Passed
Push — wip_sessions ( b55e55...384f5b )
by Nils
05:05
created
install--ASUPPRIMER/upgrade_run_3.0.0_logs.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@
 block discarded – undo
78 78
         $database,
79 79
         $port
80 80
     );
81
-	$db_link->set_charset(DB_ENCODING);
81
+    $db_link->set_charset(DB_ENCODING);
82 82
 } else {
83 83
     $res = 'Impossible to get connected to server. Error is: '.addslashes(mysqli_connect_error());
84 84
     echo '[{"finish":"1", "error":"Impossible to get connected to server. Error is: '.addslashes(mysqli_connect_error()).'!"}]';
Please login to merge, or discard this patch.
install--ASUPPRIMER/upgrade_run_3.0.0_files.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@
 block discarded – undo
78 78
         $database,
79 79
         $port
80 80
     );
81
-	$db_link->set_charset(DB_ENCODING);
81
+    $db_link->set_charset(DB_ENCODING);
82 82
 } else {
83 83
     $res = 'Impossible to get connected to server. Error is: '.addslashes(mysqli_connect_error());
84 84
     echo '[{"finish":"1", "error":"Impossible to get connected to server. Error is: '.addslashes(mysqli_connect_error()).'!"}]';
Please login to merge, or discard this patch.
install--ASUPPRIMER/upgrade_run_3.0.0_fields.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@
 block discarded – undo
78 78
         $database,
79 79
         $port
80 80
     );
81
-	$db_link->set_charset(DB_ENCODING);
81
+    $db_link->set_charset(DB_ENCODING);
82 82
 } else {
83 83
     $res = 'Impossible to get connected to server. Error is: '.addslashes(mysqli_connect_error());
84 84
     echo '[{"finish":"1", "error":"Impossible to get connected to server. Error is: '.addslashes(mysqli_connect_error()).'!"}]';
Please login to merge, or discard this patch.
sources/ldap.queries.php 1 patch
Spacing   +6 added lines, -6 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
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
                     $openLdapExtra = new OpenLdapExtra();
145 145
                     break;
146 146
                 default:
147
-                    throw new Exception("Unsupported LDAP type: " . $SETTINGS['ldap_type']);
147
+                    throw new Exception("Unsupported LDAP type: ".$SETTINGS['ldap_type']);
148 148
             }
149 149
         } catch (Exception $e) {
150 150
             echo  prepareExchangedData(
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
             // 2- Get user info from AD
160 160
             // We want to isolate attribute ldap_user_attribute or mostly samAccountName
161 161
             $userADInfos = $ldapConnection->query()
162
-                ->where((isset($SETTINGS['ldap_user_attribute']) ===true && empty($SETTINGS['ldap_user_attribute']) === false) ? $SETTINGS['ldap_user_attribute'] : 'samaccountname', '=', $post_username)
162
+                ->where((isset($SETTINGS['ldap_user_attribute']) === true && empty($SETTINGS['ldap_user_attribute']) === false) ? $SETTINGS['ldap_user_attribute'] : 'samaccountname', '=', $post_username)
163 163
                 ->firstOrFail();
164 164
 
165 165
             // Is user enabled? Only ActiveDirectory
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
             echo prepareExchangedData(
183 183
                 array(
184 184
                     'error' => true,
185
-                    'message' => $lang->get('error')." - ".(isset($error) === true ? $error->getErrorCode()." - ".$error->getErrorMessage(). "<br>".$error->getDiagnosticMessage() : $e),
185
+                    'message' => $lang->get('error')." - ".(isset($error) === true ? $error->getErrorCode()." - ".$error->getErrorMessage()."<br>".$error->getDiagnosticMessage() : $e),
186 186
                 ),
187 187
                 'encode'
188 188
             );
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
             // For OpenLDAP and others, we use attribute dn
196 196
             $userAuthAttempt = $ldapConnection->auth()->attempt(
197 197
                 $SETTINGS['ldap_type'] === 'ActiveDirectory' ?
198
-                    $userADInfos['userprincipalname'][0] :  // refering to https://ldaprecord.com/docs/core/v2/authentication#basic-authentication
198
+                    $userADInfos['userprincipalname'][0] : // refering to https://ldaprecord.com/docs/core/v2/authentication#basic-authentication
199 199
                     $userADInfos['dn'],
200 200
                 $post_password
201 201
             );
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
             echo prepareExchangedData(
217 217
                 array(
218 218
                     'error' => true,
219
-                    'message' => $lang->get('error')." - ".(isset($error) === true ? $error->getErrorCode()." - ".$error->getErrorMessage(). "<br>".$error->getDiagnosticMessage() : $e),
219
+                    'message' => $lang->get('error')." - ".(isset($error) === true ? $error->getErrorCode()." - ".$error->getErrorMessage()."<br>".$error->getDiagnosticMessage() : $e),
220 220
                 ),
221 221
                 'encode'
222 222
             );
Please login to merge, or discard this patch.
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.