Test Setup Failed
Branch — wip_sessions (a62817)
by Nils
01:12
created
includes/core/login.php 1 patch
Spacing   +35 added lines, -36 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 $lang = new Language(); 
41 41
 $get = [];
42 42
 $get['post_type'] = $request->query->get('post_type');
43
-if (isset($SETTINGS['duo']) === true && (int) $SETTINGS['duo'] === 1 && $get['post_type'] === 'duo' ) {
43
+if (isset($SETTINGS['duo']) === true && (int) $SETTINGS['duo'] === 1 && $get['post_type'] === 'duo') {
44 44
     $get['duo_state'] = $request->query->get('state');
45 45
     $get['duo_code'] = $request->query->get('duo_code');
46 46
 }
@@ -50,8 +50,7 @@  discard block
 block discarded – undo
50 50
 <div class="login-box">
51 51
     <div class="login-logo"><div style="margin:30px;">',
52 52
     isset($SETTINGS['custom_logo']) === true && empty($SETTINGS['custom_logo']) === false ?
53
-        '<img src="' . (string) $SETTINGS['custom_logo'] . '" alt="" style="text-align:center; max-width:100px;" />' :
54
-        '<img src="includes/images/teampass-logo2-login.png" alt="Teampass Logo">',
53
+        '<img src="'.(string) $SETTINGS['custom_logo'].'" alt="" style="text-align:center; max-width:100px;" />' : '<img src="includes/images/teampass-logo2-login.png" alt="Teampass Logo">',
55 54
         '
56 55
         </div>
57 56
         <div style="font-weight:bold;">
@@ -71,14 +70,14 @@  discard block
 block discarded – undo
71 70
 
72 71
         <div class="card-body login-card-body1">
73 72
             <div class="input-group has-feedback mb-2">
74
-                <div class="input-group-prepend infotip" title="' . $lang->get('login') . '">
73
+                <div class="input-group-prepend infotip" title="' . $lang->get('login').'">
75 74
                     <span class="input-group-text"><i class="fa-solid fa-user fa-fw"></i></span>
76 75
                 </div>';
77 76
 if (
78 77
     isset($SETTINGS['enable_http_request_login']) === true
79 78
     && (int) $SETTINGS['enable_http_request_login'] === 1
80 79
     && $request->server->get('PHP_AUTH_USER') !== null
81
-    && ! (isset($SETTINGS['maintenance_mode']) === true
80
+    && !(isset($SETTINGS['maintenance_mode']) === true
82 81
         && (int) $SETTINGS['maintenance_mode'] === 1)
83 82
 ) {
84 83
     if (strpos($request->server->get('PHP_AUTH_USER'), '@') !== false) {
@@ -92,32 +91,32 @@  discard block
 block discarded – undo
92 91
             <input type="text" id="login" class="form-control" placeholder="', filter_var($username, FILTER_SANITIZE_FULL_SPECIAL_CHARS), '" readonly>';
93 92
 } else {
94 93
     echo '
95
-            <input type="text" id="login" class="form-control" placeholder="' . $lang->get('index_login') . '" value="'.(null !== $session->get('user-login') && empty($session->get('user-login')) === false ? filter_var($session->get('user-login'), FILTER_SANITIZE_FULL_SPECIAL_CHARS) : '').'">';
94
+            <input type="text" id="login" class="form-control" placeholder="' . $lang->get('index_login').'" value="'.(null !== $session->get('user-login') && empty($session->get('user-login')) === false ? filter_var($session->get('user-login'), FILTER_SANITIZE_FULL_SPECIAL_CHARS) : '').'">';
96 95
 }
97 96
 
98 97
 echo '
99 98
         </div>';
100
-if (! (isset($SETTINGS['enable_http_request_login']) === true
99
+if (!(isset($SETTINGS['enable_http_request_login']) === true
101 100
     && (int) $SETTINGS['enable_http_request_login'] === 1
102 101
     && $request->server->get('PHP_AUTH_USER') !== null
103
-    && ! (isset($SETTINGS['maintenance_mode']) === true
102
+    && !(isset($SETTINGS['maintenance_mode']) === true
104 103
         && (int) $SETTINGS['maintenance_mode'] === 1))) {
105 104
     echo '
106 105
         <div class="input-group has-feedback mb-2">
107
-            <div class="input-group-prepend infotip" title="' . $lang->get('password') . '">
106
+            <div class="input-group-prepend infotip" title="' . $lang->get('password').'">
108 107
                 <span class="input-group-text"><i class="fa-solid fa-lock fa-fw"></i></span>
109 108
             </div>
110
-            <input type="password" id="pw" class="form-control submit-button" placeholder="' . $lang->get('index_password') . '">
109
+            <input type="password" id="pw" class="form-control submit-button" placeholder="' . $lang->get('index_password').'">
111 110
         </div>';
112 111
 }
113 112
 
114 113
 echo '
115 114
         <div class="input-group has-feedback mb-2">
116
-            <div class="input-group-prepend infotip" title="' . $lang->get('session_expiration_in_minutes') . '">
115
+            <div class="input-group-prepend infotip" title="' . $lang->get('session_expiration_in_minutes').'">
117 116
                 <span class="input-group-text"><i class="fa-solid fa-clock fa-fw"></i></span>
118 117
             </div>
119 118
             <input type="text" id="session_duration" class="form-control submit-button" 
120
-            placeholder="' . $lang->get('index_session_duration') .'&nbsp;(' . $lang->get('minutes') . ')" 
119
+            placeholder="' . $lang->get('index_session_duration').'&nbsp;('.$lang->get('minutes').')" 
121 120
             value="', isset($SETTINGS['default_session_expiration_time']) === true ? $SETTINGS['default_session_expiration_time'] : '', '">
122 121
         </div>';
123 122
 // 2FA auth selector
@@ -127,7 +126,7 @@  discard block
 block discarded – undo
127 126
         <input type="hidden" id="duo_state" value="', isset($get['duo_state']) === true && is_null($get['duo_state']) === false ? $get['duo_state'] : '', '">
128 127
         <div class="row mb-3 hidden" id="2fa_methods_selector">
129 128
             <div class="col-12">
130
-                <h8 class="login-box-msg">' . $lang->get('2fa_authentication_selector') . '</h8>
129
+                <h8 class="login-box-msg">' . $lang->get('2fa_authentication_selector').'</h8>
131 130
                 <div class="2fa-methods text-center mt-2">',
132 131
     isset($SETTINGS['google_authentication']) === true && (int) $SETTINGS['google_authentication'] === 1 ?
133 132
         '
@@ -161,14 +160,14 @@  discard block
 block discarded – undo
161 160
     echo '
162 161
         <div id="div-2fa-google" class="mb-3 div-2fa-method hidden">
163 162
             <div class="input-group has-feedback mb-2">
164
-                <div class="input-group-prepend infotip" title="' . $lang->get('mfa_unique_code') . '">
163
+                <div class="input-group-prepend infotip" title="' . $lang->get('mfa_unique_code').'">
165 164
                     <span class="input-group-text"><i class="fa-solid fa-key fa-fw"></i></span>
166 165
                 </div>
167
-                <input type="text" id="ga_code" class="form-control submit-button" placeholder="' . $lang->get('ga_identification_code') . '" />
166
+                <input type="text" id="ga_code" class="form-control submit-button" placeholder="' . $lang->get('ga_identification_code').'" />
168 167
                 <span class="input-group-append">
169 168
                     <button type="button" class="btn btn-info btn-flat" onclick="send_user_new_temporary_ga_code()">
170 169
                         <i class="fa-solid fa-envelope form-control-feedback pointer infotip" 
171
-                    title="' . $lang->get('i_need_to_generate_new_ga_code') . '"></i>
170
+                    title="' . $lang->get('i_need_to_generate_new_ga_code').'"></i>
172 171
                     </button>
173 172
                 </span>
174 173
             </div>
@@ -186,7 +185,7 @@  discard block
 block discarded – undo
186 185
 <script>
187 186
 var seconds = 1;
188 187
 function updateLogonButton(timeToGo){
189
-    document.getElementById("but_identify_user").value = "' . $lang->get('duration_login_attempt') . ' " + timeToGo;
188
+    document.getElementById("but_identify_user").value = "' . $lang->get('duration_login_attempt').' " + timeToGo;
190 189
 }
191 190
 $( window ).on( "load", function() {
192 191
     updateLogonButton(seconds);
@@ -195,7 +194,7 @@  discard block
 block discarded – undo
195 194
         if (seconds >= 0) {
196 195
             updateLogonButton(seconds);
197 196
         } else if(seconds === 0) {
198
-            launchIdentify("", "' . $nextUrl . '");
197
+            launchIdentify("", "' . $nextUrl.'");
199 198
         }
200 199
         updateLogonButton(seconds);
201 200
     },
@@ -216,15 +215,15 @@  discard block
 block discarded – undo
216 215
             <div class="col-8">
217 216
                 <div id="yubiko-new-key" class="alert alert-info hidden">
218 217
                     <p>
219
-                        <input type="text" size="10" id="yubico_user_id" class="form-control" placeholder="' . $lang->get('yubico_user_id') . '">
218
+                        <input type="text" size="10" id="yubico_user_id" class="form-control" placeholder="' . $lang->get('yubico_user_id').'">
220 219
                     </p>
221 220
                     <p>
222
-                    <input type="text" size="10" id="yubico_user_key" class="form-control" placeholder="' . $lang->get('yubico_user_key') . '">
221
+                    <input type="text" size="10" id="yubico_user_key" class="form-control" placeholder="' . $lang->get('yubico_user_key').'">
223 222
                     </p>
224 223
                 </div>
225
-                <input autocomplete="off" type="text" id="yubico_key" class="form-control submit-button" placeholder="' . $lang->get('press_your_yubico_key') . '">
224
+                <input autocomplete="off" type="text" id="yubico_key" class="form-control submit-button" placeholder="' . $lang->get('press_your_yubico_key').'">
226 225
                 <div class="row">
227
-                    <span class="ml-2 mt-1 font-weight-light small pointer" id="register-yubiko-key">' . $lang->get('register_new_yubiko_key') . '</span>
226
+                    <span class="ml-2 mt-1 font-weight-light small pointer" id="register-yubiko-key">' . $lang->get('register_new_yubiko_key').'</span>
228 227
                 </div>
229 228
             </div>
230 229
         </div>';
@@ -233,22 +232,22 @@  discard block
 block discarded – undo
233 232
 echo '
234 233
         <div class="row mb-3 mt-5">
235 234
             <div class="col-12">
236
-                <button id="but_identify_user" class="btn btn-primary btn-block">' . $lang->get('log_in') . '</button>
235
+                <button id="but_identify_user" class="btn btn-primary btn-block">' . $lang->get('log_in').'</button>
237 236
                 
238 237
                 <!-- In case of upgrade, the user has to provide his One Time Code -->
239 238
                 <div class="card-body user-one-time-code-card-body hidden">
240
-                    <h5 class="login-box-msg">' . $lang->get('provide_personal_one_time_code') . '</h5>
239
+                    <h5 class="login-box-msg">' . $lang->get('provide_personal_one_time_code').'</h5>
241 240
 
242 241
                     <div class="input-group has-feedback mb-2 mt-4">
243 242
                         <div class="input-group-prepend">
244 243
                             <span class="input-group-text"><i class="fa-solid fa-unlock-alt"></i></span>
245 244
                         </div>
246
-                        <input type="password" id="user-one-time-code" class="form-control" placeholder="' . $lang->get('one_time_code') . '">
245
+                        <input type="password" id="user-one-time-code" class="form-control" placeholder="' . $lang->get('one_time_code').'">
247 246
                     </div>
248 247
 
249 248
                     <div class="row mb-3">
250 249
                         <div class="col-12">
251
-                            <button id="but_confirm_otc" class="btn btn-primary btn-block">' . $lang->get('confirm') . '</button>
250
+                            <button id="but_confirm_otc" class="btn btn-primary btn-block">' . $lang->get('confirm').'</button>
252 251
                         </div>
253 252
                     </div>
254 253
                 </div>
@@ -263,10 +262,10 @@  discard block
 block discarded – undo
263 262
 // In case of password change
264 263
 echo '
265 264
     <div class="card-body confirm-password-card-body hidden">
266
-        <h5 class="login-box-msg">' . $lang->get('new_password_required') . '</h5>
265
+        <h5 class="login-box-msg">' . $lang->get('new_password_required').'</h5>
267 266
 
268 267
         <div class="alert alert-info">
269
-            <div class="text-center"><i class="icon fa fa-info"></i>' . $lang->get('password_strength') . '
268
+            <div class="text-center"><i class="icon fa fa-info"></i>' . $lang->get('password_strength').'
270 269
             <span id="confirm-password-level" class="ml-2 font-weight-bold"></span></div>
271 270
         </div>
272 271
 
@@ -276,20 +275,20 @@  discard block
 block discarded – undo
276 275
                     <div class="input-group-prepend">
277 276
                         <span class="input-group-text"><i class="fas fa-key"></i></span>
278 277
                     </div>
279
-                    <input type="password" id="current-user-password" class="form-control" placeholder="' . $lang->get('current_password') . '">
278
+                    <input type="password" id="current-user-password" class="form-control" placeholder="' . $lang->get('current_password').'">
280 279
                 </div>
281 280
             </div>
282 281
             <div class="input-group has-feedback mb-2 mt-4">
283 282
                 <div class="input-group-prepend">
284 283
                     <span class="input-group-text"><i class="fas fa-key"></i></span>
285 284
                 </div>
286
-                <input type="password" id="new-user-password" class="form-control" placeholder="' . $lang->get('index_new_pw') . '">
285
+                <input type="password" id="new-user-password" class="form-control" placeholder="' . $lang->get('index_new_pw').'">
287 286
             </div>
288 287
             <div class="input-group has-feedback mb-2">
289 288
                 <div class="input-group-prepend">
290 289
                     <span class="input-group-text"><i class="fas fa-key"></i></span>
291 290
                 </div>
292
-                <input type="password" id="new-user-password-confirm" class="form-control" placeholder="' . $lang->get('index_change_pw_confirmation') . '">
291
+                <input type="password" id="new-user-password-confirm" class="form-control" placeholder="' . $lang->get('index_change_pw_confirmation').'">
293 292
             </div>
294 293
             <div class="row mb-3">
295 294
                 <div class="col-md-12 offset-sm-4 text-center">
@@ -300,7 +299,7 @@  discard block
 block discarded – undo
300 299
             </div>
301 300
             <div class="row mb-3">
302 301
                 <div class="col-12">
303
-                    <button id="but_confirm_new_password" class="btn btn-primary btn-block">' . $lang->get('confirm') . '</button>
302
+                    <button id="but_confirm_new_password" class="btn btn-primary btn-block">' . $lang->get('confirm').'</button>
304 303
                 </div>
305 304
             </div>
306 305
         </div>
@@ -308,20 +307,20 @@  discard block
 block discarded – undo
308 307
 
309 308
     <div class="card-body hidden" id="card-user-treat-psk">
310 309
         <div class="alert alert-info">
311
-            <div class="text-center"><i class="icon fa fa-info"></i>' . $lang->get('user_has_psk_info') . '</div>
310
+            <div class="text-center"><i class="icon fa fa-info"></i>' . $lang->get('user_has_psk_info').'</div>
312 311
         </div>
313 312
         <div class="input-group has-feedback mb-2">
314 313
             <div class="input-group-prepend">
315 314
                 <span class="input-group-text"><i class="fas fa-key"></i></span>
316 315
             </div>
317
-            <input type="password" id="user-old-defuse-psk" class="form-control" placeholder="' . $lang->get('home_personal_saltkey') . '">
316
+            <input type="password" id="user-old-defuse-psk" class="form-control" placeholder="' . $lang->get('home_personal_saltkey').'">
318 317
         </div>
319 318
         <div class="row mb-3 mt-4">
320 319
             <div class="col-12">
321
-                <button id="but_confirm_defuse_psk" class="btn btn-primary btn-block">' . $lang->get('launch') . '</button>
320
+                <button id="but_confirm_defuse_psk" class="btn btn-primary btn-block">' . $lang->get('launch').'</button>
322 321
             </div>
323 322
             <div class="col-12 mt-3">
324
-                <button id="but_confirm_forgot_defuse_psk" class="btn btn-danger btn-block text-bold">' . $lang->get('i_cannot_remember') . '</button>
323
+                <button id="but_confirm_forgot_defuse_psk" class="btn btn-danger btn-block text-bold">' . $lang->get('i_cannot_remember').'</button>
325 324
             </div>
326 325
         </div>
327 326
     </div>
Please login to merge, or discard this patch.
includes/core/load.js.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
 
58 58
     $(document).ready(function() {
59
-        console.log('-- PAGE LOADED --'+$(location).attr('href').includes('?')+" -- <?php echo $session->get('key');?>");
59
+        console.log('-- PAGE LOADED --'+$(location).attr('href').includes('?')+" -- <?php echo $session->get('key'); ?>");
60 60
         if ($(location).attr('href').includes('?') === true && $(location).attr('href').includes('post_type') === false && (store.get('teampassUser') === undefined || parseInt(store.get('teampassUser').user_id) <= 0)) {
61 61
             $(location).attr('href', 'index.php?session=expired');
62 62
             return false;
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 
156 156
                             // Show passwords inputs and form
157 157
                             $('#dialog-user-change-password-info')
158
-                                .html('<i class="icon fa-solid fa-info mr-2"></i><?php echo $lang->get('user_has_to_change_password_info');?>')
158
+                                .html('<i class="icon fa-solid fa-info mr-2"></i><?php echo $lang->get('user_has_to_change_password_info'); ?>')
159 159
                                 .removeClass('hidden');
160 160
                             $('#dialog-user-change-password').removeClass('hidden');
161 161
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 
169 169
                             // Show passwords inputs and form
170 170
                             $('#dialog-ldap-user-change-password-info')
171
-                                .html('<i class="icon fa-solid fa-info mr-2"></i><?php echo $lang->get('ldap_user_has_changed_his_password');?>')
171
+                                .html('<i class="icon fa-solid fa-info mr-2"></i><?php echo $lang->get('ldap_user_has_changed_his_password'); ?>')
172 172
                                 .removeClass('hidden');
173 173
                             $('#dialog-ldap-user-change-password').removeClass('hidden');
174 174
                             
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
         /*console.log('User has to regenerate keys')
296 296
         // HIde
297 297
         $('.content-header, .content').addClass('hidden');
298
-        $('#dialog-user-temporary-code-info').html('<i class="icon fa-solid fa-info mr-2"></i><?php echo $lang->get('renecyption_expected');?>');
298
+        $('#dialog-user-temporary-code-info').html('<i class="icon fa-solid fa-info mr-2"></i><?php echo $lang->get('renecyption_expected'); ?>');
299 299
 
300 300
         // Show passwords inputs and form
301 301
         $('#dialog-user-temporary-code').removeClass('hidden');
@@ -377,13 +377,13 @@  discard block
 block discarded – undo
377 377
             {
378 378
                 if (step === 'psk') {
379 379
                     // Inform user
380
-                    $("#user-current-defuse-psk-progress").html('<b><?php echo $lang->get('encryption_keys'); ?> </b> [' + start + ' - ' + (parseInt(start) + <?php echo NUMBER_ITEMS_IN_BATCH;?>) + '] ' +
380
+                    $("#user-current-defuse-psk-progress").html('<b><?php echo $lang->get('encryption_keys'); ?> </b> [' + start + ' - ' + (parseInt(start) + <?php echo NUMBER_ITEMS_IN_BATCH; ?>) + '] ' +
381 381
                         '... <?php echo $lang->get('please_wait'); ?><i class="fa-solid fa-spinner fa-pulse ml-3 text-primary"></i>');
382 382
 
383 383
                     var data = {
384 384
                         'userPsk' : $('#user-current-defuse-psk').val(),
385 385
                             'start': start,
386
-                            'length': <?php echo NUMBER_ITEMS_IN_BATCH;?>,
386
+                            'length': <?php echo NUMBER_ITEMS_IN_BATCH; ?>,
387 387
                             'user_id': userId,
388 388
                     };
389 389
                     // Do query
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
 
461 461
                 // Show passwords inputs and form
462 462
                 $('#dialog-ldap-user-change-password-info')
463
-                    .html('<i class="icon fa-solid fa-info mr-2"></i><?php echo $lang->get('ldap_user_has_changed_his_password');?>')
463
+                    .html('<i class="icon fa-solid fa-info mr-2"></i><?php echo $lang->get('ldap_user_has_changed_his_password'); ?>')
464 464
                     .removeClass('hidden');
465 465
                 $('#dialog-ldap-user-change-password').removeClass('hidden');
466 466
 
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
                                 '</div>' +
550 550
                             '</div>' +
551 551
                         '</div>' +
552
-                        '<div class="row mt-2<?php echo isset($SETTINGS['enable_pf_feature']) === true && (int) $SETTINGS['enable_pf_feature'] === 1  ? '' : ' hidden'; ?>">' +
552
+                        '<div class="row mt-2<?php echo isset($SETTINGS['enable_pf_feature']) === true && (int) $SETTINGS['enable_pf_feature'] === 1 ? '' : ' hidden'; ?>">' +
553 553
                             '<h6><?php echo $lang->get('provide_recovery_keys'); ?></h6>' +
554 554
                             '<div class="input-group mb-2">' +
555 555
                                 '<div class="input-group-prepend">' +
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
                                 '<textarea rows="2" id="recovery-private-key" class="form-control form-item-control"></textarea>' +
565 565
                             '</div>' +
566 566
                         '</div>' +
567
-                        '<div class="row mt-2<?php echo isset($SETTINGS['enable_pf_feature']) === true && (int) $SETTINGS['enable_pf_feature'] === 1  ? '' : ' hidden'; ?>">' +
567
+                        '<div class="row mt-2<?php echo isset($SETTINGS['enable_pf_feature']) === true && (int) $SETTINGS['enable_pf_feature'] === 1 ? '' : ' hidden'; ?>">' +
568 568
                             '<div class="alert" id="confirm-no-recovery-keys-div">' +
569 569
                                 '<div class="form-check">' +
570 570
                                     '<input type="checkbox" class="form-check-input" id="confirm-no-recovery-keys">' +
@@ -1178,15 +1178,15 @@  discard block
 block discarded – undo
1178 1178
             // Prepare data
1179 1179
             var data = {
1180 1180
                 'receipt': $('#temp-user-email').val(),
1181
-                'subject': '[Teampass] <?php echo $lang->get('your_new_password');?>',
1182
-                'body': '<?php echo $lang->get('email_body_temporary_login_password');?>',
1181
+                'subject': '[Teampass] <?php echo $lang->get('your_new_password'); ?>',
1182
+                'body': '<?php echo $lang->get('email_body_temporary_login_password'); ?>',
1183 1183
                 'pre_replace' : {
1184 1184
                     '#enc_code#' : $('#temp-user-pwd').val(),
1185 1185
                 }
1186 1186
             }
1187 1187
             if (debugJavascript === true) console.log(data);
1188 1188
             // Prepare form
1189
-            $('#dialog-admin-change-user-password-info').html('<?php echo $lang->get('sending_email_message');?>');
1189
+            $('#dialog-admin-change-user-password-info').html('<?php echo $lang->get('sending_email_message'); ?>');
1190 1190
             toastr.remove();
1191 1191
             toastr.info(
1192 1192
                 '<?php echo $lang->get('in_progress'); ?><i class="fa-solid fa-circle-notch fa-spin fa-2x ml-3"></i>'
@@ -1706,7 +1706,7 @@  discard block
 block discarded – undo
1706 1706
                         '#warningModal',
1707 1707
                         '<i class="fa-solid fa-clock fa-lg warning mr-2"></i><?php echo $lang->get('index_add_one_hour'); ?>',
1708 1708
                         '<div class="form-group">' +
1709
-                        '<label for="warningModal-input" class="col-form-label"><?php echo $lang->get('extend_session_duration_by') . ' (' . $lang->get('minutes') . ')'; ?>:</label>' +
1709
+                        '<label for="warningModal-input" class="col-form-label"><?php echo $lang->get('extend_session_duration_by').' ('.$lang->get('minutes').')'; ?>:</label>' +
1710 1710
                         '<input type="number" max="'+(60*60*24)+'" class="form-control" id="warningModal-input" value="60">' +
1711 1711
                         '</div>' +
1712 1712
                         '<div class="form-text text-muted"><i class=\"fa-solid fa-info-circle mr-2\"></i><?php echo $lang->get('maximum_session_expiration_time'); ?>: '+data.max_session_duration+'</div>',
Please login to merge, or discard this patch.
scripts/background_tasks___user_keys_creation.php 1 patch
Spacing   +43 added lines, -44 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 DB::debugmode(false);
68 68
 $process_to_perform = DB::queryfirstrow(
69 69
     'SELECT *
70
-    FROM ' . prefixTable('processes') . '
70
+    FROM ' . prefixTable('processes').'
71 71
     WHERE is_in_progress = %i AND process_type = %s
72 72
     ORDER BY increment_id ASC',
73 73
     1,
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     // search for next process to handle
88 88
     $process_to_perform = DB::queryfirstrow(
89 89
         'SELECT *
90
-        FROM ' . prefixTable('processes') . '
90
+        FROM ' . prefixTable('processes').'
91 91
         WHERE is_in_progress = %i AND finished_at = "" AND process_type = %s
92 92
         ORDER BY increment_id ASC',
93 93
         0,
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
             $process_to_perform['increment_id']
106 106
         );
107 107
 
108
-        provideLog('[PROCESS][#'. $process_to_perform['increment_id'].'][START]', $SETTINGS);
108
+        provideLog('[PROCESS][#'.$process_to_perform['increment_id'].'][START]', $SETTINGS);
109 109
         handleTask(
110 110
             $process_to_perform['increment_id'],
111 111
             json_decode($process_to_perform['arguments'], true),
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 // launch a new iterative process
121 121
 $process_to_perform = DB::queryfirstrow(
122 122
     'SELECT *
123
-    FROM ' . prefixTable('processes') . '
123
+    FROM ' . prefixTable('processes').'
124 124
     WHERE is_in_progress = %i AND process_type = %s
125 125
     ORDER BY increment_id ASC',
126 126
     1,
@@ -144,11 +144,11 @@  discard block
 block discarded – undo
144 144
  */
145 145
 function handleTask(int $processId, array $ProcessArguments, array $SETTINGS): bool
146 146
 {
147
-    provideLog('[PROCESS][#'. $processId.'][START]', $SETTINGS);
147
+    provideLog('[PROCESS][#'.$processId.'][START]', $SETTINGS);
148 148
     //DB::debugmode(false);
149 149
     $task_to_perform = DB::queryfirstrow(
150 150
         'SELECT *
151
-        FROM ' . prefixTable('processes_tasks') . '
151
+        FROM ' . prefixTable('processes_tasks').'
152 152
         WHERE process_id = %i AND finished_at IS NULL
153 153
         ORDER BY increment_id ASC',
154 154
         $processId
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
         // check if a linux process is not currently on going
164 164
         // if sub_task_in_progress === 1 then exit
165 165
         if ((int) $task_to_perform['sub_task_in_progress'] === 0) {
166
-            provideLog('[TASK][#'. $task_to_perform['increment_id'].'][START]', $SETTINGS);
166
+            provideLog('[TASK][#'.$task_to_perform['increment_id'].'][START]', $SETTINGS);
167 167
 
168 168
             // handle next task
169 169
             $args = json_decode($task_to_perform['task'], true);
@@ -216,10 +216,9 @@  discard block
 block discarded – undo
216 216
             DB::update(
217 217
                 prefixTable('processes_tasks'),
218 218
                 array(
219
-                    'sub_task_in_progress' => 0,    // flag sub task is no more in prgoress
219
+                    'sub_task_in_progress' => 0, // flag sub task is no more in prgoress
220 220
                     'task' => $taskStatus['new_action'] !== $args['step'] ? 
221
-                    json_encode(["status" => "Done"]) :
222
-                    json_encode([
221
+                    json_encode(["status" => "Done"]) : json_encode([
223 222
                         "step" => $taskStatus['new_action'],
224 223
                         "index" => $taskStatus['new_index'],
225 224
                         "nb" => isset($SETTINGS['maximum_number_of_items_to_treat']) === true ? $SETTINGS['maximum_number_of_items_to_treat'] : $args['nb'],
@@ -255,7 +254,7 @@  discard block
 block discarded – undo
255 254
 
256 255
         } else {
257 256
             // Task is currently being in progress by another server process
258
-            provideLog('[TASK][#'. $task_to_perform['increment_id'].'][WARNING] Similar task already being processes', $SETTINGS);
257
+            provideLog('[TASK][#'.$task_to_perform['increment_id'].'][WARNING] Similar task already being processes', $SETTINGS);
259 258
             return false;
260 259
         }
261 260
     }
@@ -288,7 +287,7 @@  discard block
 block discarded – undo
288 287
         // Check if user exists
289 288
         $userInfo = DB::queryFirstRow(
290 289
             'SELECT public_key, private_key
291
-            FROM ' . prefixTable('users') . '
290
+            FROM ' . prefixTable('users').'
292 291
             WHERE id = %i',
293 292
             $post_user_id
294 293
         );
@@ -417,13 +416,13 @@  discard block
 block discarded – undo
417 416
 {
418 417
     $userInfo = DB::queryFirstRow(
419 418
         'SELECT pw, public_key, private_key, login, name
420
-        FROM ' . prefixTable('users') . '
419
+        FROM ' . prefixTable('users').'
421 420
         WHERE id = %i',
422 421
         $owner_id
423 422
     );
424 423
     
425 424
     // decrypt owner password
426
-    $pwd = cryption($owner_pwd, '','decrypt', $SETTINGS)['string'];
425
+    $pwd = cryption($owner_pwd, '', 'decrypt', $SETTINGS)['string'];
427 426
     provideLog('[USER][INFO] ID:'.$owner_id, $SETTINGS);
428 427
     //provideLog('[DEBUG] '.$pwd." -- ", $SETTINGS);
429 428
     // decrypt private key and send back
@@ -462,17 +461,17 @@  discard block
 block discarded – undo
462 461
     // Loop on items
463 462
     $rows = DB::query(
464 463
         'SELECT id, pw, perso
465
-        FROM ' . prefixTable('items') . '
464
+        FROM ' . prefixTable('items').'
466 465
         '.(isset($extra_arguments['only_personal_items']) === true && $extra_arguments['only_personal_items'] === 1 ? 'WHERE perso = 1' : '').'
467 466
         ORDER BY id ASC
468
-        LIMIT ' . $post_start . ', ' . $post_length
467
+        LIMIT ' . $post_start.', '.$post_length
469 468
     );
470 469
     //    WHERE perso = 0
471 470
     foreach ($rows as $record) {
472 471
         // Get itemKey from current user
473 472
         $currentUserKey = DB::queryFirstRow(
474 473
             'SELECT share_key, increment_id
475
-            FROM ' . prefixTable('sharekeys_items') . '
474
+            FROM ' . prefixTable('sharekeys_items').'
476 475
             WHERE object_id = %i AND user_id = %i',
477 476
             $record['id'],
478 477
             //$extra_arguments['owner_id']
@@ -501,7 +500,7 @@  discard block
 block discarded – undo
501 500
         
502 501
         $currentUserKey = DB::queryFirstRow(
503 502
             'SELECT increment_id
504
-            FROM ' . prefixTable('sharekeys_items') . '
503
+            FROM ' . prefixTable('sharekeys_items').'
505 504
             WHERE object_id = %i AND user_id = %i',
506 505
             $record['id'],
507 506
             $post_user_id
@@ -572,15 +571,15 @@  discard block
 block discarded – undo
572 571
     // Loop on logs
573 572
     $rows = DB::query(
574 573
         'SELECT increment_id
575
-        FROM ' . prefixTable('log_items') . '
574
+        FROM ' . prefixTable('log_items').'
576 575
         WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"
577
-        LIMIT ' . $post_start . ', ' . $post_length
576
+        LIMIT ' . $post_start.', '.$post_length
578 577
     );
579 578
     foreach ($rows as $record) {
580 579
         // Get itemKey from current user
581 580
         $currentUserKey = DB::queryFirstRow(
582 581
             'SELECT share_key
583
-            FROM ' . prefixTable('sharekeys_logs') . '
582
+            FROM ' . prefixTable('sharekeys_logs').'
584 583
             WHERE object_id = %i AND user_id = %i',
585 584
             $record['increment_id'],
586 585
             $extra_arguments['owner_id']
@@ -612,7 +611,7 @@  discard block
 block discarded – undo
612 611
             if ((int) $post_user_id !== (int) $extra_arguments['owner_id']) {
613 612
                 $currentUserKey = DB::queryFirstRow(
614 613
                     'SELECT increment_id
615
-                    FROM ' . prefixTable('sharekeys_items') . '
614
+                    FROM ' . prefixTable('sharekeys_items').'
616 615
                     WHERE object_id = %i AND user_id = %i',
617 616
                     $record['id'],
618 617
                     $post_user_id
@@ -634,7 +633,7 @@  discard block
 block discarded – undo
634 633
     // SHould we change step?
635 634
     DB::query(
636 635
         'SELECT increment_id
637
-        FROM ' . prefixTable('log_items') . '
636
+        FROM ' . prefixTable('log_items').'
638 637
         WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"'
639 638
     );
640 639
 
@@ -674,15 +673,15 @@  discard block
 block discarded – undo
674 673
     // Loop on fields
675 674
     $rows = DB::query(
676 675
         'SELECT id
677
-        FROM ' . prefixTable('categories_items') . '
676
+        FROM ' . prefixTable('categories_items').'
678 677
         WHERE encryption_type = "teampass_aes"
679
-        LIMIT ' . $post_start . ', ' . $post_length
678
+        LIMIT ' . $post_start.', '.$post_length
680 679
     );
681 680
     foreach ($rows as $record) {
682 681
         // Get itemKey from current user
683 682
         $currentUserKey = DB::queryFirstRow(
684 683
             'SELECT share_key
685
-            FROM ' . prefixTable('sharekeys_fields') . '
684
+            FROM ' . prefixTable('sharekeys_fields').'
686 685
             WHERE object_id = %i AND user_id = %i',
687 686
             $record['id'],
688 687
             $extra_arguments['owner_id']
@@ -710,7 +709,7 @@  discard block
 block discarded – undo
710 709
                 if ((int) $post_user_id !== (int) $extra_arguments['owner_id']) {
711 710
                     $currentUserKey = DB::queryFirstRow(
712 711
                         'SELECT increment_id
713
-                        FROM ' . prefixTable('sharekeys_items') . '
712
+                        FROM ' . prefixTable('sharekeys_items').'
714 713
                         WHERE object_id = %i AND user_id = %i',
715 714
                         $record['id'],
716 715
                         $post_user_id
@@ -733,7 +732,7 @@  discard block
 block discarded – undo
733 732
     // SHould we change step?
734 733
     DB::query(
735 734
         'SELECT *
736
-        FROM ' . prefixTable('categories_items') . '
735
+        FROM ' . prefixTable('categories_items').'
737 736
         WHERE encryption_type = "teampass_aes"'
738 737
     );
739 738
 
@@ -773,14 +772,14 @@  discard block
 block discarded – undo
773 772
     // Loop on suggestions
774 773
     $rows = DB::query(
775 774
         'SELECT id
776
-        FROM ' . prefixTable('suggestion') . '
777
-        LIMIT ' . $post_start . ', ' . $post_length
775
+        FROM ' . prefixTable('suggestion').'
776
+        LIMIT ' . $post_start.', '.$post_length
778 777
     );
779 778
     foreach ($rows as $record) {
780 779
         // Get itemKey from current user
781 780
         $currentUserKey = DB::queryFirstRow(
782 781
             'SELECT share_key
783
-            FROM ' . prefixTable('sharekeys_suggestions') . '
782
+            FROM ' . prefixTable('sharekeys_suggestions').'
784 783
             WHERE object_id = %i AND user_id = %i',
785 784
             $record['id'],
786 785
             $extra_arguments['owner_id']
@@ -812,7 +811,7 @@  discard block
 block discarded – undo
812 811
             if ((int) $post_user_id !== (int) $extra_arguments['owner_id']) {
813 812
                 $currentUserKey = DB::queryFirstRow(
814 813
                     'SELECT increment_id
815
-                    FROM ' . prefixTable('sharekeys_items') . '
814
+                    FROM ' . prefixTable('sharekeys_items').'
816 815
                     WHERE object_id = %i AND user_id = %i',
817 816
                     $record['id'],
818 817
                     $post_user_id
@@ -872,16 +871,16 @@  discard block
 block discarded – undo
872 871
     // Loop on files
873 872
     $rows = DB::query(
874 873
         'SELECT f.id AS id, i.perso AS perso
875
-        FROM ' . prefixTable('files') . ' AS f
876
-        INNER JOIN ' . prefixTable('items') . ' AS i ON i.id = f.id_item
877
-        WHERE f.status = "' . TP_ENCRYPTION_NAME . '"
878
-        LIMIT ' . $post_start . ', ' . $post_length
874
+        FROM ' . prefixTable('files').' AS f
875
+        INNER JOIN ' . prefixTable('items').' AS i ON i.id = f.id_item
876
+        WHERE f.status = "' . TP_ENCRYPTION_NAME.'"
877
+        LIMIT ' . $post_start.', '.$post_length
879 878
     ); //aes_encryption
880 879
     foreach ($rows as $record) {
881 880
         // Get itemKey from current user
882 881
         $currentUserKey = DB::queryFirstRow(
883 882
             'SELECT share_key, increment_id
884
-            FROM ' . prefixTable('sharekeys_files') . '
883
+            FROM ' . prefixTable('sharekeys_files').'
885 884
             WHERE object_id = %i AND user_id = %i',
886 885
             $record['id'],
887 886
             (int) $record['perso'] === 0 ? $extra_arguments['owner_id'] : $extra_arguments['new_user_id']
@@ -909,7 +908,7 @@  discard block
 block discarded – undo
909 908
 
910 909
         $currentUserKey = DB::queryFirstRow(
911 910
             'SELECT increment_id
912
-            FROM ' . prefixTable('sharekeys_files') . '
911
+            FROM ' . prefixTable('sharekeys_files').'
913 912
             WHERE object_id = %i AND user_id = %i',
914 913
             $record['id'],
915 914
             $post_user_id
@@ -971,8 +970,8 @@  discard block
 block discarded – undo
971 970
     // SHould we change step? Finished ?
972 971
     DB::query(
973 972
         'SELECT *
974
-        FROM ' . prefixTable('files') . '
975
-        WHERE status = "' . TP_ENCRYPTION_NAME . '"'
973
+        FROM ' . prefixTable('files').'
974
+        WHERE status = "' . TP_ENCRYPTION_NAME.'"'
976 975
     );
977 976
     $counter = DB::count();
978 977
     $next_start = (int) $post_start + (int) $post_length;
@@ -1038,7 +1037,7 @@  discard block
 block discarded – undo
1038 1037
     // get user info
1039 1038
     $userInfo = DB::queryFirstRow(
1040 1039
         'SELECT email, login, auth_type, special, lastname, name
1041
-        FROM ' . prefixTable('users') . '
1040
+        FROM ' . prefixTable('users').'
1042 1041
         WHERE id = %i',
1043 1042
         $extra_arguments['new_user_id']
1044 1043
     );
@@ -1052,13 +1051,13 @@  discard block
 block discarded – undo
1052 1051
         sendMailToUser(
1053 1052
             filter_var($userInfo['email'], FILTER_SANITIZE_FULL_SPECIAL_CHARS),
1054 1053
             empty($extra_arguments['email_body']) === false ? $extra_arguments['email_body'] : $lang->get('email_body_user_config_1'),
1055
-            'TEAMPASS - ' . $lang->get('login_credentials'),
1054
+            'TEAMPASS - '.$lang->get('login_credentials'),
1056 1055
             (array) filter_var_array(
1057 1056
                 [
1058
-                    '#code#' => cryption($extra_arguments['new_user_code'], '','decrypt', $SETTINGS)['string'],
1057
+                    '#code#' => cryption($extra_arguments['new_user_code'], '', 'decrypt', $SETTINGS)['string'],
1059 1058
                     '#lastname#' => isset($userInfo['name']) === true ? $userInfo['name'] : '',
1060 1059
                     '#login#' => isset($userInfo['login']) === true ? $userInfo['login'] : '',
1061
-                    '#password#' => cryption($extra_arguments['new_user_pwd'], '','decrypt', $SETTINGS)['string'],
1060
+                    '#password#' => cryption($extra_arguments['new_user_pwd'], '', 'decrypt', $SETTINGS)['string'],
1062 1061
                 ],
1063 1062
                 FILTER_SANITIZE_FULL_SPECIAL_CHARS
1064 1063
             )
Please login to merge, or discard this patch.
sources/downloadFile.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 ) {
74 74
     // Not allowed page
75 75
     $session->set('system-error_code', ERR_NOT_ALLOWED);
76
-    include $SETTINGS['cpassman_dir'] . '/error.php';
76
+    include $SETTINGS['cpassman_dir'].'/error.php';
77 77
     exit;
78 78
 }
79 79
 
@@ -94,19 +94,19 @@  discard block
 block discarded – undo
94 94
 $get_pathIsFiles = $request->query->get('pathIsFiles');
95 95
 
96 96
 // prepare Encryption class calls
97
-header('Content-disposition: attachment; filename=' . rawurldecode(basename($get_filename)));
97
+header('Content-disposition: attachment; filename='.rawurldecode(basename($get_filename)));
98 98
 header('Content-Type: application/octet-stream');
99 99
 header('Cache-Control: must-revalidate, no-cache, no-store');
100 100
 header('Expires: 0');
101 101
 if (null !== $request->query->get('pathIsFiles') && (int) $get_pathIsFiles === 1) {
102
-    readfile($SETTINGS['path_to_files_folder'] . '/' . basename($get_filename));
102
+    readfile($SETTINGS['path_to_files_folder'].'/'.basename($get_filename));
103 103
 } else {
104 104
     // get file key
105 105
     $file_info = DB::queryfirstrow(
106 106
         'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status, f.extension AS extension,
107 107
         s.share_key AS share_key
108
-        FROM ' . prefixTable('files') . ' AS f
109
-        INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id)
108
+        FROM ' . prefixTable('files').' AS f
109
+        INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id)
110 110
         WHERE s.user_id = %i AND s.object_id = %i',
111 111
         $session->get('user-id'),
112 112
         $get_fileid
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
     header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
126 126
     header('Cache-Control: private', false);
127 127
     header('Content-Type: application/octet-stream');
128
-    header('Content-Disposition: attachment; filename="' . $filename . '.' . $file_info['extension'] . '";');
128
+    header('Content-Disposition: attachment; filename="'.$filename.'.'.$file_info['extension'].'";');
129 129
     header('Content-Transfer-Encoding: binary');
130 130
     // Stream the CSV data
131 131
     exit(base64_decode($fileContent));
Please login to merge, or discard this patch.
sources/find.queries.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 ) {
71 71
     // Not allowed page
72 72
     $session->set('system-error_code', ERR_NOT_ALLOWED);
73
-    include $SETTINGS['cpassman_dir'] . '/error.php';
73
+    include $SETTINGS['cpassman_dir'].'/error.php';
74 74
     exit;
75 75
 }
76 76
 
@@ -89,12 +89,12 @@  discard block
 block discarded – undo
89 89
 if (null === $session->get('user-accessible_folders')
90 90
     || empty($session->get('user-accessible_folders')) === true
91 91
 ) {
92
-    echo '{"sEcho": ' . intval($request->query->get('sEcho')) . ' ,"iTotalRecords": "0", "iTotalDisplayRecords": "0", "aaData": [] }';
92
+    echo '{"sEcho": '.intval($request->query->get('sEcho')).' ,"iTotalRecords": "0", "iTotalDisplayRecords": "0", "aaData": [] }';
93 93
     exit;
94 94
 }
95 95
 
96 96
 //Columns name
97
-$aColumns = ['c.id', 'c.label', 'c.login', 'c.description', 'c.tags', 'c.id_tree', 'c.folder', 'c.login', 'c.url', 'ci.data'];//
97
+$aColumns = ['c.id', 'c.label', 'c.login', 'c.description', 'c.tags', 'c.id_tree', 'c.folder', 'c.login', 'c.url', 'ci.data']; //
98 98
 $aSortTypes = ['ASC', 'DESC'];
99 99
 //init SQL variables
100 100
 $sOrder = $sLimit = $sWhere = '';
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 
115 115
 //Get current user "personal folder" ID
116 116
 $row = DB::query(
117
-    'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE title = %i',
117
+    'SELECT id FROM '.prefixTable('nested_tree').' WHERE title = %i',
118 118
     intval($session->get('user-id'))
119 119
 );
120 120
 //get list of personal folders
@@ -123,20 +123,20 @@  discard block
 block discarded – undo
123 123
 $listPf = '';
124 124
 if (empty($row['id']) === false) {
125 125
     $rows = DB::query(
126
-        'SELECT id FROM ' . prefixTable('nested_tree') . '
126
+        'SELECT id FROM '.prefixTable('nested_tree').'
127 127
         WHERE personal_folder = 1 AND NOT parent_id = %i AND NOT title = %i',
128 128
         filter_var($row['id'], FILTER_SANITIZE_NUMBER_INT),
129 129
         filter_var($session->get('user-id'), FILTER_SANITIZE_NUMBER_INT)
130 130
     );
131 131
     foreach ($rows as $record) {
132
-        if (! in_array($record['id'], $arrayPf)) {
132
+        if (!in_array($record['id'], $arrayPf)) {
133 133
             //build an array of personal folders ids
134 134
             array_push($arrayPf, $record['id']);
135 135
             //build also a string with those ids
136 136
             if (empty($listPf)) {
137 137
                 $listPf = $record['id'];
138 138
             } else {
139
-                $listPf .= ', ' . $record['id'];
139
+                $listPf .= ', '.$record['id'];
140 140
             }
141 141
         }
142 142
     }
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 //Paging
147 147
 $sLimit = '';
148 148
 if (null !== $request->query->get('start') && $request->query->get('length') !== '-1') {
149
-    $sLimit = 'LIMIT ' . $request->query->filter('start', null, FILTER_SANITIZE_NUMBER_INT) . ', ' . $request->query->filter('length', null, FILTER_SANITIZE_NUMBER_INT) . '';
149
+    $sLimit = 'LIMIT '.$request->query->filter('start', null, FILTER_SANITIZE_NUMBER_INT).', '.$request->query->filter('length', null, FILTER_SANITIZE_NUMBER_INT).'';
150 150
 }
151 151
 
152 152
 //Ordering
@@ -160,8 +160,8 @@  discard block
 block discarded – undo
160 160
     }
161 161
     $sOrder = 'ORDER BY  ';
162 162
     if ($orderParam[0]['column'] >= 0) {
163
-        $sOrder .= '' . $aColumns[filter_var($orderParam[0]['column'], FILTER_SANITIZE_NUMBER_INT)] . ' '
164
-                . filter_var($orderParam[0]['dir'], FILTER_SANITIZE_FULL_SPECIAL_CHARS) . ', ';
163
+        $sOrder .= ''.$aColumns[filter_var($orderParam[0]['column'], FILTER_SANITIZE_NUMBER_INT)].' '
164
+                . filter_var($orderParam[0]['dir'], FILTER_SANITIZE_FULL_SPECIAL_CHARS).', ';
165 165
     }
166 166
 
167 167
     $sOrder = substr_replace($sOrder, '', -2);
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
         $sOrder = '';
170 170
     }
171 171
 } else {
172
-    $sOrder = 'ORDER BY ' . $aColumns[1] . ' ASC';
172
+    $sOrder = 'ORDER BY '.$aColumns[1].' ASC';
173 173
 }
174 174
 
175 175
 // Define criteria
@@ -190,9 +190,9 @@  discard block
 block discarded – undo
190 190
 if (empty($search_criteria) === false) {
191 191
     $sWhere .= ' AND (';
192 192
     for ($i = 0; $i < count($aColumns); ++$i) {
193
-        $sWhere .= $aColumns[$i] . ' LIKE %ss_' . $i . ' OR ';
193
+        $sWhere .= $aColumns[$i].' LIKE %ss_'.$i.' OR ';
194 194
     }
195
-    $sWhere = substr_replace((string) $sWhere, '', -3) . ') ';
195
+    $sWhere = substr_replace((string) $sWhere, '', -3).') ';
196 196
     $crit = [
197 197
         'idtree' => array_unique($folders),
198 198
         '0' => $search_criteria,
@@ -232,16 +232,16 @@  discard block
 block discarded – undo
232 232
     if (empty($sWhere) === false) {
233 233
         $sWhere .= ' AND ';
234 234
     }
235
-    $sWhere = 'WHERE ' . $sWhere . 'c.id_tree NOT IN %ls_pf ';
235
+    $sWhere = 'WHERE '.$sWhere.'c.id_tree NOT IN %ls_pf ';
236 236
 } else {
237
-    $sWhere = 'WHERE ' . $sWhere;
237
+    $sWhere = 'WHERE '.$sWhere;
238 238
 }
239 239
 
240 240
 // Do queries
241 241
 DB::query(
242 242
     "SELECT c.id
243
-    FROM " . prefixTable('cache') . " AS c
244
-    LEFT JOIN " . prefixTable('categories_items') . " AS ci ON (ci.item_id = c.id)
243
+    FROM " . prefixTable('cache')." AS c
244
+    LEFT JOIN " . prefixTable('categories_items')." AS ci ON (ci.item_id = c.id)
245 245
     {$sWhere}
246 246
     {$sOrder}",
247 247
     $crit
@@ -249,9 +249,9 @@  discard block
 block discarded – undo
249 249
 $iTotal = DB::count();
250 250
 $rows = DB::query(
251 251
     "SELECT c.*, ci.data, i.item_key
252
-    FROM " . prefixTable('cache') . " AS c
253
-    LEFT JOIN " . prefixTable('categories_items') . " AS ci ON (ci.item_id = c.id)
254
-    INNER JOIN " . prefixTable('items') . " AS i ON (i.id = c.id)
252
+    FROM " . prefixTable('cache')." AS c
253
+    LEFT JOIN " . prefixTable('categories_items')." AS ci ON (ci.item_id = c.id)
254
+    INNER JOIN " . prefixTable('items')." AS i ON (i.id = c.id)
255 255
     {$sWhere}
256 256
     {$sOrder}
257 257
     {$sLimit}",
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 if (null === $request->query->get('type')) {
277 277
     $sOutput = '{';
278 278
     if (null !== $request->query->get('draw')) {
279
-        $sOutput .= '"draw": ' . (int) $request->query->get('draw') . ', ';
279
+        $sOutput .= '"draw": '.(int) $request->query->get('draw').', ';
280 280
     }
281 281
     $sOutput .= '"data": [';
282 282
     $sOutputConst = '';
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
             foreach (explode(';', $session->get('user-roles')) as $role) {
294 294
                 //db::debugmode(true);
295 295
                 $access = DB::queryFirstRow(
296
-                    'SELECT type FROM ' . prefixTable('roles_values') . ' WHERE role_id = %i AND folder_id = %i',
296
+                    'SELECT type FROM '.prefixTable('roles_values').' WHERE role_id = %i AND folder_id = %i',
297 297
                     $role,
298 298
                     $record['id_tree']
299 299
                 );
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
             }
314 314
             $accessLevel = count($arrTmp) > 0 ? min($arrTmp) : $accessLevel;
315 315
             if ($accessLevel === 0) {
316
-                $checkbox = '<input type=\"checkbox\" value=\"0\" class=\"mass_op_cb\" data-id=\"' . $record['id'] . '\">';
316
+                $checkbox = '<input type=\"checkbox\" value=\"0\" class=\"mass_op_cb\" data-id=\"'.$record['id'].'\">';
317 317
             }
318 318
 
319 319
             if ((int) $accessLevel === 0) {
@@ -353,22 +353,22 @@  discard block
 block discarded – undo
353 353
             if (empty($restrictedTo)) {
354 354
                 $restrictedTo = $session->get('user-id');
355 355
             } else {
356
-                $restrictedTo .= ',' . $session->get('user-id');
356
+                $restrictedTo .= ','.$session->get('user-id');
357 357
             }
358 358
         }
359 359
         
360 360
         //col1
361
-        $sOutputItem .= '"<i class=\"fa fa-external-link-alt infotip mr-2\" title=\"' . $lang->get('open_url_link') . '\" onClick=\"window.location.href=&#039;index.php?page=items&amp;group=' . $record['id_tree'] . '&amp;id=' . $record['id'] . '&#039;\" style=\"cursor:pointer;\"></i>' .
362
-        '<i class=\"fa fa-eye infotip mr-2 item-detail\" title=\"' . stripslashes($lang->get('see_item_title')) . '\" data-id=\"' . $record['id'] . '\" data-perso=\"' . $record['perso'] . '\" data-tree-id=\"' . $record['id_tree'] . '\" data-expired=\"' . $expired . '\" data-restricted-to=\"' . $restrictedTo . '\" data-rights=\"' . $right . '\" style=\"cursor:pointer;\"></i>' . $checkbox . '",' ;
361
+        $sOutputItem .= '"<i class=\"fa fa-external-link-alt infotip mr-2\" title=\"'.$lang->get('open_url_link').'\" onClick=\"window.location.href=&#039;index.php?page=items&amp;group='.$record['id_tree'].'&amp;id='.$record['id'].'&#039;\" style=\"cursor:pointer;\"></i>'.
362
+        '<i class=\"fa fa-eye infotip mr-2 item-detail\" title=\"'.stripslashes($lang->get('see_item_title')).'\" data-id=\"'.$record['id'].'\" data-perso=\"'.$record['perso'].'\" data-tree-id=\"'.$record['id_tree'].'\" data-expired=\"'.$expired.'\" data-restricted-to=\"'.$restrictedTo.'\" data-rights=\"'.$right.'\" style=\"cursor:pointer;\"></i>'.$checkbox.'",';
363 363
         //col2
364
-        $sOutputItem .= '"'.base64_encode('<span id=\"item_label-' . $record['id'] . '\">' . (str_replace("\\", "&#92;", (string) $record['label'])) . '</span>').'", ';   // replace backslash #3015
364
+        $sOutputItem .= '"'.base64_encode('<span id=\"item_label-'.$record['id'].'\">'.(str_replace("\\", "&#92;", (string) $record['label'])).'</span>').'", '; // replace backslash #3015
365 365
         //col3
366
-        $sOutputItem .= '"' . base64_encode(str_replace('&amp;', '&', htmlspecialchars(stripslashes((string) $record['login']), ENT_QUOTES))) . '", ';
366
+        $sOutputItem .= '"'.base64_encode(str_replace('&amp;', '&', htmlspecialchars(stripslashes((string) $record['login']), ENT_QUOTES))).'", ';
367 367
         //col4
368 368
         //get restriction from ROles
369 369
         $restrictedToRole = false;
370 370
         $rTmp = DB::queryFirstColumn(
371
-            'SELECT role_id FROM ' . prefixTable('restriction_to_roles') . ' WHERE item_id = %i',
371
+            'SELECT role_id FROM '.prefixTable('restriction_to_roles').' WHERE item_id = %i',
372 372
             $record['id']
373 373
         );
374 374
         // We considere here that if user has at least one group similar to the object ones
@@ -386,14 +386,14 @@  discard block
 block discarded – undo
386 386
         } else {
387 387
             $txt = str_replace(['\n', '<br />', '\\'], [' ', ' ', '', ' '], strip_tags($record['description']));
388 388
             if (strlen($txt) > 50) {
389
-                $sOutputItem .= '"' . base64_encode(substr(stripslashes(preg_replace('~/<[\/]{0,1}[^>]*>\//|[ \t]/~', '', $txt)), 0, 50)) . '", ';
389
+                $sOutputItem .= '"'.base64_encode(substr(stripslashes(preg_replace('~/<[\/]{0,1}[^>]*>\//|[ \t]/~', '', $txt)), 0, 50)).'", ';
390 390
             } else {
391
-                $sOutputItem .= '"' . base64_encode(stripslashes(preg_replace('~/<[^>]*>|[ \t]/~', '', $txt))) . '", ';
391
+                $sOutputItem .= '"'.base64_encode(stripslashes(preg_replace('~/<[^>]*>|[ \t]/~', '', $txt))).'", ';
392 392
             }
393 393
         }
394 394
 
395 395
         //col5 - TAGS
396
-        $sOutputItem .= '"' . base64_encode(htmlspecialchars(stripslashes((string) $record['tags']), ENT_QUOTES)) . '", ';
396
+        $sOutputItem .= '"'.base64_encode(htmlspecialchars(stripslashes((string) $record['tags']), ENT_QUOTES)).'", ';
397 397
         // col6 - URL
398 398
         if ($record['url'] !== '0') {
399 399
             $sOutputItem .= '"'.filter_var($record['url'], FILTER_SANITIZE_URL).'", ';
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
         }
403 403
 
404 404
         //col7 - Prepare the Treegrid
405
-        $sOutputItem .= '"' . base64_encode(htmlspecialchars(stripslashes((string) $record['folder']), ENT_QUOTES)) . '"';
405
+        $sOutputItem .= '"'.base64_encode(htmlspecialchars(stripslashes((string) $record['folder']), ENT_QUOTES)).'"';
406 406
         //Finish the line
407 407
         //$sOutputItem .= '], ';
408 408
         if ($getItemInList === true) {
@@ -411,16 +411,16 @@  discard block
 block discarded – undo
411 411
             --$iTotal;
412 412
         }
413 413
     }
414
-    if (! empty($sOutputConst)) {
414
+    if (!empty($sOutputConst)) {
415 415
         $sOutput .= substr_replace($sOutputConst, '', -2);
416 416
     }
417 417
     $sOutput .= '], ';
418
-    $sOutput .= '"recordsTotal": ' . $iTotal . ', ';
419
-    $sOutput .= '"recordsFiltered": ' . $iTotal . ' }';
418
+    $sOutput .= '"recordsTotal": '.$iTotal.', ';
419
+    $sOutput .= '"recordsFiltered": '.$iTotal.' }';
420 420
     echo ($sOutput);
421 421
 } elseif (null !== $request->query->get('type') && ($request->query->get('type') === 'search_for_items' || $request->query->get('type') === 'search_for_items_with_tags')) {
422 422
     include_once 'main.functions.php';
423
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $session->get('user-language') . '.php';
423
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$session->get('user-language').'.php';
424 424
 
425 425
     $arr_data = [];
426 426
     foreach ($rows as $record) {
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
         $arr_data[$record['id']]['tree_id'] = (int) $record['id_tree'];
430 430
         $arr_data[$record['id']]['label'] = (string) $record['label'];
431 431
         $arr_data[$record['id']]['desc'] = (string) strip_tags(explode('<br>', $record['description'])[0]);
432
-        $arr_data[$record['id']]['folder'] = (string)$record['folder'];
432
+        $arr_data[$record['id']]['folder'] = (string) $record['folder'];
433 433
         $arr_data[$record['id']]['login'] = (string) strtr($record['login'], '"', '&quot;');
434 434
         $arr_data[$record['id']]['item_key'] = (string) $record['item_key'];
435 435
         $arr_data[$record['id']]['link'] = (string) $record['url'] !== '0' && empty($record['url']) === false ? filter_var($record['url'], FILTER_SANITIZE_URL) : '';
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 
443 443
         // Anyone can modify?
444 444
         $tmp = DB::queryfirstrow(
445
-            'SELECT anyone_can_modify FROM ' . prefixTable('items') . ' WHERE id = %i',
445
+            'SELECT anyone_can_modify FROM '.prefixTable('items').' WHERE id = %i',
446 446
             $record['id']
447 447
         );
448 448
         if (count($tmp) > 0) {
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
         // => récupérer un tableau contenant les roles associés à cet ID (a partir table restriction_to_roles)
474 474
         $user_is_included_in_role = 0;
475 475
         $roles = DB::query(
476
-            'SELECT role_id FROM ' . prefixTable('restriction_to_roles') . ' WHERE item_id=%i',
476
+            'SELECT role_id FROM '.prefixTable('restriction_to_roles').' WHERE item_id=%i',
477 477
             $record['id']
478 478
         );
479 479
         if (count($roles) > 0) {
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
             if (empty($restrictedTo)) {
497 497
                 $restrictedTo = $session->get('user-id');
498 498
             } else {
499
-                $restrictedTo .= ',' . $session->get('user-id');
499
+                $restrictedTo .= ','.$session->get('user-id');
500 500
             }
501 501
         }
502 502
 
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
             $arrTmp = [];
595 595
             foreach (explode(';', $session->get('user-roles')) as $role) {
596 596
                 $access = DB::queryFirstRow(
597
-                    'SELECT type FROM ' . prefixTable('roles_values') . ' WHERE role_id = %i AND folder_id = %i',
597
+                    'SELECT type FROM '.prefixTable('roles_values').' WHERE role_id = %i AND folder_id = %i',
598 598
                     $role,
599 599
                     $record['id_tree']
600 600
                 );
@@ -645,8 +645,8 @@  discard block
 block discarded – undo
645 645
         ) {
646 646
             $data_item = DB::queryFirstRow(
647 647
                 'SELECT i.pw AS pw, s.share_key AS share_key
648
-                FROM ' . prefixTable('items') . ' AS i
649
-                INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (s.object_id = i.id)
648
+                FROM ' . prefixTable('items').' AS i
649
+                INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (s.object_id = i.id)
650 650
                 WHERE i.id = %i AND s.user_id = %i',
651 651
                 $record['id'],
652 652
                 $session->get('user-id')
Please login to merge, or discard this patch.
sources/upload.attachments.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 ) {
65 65
     // Not allowed page
66 66
     $session->set('system-error_code', ERR_NOT_ALLOWED);
67
-    include $SETTINGS['cpassman_dir'] . '/error.php';
67
+    include $SETTINGS['cpassman_dir'].'/error.php';
68 68
     exit;
69 69
 }
70 70
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 $post_isNewItem = $request->request->filter('isNewItem', null, FILTER_SANITIZE_NUMBER_INT);
98 98
 $post_randomId = $request->request->filter('randomId', null, FILTER_SANITIZE_NUMBER_INT);
99 99
 $post_isPersonal = $request->request->filter('isPersonal', null, FILTER_SANITIZE_NUMBER_INT);
100
-$post_fileSize= $request->request->filter('file_size', null, FILTER_SANITIZE_NUMBER_INT);
100
+$post_fileSize = $request->request->filter('file_size', null, FILTER_SANITIZE_NUMBER_INT);
101 101
 
102 102
 // Get parameters
103 103
 $chunk = isset($_REQUEST['chunk']) ? (int) $_REQUEST['chunk'] : 0;
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
         // check if token is expired
159 159
         $data = DB::queryFirstRow(
160 160
             'SELECT end_timestamp
161
-            FROM ' . prefixTable('tokens') . '
161
+            FROM ' . prefixTable('tokens').'
162 162
             WHERE user_id = %i AND token = %s',
163 163
             $session->get('user-id'),
164 164
             $post_user_token
@@ -183,12 +183,12 @@  discard block
 block discarded – undo
183 183
     }
184 184
 
185 185
     // Load Settings
186
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php';
186
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php';
187 187
 }
188 188
 
189 189
 // HTTP headers for no cache etc
190 190
 header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
191
-header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
191
+header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
192 192
 header('Cache-Control: no-store, no-cache, must-revalidate');
193 193
 header('Cache-Control: post-check=0, pre-check=0', false);
194 194
 
@@ -233,9 +233,9 @@  discard block
 block discarded – undo
233 233
 }
234 234
 
235 235
 // Validate file name (for our purposes we'll just remove invalid characters)
236
-$file_name = preg_replace('[^' . $valid_chars_regex . ']', '', strtolower(basename($_FILES['file']['name'])));
236
+$file_name = preg_replace('[^'.$valid_chars_regex.']', '', strtolower(basename($_FILES['file']['name'])));
237 237
 if (strlen($file_name) == 0 || strlen($file_name) > $MAX_FILENAME_LENGTH) {
238
-    handleAttachmentError('Invalid file name: ' . $file_name . '.', 114);
238
+    handleAttachmentError('Invalid file name: '.$file_name.'.', 114);
239 239
 }
240 240
 
241 241
 // Validate file extension
@@ -245,8 +245,8 @@  discard block
 block discarded – undo
245 245
         $ext,
246 246
         explode(
247 247
             ',',
248
-            $SETTINGS['upload_docext'] . ',' . $SETTINGS['upload_imagesext'] .
249
-                ',' . $SETTINGS['upload_pkgext'] . ',' . $SETTINGS['upload_otherext']
248
+            $SETTINGS['upload_docext'].','.$SETTINGS['upload_imagesext'].
249
+                ','.$SETTINGS['upload_pkgext'].','.$SETTINGS['upload_otherext']
250 250
         )
251 251
     ) === false
252 252
 ) {
@@ -258,24 +258,24 @@  discard block
 block discarded – undo
258 258
 
259 259
 // Clean the fileName for security reasons
260 260
 $fileInfo = pathinfo($fileName);
261
-$fileName = base64_encode($fileInfo['filename']) . '.' . $fileInfo['extension'];
261
+$fileName = base64_encode($fileInfo['filename']).'.'.$fileInfo['extension'];
262 262
 $fileFullSize = 0;
263 263
 
264 264
 // Make sure the fileName is unique but only if chunking is disabled
265
-if ($chunks < 2 && file_exists($targetDir . DIRECTORY_SEPARATOR . $fileName)) {
265
+if ($chunks < 2 && file_exists($targetDir.DIRECTORY_SEPARATOR.$fileName)) {
266 266
     $ext = strrpos($fileName, '.');
267 267
     $fileNameA = substr($fileName, 0, $ext);
268 268
     $fileNameB = substr($fileName, $ext);
269 269
 
270 270
     $count = 1;
271
-    while (file_exists($targetDir . DIRECTORY_SEPARATOR . $fileNameA . '_' . $count . $fileNameB)) {
271
+    while (file_exists($targetDir.DIRECTORY_SEPARATOR.$fileNameA.'_'.$count.$fileNameB)) {
272 272
         ++$count;
273 273
     }
274 274
 
275
-    $fileName = $fileNameA . '_' . $count . $fileNameB;
275
+    $fileName = $fileNameA.'_'.$count.$fileNameB;
276 276
 }
277 277
 
278
-$filePath = $targetDir . DIRECTORY_SEPARATOR . $fileName;
278
+$filePath = $targetDir.DIRECTORY_SEPARATOR.$fileName;
279 279
 
280 280
 // Create target dir
281 281
 if (file_exists($targetDir) === false) {
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 // Remove old temp files
290 290
 if ($cleanupTargetDir && is_dir($targetDir) && ($dir = opendir($targetDir))) {
291 291
     while (($file = readdir($dir)) !== false) {
292
-        $tmpfilePath = $targetDir . DIRECTORY_SEPARATOR . $file;
292
+        $tmpfilePath = $targetDir.DIRECTORY_SEPARATOR.$file;
293 293
 
294 294
         // Remove temp file if it is older than the max age and is not the current file
295 295
         if (
@@ -411,8 +411,8 @@  discard block
 block discarded – undo
411 411
         // This is a public object
412 412
         $users = DB::query(
413 413
             'SELECT id, public_key
414
-            FROM ' . prefixTable('users') . '
415
-            WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '")
414
+            FROM ' . prefixTable('users').'
415
+            WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'")
416 416
             AND public_key != ""'
417 417
         );
418 418
         foreach ($users as $user) {
@@ -450,14 +450,14 @@  discard block
 block discarded – undo
450 450
                 'date' => time(),
451 451
                 'id_user' => $session->get('user-id'),
452 452
                 'action' => 'at_modification',
453
-                'raison' => 'at_add_file : ' . $fileName . ':' . $newID,
453
+                'raison' => 'at_add_file : '.$fileName.':'.$newID,
454 454
             )
455 455
         );
456 456
     }
457 457
 }
458 458
 
459 459
 // Return JSON-RPC response
460
-die('{"jsonrpc" : "2.0", "result" : null, "id" : "' . $newID . '"}');
460
+die('{"jsonrpc" : "2.0", "result" : null, "id" : "'.$newID.'"}');
461 461
 
462 462
 /**
463 463
  * Undocumented function.
@@ -467,5 +467,5 @@  discard block
 block discarded – undo
467 467
  */
468 468
 function handleAttachmentError($message, $code)
469 469
 {
470
-    echo '{"jsonrpc" : "2.0", "error" : {"code": ' . htmlentities((string) $code, ENT_QUOTES) . ', "message": "' . htmlentities((string) $message, ENT_QUOTES) . '"}, "id" : "id"}';
470
+    echo '{"jsonrpc" : "2.0", "error" : {"code": '.htmlentities((string) $code, ENT_QUOTES).', "message": "'.htmlentities((string) $message, ENT_QUOTES).'"}, "id" : "id"}';
471 471
 }
Please login to merge, or discard this patch.
sources/main.queries.php 1 patch
Spacing   +99 added lines, -99 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 ) {
71 71
     // Not allowed page
72 72
     $session->set('system-error_code', ERR_NOT_ALLOWED);
73
-    include $SETTINGS['cpassman_dir'] . '/error.php';
73
+    include $SETTINGS['cpassman_dir'].'/error.php';
74 74
     exit;
75 75
 }
76 76
 
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
  * @param string $post_key
294 294
  * @return string
295 295
  */
296
-function userHandler(string $post_type, array|null|string $dataReceived, array $SETTINGS, string $post_key): string
296
+function userHandler(string $post_type, array | null | string $dataReceived, array $SETTINGS, string $post_key): string
297 297
 {
298 298
     $session = SessionManager::getSession();
299 299
 
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
             $pwdlib = new PasswordLib();
534 534
             // generate key
535 535
             $key = $pwdlib->getRandomToken(filter_input(INPUT_POST, 'size', FILTER_SANITIZE_NUMBER_INT));
536
-            return '[{"key" : "' . htmlentities($key, ENT_QUOTES) . '"}]';
536
+            return '[{"key" : "'.htmlentities($key, ENT_QUOTES).'"}]';
537 537
 
538 538
         /*
539 539
         * Launch user keys change on his demand
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
  * @param array $SETTINGS
585 585
  * @return string
586 586
  */
587
-function systemHandler(string $post_type, array|null|string $dataReceived, array $SETTINGS): string
587
+function systemHandler(string $post_type, array | null | string $dataReceived, array $SETTINGS): string
588 588
 {
589 589
     $session = SessionManager::getSession();
590 590
     switch ($post_type) {
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
                 )
688 688
             );
689 689
 
690
-            return '[{"token" : "' . $token . '"}]';
690
+            return '[{"token" : "'.$token.'"}]';
691 691
 
692 692
         /*
693 693
         * Default case
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
 }
704 704
 
705 705
 
706
-function utilsHandler(string $post_type, array|null|string $dataReceived, array $SETTINGS): string
706
+function utilsHandler(string $post_type, array | null | string $dataReceived, array $SETTINGS): string
707 707
 {
708 708
     switch ($post_type) {
709 709
         /*
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
         array(
773 773
             'error' => false,
774 774
             'timestamp' => $session->get('user-session_duration'),
775
-            'max_time_to_add' => intdiv((($maximum_session_expiration_time*60) - ((int) $session->get('user-session_duration') - time())), 60),
775
+            'max_time_to_add' => intdiv((($maximum_session_expiration_time * 60) - ((int) $session->get('user-session_duration') - time())), 60),
776 776
             'max_session_duration' => $maximum_session_expiration_time,
777 777
         ),
778 778
         'encode'
@@ -824,7 +824,7 @@  discard block
 block discarded – undo
824 824
     // get number of items
825 825
     DB::queryFirstRow(
826 826
         'SELECT increment_id
827
-        FROM ' . prefixTable('sharekeys_items') .
827
+        FROM ' . prefixTable('sharekeys_items').
828 828
         ' WHERE user_id = %i',
829 829
         $userId
830 830
     );
@@ -880,7 +880,7 @@  discard block
 block discarded – undo
880 880
         // check if expected security level is reached
881 881
         $dataUser = DB::queryfirstrow(
882 882
             'SELECT *
883
-            FROM ' . prefixTable('users') . ' WHERE id = %i',
883
+            FROM ' . prefixTable('users').' WHERE id = %i',
884 884
             $post_user_id
885 885
         );
886 886
 
@@ -901,8 +901,8 @@  discard block
 block discarded – undo
901 901
         if (empty($dataUser['fonction_id']) === false) {
902 902
             $data = DB::queryFirstRow(
903 903
                 'SELECT complexity
904
-                FROM ' . prefixTable('roles_title') . '
905
-                WHERE id IN (' . $dataUser['fonction_id'] . ')
904
+                FROM ' . prefixTable('roles_title').'
905
+                WHERE id IN (' . $dataUser['fonction_id'].')
906 906
                 ORDER BY complexity DESC'
907 907
             );
908 908
         } else {
@@ -915,8 +915,8 @@  discard block
 block discarded – undo
915 915
             return prepareExchangedData(
916 916
                 array(
917 917
                     'error' => true,
918
-                    'message' => '<div style="margin:10px 0 10px 15px;">' . $lang->get('complexity_level_not_reached') . '.<br>' .
919
-                        $lang->get('expected_complexity_level') . ': <b>' . TP_PW_COMPLEXITY[$data['complexity']][1] . '</b></div>',
918
+                    'message' => '<div style="margin:10px 0 10px 15px;">'.$lang->get('complexity_level_not_reached').'.<br>'.
919
+                        $lang->get('expected_complexity_level').': <b>'.TP_PW_COMPLEXITY[$data['complexity']][1].'</b></div>',
920 920
                 ),
921 921
                 'encode'
922 922
             );
@@ -1019,14 +1019,14 @@  discard block
 block discarded – undo
1019 1019
         // Get data about user
1020 1020
         $dataUser = DB::queryfirstrow(
1021 1021
             'SELECT id, email, pw
1022
-            FROM ' . prefixTable('users') . '
1022
+            FROM ' . prefixTable('users').'
1023 1023
             WHERE login = %s',
1024 1024
             $post_login
1025 1025
         );
1026 1026
     } else {
1027 1027
         $dataUser = DB::queryfirstrow(
1028 1028
             'SELECT id, login, email, pw
1029
-            FROM ' . prefixTable('users') . '
1029
+            FROM ' . prefixTable('users').'
1030 1030
             WHERE id = %i',
1031 1031
             $post_id
1032 1032
         );
@@ -1081,7 +1081,7 @@  discard block
 block discarded – undo
1081 1081
     // Check if token already used
1082 1082
     $dataToken = DB::queryfirstrow(
1083 1083
         'SELECT end_timestamp, reason
1084
-        FROM ' . prefixTable('tokens') . '
1084
+        FROM ' . prefixTable('tokens').'
1085 1085
         WHERE token = %s AND user_id = %i',
1086 1086
         $post_token,
1087 1087
         $dataUser['id']
@@ -1092,11 +1092,11 @@  discard block
 block discarded – undo
1092 1092
         return prepareExchangedData(
1093 1093
             array(
1094 1094
                 'error' => true,
1095
-                'message' => 'TOKEN already used',//$lang->get('no_email_set'),
1095
+                'message' => 'TOKEN already used', //$lang->get('no_email_set'),
1096 1096
             ),
1097 1097
             'encode'
1098 1098
         );
1099
-    } elseif(DB::count() === 0) {
1099
+    } elseif (DB::count() === 0) {
1100 1100
         // Store token for this action
1101 1101
         DB::insert(
1102 1102
             prefixTable('tokens'),
@@ -1158,7 +1158,7 @@  discard block
 block discarded – undo
1158 1158
                 'email' => $dataUser['email'],
1159 1159
                 'email_result' => str_replace(
1160 1160
                     '#email#',
1161
-                    '<b>' . obfuscateEmail($dataUser['email']) . '</b>',
1161
+                    '<b>'.obfuscateEmail($dataUser['email']).'</b>',
1162 1162
                     addslashes($lang->get('admin_email_result_ok'))
1163 1163
                 ),
1164 1164
             ),
@@ -1174,7 +1174,7 @@  discard block
 block discarded – undo
1174 1174
             'email' => $dataUser['email'],
1175 1175
             'email_result' => str_replace(
1176 1176
                 '#email#',
1177
-                '<b>' . obfuscateEmail($dataUser['email']) . '</b>',
1177
+                '<b>'.obfuscateEmail($dataUser['email']).'</b>',
1178 1178
                 addslashes($lang->get('admin_email_result_ok'))
1179 1179
             ),
1180 1180
         ),
@@ -1188,7 +1188,7 @@  discard block
 block discarded – undo
1188 1188
 {
1189 1189
     if (isKeyExistingAndEqual('enable_send_email_on_user_login', 1, $SETTINGS) === true) {
1190 1190
         $row = DB::queryFirstRow(
1191
-            'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s',
1191
+            'SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s',
1192 1192
             'cron',
1193 1193
             'sending_emails'
1194 1194
         );
@@ -1196,7 +1196,7 @@  discard block
 block discarded – undo
1196 1196
         if ((int) (time() - $row['valeur']) >= 300 || (int) $row['valeur'] === 0) {
1197 1197
             $rows = DB::query(
1198 1198
                 'SELECT *
1199
-                FROM ' . prefixTable('emails') .
1199
+                FROM ' . prefixTable('emails').
1200 1200
                 ' WHERE status != %s',
1201 1201
                 'sent'
1202 1202
             );
@@ -1294,8 +1294,8 @@  discard block
 block discarded – undo
1294 1294
     $arr_html = array();
1295 1295
     $rows = DB::query(
1296 1296
         '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
1297
-        FROM ' . prefixTable('log_items') . ' AS l
1298
-        RIGHT JOIN ' . prefixTable('items') . ' AS i ON (l.id_item = i.id)
1297
+        FROM ' . prefixTable('log_items').' AS l
1298
+        RIGHT JOIN ' . prefixTable('items').' AS i ON (l.id_item = i.id)
1299 1299
         WHERE l.action = %s AND l.id_user = %i
1300 1300
         ORDER BY l.date DESC
1301 1301
         LIMIT 0, 100',
@@ -1327,7 +1327,7 @@  discard block
 block discarded – undo
1327 1327
     if (isKeyExistingAndEqual('enable_suggestion', 1, $SETTINGS) === true
1328 1328
         && ((int) $session->get('user-admin') === 1 || (int) $session->get('user-manager') === 1)
1329 1329
     ) {
1330
-        DB::query('SELECT * FROM ' . prefixTable('suggestion'));
1330
+        DB::query('SELECT * FROM '.prefixTable('suggestion'));
1331 1331
         $nb_suggestions_waiting = DB::count();
1332 1332
     }
1333 1333
 
@@ -1362,13 +1362,13 @@  discard block
 block discarded – undo
1362 1362
             if ($data === 'stat_languages') {
1363 1363
                 $tmp = '';
1364 1364
                 foreach ($stats_data[$data] as $key => $value) {
1365
-                    $tmp .= $tmp === '' ? $key . '-' . $value : ',' . $key . '-' . $value;
1365
+                    $tmp .= $tmp === '' ? $key.'-'.$value : ','.$key.'-'.$value;
1366 1366
                 }
1367 1367
                 $statsToSend[$data] = $tmp;
1368 1368
             } elseif ($data === 'stat_country') {
1369 1369
                 $tmp = '';
1370 1370
                 foreach ($stats_data[$data] as $key => $value) {
1371
-                    $tmp .= $tmp === '' ? $key . '-' . $value : ',' . $key . '-' . $value;
1371
+                    $tmp .= $tmp === '' ? $key.'-'.$value : ','.$key.'-'.$value;
1372 1372
                 }
1373 1373
                 $statsToSend[$data] = $tmp;
1374 1374
             } else {
@@ -1455,8 +1455,8 @@  discard block
 block discarded – undo
1455 1455
                 $url_found = substr($line, 19, strlen($line) - 22);
1456 1456
                 if (empty($url_found) === false) {
1457 1457
                     $tmp = parse_url($url_found);
1458
-                    $anonym_url = $tmp['scheme'] . '://<anonym_url>' . (isset($tmp['path']) === true ? $tmp['path'] : '');
1459
-                    $line = "'cpassman_url' => '" . $anonym_url . "\n";
1458
+                    $anonym_url = $tmp['scheme'].'://<anonym_url>'.(isset($tmp['path']) === true ? $tmp['path'] : '');
1459
+                    $line = "'cpassman_url' => '".$anonym_url."\n";
1460 1460
                 } else {
1461 1461
                     $line = "'cpassman_url' => \n";
1462 1462
                 }
@@ -1486,7 +1486,7 @@  discard block
 block discarded – undo
1486 1486
     $teampass_errors = '';
1487 1487
     $rows = DB::query(
1488 1488
         'SELECT label, date AS error_date
1489
-        FROM ' . prefixTable('log_system') . "
1489
+        FROM ' . prefixTable('log_system')."
1490 1490
         WHERE `type` LIKE 'error'
1491 1491
         ORDER BY `date` DESC
1492 1492
         LIMIT 0, 10"
@@ -1494,9 +1494,9 @@  discard block
 block discarded – undo
1494 1494
     if (DB::count() > 0) {
1495 1495
         foreach ($rows as $record) {
1496 1496
             if (empty($teampass_errors) === true) {
1497
-                $teampass_errors = ' * ' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['error_date']) . ' - ' . $record['label'];
1497
+                $teampass_errors = ' * '.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['error_date']).' - '.$record['label'];
1498 1498
             } else {
1499
-                $teampass_errors .= ' * ' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['error_date']) . ' - ' . $record['label'];
1499
+                $teampass_errors .= ' * '.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['error_date']).' - '.$record['label'];
1500 1500
             }
1501 1501
         }
1502 1502
     }
@@ -1505,7 +1505,7 @@  discard block
 block discarded – undo
1505 1505
 
1506 1506
     // Now prepare text
1507 1507
     $txt = '### Page on which it happened
1508
-' . $data['current_page'] . '
1508
+' . $data['current_page'].'
1509 1509
 
1510 1510
 ### Steps to reproduce
1511 1511
 1.
@@ -1520,39 +1520,39 @@  discard block
 block discarded – undo
1520 1520
 Tell us what happens instead
1521 1521
 
1522 1522
 ### Server configuration
1523
-**Operating system**: ' . php_uname() . '
1523
+**Operating system**: ' . php_uname().'
1524 1524
 
1525
-**Web server:** ' . $_SERVER['SERVER_SOFTWARE'] . '
1525
+**Web server:** ' . $_SERVER['SERVER_SOFTWARE'].'
1526 1526
 
1527
-**Database:** ' . ($link === false ? $lang->get('undefined') : mysqli_get_server_info($link)) . '
1527
+**Database:** ' . ($link === false ? $lang->get('undefined') : mysqli_get_server_info($link)).'
1528 1528
 
1529
-**PHP version:** ' . PHP_VERSION . '
1529
+**PHP version:** ' . PHP_VERSION.'
1530 1530
 
1531
-**Teampass version:** ' . TP_VERSION . '
1531
+**Teampass version:** ' . TP_VERSION.'
1532 1532
 
1533 1533
 **Teampass configuration file:**
1534 1534
 ```
1535
-' . $list_of_options . '
1535
+' . $list_of_options.'
1536 1536
 ```
1537 1537
 
1538 1538
 **Updated from an older Teampass or fresh install:**
1539 1539
 
1540 1540
 ### Client configuration
1541 1541
 
1542
-**Browser:** ' . $data['browser_name'] . ' - ' . $data['browser_version'] . '
1542
+**Browser:** ' . $data['browser_name'].' - '.$data['browser_version'].'
1543 1543
 
1544
-**Operating system:** ' . $data['os'] . ' - ' . $data['os_archi'] . 'bits
1544
+**Operating system:** ' . $data['os'].' - '.$data['os_archi'].'bits
1545 1545
 
1546 1546
 ### Logs
1547 1547
 
1548 1548
 #### Web server error log
1549 1549
 ```
1550
-' . $err['message'] . ' - ' . $err['file'] . ' (' . $err['line'] . ')
1550
+' . $err['message'].' - '.$err['file'].' ('.$err['line'].')
1551 1551
 ```
1552 1552
 
1553 1553
 #### Teampass 10 last system errors
1554 1554
 ```
1555
-' . $teampass_errors . '
1555
+' . $teampass_errors.'
1556 1556
 ```
1557 1557
 
1558 1558
 #### Log from the web-browser developer console (CTRL + SHIFT + i)
@@ -1592,7 +1592,7 @@  discard block
 block discarded – undo
1592 1592
         // Check if user exists
1593 1593
         $userInfo = DB::queryFirstRow(
1594 1594
             'SELECT public_key, private_key, pw, auth_type
1595
-            FROM ' . prefixTable('users') . '
1595
+            FROM ' . prefixTable('users').'
1596 1596
             WHERE id = %i',
1597 1597
             $post_user_id
1598 1598
         );
@@ -1601,9 +1601,9 @@  discard block
 block discarded – undo
1601 1601
             // Get one item
1602 1602
             $currentUserKey = DB::queryFirstRow(
1603 1603
                 'SELECT object_id, share_key, increment_id
1604
-                FROM ' . prefixTable('sharekeys_items') . ' AS si
1605
-                INNER JOIN ' . prefixTable('items') . ' AS i ON  (i.id = si.object_id)
1606
-                INNER JOIN ' . prefixTable('nested_tree') . ' AS nt ON  (i.id_tree = nt.id)
1604
+                FROM ' . prefixTable('sharekeys_items').' AS si
1605
+                INNER JOIN ' . prefixTable('items').' AS i ON  (i.id = si.object_id)
1606
+                INNER JOIN ' . prefixTable('nested_tree').' AS nt ON  (i.id_tree = nt.id)
1607 1607
                 WHERE user_id = %i AND nt.personal_folder = %i',
1608 1608
                 $post_user_id,
1609 1609
                 0
@@ -1702,7 +1702,7 @@  discard block
 block discarded – undo
1702 1702
         // Get user info
1703 1703
         $userData = DB::queryFirstRow(
1704 1704
             'SELECT private_key
1705
-            FROM ' . prefixTable('users') . '
1705
+            FROM ' . prefixTable('users').'
1706 1706
             WHERE id = %i',
1707 1707
             $post_user_id
1708 1708
         );
@@ -1767,7 +1767,7 @@  discard block
 block discarded – undo
1767 1767
         // Get user info
1768 1768
         $userData = DB::queryFirstRow(
1769 1769
             'SELECT email, auth_type, login
1770
-            FROM ' . prefixTable('users') . '
1770
+            FROM ' . prefixTable('users').'
1771 1771
             WHERE id = %i',
1772 1772
             $post_user_id
1773 1773
         );
@@ -1903,7 +1903,7 @@  discard block
 block discarded – undo
1903 1903
         // Get user info
1904 1904
         $userData = DB::queryFirstRow(
1905 1905
             'SELECT email, auth_type, login
1906
-            FROM ' . prefixTable('users') . '
1906
+            FROM ' . prefixTable('users').'
1907 1907
             WHERE id = %i',
1908 1908
             $post_user_id
1909 1909
         );
@@ -1968,7 +1968,7 @@  discard block
 block discarded – undo
1968 1968
         // Check if user exists
1969 1969
         DB::queryFirstRow(
1970 1970
             'SELECT *
1971
-            FROM ' . prefixTable('users') . '
1971
+            FROM ' . prefixTable('users').'
1972 1972
             WHERE id = %i',
1973 1973
             $post_user_id
1974 1974
         );
@@ -2037,7 +2037,7 @@  discard block
 block discarded – undo
2037 2037
         // Check if user exists
2038 2038
         $userInfo = DB::queryFirstRow(
2039 2039
             'SELECT public_key
2040
-            FROM ' . prefixTable('users') . '
2040
+            FROM ' . prefixTable('users').'
2041 2041
             WHERE id = %i',
2042 2042
             $post_user_id
2043 2043
         );
@@ -2185,15 +2185,15 @@  discard block
 block discarded – undo
2185 2185
     // Loop on items
2186 2186
     $rows = DB::query(
2187 2187
         'SELECT id, pw
2188
-        FROM ' . prefixTable('items') . '
2188
+        FROM ' . prefixTable('items').'
2189 2189
         WHERE perso = 0
2190
-        LIMIT ' . $post_start . ', ' . $post_length
2190
+        LIMIT ' . $post_start.', '.$post_length
2191 2191
     );
2192 2192
     foreach ($rows as $record) {
2193 2193
         // Get itemKey from current user
2194 2194
         $currentUserKey = DB::queryFirstRow(
2195 2195
             'SELECT share_key, increment_id
2196
-            FROM ' . prefixTable('sharekeys_items') . '
2196
+            FROM ' . prefixTable('sharekeys_items').'
2197 2197
             WHERE object_id = %i AND user_id = %i',
2198 2198
             $record['id'],
2199 2199
             $session->get('user-id')
@@ -2225,7 +2225,7 @@  discard block
 block discarded – undo
2225 2225
             if ((int) $post_user_id !== (int) $session->get('user-id')) {
2226 2226
                 $currentUserKey = DB::queryFirstRow(
2227 2227
                     'SELECT increment_id
2228
-                    FROM ' . prefixTable('sharekeys_items') . '
2228
+                    FROM ' . prefixTable('sharekeys_items').'
2229 2229
                     WHERE object_id = %i AND user_id = %i',
2230 2230
                     $record['id'],
2231 2231
                     $post_user_id
@@ -2258,7 +2258,7 @@  discard block
 block discarded – undo
2258 2258
     // SHould we change step?
2259 2259
     DB::query(
2260 2260
         'SELECT *
2261
-        FROM ' . prefixTable('items') . '
2261
+        FROM ' . prefixTable('items').'
2262 2262
         WHERE perso = 0'
2263 2263
     );
2264 2264
 
@@ -2283,15 +2283,15 @@  discard block
 block discarded – undo
2283 2283
     // Loop on logs
2284 2284
     $rows = DB::query(
2285 2285
         'SELECT increment_id
2286
-        FROM ' . prefixTable('log_items') . '
2286
+        FROM ' . prefixTable('log_items').'
2287 2287
         WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"
2288
-        LIMIT ' . $post_start . ', ' . $post_length
2288
+        LIMIT ' . $post_start.', '.$post_length
2289 2289
     );
2290 2290
     foreach ($rows as $record) {
2291 2291
         // Get itemKey from current user
2292 2292
         $currentUserKey = DB::queryFirstRow(
2293 2293
             'SELECT share_key
2294
-            FROM ' . prefixTable('sharekeys_logs') . '
2294
+            FROM ' . prefixTable('sharekeys_logs').'
2295 2295
             WHERE object_id = %i AND user_id = %i',
2296 2296
             $record['increment_id'],
2297 2297
             $session->get('user-id')
@@ -2323,7 +2323,7 @@  discard block
 block discarded – undo
2323 2323
             if ((int) $post_user_id !== (int) $session->get('user-id')) {
2324 2324
                 $currentUserKey = DB::queryFirstRow(
2325 2325
                     'SELECT increment_id
2326
-                    FROM ' . prefixTable('sharekeys_items') . '
2326
+                    FROM ' . prefixTable('sharekeys_items').'
2327 2327
                     WHERE object_id = %i AND user_id = %i',
2328 2328
                     $record['id'],
2329 2329
                     $post_user_id
@@ -2345,7 +2345,7 @@  discard block
 block discarded – undo
2345 2345
     // SHould we change step?
2346 2346
     DB::query(
2347 2347
         'SELECT increment_id
2348
-        FROM ' . prefixTable('log_items') . '
2348
+        FROM ' . prefixTable('log_items').'
2349 2349
         WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"'
2350 2350
     );
2351 2351
 
@@ -2370,15 +2370,15 @@  discard block
 block discarded – undo
2370 2370
     // Loop on fields
2371 2371
     $rows = DB::query(
2372 2372
         'SELECT id
2373
-        FROM ' . prefixTable('categories_items') . '
2373
+        FROM ' . prefixTable('categories_items').'
2374 2374
         WHERE encryption_type = "teampass_aes"
2375
-        LIMIT ' . $post_start . ', ' . $post_length
2375
+        LIMIT ' . $post_start.', '.$post_length
2376 2376
     );
2377 2377
     foreach ($rows as $record) {
2378 2378
         // Get itemKey from current user
2379 2379
         $currentUserKey = DB::queryFirstRow(
2380 2380
             'SELECT share_key
2381
-            FROM ' . prefixTable('sharekeys_fields') . '
2381
+            FROM ' . prefixTable('sharekeys_fields').'
2382 2382
             WHERE object_id = %i AND user_id = %i',
2383 2383
             $record['id'],
2384 2384
             $session->get('user-id')
@@ -2410,7 +2410,7 @@  discard block
 block discarded – undo
2410 2410
             if ((int) $post_user_id !== (int) $session->get('user-id')) {
2411 2411
                 $currentUserKey = DB::queryFirstRow(
2412 2412
                     'SELECT increment_id
2413
-                    FROM ' . prefixTable('sharekeys_items') . '
2413
+                    FROM ' . prefixTable('sharekeys_items').'
2414 2414
                     WHERE object_id = %i AND user_id = %i',
2415 2415
                     $record['id'],
2416 2416
                     $post_user_id
@@ -2432,7 +2432,7 @@  discard block
 block discarded – undo
2432 2432
     // SHould we change step?
2433 2433
     DB::query(
2434 2434
         'SELECT *
2435
-        FROM ' . prefixTable('categories_items') . '
2435
+        FROM ' . prefixTable('categories_items').'
2436 2436
         WHERE encryption_type = "teampass_aes"'
2437 2437
     );
2438 2438
 
@@ -2457,14 +2457,14 @@  discard block
 block discarded – undo
2457 2457
     // Loop on suggestions
2458 2458
     $rows = DB::query(
2459 2459
         'SELECT id
2460
-        FROM ' . prefixTable('suggestion') . '
2461
-        LIMIT ' . $post_start . ', ' . $post_length
2460
+        FROM ' . prefixTable('suggestion').'
2461
+        LIMIT ' . $post_start.', '.$post_length
2462 2462
     );
2463 2463
     foreach ($rows as $record) {
2464 2464
         // Get itemKey from current user
2465 2465
         $currentUserKey = DB::queryFirstRow(
2466 2466
             'SELECT share_key
2467
-            FROM ' . prefixTable('sharekeys_suggestions') . '
2467
+            FROM ' . prefixTable('sharekeys_suggestions').'
2468 2468
             WHERE object_id = %i AND user_id = %i',
2469 2469
             $record['id'],
2470 2470
             $session->get('user-id')
@@ -2496,7 +2496,7 @@  discard block
 block discarded – undo
2496 2496
             if ((int) $post_user_id !== (int) $session->get('user-id')) {
2497 2497
                 $currentUserKey = DB::queryFirstRow(
2498 2498
                     'SELECT increment_id
2499
-                    FROM ' . prefixTable('sharekeys_items') . '
2499
+                    FROM ' . prefixTable('sharekeys_items').'
2500 2500
                     WHERE object_id = %i AND user_id = %i',
2501 2501
                     $record['id'],
2502 2502
                     $post_user_id
@@ -2542,15 +2542,15 @@  discard block
 block discarded – undo
2542 2542
     // Loop on files
2543 2543
     $rows = DB::query(
2544 2544
         'SELECT id
2545
-        FROM ' . prefixTable('files') . '
2546
-        WHERE status = "' . TP_ENCRYPTION_NAME . '"
2547
-        LIMIT ' . $post_start . ', ' . $post_length
2545
+        FROM ' . prefixTable('files').'
2546
+        WHERE status = "' . TP_ENCRYPTION_NAME.'"
2547
+        LIMIT ' . $post_start.', '.$post_length
2548 2548
     ); //aes_encryption
2549 2549
     foreach ($rows as $record) {
2550 2550
         // Get itemKey from current user
2551 2551
         $currentUserKey = DB::queryFirstRow(
2552 2552
             'SELECT share_key
2553
-            FROM ' . prefixTable('sharekeys_files') . '
2553
+            FROM ' . prefixTable('sharekeys_files').'
2554 2554
             WHERE object_id = %i AND user_id = %i',
2555 2555
             $record['id'],
2556 2556
             $session->get('user-id')
@@ -2582,7 +2582,7 @@  discard block
 block discarded – undo
2582 2582
             if ((int) $post_user_id !== (int) $session->get('user-id')) {
2583 2583
                 $currentUserKey = DB::queryFirstRow(
2584 2584
                     'SELECT increment_id
2585
-                    FROM ' . prefixTable('sharekeys_items') . '
2585
+                    FROM ' . prefixTable('sharekeys_items').'
2586 2586
                     WHERE object_id = %i AND user_id = %i',
2587 2587
                     $record['id'],
2588 2588
                     $post_user_id
@@ -2604,8 +2604,8 @@  discard block
 block discarded – undo
2604 2604
     // SHould we change step?
2605 2605
     DB::query(
2606 2606
         'SELECT *
2607
-        FROM ' . prefixTable('files') . '
2608
-        WHERE status = "' . TP_ENCRYPTION_NAME . '"'
2607
+        FROM ' . prefixTable('files').'
2608
+        WHERE status = "' . TP_ENCRYPTION_NAME.'"'
2609 2609
     );
2610 2610
 
2611 2611
     $next_start = (int) $post_start + (int) $post_length;
@@ -2638,16 +2638,16 @@  discard block
 block discarded – undo
2638 2638
     if (count($session->get('user-personal_folders')) > 0) {
2639 2639
         $rows = DB::query(
2640 2640
             'SELECT id, pw
2641
-            FROM ' . prefixTable('items') . '
2641
+            FROM ' . prefixTable('items').'
2642 2642
             WHERE perso = 1 AND id_tree IN %ls
2643
-            LIMIT ' . $post_start . ', ' . $post_length,
2643
+            LIMIT ' . $post_start.', '.$post_length,
2644 2644
             $session->get('user-personal_folders')
2645 2645
         );
2646 2646
         foreach ($rows as $record) {
2647 2647
             // Get itemKey from current user
2648 2648
             $currentUserKey = DB::queryFirstRow(
2649 2649
                 'SELECT share_key, increment_id
2650
-                FROM ' . prefixTable('sharekeys_items') . '
2650
+                FROM ' . prefixTable('sharekeys_items').'
2651 2651
                 WHERE object_id = %i AND user_id = %i',
2652 2652
                 $record['id'],
2653 2653
                 $session->get('user-id')
@@ -2674,7 +2674,7 @@  discard block
 block discarded – undo
2674 2674
                 if ((int) $post_user_id !== (int) $session->get('user-id')) {
2675 2675
                     $currentUserKey = DB::queryFirstRow(
2676 2676
                         'SELECT increment_id
2677
-                        FROM ' . prefixTable('sharekeys_items') . '
2677
+                        FROM ' . prefixTable('sharekeys_items').'
2678 2678
                         WHERE object_id = %i AND user_id = %i',
2679 2679
                         $record['id'],
2680 2680
                         $post_user_id
@@ -2697,7 +2697,7 @@  discard block
 block discarded – undo
2697 2697
     // SHould we change step?
2698 2698
     DB::query(
2699 2699
         'SELECT *
2700
-        FROM ' . prefixTable('items') . '
2700
+        FROM ' . prefixTable('items').'
2701 2701
         WHERE perso = 0'
2702 2702
     );
2703 2703
 
@@ -2724,7 +2724,7 @@  discard block
 block discarded – undo
2724 2724
         // Check if user exists
2725 2725
         $userInfo = DB::queryFirstRow(
2726 2726
             'SELECT public_key, encrypted_psk
2727
-            FROM ' . prefixTable('users') . '
2727
+            FROM ' . prefixTable('users').'
2728 2728
             WHERE id = %i',
2729 2729
             $post_user_id
2730 2730
         );
@@ -2749,9 +2749,9 @@  discard block
 block discarded – undo
2749 2749
                 // Loop on persoanl items
2750 2750
                 $rows = DB::query(
2751 2751
                     'SELECT id, pw
2752
-                    FROM ' . prefixTable('items') . '
2752
+                    FROM ' . prefixTable('items').'
2753 2753
                     WHERE perso = 1 AND id_tree IN %ls
2754
-                    LIMIT ' . $post_start . ', ' . $post_length,
2754
+                    LIMIT ' . $post_start.', '.$post_length,
2755 2755
                     $session->get('user-personal_folders')
2756 2756
                 );
2757 2757
                 $countUserPersonalItems = DB::count();
@@ -2794,7 +2794,7 @@  discard block
 block discarded – undo
2794 2794
                         // Loop on files
2795 2795
                         $rows = DB::query(
2796 2796
                             'SELECT id, file
2797
-                            FROM ' . prefixTable('files') . '
2797
+                            FROM ' . prefixTable('files').'
2798 2798
                             WHERE status != %s
2799 2799
                             AND id_item = %i',
2800 2800
                             TP_ENCRYPTION_NAME,
@@ -2805,14 +2805,14 @@  discard block
 block discarded – undo
2805 2805
                             // Now decrypt the file
2806 2806
                             prepareFileWithDefuse(
2807 2807
                                 'decrypt',
2808
-                                $SETTINGS['path_to_upload_folder'] . '/' . $record2['file'],
2809
-                                $SETTINGS['path_to_upload_folder'] . '/' . $record2['file'] . '.delete',
2808
+                                $SETTINGS['path_to_upload_folder'].'/'.$record2['file'],
2809
+                                $SETTINGS['path_to_upload_folder'].'/'.$record2['file'].'.delete',
2810 2810
                                 $SETTINGS,
2811 2811
                                 $post_user_psk
2812 2812
                             );
2813 2813
 
2814 2814
                             // Encrypt the file
2815
-                            $encryptedFile = encryptFile($record2['file'] . '.delete', $SETTINGS['path_to_upload_folder']);
2815
+                            $encryptedFile = encryptFile($record2['file'].'.delete', $SETTINGS['path_to_upload_folder']);
2816 2816
 
2817 2817
                             DB::update(
2818 2818
                                 prefixTable('files'),
@@ -2835,7 +2835,7 @@  discard block
 block discarded – undo
2835 2835
                             );
2836 2836
 
2837 2837
                             // Unlink original file
2838
-                            unlink($SETTINGS['path_to_upload_folder'] . '/' . $record2['file']);
2838
+                            unlink($SETTINGS['path_to_upload_folder'].'/'.$record2['file']);
2839 2839
                         }
2840 2840
                     }
2841 2841
                 }
@@ -2907,7 +2907,7 @@  discard block
 block discarded – undo
2907 2907
         // Get user info
2908 2908
         $userData = DB::queryFirstRow(
2909 2909
             'SELECT '.$post_fields.'
2910
-            FROM ' . prefixTable('users') . '
2910
+            FROM ' . prefixTable('users').'
2911 2911
             WHERE id = %i',
2912 2912
             $post_user_id
2913 2913
         );
@@ -2954,7 +2954,7 @@  discard block
 block discarded – undo
2954 2954
         // Get user info
2955 2955
         $userData = DB::queryFirstRow(
2956 2956
             'SELECT auth_type, login, private_key
2957
-            FROM ' . prefixTable('users') . '
2957
+            FROM ' . prefixTable('users').'
2958 2958
             WHERE id = %i',
2959 2959
             $post_user_id
2960 2960
         );
@@ -3004,7 +3004,7 @@  discard block
 block discarded – undo
3004 3004
                 return prepareExchangedData(
3005 3005
                     array(
3006 3006
                         'error' => false,
3007
-                        'message' => $lang->get('done'),'',
3007
+                        'message' => $lang->get('done'), '',
3008 3008
                     ),
3009 3009
                     'encode'
3010 3010
                 );
@@ -3054,7 +3054,7 @@  discard block
 block discarded – undo
3054 3054
         // Get user info
3055 3055
         $userData = DB::queryFirstRow(
3056 3056
             'SELECT auth_type, login, private_key, special
3057
-            FROM ' . prefixTable('users') . '
3057
+            FROM ' . prefixTable('users').'
3058 3058
             WHERE id = %i',
3059 3059
             $post_user_id
3060 3060
         );
@@ -3088,7 +3088,7 @@  discard block
 block discarded – undo
3088 3088
                 return prepareExchangedData(
3089 3089
                     array(
3090 3090
                         'error' => false,
3091
-                        'message' => $lang->get('done'),'',
3091
+                        'message' => $lang->get('done'), '',
3092 3092
                     ),
3093 3093
                     'encode'
3094 3094
                 );
@@ -3112,14 +3112,14 @@  discard block
 block discarded – undo
3112 3112
             // Get one item
3113 3113
             $record = DB::queryFirstRow(
3114 3114
                 'SELECT id, pw
3115
-                FROM ' . prefixTable('items') . '
3115
+                FROM ' . prefixTable('items').'
3116 3116
                 WHERE perso = 0'
3117 3117
             );
3118 3118
 
3119 3119
             // Get itemKey from current user
3120 3120
             $currentUserKey = DB::queryFirstRow(
3121 3121
                 'SELECT share_key, increment_id
3122
-                FROM ' . prefixTable('sharekeys_items') . '
3122
+                FROM ' . prefixTable('sharekeys_items').'
3123 3123
                 WHERE object_id = %i AND user_id = %i',
3124 3124
                 $record['id'],
3125 3125
                 $post_user_id
@@ -3208,7 +3208,7 @@  discard block
 block discarded – undo
3208 3208
             $session->get('user-id')
3209 3209
         );
3210 3210
         // Return data
3211
-        return '[{"new_value":"' . $session->get('user-session_duration') . '"}]';
3211
+        return '[{"new_value":"'.$session->get('user-session_duration').'"}]';
3212 3212
     }
3213 3213
     
3214 3214
     return '[{"new_value":"expired"}]';
Please login to merge, or discard this patch.
sources/core.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -54,16 +54,16 @@  discard block
 block discarded – undo
54 54
 {
55 55
     // Load AntiXSS
56 56
     $antiXss = new AntiXSS();
57
-    if (! headers_sent()) {    //If headers not sent yet... then do php redirect
58
-        header('Location: ' . $antiXss->xss_clean($url));
57
+    if (!headers_sent()) {    //If headers not sent yet... then do php redirect
58
+        header('Location: '.$antiXss->xss_clean($url));
59 59
     }
60 60
 
61 61
     //If headers are sent... do java redirect... if java disabled, do html redirect.
62 62
     echo '<script type="text/javascript">';
63
-    echo 'window.location.href="' . $antiXss->xss_clean($url) . '";';
63
+    echo 'window.location.href="'.$antiXss->xss_clean($url).'";';
64 64
     echo '</script>';
65 65
     echo '<noscript>';
66
-    echo '<meta http-equiv="refresh" content="0;url=' . $antiXss->xss_clean($url) . '" />';
66
+    echo '<meta http-equiv="refresh" content="0;url='.$antiXss->xss_clean($url).'" />';
67 67
     echo '</noscript>';
68 68
 }
69 69
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     && isset($SETTINGS['enable_sts']) === true
90 90
     && (int) $SETTINGS['enable_sts'] === 1
91 91
 ) {
92
-    teampassRedirect('https://' . $server['http_host'] . $server['request_uri']);
92
+    teampassRedirect('https://'.$server['http_host'].$server['request_uri']);
93 93
 }
94 94
 
95 95
 // Load pwComplexity
@@ -110,11 +110,11 @@  discard block
 block discarded – undo
110 110
 // LOAD CPASSMAN SETTINGS
111 111
 if (
112 112
     isset($SETTINGS['cpassman_dir']) === true
113
-    && is_dir($SETTINGS['cpassman_dir'] . '/install') === true
113
+    && is_dir($SETTINGS['cpassman_dir'].'/install') === true
114 114
 ) {
115 115
     // Should we delete folder INSTALL?
116 116
     $row = DB::queryFirstRow(
117
-        'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type=%s AND intitule=%s',
117
+        'SELECT valeur FROM '.prefixTable('misc').' WHERE type=%s AND intitule=%s',
118 118
         'install',
119 119
         'clear_install_folder'
120 120
     );
@@ -132,11 +132,11 @@  discard block
 block discarded – undo
132 132
             if ($directories !== false) {
133 133
                 $files = array_diff($directories, ['.', '..']);
134 134
                 foreach ($files as $file) {
135
-                    if (is_dir($dir . '/' . $file)) {
136
-                        delTree($dir . '/' . $file);
135
+                    if (is_dir($dir.'/'.$file)) {
136
+                        delTree($dir.'/'.$file);
137 137
                     } else {
138 138
                         try {
139
-                            unlink($dir . '/' . $file);
139
+                            unlink($dir.'/'.$file);
140 140
                         } catch (Exception $e) {
141 141
                             // do nothing... php will ignore and continue
142 142
                         }
@@ -150,13 +150,13 @@  discard block
 block discarded – undo
150 150
             return false;
151 151
         }
152 152
 
153
-        if (is_dir($SETTINGS['cpassman_dir'] . '/install')) {
153
+        if (is_dir($SETTINGS['cpassman_dir'].'/install')) {
154 154
             // Set the permissions on the install directory and delete
155 155
             // is server Windows or Linux?
156 156
             if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
157
-                recursiveChmod($SETTINGS['cpassman_dir'] . '/install', 0755, 0440);
157
+                recursiveChmod($SETTINGS['cpassman_dir'].'/install', 0755, 0440);
158 158
             }
159
-            delTree($SETTINGS['cpassman_dir'] . '/install');
159
+            delTree($SETTINGS['cpassman_dir'].'/install');
160 160
         }
161 161
 
162 162
         // Delete temporary install table
@@ -174,10 +174,10 @@  discard block
 block discarded – undo
174 174
 // Load Languages stuff
175 175
 if (isset($languagesList) === false) {
176 176
     $languagesList = [];
177
-    $rows = DB::query('SELECT * FROM ' . prefixTable('languages') . ' GROUP BY name, label, code, flag, id ORDER BY name ASC');
177
+    $rows = DB::query('SELECT * FROM '.prefixTable('languages').' GROUP BY name, label, code, flag, id ORDER BY name ASC');
178 178
     foreach ($rows as $record) {
179 179
         array_push($languagesList, $record['name']);
180
-        if ($session->get('user-language') === $record['name'] ) {
180
+        if ($session->get('user-language') === $record['name']) {
181 181
             $session->set('user-language_flag', $record['flag']);
182 182
             $session->set('user-language_code', $record['code']);
183 183
             //$session->set('user-language_label', $record['label']);
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 // CHECK IF SESSION EXISTS AND IF SESSION IS VALID
236 236
 if (empty($session->get('user-session_duration')) === false) {
237 237
     $dataSession = DB::queryFirstRow(
238
-        'SELECT key_tempo FROM ' . prefixTable('users') . ' WHERE id=%i',
238
+        'SELECT key_tempo FROM '.prefixTable('users').' WHERE id=%i',
239 239
         $session->get('user-id')
240 240
     );
241 241
 } else {
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
     && (null !== $session->get('user-admin') && $session->get('user-admin') === 1)
300 300
 ) {
301 301
     $row = DB::queryFirstRow(
302
-        'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type=%s_type AND intitule=%s_intitule',
302
+        'SELECT valeur FROM '.prefixTable('misc').' WHERE type=%s_type AND intitule=%s_intitule',
303 303
         [
304 304
             'type' => 'admin',
305 305
             'intitule' => 'teampass_version',
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 
341 341
         syslog(
342 342
             LOG_WARNING,
343
-            'Unlog user: ' . date('Y/m/d H:i:s') . " {$server['remote_addr']} ({$server['http_user_agent']})"
343
+            'Unlog user: '.date('Y/m/d H:i:s')." {$server['remote_addr']} ({$server['http_user_agent']})"
344 344
         );
345 345
         // erase session table
346 346
         $_SESSION = [];
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 if (null !== $session->get('user-id') && empty($session->get('user-id')) === false) {
397 397
     // query on user
398 398
     $data = DB::queryfirstrow(
399
-        'SELECT login, admin, gestionnaire, can_manage_all_users, groupes_visibles, groupes_interdits, fonction_id, last_connexion, roles_from_ad_groups FROM ' . prefixTable('users') . ' WHERE id=%i',
399
+        'SELECT login, admin, gestionnaire, can_manage_all_users, groupes_visibles, groupes_interdits, fonction_id, last_connexion, roles_from_ad_groups FROM '.prefixTable('users').' WHERE id=%i',
400 400
         $session->get('user-id')
401 401
     );
402 402
     //Check if user has been deleted or unlogged
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
             $data['groupes_visibles'],
444 444
             $data['groupes_interdits'],
445 445
             $data['admin'],
446
-            is_null($data['roles_from_ad_groups']) === true ? $data['fonction_id'] : (empty($data['roles_from_ad_groups']) === true ? $data['fonction_id'] : $data['fonction_id'] . ';' . $data['roles_from_ad_groups']),
446
+            is_null($data['roles_from_ad_groups']) === true ? $data['fonction_id'] : (empty($data['roles_from_ad_groups']) === true ? $data['fonction_id'] : $data['fonction_id'].';'.$data['roles_from_ad_groups']),
447 447
             $SETTINGS
448 448
         );
449 449
         if (null !== $session->get('user-can_create_root_folder') && (int) $session->get('user-can_create_root_folder') === 1) {
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
     $session->set('system-item_fields', []);
479 479
     $rows = DB::query(
480 480
         'SELECT *
481
-            FROM ' . prefixTable('categories') . '
481
+            FROM ' . prefixTable('categories').'
482 482
             WHERE level=%i',
483 483
         '0'
484 484
     );
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
         // get each field
488 488
         $rows2 = DB::query(
489 489
             'SELECT *
490
-            FROM ' . prefixTable('categories') . '
490
+            FROM ' . prefixTable('categories').'
491 491
             WHERE parent_id=%i
492 492
             ORDER BY `order` ASC',
493 493
             $record['id']
@@ -574,5 +574,5 @@  discard block
 block discarded – undo
574 574
 }
575 575
 
576 576
 /* CHECK NUMBER OF USER ONLINE */
577
-DB::query('SELECT * FROM ' . prefixTable('users') . ' WHERE timestamp>=%i', time() - 600);
577
+DB::query('SELECT * FROM '.prefixTable('users').' WHERE timestamp>=%i', time() - 600);
578 578
 $session->set('system-nb_users_online', DB::count());
Please login to merge, or discard this patch.
sources/main.functions.php 1 patch
Spacing   +149 added lines, -152 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
 // Load config if $SETTINGS not defined
52 52
 if (isset($SETTINGS['cpassman_dir']) === false || empty($SETTINGS['cpassman_dir']) === true) {
53
-    include_once __DIR__ . '/../includes/config/tp.config.php';
53
+    include_once __DIR__.'/../includes/config/tp.config.php';
54 54
 }
55 55
 
56 56
 header('Content-type: text/html; charset=utf-8');
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
  */
220 220
 function trimElement($chaine, string $element): string
221 221
 {
222
-    if (! empty($chaine)) {
222
+    if (!empty($chaine)) {
223 223
         if (is_array($chaine) === true) {
224 224
             $chaine = implode(';', $chaine);
225 225
         }
@@ -267,8 +267,8 @@  discard block
 block discarded – undo
267 267
  */
268 268
 function db_error_handler(array $params): void
269 269
 {
270
-    echo 'Error: ' . $params['error'] . "<br>\n";
271
-    echo 'Query: ' . $params['query'] . "<br>\n";
270
+    echo 'Error: '.$params['error']."<br>\n";
271
+    echo 'Query: '.$params['query']."<br>\n";
272 272
     throw new Exception('Error - Query', 1);
273 273
 }
274 274
 
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
     $globalsVisibleFolders = $session->get('user-accessible_folders');
349 349
     $globalsPersonalVisibleFolders = $session->get('user-personal_visible_folders');
350 350
     // Get list of Folders
351
-    $rows = DB::query('SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', 0);
351
+    $rows = DB::query('SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', 0);
352 352
     foreach ($rows as $record) {
353 353
         array_push($groupesVisibles, $record['id']);
354 354
     }
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
     }
368 368
     // Get ID of personal folder
369 369
     $persfld = DB::queryfirstrow(
370
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE title = %s',
370
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE title = %s',
371 371
         $globalsUserId
372 372
     );
373 373
     if (empty($persfld['id']) === false) {
@@ -387,20 +387,20 @@  discard block
 block discarded – undo
387 387
     // get complete list of ROLES
388 388
     $tmp = explode(';', $idFonctions);
389 389
     $rows = DB::query(
390
-        'SELECT * FROM ' . prefixTable('roles_title') . '
390
+        'SELECT * FROM '.prefixTable('roles_title').'
391 391
         ORDER BY title ASC'
392 392
     );
393 393
     foreach ($rows as $record) {
394
-        if (! empty($record['id']) && ! in_array($record['id'], $tmp)) {
394
+        if (!empty($record['id']) && !in_array($record['id'], $tmp)) {
395 395
             array_push($tmp, $record['id']);
396 396
         }
397 397
     }
398 398
     $session->set('user-roles', implode(';', $tmp));
399 399
     $session->set('user-admin', 1);
400 400
     // Check if admin has created Folders and Roles
401
-    DB::query('SELECT * FROM ' . prefixTable('nested_tree') . '');
401
+    DB::query('SELECT * FROM '.prefixTable('nested_tree').'');
402 402
     $session->set('user-nb_folders', DB::count());
403
-    DB::query('SELECT * FROM ' . prefixTable('roles_title'));
403
+    DB::query('SELECT * FROM '.prefixTable('roles_title'));
404 404
     $session->set('user-nb_roles', DB::count());
405 405
 
406 406
     return true;
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
     // Does this user is allowed to see other items
484 484
     $inc = 0;
485 485
     $rows = DB::query(
486
-        'SELECT id, id_tree FROM ' . prefixTable('items') . '
486
+        'SELECT id, id_tree FROM '.prefixTable('items').'
487 487
             WHERE restricted_to LIKE %ss AND inactif = %s'.
488 488
             (count($allowedFolders) > 0 ? ' AND id_tree NOT IN ('.implode(',', $allowedFolders).')' : ''),
489 489
         $globalsUserId,
@@ -500,8 +500,8 @@  discard block
 block discarded – undo
500 500
     // Check for the users roles if some specific rights exist on items
501 501
     $rows = DB::query(
502 502
         'SELECT i.id_tree, r.item_id
503
-        FROM ' . prefixTable('items') . ' as i
504
-        INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (r.item_id=i.id)
503
+        FROM ' . prefixTable('items').' as i
504
+        INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (r.item_id=i.id)
505 505
         WHERE i.id_tree <> "" '.
506 506
         (count($userRoles) > 0 ? 'AND r.role_id IN %li ' : '').
507 507
         'ORDER BY i.id_tree ASC',
@@ -555,16 +555,16 @@  discard block
 block discarded – undo
555 555
         ), SORT_NUMERIC)
556 556
     );
557 557
     // Folders and Roles numbers
558
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('nested_tree') . '');
558
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('nested_tree').'');
559 559
     $session->set('user-nb_folders', DB::count());
560
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('roles_title'));
560
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('roles_title'));
561 561
     $session->set('user-nb_roles', DB::count());
562 562
     // check if change proposals on User's items
563 563
     if (isset($SETTINGS['enable_suggestion']) === true && (int) $SETTINGS['enable_suggestion'] === 1) {
564 564
         $countNewItems = DB::query(
565 565
             'SELECT COUNT(*)
566
-            FROM ' . prefixTable('items_change') . ' AS c
567
-            LEFT JOIN ' . prefixTable('log_items') . ' AS i ON (c.item_id = i.id_item)
566
+            FROM ' . prefixTable('items_change').' AS c
567
+            LEFT JOIN ' . prefixTable('log_items').' AS i ON (c.item_id = i.id_item)
568 568
             WHERE i.action = %s AND i.id_user = %i',
569 569
             'at_creation',
570 570
             $globalsUserId
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
 {
592 592
     $rows = DB::query(
593 593
         'SELECT *
594
-        FROM ' . prefixTable('roles_values') . '
594
+        FROM ' . prefixTable('roles_values').'
595 595
         WHERE type IN %ls'.(count($userRoles) > 0 ? ' AND role_id IN %li' : ''),
596 596
         ['W', 'ND', 'NE', 'NDNE', 'R'],
597 597
         $userRoles,
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
     ) {
659 659
         $persoFld = DB::queryfirstrow(
660 660
             'SELECT id
661
-            FROM ' . prefixTable('nested_tree') . '
661
+            FROM ' . prefixTable('nested_tree').'
662 662
             WHERE title = %s AND personal_folder = %i'.
663 663
             (count($allowedFolders) > 0 ? ' AND id NOT IN ('.implode(',', $allowedFolders).')' : ''),
664 664
             $globalsUserId,
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
     }
692 692
     $persoFlds = DB::query(
693 693
         'SELECT id
694
-        FROM ' . prefixTable('nested_tree') . '
694
+        FROM ' . prefixTable('nested_tree').'
695 695
         WHERE %l',
696 696
         $where
697 697
     );
@@ -759,12 +759,12 @@  discard block
 block discarded – undo
759 759
     //Load Tree
760 760
     $tree = new NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
761 761
     // truncate table
762
-    DB::query('TRUNCATE TABLE ' . prefixTable('cache'));
762
+    DB::query('TRUNCATE TABLE '.prefixTable('cache'));
763 763
     // reload date
764 764
     $rows = DB::query(
765 765
         'SELECT *
766
-        FROM ' . prefixTable('items') . ' as i
767
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
766
+        FROM ' . prefixTable('items').' as i
767
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
768 768
         AND l.action = %s
769 769
         AND i.inactif = %i',
770 770
         'at_creation',
@@ -776,18 +776,18 @@  discard block
 block discarded – undo
776 776
             $tags = '';
777 777
             $itemTags = DB::query(
778 778
                 'SELECT tag
779
-                FROM ' . prefixTable('tags') . '
779
+                FROM ' . prefixTable('tags').'
780 780
                 WHERE item_id = %i AND tag != ""',
781 781
                 $record['id']
782 782
             );
783 783
             foreach ($itemTags as $itemTag) {
784
-                $tags .= $itemTag['tag'] . ' ';
784
+                $tags .= $itemTag['tag'].' ';
785 785
             }
786 786
 
787 787
             // Get renewal period
788 788
             $resNT = DB::queryfirstrow(
789 789
                 'SELECT renewal_period
790
-                FROM ' . prefixTable('nested_tree') . '
790
+                FROM ' . prefixTable('nested_tree').'
791 791
                 WHERE id = %i',
792 792
                 $record['id_tree']
793 793
             );
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
                     // Is this a User id?
801 801
                     $user = DB::queryfirstrow(
802 802
                         'SELECT id, login
803
-                        FROM ' . prefixTable('users') . '
803
+                        FROM ' . prefixTable('users').'
804 804
                         WHERE id = %i',
805 805
                         $elem->title
806 806
                     );
@@ -818,11 +818,11 @@  discard block
 block discarded – undo
818 818
                     'id' => $record['id'],
819 819
                     'label' => $record['label'],
820 820
                     'description' => $record['description'] ?? '',
821
-                    'url' => isset($record['url']) && ! empty($record['url']) ? $record['url'] : '0',
821
+                    'url' => isset($record['url']) && !empty($record['url']) ? $record['url'] : '0',
822 822
                     'tags' => $tags,
823 823
                     'id_tree' => $record['id_tree'],
824 824
                     'perso' => $record['perso'],
825
-                    'restricted_to' => isset($record['restricted_to']) && ! empty($record['restricted_to']) ? $record['restricted_to'] : '0',
825
+                    'restricted_to' => isset($record['restricted_to']) && !empty($record['restricted_to']) ? $record['restricted_to'] : '0',
826 826
                     'login' => $record['login'] ?? '',
827 827
                     'folder' => implode(' > ', $folder),
828 828
                     'author' => $record['id_user'],
@@ -851,7 +851,7 @@  discard block
 block discarded – undo
851 851
     // get new value from db
852 852
     $data = DB::queryfirstrow(
853 853
         'SELECT label, description, id_tree, perso, restricted_to, login, url
854
-        FROM ' . prefixTable('items') . '
854
+        FROM ' . prefixTable('items').'
855 855
         WHERE id=%i',
856 856
         $ident
857 857
     );
@@ -859,12 +859,12 @@  discard block
 block discarded – undo
859 859
     $tags = '';
860 860
     $itemTags = DB::query(
861 861
         'SELECT tag
862
-            FROM ' . prefixTable('tags') . '
862
+            FROM ' . prefixTable('tags').'
863 863
             WHERE item_id = %i AND tag != ""',
864 864
         $ident
865 865
     );
866 866
     foreach ($itemTags as $itemTag) {
867
-        $tags .= $itemTag['tag'] . ' ';
867
+        $tags .= $itemTag['tag'].' ';
868 868
     }
869 869
     // form id_tree to full foldername
870 870
     $folder = [];
@@ -875,7 +875,7 @@  discard block
 block discarded – undo
875 875
             // Is this a User id?
876 876
             $user = DB::queryfirstrow(
877 877
                 'SELECT id, login
878
-                FROM ' . prefixTable('users') . '
878
+                FROM ' . prefixTable('users').'
879 879
                 WHERE id = %i',
880 880
                 $elem->title
881 881
             );
@@ -893,10 +893,10 @@  discard block
 block discarded – undo
893 893
             'label' => $data['label'],
894 894
             'description' => $data['description'],
895 895
             'tags' => $tags,
896
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
896
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
897 897
             'id_tree' => $data['id_tree'],
898 898
             'perso' => $data['perso'],
899
-            'restricted_to' => isset($data['restricted_to']) && ! empty($data['restricted_to']) ? $data['restricted_to'] : '0',
899
+            'restricted_to' => isset($data['restricted_to']) && !empty($data['restricted_to']) ? $data['restricted_to'] : '0',
900 900
             'login' => $data['login'] ?? '',
901 901
             'folder' => implode(' » ', $folder),
902 902
             'author' => $session->get('user-id'),
@@ -926,8 +926,8 @@  discard block
 block discarded – undo
926 926
     // get new value from db
927 927
     $data = DB::queryFirstRow(
928 928
         'SELECT i.label, i.description, i.id_tree as id_tree, i.perso, i.restricted_to, i.id, i.login, i.url, l.date
929
-        FROM ' . prefixTable('items') . ' as i
930
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
929
+        FROM ' . prefixTable('items').' as i
930
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
931 931
         WHERE i.id = %i
932 932
         AND l.action = %s',
933 933
         $ident,
@@ -937,12 +937,12 @@  discard block
 block discarded – undo
937 937
     $tags = '';
938 938
     $itemTags = DB::query(
939 939
         'SELECT tag
940
-            FROM ' . prefixTable('tags') . '
940
+            FROM ' . prefixTable('tags').'
941 941
             WHERE item_id = %i AND tag != ""',
942 942
         $ident
943 943
     );
944 944
     foreach ($itemTags as $itemTag) {
945
-        $tags .= $itemTag['tag'] . ' ';
945
+        $tags .= $itemTag['tag'].' ';
946 946
     }
947 947
     // form id_tree to full foldername
948 948
     $folder = [];
@@ -953,7 +953,7 @@  discard block
 block discarded – undo
953 953
             // Is this a User id?
954 954
             $user = DB::queryfirstrow(
955 955
                 'SELECT id, login
956
-                FROM ' . prefixTable('users') . '
956
+                FROM ' . prefixTable('users').'
957 957
                 WHERE id = %i',
958 958
                 $elem->title
959 959
             );
@@ -972,7 +972,7 @@  discard block
 block discarded – undo
972 972
             'label' => $data['label'],
973 973
             'description' => $data['description'],
974 974
             'tags' => isset($tags) && empty($tags) === false ? $tags : 'None',
975
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
975
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
976 976
             'id_tree' => $data['id_tree'],
977 977
             'perso' => isset($data['perso']) && empty($data['perso']) === false && $data['perso'] !== 'None' ? $data['perso'] : '0',
978 978
             'restricted_to' => isset($data['restricted_to']) && empty($data['restricted_to']) === false ? $data['restricted_to'] : '0',
@@ -994,52 +994,52 @@  discard block
 block discarded – undo
994 994
 function getStatisticsData(array $SETTINGS): array
995 995
 {
996 996
     DB::query(
997
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
997
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
998 998
         0
999 999
     );
1000 1000
     $counter_folders = DB::count();
1001 1001
     DB::query(
1002
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
1002
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
1003 1003
         1
1004 1004
     );
1005 1005
     $counter_folders_perso = DB::count();
1006 1006
     DB::query(
1007
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
1007
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
1008 1008
         0
1009 1009
     );
1010 1010
     $counter_items = DB::count();
1011 1011
         DB::query(
1012
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
1012
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
1013 1013
         1
1014 1014
     );
1015 1015
     $counter_items_perso = DB::count();
1016 1016
         DB::query(
1017
-        'SELECT id FROM ' . prefixTable('users') . ''
1017
+        'SELECT id FROM '.prefixTable('users').''
1018 1018
     );
1019 1019
     $counter_users = DB::count();
1020 1020
         DB::query(
1021
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE admin = %i',
1021
+        'SELECT id FROM '.prefixTable('users').' WHERE admin = %i',
1022 1022
         1
1023 1023
     );
1024 1024
     $admins = DB::count();
1025 1025
     DB::query(
1026
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE gestionnaire = %i',
1026
+        'SELECT id FROM '.prefixTable('users').' WHERE gestionnaire = %i',
1027 1027
         1
1028 1028
     );
1029 1029
     $managers = DB::count();
1030 1030
     DB::query(
1031
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE read_only = %i',
1031
+        'SELECT id FROM '.prefixTable('users').' WHERE read_only = %i',
1032 1032
         1
1033 1033
     );
1034 1034
     $readOnly = DB::count();
1035 1035
     // list the languages
1036 1036
     $usedLang = [];
1037 1037
     $tp_languages = DB::query(
1038
-        'SELECT name FROM ' . prefixTable('languages')
1038
+        'SELECT name FROM '.prefixTable('languages')
1039 1039
     );
1040 1040
     foreach ($tp_languages as $tp_language) {
1041 1041
         DB::query(
1042
-            'SELECT * FROM ' . prefixTable('users') . ' WHERE user_language = %s',
1042
+            'SELECT * FROM '.prefixTable('users').' WHERE user_language = %s',
1043 1043
             $tp_language['name']
1044 1044
         );
1045 1045
         $usedLang[$tp_language['name']] = round((DB::count() * 100 / $counter_users), 0);
@@ -1048,12 +1048,12 @@  discard block
 block discarded – undo
1048 1048
     // get list of ips
1049 1049
     $usedIp = [];
1050 1050
     $tp_ips = DB::query(
1051
-        'SELECT user_ip FROM ' . prefixTable('users')
1051
+        'SELECT user_ip FROM '.prefixTable('users')
1052 1052
     );
1053 1053
     foreach ($tp_ips as $ip) {
1054 1054
         if (array_key_exists($ip['user_ip'], $usedIp)) {
1055 1055
             $usedIp[$ip['user_ip']] += $usedIp[$ip['user_ip']];
1056
-        } elseif (! empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1056
+        } elseif (!empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1057 1057
             $usedIp[$ip['user_ip']] = 1;
1058 1058
         }
1059 1059
     }
@@ -1206,7 +1206,7 @@  discard block
 block discarded – undo
1206 1206
 {
1207 1207
     // Load PHPMailer
1208 1208
     $mail = new PHPMailer(true);
1209
-    $languageDir = $SETTINGS['cpassman_dir'] . '/vendor/phpmailer/phpmailer/language/';
1209
+    $languageDir = $SETTINGS['cpassman_dir'].'/vendor/phpmailer/phpmailer/language/';
1210 1210
 
1211 1211
     try {
1212 1212
         // Set language and SMTPDebug
@@ -1357,7 +1357,7 @@  discard block
 block discarded – undo
1357 1357
         <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;">
1358 1358
         <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;">
1359 1359
         <br><div style="float:right;">' .
1360
-        $textMail .
1360
+        $textMail.
1361 1361
         '<br><br></td></tr></table>
1362 1362
     </td></tr></table>
1363 1363
     <br></body></html>';
@@ -1370,7 +1370,7 @@  discard block
 block discarded – undo
1370 1370
  */
1371 1371
 function generateKey(): string
1372 1372
 {
1373
-    return substr(md5(rand() . rand()), 0, 15);
1373
+    return substr(md5(rand().rand()), 0, 15);
1374 1374
 }
1375 1375
 
1376 1376
 /**
@@ -1448,7 +1448,7 @@  discard block
 block discarded – undo
1448 1448
 {
1449 1449
     array_walk_recursive(
1450 1450
         $array,
1451
-        static function (&$item): void {
1451
+        static function(&$item): void {
1452 1452
             if (mb_detect_encoding((string) $item, 'utf-8', true) === false) {
1453 1453
                 $item = mb_convert_encoding($item, 'ISO-8859-1', 'UTF-8');
1454 1454
             }
@@ -1475,7 +1475,7 @@  discard block
 block discarded – undo
1475 1475
         //$session->set('key', $cookieValue);
1476 1476
         //error_log('DEBUG : Réinitialisation de la clé de session ' . $session->get('key'));
1477 1477
     }
1478
-    error_log(strtoupper($type).' - Valeur de la clé de session ' . $session->get('key')." --- et la valeur du COOKIE : ".$cookieValue);
1478
+    error_log(strtoupper($type).' - Valeur de la clé de session '.$session->get('key')." --- et la valeur du COOKIE : ".$cookieValue);
1479 1479
     // Perform
1480 1480
     if ($type === 'encode' && is_array($data) === true) {
1481 1481
         // Now encode
@@ -1547,7 +1547,7 @@  discard block
 block discarded – undo
1547 1547
  */
1548 1548
 function prefixTable(string $table): string
1549 1549
 {
1550
-    $safeTable = htmlspecialchars(DB_PREFIX . $table);
1550
+    $safeTable = htmlspecialchars(DB_PREFIX.$table);
1551 1551
     if (empty($safeTable) === false) {
1552 1552
         // sanitize string
1553 1553
         return $safeTable;
@@ -1611,7 +1611,7 @@  discard block
 block discarded – undo
1611 1611
 function send_syslog($message, $host, $port, $component = 'teampass'): void
1612 1612
 {
1613 1613
     $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
1614
-    $syslog_message = '<123>' . date('M d H:i:s ') . $component . ': ' . $message;
1614
+    $syslog_message = '<123>'.date('M d H:i:s ').$component.': '.$message;
1615 1615
     socket_sendto($sock, (string) $syslog_message, strlen($syslog_message), 0, (string) $host, (int) $port);
1616 1616
     socket_close($sock);
1617 1617
 }
@@ -1658,14 +1658,14 @@  discard block
 block discarded – undo
1658 1658
     if (isset($SETTINGS['syslog_enable']) === true && (int) $SETTINGS['syslog_enable'] === 1) {
1659 1659
         if ($type === 'user_mngt') {
1660 1660
             send_syslog(
1661
-                'action=' . str_replace('at_', '', $label) . ' attribute=user user=' . $who . ' userid="' . $login . '" change="' . $field_1 . '" ',
1661
+                'action='.str_replace('at_', '', $label).' attribute=user user='.$who.' userid="'.$login.'" change="'.$field_1.'" ',
1662 1662
                 $SETTINGS['syslog_host'],
1663 1663
                 $SETTINGS['syslog_port'],
1664 1664
                 'teampass'
1665 1665
             );
1666 1666
         } else {
1667 1667
             send_syslog(
1668
-                'action=' . $type . ' attribute=' . $label . ' user=' . $who . ' userid="' . $login . '" ',
1668
+                'action='.$type.' attribute='.$label.' user='.$who.' userid="'.$login.'" ',
1669 1669
                 $SETTINGS['syslog_host'],
1670 1670
                 $SETTINGS['syslog_port'],
1671 1671
                 'teampass'
@@ -1739,7 +1739,7 @@  discard block
 block discarded – undo
1739 1739
         if (empty($item_label) === true) {
1740 1740
             $dataItem = DB::queryfirstrow(
1741 1741
                 'SELECT id, id_tree, label
1742
-                FROM ' . prefixTable('items') . '
1742
+                FROM ' . prefixTable('items').'
1743 1743
                 WHERE id = %i',
1744 1744
                 $item_id
1745 1745
             );
@@ -1747,11 +1747,11 @@  discard block
 block discarded – undo
1747 1747
         }
1748 1748
 
1749 1749
         send_syslog(
1750
-            'action=' . str_replace('at_', '', $action) .
1751
-                ' attribute=' . str_replace('at_', '', $attribute[0]) .
1752
-                ' itemno=' . $item_id .
1753
-                ' user=' . is_null($login) === true ? '' : addslashes((string) $login) .
1754
-                ' itemname="' . addslashes($item_label) . '"',
1750
+            'action='.str_replace('at_', '', $action).
1751
+                ' attribute='.str_replace('at_', '', $attribute[0]).
1752
+                ' itemno='.$item_id.
1753
+                ' user='.is_null($login) === true ? '' : addslashes((string) $login).
1754
+                ' itemname="'.addslashes($item_label).'"',
1755 1755
             $SETTINGS['syslog_host'],
1756 1756
             $SETTINGS['syslog_port'],
1757 1757
             'teampass'
@@ -1783,8 +1783,8 @@  discard block
 block discarded – undo
1783 1783
     $notification = DB::queryOneColumn(
1784 1784
         'email',
1785 1785
         'SELECT *
1786
-        FROM ' . prefixTable('notification') . ' AS n
1787
-        INNER JOIN ' . prefixTable('users') . ' AS u ON (n.user_id = u.id)
1786
+        FROM ' . prefixTable('notification').' AS n
1787
+        INNER JOIN ' . prefixTable('users').' AS u ON (n.user_id = u.id)
1788 1788
         WHERE n.item_id = %i AND n.user_id != %i',
1789 1789
         $item_id,
1790 1790
         $globalsUserId
@@ -1795,7 +1795,7 @@  discard block
 block discarded – undo
1795 1795
         // Get list of changes
1796 1796
         $htmlChanges = '<ul>';
1797 1797
         foreach ($changes as $change) {
1798
-            $htmlChanges .= '<li>' . $change . '</li>';
1798
+            $htmlChanges .= '<li>'.$change.'</li>';
1799 1799
         }
1800 1800
         $htmlChanges .= '</ul>';
1801 1801
         // send email
@@ -1832,15 +1832,15 @@  discard block
 block discarded – undo
1832 1832
     $path = '';
1833 1833
     foreach ($arbo as $elem) {
1834 1834
         if (empty($path) === true) {
1835
-            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' ';
1835
+            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' ';
1836 1836
         } else {
1837
-            $path .= '&#8594; ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1837
+            $path .= '&#8594; '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1838 1838
         }
1839 1839
     }
1840 1840
 
1841 1841
     // Build text to show user
1842 1842
     if (empty($label) === false) {
1843
-        return empty($path) === true ? addslashes($label) : addslashes($label) . ' (' . $path . ')';
1843
+        return empty($path) === true ? addslashes($label) : addslashes($label).' ('.$path.')';
1844 1844
     }
1845 1845
     return empty($path) === true ? '' : $path;
1846 1846
 }
@@ -1897,7 +1897,7 @@  discard block
 block discarded – undo
1897 1897
  */
1898 1898
 function handleConfigFile($action, $SETTINGS, $field = null, $value = null)
1899 1899
 {
1900
-    $tp_config_file = $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php';
1900
+    $tp_config_file = $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php';
1901 1901
 
1902 1902
     // Load class DB
1903 1903
     loadClasses('DB');
@@ -1905,8 +1905,8 @@  discard block
 block discarded – undo
1905 1905
     if (file_exists($tp_config_file) === false || $action === 'rebuild') {
1906 1906
         // perform a copy
1907 1907
         if (file_exists($tp_config_file)) {
1908
-            if (! copy($tp_config_file, $tp_config_file . '.' . date('Y_m_d_His', time()))) {
1909
-                return "ERROR: Could not copy file '" . $tp_config_file . "'";
1908
+            if (!copy($tp_config_file, $tp_config_file.'.'.date('Y_m_d_His', time()))) {
1909
+                return "ERROR: Could not copy file '".$tp_config_file."'";
1910 1910
             }
1911 1911
         }
1912 1912
 
@@ -1916,11 +1916,11 @@  discard block
 block discarded – undo
1916 1916
         $data[1] = "global \$SETTINGS;\n";
1917 1917
         $data[2] = "\$SETTINGS = array (\n";
1918 1918
         $rows = DB::query(
1919
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s',
1919
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s',
1920 1920
             'admin'
1921 1921
         );
1922 1922
         foreach ($rows as $record) {
1923
-            array_push($data, "    '" . $record['intitule'] . "' => '" . htmlspecialchars_decode($record['valeur'], ENT_COMPAT) . "',\n");
1923
+            array_push($data, "    '".$record['intitule']."' => '".htmlspecialchars_decode($record['valeur'], ENT_COMPAT)."',\n");
1924 1924
         }
1925 1925
         array_push($data, ");\n");
1926 1926
         $data = array_unique($data);
@@ -1934,15 +1934,15 @@  discard block
 block discarded – undo
1934 1934
                 break;
1935 1935
             }
1936 1936
 
1937
-            if (stristr($line, "'" . $field . "' => '")) {
1938
-                $data[$inc] = "    '" . $field . "' => '" . htmlspecialchars_decode($value ?? '', ENT_COMPAT) . "',\n";
1937
+            if (stristr($line, "'".$field."' => '")) {
1938
+                $data[$inc] = "    '".$field."' => '".htmlspecialchars_decode($value ?? '', ENT_COMPAT)."',\n";
1939 1939
                 $bFound = true;
1940 1940
                 break;
1941 1941
             }
1942 1942
             ++$inc;
1943 1943
         }
1944 1944
         if ($bFound === false) {
1945
-            $data[$inc] = "    '" . $field . "' => '" . htmlspecialchars_decode($value ?? '', ENT_COMPAT). "',\n);\n";
1945
+            $data[$inc] = "    '".$field."' => '".htmlspecialchars_decode($value ?? '', ENT_COMPAT)."',\n);\n";
1946 1946
         }
1947 1947
     }
1948 1948
 
@@ -1972,7 +1972,7 @@  discard block
 block discarded – undo
1972 1972
 {
1973 1973
     global $SETTINGS;
1974 1974
     /* LOAD CPASSMAN SETTINGS */
1975
-    if (! isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
1975
+    if (!isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
1976 1976
         $SETTINGS = [];
1977 1977
         $SETTINGS['duplicate_folder'] = 0;
1978 1978
         //by default, this is set to 0;
@@ -1982,7 +1982,7 @@  discard block
 block discarded – undo
1982 1982
         //by default, this value is set to 5;
1983 1983
         $settings = [];
1984 1984
         $rows = DB::query(
1985
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s_type OR type=%s_type2',
1985
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s_type OR type=%s_type2',
1986 1986
             [
1987 1987
                 'type' => 'admin',
1988 1988
                 'type2' => 'settings',
@@ -2014,7 +2014,7 @@  discard block
 block discarded – undo
2014 2014
     $source_cf = [];
2015 2015
     $rows = DB::QUERY(
2016 2016
         'SELECT id_category
2017
-            FROM ' . prefixTable('categories_folders') . '
2017
+            FROM ' . prefixTable('categories_folders').'
2018 2018
             WHERE id_folder = %i',
2019 2019
         $source_id
2020 2020
     );
@@ -2025,7 +2025,7 @@  discard block
 block discarded – undo
2025 2025
     $target_cf = [];
2026 2026
     $rows = DB::QUERY(
2027 2027
         'SELECT id_category
2028
-            FROM ' . prefixTable('categories_folders') . '
2028
+            FROM ' . prefixTable('categories_folders').'
2029 2029
             WHERE id_folder = %i',
2030 2030
         $target_id
2031 2031
     );
@@ -2243,7 +2243,7 @@  discard block
 block discarded – undo
2243 2243
     int  $dirPerm = 0755
2244 2244
 ) {
2245 2245
     // Check if the path exists
2246
-    if (! file_exists($path)) {
2246
+    if (!file_exists($path)) {
2247 2247
         return false;
2248 2248
     }
2249 2249
 
@@ -2296,7 +2296,7 @@  discard block
 block discarded – undo
2296 2296
     // Load item data
2297 2297
     $data = DB::queryFirstRow(
2298 2298
         'SELECT id_tree
2299
-        FROM ' . prefixTable('items') . '
2299
+        FROM ' . prefixTable('items').'
2300 2300
         WHERE id = %i',
2301 2301
         $item_id
2302 2302
     );
@@ -2359,7 +2359,7 @@  discard block
 block discarded – undo
2359 2359
         }
2360 2360
         $host .= substr(explode(".", $email[1])[0], -1, 1);
2361 2361
     }
2362
-    $email = $name . "@" . $host . "." . explode(".", $email[1])[1];
2362
+    $email = $name."@".$host.".".explode(".", $email[1])[1];
2363 2363
     return $email;
2364 2364
 }
2365 2365
 
@@ -2382,7 +2382,7 @@  discard block
 block discarded – undo
2382 2382
     
2383 2383
     // Insert log in DB
2384 2384
     return DB::query(
2385
-        'SELECT ' . $fields . '
2385
+        'SELECT '.$fields.'
2386 2386
         FROM ' . prefixTable($table)
2387 2387
     );
2388 2388
 }
@@ -2397,11 +2397,11 @@  discard block
 block discarded – undo
2397 2397
 function formatSizeUnits(int $bytes): string
2398 2398
 {
2399 2399
     if ($bytes >= 1073741824) {
2400
-        $bytes = number_format($bytes / 1073741824, 2) . ' GB';
2400
+        $bytes = number_format($bytes / 1073741824, 2).' GB';
2401 2401
     } elseif ($bytes >= 1048576) {
2402
-        $bytes = number_format($bytes / 1048576, 2) . ' MB';
2402
+        $bytes = number_format($bytes / 1048576, 2).' MB';
2403 2403
     } elseif ($bytes >= 1024) {
2404
-        $bytes = number_format($bytes / 1024, 2) . ' KB';
2404
+        $bytes = number_format($bytes / 1024, 2).' KB';
2405 2405
     } elseif ($bytes > 1) {
2406 2406
         $bytes .= ' bytes';
2407 2407
     } elseif ($bytes === 1) {
@@ -2646,14 +2646,14 @@  discard block
 block discarded – undo
2646 2646
 
2647 2647
         // Encrypt the file content
2648 2648
         $plaintext = file_get_contents(
2649
-            filter_var($fileInPath . '/' . $fileInName, FILTER_SANITIZE_URL)
2649
+            filter_var($fileInPath.'/'.$fileInName, FILTER_SANITIZE_URL)
2650 2650
         );
2651 2651
         $ciphertext = $cipher->encrypt($plaintext);
2652 2652
         // Save new file
2653 2653
         $hash = md5($plaintext);
2654
-        $fileOut = $fileInPath . '/' . TP_FILE_PREFIX . $hash;
2654
+        $fileOut = $fileInPath.'/'.TP_FILE_PREFIX.$hash;
2655 2655
         file_put_contents($fileOut, $ciphertext);
2656
-        unlink($fileInPath . '/' . $fileInName);
2656
+        unlink($fileInPath.'/'.$fileInName);
2657 2657
         return [
2658 2658
             'fileHash' => base64_encode($hash),
2659 2659
             'objectKey' => base64_encode($objectKey),
@@ -2674,7 +2674,7 @@  discard block
 block discarded – undo
2674 2674
  */
2675 2675
 function decryptFile(string $fileName, string $filePath, string $key): string
2676 2676
 {
2677
-    if (! defined('FILE_BUFFER_SIZE')) {
2677
+    if (!defined('FILE_BUFFER_SIZE')) {
2678 2678
         define('FILE_BUFFER_SIZE', 128 * 1024);
2679 2679
     }
2680 2680
     
@@ -2690,7 +2690,7 @@  discard block
 block discarded – undo
2690 2690
         $cipher->enableContinuousBuffer();
2691 2691
         $cipher->disablePadding();
2692 2692
         // Get file content
2693
-        $ciphertext = file_get_contents($filePath . '/' . TP_FILE_PREFIX . $fileName);
2693
+        $ciphertext = file_get_contents($filePath.'/'.TP_FILE_PREFIX.$fileName);
2694 2694
         // Decrypt file content and return
2695 2695
         return base64_encode($cipher->decrypt($ciphertext));
2696 2696
     /*} else {
@@ -2772,8 +2772,8 @@  discard block
 block discarded – undo
2772 2772
         // Only create the sharekey for a user
2773 2773
         $user = DB::queryFirstRow(
2774 2774
             'SELECT public_key
2775
-            FROM ' . prefixTable('users') . '
2776
-            WHERE id = ' . (int) $session->get('user-id') . '
2775
+            FROM ' . prefixTable('users').'
2776
+            WHERE id = ' . (int) $session->get('user-id').'
2777 2777
             AND public_key != ""'
2778 2778
         );
2779 2779
 
@@ -2809,10 +2809,9 @@  discard block
 block discarded – undo
2809 2809
         //DB::debugmode(true);
2810 2810
         $users = DB::query(
2811 2811
             'SELECT id, public_key
2812
-            FROM ' . prefixTable('users') . '
2812
+            FROM ' . prefixTable('users').'
2813 2813
             WHERE ' . ($onlyForUser === true ? 
2814
-                'id IN ("' . TP_USER_ID . '","' . $session->get('user-id') . '") ' : 
2815
-                'id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '") ') . '
2814
+                'id IN ("'.TP_USER_ID.'","'.$session->get('user-id').'") ' : 'id NOT IN ("'.OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'") ').'
2816 2815
             AND public_key != ""'
2817 2816
         );
2818 2817
         //DB::debugmode(false);
@@ -2859,7 +2858,7 @@  discard block
 block discarded – undo
2859 2858
 function isBase64(string $str): bool
2860 2859
 {
2861 2860
     $str = (string) trim($str);
2862
-    if (! isset($str[0])) {
2861
+    if (!isset($str[0])) {
2863 2862
         return false;
2864 2863
     }
2865 2864
 
@@ -2932,7 +2931,7 @@  discard block
 block discarded – undo
2932 2931
         $connection->connect();
2933 2932
     } catch (\LdapRecord\Auth\BindException $e) {
2934 2933
         $error = $e->getDetailedError();
2935
-        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage();
2934
+        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage();
2936 2935
         return false;
2937 2936
     }
2938 2937
 
@@ -2945,7 +2944,7 @@  discard block
 block discarded – undo
2945 2944
         }
2946 2945
     } catch (\LdapRecord\Auth\BindException $e) {
2947 2946
         $error = $e->getDetailedError();
2948
-        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage();
2947
+        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage();
2949 2948
         return false;
2950 2949
     }
2951 2950
 
@@ -2969,7 +2968,7 @@  discard block
 block discarded – undo
2969 2968
     // expect if personal item
2970 2969
     DB::delete(
2971 2970
         prefixTable('sharekeys_items'),
2972
-        'user_id = %i AND object_id NOT IN (SELECT i.id FROM ' . prefixTable('items') . ' AS i WHERE i.perso = 1)',
2971
+        'user_id = %i AND object_id NOT IN (SELECT i.id FROM '.prefixTable('items').' AS i WHERE i.perso = 1)',
2973 2972
         $userId
2974 2973
     );
2975 2974
     // Remove all item sharekeys files
@@ -2977,8 +2976,8 @@  discard block
 block discarded – undo
2977 2976
         prefixTable('sharekeys_files'),
2978 2977
         'user_id = %i AND object_id NOT IN (
2979 2978
             SELECT f.id 
2980
-            FROM ' . prefixTable('items') . ' AS i 
2981
-            INNER JOIN ' . prefixTable('files') . ' AS f ON f.id_item = i.id
2979
+            FROM ' . prefixTable('items').' AS i 
2980
+            INNER JOIN ' . prefixTable('files').' AS f ON f.id_item = i.id
2982 2981
             WHERE i.perso = 1
2983 2982
         )',
2984 2983
         $userId
@@ -2988,8 +2987,8 @@  discard block
 block discarded – undo
2988 2987
         prefixTable('sharekeys_fields'),
2989 2988
         'user_id = %i AND object_id NOT IN (
2990 2989
             SELECT c.id 
2991
-            FROM ' . prefixTable('items') . ' AS i 
2992
-            INNER JOIN ' . prefixTable('categories_items') . ' AS c ON c.item_id = i.id
2990
+            FROM ' . prefixTable('items').' AS i 
2991
+            INNER JOIN ' . prefixTable('categories_items').' AS c ON c.item_id = i.id
2993 2992
             WHERE i.perso = 1
2994 2993
         )',
2995 2994
         $userId
@@ -2997,13 +2996,13 @@  discard block
 block discarded – undo
2997 2996
     // Remove all item sharekeys logs
2998 2997
     DB::delete(
2999 2998
         prefixTable('sharekeys_logs'),
3000
-        'user_id = %i AND object_id NOT IN (SELECT i.id FROM ' . prefixTable('items') . ' AS i WHERE i.perso = 1)',
2999
+        'user_id = %i AND object_id NOT IN (SELECT i.id FROM '.prefixTable('items').' AS i WHERE i.perso = 1)',
3001 3000
         $userId
3002 3001
     );
3003 3002
     // Remove all item sharekeys suggestions
3004 3003
     DB::delete(
3005 3004
         prefixTable('sharekeys_suggestions'),
3006
-        'user_id = %i AND object_id NOT IN (SELECT i.id FROM ' . prefixTable('items') . ' AS i WHERE i.perso = 1)',
3005
+        'user_id = %i AND object_id NOT IN (SELECT i.id FROM '.prefixTable('items').' AS i WHERE i.perso = 1)',
3007 3006
         $userId
3008 3007
     );
3009 3008
     return false;
@@ -3024,7 +3023,7 @@  discard block
 block discarded – undo
3024 3023
         foreach (DateTimeZone::listIdentifiers() as $timezone) {
3025 3024
             $now->setTimezone(new DateTimeZone($timezone));
3026 3025
             $offsets[] = $offset = $now->getOffset();
3027
-            $timezones[$timezone] = '(' . format_GMT_offset($offset) . ') ' . format_timezone_name($timezone);
3026
+            $timezones[$timezone] = '('.format_GMT_offset($offset).') '.format_timezone_name($timezone);
3028 3027
         }
3029 3028
 
3030 3029
         array_multisort($offsets, $timezones);
@@ -3044,7 +3043,7 @@  discard block
 block discarded – undo
3044 3043
 {
3045 3044
     $hours = intval($offset / 3600);
3046 3045
     $minutes = abs(intval($offset % 3600 / 60));
3047
-    return 'GMT' . ($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
3046
+    return 'GMT'.($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
3048 3047
 }
3049 3048
 
3050 3049
 /**
@@ -3144,8 +3143,7 @@  discard block
 block discarded – undo
3144 3143
 {
3145 3144
     if (isset($array[$key]) === true
3146 3145
         && (is_int($value) === true ?
3147
-            (int) $array[$key] === $value :
3148
-            (string) $array[$key] === $value)
3146
+            (int) $array[$key] === $value : (string) $array[$key] === $value)
3149 3147
     ) {
3150 3148
         return true;
3151 3149
     }
@@ -3167,8 +3165,7 @@  discard block
 block discarded – undo
3167 3165
 {
3168 3166
     if (isset($var) === false
3169 3167
         || (is_int($value) === true ?
3170
-            (int) $var === $value :
3171
-            (string) $var === $value)
3168
+            (int) $var === $value : (string) $var === $value)
3172 3169
     ) {
3173 3170
         return true;
3174 3171
     }
@@ -3219,7 +3216,7 @@  discard block
 block discarded – undo
3219 3216
  */
3220 3217
 function isSetArrayOfValues(array $arrayOfValues): bool
3221 3218
 {
3222
-    foreach($arrayOfValues as $value) {
3219
+    foreach ($arrayOfValues as $value) {
3223 3220
         if (isset($value) === false) {
3224 3221
             return false;
3225 3222
         }
@@ -3241,7 +3238,7 @@  discard block
 block discarded – undo
3241 3238
     /*PHP8 - integer|string*/$value
3242 3239
 ) : bool
3243 3240
 {
3244
-    foreach($arrayOfVars as $variable) {
3241
+    foreach ($arrayOfVars as $variable) {
3245 3242
         if ($variable !== $value) {
3246 3243
             return false;
3247 3244
         }
@@ -3261,7 +3258,7 @@  discard block
 block discarded – undo
3261 3258
     /*PHP8 - integer|string*/$value
3262 3259
 ) : bool
3263 3260
 {
3264
-    foreach($arrayOfVars as $variable) {
3261
+    foreach ($arrayOfVars as $variable) {
3265 3262
         if ($variable === $value) {
3266 3263
             return true;
3267 3264
         }
@@ -3329,7 +3326,7 @@  discard block
 block discarded – undo
3329 3326
  * @param array     $filters
3330 3327
  * @return array|string
3331 3328
  */
3332
-function dataSanitizer(array $data, array $filters): array|string
3329
+function dataSanitizer(array $data, array $filters): array | string
3333 3330
 {
3334 3331
     // Load Sanitizer library
3335 3332
     $sanitizer = new Sanitizer($data, $filters);
@@ -3358,7 +3355,7 @@  discard block
 block discarded – undo
3358 3355
     // Exists ?
3359 3356
     $userCacheId = DB::queryfirstrow(
3360 3357
         'SELECT increment_id
3361
-        FROM ' . prefixTable('cache_tree') . '
3358
+        FROM ' . prefixTable('cache_tree').'
3362 3359
         WHERE user_id = %i',
3363 3360
         $user_id
3364 3361
     );
@@ -3409,7 +3406,7 @@  discard block
 block discarded – undo
3409 3406
  */
3410 3407
 function pourcentage(float $nombre, float $total, float $pourcentage): float
3411 3408
 { 
3412
-    $resultat = ($nombre/$total) * $pourcentage;
3409
+    $resultat = ($nombre / $total) * $pourcentage;
3413 3410
     return round($resultat);
3414 3411
 }
3415 3412
 
@@ -3439,7 +3436,7 @@  discard block
 block discarded – undo
3439 3436
 
3440 3437
     // Get last folder update
3441 3438
     $lastFolderChange = DB::queryfirstrow(
3442
-        'SELECT valeur FROM ' . prefixTable('misc') . '
3439
+        'SELECT valeur FROM '.prefixTable('misc').'
3443 3440
         WHERE type = %s AND intitule = %s',
3444 3441
         'timestamp',
3445 3442
         'last_folder_change'
@@ -3469,7 +3466,7 @@  discard block
 block discarded – undo
3469 3466
     // Does this user has a tree cache
3470 3467
     $userCacheTree = DB::queryfirstrow(
3471 3468
         'SELECT '.$fieldName.'
3472
-        FROM ' . prefixTable('cache_tree') . '
3469
+        FROM ' . prefixTable('cache_tree').'
3473 3470
         WHERE user_id = %i',
3474 3471
         $session->get('user-id')
3475 3472
     );
@@ -3511,7 +3508,7 @@  discard block
 block discarded – undo
3511 3508
     if (count($folderIds) === 0) {
3512 3509
         $folderIds = DB::queryFirstColumn(
3513 3510
             'SELECT id
3514
-            FROM ' . prefixTable('nested_tree') . '
3511
+            FROM ' . prefixTable('nested_tree').'
3515 3512
             WHERE personal_folder=%i',
3516 3513
             0
3517 3514
         );
@@ -3528,8 +3525,8 @@  discard block
 block discarded – undo
3528 3525
         $rows_tmp = DB::query(
3529 3526
             'SELECT c.id, c.title, c.level, c.type, c.masked, c.order, c.encrypted_data, c.role_visibility, c.is_mandatory,
3530 3527
             f.id_category AS category_id
3531
-            FROM ' . prefixTable('categories_folders') . ' AS f
3532
-            INNER JOIN ' . prefixTable('categories') . ' AS c ON (f.id_category = c.parent_id)
3528
+            FROM ' . prefixTable('categories_folders').' AS f
3529
+            INNER JOIN ' . prefixTable('categories').' AS c ON (f.id_category = c.parent_id)
3533 3530
             WHERE id_folder=%i',
3534 3531
             $folder
3535 3532
         );
@@ -3555,7 +3552,7 @@  discard block
 block discarded – undo
3555 3552
         $valTemp = '';
3556 3553
         $data = DB::queryFirstRow(
3557 3554
             'SELECT valeur
3558
-            FROM ' . prefixTable('misc') . '
3555
+            FROM ' . prefixTable('misc').'
3559 3556
             WHERE type = %s AND intitule=%i',
3560 3557
             'complex',
3561 3558
             $folder
@@ -3572,14 +3569,14 @@  discard block
 block discarded – undo
3572 3569
         $valTemp = '';
3573 3570
         $rows_tmp = DB::query(
3574 3571
             'SELECT t.title
3575
-            FROM ' . prefixTable('roles_values') . ' as v
3576
-            INNER JOIN ' . prefixTable('roles_title') . ' as t ON (v.role_id = t.id)
3572
+            FROM ' . prefixTable('roles_values').' as v
3573
+            INNER JOIN ' . prefixTable('roles_title').' as t ON (v.role_id = t.id)
3577 3574
             WHERE v.folder_id = %i
3578 3575
             GROUP BY title',
3579 3576
             $folder
3580 3577
         );
3581 3578
         foreach ($rows_tmp as $record) {
3582
-            $valTemp .= (empty($valTemp) === true ? '' : ' - ') . $record['title'];
3579
+            $valTemp .= (empty($valTemp) === true ? '' : ' - ').$record['title'];
3583 3580
         }
3584 3581
         $arr_data['visibilityRoles'] = $valTemp;
3585 3582
 
@@ -3612,7 +3609,7 @@  discard block
 block discarded – undo
3612 3609
         // loop on users and check if user has this role
3613 3610
         $rows = DB::query(
3614 3611
             'SELECT id, fonction_id
3615
-            FROM ' . prefixTable('users') . '
3612
+            FROM ' . prefixTable('users').'
3616 3613
             WHERE id != %i AND admin = 0 AND fonction_id IS NOT NULL AND fonction_id != ""',
3617 3614
             $session->get('user-id')
3618 3615
         );
@@ -3644,7 +3641,7 @@  discard block
 block discarded – undo
3644 3641
 
3645 3642
     $val = DB::queryfirstrow(
3646 3643
         'SELECT *
3647
-        FROM ' . prefixTable('users') . '
3644
+        FROM ' . prefixTable('users').'
3648 3645
         WHERE id = %i',
3649 3646
         $userId
3650 3647
     );
@@ -3660,12 +3657,12 @@  discard block
 block discarded – undo
3660 3657
 function upgradeRequired(): bool
3661 3658
 {
3662 3659
     // Get settings.php
3663
-    include_once __DIR__. '/../includes/config/settings.php';
3660
+    include_once __DIR__.'/../includes/config/settings.php';
3664 3661
 
3665 3662
     // Get timestamp in DB
3666 3663
     $val = DB::queryfirstrow(
3667 3664
         'SELECT valeur
3668
-        FROM ' . prefixTable('misc') . '
3665
+        FROM ' . prefixTable('misc').'
3669 3666
         WHERE type = %s AND intitule = %s',
3670 3667
         'admin',
3671 3668
         'upgrade_timestamp'
@@ -3720,7 +3717,7 @@  discard block
 block discarded – undo
3720 3717
     // prepapre background tasks for item keys generation        
3721 3718
     $userTP = DB::queryFirstRow(
3722 3719
         'SELECT pw, public_key, private_key
3723
-        FROM ' . prefixTable('users') . '
3720
+        FROM ' . prefixTable('users').'
3724 3721
         WHERE id = %i',
3725 3722
         TP_USER_ID
3726 3723
     );
@@ -3745,7 +3742,7 @@  discard block
 block discarded – undo
3745 3742
         }
3746 3743
 
3747 3744
         // Generate new keys
3748
-        if ($user_self_change === true && empty($recovery_public_key) === false && empty($recovery_private_key) === false){
3745
+        if ($user_self_change === true && empty($recovery_public_key) === false && empty($recovery_private_key) === false) {
3749 3746
             $userKeys = [
3750 3747
                 'public_key' => $recovery_public_key,
3751 3748
                 'private_key_clear' => $recovery_private_key,
@@ -3785,8 +3782,8 @@  discard block
 block discarded – undo
3785 3782
                 'process_type' => 'create_user_keys',
3786 3783
                 'arguments' => json_encode([
3787 3784
                     'new_user_id' => (int) $userId,
3788
-                    'new_user_pwd' => cryption($passwordClear, '','encrypt')['string'],
3789
-                    'new_user_code' => cryption(empty($encryptionKey) === true ? uniqidReal(20) : $encryptionKey, '','encrypt')['string'],
3785
+                    'new_user_pwd' => cryption($passwordClear, '', 'encrypt')['string'],
3786
+                    'new_user_code' => cryption(empty($encryptionKey) === true ? uniqidReal(20) : $encryptionKey, '', 'encrypt')['string'],
3790 3787
                     'owner_id' => (int) TP_USER_ID,
3791 3788
                     'creator_pwd' => $userTP['pw'],
3792 3789
                     'send_email' => $sendEmailToUser === true ? 1 : 0,
@@ -4082,7 +4079,7 @@  discard block
 block discarded – undo
4082 4079
  * @param integer $user_id
4083 4080
  * @return void
4084 4081
  */
4085
-function purgeUnnecessaryKeys(bool $allUsers = true, int $user_id=0)
4082
+function purgeUnnecessaryKeys(bool $allUsers = true, int $user_id = 0)
4086 4083
 {
4087 4084
     if ($allUsers === true) {
4088 4085
         // Load class DB
@@ -4092,7 +4089,7 @@  discard block
 block discarded – undo
4092 4089
 
4093 4090
         $users = DB::query(
4094 4091
             'SELECT id
4095
-            FROM ' . prefixTable('users') . '
4092
+            FROM ' . prefixTable('users').'
4096 4093
             WHERE id NOT IN ('.OTV_USER_ID.', '.TP_USER_ID.', '.SSH_USER_ID.', '.API_USER_ID.')
4097 4094
             ORDER BY login ASC'
4098 4095
         );
@@ -4110,7 +4107,7 @@  discard block
 block discarded – undo
4110 4107
  * @param integer $user_id
4111 4108
  * @return void
4112 4109
  */
4113
-function purgeUnnecessaryKeysForUser(int $user_id=0)
4110
+function purgeUnnecessaryKeysForUser(int $user_id = 0)
4114 4111
 {
4115 4112
     if ($user_id === 0) {
4116 4113
         return;
@@ -4121,8 +4118,8 @@  discard block
 block discarded – undo
4121 4118
 
4122 4119
     $personalItems = DB::queryFirstColumn(
4123 4120
         'SELECT id
4124
-        FROM ' . prefixTable('items') . ' AS i
4125
-        INNER JOIN ' . prefixTable('log_items') . ' AS li ON li.id_item = i.id
4121
+        FROM ' . prefixTable('items').' AS i
4122
+        INNER JOIN ' . prefixTable('log_items').' AS li ON li.id_item = i.id
4126 4123
         WHERE i.perso = 1 AND li.action = "at_creation" AND li.id_user IN (%i, '.TP_USER_ID.')',
4127 4124
         $user_id
4128 4125
     );
@@ -4171,7 +4168,7 @@  discard block
 block discarded – undo
4171 4168
     // Check if user exists
4172 4169
     $userInfo = DB::queryFirstRow(
4173 4170
         'SELECT pw, public_key, private_key, login, name
4174
-        FROM ' . prefixTable('users') . '
4171
+        FROM ' . prefixTable('users').'
4175 4172
         WHERE id = %i',
4176 4173
         $userId
4177 4174
     );
@@ -4181,7 +4178,7 @@  discard block
 block discarded – undo
4181 4178
 
4182 4179
         // Prepare file content
4183 4180
         $export_value = file_get_contents(__DIR__."/../includes/core/teampass_ascii.txt")."\n".
4184
-            "Generation date: ".date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], $now)."\n\n".
4181
+            "Generation date: ".date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], $now)."\n\n".
4185 4182
             "RECOVERY KEYS - Not to be shared - To be store safely\n\n".
4186 4183
             "Public Key:\n".$userInfo['public_key']."\n\n".
4187 4184
             "Private Key:\n".decryptPrivateKey($session->get('user-password'), $userInfo['private_key'])."\n\n";
@@ -4204,7 +4201,7 @@  discard block
 block discarded – undo
4204 4201
         return prepareExchangedData(
4205 4202
             array(
4206 4203
                 'error' => false,
4207
-                'datetime' => date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], $now),
4204
+                'datetime' => date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], $now),
4208 4205
                 'timestamp' => $now,
4209 4206
                 'content' => base64_encode($export_value),
4210 4207
                 'login' => $userInfo['login'],
@@ -4230,8 +4227,8 @@  discard block
 block discarded – undo
4230 4227
  */
4231 4228
 function loadClasses(string $className = ''): void
4232 4229
 {
4233
-    require_once __DIR__. '/../includes/config/include.php';
4234
-    require_once __DIR__. '/../includes/config/settings.php';
4230
+    require_once __DIR__.'/../includes/config/include.php';
4231
+    require_once __DIR__.'/../includes/config/settings.php';
4235 4232
     require_once __DIR__.'/../vendor/autoload.php';
4236 4233
 
4237 4234
     if (defined('DB_PASSWD_CLEAR') === false) {
Please login to merge, or discard this patch.