Passed
Pull Request — master (#4682)
by Nils
06:11
created
pages/2fa.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('mfa') === false) {
70 70
     // Not allowed page
71 71
     $session->set('system-error_code', ERR_NOT_ALLOWED);
72
-    include $SETTINGS['cpassman_dir'] . '/error.php';
72
+    include $SETTINGS['cpassman_dir'].'/error.php';
73 73
     exit;
74 74
 }
75 75
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
                                     $roles = getRolesTitles();
142 142
                                     foreach ($roles as $role) {
143 143
                                         echo '
144
-                                    <option value="' . $role['id'] . '"', in_array($role['id'], $arrRolesMFA) === true ? ' selected' : '', '>' . addslashes($role['title']) . '</option>';
144
+                                    <option value="' . $role['id'].'"', in_array($role['id'], $arrRolesMFA) === true ? ' selected' : '', '>'.addslashes($role['title']).'</option>';
145 145
                                     }
146 146
                                     ?>
147 147
                                 </select>
Please login to merge, or discard this patch.
pages/options.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('options') === false) {
70 70
     // Not allowed page
71 71
     $session->set('system-error_code', ERR_NOT_ALLOWED);
72
-    include $SETTINGS['cpassman_dir'] . '/error.php';
72
+    include $SETTINGS['cpassman_dir'].'/error.php';
73 73
     exit;
74 74
 }
75 75
 
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
                                     // get list of all timezones
323 323
                                     foreach ($zones as $key => $zone) {
324 324
                                         echo '
325
-                                <option value="' . $key . '"', isset($SETTINGS['timezone']) === true && $SETTINGS['timezone'] === $key ? ' selected' : '', '>' . $zone . '</option>';
325
+                                <option value="' . $key.'"', isset($SETTINGS['timezone']) === true && $SETTINGS['timezone'] === $key ? ' selected' : '', '>'.$zone.'</option>';
326 326
                                     }
327 327
                                     ?>
328 328
                                 </select>
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
                                     <?php
374 374
                                     foreach ($languagesList as $teampassLang) {
375 375
                                         echo '
376
-                                <option value="' . $teampassLang . '"', isset($SETTINGS['default_language']) === true && $SETTINGS['default_language'] === $teampassLang ? ' selected' : '', '>' . $teampassLang . '</option>';
376
+                                <option value="' . $teampassLang.'"', isset($SETTINGS['default_language']) === true && $SETTINGS['default_language'] === $teampassLang ? ' selected' : '', '>'.$teampassLang.'</option>';
377 377
                                     }
378 378
                                     ?>
379 379
                                 </select>
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
                                 <?php
471 471
                                 foreach (TP_PW_COMPLEXITY as $complex) {
472 472
                                     echo '
473
-                                <option value="' . $complex[0] . '"', isset($SETTINGS['personal_saltkey_security_level']) === true && $SETTINGS['personal_saltkey_security_level'] === $complex[0] ? ' selected' : '', '>' . $complex[1] . '</option>';
473
+                                <option value="' . $complex[0].'"', isset($SETTINGS['personal_saltkey_security_level']) === true && $SETTINGS['personal_saltkey_security_level'] === $complex[0] ? ' selected' : '', '>'.$complex[1].'</option>';
474 474
                                 }
475 475
                                 ?>
476 476
                             </select>
@@ -802,7 +802,7 @@  discard block
 block discarded – undo
802 802
                                         $roles = getRolesTitles();
803 803
                                         foreach ($roles as $role) {
804 804
                                             echo '
805
-                                    <option value="' . htmlspecialchars($role['id']) . '"', in_array($role['id'], $arrRolesToPrint) === true ? ' selected' : '', '>' . htmlspecialchars(addslashes($role['title'])) . '</option>';
805
+                                    <option value="' . htmlspecialchars($role['id']).'"', in_array($role['id'], $arrRolesToPrint) === true ? ' selected' : '', '>'.htmlspecialchars(addslashes($role['title'])).'</option>';
806 806
                                         }
807 807
                                     }
808 808
                                     ?>
@@ -1029,7 +1029,7 @@  discard block
 block discarded – undo
1029 1029
                                     <?php
1030 1030
                                     foreach (TP_PW_COMPLEXITY as $complex) {
1031 1031
                                         echo '
1032
-                                <option value="' . $complex[0] . '"', isset($SETTINGS['offline_key_level']) === true && $SETTINGS['offline_key_level'] === $complex[0] ? ' selected' : '', '>' . $complex[1] . '</option>';
1032
+                                <option value="' . $complex[0].'"', isset($SETTINGS['offline_key_level']) === true && $SETTINGS['offline_key_level'] === $complex[0] ? ' selected' : '', '>'.$complex[1].'</option>';
1033 1033
                                     }
1034 1034
                                     ?>
1035 1035
                                 </select>
Please login to merge, or discard this patch.
sources/backups.queries.php 2 patches
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 ) {
78 78
     // Not allowed page
79 79
     $session->set('system-error_code', ERR_NOT_ALLOWED);
80
-    include $SETTINGS['cpassman_dir'] . '/error.php';
80
+    include $SETTINGS['cpassman_dir'].'/error.php';
81 81
     exit;
82 82
 }
83 83
 
@@ -138,21 +138,21 @@  discard block
 block discarded – undo
138 138
             // Prepare variables
139 139
             $post_key = filter_var($dataReceived['encryptionKey'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
140 140
 
141
-            require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
141
+            require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
142 142
             $return = '';
143 143
 
144 144
             //Get all tables
145 145
             $tables = array();
146 146
             $result = DB::query('SHOW TABLES');
147 147
             foreach ($result as $row) {
148
-                $tables[] = $row['Tables_in_' . DB_NAME];
148
+                $tables[] = $row['Tables_in_'.DB_NAME];
149 149
             }
150 150
 
151 151
             //cycle through
152 152
             foreach ($tables as $table) {
153 153
                 if (empty($pre) || substr_count($table, $pre) > 0) {
154 154
                     // Do query
155
-                    $result = DB::queryRaw('SELECT * FROM ' . $table);
155
+                    $result = DB::queryRaw('SELECT * FROM '.$table);
156 156
                     DB::queryRaw(
157 157
                         'SELECT *
158 158
                         FROM INFORMATION_SCHEMA.COLUMNS
@@ -164,17 +164,17 @@  discard block
 block discarded – undo
164 164
                     $numFields = DB::count();
165 165
 
166 166
                     // prepare a drop table
167
-                    $return .= 'DROP TABLE ' . $table . ';';
168
-                    $row2 = DB::queryfirstrow('SHOW CREATE TABLE ' . $table);
169
-                    $return .= "\n\n" . $row2['Create Table'] . ";\n\n";
167
+                    $return .= 'DROP TABLE '.$table.';';
168
+                    $row2 = DB::queryfirstrow('SHOW CREATE TABLE '.$table);
169
+                    $return .= "\n\n".$row2['Create Table'].";\n\n";
170 170
 
171 171
                     //prepare all fields and datas
172 172
                     for ($i = 0; $i < $numFields; ++$i) {
173 173
                         while ($row = $result->fetch_row()) {
174
-                            $return .= 'INSERT INTO ' . $table . ' VALUES(';
174
+                            $return .= 'INSERT INTO '.$table.' VALUES(';
175 175
                             for ($j = 0; $j < $numFields; ++$j) {
176 176
                                 // Manage NULL values
177
-                                $value = $row[$j] === null ? 'NULL' : '"' . addslashes(preg_replace("/\n/", '\\n', $row[$j])) . '"';                    
177
+                                $value = $row[$j] === null ? 'NULL' : '"'.addslashes(preg_replace("/\n/", '\\n', $row[$j])).'"';                    
178 178
                                 $return .= $value;
179 179
                                 if ($j < ($numFields - 1)) {
180 180
                                     $return .= ',';
@@ -192,8 +192,8 @@  discard block
 block discarded – undo
192 192
                 $token = GenerateCryptKey(20, false, true, true, false, true);
193 193
 
194 194
                 //save file
195
-                $filename = time() . '-' . $token . '.sql';
196
-                $handle = fopen($SETTINGS['path_to_files_folder'] . '/' . $filename, 'w+');
195
+                $filename = time().'-'.$token.'.sql';
196
+                $handle = fopen($SETTINGS['path_to_files_folder'].'/'.$filename, 'w+');
197 197
                 if ($handle !== false) {
198 198
                     //write file
199 199
                     fwrite($handle, $return);
@@ -205,16 +205,16 @@  discard block
 block discarded – undo
205 205
                     // Encrypt the file
206 206
                     prepareFileWithDefuse(
207 207
                         'encrypt',
208
-                        $SETTINGS['path_to_files_folder'] . '/' . $filename,
209
-                        $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
208
+                        $SETTINGS['path_to_files_folder'].'/'.$filename,
209
+                        $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
210 210
                         $post_key
211 211
                     );
212 212
 
213 213
                     // Do clean
214
-                    unlink($SETTINGS['path_to_files_folder'] . '/' . $filename);
214
+                    unlink($SETTINGS['path_to_files_folder'].'/'.$filename);
215 215
                     rename(
216
-                        $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
217
-                        $SETTINGS['path_to_files_folder'] . '/' . $filename
216
+                        $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
217
+                        $SETTINGS['path_to_files_folder'].'/'.$filename
218 218
                     );
219 219
                 }
220 220
 
@@ -234,9 +234,9 @@  discard block
 block discarded – undo
234 234
                     array(
235 235
                         'error' => false,
236 236
                         'message' => '',
237
-                        'download' => 'sources/downloadFile.php?name=' . urlencode($filename) .
238
-                            '&sub=files&file=' . $filename . '&type=sql&key=' . $session->get('key') . '&key_tmp=' .
239
-                            $session->get('user-key_tmp') . '&pathIsFiles=1',
237
+                        'download' => 'sources/downloadFile.php?name='.urlencode($filename).
238
+                            '&sub=files&file='.$filename.'&type=sql&key='.$session->get('key').'&key_tmp='.
239
+                            $session->get('user-key_tmp').'&pathIsFiles=1',
240 240
                     ),
241 241
                     'encode'
242 242
                 );
@@ -303,13 +303,13 @@  discard block
 block discarded – undo
303 303
             
304 304
             if (WIP === true) error_log('DEBUG: Offset -> '.$post_offset.'/'.$post_totalSize.' | File -> '.$post_clearFilename.' | key -> '.$post_key);
305 305
 
306
-            include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
306
+            include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
307 307
 
308 308
             if (empty($post_clearFilename) === true) {
309 309
                 // Get filename from database
310 310
                 $data = DB::queryFirstRow(
311 311
                     'SELECT valeur
312
-                    FROM ' . prefixTable('misc') . '
312
+                    FROM ' . prefixTable('misc').'
313 313
                     WHERE increment_id = %i',
314 314
                     $post_backupFile
315 315
                 );
@@ -329,8 +329,8 @@  discard block
 block discarded – undo
329 329
                     
330 330
                     $ret = prepareFileWithDefuse(
331 331
                         'decrypt',
332
-                        $SETTINGS['path_to_files_folder'] . '/' . $post_backupFile,
333
-                        $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $post_backupFile,
332
+                        $SETTINGS['path_to_files_folder'].'/'.$post_backupFile,
333
+                        $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$post_backupFile,
334 334
                         $post_key
335 335
                     );
336 336
                     
@@ -346,8 +346,8 @@  discard block
 block discarded – undo
346 346
                     }
347 347
 
348 348
                     // Do clean
349
-                    fileDelete($SETTINGS['path_to_files_folder'] . '/' . $post_backupFile, $SETTINGS);
350
-                    $post_backupFile = $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $post_backupFile;
349
+                    fileDelete($SETTINGS['path_to_files_folder'].'/'.$post_backupFile, $SETTINGS);
350
+                    $post_backupFile = $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$post_backupFile;
351 351
                 } else {
352 352
                     echo prepareExchangedData(
353 353
                         array(
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -301,7 +301,9 @@
 block discarded – undo
301 301
                 break;
302 302
             }
303 303
             
304
-            if (WIP === true) error_log('DEBUG: Offset -> '.$post_offset.'/'.$post_totalSize.' | File -> '.$post_clearFilename.' | key -> '.$post_key);
304
+            if (WIP === true) {
305
+                error_log('DEBUG: Offset -> '.$post_offset.'/'.$post_totalSize.' | File -> '.$post_clearFilename.' | key -> '.$post_key);
306
+            }
305 307
 
306 308
             include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
307 309
 
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
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 ) {
75 75
     // Not allowed page
76 76
     $session->set('system-error_code', ERR_NOT_ALLOWED);
77
-    include $SETTINGS['cpassman_dir'] . '/error.php';
77
+    include $SETTINGS['cpassman_dir'].'/error.php';
78 78
     exit;
79 79
 }
80 80
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 $post_isNewItem = $request->request->filter('isNewItem', null, FILTER_SANITIZE_NUMBER_INT);
108 108
 $post_randomId = $request->request->filter('randomId', null, FILTER_SANITIZE_NUMBER_INT);
109 109
 $post_isPersonal = $request->request->filter('isPersonal', null, FILTER_SANITIZE_NUMBER_INT);
110
-$post_fileSize= $request->request->filter('file_size', null, FILTER_SANITIZE_NUMBER_INT);
110
+$post_fileSize = $request->request->filter('file_size', null, FILTER_SANITIZE_NUMBER_INT);
111 111
 $chunk = $request->request->filter('chunk', 0, FILTER_SANITIZE_NUMBER_INT);
112 112
 $chunks = $request->request->filter('chunks', 0, FILTER_SANITIZE_NUMBER_INT);
113 113
 $fileName = $request->request->filter('name', '', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
@@ -122,10 +122,10 @@  discard block
 block discarded – undo
122 122
     $unit = strtoupper(substr(trim($POST_MAX_SIZE), -1)); // Assurez-vous de bien gérer les espaces éventuels
123 123
     $units = ['G' => 1073741824, 'M' => 1048576, 'K' => 1024];
124 124
     $multiplier = $units[$unit] ?? 1; // Vérifie si l'unité est dans le tableau, sinon 1
125
-    $maxSize = (int)$POST_MAX_SIZE * $multiplier;
125
+    $maxSize = (int) $POST_MAX_SIZE * $multiplier;
126 126
     
127 127
     // CHeck if the POST is too big
128
-    if (!empty($_SERVER['CONTENT_LENGTH']) && (int)$_SERVER['CONTENT_LENGTH'] > $maxSize && $maxSize > 0) {
128
+    if (!empty($_SERVER['CONTENT_LENGTH']) && (int) $_SERVER['CONTENT_LENGTH'] > $maxSize && $maxSize > 0) {
129 129
         handleAttachmentError('POST exceeded maximum allowed size.', 111, 413);
130 130
     }
131 131
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
         handleAttachmentError('File exceeds the maximum allowed size', 120, 413);
135 135
         die();
136 136
     }
137
-    error_log('POST_MAX_SIZE: ' . $POST_MAX_SIZE." - CONTENT_LENGTH: ".$_SERVER['CONTENT_LENGTH']." - UNIT: ".$unit." - MAX: ".$maxSize." - MULTIPLIER: ".$multiplier." - FILE_SIZE: ".$post_fileSize);
137
+    error_log('POST_MAX_SIZE: '.$POST_MAX_SIZE." - CONTENT_LENGTH: ".$_SERVER['CONTENT_LENGTH']." - UNIT: ".$unit." - MAX: ".$maxSize." - MULTIPLIER: ".$multiplier." - FILE_SIZE: ".$post_fileSize);
138 138
     
139 139
     // delete expired tokens
140 140
     DB::delete(prefixTable('tokens'), 'end_timestamp < %i', time());
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
         // check if token is expired
186 186
         $data = DB::queryFirstRow(
187 187
             'SELECT end_timestamp
188
-            FROM ' . prefixTable('tokens') . '
188
+            FROM ' . prefixTable('tokens').'
189 189
             WHERE user_id = %i AND token = %s',
190 190
             $session->get('user-id'),
191 191
             $post_user_token
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 
219 219
 // HTTP headers for no cache etc
220 220
 header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
221
-header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
221
+header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
222 222
 header('Cache-Control: no-store, no-cache, must-revalidate');
223 223
 header('Cache-Control: post-check=0, pre-check=0', false);
224 224
 
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 // Validate file name (for our purposes we'll just remove invalid characters)
257 257
 $file_name = preg_replace('[^A-Za-z0-9]', '', strtolower(basename($_FILES['file']['name'])));
258 258
 if (strlen($file_name) == 0 || strlen($file_name) > $MAX_FILENAME_LENGTH) {
259
-    handleAttachmentError('Invalid file name: ' . $file_name . '.', 114);
259
+    handleAttachmentError('Invalid file name: '.$file_name.'.', 114);
260 260
 }
261 261
 
262 262
 // Validate file extension
@@ -266,8 +266,8 @@  discard block
 block discarded – undo
266 266
         $ext,
267 267
         explode(
268 268
             ',',
269
-            $SETTINGS['upload_docext'] . ',' . $SETTINGS['upload_imagesext'] .
270
-                ',' . $SETTINGS['upload_pkgext'] . ',' . $SETTINGS['upload_otherext']
269
+            $SETTINGS['upload_docext'].','.$SETTINGS['upload_imagesext'].
270
+                ','.$SETTINGS['upload_pkgext'].','.$SETTINGS['upload_otherext']
271 271
         )
272 272
     ) === false
273 273
 ) {
@@ -279,24 +279,24 @@  discard block
 block discarded – undo
279 279
 
280 280
 // Clean the fileName for security reasons
281 281
 $fileInfo = pathinfo($fileName);
282
-$fileName = base64_encode($fileInfo['filename']) . '.' . $fileInfo['extension'];
282
+$fileName = base64_encode($fileInfo['filename']).'.'.$fileInfo['extension'];
283 283
 $fileFullSize = 0;
284 284
 
285 285
 // Make sure the fileName is unique but only if chunking is disabled
286
-if ($chunks < 2 && file_exists($targetDir . DIRECTORY_SEPARATOR . $fileName)) {
286
+if ($chunks < 2 && file_exists($targetDir.DIRECTORY_SEPARATOR.$fileName)) {
287 287
     $ext = strrpos($fileName, '.');
288 288
     $fileNameA = substr($fileName, 0, $ext);
289 289
     $fileNameB = substr($fileName, $ext);
290 290
 
291 291
     $count = 1;
292
-    while (file_exists($targetDir . DIRECTORY_SEPARATOR . $fileNameA . '_' . $count . $fileNameB)) {
292
+    while (file_exists($targetDir.DIRECTORY_SEPARATOR.$fileNameA.'_'.$count.$fileNameB)) {
293 293
         ++$count;
294 294
     }
295 295
 
296
-    $fileName = $fileNameA . '_' . $count . $fileNameB;
296
+    $fileName = $fileNameA.'_'.$count.$fileNameB;
297 297
 }
298 298
 
299
-$filePath = $targetDir . DIRECTORY_SEPARATOR . $fileName;
299
+$filePath = $targetDir.DIRECTORY_SEPARATOR.$fileName;
300 300
 
301 301
 // Create target dir
302 302
 if (file_exists($targetDir) === false) {
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 // Remove old temp files
311 311
 if ($cleanupTargetDir && is_dir($targetDir) && ($dir = opendir($targetDir))) {
312 312
     while (($file = readdir($dir)) !== false) {
313
-        $tmpfilePath = $targetDir . DIRECTORY_SEPARATOR . $file;
313
+        $tmpfilePath = $targetDir.DIRECTORY_SEPARATOR.$file;
314 314
 
315 315
         // Remove temp file if it is older than the max age and is not the current file
316 316
         if (
@@ -432,8 +432,8 @@  discard block
 block discarded – undo
432 432
         // This is a public object
433 433
         $users = DB::query(
434 434
             'SELECT id, public_key
435
-            FROM ' . prefixTable('users') . '
436
-            WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '")
435
+            FROM ' . prefixTable('users').'
436
+            WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'")
437 437
             AND public_key != ""'
438 438
         );
439 439
         foreach ($users as $user) {
@@ -471,14 +471,14 @@  discard block
 block discarded – undo
471 471
                 'date' => time(),
472 472
                 'id_user' => $session->get('user-id'),
473 473
                 'action' => 'at_modification',
474
-                'raison' => 'at_add_file : ' . $fileName . ':' . $newID,
474
+                'raison' => 'at_add_file : '.$fileName.':'.$newID,
475 475
             )
476 476
         );
477 477
     }
478 478
 }
479 479
 
480 480
 // Return JSON-RPC response
481
-die('{"jsonrpc" : "2.0", "result" : null, "id" : "' . $newID . '"}');
481
+die('{"jsonrpc" : "2.0", "result" : null, "id" : "'.$newID.'"}');
482 482
 
483 483
 /**
484 484
  * Handle errors and kill script.
Please login to merge, or discard this patch.
self-unlock.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 use Symfony\Component\HttpFoundation\Request as SymfonyRequest;
34 34
 
35 35
 // Load functions
36
-require_once __DIR__. '/includes/config/include.php';
36
+require_once __DIR__.'/includes/config/include.php';
37 37
 require_once __DIR__.'/sources/main.functions.php';
38 38
 
39 39
 // init
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
 // Check for existing lock
54 54
 $result = DB::queryFirstField(
55 55
     'SELECT 1
56
-     FROM ' . prefixTable('auth_failures') . '
56
+     FROM ' . prefixTable('auth_failures').'
57 57
      WHERE unlock_at = (
58 58
         SELECT MAX(unlock_at)
59
-        FROM ' . prefixTable('auth_failures') . '
59
+        FROM ' . prefixTable('auth_failures').'
60 60
         WHERE unlock_at > %s
61 61
         AND source = %s AND value = %s)
62 62
      AND unlock_code = %s',
Please login to merge, or discard this patch.
sources/identify.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2663,7 +2663,7 @@
 block discarded – undo
2663 2663
             'SELECT email, name
2664 2664
              FROM '.prefixTable('users').'
2665 2665
              WHERE login = %s',
2666
-             $value
2666
+                $value
2667 2667
         );
2668 2668
 
2669 2669
         // No valid email address for user
Please login to merge, or discard this patch.
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2401,7 +2401,9 @@  discard block
 block discarded – undo
2401 2401
         // Complete $userInfo
2402 2402
         $userInfo['has_been_created'] = 1;
2403 2403
 
2404
-        if (WIP === true) error_log("--- USER CREATED ---");
2404
+        if (WIP === true) {
2405
+            error_log("--- USER CREATED ---");
2406
+        }
2405 2407
 
2406 2408
         return [
2407 2409
             'error' => false,
@@ -2437,7 +2439,9 @@  discard block
 block discarded – undo
2437 2439
         }
2438 2440
 
2439 2441
         // Oauth2 user already exists and authenticated
2440
-        if (WIP === true) error_log("--- USER AUTHENTICATED ---");
2442
+        if (WIP === true) {
2443
+            error_log("--- USER AUTHENTICATED ---");
2444
+        }
2441 2445
         $userInfo['has_been_created'] = 0;
2442 2446
 
2443 2447
         $passwordManager = new PasswordManager();
@@ -2667,8 +2671,9 @@  discard block
 block discarded – undo
2667 2671
         );
2668 2672
 
2669 2673
         // No valid email address for user
2670
-        if (!$userInfos || !filter_var($userInfos['email'], FILTER_VALIDATE_EMAIL))
2671
-            return;
2674
+        if (!$userInfos || !filter_var($userInfos['email'], FILTER_VALIDATE_EMAIL)) {
2675
+                    return;
2676
+        }
2672 2677
 
2673 2678
         $unlock_url = $SETTINGS['cpassman_url'].'/self-unlock.php?login='.$value.'&otp='.$unlock_code;
2674 2679
 
Please login to merge, or discard this patch.
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
     $sessionPwdAttempts = $session->get('pwd_attempts');
148 148
     $sessionUrl = $session->get('user-initial_url');
149 149
     $server = [];
150
-    $server['PHP_AUTH_USER'] =  $request->getUser();
150
+    $server['PHP_AUTH_USER'] = $request->getUser();
151 151
     $server['PHP_AUTH_PW'] = $request->getPassword();
152 152
     
153 153
     // decrypt and retreive data in JSON format
@@ -162,18 +162,18 @@  discard block
 block discarded – undo
162 162
     }
163 163
 
164 164
     // Check if Duo auth is in progress and pass the pw and login back to the standard login process
165
-    if(
165
+    if (
166 166
         isKeyExistingAndEqual('duo', 1, $SETTINGS) === true
167 167
         && $dataReceived['user_2fa_selection'] === 'duo'
168 168
         && $session->get('user-duo_status') === 'IN_PROGRESS'
169 169
         && !empty($dataReceived['duo_state'])
170
-    ){
170
+    ) {
171 171
         $key = hash('sha256', $dataReceived['duo_state']);
172 172
         $iv = substr(hash('sha256', $dataReceived['duo_state']), 0, 16);
173 173
         $duo_data_dec = openssl_decrypt(base64_decode($session->get('user-duo_data')), 'AES-256-CBC', $key, 0, $iv);
174 174
         // Clear the data from the Duo process to continue clean with the standard login process
175
-        $session->set('user-duo_data','');
176
-        if($duo_data_dec === false) {
175
+        $session->set('user-duo_data', '');
176
+        if ($duo_data_dec === false) {
177 177
             // Add failed authentication log
178 178
             addFailedAuthentication(filter_var($dataReceived['login'], FILTER_SANITIZE_FULL_SPECIAL_CHARS), getClientIpServer());
179 179
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
         $dataReceived['login'] = $duo_data['duo_login'];
192 192
     }
193 193
 
194
-    if(isset($dataReceived['pw']) === false || isset($dataReceived['login']) === false) {
194
+    if (isset($dataReceived['pw']) === false || isset($dataReceived['login']) === false) {
195 195
         echo json_encode([
196 196
             'data' => prepareExchangedData(
197 197
                 [
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
         }
537 537
         // Append with roles from AD groups
538 538
         if (is_null($userInfo['roles_from_ad_groups']) === false) {
539
-            $userInfo['fonction_id'] = empty($userInfo['fonction_id'])  === true ? $userInfo['roles_from_ad_groups'] : $userInfo['fonction_id']. ';' . $userInfo['roles_from_ad_groups'];
539
+            $userInfo['fonction_id'] = empty($userInfo['fonction_id']) === true ? $userInfo['roles_from_ad_groups'] : $userInfo['fonction_id'].';'.$userInfo['roles_from_ad_groups'];
540 540
         }
541 541
         // store
542 542
         $session->set('user-roles', $userInfo['fonction_id']);
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
         if (count($session->get('user-roles_array')) > 0) {
549 549
             $rolesList = DB::query(
550 550
                 'SELECT id, title, complexity
551
-                FROM ' . prefixTable('roles_title') . '
551
+                FROM ' . prefixTable('roles_title').'
552 552
                 WHERE id IN %li',
553 553
                 $session->get('user-roles_array')
554 554
             );
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
             if ($adjustPermissions) {
595 595
                 $session->set('user-admin', (int) $userInfo['admin']);
596 596
                 $session->set('user-manager', (int) $userInfo['gestionnaire']);
597
-                $session->set('user-can_manage_all_users',(int)  $userInfo['can_manage_all_users']);
597
+                $session->set('user-can_manage_all_users', (int) $userInfo['can_manage_all_users']);
598 598
                 $session->set('user-read_only', (int) $userInfo['read_only']);
599 599
                 DB::update(
600 600
                     prefixTable('users'),
@@ -665,10 +665,10 @@  discard block
 block discarded – undo
665 665
         $session->set('user-latest_items_tab', []);
666 666
         $session->set('user-nb_roles', 0);
667 667
         foreach ($session->get('user-latest_items') as $item) {
668
-            if (! empty($item)) {
668
+            if (!empty($item)) {
669 669
                 $dataLastItems = DB::queryFirstRow(
670 670
                     'SELECT id,label,id_tree
671
-                    FROM ' . prefixTable('items') . '
671
+                    FROM ' . prefixTable('items').'
672 672
                     WHERE id=%i',
673 673
                     $item
674 674
                 );
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
                     [
678 678
                         'id' => $item,
679 679
                         'label' => $dataLastItems['label'],
680
-                        'url' => 'index.php?page=items&amp;group=' . $dataLastItems['id_tree'] . '&amp;id=' . $item,
680
+                        'url' => 'index.php?page=items&amp;group='.$dataLastItems['id_tree'].'&amp;id='.$item,
681 681
                     ],
682 682
                     'add'
683 683
                 );
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
         // Get cahce tree info
688 688
         $cacheTreeData = DB::queryFirstRow(
689 689
             'SELECT visible_folders
690
-            FROM ' . prefixTable('cache_tree') . '
690
+            FROM ' . prefixTable('cache_tree').'
691 691
             WHERE user_id=%i',
692 692
             (int) $session->get('user-id')
693 693
         );
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
             && (int) $sessionAdmin !== 1
720 720
         ) {
721 721
             // get all Admin users
722
-            $val = DB::queryfirstrow('SELECT email FROM ' . prefixTable('users') . " WHERE admin = %i and email != ''", 1);
722
+            $val = DB::queryfirstrow('SELECT email FROM '.prefixTable('users')." WHERE admin = %i and email != ''", 1);
723 723
             if (DB::count() > 0) {
724 724
                 // Add email to table
725 725
                 prepareSendingEmail(
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
                             '#tp_time#',
732 732
                         ],
733 733
                         [
734
-                            ' ' . $session->get('user-login') . ' (IP: ' . getClientIpServer() . ')',
734
+                            ' '.$session->get('user-login').' (IP: '.getClientIpServer().')',
735 735
                             date($SETTINGS['date_format'], (int) $session->get('user-last_connection')),
736 736
                             date($SETTINGS['time_format'], (int) $session->get('user-last_connection')),
737 737
                         ],
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
 {
843 843
     $rows = DB::query(
844 844
         'SELECT date
845
-        FROM ' . prefixTable('log_system') . "
845
+        FROM ' . prefixTable('log_system')."
846 846
         WHERE field_1 = %s
847 847
         AND type = 'failed_auth'
848 848
         AND label = 'password_is_not_correct'
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
         foreach ($rows as $record) {
857 857
             array_push(
858 858
                 $arrAttempts,
859
-                date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date'])
859
+                date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date'])
860 860
             );
861 861
         }
862 862
     }
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
     $ldapConnection
892 892
 ) : bool
893 893
 {
894
-    include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
894
+    include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
895 895
 
896 896
     if ((int) $userInfoDisabled === 1) {
897 897
         return false;
@@ -1086,7 +1086,7 @@  discard block
 block discarded – undo
1086 1086
     } catch (Exception $e) {
1087 1087
         return [
1088 1088
             'error' => true,
1089
-            'message' => "Error: " . $e->getMessage(),
1089
+            'message' => "Error: ".$e->getMessage(),
1090 1090
         ];
1091 1091
     }
1092 1092
 }
@@ -1117,7 +1117,7 @@  discard block
 block discarded – undo
1117 1117
                 'type' => 'OpenLDAP'
1118 1118
             ];
1119 1119
         default:
1120
-            throw new Exception("Unsupported LDAP type: " . $SETTINGS['ldap_type']);
1120
+            throw new Exception("Unsupported LDAP type: ".$SETTINGS['ldap_type']);
1121 1121
     }
1122 1122
 }
1123 1123
 
@@ -1254,7 +1254,7 @@  discard block
 block discarded – undo
1254 1254
         );
1255 1255
     }
1256 1256
     
1257
-    throw new Exception("Unsupported LDAP type: " . $ldapHandler['type']);
1257
+    throw new Exception("Unsupported LDAP type: ".$ldapHandler['type']);
1258 1258
 }
1259 1259
 
1260 1260
 /**
@@ -1271,12 +1271,12 @@  discard block
 block discarded – undo
1271 1271
     if (isset($SETTINGS['enable_ad_users_with_ad_groups']) === true && (int) $SETTINGS['enable_ad_users_with_ad_groups'] === 1) {
1272 1272
         // Get user groups from AD
1273 1273
         $user_ad_groups = [];
1274
-        foreach($groups as $group) {
1274
+        foreach ($groups as $group) {
1275 1275
             //print_r($group);
1276 1276
             // get relation role id for AD group
1277 1277
             $role = DB::queryFirstRow(
1278 1278
                 'SELECT lgr.role_id
1279
-                FROM ' . prefixTable('ldap_groups_roles') . ' AS lgr
1279
+                FROM ' . prefixTable('ldap_groups_roles').' AS lgr
1280 1280
                 WHERE lgr.ldap_group_id = %s',
1281 1281
                 $group
1282 1282
             );
@@ -1421,7 +1421,7 @@  discard block
 block discarded – undo
1421 1421
     }
1422 1422
 
1423 1423
     // Now check yubico validity
1424
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/Yubico/Yubico.php';
1424
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/Yubico/Yubico.php';
1425 1425
     $yubi = new Auth_Yubico($yubico_user_id, $yubico_user_key);
1426 1426
     $auth = $yubi->verify($yubico_key);
1427 1427
     //, null, null, null, 60
@@ -1480,7 +1480,7 @@  discard block
 block discarded – undo
1480 1480
             // Check if exists in DB
1481 1481
             $groupData = DB::queryFirstRow(
1482 1482
                 'SELECT id
1483
-                FROM ' . prefixTable('roles_title') . '
1483
+                FROM ' . prefixTable('roles_title').'
1484 1484
                 WHERE title = %s',
1485 1485
                 $group["displayName"]
1486 1486
             );
@@ -1610,7 +1610,7 @@  discard block
 block discarded – undo
1610 1610
             
1611 1611
             // generate new QR
1612 1612
             $new_2fa_qr = $tfa->getQRCodeImageAsDataUri(
1613
-                'Teampass - ' . $username,
1613
+                'Teampass - '.$username,
1614 1614
                 $userInfo['ga']
1615 1615
             );
1616 1616
             // clear temporary code from DB
@@ -1623,7 +1623,7 @@  discard block
 block discarded – undo
1623 1623
                 $userInfo['id']
1624 1624
             );
1625 1625
             $firstTime = [
1626
-                'value' => '<img src="' . $new_2fa_qr . '">',
1626
+                'value' => '<img src="'.$new_2fa_qr.'">',
1627 1627
                 'user_admin' => isset($sessionAdmin) ? (int) $sessionAdmin : '',
1628 1628
                 'initial_url' => isset($sessionUrl) === true ? $sessionUrl : '',
1629 1629
                 'pwd_attempts' => (int) $sessionPwdAttempts,
@@ -1779,7 +1779,7 @@  discard block
 block discarded – undo
1779 1779
         }*/
1780 1780
         return [
1781 1781
             'error' => true,
1782
-            'message' => $duo_error . $lang->get('duo_error_check_config'),
1782
+            'message' => $duo_error.$lang->get('duo_error_check_config'),
1783 1783
             'pwd_attempts' => (int) $sessionPwdAttempts,
1784 1784
             'debug_message' => $e->getMessage(),
1785 1785
             'proceedIdentification' => false,
@@ -1795,7 +1795,7 @@  discard block
 block discarded – undo
1795 1795
         } catch (DuoException $e) {
1796 1796
             return [
1797 1797
                 'error' => true,
1798
-                'message' => $duo_error . $lang->get('duo_error_url'),
1798
+                'message' => $duo_error.$lang->get('duo_error_url'),
1799 1799
                 'pwd_attempts' => (int) $sessionPwdAttempts,
1800 1800
                 'debug_message' => $e->getMessage(),
1801 1801
                 'proceedIdentification' => false,
@@ -1803,7 +1803,7 @@  discard block
 block discarded – undo
1803 1803
         }
1804 1804
         
1805 1805
         // Somethimes Duo return success but fail to return a URL, double check if the URL has been created
1806
-        if (!empty($duo_redirect_url) && isset($duo_redirect_url) && filter_var($duo_redirect_url,FILTER_SANITIZE_URL)) {
1806
+        if (!empty($duo_redirect_url) && isset($duo_redirect_url) && filter_var($duo_redirect_url, FILTER_SANITIZE_URL)) {
1807 1807
             // Since Duo Universal requires a redirect, let's store some info when the user get's back after completing the Duo prompt
1808 1808
             $key = hash('sha256', $duo_state);
1809 1809
             $iv = substr(hash('sha256', $duo_state), 0, 16);
@@ -1831,7 +1831,7 @@  discard block
 block discarded – undo
1831 1831
         } else {
1832 1832
             return [
1833 1833
                 'error' => true,
1834
-                'message' => $duo_error . $lang->get('duo_error_url'),
1834
+                'message' => $duo_error.$lang->get('duo_error_url'),
1835 1835
                 'pwd_attempts' => (int) $sessionPwdAttempts,
1836 1836
                 'proceedIdentification' => false,
1837 1837
             ];
@@ -1852,8 +1852,8 @@  discard block
 block discarded – undo
1852 1852
         // return the response (which should be the user name)
1853 1853
         if ($decoded_token['preferred_username'] === $username) {
1854 1854
             $session->set('user-duo_status', 'COMPLET');
1855
-            $session->set('user-duo_state','');
1856
-            $session->set('user-duo_data','');
1855
+            $session->set('user-duo_state', '');
1856
+            $session->set('user-duo_data', '');
1857 1857
             $session->set('user-login', $username);
1858 1858
 
1859 1859
             return [
@@ -1864,9 +1864,9 @@  discard block
 block discarded – undo
1864 1864
             ];
1865 1865
         } else {
1866 1866
             // Something wrong, username from the original Duo request is different than the one received now
1867
-            $session->set('user-duo_status','');
1868
-            $session->set('user-duo_state','');
1869
-            $session->set('user-duo_data','');
1867
+            $session->set('user-duo_status', '');
1868
+            $session->set('user-duo_state', '');
1869
+            $session->set('user-duo_data', '');
1870 1870
 
1871 1871
             return [
1872 1872
                 'error' => true,
@@ -1877,9 +1877,9 @@  discard block
 block discarded – undo
1877 1877
         }
1878 1878
     }
1879 1879
     // If we are here something wrong
1880
-    $session->set('user-duo_status','');
1881
-    $session->set('user-duo_state','');
1882
-    $session->set('user-duo_data','');
1880
+    $session->set('user-duo_status', '');
1881
+    $session->set('user-duo_state', '');
1882
+    $session->set('user-duo_data', '');
1883 1883
     return [
1884 1884
         'error' => true,
1885 1885
         'message' => $lang->get('duo_login_mismatch'),
@@ -1991,7 +1991,7 @@  discard block
 block discarded – undo
1991 1991
         // Check for existing lock
1992 1992
         $unlock_at = DB::queryFirstField(
1993 1993
             'SELECT MAX(unlock_at)
1994
-             FROM ' . prefixTable('auth_failures') . '
1994
+             FROM ' . prefixTable('auth_failures').'
1995 1995
              WHERE unlock_at > %s
1996 1996
              AND ((source = %s AND value = %s) OR (source = %s AND value = %s))',
1997 1997
             date('Y-m-d H:i:s', time()),
@@ -2013,8 +2013,8 @@  discard block
 block discarded – undo
2013 2013
         // Get user info from DB
2014 2014
         $data = DB::queryFirstRow(
2015 2015
             'SELECT u.*, a.value AS api_key
2016
-            FROM ' . prefixTable('users') . ' AS u
2017
-            LEFT JOIN ' . prefixTable('api') . ' AS a ON (u.id = a.user_id)
2016
+            FROM ' . prefixTable('users').' AS u
2017
+            LEFT JOIN ' . prefixTable('api').' AS a ON (u.id = a.user_id)
2018 2018
             WHERE login = %s AND deleted_at IS NULL',
2019 2019
             $login
2020 2020
         );
@@ -2134,7 +2134,7 @@  discard block
 block discarded – undo
2134 2134
             'array' => [
2135 2135
                 'value' => 'bruteforce_wait',
2136 2136
                 'error' => true,
2137
-                'message' => $lang->get('bruteforce_wait') . (string) $e->getMessage(),
2137
+                'message' => $lang->get('bruteforce_wait').(string) $e->getMessage(),
2138 2138
             ]
2139 2139
         ];
2140 2140
     }
@@ -2566,15 +2566,15 @@  discard block
 block discarded – undo
2566 2566
 
2567 2567
             if ($ret['error'] !== false) {
2568 2568
                 logEvents($SETTINGS, 'failed_auth', 'bad_duo_mfa', '', stripslashes($username), stripslashes($username));
2569
-                $session->set('user-duo_status','');
2570
-                $session->set('user-duo_state','');
2571
-                $session->set('user-duo_data','');
2569
+                $session->set('user-duo_status', '');
2570
+                $session->set('user-duo_state', '');
2571
+                $session->set('user-duo_data', '');
2572 2572
                 return [
2573 2573
                     'error' => true,
2574 2574
                     'mfaData' => $ret,
2575 2575
                     'mfaQRCodeInfos' => false,
2576 2576
                 ];
2577
-            } else if ($ret['duo_url_ready'] === true){
2577
+            } else if ($ret['duo_url_ready'] === true) {
2578 2578
                 return [
2579 2579
                     'error' => false,
2580 2580
                     'mfaData' => $ret,
@@ -2638,7 +2638,7 @@  discard block
 block discarded – undo
2638 2638
     // Count failed attempts from this source
2639 2639
     $count = DB::queryFirstField(
2640 2640
         'SELECT COUNT(*)
2641
-        FROM ' . prefixTable('auth_failures') . '
2641
+        FROM ' . prefixTable('auth_failures').'
2642 2642
         WHERE source = %s AND value = %s',
2643 2643
         $source,
2644 2644
         $value
Please login to merge, or discard this patch.
sources/users.datatable.php 1 patch
Spacing   +15 added lines, -17 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 ) {
78 78
     // Not allowed page
79 79
     $session->set('system-error_code', ERR_NOT_ALLOWED);
80
-    include $SETTINGS['cpassman_dir'] . '/error.php';
80
+    include $SETTINGS['cpassman_dir'].'/error.php';
81 81
     exit;
82 82
 }
83 83
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
     if (isset($order['column']) && preg_match('#^(asc|desc)$#i', $order['dir'])) {
129 129
         $columnIndex = filter_var($order['column'], FILTER_SANITIZE_NUMBER_INT);
130 130
         $dir = filter_var($order['dir'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
131
-        $sOrder .= $aColumns[$columnIndex] . ' ' . $dir . ', ';
131
+        $sOrder .= $aColumns[$columnIndex].' '.$dir.', ';
132 132
     }
133 133
 
134 134
     $sOrder = substr_replace($sOrder, '', -2);
@@ -152,15 +152,15 @@  discard block
 block discarded – undo
152 152
 
153 153
 if ($letter !== '' && $letter !== 'None') {
154 154
     $sWhere .= ' AND (';
155
-    $sWhere .= $aColumns[1] . " LIKE '" . $letter . "%' OR ";
156
-    $sWhere .= $aColumns[2] . " LIKE '" . $letter . "%' OR ";
157
-    $sWhere .= $aColumns[3] . " LIKE '" . $letter . "%' ";
155
+    $sWhere .= $aColumns[1]." LIKE '".$letter."%' OR ";
156
+    $sWhere .= $aColumns[2]." LIKE '".$letter."%' OR ";
157
+    $sWhere .= $aColumns[3]." LIKE '".$letter."%' ";
158 158
     $sWhere .= ')';
159 159
 } elseif ($searchValue !== '') {
160 160
     $sWhere .= ' AND (';
161
-    $sWhere .= $aColumns[1] . " LIKE '" . $searchValue . "%' OR ";
162
-    $sWhere .= $aColumns[2] . " LIKE '" . $searchValue . "%' OR ";
163
-    $sWhere .= $aColumns[3] . " LIKE '" . $searchValue . "%' ";
161
+    $sWhere .= $aColumns[1]." LIKE '".$searchValue."%' OR ";
162
+    $sWhere .= $aColumns[2]." LIKE '".$searchValue."%' OR ";
163
+    $sWhere .= $aColumns[3]." LIKE '".$searchValue."%' ";
164 164
     $sWhere .= ')';
165 165
 }
166 166
 
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
         // Check for existing lock
248 248
         $unlock_at = DB::queryFirstField(
249 249
             'SELECT MAX(unlock_at)
250
-             FROM ' . prefixTable('auth_failures') . '
250
+             FROM ' . prefixTable('auth_failures').'
251 251
              WHERE unlock_at > %s AND source = %s AND value = %s',
252 252
             date('Y-m-d H:i:s', time()),
253 253
             'login',
@@ -256,33 +256,31 @@  discard block
 block discarded – undo
256 256
 
257 257
         // Get some infos about user
258 258
         $userDisplayInfos = 
259
-            (isset($userDate['date']) ? '<i class=\"fas fa-calendar-day infotip text-info ml-2\" title=\"'.$lang->get('creation_date').': '.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $userDate['date']).'\"></i>' : '')
259
+            (isset($userDate['date']) ? '<i class=\"fas fa-calendar-day infotip text-info ml-2\" title=\"'.$lang->get('creation_date').': '.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $userDate['date']).'\"></i>' : '')
260 260
             .
261 261
             ((int) $record['last_connexion'] > 0 ? '<i class=\"far fa-clock infotip text-info ml-2\" title=\"'.$lang->get('index_last_seen').": ".
262
-            date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['last_connexion']).'\"></i>' : '')
262
+            date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['last_connexion']).'\"></i>' : '')
263 263
             .
264 264
             ((int) $record['user_ip'] > 0 ? '<i class=\"fas fa-street-view infotip text-info ml-1\" title=\"'.$lang->get('ip').": ".($record['user_ip']).'\"></i>' : '')
265 265
             .
266 266
             ($record['auth_type'] === 'ldap' ? '<i class=\"far fa-address-book infotip text-warning ml-1\" title=\"'.$lang->get('managed_through_ad').'\"></i>' : '')
267 267
             .
268 268
             ((in_array($record['id'], [OTV_USER_ID, TP_USER_ID, SSH_USER_ID, API_USER_ID]) === false && (int) $record['admin'] !== 1 && ((int) $SETTINGS['duo'] === 1 || (int) $SETTINGS['google_authentication'] === 1)) ?
269
-                ((int) $record['mfa_enabled'] === 1 ? '' : '<i class=\"fa-solid fa-fingerprint infotip ml-1\" style=\"color:Tomato\" title=\"'.$lang->get('mfa_disabled_for_user').'\"></i>') :
270
-                ''
269
+                ((int) $record['mfa_enabled'] === 1 ? '' : '<i class=\"fa-solid fa-fingerprint infotip ml-1\" style=\"color:Tomato\" title=\"'.$lang->get('mfa_disabled_for_user').'\"></i>') : ''
271 270
                 )
272 271
             .
273 272
             (($unlock_at) ? '<i class=\"fas fa-solid text-red fa-lock infotip text-info ml-1\" title=\"'.$lang->get('bruteforce_unlock_at').$unlock_at.'\"></i>' : '');
274 273
         if ($request->query->filter('display_warnings', '', FILTER_VALIDATE_BOOLEAN) === true) {
275 274
             $userDisplayInfos .= '<br>'.
276 275
                 ((in_array($record['id'], [OTV_USER_ID, TP_USER_ID, SSH_USER_ID, API_USER_ID]) === false && (int) $record['admin'] !== 1 && is_null($record['keys_recovery_time']) === true) ? 
277
-                    '<i class=\"fa-solid fa-download infotip ml-1\" style=\"color:Tomato\" title=\"'.$lang->get('recovery_keys_not_downloaded').'\"></i>' :
278
-                    ''
276
+                    '<i class=\"fa-solid fa-download infotip ml-1\" style=\"color:Tomato\" title=\"'.$lang->get('recovery_keys_not_downloaded').'\"></i>' : ''
279 277
                 ).
280 278
                 ((in_array($record['id'], [OTV_USER_ID, TP_USER_ID, SSH_USER_ID, API_USER_ID]) === false && (int) $record['pw_passwordlib'] === 1) ? '<i class=\"fa-solid fa-person-walking-luggage infotip ml-1\" style=\"color:Tomato\" title=\"Old password encryption. Shall login to initialize.\"></i>' : '');
281 279
         }
282 280
 
283 281
         $sOutput .= '["<span data-id=\"'.$record['id'].'\" data-fullname=\"'.
284
-            (empty($record['name']) === false ? htmlentities($record['name'], ENT_QUOTES|ENT_SUBSTITUTE|ENT_DISALLOWED) : '').' '.
285
-            (empty($record['lastname']) === false ? htmlentities($record['lastname'], ENT_QUOTES|ENT_SUBSTITUTE|ENT_DISALLOWED) : '').
282
+            (empty($record['name']) === false ? htmlentities($record['name'], ENT_QUOTES | ENT_SUBSTITUTE | ENT_DISALLOWED) : '').' '.
283
+            (empty($record['lastname']) === false ? htmlentities($record['lastname'], ENT_QUOTES | ENT_SUBSTITUTE | ENT_DISALLOWED) : '').
286 284
             '\" data-auth-type=\"'.$record['auth_type'].'\" data-special=\"'.$record['special'].'\" data-mfa-enabled=\"'.$record['mfa_enabled'].'\" data-otp-provided=\"'.(isset($record['otp_provided']) === true ? $record['otp_provided'] : '').'\"></span>", ';
287 285
         //col2
288 286
         $sOutput .= '"'.
Please login to merge, or discard this patch.
scripts/background_tasks___items_handler.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 DB::debugmode(false);
76 76
 $process_to_perform = DB::queryfirstrow(
77 77
     'SELECT *
78
-    FROM ' . prefixTable('background_tasks') . '
78
+    FROM ' . prefixTable('background_tasks').'
79 79
     WHERE is_in_progress = %i AND process_type IN ("item_copy", "new_item", "update_item", "item_update_create_keys")
80 80
     ORDER BY increment_id ASC',
81 81
     1
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
     // search for next process to handle
94 94
     $process_to_perform = DB::queryfirstrow(
95 95
         'SELECT *
96
-        FROM ' . prefixTable('background_tasks') . '
96
+        FROM ' . prefixTable('background_tasks').'
97 97
         WHERE is_in_progress = %i AND (finished_at = "" OR finished_at IS NULL) AND process_type IN ("item_copy", "new_item", "update_item", "item_update_create_keys")
98 98
         ORDER BY increment_id ASC',
99 99
         0
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
             $process_to_perform['increment_id']
112 112
         );
113 113
 
114
-        provideLog('[PROCESS][#'. $process_to_perform['increment_id'].'][START]', $SETTINGS);
114
+        provideLog('[PROCESS][#'.$process_to_perform['increment_id'].'][START]', $SETTINGS);
115 115
         handleTask(
116 116
             $process_to_perform['increment_id'],
117 117
             json_decode($process_to_perform['arguments'], true),
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
         // Search if there are remaining tasks
142 142
         $process_to_perform = DB::queryFirstField(
143 143
             'SELECT 1
144
-            FROM ' . prefixTable('background_tasks') . '
144
+            FROM ' . prefixTable('background_tasks').'
145 145
             WHERE is_in_progress = %i AND process_type IN (
146 146
                 "item_copy",
147 147
                 "new_item",
@@ -180,10 +180,10 @@  discard block
 block discarded – undo
180 180
  */
181 181
 function handleTask(int $processId, array $ProcessArguments, array $SETTINGS, int $itemId = null): bool
182 182
 {
183
-    provideLog('[PROCESS][#'. $processId.'][START]', $SETTINGS);
183
+    provideLog('[PROCESS][#'.$processId.'][START]', $SETTINGS);
184 184
     $task_to_perform = DB::queryfirstrow(
185 185
         'SELECT *
186
-        FROM ' . prefixTable('background_subtasks') . '
186
+        FROM ' . prefixTable('background_subtasks').'
187 187
         WHERE task_id = %i AND finished_at IS NULL
188 188
         ORDER BY increment_id ASC',
189 189
         $processId
@@ -197,13 +197,13 @@  discard block
 block discarded – undo
197 197
         // if sub_task_in_progress === 1 then exit
198 198
         if ((int) $task_to_perform['sub_task_in_progress'] !== 0) {
199 199
             // Task is currently being in progress by another server process
200
-            provideLog('[TASK][#'. $task_to_perform['increment_id'].'][WARNING] Similar task already being processes', $SETTINGS);
200
+            provideLog('[TASK][#'.$task_to_perform['increment_id'].'][WARNING] Similar task already being processes', $SETTINGS);
201 201
             return false;
202 202
         }
203 203
 
204 204
         // handle next task
205 205
         $args = json_decode($task_to_perform['task'], true);
206
-        provideLog('[TASK][#'. $task_to_perform['increment_id'].'][START]Task '.$args['step'], $SETTINGS);
206
+        provideLog('[TASK][#'.$task_to_perform['increment_id'].'][START]Task '.$args['step'], $SETTINGS);
207 207
 
208 208
         // flag as in progress
209 209
         DB::update(
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
         DB::update(
246 246
             prefixTable('background_subtasks'),
247 247
             array(
248
-                'sub_task_in_progress' => 0,    // flag sub task is no more in prgoress
248
+                'sub_task_in_progress' => 0, // flag sub task is no more in prgoress
249 249
                 'task' => json_encode(["status" => "Done"]),
250 250
                 'is_in_progress' => -1,
251 251
                 'finished_at' => time(),
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
         // are all tasks done?
261 261
         DB::query(
262 262
             'SELECT *
263
-            FROM ' . prefixTable('background_subtasks') . '
263
+            FROM ' . prefixTable('background_subtasks').'
264 264
             WHERE task_id = %i AND finished_at IS NULL',
265 265
             $processId
266 266
         );
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
         // Loop on all files for this item
333 333
         // and encrypt them for each user
334 334
         if (WIP === true) provideLog('[DEBUG] '.print_r($args['files_keys'], true), $SETTINGS);
335
-        foreach($args['files_keys'] as $file) {
335
+        foreach ($args['files_keys'] as $file) {
336 336
             storeUsersShareKey(
337 337
                 prefixTable('sharekeys_items'),
338 338
                 0,
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
         // Loop on all encrypted fields for this item
349 349
         // and encrypt them for each user
350 350
         if (WIP === true) provideLog('[DEBUG] '.print_r($args, true), $SETTINGS);
351
-        foreach($args['fields_keys'] as $field) {
351
+        foreach ($args['fields_keys'] as $field) {
352 352
             storeUsersShareKey(
353 353
                 prefixTable('sharekeys_fields'),
354 354
                 0,
@@ -400,6 +400,6 @@  discard block
 block discarded – undo
400 400
     DB::query(
401 401
         'DELETE FROM '.prefixTable('items_edition').'
402 402
         WHERE timestamp < %i',
403
-        ($SETTINGS['delay_item_edition'] > 0) ? time() - ($SETTINGS['delay_item_edition']*60) : time() - EDITION_LOCK_PERIOD
403
+        ($SETTINGS['delay_item_edition'] > 0) ? time() - ($SETTINGS['delay_item_edition'] * 60) : time() - EDITION_LOCK_PERIOD
404 404
     );
405 405
 }
Please login to merge, or discard this patch.
Braces   +15 added lines, -6 removed lines patch added patch discarded remove patch
@@ -83,7 +83,9 @@  discard block
 block discarded – undo
83 83
 
84 84
 if (DB::count() > 0) {
85 85
     // handle tasks inside this process
86
-    if (WIP === true) error_log("Process in progress: ".$process_to_perform['increment_id']);
86
+    if (WIP === true) {
87
+        error_log("Process in progress: ".$process_to_perform['increment_id']);
88
+    }
87 89
     handleTask(
88 90
         $process_to_perform['increment_id'],
89 91
         json_decode($process_to_perform['arguments'], true),
@@ -100,7 +102,9 @@  discard block
 block discarded – undo
100 102
     );
101 103
     
102 104
     if (DB::count() > 0) {
103
-        if (WIP === true) error_log("New process ta start: ".$process_to_perform['increment_id']);
105
+        if (WIP === true) {
106
+            error_log("New process ta start: ".$process_to_perform['increment_id']);
107
+        }
104 108
         // update DB - started_at
105 109
         DB::update(
106 110
             prefixTable('background_tasks'),
@@ -153,8 +157,9 @@  discard block
 block discarded – undo
153 157
         );
154 158
 
155 159
         // No more tasks, exit
156
-        if ($process_to_perform !== 1)
157
-            break;
160
+        if ($process_to_perform !== 1) {
161
+                    break;
162
+        }
158 163
 
159 164
         // Run next task
160 165
         $process = new Symfony\Component\Process\Process([
@@ -331,7 +336,9 @@  discard block
 block discarded – undo
331 336
     if ($args['step'] === 'create_users_files_key') {
332 337
         // Loop on all files for this item
333 338
         // and encrypt them for each user
334
-        if (WIP === true) provideLog('[DEBUG] '.print_r($args['files_keys'], true), $SETTINGS);
339
+        if (WIP === true) {
340
+            provideLog('[DEBUG] '.print_r($args['files_keys'], true), $SETTINGS);
341
+        }
335 342
         foreach($args['files_keys'] as $file) {
336 343
             storeUsersShareKey(
337 344
                 prefixTable('sharekeys_items'),
@@ -347,7 +354,9 @@  discard block
 block discarded – undo
347 354
     } elseif ($args['step'] === 'create_users_fields_key') {
348 355
         // Loop on all encrypted fields for this item
349 356
         // and encrypt them for each user
350
-        if (WIP === true) provideLog('[DEBUG] '.print_r($args, true), $SETTINGS);
357
+        if (WIP === true) {
358
+            provideLog('[DEBUG] '.print_r($args, true), $SETTINGS);
359
+        }
351 360
         foreach($args['fields_keys'] as $field) {
352 361
             storeUsersShareKey(
353 362
                 prefixTable('sharekeys_fields'),
Please login to merge, or discard this patch.
sources/logs.datatables.php 1 patch
Spacing   +23 added lines, -24 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 ) {
77 77
     // Not allowed page
78 78
     $session->set('system-error_code', ERR_NOT_ALLOWED);
79
-    include $SETTINGS['cpassman_dir'] . '/error.php';
79
+    include $SETTINGS['cpassman_dir'].'/error.php';
80 80
     exit;
81 81
 }
82 82
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
     
169 169
     // Output
170 170
     $sOutput = '{';
171
-    $sOutput .= '"sEcho": '. $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
171
+    $sOutput .= '"sEcho": '.$request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
172 172
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
173 173
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
174 174
     $sOutput .= '"aaData": ';
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 
242 242
     // Output
243 243
     $sOutput = '{';
244
-    $sOutput .= '"sEcho": '. $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
244
+    $sOutput .= '"sEcho": '.$request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
245 245
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
246 246
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
247 247
     $sOutput .= '"aaData": ';
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 
315 315
     // Output
316 316
     $sOutput = '{';
317
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
317
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
318 318
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
319 319
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
320 320
     $sOutput .= '"aaData": ';
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 
388 388
     // Output
389 389
     $sOutput = '{';
390
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
390
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
391 391
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
392 392
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
393 393
     $sOutput .= '"aaData": [ ';
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
 
491 491
     // Output
492 492
     $sOutput = '{';
493
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
493
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
494 494
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
495 495
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
496 496
     $sOutput .= '"aaData": [ ';
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
         $iTotal = 0;
573 573
     }
574 574
     $sOutput = '{';
575
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
575
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
576 576
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
577 577
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
578 578
     $sOutput .= '"aaData": ';
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
 
649 649
     // Output
650 650
     $sOutput = '{';
651
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
651
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
652 652
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
653 653
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
654 654
     $sOutput .= '"aaData": ';
@@ -717,7 +717,7 @@  discard block
 block discarded – undo
717 717
 
718 718
     // Output
719 719
     $sOutput = '{';
720
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
720
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
721 721
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
722 722
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
723 723
     $sOutput .= '"aaData": ';
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 
792 792
     // Output
793 793
     $sOutput = '{';
794
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
794
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
795 795
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
796 796
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
797 797
     $sOutput .= '"aaData": ';
@@ -868,7 +868,7 @@  discard block
 block discarded – undo
868 868
             FROM '.prefixTable('background_tasks').' AS p 
869 869
             LEFT JOIN '.prefixTable('users').' AS u ON %l
870 870
             WHERE %l ORDER BY %l %l LIMIT %i, %i';
871
-    $params = ['u.id = json_extract(p.arguments, "$[0]")',$sWhere, $orderColumn, $orderDirection, $sLimitStart, $sLimitLength];
871
+    $params = ['u.id = json_extract(p.arguments, "$[0]")', $sWhere, $orderColumn, $orderDirection, $sLimitStart, $sLimitLength];
872 872
 
873 873
     // Get the records
874 874
     $rows = DB::query($sql, ...$params);
@@ -876,7 +876,7 @@  discard block
 block discarded – undo
876 876
 
877 877
     // Output
878 878
     $sOutput = '{';
879
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
879
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
880 880
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
881 881
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
882 882
     $sOutput .= '"aaData": ';
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
         //col1
892 892
         $sOutput .= '"<span data-done=\"'.$record['is_in_progress'].'\" data-type=\"'.$record['process_type'].'\" data-process-id=\"'.$record['increment_id'].'\"></span>", ';
893 893
         //col2
894
-        $sOutput .= '"'.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['created_at']).'", ';
894
+        $sOutput .= '"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['created_at']).'", ';
895 895
         //col3
896 896
         //$sOutput .= '"'.($record['updated_at'] === '' ? '-' : date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['updated_at'])).'", ';
897 897
         $sOutput .= '"<div class=\"progress mt-2\"><div class=\"progress-bar\" style=\"width: '.$subtaskProgress.'\">'.$subtaskProgress.'</div></div>", ';
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
         // col5
902 902
         if (in_array($record['process_type'], array('create_user_keys', 'item_copy')) === true) {
903 903
             $data_user = DB::queryfirstrow(
904
-                'SELECT name, lastname FROM ' . prefixTable('users') . '
904
+                'SELECT name, lastname FROM '.prefixTable('users').'
905 905
                 WHERE id = %i',
906 906
                 json_decode($record['arguments'], true)['new_user_id']
907 907
             );
@@ -957,7 +957,7 @@  discard block
 block discarded – undo
957 957
     FROM '.prefixTable('background_tasks').' AS p 
958 958
     LEFT JOIN '.prefixTable('users').' AS u ON %l
959 959
     WHERE %l ORDER BY %l %l LIMIT %i, %i';
960
-    $params = ['u.id = json_extract(p.arguments, "$[0]")',$sWhere, $orderColumn, $orderDirection, $sLimitStart, $sLimitLength];
960
+    $params = ['u.id = json_extract(p.arguments, "$[0]")', $sWhere, $orderColumn, $orderDirection, $sLimitStart, $sLimitLength];
961 961
 
962 962
     // Get the records
963 963
     $rows = DB::query($sql, ...$params);
@@ -965,7 +965,7 @@  discard block
 block discarded – undo
965 965
 
966 966
     // Output
967 967
     $sOutput = '{';
968
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
968
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
969 969
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
970 970
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
971 971
     $sOutput .= '"aaData": ';
@@ -981,13 +981,12 @@  discard block
 block discarded – undo
981 981
         //col1
982 982
         $sOutput .= '"", ';
983 983
         //col2
984
-        $sOutput .= '"'.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['created_at']).'", ';
984
+        $sOutput .= '"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['created_at']).'", ';
985 985
         //col3
986 986
         $sOutput .= is_null($record['started_at']) === false ?
987
-            ('"'.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['started_at']).'", ') :
988
-                ('"'.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['created_at']).'", ');
987
+            ('"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['started_at']).'", ') : ('"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['created_at']).'", ');
989 988
         //col4
990
-        $sOutput .= '"'.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['finished_at']).'", ';
989
+        $sOutput .= '"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['finished_at']).'", ';
991 990
         // col7
992 991
         $sOutput .= '"'.gmdate('H:i:s', (int) $record['finished_at'] - (is_null($record['started_at']) === false ? (int) $record['started_at'] : (int) $record['created_at'])).'",';
993 992
         //col5
@@ -1006,7 +1005,7 @@  discard block
 block discarded – undo
1006 1005
         $newUserId = array_key_exists('new_user_id', $arguments) ? $arguments['new_user_id'] : null;
1007 1006
         if ($record['process_type'] === 'create_user_keys' && is_null($newUserId) === false && empty($newUserId) === false) {
1008 1007
             $data_user = DB::queryfirstrow(
1009
-                'SELECT name, lastname, login FROM ' . prefixTable('users') . '
1008
+                'SELECT name, lastname, login FROM '.prefixTable('users').'
1010 1009
                 WHERE id = %i',
1011 1010
                 $newUserId
1012 1011
             );
@@ -1022,7 +1021,7 @@  discard block
 block discarded – undo
1022 1021
         } elseif ($record['process_type'] === 'user_build_cache_tree') {
1023 1022
             $user = json_decode($record['arguments'], true)['user_id'];
1024 1023
             $data_user = DB::queryfirstrow(
1025
-                'SELECT name, lastname, login FROM ' . prefixTable('users') . '
1024
+                'SELECT name, lastname, login FROM '.prefixTable('users').'
1026 1025
                 WHERE id = %i',
1027 1026
                 $user
1028 1027
             );
@@ -1056,7 +1055,7 @@  discard block
 block discarded – undo
1056 1055
 {
1057 1056
     $subtasks = DB::query(
1058 1057
         'SELECT *
1059
-        FROM ' . prefixTable('background_subtasks') . '
1058
+        FROM ' . prefixTable('background_subtasks').'
1060 1059
         WHERE task_id = %i',
1061 1060
         $id
1062 1061
     );
@@ -1072,5 +1071,5 @@  discard block
 block discarded – undo
1072 1071
         $i++;
1073 1072
     }
1074 1073
 
1075
-    return ($finished_nb !== 0 ? pourcentage($finished_nb, $nb, 100) : 0) .'%';
1074
+    return ($finished_nb !== 0 ? pourcentage($finished_nb, $nb, 100) : 0).'%';
1076 1075
 }
1077 1076
\ No newline at end of file
Please login to merge, or discard this patch.