Passed
Push — master ( b61ff7...0d33c7 )
by Nils
05:51
created
scripts/taskLogger.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,8 +47,8 @@
 block discarded – undo
47 47
      */
48 48
     public function log(string $message, string $level = 'INFO') {
49 49
         if (!empty($this->settings['enable_tasks_log'])) {
50
-            $formattedMessage = date($this->settings['date_format'] . ' ' . $this->settings['time_format']) . 
51
-                                " - [$level] $message" . PHP_EOL;
50
+            $formattedMessage = date($this->settings['date_format'].' '.$this->settings['time_format']). 
51
+                                " - [$level] $message".PHP_EOL;
52 52
 
53 53
             if (!empty($this->logFile)) {
54 54
                 // WWrite to the specified log file
Please login to merge, or discard this patch.
scripts/background_tasks___handler.php 2 patches
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -55,7 +55,9 @@  discard block
 block discarded – undo
55 55
     public function processBackgroundTasks() {
56 56
         // Prevent multiple concurrent executions
57 57
         if (!$this->acquireProcessLock()) {
58
-            if (LOG_TASKS=== true) $this->logger->log('Process already running', 'INFO');
58
+            if (LOG_TASKS=== true) {
59
+                $this->logger->log('Process already running', 'INFO');
60
+            }
59 61
             return false;
60 62
         }
61 63
 
@@ -64,7 +66,9 @@  discard block
 block discarded – undo
64 66
             $this->processTaskBatches();
65 67
             $this->performMaintenanceTasks();
66 68
         } catch (Exception $e) {
67
-            if (LOG_TASKS=== true) $this->logger->log('Task processing error: ' . $e->getMessage(), 'ERROR');
69
+            if (LOG_TASKS=== true) {
70
+                $this->logger->log('Task processing error: ' . $e->getMessage(), 'ERROR');
71
+            }
68 72
         } finally {
69 73
             $this->releaseProcessLock();
70 74
         }
@@ -131,7 +135,9 @@  discard block
 block discarded – undo
131 135
         
132 136
         // Check if the maximum number of parallel tasks is reached
133 137
         if ($runningTasks >= $this->maxParallelTasks) {
134
-            if (LOG_TASKS=== true) $this->logger->log('Wait ... '.$runningTasks.' out of '.$this->maxParallelTasks.' are already running ', 'INFO');
138
+            if (LOG_TASKS=== true) {
139
+                $this->logger->log('Wait ... '.$runningTasks.' out of '.$this->maxParallelTasks.' are already running ', 'INFO');
140
+            }
135 141
             return;
136 142
         }
137 143
 
@@ -149,7 +155,9 @@  discard block
 block discarded – undo
149 155
         );
150 156
 
151 157
         foreach ($tasks as $task) {
152
-            if (LOG_TASKS=== true) $this->logger->log('Launching '.$task['increment_id'], 'INFO');
158
+            if (LOG_TASKS=== true) {
159
+                $this->logger->log('Launching '.$task['increment_id'], 'INFO');
160
+            }
153 161
             $this->processIndividualTask($task);
154 162
         }
155 163
     }
@@ -160,7 +168,9 @@  discard block
 block discarded – undo
160 168
      * @param array $task The task to process.
161 169
      */
162 170
     private function processIndividualTask(array $task) {
163
-        if (LOG_TASKS=== true)  $this->logger->log('Starting task: ' . print_r($task, true), 'INFO');
171
+        if (LOG_TASKS=== true) {
172
+            $this->logger->log('Starting task: ' . print_r($task, true), 'INFO');
173
+        }
164 174
 
165 175
         // Store progress in the database        
166 176
         DB::update(
@@ -188,7 +198,9 @@  discard block
 block discarded – undo
188 198
             $process->mustRun();
189 199
 
190 200
         } catch (Exception $e) {
191
-            if (LOG_TASKS=== true) $this->logger->log('Error launching task: ' . $e->getMessage(), 'ERROR');
201
+            if (LOG_TASKS=== true) {
202
+                $this->logger->log('Error launching task: ' . $e->getMessage(), 'ERROR');
203
+            }
192 204
             DB::update(
193 205
                 prefixTable('background_tasks'),
194 206
                 [
@@ -290,7 +302,9 @@  discard block
 block discarded – undo
290 302
             $taskIds
291 303
         );
292 304
     
293
-        if (LOG_TASKS=== true) $this->logger->log('Old finished tasks cleaned: ' . count($taskIds), 'INFO');
305
+        if (LOG_TASKS=== true) {
306
+            $this->logger->log('Old finished tasks cleaned: ' . count($taskIds), 'INFO');
307
+        }
294 308
     }
295 309
 }
296 310
 
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 use TeampassClasses\ConfigManager\ConfigManager;
31 31
 
32 32
 require_once __DIR__.'/../sources/main.functions.php';
33
-require_once __DIR__ . '/taskLogger.php';
33
+require_once __DIR__.'/taskLogger.php';
34 34
 
35 35
 class BackgroundTasksHandler {
36 36
     private $settings;
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     public function processBackgroundTasks() {
56 56
         // Prevent multiple concurrent executions
57 57
         if (!$this->acquireProcessLock()) {
58
-            if (LOG_TASKS=== true) $this->logger->log('Process already running', 'INFO');
58
+            if (LOG_TASKS === true) $this->logger->log('Process already running', 'INFO');
59 59
             return false;
60 60
         }
61 61
 
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
             $this->processTaskBatches();
65 65
             $this->performMaintenanceTasks();
66 66
         } catch (Exception $e) {
67
-            if (LOG_TASKS=== true) $this->logger->log('Task processing error: ' . $e->getMessage(), 'ERROR');
67
+            if (LOG_TASKS === true) $this->logger->log('Task processing error: '.$e->getMessage(), 'ERROR');
68 68
         } finally {
69 69
             $this->releaseProcessLock();
70 70
         }
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
             return false;
84 84
         }
85 85
         
86
-        fwrite($fp, (string)getmypid());
86
+        fwrite($fp, (string) getmypid());
87 87
         return true;
88 88
     }
89 89
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
     private function cleanupStaleTasks() {
102 102
         // Mark tasks as failed if they've been running too long
103 103
         DB::query(
104
-            'UPDATE ' . prefixTable('background_tasks') . ' 
104
+            'UPDATE '.prefixTable('background_tasks').' 
105 105
             SET is_in_progress = -1, 
106 106
                 finished_at = %i, 
107 107
                 status = "failed",
@@ -114,8 +114,8 @@  discard block
 block discarded – undo
114 114
 
115 115
         // Remove very old failed tasks
116 116
         DB::query(
117
-            'DELETE t, st FROM ' . prefixTable('background_tasks') . ' t
118
-            INNER JOIN ' . prefixTable('background_subtasks') . ' st ON (t.increment_id = st.task_id)
117
+            'DELETE t, st FROM '.prefixTable('background_tasks').' t
118
+            INNER JOIN ' . prefixTable('background_subtasks').' st ON (t.increment_id = st.task_id)
119 119
             WHERE t.finished_at < %i 
120 120
             AND t.status = %s',
121 121
             time() - $this->maxTimeBeforeRemoval,
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
         
133 133
         // Check if the maximum number of parallel tasks is reached
134 134
         if ($runningTasks >= $this->maxParallelTasks) {
135
-            if (LOG_TASKS=== true) $this->logger->log('Wait ... '.$runningTasks.' out of '.$this->maxParallelTasks.' are already running ', 'INFO');
135
+            if (LOG_TASKS === true) $this->logger->log('Wait ... '.$runningTasks.' out of '.$this->maxParallelTasks.' are already running ', 'INFO');
136 136
             return;
137 137
         }
138 138
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
         // Fetch next batch of tasks
142 142
         $tasks = DB::query(
143 143
             'SELECT increment_id, process_type, arguments 
144
-            FROM ' . prefixTable('background_tasks') . '
144
+            FROM ' . prefixTable('background_tasks').'
145 145
             WHERE is_in_progress = 0 
146 146
             AND (finished_at IS NULL OR finished_at = "")
147 147
             ORDER BY increment_id ASC
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
         );
151 151
 
152 152
         foreach ($tasks as $task) {
153
-            if (LOG_TASKS=== true) $this->logger->log('Launching '.$task['increment_id'], 'INFO');
153
+            if (LOG_TASKS === true) $this->logger->log('Launching '.$task['increment_id'], 'INFO');
154 154
             $this->processIndividualTask($task);
155 155
         }
156 156
     }
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
      * @param array $task The task to process.
162 162
      */
163 163
     private function processIndividualTask(array $task) {
164
-        if (LOG_TASKS=== true)  $this->logger->log('Starting task: ' . print_r($task, true), 'INFO');
164
+        if (LOG_TASKS === true)  $this->logger->log('Starting task: '.print_r($task, true), 'INFO');
165 165
 
166 166
         // Store progress in the database        
167 167
         DB::update(
@@ -179,19 +179,19 @@  discard block
 block discarded – undo
179 179
         // Prepare process
180 180
         $process = new Process([
181 181
             PHP_BINARY,
182
-            __DIR__ . '/background_tasks___worker.php',
182
+            __DIR__.'/background_tasks___worker.php',
183 183
             $task['increment_id'],
184 184
             $task['process_type'],
185 185
             $task['arguments']
186 186
         ]);
187 187
 
188 188
         // Launch process
189
-        try{
189
+        try {
190 190
             $process->setTimeout($this->maxExecutionTime);
191 191
             $process->mustRun();
192 192
 
193 193
         } catch (Exception $e) {
194
-            if (LOG_TASKS=== true) $this->logger->log('Error launching task: ' . $e->getMessage(), 'ERROR');
194
+            if (LOG_TASKS === true) $this->logger->log('Error launching task: '.$e->getMessage(), 'ERROR');
195 195
             DB::update(
196 196
                 prefixTable('background_tasks'),
197 197
                 [
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
     private function countRunningTasks(): int {
214 214
         return DB::queryFirstField(
215 215
             'SELECT COUNT(*) 
216
-            FROM ' . prefixTable('background_tasks') . ' 
216
+            FROM ' . prefixTable('background_tasks').' 
217 217
             WHERE is_in_progress = 1'
218 218
         );
219 219
     }
@@ -234,10 +234,10 @@  discard block
 block discarded – undo
234 234
      */
235 235
     private function cleanMultipleItemsEdition() {
236 236
         DB::query(
237
-            'DELETE i1 FROM ' . prefixTable('items_edition') . ' i1
237
+            'DELETE i1 FROM '.prefixTable('items_edition').' i1
238 238
             JOIN (
239 239
                 SELECT user_id, item_id, MIN(timestamp) AS oldest_timestamp
240
-                FROM ' . prefixTable('items_edition') . '
240
+                FROM ' . prefixTable('items_edition').'
241 241
                 GROUP BY user_id, item_id
242 242
             ) i2 ON i1.user_id = i2.user_id AND i1.item_id = i2.item_id
243 243
             WHERE i1.timestamp > i2.oldest_timestamp'
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
      */
251 251
     private function handleItemTokensExpiration() {
252 252
         DB::query(
253
-            'DELETE FROM ' . prefixTable('items_edition') . '
253
+            'DELETE FROM '.prefixTable('items_edition').'
254 254
             WHERE timestamp < %i',
255 255
             time() - ($this->settings['delay_item_edition'] * 60 ?: EDITION_LOCK_PERIOD)
256 256
         );
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
         // 1. Get all finished tasks older than the cutoff timestamp
268 268
         //    and that are not in progress
269 269
         $tasks = DB::query(
270
-            'SELECT increment_id FROM ' . prefixTable('background_tasks') . '
270
+            'SELECT increment_id FROM '.prefixTable('background_tasks').'
271 271
             WHERE status = %s AND is_in_progress = %i AND finished_at < %s',
272 272
             'completed',
273 273
             -1,
@@ -282,19 +282,19 @@  discard block
 block discarded – undo
282 282
     
283 283
         // 2. Delete all subtasks related to these tasks
284 284
         DB::query(
285
-            'DELETE FROM ' . prefixTable('background_subtasks') . '
285
+            'DELETE FROM '.prefixTable('background_subtasks').'
286 286
             WHERE task_id IN %ls',
287 287
             $taskIds
288 288
         );
289 289
     
290 290
         // 3. Delete the tasks themselves
291 291
         DB::query(
292
-            'DELETE FROM ' . prefixTable('background_tasks') . '
292
+            'DELETE FROM '.prefixTable('background_tasks').'
293 293
             WHERE increment_id IN %ls',
294 294
             $taskIds
295 295
         );
296 296
     
297
-        if (LOG_TASKS=== true) $this->logger->log('Old finished tasks cleaned: ' . count($taskIds), 'INFO');
297
+        if (LOG_TASKS === true) $this->logger->log('Old finished tasks cleaned: '.count($taskIds), 'INFO');
298 298
     }
299 299
 }
300 300
 
@@ -308,5 +308,5 @@  discard block
 block discarded – undo
308 308
     $tasksHandler = new BackgroundTasksHandler($settings);
309 309
     $tasksHandler->processBackgroundTasks();
310 310
 } catch (Exception $e) {
311
-    error_log('Teampass Background Tasks Error: ' . $e->getMessage());
311
+    error_log('Teampass Background Tasks Error: '.$e->getMessage());
312 312
 }
313 313
\ No newline at end of file
Please login to merge, or discard this patch.
pages/favourites.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     || (isset($session_user_admin) && (int) $session_user_admin === 1)) {
73 73
     // Not allowed page
74 74
     $session->set('system-error_code', ERR_NOT_ALLOWED);
75
-    include $SETTINGS['cpassman_dir'] . '/error.php';
75
+    include $SETTINGS['cpassman_dir'].'/error.php';
76 76
     exit;
77 77
 }
78 78
 
@@ -125,12 +125,12 @@  discard block
 block discarded – undo
125 125
                             if (empty($fav) === false) {
126 126
                                 $data = DB::queryFirstRow(
127 127
                                     'SELECT i.label, i.description, i.id, i.id_tree, t.title
128
-                                    FROM ' . prefixTable('items') . ' as i
129
-                                    INNER JOIN ' . prefixTable('nested_tree') . ' as t ON (t.id = i.id_tree)
128
+                                    FROM ' . prefixTable('items').' as i
129
+                                    INNER JOIN ' . prefixTable('nested_tree').' as t ON (t.id = i.id_tree)
130 130
                                     WHERE i.id = %i',
131 131
                                     $fav
132 132
                                 );
133
-                                if (! empty($data['label'])) {
133
+                                if (!empty($data['label'])) {
134 134
                                     ?>
135 135
                                     <tr>
136 136
                                         <td>
Please login to merge, or discard this patch.
includes/core/login.oauth2.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
 use TeampassClasses\SessionManager\SessionManager;
34 34
 use TeampassClasses\ConfigManager\ConfigManager;
35 35
 
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
Please login to merge, or discard this patch.
sources/upload.attachments.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -134,7 +134,9 @@
 block discarded – undo
134 134
         handleAttachmentError('File exceeds the maximum allowed size', 120, 413);
135 135
         die();
136 136
     }
137
-    if (WIP === true) error_log('POST_MAX_SIZE: ' . $POST_MAX_SIZE." - CONTENT_LENGTH: ".$_SERVER['CONTENT_LENGTH']." - UNIT: ".$unit." - MAX: ".$maxSize." - MULTIPLIER: ".$multiplier." - FILE_SIZE: ".$post_fileSize);
137
+    if (WIP === true) {
138
+        error_log('POST_MAX_SIZE: ' . $POST_MAX_SIZE." - CONTENT_LENGTH: ".$_SERVER['CONTENT_LENGTH']." - UNIT: ".$unit." - MAX: ".$maxSize." - MULTIPLIER: ".$multiplier." - FILE_SIZE: ".$post_fileSize);
139
+    }
138 140
     
139 141
     // delete expired tokens
140 142
     DB::delete(prefixTable('tokens'), 'end_timestamp < %i', time());
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 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
-    if (WIP === true) error_log('POST_MAX_SIZE: ' . $POST_MAX_SIZE." - CONTENT_LENGTH: ".$_SERVER['CONTENT_LENGTH']." - UNIT: ".$unit." - MAX: ".$maxSize." - MULTIPLIER: ".$multiplier." - FILE_SIZE: ".$post_fileSize);
137
+    if (WIP === true) 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
@@ -269,8 +269,8 @@  discard block
 block discarded – undo
269 269
             $ext,
270 270
             explode(
271 271
                 ',',
272
-                $SETTINGS['upload_docext'] . ',' . $SETTINGS['upload_imagesext'] .
273
-                    ',' . $SETTINGS['upload_pkgext'] . ',' . $SETTINGS['upload_otherext']
272
+                $SETTINGS['upload_docext'].','.$SETTINGS['upload_imagesext'].
273
+                    ','.$SETTINGS['upload_pkgext'].','.$SETTINGS['upload_otherext']
274 274
             )
275 275
         ) === false
276 276
     ) {
@@ -283,24 +283,24 @@  discard block
 block discarded – undo
283 283
 
284 284
 // Clean the fileName for security reasons
285 285
 $fileInfo = pathinfo($fileName);
286
-$fileName = base64_encode($fileInfo['filename']) . '.' . $fileInfo['extension'];
286
+$fileName = base64_encode($fileInfo['filename']).'.'.$fileInfo['extension'];
287 287
 $fileFullSize = 0;
288 288
 
289 289
 // Make sure the fileName is unique but only if chunking is disabled
290
-if ($chunks < 2 && file_exists($targetDir . DIRECTORY_SEPARATOR . $fileName)) {
290
+if ($chunks < 2 && file_exists($targetDir.DIRECTORY_SEPARATOR.$fileName)) {
291 291
     $ext = strrpos($fileName, '.');
292 292
     $fileNameA = substr($fileName, 0, $ext);
293 293
     $fileNameB = substr($fileName, $ext);
294 294
 
295 295
     $count = 1;
296
-    while (file_exists($targetDir . DIRECTORY_SEPARATOR . $fileNameA . '_' . $count . $fileNameB)) {
296
+    while (file_exists($targetDir.DIRECTORY_SEPARATOR.$fileNameA.'_'.$count.$fileNameB)) {
297 297
         ++$count;
298 298
     }
299 299
 
300
-    $fileName = $fileNameA . '_' . $count . $fileNameB;
300
+    $fileName = $fileNameA.'_'.$count.$fileNameB;
301 301
 }
302 302
 
303
-$filePath = $targetDir . DIRECTORY_SEPARATOR . $fileName;
303
+$filePath = $targetDir.DIRECTORY_SEPARATOR.$fileName;
304 304
 
305 305
 // Create target dir
306 306
 if (file_exists($targetDir) === false) {
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 // Remove old temp files
315 315
 if ($cleanupTargetDir && is_dir($targetDir) && ($dir = opendir($targetDir))) {
316 316
     while (($file = readdir($dir)) !== false) {
317
-        $tmpfilePath = $targetDir . DIRECTORY_SEPARATOR . $file;
317
+        $tmpfilePath = $targetDir.DIRECTORY_SEPARATOR.$file;
318 318
 
319 319
         // Remove temp file if it is older than the max age and is not the current file
320 320
         if (
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
         prefixTable('files'),
417 417
         array(
418 418
             'id_item' => $post_itemId,
419
-            'name' => 'b64:' . $fileName,   // add "b64:" prefix to indicate that the file name is base64 encoded
419
+            'name' => 'b64:'.$fileName, // add "b64:" prefix to indicate that the file name is base64 encoded
420 420
             'size' => $post_fileSize,
421 421
             'extension' => $fileInfo['extension'],
422 422
             'type' => $_FILES['file']['type'],
@@ -433,8 +433,8 @@  discard block
 block discarded – undo
433 433
         // This is a public object
434 434
         $users = DB::query(
435 435
             'SELECT id, public_key
436
-            FROM ' . prefixTable('users') . '
437
-            WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '")
436
+            FROM ' . prefixTable('users').'
437
+            WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'")
438 438
             AND public_key != ""'
439 439
         );
440 440
         foreach ($users as $user) {
@@ -468,14 +468,14 @@  discard block
 block discarded – undo
468 468
                 'date' => time(),
469 469
                 'id_user' => $session->get('user-id'),
470 470
                 'action' => 'at_modification',
471
-                'raison' => 'at_add_file : ' . $fileName . ':' . $newID,
471
+                'raison' => 'at_add_file : '.$fileName.':'.$newID,
472 472
             )
473 473
         );
474 474
     }
475 475
 }
476 476
 
477 477
 // Return JSON-RPC response
478
-die('{"jsonrpc" : "2.0", "result" : null, "id" : "' . $newID . '"}');
478
+die('{"jsonrpc" : "2.0", "result" : null, "id" : "'.$newID.'"}');
479 479
 
480 480
 /**
481 481
  * Handle errors and kill script.
Please login to merge, or discard this patch.
sources/roles.queries.php 1 patch
Spacing   +5 added lines, -5 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
 
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
                         );
462 462
 
463 463
                         // add new role to user
464
-                        $tmp = $data_tmp['fonction_id'] . (substr($data_tmp['fonction_id'], -1) == ';' ? $role_id : ';' . $role_id);
464
+                        $tmp = $data_tmp['fonction_id'].(substr($data_tmp['fonction_id'], -1) == ';' ? $role_id : ';'.$role_id);
465 465
                         $session->set('user-roles', str_replace(';;', ';', $tmp));
466 466
 
467 467
                         // store in DB
@@ -649,7 +649,7 @@  discard block
 block discarded – undo
649 649
                         $groupsData = $openLdapExtra->getADGroups($ldapConnection, $SETTINGS);
650 650
                         break;
651 651
                     default:
652
-                        throw new Exception("Unsupported LDAP type: " . $SETTINGS['ldap_type']);
652
+                        throw new Exception("Unsupported LDAP type: ".$SETTINGS['ldap_type']);
653 653
                 }
654 654
             } catch (Exception $e) {
655 655
                 if (defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) {
@@ -669,7 +669,7 @@  discard block
 block discarded – undo
669 669
             } else {
670 670
                 // Handle successful retrieval of groups
671 671
                 // exists in Teampass
672
-                foreach($groupsData['userGroups'] as $key => $group) {
672
+                foreach ($groupsData['userGroups'] as $key => $group) {
673 673
                     $role_detail = DB::queryFirstRow(
674 674
                         'SELECT a.increment_id as increment_id, a.role_id as role_id, r.title as title
675 675
                         FROM '.prefixTable('ldap_groups_roles').' AS a
@@ -694,7 +694,7 @@  discard block
 block discarded – undo
694 694
             
695 695
             // Get all groups in Teampass
696 696
             $teampassRoles = array();
697
-            $rows = DB::query('SELECT id,title FROM ' . prefixTable('roles_title'));
697
+            $rows = DB::query('SELECT id,title FROM '.prefixTable('roles_title'));
698 698
             foreach ($rows as $record) {
699 699
                 array_push(
700 700
                     $teampassRoles,
Please login to merge, or discard this patch.
sources/tree.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 ) {
65 65
     // Not allowed page
66 66
     $session->set('system-error_code', ERR_NOT_ALLOWED);
67
-    include $SETTINGS['cpassman_dir'] . '/error.php';
67
+    include $SETTINGS['cpassman_dir'].'/error.php';
68 68
     exit;
69 69
 }
70 70
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 );
126 126
 
127 127
 $lastFolderChange = DB::queryFirstRow(
128
-    'SELECT valeur FROM ' . prefixTable('misc') . '
128
+    'SELECT valeur FROM '.prefixTable('misc').'
129 129
     WHERE type = %s AND intitule = %s',
130 130
     'timestamp',
131 131
     'last_folder_change'
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
         $nbItemsInSubfolders = (int) $node->nb_items_in_subfolders;
347 347
         $nbItemsInFolder = (int) $node->nb_items_in_folder;
348 348
         $nbSubfolders = (int) $node->nb_subfolders;
349
-        break;  // Get out as soon as we find a valid node.
349
+        break; // Get out as soon as we find a valid node.
350 350
     }
351 351
     
352 352
     if ($displayThisNode === true) {
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
         foreach ($currentNode->children as $child) {
459 459
             recursiveTree(
460 460
                 (int) $child,
461
-                $tree->getNode($child),// get node info for this child
461
+                $tree->getNode($child), // get node info for this child
462 462
                 /** @scrutinizer ignore-type */ $tree,
463 463
                 $listFoldersLimitedKeys,
464 464
                 $listRestrictedFoldersForItemsKeys,
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
     $lang = new Language($session->get('user-language') ?? 'english');
506 506
 
507 507
     // prepare json return for current node
508
-    $parent = $currentNode->parent_id === '0' ? '#' : 'li_' . $currentNode->parent_id;
508
+    $parent = $currentNode->parent_id === '0' ? '#' : 'li_'.$currentNode->parent_id;
509 509
 
510 510
     // handle displaying
511 511
     if (isKeyExistingAndEqual('show_only_accessible_folders', 1, $SETTINGS) === true) {
@@ -522,17 +522,17 @@  discard block
 block discarded – undo
522 522
         array_push(
523 523
             $ret_json,
524 524
             array(
525
-                'id' => 'li_' . $nodeId,
525
+                'id' => 'li_'.$nodeId,
526 526
                 'parent' => $last_visible_parent === -1 ? $parent : $last_visible_parent,
527 527
                 'text' => '<i class="'.$currentNode->fa_icon.' tree-folder mr-2" data-folder="'.$currentNode->fa_icon.'"  data-folder-selected="'.$currentNode->fa_icon_selected.'"></i>'.$text.htmlspecialchars($currentNode->title).$nodeData['html'],
528 528
                 'li_attr' => array(
529 529
                     'class' => 'jstreeopen',
530
-                    'title' => 'ID [' . $nodeId . '] ' . $nodeData['title'],
530
+                    'title' => 'ID ['.$nodeId.'] '.$nodeData['title'],
531 531
                 ),
532 532
                 'a_attr' => array(
533
-                    'id' => 'fld_' . $nodeId,
533
+                    'id' => 'fld_'.$nodeId,
534 534
                     'class' => $nodeData['folderClass'],
535
-                    'onclick' => 'ListerItems(' . $nodeId . ', ' . $nodeData['restricted'] . ', 0, 1)',
535
+                    'onclick' => 'ListerItems('.$nodeId.', '.$nodeData['restricted'].', 0, 1)',
536 536
                     'data-title' => htmlspecialchars($currentNode->title),
537 537
                 ),
538 538
                 'is_pf' => in_array($nodeId, $inputData['personalFolders']) === true ? 1 : 0,
@@ -548,12 +548,12 @@  discard block
 block discarded – undo
548 548
         array_push(
549 549
             $ret_json,
550 550
             array(
551
-                'id' => 'li_' . $nodeId,
551
+                'id' => 'li_'.$nodeId,
552 552
                 'parent' => $last_visible_parent === -1 ? $parent : $last_visible_parent,
553 553
                 'text' => '<i class="'.$currentNode->fa_icon.' tree-folder mr-2" data-folder="'.$currentNode->fa_icon.'"  data-folder-selected="'.$currentNode->fa_icon_selected.'"></i>'.'<i class="fas fa-times fa-xs text-danger mr-1 ml-1"></i>'.$text.htmlspecialchars($currentNode->title).$nodeData['html'],
554 554
                 'li_attr' => array(
555 555
                     'class' => '',
556
-                    'title' => 'ID [' . $nodeId . '] ' . $lang->get('no_access'),
556
+                    'title' => 'ID ['.$nodeId.'] '.$lang->get('no_access'),
557 557
                 ),
558 558
             )
559 559
         );
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
         if (in_array($nodeId, $session_read_only_folders) === true) {
614 614
             return [
615 615
                 'html' => '<i class="far fa-eye fa-xs mr-1 ml-1"></i>'.
616
-                    ($tree_counters === 1 ? '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . $nbItemsInFolder .'/'.$nbItemsInSubfolders .'/'.$nbSubfolders. '</span>'  : ''),
616
+                    ($tree_counters === 1 ? '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.$nbItemsInFolder.'/'.$nbItemsInSubfolders.'/'.$nbSubfolders.'</span>' : ''),
617 617
                 'title' => $lang->get('read_only_account'),
618 618
                 'restricted' => 1,
619 619
                 'folderClass' => 'folder_not_droppable',
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
         ) {
629 629
             return [
630 630
                 'html' => '<i class="far fa-eye fa-xs mr-1"></i>'.
631
-                    ($tree_counters === 1 ? '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . $nbItemsInFolder .'/'.$nbItemsInSubfolders .'/'.$nbSubfolders. '</span>'  : ''),
631
+                    ($tree_counters === 1 ? '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.$nbItemsInFolder.'/'.$nbItemsInSubfolders.'/'.$nbSubfolders.'</span>' : ''),
632 632
                 'title' => $lang->get('read_only_account'),
633 633
                 'restricted' => 0,
634 634
                 'folderClass' => 'folder',
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
         }
640 640
         
641 641
         return [
642
-            'html' => ($tree_counters === 1 ? '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . $nbItemsInFolder .'/'.$nbItemsInSubfolders .'/'.$nbSubfolders. '</span>'  : ''),
642
+            'html' => ($tree_counters === 1 ? '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.$nbItemsInFolder.'/'.$nbItemsInSubfolders.'/'.$nbSubfolders.'</span>' : ''),
643 643
             'title' => '',
644 644
             'restricted' => 0,
645 645
             'folderClass' => 'folder',
@@ -650,8 +650,8 @@  discard block
 block discarded – undo
650 650
 
651 651
     } elseif (in_array($nodeId, $listFoldersLimitedKeys) === true) {
652 652
         return [
653
-            'html' => ($session_user_read_only === true ? '<i class="far fa-eye fa-xs mr-1"></i>' : '') .
654
-                ($tree_counters === 1 ? '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . count($session_list_folders_limited[$nodeId]) . '</span>' : ''),
653
+            'html' => ($session_user_read_only === true ? '<i class="far fa-eye fa-xs mr-1"></i>' : '').
654
+                ($tree_counters === 1 ? '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.count($session_list_folders_limited[$nodeId]).'</span>' : ''),
655 655
             'title' => '',
656 656
             'restricted' => 1,
657 657
             'folderClass' => 'folder',
@@ -662,8 +662,8 @@  discard block
 block discarded – undo
662 662
 
663 663
     } elseif (in_array($nodeId, $listRestrictedFoldersForItemsKeys) === true) {
664 664
         return [
665
-            'html' => $session_user_read_only === true ? '<i class="far fa-eye fa-xs mr-1"></i>' : '' .
666
-                '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . count($session_list_restricted_folders_for_items[$nodeId]) . '</span>',
665
+            'html' => $session_user_read_only === true ? '<i class="far fa-eye fa-xs mr-1"></i>' : ''.
666
+                '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.count($session_list_restricted_folders_for_items[$nodeId]).'</span>',
667 667
             'title' => '',
668 668
             'restricted' => 1,
669 669
             'folderClass' => 'folder',
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
     // Does this user has a tree cache
774 774
     $userCacheTree = DB::queryFirstRow(
775 775
         'SELECT data
776
-        FROM ' . prefixTable('cache_tree') . '
776
+        FROM ' . prefixTable('cache_tree').'
777 777
         WHERE user_id = %i',
778 778
         $userId
779 779
     );
Please login to merge, or discard this patch.
sources/core.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -58,16 +58,16 @@  discard block
 block discarded – undo
58 58
 {
59 59
     // Load AntiXSS
60 60
     $antiXss = new AntiXSS();
61
-    if (! headers_sent()) {    //If headers not sent yet... then do php redirect
62
-        header('Location: ' . $antiXss->xss_clean($url));
61
+    if (!headers_sent()) {    //If headers not sent yet... then do php redirect
62
+        header('Location: '.$antiXss->xss_clean($url));
63 63
     }
64 64
 
65 65
     //If headers are sent... do java redirect... if java disabled, do html redirect.
66 66
     echo '<script type="text/javascript">';
67
-    echo 'window.location.href="' . $antiXss->xss_clean($url) . '";';
67
+    echo 'window.location.href="'.$antiXss->xss_clean($url).'";';
68 68
     echo '</script>';
69 69
     echo '<noscript>';
70
-    echo '<meta http-equiv="refresh" content="0;url=' . $antiXss->xss_clean($url) . '" />';
70
+    echo '<meta http-equiv="refresh" content="0;url='.$antiXss->xss_clean($url).'" />';
71 71
     echo '</noscript>';
72 72
 }
73 73
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
     && isset($SETTINGS['enable_sts']) === true
94 94
     && (int) $SETTINGS['enable_sts'] === 1
95 95
 ) {
96
-    teampassRedirect('https://' . $server['http_host'] . $server['request_uri']);
96
+    teampassRedirect('https://'.$server['http_host'].$server['request_uri']);
97 97
 }
98 98
 
99 99
 // Load pwComplexity
@@ -114,11 +114,11 @@  discard block
 block discarded – undo
114 114
 // LOAD CPASSMAN SETTINGS
115 115
 if (
116 116
     isset($SETTINGS['cpassman_dir']) === true
117
-    && is_dir($SETTINGS['cpassman_dir'] . '/install') === true
117
+    && is_dir($SETTINGS['cpassman_dir'].'/install') === true
118 118
 ) {
119 119
     // Should we delete folder INSTALL?
120 120
     $row = DB::queryFirstRow(
121
-        'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type=%s AND intitule=%s',
121
+        'SELECT valeur FROM '.prefixTable('misc').' WHERE type=%s AND intitule=%s',
122 122
         'install',
123 123
         'clear_install_folder'
124 124
     );
@@ -136,11 +136,11 @@  discard block
 block discarded – undo
136 136
             if ($directories !== false) {
137 137
                 $files = array_diff($directories, ['.', '..']);
138 138
                 foreach ($files as $file) {
139
-                    if (is_dir($dir . '/' . $file)) {
140
-                        delTree($dir . '/' . $file);
139
+                    if (is_dir($dir.'/'.$file)) {
140
+                        delTree($dir.'/'.$file);
141 141
                     } else {
142 142
                         try {
143
-                            unlink($dir . '/' . $file);
143
+                            unlink($dir.'/'.$file);
144 144
                         } catch (Exception $e) {
145 145
                             // do nothing... php will ignore and continue
146 146
                         }
@@ -154,13 +154,13 @@  discard block
 block discarded – undo
154 154
             return false;
155 155
         }
156 156
 
157
-        if (is_dir($SETTINGS['cpassman_dir'] . '/install')) {
157
+        if (is_dir($SETTINGS['cpassman_dir'].'/install')) {
158 158
             // Set the permissions on the install directory and delete
159 159
             // is server Windows or Linux?
160 160
             if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
161
-                recursiveChmod($SETTINGS['cpassman_dir'] . '/install', 0755, 0440);
161
+                recursiveChmod($SETTINGS['cpassman_dir'].'/install', 0755, 0440);
162 162
             }
163
-            delTree($SETTINGS['cpassman_dir'] . '/install');
163
+            delTree($SETTINGS['cpassman_dir'].'/install');
164 164
         }
165 165
 
166 166
         // Delete temporary install table
@@ -178,10 +178,10 @@  discard block
 block discarded – undo
178 178
 // Load Languages stuff
179 179
 if (isset($languagesList) === false) {
180 180
     $languagesList = [];
181
-    $rows = DB::query('SELECT * FROM ' . prefixTable('languages') . ' GROUP BY name, label, code, flag, id ORDER BY name ASC');
181
+    $rows = DB::query('SELECT * FROM '.prefixTable('languages').' GROUP BY name, label, code, flag, id ORDER BY name ASC');
182 182
     foreach ($rows as $record) {
183 183
         array_push($languagesList, $record['name']);
184
-        if ($session->get('user-language') === $record['name'] ) {
184
+        if ($session->get('user-language') === $record['name']) {
185 185
             $session->set('user-language_flag', $record['flag']);
186 186
             $session->set('user-language_code', $record['code']);
187 187
             //$session->set('user-language_label', $record['label']);
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 // CHECK IF SESSION EXISTS AND IF SESSION IS VALID
239 239
 if (empty($session->get('user-session_duration')) === false) {
240 240
     $dataSession = DB::queryFirstRow(
241
-        'SELECT key_tempo FROM ' . prefixTable('users') . ' WHERE id=%i',
241
+        'SELECT key_tempo FROM '.prefixTable('users').' WHERE id=%i',
242 242
         $session->get('user-id')
243 243
     );
244 244
 } else {
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
     && ($session->has('user-admin') && $session->get('user-admin') && null !== $session->get('user-admin') && $session->get('user-admin') === 1)
294 294
 ) {
295 295
     $row = DB::queryFirstRow(
296
-        'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type=%s_type AND intitule=%s_intitule',
296
+        'SELECT valeur FROM '.prefixTable('misc').' WHERE type=%s_type AND intitule=%s_intitule',
297 297
         [
298 298
             'type' => 'admin',
299 299
             'intitule' => 'teampass_version',
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 
335 335
         syslog(
336 336
             LOG_WARNING,
337
-            'Unlog user: ' . date('Y/m/d H:i:s') . " {$server['remote_addr']} ({$server['http_user_agent']})"
337
+            'Unlog user: '.date('Y/m/d H:i:s')." {$server['remote_addr']} ({$server['http_user_agent']})"
338 338
         );
339 339
         // erase session table
340 340
         $session->invalidate();
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 if ($session->has('user-timezone') && null !== $session->get('user-id') && empty($session->get('user-id')) === false) {
389 389
     // query on user
390 390
     $data = DB::queryFirstRow(
391
-        'SELECT login, admin, gestionnaire, can_manage_all_users, groupes_visibles, groupes_interdits, fonction_id, last_connexion, roles_from_ad_groups, auth_type, last_pw_change FROM ' . prefixTable('users') . ' WHERE id=%i',
391
+        'SELECT login, admin, gestionnaire, can_manage_all_users, groupes_visibles, groupes_interdits, fonction_id, last_connexion, roles_from_ad_groups, auth_type, last_pw_change FROM '.prefixTable('users').' WHERE id=%i',
392 392
         $session->get('user-id')
393 393
     );
394 394
     //Check if user has been deleted or unlogged
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
             $data['groupes_visibles'],
436 436
             $data['groupes_interdits'],
437 437
             $data['admin'],
438
-            is_null($data['roles_from_ad_groups']) === true ? $data['fonction_id'] : (empty($data['roles_from_ad_groups']) === true ? $data['fonction_id'] : $data['fonction_id'] . ';' . $data['roles_from_ad_groups']),
438
+            is_null($data['roles_from_ad_groups']) === true ? $data['fonction_id'] : (empty($data['roles_from_ad_groups']) === true ? $data['fonction_id'] : $data['fonction_id'].';'.$data['roles_from_ad_groups']),
439 439
             $SETTINGS
440 440
         );
441 441
         if ($session->has('user-can_create_root_folder') && (int) $session->get('user-can_create_root_folder') && null !== $session->get('user-can_create_root_folder') && (int) $session->get('user-can_create_root_folder') === 1) {
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
     $session->set('system-item_fields', []);
471 471
     $rows = DB::query(
472 472
         'SELECT *
473
-            FROM ' . prefixTable('categories') . '
473
+            FROM ' . prefixTable('categories').'
474 474
             WHERE level=%i',
475 475
         '0'
476 476
     );
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
         // get each field
480 480
         $rows2 = DB::query(
481 481
             'SELECT *
482
-            FROM ' . prefixTable('categories') . '
482
+            FROM ' . prefixTable('categories').'
483 483
             WHERE parent_id=%i
484 484
             ORDER BY `order` ASC',
485 485
             $record['id']
@@ -566,5 +566,5 @@  discard block
 block discarded – undo
566 566
 }
567 567
 
568 568
 /* CHECK NUMBER OF USER ONLINE */
569
-DB::query('SELECT * FROM ' . prefixTable('users') . ' WHERE timestamp>=%i', time() - 600);
569
+DB::query('SELECT * FROM '.prefixTable('users').' WHERE timestamp>=%i', time() - 600);
570 570
 $session->set('system-nb_users_online', DB::count());
Please login to merge, or discard this patch.
scripts/task_maintenance_clean_orphan_objects.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -72,37 +72,37 @@
 block discarded – undo
72 72
 {
73 73
     // Delete all item keys for which no user exist
74 74
     DB::query(
75
-        'DELETE k.* FROM ' . prefixTable('sharekeys_items') . ' k
76
-        LEFT JOIN ' . prefixTable('users') . ' u ON k.user_id = u.id
75
+        'DELETE k.* FROM '.prefixTable('sharekeys_items').' k
76
+        LEFT JOIN ' . prefixTable('users').' u ON k.user_id = u.id
77 77
         WHERE u.id IS NULL OR u.deleted_at IS NOT NULL'
78 78
     );
79 79
 
80 80
     // Delete all files keys for which no item exist
81 81
     DB::query(
82
-        'DELETE k.* FROM ' . prefixTable('sharekeys_files') . ' k
83
-        LEFT JOIN ' . prefixTable('items') . ' i ON k.object_id = i.id
82
+        'DELETE k.* FROM '.prefixTable('sharekeys_files').' k
83
+        LEFT JOIN ' . prefixTable('items').' i ON k.object_id = i.id
84 84
         WHERE i.id IS NULL'
85 85
     );
86 86
 
87 87
     // Delete all fields keys for which no item exist
88 88
     DB::query(
89
-        'DELETE k.* FROM ' . prefixTable('sharekeys_fields') . ' k
90
-        LEFT JOIN ' . prefixTable('categories_items') . ' c ON k.object_id = c.id
91
-        LEFT JOIN ' . prefixTable('items') . ' i ON c.item_id = i.id
89
+        'DELETE k.* FROM '.prefixTable('sharekeys_fields').' k
90
+        LEFT JOIN ' . prefixTable('categories_items').' c ON k.object_id = c.id
91
+        LEFT JOIN ' . prefixTable('items').' i ON c.item_id = i.id
92 92
         WHERE c.id IS NULL OR i.id IS NULL'
93 93
     );
94 94
 
95 95
     // Delete all item logs for which no user exist
96 96
     DB::query(
97
-        'DELETE l.* FROM ' . prefixTable('log_items') . ' l
98
-        LEFT JOIN ' . prefixTable('items') . ' i ON l.id_item = i.id
97
+        'DELETE l.* FROM '.prefixTable('log_items').' l
98
+        LEFT JOIN ' . prefixTable('items').' i ON l.id_item = i.id
99 99
         WHERE i.id IS NULL'
100 100
     );
101 101
 
102 102
     // Delete all system logs for which no user exist
103 103
     DB::query(
104
-        'DELETE l.* FROM ' . prefixTable('log_system') . ' l
105
-        LEFT JOIN ' . prefixTable('users') . ' u ON l.qui = u.id
104
+        'DELETE l.* FROM '.prefixTable('log_system').' l
105
+        LEFT JOIN ' . prefixTable('users').' u ON l.qui = u.id
106 106
         WHERE u.id IS NULL OR u.deleted_at IS NOT NULL'
107 107
     );
108 108
 
Please login to merge, or discard this patch.