Passed
Push — master ( 6c6a64...e7ed79 )
by Nils
04:33
created
pages/tasks.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -45,15 +45,15 @@  discard block
 block discarded – undo
45 45
 }
46 46
 
47 47
 /* do checks */
48
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
48
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
49 49
 if (checkUser($_SESSION['user_id'], $_SESSION['key'], 'tasks', $SETTINGS) === false) {
50 50
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
51
-    include $SETTINGS['cpassman_dir'] . '/error.php';
51
+    include $SETTINGS['cpassman_dir'].'/error.php';
52 52
     exit;
53 53
 }
54 54
 
55 55
 // Load template
56
-require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
56
+require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
57 57
 
58 58
 ?>
59 59
 
@@ -182,9 +182,9 @@  discard block
 block discarded – undo
182 182
                                                 <?php
183 183
                                                 $tasks = isset($SETTINGS['maintenance_job_tasks']) === true ? json_decode($SETTINGS['maintenance_job_tasks']) : [];
184 184
                                                 
185
-                                                echo '<option value="users-personal-folder"',in_array('users-personal-folder', $tasks) === true ? ' selected' : '','>'.langHdl('users_personal_folder').'</option>';
186
-                                                echo '<option value="clean-orphan-objects"',in_array('clean-orphan-objects', $tasks) === true ? ' selected' : '','>'.langHdl('clean_orphan_objects').'</option>';
187
-                                                echo '<option value="purge-old-files"',in_array('purge-old-files', $tasks) === true ? ' selected' : '','>'.langHdl('purge_old_files').'</option>';
185
+                                                echo '<option value="users-personal-folder"', in_array('users-personal-folder', $tasks) === true ? ' selected' : '', '>'.langHdl('users_personal_folder').'</option>';
186
+                                                echo '<option value="clean-orphan-objects"', in_array('clean-orphan-objects', $tasks) === true ? ' selected' : '', '>'.langHdl('clean_orphan_objects').'</option>';
187
+                                                echo '<option value="purge-old-files"', in_array('purge-old-files', $tasks) === true ? ' selected' : '', '>'.langHdl('purge_old_files').'</option>';
188 188
                                                 ?>
189 189
                                             </select>
190 190
                                         </div>
Please login to merge, or discard this patch.
pages/actions.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -42,15 +42,15 @@  discard block
 block discarded – undo
42 42
 }
43 43
 
44 44
 /* do checks */
45
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
45
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
46 46
 if (checkUser($_SESSION['user_id'], $_SESSION['key'], 'ldap', $SETTINGS) === false) {
47 47
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
48
-    include $SETTINGS['cpassman_dir'] . '/error.php';
48
+    include $SETTINGS['cpassman_dir'].'/error.php';
49 49
     exit;
50 50
 }
51 51
 
52 52
 // Load template
53
-require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
53
+require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
54 54
 
55 55
 ?>
56 56
 
@@ -89,14 +89,14 @@  discard block
 block discarded – undo
89 89
                                 <?php
90 90
                                 echo langHdl('rebuild_config_file');
91 91
 $data = DB::queryfirstrow(
92
-    'SELECT field_1, date FROM ' . prefixTable('log_system') . '
92
+    'SELECT field_1, date FROM '.prefixTable('log_system').'
93 93
                                     WHERE label = %s
94 94
                                     ORDER BY id DESC',
95 95
     'admin_action_rebuild_config_file'
96 96
 );
97 97
 if (DB::count() > 0) {
98
-    $tmp = langHdl('last_execution') . ' ' .
99
-                                        date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $data['date']);
98
+    $tmp = langHdl('last_execution').' '.
99
+                                        date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $data['date']);
100 100
     $tmp .= $data['field_1'] === 'success' ?
101 101
                                         '<i class="fas fa-check ml-2 text-success"></i>' : '<i class="fas fa-times ml-2 text-danger"></i>';
102 102
 } else {
@@ -118,14 +118,14 @@  discard block
 block discarded – undo
118 118
                                 </span>
119 119
                                 <?php echo langHdl('admin_action_db_optimize');
120 120
 $data = DB::queryfirstrow(
121
-    'SELECT field_1, date FROM ' . prefixTable('log_system') . '
121
+    'SELECT field_1, date FROM '.prefixTable('log_system').'
122 122
                                     WHERE label = %s
123 123
                                     ORDER BY id DESC',
124 124
     'admin_action_db_optimize'
125 125
 );
126 126
 if (DB::count() > 0) {
127
-    $tmp = langHdl('last_execution') . ' ' .
128
-                                        date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $data['date']);
127
+    $tmp = langHdl('last_execution').' '.
128
+                                        date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $data['date']);
129 129
     $tmp .= $data['field_1'] === 'success' ?
130 130
                                         '<i class="fas fa-check ml-2 text-success"></i>' : '<i class="fas fa-times ml-2 text-danger"></i>';
131 131
 } else {
@@ -144,14 +144,14 @@  discard block
 block discarded – undo
144 144
                                 </span>
145 145
                                 <?php echo langHdl('admin_action_reload_cache_table');
146 146
 $data = DB::queryfirstrow(
147
-    'SELECT field_1, date FROM ' . prefixTable('log_system') . '
147
+    'SELECT field_1, date FROM '.prefixTable('log_system').'
148 148
                                     WHERE label = %s
149 149
                                     ORDER BY id DESC',
150 150
     'admin_action_reload_cache_table'
151 151
 );
152 152
 if (DB::count() > 0) {
153
-    $tmp = langHdl('last_execution') . ' ' .
154
-                                        date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $data['date']);
153
+    $tmp = langHdl('last_execution').' '.
154
+                                        date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $data['date']);
155 155
     $tmp .= $data['field_1'] === 'success' ?
156 156
                                         '<i class="fas fa-check ml-2 text-success"></i>' : '<i class="fas fa-times ml-2 text-danger"></i>';
157 157
 } else {
@@ -174,14 +174,14 @@  discard block
 block discarded – undo
174 174
                                 </span>
175 175
                                 <?php echo langHdl('admin_action_change_salt_key');
176 176
 $data = DB::queryfirstrow(
177
-    'SELECT field_1, date FROM ' . prefixTable('log_system') . '
177
+    'SELECT field_1, date FROM '.prefixTable('log_system').'
178 178
                                     WHERE label = %s
179 179
                                     ORDER BY id DESC',
180 180
     'admin_action_change_sk'
181 181
 );
182 182
 if (DB::count() > 0) {
183
-    $tmp = langHdl('last_execution') . ' ' .
184
-                                        date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $data['date']);
183
+    $tmp = langHdl('last_execution').' '.
184
+                                        date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $data['date']);
185 185
     $tmp .= $data['field_1'] === 'success' ?
186 186
                                         '<i class="fas fa-check ml-2 text-success"></i>' : '<i class="fas fa-times ml-2 text-danger"></i>';
187 187
 } else {
@@ -204,14 +204,14 @@  discard block
 block discarded – undo
204 204
                                 </span>
205 205
                                 <?php echo langHdl('admin_action_attachments_cryption');
206 206
 $data = DB::queryfirstrow(
207
-    'SELECT field_1, date FROM ' . prefixTable('log_system') . '
207
+    'SELECT field_1, date FROM '.prefixTable('log_system').'
208 208
                                     WHERE label = %s
209 209
                                     ORDER BY id DESC',
210 210
     'admin_action_change_file_encryption'
211 211
 );
212 212
 if (DB::count() > 0) {
213
-    $tmp = langHdl('last_execution') . ' ' .
214
-                                        date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $data['date']);
213
+    $tmp = langHdl('last_execution').' '.
214
+                                        date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $data['date']);
215 215
     $tmp .= $data['field_1'] === 'success' ?
216 216
                                         '<i class="fas fa-check ml-2 text-success"></i>' : '<i class="fas fa-times ml-2 text-danger"></i>';
217 217
 } else {
Please login to merge, or discard this patch.
sources/admin.queries.php 1 patch
Spacing   +164 added lines, -164 removed lines patch added patch discarded remove patch
@@ -46,25 +46,25 @@  discard block
 block discarded – undo
46 46
 }
47 47
 
48 48
 /* do checks */
49
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
50
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
49
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
50
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
51 51
 if (!checkUser($_SESSION['user_id'], $_SESSION['key'], 'options', $SETTINGS)) {
52 52
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
53
-    include $SETTINGS['cpassman_dir'] . '/error.php';
53
+    include $SETTINGS['cpassman_dir'].'/error.php';
54 54
     exit;
55 55
 }
56 56
 
57
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user']['user_language'] . '.php';
58
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
59
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php';
57
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user']['user_language'].'.php';
58
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
59
+require_once $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php';
60 60
 
61 61
 header('Content-type: text/html; charset=utf-8');
62 62
 header('Cache-Control: no-cache, no-store, must-revalidate');
63 63
 
64
-require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
64
+require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
65 65
 
66 66
 // connect to the server
67
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
67
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
68 68
 if (defined('DB_PASSWD_CLEAR') === false) {
69 69
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
70 70
 }
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
                         array(
120 120
                             'http' => array(
121 121
                                 'ignore_errors' => true,
122
-                                'proxy' => $SETTINGS['proxy_ip'] . ':' . $SETTINGS['proxy_port'],
122
+                                'proxy' => $SETTINGS['proxy_ip'].':'.$SETTINGS['proxy_port'],
123 123
                             ),
124 124
                         )
125 125
                     );
@@ -138,16 +138,16 @@  discard block
 block discarded – undo
138 138
                     $json_array = json_decode($json, true);
139 139
 
140 140
                     // About version
141
-                    $text .= '<li><u>' . $LANG['your_version'] . '</u> : ' . TP_VERSION;
141
+                    $text .= '<li><u>'.$LANG['your_version'].'</u> : '.TP_VERSION;
142 142
                     if (floatval(TP_VERSION) < floatval($json_array['info']['version'])) {
143
-                        $text .= '&nbsp;&nbsp;<b>' . $LANG['please_update'] . '</b>';
143
+                        $text .= '&nbsp;&nbsp;<b>'.$LANG['please_update'].'</b>';
144 144
                     }
145 145
                     $text .= '</li>';
146 146
 
147 147
                     // Libraries
148 148
                     $text .= '<li><u>Libraries</u> :</li>';
149 149
                     foreach ($json_array['libraries'] as $key => $val) {
150
-                        $text .= "<li>&nbsp;<span class='fa fa-caret-right'></span>&nbsp;" . $key . " (<a href='" . $val . "' target='_blank'>" . $val . '</a>)</li>';
150
+                        $text .= "<li>&nbsp;<span class='fa fa-caret-right'></span>&nbsp;".$key." (<a href='".$val."' target='_blank'>".$val.'</a>)</li>';
151 151
                     }
152 152
                 }
153 153
             } else {
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
         }
159 159
         $text .= '</ul>';
160 160
 
161
-        echo '[{"error":"' . $error . '" , "output":"' . str_replace(array("\n", "\t", "\r"), '', $text) . '"}]';
161
+        echo '[{"error":"'.$error.'" , "output":"'.str_replace(array("\n", "\t", "\r"), '', $text).'"}]';
162 162
         break;
163 163
         
164 164
 
@@ -190,21 +190,21 @@  discard block
 block discarded – undo
190 190
             break;
191 191
         }
192 192
 
193
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
193
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
194 194
         $return = '';
195 195
 
196 196
         //Get all tables
197 197
         $tables = array();
198 198
         $result = DB::query('SHOW TABLES');
199 199
         foreach ($result as $row) {
200
-            $tables[] = $row['Tables_in_' . $database];
200
+            $tables[] = $row['Tables_in_'.$database];
201 201
         }
202 202
 
203 203
         //cycle through
204 204
         foreach ($tables as $table) {
205 205
             if (defined('DB_PREFIX') || substr_count($table, DB_PREFIX) > 0) {
206 206
                 // Do query
207
-                $result = DB::queryRaw('SELECT * FROM ' . $table);
207
+                $result = DB::queryRaw('SELECT * FROM '.$table);
208 208
                 DB::queryRaw(
209 209
                     'SELECT *
210 210
                     FROM INFORMATION_SCHEMA.COLUMNS
@@ -216,19 +216,19 @@  discard block
 block discarded – undo
216 216
                 $numFields = DB::count();
217 217
 
218 218
                 // prepare a drop table
219
-                $return .= 'DROP TABLE ' . $table . ';';
220
-                $row2 = DB::queryfirstrow('SHOW CREATE TABLE ' . $table);
221
-                $return .= "\n\n" . $row2['Create Table'] . ";\n\n";
219
+                $return .= 'DROP TABLE '.$table.';';
220
+                $row2 = DB::queryfirstrow('SHOW CREATE TABLE '.$table);
221
+                $return .= "\n\n".$row2['Create Table'].";\n\n";
222 222
 
223 223
                 //prepare all fields and datas
224 224
                 for ($i = 0; $i < $numFields; ++$i) {
225 225
                     while ($row = $result->fetch_row()) {
226
-                        $return .= 'INSERT INTO ' . $table . ' VALUES(';
226
+                        $return .= 'INSERT INTO '.$table.' VALUES(';
227 227
                         for ($j = 0; $j < $numFields; ++$j) {
228 228
                             $row[$j] = addslashes($row[$j]);
229 229
                             $row[$j] = preg_replace("/\n/", '\\n', $row[$j]);
230 230
                             if (isset($row[$j])) {
231
-                                $return .= '"' . $row[$j] . '"';
231
+                                $return .= '"'.$row[$j].'"';
232 232
                             } else {
233 233
                                 $return .= 'NULL';
234 234
                             }
@@ -248,8 +248,8 @@  discard block
 block discarded – undo
248 248
             $token = GenerateCryptKey(20, false, true, true, false, true, $SETTINGS);
249 249
 
250 250
             //save file
251
-            $filename = time() . '-' . $token . '.sql';
252
-            $handle = fopen($SETTINGS['path_to_files_folder'] . '/' . $filename, 'w+');
251
+            $filename = time().'-'.$token.'.sql';
252
+            $handle = fopen($SETTINGS['path_to_files_folder'].'/'.$filename, 'w+');
253 253
             if ($handle !== false) {
254 254
                 //write file
255 255
                 fwrite($handle, $return);
@@ -261,17 +261,17 @@  discard block
 block discarded – undo
261 261
                 // Encrypt the file
262 262
                 prepareFileWithDefuse(
263 263
                     'encrypt',
264
-                    $SETTINGS['path_to_files_folder'] . '/' . $filename,
265
-                    $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
264
+                    $SETTINGS['path_to_files_folder'].'/'.$filename,
265
+                    $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
266 266
                     $SETTINGS,
267 267
                     $post_option
268 268
                 );
269 269
 
270 270
                 // Do clean
271
-                unlink($SETTINGS['path_to_files_folder'] . '/' . $filename);
271
+                unlink($SETTINGS['path_to_files_folder'].'/'.$filename);
272 272
                 rename(
273
-                    $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
274
-                    $SETTINGS['path_to_files_folder'] . '/' . $filename
273
+                    $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
274
+                    $SETTINGS['path_to_files_folder'].'/'.$filename
275 275
                 );
276 276
             }
277 277
 
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
             //update LOG
282 282
             logEvents($SETTINGS, 'admin_action', 'dataBase backup', (string) $_SESSION['user_id'], $_SESSION['login']);
283 283
 
284
-            echo '[{"result":"db_backup" , "href":"sources/downloadFile.php?name=' . urlencode($filename) . '&sub=files&file=' . $filename . '&type=sql&key=' . $_SESSION['key'] . '&key_tmp=' . $_SESSION['key_tmp'] . '&pathIsFiles=1"}]';
284
+            echo '[{"result":"db_backup" , "href":"sources/downloadFile.php?name='.urlencode($filename).'&sub=files&file='.$filename.'&type=sql&key='.$_SESSION['key'].'&key_tmp='.$_SESSION['key_tmp'].'&pathIsFiles=1"}]';
285 285
         }
286 286
         break;
287 287
 
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
             );
313 313
             break;
314 314
         }
315
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
315
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
316 316
 
317 317
         $dataPost = explode('&', $post_option);
318 318
         $file = htmlspecialchars($dataPost[0]);
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
         // Get filename from database
322 322
         $data = DB::queryFirstRow(
323 323
             'SELECT valeur
324
-            FROM ' . prefixTable('misc') . '
324
+            FROM ' . prefixTable('misc').'
325 325
             WHERE increment_id = %i',
326 326
             $file
327 327
         );
@@ -340,22 +340,22 @@  discard block
 block discarded – undo
340 340
             // Decrypt the file
341 341
             $ret = prepareFileWithDefuse(
342 342
                 'decrypt',
343
-                $SETTINGS['path_to_files_folder'] . '/' . $file,
344
-                $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $file,
343
+                $SETTINGS['path_to_files_folder'].'/'.$file,
344
+                $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$file,
345 345
                 $SETTINGS,
346 346
                 $key
347 347
             );
348 348
 
349 349
             if (empty($ret) === false) {
350
-                echo '[{"result":"db_restore" , "message":"' . $ret . '"}]';
350
+                echo '[{"result":"db_restore" , "message":"'.$ret.'"}]';
351 351
                 break;
352 352
             }
353 353
 
354 354
             // Do clean
355
-            fileDelete($SETTINGS['path_to_files_folder'] . '/' . $file, $SETTINGS);
356
-            $file = $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $file;
355
+            fileDelete($SETTINGS['path_to_files_folder'].'/'.$file, $SETTINGS);
356
+            $file = $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$file;
357 357
         } else {
358
-            $file = $SETTINGS['path_to_files_folder'] . '/' . $file;
358
+            $file = $SETTINGS['path_to_files_folder'].'/'.$file;
359 359
         }
360 360
 
361 361
         //read sql file
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
         fclose($handle);
373 373
 
374 374
         //delete file
375
-        unlink($SETTINGS['path_to_files_folder'] . '/' . $file);
375
+        unlink($SETTINGS['path_to_files_folder'].'/'.$file);
376 376
 
377 377
         //Show done
378 378
         echo '[{"result":"db_restore" , "message":""}]';
@@ -412,8 +412,8 @@  discard block
 block discarded – undo
412 412
             foreach ($table as $i => $tablename) {
413 413
                 if (substr_count($tablename, DB_PREFIX) > 0) {
414 414
                     // launch optimization quieries
415
-                    DB::query('ANALYZE TABLE `' . $tablename . '`');
416
-                    DB::query('OPTIMIZE TABLE `' . $tablename . '`');
415
+                    DB::query('ANALYZE TABLE `'.$tablename.'`');
416
+                    DB::query('OPTIMIZE TABLE `'.$tablename.'`');
417 417
                 }
418 418
             }
419 419
         }
@@ -421,12 +421,12 @@  discard block
 block discarded – undo
421 421
         //Clean up LOG_ITEMS table
422 422
         $rows = DB::query(
423 423
             'SELECT id
424
-            FROM ' . prefixTable('items') . '
424
+            FROM ' . prefixTable('items').'
425 425
             ORDER BY id ASC'
426 426
         );
427 427
         foreach ($rows as $item) {
428 428
             DB::query(
429
-                'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i AND action = %s',
429
+                'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i AND action = %s',
430 430
                 $item['id'],
431 431
                 'at_creation'
432 432
             );
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
             if ($counter === 0) {
435 435
                 //Create new at_creation entry
436 436
                 $rowTmp = DB::queryFirstRow(
437
-                    'SELECT date, id_user FROM ' . prefixTable('log_items') . ' WHERE id_item=%i ORDER BY date ASC',
437
+                    'SELECT date, id_user FROM '.prefixTable('log_items').' WHERE id_item=%i ORDER BY date ASC',
438 438
                     $item['id']
439 439
                 );
440 440
                 DB::insert(
@@ -465,8 +465,8 @@  discard block
 block discarded – undo
465 465
     $SETTINGS['cpassman_dir'],
466 466
             array(
467 467
                 'error' => false,
468
-                'message' => langHdl('last_execution') . ' ' .
469
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
468
+                'message' => langHdl('last_execution').' '.
469
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
470 470
                     '<i class="fas fa-check text-success ml-2"></i>',
471 471
             ),
472 472
             'encode'
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
             break;
505 505
         }
506 506
 
507
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
507
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
508 508
         updateCacheTable('reload', $SETTINGS, NULL);
509 509
 
510 510
         // Log
@@ -521,8 +521,8 @@  discard block
 block discarded – undo
521 521
     $SETTINGS['cpassman_dir'],
522 522
             [
523 523
                 'error' => false,
524
-                'message' => langHdl('last_execution') . ' ' .
525
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
524
+                'message' => langHdl('last_execution').' '.
525
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
526 526
                     '<i class="fas fa-check text-success mr-2"></i>',
527 527
             ],
528 528
             'encode'
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
         }
560 560
 
561 561
         // Perform
562
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
562
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
563 563
         $ret = handleConfigFile('rebuild', $SETTINGS);
564 564
 
565 565
         // Log
@@ -588,8 +588,8 @@  discard block
 block discarded – undo
588 588
     $SETTINGS['cpassman_dir'],
589 589
             array(
590 590
                 'error' => false,
591
-                'message' => langHdl('last_execution') . ' ' .
592
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
591
+                'message' => langHdl('last_execution').' '.
592
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
593 593
                     '<i class="fas fa-check text-success ml-2"></i>',
594 594
             ),
595 595
             'encode'
@@ -631,33 +631,33 @@  discard block
 block discarded – undo
631 631
         $filename = $post_option;
632 632
         $tp_settings = [];
633 633
         //get backups infos
634
-        $rows = DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s', 'admin');
634
+        $rows = DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s', 'admin');
635 635
         foreach ($rows as $record) {
636 636
             $tp_settings[$record['intitule']] = $record['valeur'];
637 637
         }
638 638
 
639 639
         // check if backup file is in DB.
640 640
         // If YES then it is encrypted with DEFUSE
641
-        $bck = DB::queryFirstRow('SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'backup', 'filename');
641
+        $bck = DB::queryFirstRow('SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'backup', 'filename');
642 642
 
643 643
         //read file
644 644
         $return = '';
645
-        $Fnm = $tp_settings['bck_script_path'] . '/' . $filename . '.sql';
645
+        $Fnm = $tp_settings['bck_script_path'].'/'.$filename.'.sql';
646 646
         if (file_exists($Fnm)) {
647 647
             if (!empty($bck) && $bck['valeur'] === $filename) {
648 648
                 $err = '';
649 649
 
650 650
                 // it means that file is DEFUSE encrypted
651
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Crypto.php';
652
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/DerivedKeys.php';
653
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/KeyOrPassword.php';
654
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/File.php';
655
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Core.php';
651
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Crypto.php';
652
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/DerivedKeys.php';
653
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/KeyOrPassword.php';
654
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/File.php';
655
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Core.php';
656 656
 
657 657
                 try {
658 658
                     \Defuse\Crypto\File::decryptFileWithPassword(
659
-                        $SETTINGS['bck_script_path'] . '/' . $post_option . '.sql',
660
-                        $SETTINGS['bck_script_path'] . '/' . str_replace('encrypted', 'clear', $filename) . '.sql',
659
+                        $SETTINGS['bck_script_path'].'/'.$post_option.'.sql',
660
+                        $SETTINGS['bck_script_path'].'/'.str_replace('encrypted', 'clear', $filename).'.sql',
661 661
                         base64_decode($SETTINGS['bck_script_key'])
662 662
                     );
663 663
                 } catch (Defuse\Crypto\Exception\WrongKeyOrModifiedCiphertextException $ex) {
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
                 }
666 666
 
667 667
                 if (!empty($err)) {
668
-                    echo '[{ "result":"backup_decrypt_fails" , "msg":"' . $err . '"}]';
668
+                    echo '[{ "result":"backup_decrypt_fails" , "msg":"'.$err.'"}]';
669 669
                     break;
670 670
                 }
671 671
             } else {
@@ -687,19 +687,19 @@  discard block
 block discarded – undo
687 687
                 );
688 688
 
689 689
                 //save the file
690
-                $handle = fopen($tp_settings['bck_script_path'] . '/' . $filename . '.clear.sql', 'w+');
690
+                $handle = fopen($tp_settings['bck_script_path'].'/'.$filename.'.clear.sql', 'w+');
691 691
                 if ($handle !== false) {
692 692
                     fwrite($handle, $return);
693 693
                     fclose($handle);
694 694
                 }
695 695
             }
696 696
             $result = 'backup_decrypt_success';
697
-            $msg = $tp_settings['bck_script_path'] . '/' . $filename . '.clear.sql';
697
+            $msg = $tp_settings['bck_script_path'].'/'.$filename.'.clear.sql';
698 698
         } else {
699 699
             $result = 'backup_decrypt_fails';
700
-            $msg = 'File not found: ' . $Fnm;
700
+            $msg = 'File not found: '.$Fnm;
701 701
         }
702
-        echo '[{ "result":"' . $result . '" , "msg":"' . $msg . '"}]';
702
+        echo '[{ "result":"'.$result.'" , "msg":"'.$msg.'"}]';
703 703
         break;
704 704
 
705 705
         /*
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
         $_SESSION['reencrypt_old_salt'] = file_get_contents(SECUREPATH.'/'.SECUREFILE);
739 739
 
740 740
         // generate new saltkey
741
-        $old_sk_filename = SECUREPATH.'/'.SECUREFILE . date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))) . '.' . time();
741
+        $old_sk_filename = SECUREPATH.'/'.SECUREFILE.date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))).'.'.time();
742 742
         copy(
743 743
             SECUREPATH.'/'.SECUREFILE,
744 744
             $old_sk_filename
@@ -766,13 +766,13 @@  discard block
 block discarded – undo
766 766
         logEvents($SETTINGS, 'system', 'change_salt_key', (string) $_SESSION['user_id'], $_SESSION['login']);
767 767
 
768 768
         // get number of items to change
769
-        DB::query('SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i', 0);
769
+        DB::query('SELECT id FROM '.prefixTable('items').' WHERE perso = %i', 0);
770 770
         $nb_of_items = DB::count();
771 771
 
772 772
         // create backup table
773
-        DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
773
+        DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup'));
774 774
         DB::query(
775
-            'CREATE TABLE `' . prefixTable('sk_reencrypt_backup') . '` (
775
+            'CREATE TABLE `'.prefixTable('sk_reencrypt_backup').'` (
776 776
             `id` int(12) NOT null AUTO_INCREMENT,
777 777
             `current_table` varchar(100) NOT NULL,
778 778
             `current_field` varchar(500) NOT NULL,
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
         );
801 801
 
802 802
         // delete previous backup files
803
-        $files = glob($SETTINGS['path_to_upload_folder'] . '/*'); // get all file names
803
+        $files = glob($SETTINGS['path_to_upload_folder'].'/*'); // get all file names
804 804
         foreach ($files as $file) { // iterate files
805 805
             if (is_file($file)) {
806 806
                 $file_parts = pathinfo($file);
@@ -887,7 +887,7 @@  discard block
 block discarded – undo
887 887
     $SETTINGS['cpassman_dir'],
888 888
                     array(
889 889
                         'error' => true,
890
-                        'message' => 'Input `' . $objects[0] . '` is not allowed',
890
+                        'message' => 'Input `'.$objects[0].'` is not allowed',
891 891
                         'nbOfItems' => '',
892 892
                         'nextAction' => '',
893 893
                     ),
@@ -900,9 +900,9 @@  discard block
 block discarded – undo
900 900
                 //change all encrypted data in Items (passwords)
901 901
                 $rows = DB::query(
902 902
                     'SELECT id, pw, pw_iv
903
-                    FROM ' . prefixTable('items') . '
903
+                    FROM ' . prefixTable('items').'
904 904
                     WHERE perso = %s
905
-                    LIMIT ' . $post_start . ', ' . $post_length,
905
+                    LIMIT ' . $post_start.', '.$post_length,
906 906
                     '0'
907 907
                 );
908 908
                 foreach ($rows as $record) {
@@ -914,7 +914,7 @@  discard block
 block discarded – undo
914 914
                             'current_field' => 'pw',
915 915
                             'value_id' => $record['id'],
916 916
                             'value' => $record['pw'],
917
-                            'current_sql' => 'UPDATE ' . prefixTable('items') . " SET pw = '" . $record['pw'] . "' WHERE id = '" . $record['id'] . "';",
917
+                            'current_sql' => 'UPDATE '.prefixTable('items')." SET pw = '".$record['pw']."' WHERE id = '".$record['id']."';",
918 918
                             'value2' => 'none',
919 919
                             'result' => 'none',
920 920
                         )
@@ -963,9 +963,9 @@  discard block
 block discarded – undo
963 963
                 //change all encrypted data in Logs (passwords)
964 964
                 $rows = DB::query(
965 965
                     'SELECT raison, increment_id
966
-                    FROM ' . prefixTable('log_items') . "
966
+                    FROM ' . prefixTable('log_items')."
967 967
                     WHERE action = %s AND raison LIKE 'at_pw :%'
968
-                    LIMIT " . $post_start . ', ' . $post_length,
968
+                    LIMIT " . $post_start.', '.$post_length,
969 969
                     'at_modification'
970 970
                 );
971 971
                 foreach ($rows as $record) {
@@ -977,7 +977,7 @@  discard block
 block discarded – undo
977 977
                             'current_field' => 'raison',
978 978
                             'value_id' => $record['increment_id'],
979 979
                             'value' => $record['raison'],
980
-                            'current_sql' => 'UPDATE ' . prefixTable('log_items') . " SET raison = '" . $record['raison'] . "' WHERE increment_id = '" . $record['increment_id'] . "';",
980
+                            'current_sql' => 'UPDATE '.prefixTable('log_items')." SET raison = '".$record['raison']."' WHERE increment_id = '".$record['increment_id']."';",
981 981
                             'value2' => 'none',
982 982
                             'result' => 'none',
983 983
                         )
@@ -1005,7 +1005,7 @@  discard block
 block discarded – undo
1005 1005
                         DB::update(
1006 1006
                             prefixTable('log_items'),
1007 1007
                             array(
1008
-                                'raison' => 'at_pw :' . $encrypt['string'],
1008
+                                'raison' => 'at_pw :'.$encrypt['string'],
1009 1009
                                 'encryption_type' => 'defuse',
1010 1010
                             ),
1011 1011
                             'increment_id = %i',
@@ -1030,8 +1030,8 @@  discard block
 block discarded – undo
1030 1030
                 //change all encrypted data in CATEGORIES (passwords)
1031 1031
                 $rows = DB::query(
1032 1032
                     'SELECT id, data
1033
-                    FROM ' . prefixTable('categories_items') . '
1034
-                    LIMIT ' . $post_start . ', ' . $post_length
1033
+                    FROM ' . prefixTable('categories_items').'
1034
+                    LIMIT ' . $post_start.', '.$post_length
1035 1035
                 );
1036 1036
                 foreach ($rows as $record) {
1037 1037
                     // backup data
@@ -1042,7 +1042,7 @@  discard block
 block discarded – undo
1042 1042
                             'current_field' => 'data',
1043 1043
                             'value_id' => $record['id'],
1044 1044
                             'value' => $record['data'],
1045
-                            'current_sql' => 'UPDATE ' . prefixTable('categories_items') . " SET data = '" . $record['data'] . "' WHERE id = '" . $record['id'] . "';",
1045
+                            'current_sql' => 'UPDATE '.prefixTable('categories_items')." SET data = '".$record['data']."' WHERE id = '".$record['id']."';",
1046 1046
                             'value2' => 'none',
1047 1047
                             'result' => 'none',
1048 1048
                         )
@@ -1090,9 +1090,9 @@  discard block
 block discarded – undo
1090 1090
                 // Change all encrypted data in FILES (passwords)
1091 1091
                 $rows = DB::query(
1092 1092
                     'SELECT id, file, status
1093
-                    FROM ' . prefixTable('files') . "
1093
+                    FROM ' . prefixTable('files')."
1094 1094
                     WHERE status = 'encrypted'
1095
-                    LIMIT " . $post_start . ', ' . $post_length
1095
+                    LIMIT " . $post_start.', '.$post_length
1096 1096
                 );
1097 1097
                 foreach ($rows as $record) {
1098 1098
                     // backup data
@@ -1110,20 +1110,20 @@  discard block
 block discarded – undo
1110 1110
                     );
1111 1111
                     $newID = DB::insertId();
1112 1112
 
1113
-                    if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['file'])) {
1113
+                    if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['file'])) {
1114 1114
                         // make a copy of file
1115 1115
                         if (!copy(
1116
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
1117
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '.copy'
1116
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
1117
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'.copy'
1118 1118
                         )) {
1119 1119
                             $error = 'Copy not possible';
1120 1120
                             exit;
1121 1121
                         } else {
1122 1122
                             // prepare a bck of file (that will not be deleted)
1123
-                            $backup_filename = $record['file'] . '.bck-change-sk.' . time();
1123
+                            $backup_filename = $record['file'].'.bck-change-sk.'.time();
1124 1124
                             copy(
1125
-                                $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
1126
-                                $SETTINGS['path_to_upload_folder'] . '/' . $backup_filename
1125
+                                $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
1126
+                                $SETTINGS['path_to_upload_folder'].'/'.$backup_filename
1127 1127
                             );
1128 1128
                         }
1129 1129
 
@@ -1131,24 +1131,24 @@  discard block
 block discarded – undo
1131 1131
                         // STEP1 - Do decryption
1132 1132
                         prepareFileWithDefuse(
1133 1133
                             'decrypt',
1134
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
1135
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted',
1134
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
1135
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted',
1136 1136
                             $SETTINGS
1137 1137
                         );
1138 1138
 
1139 1139
                         // Do cleanup of files
1140
-                        unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['file']);
1140
+                        unlink($SETTINGS['path_to_upload_folder'].'/'.$record['file']);
1141 1141
 
1142 1142
                         // STEP2 - Do encryption
1143 1143
                         prepareFileWithDefuse(
1144 1144
                             'encryp',
1145
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted',
1146
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
1145
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted',
1146
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
1147 1147
                             $SETTINGS
1148 1148
                         );
1149 1149
 
1150 1150
                         // Do cleanup of files
1151
-                        unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted');
1151
+                        unlink($SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted');
1152 1152
 
1153 1153
                         // Update backup table
1154 1154
                         DB::update(
@@ -1174,13 +1174,13 @@  discard block
 block discarded – undo
1174 1174
                 // do some things for new object
1175 1175
                 if (isset($objects[0])) {
1176 1176
                     if ($objects[0] === 'logs') {
1177
-                        DB::query('SELECT increment_id FROM ' . prefixTable('log_items') . " WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
1177
+                        DB::query('SELECT increment_id FROM '.prefixTable('log_items')." WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
1178 1178
                     } elseif ($objects[0] === 'files') {
1179
-                        DB::query('SELECT id FROM ' . prefixTable('files'));
1179
+                        DB::query('SELECT id FROM '.prefixTable('files'));
1180 1180
                     } elseif ($objects[0] === 'categories') {
1181
-                        DB::query('SELECT id FROM ' . prefixTable('categories_items'));
1181
+                        DB::query('SELECT id FROM '.prefixTable('categories_items'));
1182 1182
                     } elseif ($objects[0] === 'custfields') {
1183
-                        DB::query('SELECT raison FROM ' . prefixTable('log_items') . " WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
1183
+                        DB::query('SELECT raison FROM '.prefixTable('log_items')." WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
1184 1184
                     }
1185 1185
                     $nb_of_items = DB::count();
1186 1186
                 } else {
@@ -1305,12 +1305,12 @@  discard block
 block discarded – undo
1305 1305
                 );
1306 1306
             } elseif ($record['current_table'] === 'files') {
1307 1307
                 // restore backup file
1308
-                if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value'])) {
1309
-                    unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['value']);
1310
-                    if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value2'])) {
1308
+                if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value'])) {
1309
+                    unlink($SETTINGS['path_to_upload_folder'].'/'.$record['value']);
1310
+                    if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value2'])) {
1311 1311
                         rename(
1312
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['value2'],
1313
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['value']
1312
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['value2'],
1313
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['value']
1314 1314
                         );
1315 1315
                     }
1316 1316
                 }
@@ -1329,7 +1329,7 @@  discard block
 block discarded – undo
1329 1329
         }
1330 1330
 
1331 1331
         // drop table
1332
-        DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
1332
+        DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup'));
1333 1333
 
1334 1334
         // Send back
1335 1335
         echo prepareExchangedData(
@@ -1375,17 +1375,17 @@  discard block
 block discarded – undo
1375 1375
         // delete files
1376 1376
         $rows = DB::query(
1377 1377
             'SELECT value, value2
1378
-            FROM ' . prefixTable('sk_reencrypt_backup') . "
1378
+            FROM ' . prefixTable('sk_reencrypt_backup')."
1379 1379
             WHERE current_table = 'files'"
1380 1380
         );
1381 1381
         foreach ($rows as $record) {
1382
-            if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value2'])) {
1383
-                unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['value2']);
1382
+            if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value2'])) {
1383
+                unlink($SETTINGS['path_to_upload_folder'].'/'.$record['value2']);
1384 1384
             }
1385 1385
         }
1386 1386
 
1387 1387
         // drop table
1388
-        DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
1388
+        DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup'));
1389 1389
 
1390 1390
         echo '[{"status":"done"}]';
1391 1391
         break;
@@ -1419,7 +1419,7 @@  discard block
 block discarded – undo
1419 1419
             );
1420 1420
             break;
1421 1421
         } else {
1422
-            require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1422
+            require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1423 1423
 
1424 1424
             //send email
1425 1425
             sendEmail(
@@ -1457,11 +1457,11 @@  discard block
 block discarded – undo
1457 1457
             break;
1458 1458
         }
1459 1459
 
1460
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1460
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1461 1461
 
1462 1462
         $rows = DB::query(
1463 1463
             'SELECT *
1464
-            FROM ' . prefixTable('emails') . '
1464
+            FROM ' . prefixTable('emails').'
1465 1465
             WHERE status = %s OR status = %s',
1466 1466
             'not_sent',
1467 1467
             ''
@@ -1548,9 +1548,9 @@  discard block
 block discarded – undo
1548 1548
             break;
1549 1549
         }
1550 1550
 
1551
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1551
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1552 1552
 
1553
-        $rows = DB::query('SELECT * FROM ' . prefixTable('emails') . ' WHERE status = %s OR status = %s', 'not_sent', '');
1553
+        $rows = DB::query('SELECT * FROM '.prefixTable('emails').' WHERE status = %s OR status = %s', 'not_sent', '');
1554 1554
         foreach ($rows as $record) {
1555 1555
             //send email
1556 1556
             $ret = json_decode(
@@ -1621,7 +1621,7 @@  discard block
 block discarded – undo
1621 1621
             break;
1622 1622
         }
1623 1623
 
1624
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1624
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1625 1625
 
1626 1626
         // init
1627 1627
         $filesList = array();
@@ -1634,7 +1634,7 @@  discard block
 block discarded – undo
1634 1634
                 FROM ' . prefixTable('files')
1635 1635
             );
1636 1636
             foreach ($rows as $record) {
1637
-                if (is_file($SETTINGS['path_to_upload_folder'] . '/' . $record['file'])) {
1637
+                if (is_file($SETTINGS['path_to_upload_folder'].'/'.$record['file'])) {
1638 1638
                     $addFile = false;
1639 1639
                     if (($post_option === 'attachments-decrypt' && $record['status'] === 'encrypted')
1640 1640
                         || ($post_option === 'attachments-encrypt' && $record['status'] === 'clear')
@@ -1703,8 +1703,8 @@  discard block
 block discarded – undo
1703 1703
         $post_list = filter_var_array($post_list, FILTER_SANITIZE_FULL_SPECIAL_CHARS);
1704 1704
         $post_counter = filter_var($post_counter, FILTER_SANITIZE_NUMBER_INT);
1705 1705
 
1706
-        include $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
1707
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1706
+        include $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
1707
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1708 1708
 
1709 1709
         $cpt = 0;
1710 1710
         $continu = true;
@@ -1712,15 +1712,15 @@  discard block
 block discarded – undo
1712 1712
         $message = '';
1713 1713
 
1714 1714
         // load PhpEncryption library
1715
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Crypto.php';
1716
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Encoding.php';
1717
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/DerivedKeys.php';
1718
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Key.php';
1719
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/KeyOrPassword.php';
1720
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/File.php';
1721
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/RuntimeTests.php';
1722
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/KeyProtectedByPassword.php';
1723
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Core.php';
1715
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Crypto.php';
1716
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Encoding.php';
1717
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/DerivedKeys.php';
1718
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Key.php';
1719
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/KeyOrPassword.php';
1720
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/File.php';
1721
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/RuntimeTests.php';
1722
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/KeyProtectedByPassword.php';
1723
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Core.php';
1724 1724
 
1725 1725
         // treat 10 files
1726 1726
         foreach ($post_list as $file) {
@@ -1728,35 +1728,35 @@  discard block
 block discarded – undo
1728 1728
                 // Get file name
1729 1729
                 $file_info = DB::queryfirstrow(
1730 1730
                     'SELECT file
1731
-                    FROM ' . prefixTable('files') . '
1731
+                    FROM ' . prefixTable('files').'
1732 1732
                     WHERE id = %i',
1733 1733
                     $file
1734 1734
                 );
1735 1735
 
1736 1736
                 // skip file is Coherancey not respected
1737
-                if (is_file($SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'])) {
1737
+                if (is_file($SETTINGS['path_to_upload_folder'].'/'.$file_info['file'])) {
1738 1738
                     // Case where we want to decrypt
1739 1739
                     if ($post_option === 'decrypt') {
1740 1740
                         prepareFileWithDefuse(
1741 1741
                             'decrypt',
1742
-                            $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'],
1743
-                            $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
1742
+                            $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'],
1743
+                            $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
1744 1744
                             $SETTINGS
1745 1745
                         );
1746 1746
                         // Case where we want to encrypt
1747 1747
                     } elseif ($post_option === 'encrypt') {
1748 1748
                         prepareFileWithDefuse(
1749 1749
                             'encrypt',
1750
-                            $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'],
1751
-                            $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
1750
+                            $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'],
1751
+                            $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
1752 1752
                             $SETTINGS
1753 1753
                         );
1754 1754
                     }
1755 1755
                     // Do file cleanup
1756
-                    fileDelete($SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'], $SETTINGS);
1756
+                    fileDelete($SETTINGS['path_to_upload_folder'].'/'.$file_info['file'], $SETTINGS);
1757 1757
                     rename(
1758
-                        $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
1759
-                        $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file']
1758
+                        $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
1759
+                        $SETTINGS['path_to_upload_folder'].'/'.$file_info['file']
1760 1760
                     );
1761 1761
 
1762 1762
                     // store in DB
@@ -1791,8 +1791,8 @@  discard block
 block discarded – undo
1791 1791
                 $post_option === 'attachments-decrypt' ? 'clear' : 'encrypted'
1792 1792
             );
1793 1793
 
1794
-            $message = langHdl('last_execution') . ' ' .
1795
-                date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
1794
+            $message = langHdl('last_execution').' '.
1795
+                date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
1796 1796
                 '<i class="fas fa-check text-success ml-2 mr-3"></i>';
1797 1797
         }
1798 1798
 
@@ -1890,7 +1890,7 @@  discard block
 block discarded – undo
1890 1890
             $post_id = filter_var($dataReceived['id'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
1891 1891
 
1892 1892
             DB::query(
1893
-                'DELETE FROM ' . prefixTable('api') . ' WHERE increment_id = %i',
1893
+                'DELETE FROM '.prefixTable('api').' WHERE increment_id = %i',
1894 1894
                 $post_id
1895 1895
             );
1896 1896
         }
@@ -1989,7 +1989,7 @@  discard block
 block discarded – undo
1989 1989
             // Delete existing key
1990 1990
         } elseif (null !== $post_action && $post_action === 'delete') {
1991 1991
             $post_id = filter_var($dataReceived['id'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
1992
-            DB::query('DELETE FROM ' . prefixTable('api') . ' WHERE increment_id=%i', $post_id);
1992
+            DB::query('DELETE FROM '.prefixTable('api').' WHERE increment_id=%i', $post_id);
1993 1993
         }
1994 1994
 
1995 1995
         echo prepareExchangedData(
@@ -2005,7 +2005,7 @@  discard block
 block discarded – undo
2005 2005
 
2006 2006
     case 'save_api_status':
2007 2007
         // Do query
2008
-        DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'api');
2008
+        DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'api');
2009 2009
         $counter = DB::count();
2010 2010
         if ($counter === 0) {
2011 2011
             DB::insert(
@@ -2032,7 +2032,7 @@  discard block
 block discarded – undo
2032 2032
 
2033 2033
     case 'run_duo_config_check':
2034 2034
         //Libraries call
2035
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
2035
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
2036 2036
         // Check KEY
2037 2037
         if ($post_key !== $_SESSION['key']) {
2038 2038
             echo prepareExchangedData(
@@ -2088,7 +2088,7 @@  discard block
 block discarded – undo
2088 2088
                 $SETTINGS['cpassman_dir'],
2089 2089
                     array(
2090 2090
                         'error' => true,
2091
-                        'message' => langHdl('duo_config_error') . "<br/>Duo: " . $e->getMessage(),
2091
+                        'message' => langHdl('duo_config_error')."<br/>Duo: ".$e->getMessage(),
2092 2092
                     ),
2093 2093
                     'encode'
2094 2094
             );
@@ -2108,7 +2108,7 @@  discard block
 block discarded – undo
2108 2108
                 $duo_error = langHdl('duo_error_secure');
2109 2109
                 $data["duo_check"] = "failed";
2110 2110
             }*/
2111
-            $duo_error = langHdl('duo_error_check_config') . "<br/>Duo: " . $e->getMessage();
2111
+            $duo_error = langHdl('duo_error_check_config')."<br/>Duo: ".$e->getMessage();
2112 2112
             echo prepareExchangedData(
2113 2113
                 $SETTINGS['cpassman_dir'],
2114 2114
                     array(
@@ -2157,7 +2157,7 @@  discard block
 block discarded – undo
2157 2157
         } else {
2158 2158
             $tmp = 1;
2159 2159
         }
2160
-        DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'google_authentication');
2160
+        DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'google_authentication');
2161 2161
         $counter = DB::count();
2162 2162
         if ($counter === 0) {
2163 2163
             DB::insert(
@@ -2183,7 +2183,7 @@  discard block
 block discarded – undo
2183 2183
 
2184 2184
         // ga_website_name
2185 2185
         if (is_null($dataReceived['ga_website_name']) === false) {
2186
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'ga_website_name');
2186
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'ga_website_name');
2187 2187
             $counter = DB::count();
2188 2188
             if ($counter === 0) {
2189 2189
                 DB::insert(
@@ -2214,7 +2214,7 @@  discard block
 block discarded – undo
2214 2214
         }
2215 2215
 
2216 2216
         // send data
2217
-        echo '[{"result" : "' . addslashes($LANG['done']) . '" , "error" : ""}]';
2217
+        echo '[{"result" : "'.addslashes($LANG['done']).'" , "error" : ""}]';
2218 2218
         break;
2219 2219
 
2220 2220
     case 'save_agses_options':
@@ -2239,7 +2239,7 @@  discard block
 block discarded – undo
2239 2239
 
2240 2240
         // agses_hosted_url
2241 2241
         if (!is_null($dataReceived['agses_hosted_url'])) {
2242
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_url');
2242
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_url');
2243 2243
             $counter = DB::count();
2244 2244
             if ($counter === 0) {
2245 2245
                 DB::insert(
@@ -2268,7 +2268,7 @@  discard block
 block discarded – undo
2268 2268
 
2269 2269
         // agses_hosted_id
2270 2270
         if (!is_null($dataReceived['agses_hosted_id'])) {
2271
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_id');
2271
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_id');
2272 2272
             $counter = DB::count();
2273 2273
             if ($counter === 0) {
2274 2274
                 DB::insert(
@@ -2297,7 +2297,7 @@  discard block
 block discarded – undo
2297 2297
 
2298 2298
         // agses_hosted_apikey
2299 2299
         if (!is_null($dataReceived['agses_hosted_apikey'])) {
2300
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_apikey');
2300
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_apikey');
2301 2301
             $counter = DB::count();
2302 2302
             if ($counter === 0) {
2303 2303
                 DB::insert(
@@ -2325,7 +2325,7 @@  discard block
 block discarded – undo
2325 2325
         }
2326 2326
 
2327 2327
         // send data
2328
-        echo '[{"result" : "' . addslashes($LANG['done']) . '" , "error" : ""}]';
2328
+        echo '[{"result" : "'.addslashes($LANG['done']).'" , "error" : ""}]';
2329 2329
         break;
2330 2330
 
2331 2331
     case 'save_option_change':
@@ -2366,7 +2366,7 @@  discard block
 block discarded – undo
2366 2366
 
2367 2367
         // Check if setting is already in DB. If NO then insert, if YES then update.
2368 2368
         $data = DB::query(
2369
-            'SELECT * FROM ' . prefixTable('misc') . '
2369
+            'SELECT * FROM '.prefixTable('misc').'
2370 2370
             WHERE type = %s AND intitule = %s',
2371 2371
             'admin',
2372 2372
             $post_field
@@ -2388,7 +2388,7 @@  discard block
 block discarded – undo
2388 2388
                     array(
2389 2389
                         'valeur' => time(),
2390 2390
                         'type' => 'admin',
2391
-                        'intitule' => $post_field . '_time',
2391
+                        'intitule' => $post_field.'_time',
2392 2392
                     )
2393 2393
                 );
2394 2394
             }
@@ -2406,10 +2406,10 @@  discard block
 block discarded – undo
2406 2406
             if ($post_field === 'send_stats') {
2407 2407
                 // Check if previous time exists, if not them insert this value in DB
2408 2408
                 DB::query(
2409
-                    'SELECT * FROM ' . prefixTable('misc') . '
2409
+                    'SELECT * FROM '.prefixTable('misc').'
2410 2410
                     WHERE type = %s AND intitule = %s',
2411 2411
                     'admin',
2412
-                    $post_field . '_time'
2412
+                    $post_field.'_time'
2413 2413
                 );
2414 2414
                 $counter = DB::count();
2415 2415
                 if ($counter === 0) {
@@ -2418,7 +2418,7 @@  discard block
 block discarded – undo
2418 2418
                         array(
2419 2419
                             'valeur' => 0,
2420 2420
                             'type' => 'admin',
2421
-                            'intitule' => $post_field . '_time',
2421
+                            'intitule' => $post_field.'_time',
2422 2422
                         )
2423 2423
                     );
2424 2424
                 } else {
@@ -2438,13 +2438,13 @@  discard block
 block discarded – undo
2438 2438
         // special Cases
2439 2439
         if ($post_field === 'cpassman_url') {
2440 2440
             // update also jsUrl for CSFP protection
2441
-            $jsUrl = $post_value . '/includes/libraries/csrfp/js/csrfprotector.js';
2441
+            $jsUrl = $post_value.'/includes/libraries/csrfp/js/csrfprotector.js';
2442 2442
             $csrfp_file = '../includes/libraries/csrfp/libs/csrfp.config.php';
2443 2443
             $data = file_get_contents($csrfp_file);
2444 2444
             $posJsUrl = strpos($data, '"jsUrl" => "');
2445 2445
             $posEndLine = strpos($data, '",', $posJsUrl);
2446 2446
             $line = substr($data, $posJsUrl, ($posEndLine - $posJsUrl + 2));
2447
-            $newdata = str_replace($line, '"jsUrl" => "' . filter_var($jsUrl, FILTER_SANITIZE_FULL_SPECIAL_CHARS) . '",', $data);
2447
+            $newdata = str_replace($line, '"jsUrl" => "'.filter_var($jsUrl, FILTER_SANITIZE_FULL_SPECIAL_CHARS).'",', $data);
2448 2448
             file_put_contents($csrfp_file, $newdata);
2449 2449
         } elseif ($post_field === 'restricted_to_input' && (int) $post_value === 0) {
2450 2450
             DB::update(
@@ -2474,7 +2474,7 @@  discard block
 block discarded – undo
2474 2474
             $SETTINGS['cpassman_dir'],
2475 2475
             array(
2476 2476
                 'error' => false,
2477
-                'misc' => $counter . ' ; ' . $SETTINGS[$post_field],
2477
+                'misc' => $counter.' ; '.$SETTINGS[$post_field],
2478 2478
             ),
2479 2479
             'encode'
2480 2480
         );
@@ -2519,7 +2519,7 @@  discard block
 block discarded – undo
2519 2519
 
2520 2520
         // send statistics
2521 2521
         if (null !== $post_status) {
2522
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'send_stats');
2522
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'send_stats');
2523 2523
             $counter = DB::count();
2524 2524
             if ($counter === 0) {
2525 2525
                 DB::insert(
@@ -2551,7 +2551,7 @@  discard block
 block discarded – undo
2551 2551
 
2552 2552
         // send statistics items
2553 2553
         if (null !== $post_list) {
2554
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'send_statistics_items');
2554
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'send_statistics_items');
2555 2555
             $counter = DB::count();
2556 2556
             if ($counter === 0) {
2557 2557
                 DB::insert(
@@ -2599,7 +2599,7 @@  discard block
 block discarded – undo
2599 2599
             break;
2600 2600
         }
2601 2601
 
2602
-        if (DB::query("SHOW TABLES LIKE '" . prefixTable('sk_reencrypt_backup') . "'")) {
2602
+        if (DB::query("SHOW TABLES LIKE '".prefixTable('sk_reencrypt_backup')."'")) {
2603 2603
             if (DB::count() === 1) {
2604 2604
                 echo 1;
2605 2605
             } else {
@@ -2638,7 +2638,7 @@  discard block
 block discarded – undo
2638 2638
 
2639 2639
         $rows = DB::query(
2640 2640
             'SELECT id, title
2641
-                FROM ' . prefixTable('roles_title') . '
2641
+                FROM ' . prefixTable('roles_title').'
2642 2642
                 ORDER BY title ASC'
2643 2643
         );
2644 2644
         foreach ($rows as $record) {
Please login to merge, or discard this patch.
scripts/background_tasks___do_maintenance.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 $logID = doLog('start', 'do_maintenance', (isset($SETTINGS['enable_tasks_log']) === true ? (int) $SETTINGS['enable_tasks_log'] : 0));
60 60
 
61 61
 // Perform maintenance tasks
62
-foreach(json_decode($SETTINGS['maintenance_job_tasks']) as $task) {
62
+foreach (json_decode($SETTINGS['maintenance_job_tasks']) as $task) {
63 63
     if ($task === "users-personal-folder") createUserPersonalFolder();
64 64
     elseif ($task === "clean-orphan-objects") cleanOrphanObjects();
65 65
     elseif ($task === "purge-old-files") purgeTemporaryFiles();
@@ -77,14 +77,14 @@  discard block
 block discarded – undo
77 77
 function createUserPersonalFolder(): void
78 78
 {
79 79
     //Libraries call
80
-    require_once __DIR__. '/../sources/main.functions.php';
81
-    require_once __DIR__. '/../includes/libraries/Tree/NestedTree/NestedTree.php';
80
+    require_once __DIR__.'/../sources/main.functions.php';
81
+    require_once __DIR__.'/../includes/libraries/Tree/NestedTree/NestedTree.php';
82 82
     $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
83 83
 
84 84
     //get through all users
85 85
     $rows = DB::query(
86 86
         'SELECT id, login, email
87
-        FROM ' . prefixTable('users') . '
87
+        FROM ' . prefixTable('users').'
88 88
         WHERE id NOT IN ('.OTV_USER_ID.', '.TP_USER_ID.', '.SSH_USER_ID.', '.API_USER_ID.')
89 89
         ORDER BY login ASC'
90 90
     );
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
         //if folder doesn't exist then create it
103 103
         $data = DB::queryfirstrow(
104 104
             'SELECT id
105
-            FROM ' . prefixTable('nested_tree') . '
105
+            FROM ' . prefixTable('nested_tree').'
106 106
             WHERE title = %s AND parent_id = %i',
107 107
             $record['id'],
108 108
             0
@@ -161,9 +161,9 @@  discard block
 block discarded – undo
161 161
 function cleanOrphanObjects(): void
162 162
 {
163 163
     //Libraries call
164
-    require_once __DIR__. '/../sources/main.functions.php';
165
-    include __DIR__. '/../includes/config/tp.config.php';
166
-    require_once __DIR__. '/../includes/libraries/Tree/NestedTree/NestedTree.php';
164
+    require_once __DIR__.'/../sources/main.functions.php';
165
+    include __DIR__.'/../includes/config/tp.config.php';
166
+    require_once __DIR__.'/../includes/libraries/Tree/NestedTree/NestedTree.php';
167 167
     $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
168 168
 
169 169
     //init
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
         }
178 178
     }
179 179
 
180
-    $items = DB::query('SELECT id,label FROM ' . prefixTable('items') . ' WHERE id_tree NOT IN %li', $foldersIds);
180
+    $items = DB::query('SELECT id,label FROM '.prefixTable('items').' WHERE id_tree NOT IN %li', $foldersIds);
181 181
     foreach ($items as $item) {
182 182
         //Delete item
183 183
         DB::DELETE(prefixTable('items'), 'id = %i', $item['id']);
@@ -196,12 +196,12 @@  discard block
 block discarded – undo
196 196
     // delete orphan items
197 197
     $rows = DB::query(
198 198
         'SELECT id
199
-        FROM ' . prefixTable('items') . '
199
+        FROM ' . prefixTable('items').'
200 200
         ORDER BY id ASC'
201 201
     );
202 202
     foreach ($rows as $item) {
203 203
         DB::query(
204
-            'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i AND action = %s',
204
+            'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i AND action = %s',
205 205
             $item['id'],
206 206
             'at_creation'
207 207
         );
@@ -225,8 +225,8 @@  discard block
 block discarded – undo
225 225
 function purgeTemporaryFiles(): void
226 226
 {
227 227
     // Load expected files
228
-    require_once __DIR__. '/../sources/main.functions.php';
229
-    include __DIR__. '/../includes/config/tp.config.php';
228
+    require_once __DIR__.'/../sources/main.functions.php';
229
+    include __DIR__.'/../includes/config/tp.config.php';
230 230
 
231 231
     //read folder
232 232
     if (is_dir($SETTINGS['path_to_files_folder']) === true) {
@@ -235,8 +235,8 @@  discard block
 block discarded – undo
235 235
             //delete file FILES
236 236
             while (false !== ($f = readdir($dir))) {
237 237
                 if ($f !== '.' && $f !== '..' && $f !== '.htaccess') {
238
-                    if (file_exists($dir . $f) && ((time() - filectime($dir . $f)) > 604800)) {
239
-                        fileDelete($dir . '/' . $f, $SETTINGS);
238
+                    if (file_exists($dir.$f) && ((time() - filectime($dir.$f)) > 604800)) {
239
+                        fileDelete($dir.'/'.$f, $SETTINGS);
240 240
                     }
241 241
                 }
242 242
             }
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
             while (false !== ($f = readdir($dir))) {
256 256
                 if ($f !== '.' && $f !== '..') {
257 257
                     if (strpos($f, '_delete.') > 0) {
258
-                        fileDelete($SETTINGS['path_to_upload_folder'] . '/' . $f, $SETTINGS);
258
+                        fileDelete($SETTINGS['path_to_upload_folder'].'/'.$f, $SETTINGS);
259 259
                     }
260 260
                 }
261 261
             }
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -60,10 +60,14 @@
 block discarded – undo
60 60
 
61 61
 // Perform maintenance tasks
62 62
 foreach(json_decode($SETTINGS['maintenance_job_tasks']) as $task) {
63
-    if ($task === "users-personal-folder") createUserPersonalFolder();
64
-    elseif ($task === "clean-orphan-objects") cleanOrphanObjects();
65
-    elseif ($task === "purge-old-files") purgeTemporaryFiles();
66
-}
63
+    if ($task === "users-personal-folder") {
64
+        createUserPersonalFolder();
65
+    } elseif ($task === "clean-orphan-objects") {
66
+        cleanOrphanObjects();
67
+    } elseif ($task === "purge-old-files") {
68
+        purgeTemporaryFiles();
69
+    }
70
+    }
67 71
 
68 72
 // log end
69 73
 doLog('end', '', (isset($SETTINGS['enable_tasks_log']) === true ? (int) $SETTINGS['enable_tasks_log'] : 0), $logID);
Please login to merge, or discard this patch.