Passed
Pull Request — master (#4948)
by Nils
07:11
created
scripts/install-cli.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     ]);
75 75
     echo "      ✅ Database connection successful\n\n";
76 76
 } catch (PDOException $e) {
77
-    echo "      ❌ Database connection failed: " . $e->getMessage() . "\n";
77
+    echo "      ❌ Database connection failed: ".$e->getMessage()."\n";
78 78
     exit(1);
79 79
 }
80 80
 
@@ -85,15 +85,15 @@  discard block
 block discarded – undo
85 85
     $pdo->exec("USE `{$dbName}`");
86 86
     echo "      ✅ Database created/selected\n\n";
87 87
 } catch (PDOException $e) {
88
-    echo "      ❌ Database creation failed: " . $e->getMessage() . "\n";
88
+    echo "      ❌ Database creation failed: ".$e->getMessage()."\n";
89 89
     exit(1);
90 90
 }
91 91
 
92 92
 // Step 3: Create settings.php file
93 93
 echo "[3/6] Creating settings.php configuration file...\n";
94 94
 try {
95
-    $settingsTemplate = BASE_PATH . '/includes/config/settings.sample.php';
96
-    $settingsPath = BASE_PATH . '/includes/config/settings.php';
95
+    $settingsTemplate = BASE_PATH.'/includes/config/settings.sample.php';
96
+    $settingsPath = BASE_PATH.'/includes/config/settings.php';
97 97
 
98 98
     if (!file_exists($settingsTemplate)) {
99 99
         throw new Exception("Template file not found: {$settingsTemplate}");
@@ -130,17 +130,17 @@  discard block
 block discarded – undo
130 130
 
131 131
     echo "      ✅ Settings file created\n\n";
132 132
 } catch (Exception $e) {
133
-    echo "      ❌ Settings creation failed: " . $e->getMessage() . "\n";
133
+    echo "      ❌ Settings creation failed: ".$e->getMessage()."\n";
134 134
     exit(1);
135 135
 }
136 136
 
137 137
 // Step 4: Import database schema
138 138
 echo "[4/6] Importing database schema...\n";
139 139
 try {
140
-    $installDir = BASE_PATH . '/install';
140
+    $installDir = BASE_PATH.'/install';
141 141
     $schemaFiles = [
142
-        $installDir . '/database/tables.sql',
143
-        $installDir . '/database/initial-data.sql',
142
+        $installDir.'/database/tables.sql',
143
+        $installDir.'/database/initial-data.sql',
144 144
     ];
145 145
 
146 146
     foreach ($schemaFiles as $schemaFile) {
@@ -159,33 +159,33 @@  discard block
 block discarded – undo
159 159
                 }
160 160
             }
161 161
 
162
-            echo "      ✅ Imported: " . basename($schemaFile) . "\n";
162
+            echo "      ✅ Imported: ".basename($schemaFile)."\n";
163 163
         } else {
164
-            echo "      ⚠️  Schema file not found: " . basename($schemaFile) . " (continuing...)\n";
164
+            echo "      ⚠️  Schema file not found: ".basename($schemaFile)." (continuing...)\n";
165 165
         }
166 166
     }
167 167
 
168 168
     echo "      ✅ Database schema imported\n\n";
169 169
 } catch (PDOException $e) {
170 170
     echo "      ⚠️  Note: This is a simplified installer. Full schema import should be done via web installer.\n";
171
-    echo "      Error details: " . $e->getMessage() . "\n\n";
171
+    echo "      Error details: ".$e->getMessage()."\n\n";
172 172
 }
173 173
 
174 174
 // Step 5: Create saltkey
175 175
 echo "[5/6] Generating encryption saltkey...\n";
176 176
 try {
177
-    $skDir = BASE_PATH . '/sk';
177
+    $skDir = BASE_PATH.'/sk';
178 178
     if (!is_dir($skDir)) {
179 179
         mkdir($skDir, 0700, true);
180 180
     }
181 181
 
182 182
     $saltkey = bin2hex(random_bytes(32));
183
-    file_put_contents($skDir . '/sk.txt', $saltkey);
184
-    chmod($skDir . '/sk.txt', 0400);
183
+    file_put_contents($skDir.'/sk.txt', $saltkey);
184
+    chmod($skDir.'/sk.txt', 0400);
185 185
 
186 186
     echo "      ✅ Saltkey generated\n\n";
187 187
 } catch (Exception $e) {
188
-    echo "      ❌ Saltkey generation failed: " . $e->getMessage() . "\n";
188
+    echo "      ❌ Saltkey generation failed: ".$e->getMessage()."\n";
189 189
     exit(1);
190 190
 }
191 191
 
Please login to merge, or discard this patch.
sources/admin.queries.php 2 patches
Spacing   +193 added lines, -193 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('admin') === false) {
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
 
@@ -133,14 +133,14 @@  discard block
 block discarded – undo
133 133
             break;
134 134
         }
135 135
 
136
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
136
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
137 137
         $return = '';
138 138
 
139 139
         //Get all tables
140 140
         $tables = array();
141 141
         $result = DB::query('SHOW TABLES');
142 142
         foreach ($result as $row) {
143
-            $tables[] = $row['Tables_in_' . DB_NAME];
143
+            $tables[] = $row['Tables_in_'.DB_NAME];
144 144
         }
145 145
 
146 146
         //cycle through
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
             if (defined('DB_PREFIX') || substr_count($table, DB_PREFIX) > 0) {
149 149
                 $table = (is_string($table) ? $table : strval($table));
150 150
                 // Do query
151
-                $result = DB::query('SELECT * FROM ' . $table);
151
+                $result = DB::query('SELECT * FROM '.$table);
152 152
                 DB::query(
153 153
                     'SELECT *
154 154
                     FROM INFORMATION_SCHEMA.COLUMNS
@@ -160,20 +160,20 @@  discard block
 block discarded – undo
160 160
                 $numFields = DB::count();
161 161
 
162 162
                 // prepare a drop table
163
-                $return .= 'DROP TABLE ' . $table . ';';
164
-                $row2 = DB::queryFirstRow('SHOW CREATE TABLE ' . $table);
165
-                $return .= "\n\n" . strval($row2['Create Table']) . ";\n\n";
163
+                $return .= 'DROP TABLE '.$table.';';
164
+                $row2 = DB::queryFirstRow('SHOW CREATE TABLE '.$table);
165
+                $return .= "\n\n".strval($row2['Create Table']).";\n\n";
166 166
 
167 167
                 //prepare all fields and datas
168 168
                 for ($i = 0; $i < $numFields; ++$i) {
169 169
                     if (is_object($result)) {
170 170
                         while ($row = $result->fetch_row()) {
171
-                            $return .= 'INSERT INTO ' . $table . ' VALUES(';
171
+                            $return .= 'INSERT INTO '.$table.' VALUES(';
172 172
                             for ($j = 0; $j < $numFields; ++$j) {
173 173
                                 $row[$j] = addslashes($row[$j]);
174 174
                                 $row[$j] = preg_replace("/\n/", '\\n', $row[$j]);
175 175
                                 if (isset($row[$j])) {
176
-                                    $return .= '"' . $row[$j] . '"';
176
+                                    $return .= '"'.$row[$j].'"';
177 177
                                 } else {
178 178
                                     $return .= 'NULL';
179 179
                                 }
@@ -194,8 +194,8 @@  discard block
 block discarded – undo
194 194
             $token = GenerateCryptKey(20, false, true, true, false, true);
195 195
 
196 196
             //save file
197
-            $filename = time() . '-' . $token . '.sql';
198
-            $handle = fopen($SETTINGS['path_to_files_folder'] . '/' . $filename, 'w+');
197
+            $filename = time().'-'.$token.'.sql';
198
+            $handle = fopen($SETTINGS['path_to_files_folder'].'/'.$filename, 'w+');
199 199
             if ($handle !== false) {
200 200
                 //write file
201 201
                 fwrite($handle, $return);
@@ -207,16 +207,16 @@  discard block
 block discarded – undo
207 207
                 // Encrypt the file
208 208
                 prepareFileWithDefuse(
209 209
                     'encrypt',
210
-                    $SETTINGS['path_to_files_folder'] . '/' . $filename,
211
-                    $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
210
+                    $SETTINGS['path_to_files_folder'].'/'.$filename,
211
+                    $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
212 212
                     $post_option
213 213
                 );
214 214
 
215 215
                 // Do clean
216
-                unlink($SETTINGS['path_to_files_folder'] . '/' . $filename);
216
+                unlink($SETTINGS['path_to_files_folder'].'/'.$filename);
217 217
                 rename(
218
-                    $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
219
-                    $SETTINGS['path_to_files_folder'] . '/' . $filename
218
+                    $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
219
+                    $SETTINGS['path_to_files_folder'].'/'.$filename
220 220
                 );
221 221
             }
222 222
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
             //update LOG
227 227
             logEvents($SETTINGS, 'admin_action', 'dataBase backup', (string) $session->get('user-id'), $session->get('user-login'));
228 228
 
229
-            echo '[{"result":"db_backup" , "href":"sources/downloadFile.php?name=' . urlencode($filename) . '&sub=files&file=' . $filename . '&type=sql&key=' . $session->get('key') . '&key_tmp=' . $session->get('user-key_tmp') . '&pathIsFiles=1"}]';
229
+            echo '[{"result":"db_backup" , "href":"sources/downloadFile.php?name='.urlencode($filename).'&sub=files&file='.$filename.'&type=sql&key='.$session->get('key').'&key_tmp='.$session->get('user-key_tmp').'&pathIsFiles=1"}]';
230 230
         }
231 231
         break;
232 232
 
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
             );
256 256
             break;
257 257
         }
258
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
258
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
259 259
 
260 260
         $dataPost = explode('&', $post_option);
261 261
         $file = htmlspecialchars($dataPost[0]);
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
         // Get filename from database
265 265
         $data = DB::queryFirstRow(
266 266
             'SELECT valeur
267
-            FROM ' . prefixTable('misc') . '
267
+            FROM ' . prefixTable('misc').'
268 268
             WHERE increment_id = %i',
269 269
             $file
270 270
         );
@@ -283,8 +283,8 @@  discard block
 block discarded – undo
283 283
             // Decrypt the file
284 284
             $ret = prepareFileWithDefuse(
285 285
                 'decrypt',
286
-                $SETTINGS['path_to_files_folder'] . '/' . $file,
287
-                $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $file,
286
+                $SETTINGS['path_to_files_folder'].'/'.$file,
287
+                $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$file,
288 288
                 $key
289 289
             );
290 290
 
@@ -295,10 +295,10 @@  discard block
 block discarded – undo
295 295
             }
296 296
 
297 297
             // Do clean
298
-            fileDelete($SETTINGS['path_to_files_folder'] . '/' . $file, $SETTINGS);
299
-            $file = $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $file;
298
+            fileDelete($SETTINGS['path_to_files_folder'].'/'.$file, $SETTINGS);
299
+            $file = $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$file;
300 300
         } else {
301
-            $file = $SETTINGS['path_to_files_folder'] . '/' . $file;
301
+            $file = $SETTINGS['path_to_files_folder'].'/'.$file;
302 302
         }
303 303
 
304 304
         //read sql file
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
         fclose($handle);
316 316
 
317 317
         //delete file
318
-        unlink($SETTINGS['path_to_files_folder'] . '/' . $file);
318
+        unlink($SETTINGS['path_to_files_folder'].'/'.$file);
319 319
 
320 320
         //Show done
321 321
         echo '[{"result":"db_restore" , "message":""}]';
@@ -354,8 +354,8 @@  discard block
 block discarded – undo
354 354
                 $tablename = (is_string($tablename) ? $tablename : strval($tablename));
355 355
                 if (substr_count($tablename, DB_PREFIX) > 0) {
356 356
                     // launch optimization quieries
357
-                    DB::query('ANALYZE TABLE `' . $tablename . '`');
358
-                    DB::query('OPTIMIZE TABLE `' . $tablename . '`');
357
+                    DB::query('ANALYZE TABLE `'.$tablename.'`');
358
+                    DB::query('OPTIMIZE TABLE `'.$tablename.'`');
359 359
                 }
360 360
             }
361 361
         }
@@ -363,12 +363,12 @@  discard block
 block discarded – undo
363 363
         //Clean up LOG_ITEMS table
364 364
         $rows = DB::query(
365 365
             'SELECT id
366
-            FROM ' . prefixTable('items') . '
366
+            FROM ' . prefixTable('items').'
367 367
             ORDER BY id ASC'
368 368
         );
369 369
         foreach ($rows as $item) {
370 370
             DB::query(
371
-                'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i AND action = %s',
371
+                'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i AND action = %s',
372 372
                 $item['id'],
373 373
                 'at_creation'
374 374
             );
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
             if ($counter === 0) {
377 377
                 //Create new at_creation entry
378 378
                 $rowTmp = DB::queryFirstRow(
379
-                    'SELECT date, id_user FROM ' . prefixTable('log_items') . ' WHERE id_item=%i ORDER BY date ASC',
379
+                    'SELECT date, id_user FROM '.prefixTable('log_items').' WHERE id_item=%i ORDER BY date ASC',
380 380
                     $item['id']
381 381
                 );
382 382
                 DB::insert(
@@ -406,8 +406,8 @@  discard block
 block discarded – undo
406 406
         echo prepareExchangedData(
407 407
             array(
408 408
                 'error' => false,
409
-                'message' => $lang->get('last_execution') . ' ' .
410
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
409
+                'message' => $lang->get('last_execution').' '.
410
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
411 411
                     '<i class="fas fa-check text-success ml-2"></i>',
412 412
             ),
413 413
             'encode'
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
             break;
444 444
         }
445 445
 
446
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
446
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
447 447
         updateCacheTable('reload', NULL);
448 448
 
449 449
         // Log
@@ -459,8 +459,8 @@  discard block
 block discarded – undo
459 459
         echo prepareExchangedData(
460 460
             [
461 461
                 'error' => false,
462
-                'message' => $lang->get('last_execution') . ' ' .
463
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
462
+                'message' => $lang->get('last_execution').' '.
463
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
464 464
                     '<i class="fas fa-check text-success mr-2"></i>',
465 465
             ],
466 466
             'encode'
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
         $session->set('user-reencrypt_old_salt', file_get_contents(SECUREPATH.'/'.SECUREFILE));
503 503
 
504 504
         // generate new saltkey
505
-        $old_sk_filename = SECUREPATH.'/'.SECUREFILE . date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))) . '.' . time();
505
+        $old_sk_filename = SECUREPATH.'/'.SECUREFILE.date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))).'.'.time();
506 506
         copy(
507 507
             SECUREPATH.'/'.SECUREFILE,
508 508
             $old_sk_filename
@@ -531,13 +531,13 @@  discard block
 block discarded – undo
531 531
         logEvents($SETTINGS, 'system', 'change_salt_key', (string) $session->get('user-id'), $session->get('user-login'));
532 532
 
533 533
         // get number of items to change
534
-        DB::query('SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i', 0);
534
+        DB::query('SELECT id FROM '.prefixTable('items').' WHERE perso = %i', 0);
535 535
         $nb_of_items = DB::count();
536 536
 
537 537
         // create backup table
538
-        DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
538
+        DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup'));
539 539
         DB::query(
540
-            'CREATE TABLE `' . prefixTable('sk_reencrypt_backup') . '` (
540
+            'CREATE TABLE `'.prefixTable('sk_reencrypt_backup').'` (
541 541
             `id` int(12) NOT null AUTO_INCREMENT,
542 542
             `current_table` varchar(100) NOT NULL,
543 543
             `current_field` varchar(500) NOT NULL,
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
         );
566 566
 
567 567
         // delete previous backup files
568
-        $files = glob($SETTINGS['path_to_upload_folder'] . '/*'); // get all file names
568
+        $files = glob($SETTINGS['path_to_upload_folder'].'/*'); // get all file names
569 569
         foreach ($files as $file) { // iterate files
570 570
             if (is_file($file)) {
571 571
                 $file_parts = pathinfo($file);
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
                 echo prepareExchangedData(
653 653
                     array(
654 654
                         'error' => true,
655
-                        'message' => 'Input `' . $objects[0] . '` is not allowed',
655
+                        'message' => 'Input `'.$objects[0].'` is not allowed',
656 656
                         'nbOfItems' => '',
657 657
                         'nextAction' => '',
658 658
                     ),
@@ -665,9 +665,9 @@  discard block
 block discarded – undo
665 665
                 //change all encrypted data in Items (passwords)
666 666
                 $rows = DB::query(
667 667
                     'SELECT id, pw, pw_iv
668
-                    FROM ' . prefixTable('items') . '
668
+                    FROM ' . prefixTable('items').'
669 669
                     WHERE perso = %s
670
-                    LIMIT ' . $post_start . ', ' . $post_length,
670
+                    LIMIT ' . $post_start.', '.$post_length,
671 671
                     '0'
672 672
                 );
673 673
                 foreach ($rows as $record) {
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
                             'current_field' => 'pw',
680 680
                             'value_id' => $record['id'],
681 681
                             'value' => $record['pw'],
682
-                            'current_sql' => 'UPDATE ' . prefixTable('items') . " SET pw = '" . $record['pw'] . "' WHERE id = '" . $record['id'] . "';",
682
+                            'current_sql' => 'UPDATE '.prefixTable('items')." SET pw = '".$record['pw']."' WHERE id = '".$record['id']."';",
683 683
                             'value2' => 'none',
684 684
                             'result' => 'none',
685 685
                         )
@@ -728,9 +728,9 @@  discard block
 block discarded – undo
728 728
                 //change all encrypted data in Logs (passwords)
729 729
                 $rows = DB::query(
730 730
                     'SELECT raison, increment_id
731
-                    FROM ' . prefixTable('log_items') . "
731
+                    FROM ' . prefixTable('log_items')."
732 732
                     WHERE action = %s AND raison LIKE 'at_pw :%'
733
-                    LIMIT " . $post_start . ', ' . $post_length,
733
+                    LIMIT " . $post_start.', '.$post_length,
734 734
                     'at_modification'
735 735
                 );
736 736
                 foreach ($rows as $record) {
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
                             'current_field' => 'raison',
743 743
                             'value_id' => $record['increment_id'],
744 744
                             'value' => $record['raison'],
745
-                            'current_sql' => 'UPDATE ' . prefixTable('log_items') . " SET raison = '" . $record['raison'] . "' WHERE increment_id = '" . $record['increment_id'] . "';",
745
+                            'current_sql' => 'UPDATE '.prefixTable('log_items')." SET raison = '".$record['raison']."' WHERE increment_id = '".$record['increment_id']."';",
746 746
                             'value2' => 'none',
747 747
                             'result' => 'none',
748 748
                         )
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
                         DB::update(
771 771
                             prefixTable('log_items'),
772 772
                             array(
773
-                                'raison' => 'at_pw :' . $encrypt['string'],
773
+                                'raison' => 'at_pw :'.$encrypt['string'],
774 774
                                 'encryption_type' => 'defuse',
775 775
                             ),
776 776
                             'increment_id = %i',
@@ -795,8 +795,8 @@  discard block
 block discarded – undo
795 795
                 //change all encrypted data in CATEGORIES (passwords)
796 796
                 $rows = DB::query(
797 797
                     'SELECT id, data
798
-                    FROM ' . prefixTable('categories_items') . '
799
-                    LIMIT ' . $post_start . ', ' . $post_length
798
+                    FROM ' . prefixTable('categories_items').'
799
+                    LIMIT ' . $post_start.', '.$post_length
800 800
                 );
801 801
                 foreach ($rows as $record) {
802 802
                     // backup data
@@ -807,7 +807,7 @@  discard block
 block discarded – undo
807 807
                             'current_field' => 'data',
808 808
                             'value_id' => $record['id'],
809 809
                             'value' => $record['data'],
810
-                            'current_sql' => 'UPDATE ' . prefixTable('categories_items') . " SET data = '" . $record['data'] . "' WHERE id = '" . $record['id'] . "';",
810
+                            'current_sql' => 'UPDATE '.prefixTable('categories_items')." SET data = '".$record['data']."' WHERE id = '".$record['id']."';",
811 811
                             'value2' => 'none',
812 812
                             'result' => 'none',
813 813
                         )
@@ -855,9 +855,9 @@  discard block
 block discarded – undo
855 855
                 // Change all encrypted data in FILES (passwords)
856 856
                 $rows = DB::query(
857 857
                     'SELECT id, file, status
858
-                    FROM ' . prefixTable('files') . "
858
+                    FROM ' . prefixTable('files')."
859 859
                     WHERE status = 'encrypted'
860
-                    LIMIT " . $post_start . ', ' . $post_length
860
+                    LIMIT " . $post_start.', '.$post_length
861 861
                 );
862 862
                 foreach ($rows as $record) {
863 863
                     // backup data
@@ -875,20 +875,20 @@  discard block
 block discarded – undo
875 875
                     );
876 876
                     $newID = DB::insertId();
877 877
 
878
-                    if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['file'])) {
878
+                    if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['file'])) {
879 879
                         // make a copy of file
880 880
                         if (!copy(
881
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
882
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '.copy'
881
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
882
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'.copy'
883 883
                         )) {
884 884
                             $error = 'Copy not possible';
885 885
                             exit;
886 886
                         } else {
887 887
                             // prepare a bck of file (that will not be deleted)
888
-                            $backup_filename = $record['file'] . '.bck-change-sk.' . time();
888
+                            $backup_filename = $record['file'].'.bck-change-sk.'.time();
889 889
                             copy(
890
-                                $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
891
-                                $SETTINGS['path_to_upload_folder'] . '/' . $backup_filename
890
+                                $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
891
+                                $SETTINGS['path_to_upload_folder'].'/'.$backup_filename
892 892
                             );
893 893
                         }
894 894
 
@@ -896,22 +896,22 @@  discard block
 block discarded – undo
896 896
                         // STEP1 - Do decryption
897 897
                         prepareFileWithDefuse(
898 898
                             'decrypt',
899
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
900
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted'
899
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
900
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted'
901 901
                         );
902 902
 
903 903
                         // Do cleanup of files
904
-                        unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['file']);
904
+                        unlink($SETTINGS['path_to_upload_folder'].'/'.$record['file']);
905 905
 
906 906
                         // STEP2 - Do encryption
907 907
                         prepareFileWithDefuse(
908 908
                             'encryp',
909
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted',
910
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file']
909
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted',
910
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file']
911 911
                         );
912 912
 
913 913
                         // Do cleanup of files
914
-                        unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted');
914
+                        unlink($SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted');
915 915
 
916 916
                         // Update backup table
917 917
                         DB::update(
@@ -937,13 +937,13 @@  discard block
 block discarded – undo
937 937
                 // do some things for new object
938 938
                 if (isset($objects[0])) {
939 939
                     if ($objects[0] === 'logs') {
940
-                        DB::query('SELECT increment_id FROM ' . prefixTable('log_items') . " WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
940
+                        DB::query('SELECT increment_id FROM '.prefixTable('log_items')." WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
941 941
                     } elseif ($objects[0] === 'files') {
942
-                        DB::query('SELECT id FROM ' . prefixTable('files'));
942
+                        DB::query('SELECT id FROM '.prefixTable('files'));
943 943
                     } elseif ($objects[0] === 'categories') {
944
-                        DB::query('SELECT id FROM ' . prefixTable('categories_items'));
944
+                        DB::query('SELECT id FROM '.prefixTable('categories_items'));
945 945
                     } elseif ($objects[0] === 'custfields') {
946
-                        DB::query('SELECT raison FROM ' . prefixTable('log_items') . " WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
946
+                        DB::query('SELECT raison FROM '.prefixTable('log_items')." WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
947 947
                     }
948 948
                     $nb_of_items = DB::count();
949 949
                 } else {
@@ -1063,12 +1063,12 @@  discard block
 block discarded – undo
1063 1063
                 );
1064 1064
             } elseif ($record['current_table'] === 'files') {
1065 1065
                 // restore backup file
1066
-                if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value'])) {
1067
-                    unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['value']);
1068
-                    if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value2'])) {
1066
+                if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value'])) {
1067
+                    unlink($SETTINGS['path_to_upload_folder'].'/'.$record['value']);
1068
+                    if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value2'])) {
1069 1069
                         rename(
1070
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['value2'],
1071
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['value']
1070
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['value2'],
1071
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['value']
1072 1072
                         );
1073 1073
                     }
1074 1074
                 }
@@ -1087,7 +1087,7 @@  discard block
 block discarded – undo
1087 1087
         }
1088 1088
 
1089 1089
         // drop table
1090
-        DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
1090
+        DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup'));
1091 1091
 
1092 1092
         // Send back
1093 1093
         echo prepareExchangedData(
@@ -1130,17 +1130,17 @@  discard block
 block discarded – undo
1130 1130
         // delete files
1131 1131
         $rows = DB::query(
1132 1132
             'SELECT value, value2
1133
-            FROM ' . prefixTable('sk_reencrypt_backup') . "
1133
+            FROM ' . prefixTable('sk_reencrypt_backup')."
1134 1134
             WHERE current_table = 'files'"
1135 1135
         );
1136 1136
         foreach ($rows as $record) {
1137
-            if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value2'])) {
1138
-                unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['value2']);
1137
+            if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value2'])) {
1138
+                unlink($SETTINGS['path_to_upload_folder'].'/'.$record['value2']);
1139 1139
             }
1140 1140
         }
1141 1141
 
1142 1142
         // drop table
1143
-        DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
1143
+        DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup'));
1144 1144
 
1145 1145
         echo '[{"status":"done"}]';
1146 1146
         break;
@@ -1171,7 +1171,7 @@  discard block
 block discarded – undo
1171 1171
                 'encode'
1172 1172
             );
1173 1173
         } else {
1174
-            require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1174
+            require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1175 1175
 
1176 1176
             //send email
1177 1177
             $emailSettings = new EmailSettings($SETTINGS);
@@ -1209,13 +1209,13 @@  discard block
 block discarded – undo
1209 1209
             break;
1210 1210
         }
1211 1211
 
1212
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1212
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1213 1213
         $emailSettings = new EmailSettings($SETTINGS);
1214 1214
         $emailService = new EmailService();
1215 1215
 
1216 1216
         $rows = DB::query(
1217 1217
             'SELECT *
1218
-            FROM ' . prefixTable('emails') . '
1218
+            FROM ' . prefixTable('emails').'
1219 1219
             WHERE status = %s OR status = %s',
1220 1220
             'not_sent',
1221 1221
             ''
@@ -1301,13 +1301,13 @@  discard block
 block discarded – undo
1301 1301
             break;
1302 1302
         }
1303 1303
 
1304
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1304
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1305 1305
 
1306 1306
         // Instatiate email settings and service
1307 1307
         $emailSettings = new EmailSettings($SETTINGS);
1308 1308
         $emailService = new EmailService();
1309 1309
 
1310
-        $rows = DB::query('SELECT * FROM ' . prefixTable('emails') . ' WHERE status = %s OR status = %s', 'not_sent', '');
1310
+        $rows = DB::query('SELECT * FROM '.prefixTable('emails').' WHERE status = %s OR status = %s', 'not_sent', '');
1311 1311
         foreach ($rows as $record) {
1312 1312
             //send email
1313 1313
             $email = $emailService->sendMail(
@@ -1376,7 +1376,7 @@  discard block
 block discarded – undo
1376 1376
             break;
1377 1377
         }
1378 1378
 
1379
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1379
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1380 1380
 
1381 1381
         // init
1382 1382
         $filesList = array();
@@ -1389,7 +1389,7 @@  discard block
 block discarded – undo
1389 1389
                 FROM ' . prefixTable('files')
1390 1390
             );
1391 1391
             foreach ($rows as $record) {
1392
-                if (is_file($SETTINGS['path_to_upload_folder'] . '/' . $record['file'])) {
1392
+                if (is_file($SETTINGS['path_to_upload_folder'].'/'.$record['file'])) {
1393 1393
                     $addFile = false;
1394 1394
                     if (($post_option === 'attachments-decrypt' && $record['status'] === 'encrypted')
1395 1395
                         || ($post_option === 'attachments-encrypt' && $record['status'] === 'clear')
@@ -1454,8 +1454,8 @@  discard block
 block discarded – undo
1454 1454
         $post_list = filter_var_array($post_list, FILTER_SANITIZE_FULL_SPECIAL_CHARS);
1455 1455
         $post_counter = filter_var($post_counter, FILTER_SANITIZE_NUMBER_INT);
1456 1456
 
1457
-        include $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
1458
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1457
+        include $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
1458
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1459 1459
 
1460 1460
         $cpt = 0;
1461 1461
         $continu = true;
@@ -1468,33 +1468,33 @@  discard block
 block discarded – undo
1468 1468
                 // Get file name
1469 1469
                 $file_info = DB::queryFirstRow(
1470 1470
                     'SELECT file
1471
-                    FROM ' . prefixTable('files') . '
1471
+                    FROM ' . prefixTable('files').'
1472 1472
                     WHERE id = %i',
1473 1473
                     $file
1474 1474
                 );
1475 1475
 
1476 1476
                 // skip file is Coherancey not respected
1477
-                if (is_file($SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'])) {
1477
+                if (is_file($SETTINGS['path_to_upload_folder'].'/'.$file_info['file'])) {
1478 1478
                     // Case where we want to decrypt
1479 1479
                     if ($post_option === 'decrypt') {
1480 1480
                         prepareFileWithDefuse(
1481 1481
                             'decrypt',
1482
-                            $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'],
1483
-                            $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
1482
+                            $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'],
1483
+                            $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
1484 1484
                         );
1485 1485
                         // Case where we want to encrypt
1486 1486
                     } elseif ($post_option === 'encrypt') {
1487 1487
                         prepareFileWithDefuse(
1488 1488
                             'encrypt',
1489
-                            $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'],
1490
-                            $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
1489
+                            $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'],
1490
+                            $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
1491 1491
                         );
1492 1492
                     }
1493 1493
                     // Do file cleanup
1494
-                    fileDelete($SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'], $SETTINGS);
1494
+                    fileDelete($SETTINGS['path_to_upload_folder'].'/'.$file_info['file'], $SETTINGS);
1495 1495
                     rename(
1496
-                        $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
1497
-                        $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file']
1496
+                        $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
1497
+                        $SETTINGS['path_to_upload_folder'].'/'.$file_info['file']
1498 1498
                     );
1499 1499
 
1500 1500
                     // store in DB
@@ -1529,8 +1529,8 @@  discard block
 block discarded – undo
1529 1529
                 $post_option === 'attachments-decrypt' ? 'clear' : 'encrypted'
1530 1530
             );
1531 1531
 
1532
-            $message = $lang->get('last_execution') . ' ' .
1533
-                date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
1532
+            $message = $lang->get('last_execution').' '.
1533
+                date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
1534 1534
                 '<i class="fas fa-check text-success ml-2 mr-3"></i>';
1535 1535
         }
1536 1536
 
@@ -1620,7 +1620,7 @@  discard block
 block discarded – undo
1620 1620
             $post_id = filter_var($dataReceived['id'], FILTER_SANITIZE_NUMBER_INT);
1621 1621
 
1622 1622
             DB::query(
1623
-                'DELETE FROM ' . prefixTable('api') . ' WHERE increment_id = %i',
1623
+                'DELETE FROM '.prefixTable('api').' WHERE increment_id = %i',
1624 1624
                 $post_id
1625 1625
             );
1626 1626
         }
@@ -1715,7 +1715,7 @@  discard block
 block discarded – undo
1715 1715
             // Delete existing key
1716 1716
         } elseif (null !== $post_action && $post_action === 'delete') {
1717 1717
             $post_id = filter_var($dataReceived['id'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
1718
-            DB::query('DELETE FROM ' . prefixTable('api') . ' WHERE increment_id=%i', $post_id);
1718
+            DB::query('DELETE FROM '.prefixTable('api').' WHERE increment_id=%i', $post_id);
1719 1719
         }
1720 1720
 
1721 1721
         echo prepareExchangedData(
@@ -1730,7 +1730,7 @@  discard block
 block discarded – undo
1730 1730
 
1731 1731
     case 'save_api_status':
1732 1732
         // Do query
1733
-        DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'api');
1733
+        DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'api');
1734 1734
         $counter = DB::count();
1735 1735
         if ($counter === 0) {
1736 1736
             DB::insert(
@@ -1759,7 +1759,7 @@  discard block
 block discarded – undo
1759 1759
 
1760 1760
     case 'run_duo_config_check':
1761 1761
         //Libraries call
1762
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1762
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1763 1763
         // Check KEY
1764 1764
         if ($post_key !== $session->get('key')) {
1765 1765
             echo prepareExchangedData(
@@ -1865,7 +1865,7 @@  discard block
 block discarded – undo
1865 1865
         } else {
1866 1866
             $tmp = 1;
1867 1867
         }
1868
-        DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'google_authentication');
1868
+        DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'google_authentication');
1869 1869
         $counter = DB::count();
1870 1870
         if ($counter === 0) {
1871 1871
             DB::insert(
@@ -1893,7 +1893,7 @@  discard block
 block discarded – undo
1893 1893
 
1894 1894
         // ga_website_name
1895 1895
         if (is_null($dataReceived['ga_website_name']) === false) {
1896
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'ga_website_name');
1896
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'ga_website_name');
1897 1897
             $counter = DB::count();
1898 1898
             if ($counter === 0) {
1899 1899
                 DB::insert(
@@ -1923,7 +1923,7 @@  discard block
 block discarded – undo
1923 1923
         }
1924 1924
 
1925 1925
         // send data
1926
-        echo '[{"result" : "' . addslashes($lang['done']) . '" , "error" : ""}]';
1926
+        echo '[{"result" : "'.addslashes($lang['done']).'" , "error" : ""}]';
1927 1927
         break;
1928 1928
 
1929 1929
     case 'save_agses_options':
@@ -1946,7 +1946,7 @@  discard block
 block discarded – undo
1946 1946
 
1947 1947
         // agses_hosted_url
1948 1948
         if (!is_null($dataReceived['agses_hosted_url'])) {
1949
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_url');
1949
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_url');
1950 1950
             $counter = DB::count();
1951 1951
             if ($counter === 0) {
1952 1952
                 DB::insert(
@@ -1977,7 +1977,7 @@  discard block
 block discarded – undo
1977 1977
 
1978 1978
         // agses_hosted_id
1979 1979
         if (!is_null($dataReceived['agses_hosted_id'])) {
1980
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_id');
1980
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_id');
1981 1981
             $counter = DB::count();
1982 1982
             if ($counter === 0) {
1983 1983
                 DB::insert(
@@ -2008,7 +2008,7 @@  discard block
 block discarded – undo
2008 2008
 
2009 2009
         // agses_hosted_apikey
2010 2010
         if (!is_null($dataReceived['agses_hosted_apikey'])) {
2011
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_apikey');
2011
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_apikey');
2012 2012
             $counter = DB::count();
2013 2013
             if ($counter === 0) {
2014 2014
                 DB::insert(
@@ -2038,7 +2038,7 @@  discard block
 block discarded – undo
2038 2038
         }
2039 2039
 
2040 2040
         // send data
2041
-        echo '[{"result" : "' . addslashes($lang['done']) . '" , "error" : ""}]';
2041
+        echo '[{"result" : "'.addslashes($lang['done']).'" , "error" : ""}]';
2042 2042
         break;
2043 2043
 
2044 2044
     case 'save_option_change':
@@ -2079,7 +2079,7 @@  discard block
 block discarded – undo
2079 2079
 
2080 2080
         // Check if setting is already in DB. If NO then insert, if YES then update.
2081 2081
         $data = DB::query(
2082
-            'SELECT * FROM ' . prefixTable('misc') . '
2082
+            'SELECT * FROM '.prefixTable('misc').'
2083 2083
             WHERE type = %s AND intitule = %s',
2084 2084
             'admin',
2085 2085
             $post_field
@@ -2102,7 +2102,7 @@  discard block
 block discarded – undo
2102 2102
                     array(
2103 2103
                         'valeur' => time(),
2104 2104
                         'type' => 'admin',
2105
-                        'intitule' => $post_field . '_time',
2105
+                        'intitule' => $post_field.'_time',
2106 2106
                         'updated_at' => time(),
2107 2107
                     )
2108 2108
                 );
@@ -2124,10 +2124,10 @@  discard block
 block discarded – undo
2124 2124
             if ($post_field === 'send_stats') {
2125 2125
                 // Check if previous time exists, if not them insert this value in DB
2126 2126
                 DB::query(
2127
-                    'SELECT * FROM ' . prefixTable('misc') . '
2127
+                    'SELECT * FROM '.prefixTable('misc').'
2128 2128
                     WHERE type = %s AND intitule = %s',
2129 2129
                     'admin',
2130
-                    $post_field . '_time'
2130
+                    $post_field.'_time'
2131 2131
                 );
2132 2132
                 $counter = DB::count();
2133 2133
                 if ($counter === 0) {
@@ -2136,7 +2136,7 @@  discard block
 block discarded – undo
2136 2136
                         array(
2137 2137
                             'valeur' => 0,
2138 2138
                             'type' => 'admin',
2139
-                            'intitule' => $post_field . '_time',
2139
+                            'intitule' => $post_field.'_time',
2140 2140
                             'created_at' => time(),
2141 2141
                         )
2142 2142
                     );
@@ -2158,13 +2158,13 @@  discard block
 block discarded – undo
2158 2158
         // special Cases
2159 2159
         if ($post_field === 'cpassman_url') {
2160 2160
             // update also jsUrl for CSFP protection
2161
-            $jsUrl = $post_value . '/includes/libraries/csrfp/js/csrfprotector.js';
2161
+            $jsUrl = $post_value.'/includes/libraries/csrfp/js/csrfprotector.js';
2162 2162
             $csrfp_file = '../includes/libraries/csrfp/libs/csrfp.config.php';
2163 2163
             $data = file_get_contents($csrfp_file);
2164 2164
             $posJsUrl = strpos($data, '"jsUrl" => "');
2165 2165
             $posEndLine = strpos($data, '",', $posJsUrl);
2166 2166
             $line = substr($data, $posJsUrl, ($posEndLine - $posJsUrl + 2));
2167
-            $newdata = str_replace($line, '"jsUrl" => "' . filter_var($jsUrl, FILTER_SANITIZE_FULL_SPECIAL_CHARS) . '",', $data);
2167
+            $newdata = str_replace($line, '"jsUrl" => "'.filter_var($jsUrl, FILTER_SANITIZE_FULL_SPECIAL_CHARS).'",', $data);
2168 2168
             file_put_contents($csrfp_file, $newdata);
2169 2169
         } elseif ($post_field === 'restricted_to_input' && (int) $post_value === 0) {
2170 2170
             DB::update(
@@ -2183,7 +2183,7 @@  discard block
 block discarded – undo
2183 2183
         echo prepareExchangedData(
2184 2184
             array(
2185 2185
                 'error' => false,
2186
-                'misc' => $counter . ' ; ' . $SETTINGS[$post_field],
2186
+                'misc' => $counter.' ; '.$SETTINGS[$post_field],
2187 2187
                 'message' => empty($post_translate) === false ? $lang->get($post_translate) : '',
2188 2188
             ),
2189 2189
             'encode'
@@ -2226,7 +2226,7 @@  discard block
 block discarded – undo
2226 2226
 
2227 2227
         // send statistics
2228 2228
         if (null !== $post_status) {
2229
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'send_stats');
2229
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'send_stats');
2230 2230
             $counter = DB::count();
2231 2231
             if ($counter === 0) {
2232 2232
                 DB::insert(
@@ -2257,7 +2257,7 @@  discard block
 block discarded – undo
2257 2257
 
2258 2258
         // send statistics items
2259 2259
         if (null !== $post_list) {
2260
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'send_statistics_items');
2260
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'send_statistics_items');
2261 2261
             $counter = DB::count();
2262 2262
             if ($counter === 0) {
2263 2263
                 DB::insert(
@@ -2303,7 +2303,7 @@  discard block
 block discarded – undo
2303 2303
             break;
2304 2304
         }
2305 2305
 
2306
-        if (DB::query("SHOW TABLES LIKE '" . prefixTable('sk_reencrypt_backup') . "'")) {
2306
+        if (DB::query("SHOW TABLES LIKE '".prefixTable('sk_reencrypt_backup')."'")) {
2307 2307
             if (DB::count() === 1) {
2308 2308
                 echo 1;
2309 2309
             } else {
@@ -2364,7 +2364,7 @@  discard block
 block discarded – undo
2364 2364
 
2365 2365
         $rows = DB::query(
2366 2366
             'SELECT id, title
2367
-                FROM ' . prefixTable('roles_title') . '
2367
+                FROM ' . prefixTable('roles_title').'
2368 2368
                 ORDER BY title ASC'
2369 2369
         );
2370 2370
         foreach ($rows as $record) {
@@ -2496,7 +2496,7 @@  discard block
 block discarded – undo
2496 2496
 
2497 2497
         $ignoredFiles = DB::queryFirstField(
2498 2498
             'SELECT valeur 
2499
-            FROM ' . prefixTable('misc') . ' 
2499
+            FROM ' . prefixTable('misc').' 
2500 2500
             WHERE type = %s AND intitule = %s',
2501 2501
             'admin',
2502 2502
             'ignored_unknown_files'
@@ -2539,7 +2539,7 @@  discard block
 block discarded – undo
2539 2539
         // Get ignored unknown files
2540 2540
         $existingData = DB::queryFirstRow(
2541 2541
             'SELECT valeur 
2542
-            FROM ' . prefixTable('misc') . ' 
2542
+            FROM ' . prefixTable('misc').' 
2543 2543
             WHERE type = %s AND intitule = %s',
2544 2544
             'admin',
2545 2545
             'ignored_unknown_files'
@@ -2596,7 +2596,7 @@  discard block
 block discarded – undo
2596 2596
         // Get the list of files to delete
2597 2597
         $filesToDelete = DB::queryFirstField(
2598 2598
             'SELECT valeur 
2599
-            FROM ' . prefixTable('misc') . ' 
2599
+            FROM ' . prefixTable('misc').' 
2600 2600
             WHERE type = %s AND intitule = %s',
2601 2601
             'admin',
2602 2602
             'unknown_files'
@@ -2642,7 +2642,7 @@  discard block
 block discarded – undo
2642 2642
         // Get some TP USER info
2643 2643
         $userInfo = DB::queryFirstRow(
2644 2644
             'SELECT id, public_key, private_key, pw
2645
-            FROM ' . prefixTable('users') . ' 
2645
+            FROM ' . prefixTable('users').' 
2646 2646
             WHERE id = %i',
2647 2647
             TP_USER_ID,
2648 2648
         );
@@ -2688,8 +2688,8 @@  discard block
 block discarded – undo
2688 2688
 
2689 2689
         $users = DB::query(
2690 2690
             'SELECT u.id, u.public_key, a.increment_id
2691
-            FROM ' . prefixTable('users') . ' AS u
2692
-            LEFT JOIN ' . prefixTable('api') . ' AS a 
2691
+            FROM ' . prefixTable('users').' AS u
2692
+            LEFT JOIN ' . prefixTable('api').' AS a 
2693 2693
                 ON a.user_id = u.id AND a.type = %s
2694 2694
             WHERE u.disabled = %i AND u.deleted_at IS NULL AND u.public_key IS NOT NULL AND u.admin = %i
2695 2695
             ORDER BY u.login ASC',
@@ -2793,40 +2793,40 @@  discard block
 block discarded – undo
2793 2793
     
2794 2794
     // Users statistics
2795 2795
     $usersActive = DB::queryFirstField(
2796
-        'SELECT COUNT(*) FROM ' . prefixTable('users') . ' 
2796
+        'SELECT COUNT(*) FROM '.prefixTable('users').' 
2797 2797
         WHERE disabled = %i AND deleted_at IS NULL',
2798 2798
         0
2799 2799
     );
2800 2800
     
2801 2801
     $usersOnline = DB::queryFirstField(
2802
-        'SELECT COUNT(*) FROM ' . prefixTable('users') . ' 
2802
+        'SELECT COUNT(*) FROM '.prefixTable('users').' 
2803 2803
         WHERE session_end > %i AND disabled = %i',
2804 2804
         time(),
2805 2805
         0
2806 2806
     );
2807 2807
     
2808 2808
     $usersBlocked = DB::queryFirstField(
2809
-        'SELECT COUNT(*) FROM ' . prefixTable('users') . ' 
2809
+        'SELECT COUNT(*) FROM '.prefixTable('users').' 
2810 2810
         WHERE disabled = %i AND deleted_at IS NULL',
2811 2811
         1
2812 2812
     );
2813 2813
     
2814 2814
     // Items statistics
2815 2815
     $itemsTotal = DB::queryFirstField(
2816
-        'SELECT COUNT(*) FROM ' . prefixTable('items') . ' 
2816
+        'SELECT COUNT(*) FROM '.prefixTable('items').' 
2817 2817
         WHERE inactif = %i AND deleted_at IS NULL',
2818 2818
         0
2819 2819
     );
2820 2820
     
2821 2821
     $itemsShared = DB::queryFirstField(
2822
-        'SELECT COUNT(*) FROM ' . prefixTable('items') . ' 
2822
+        'SELECT COUNT(*) FROM '.prefixTable('items').' 
2823 2823
         WHERE inactif = %i AND perso = %i AND deleted_at IS NULL',
2824 2824
         0,
2825 2825
         0
2826 2826
     );
2827 2827
     
2828 2828
     $itemsPersonal = DB::queryFirstField(
2829
-        'SELECT COUNT(*) FROM ' . prefixTable('items') . ' 
2829
+        'SELECT COUNT(*) FROM '.prefixTable('items').' 
2830 2830
         WHERE inactif = %i AND perso = %i AND deleted_at IS NULL',
2831 2831
         0,
2832 2832
         1
@@ -2834,17 +2834,17 @@  discard block
 block discarded – undo
2834 2834
     
2835 2835
     // Folders statistics
2836 2836
     $foldersTotal = DB::queryFirstField(
2837
-        'SELECT COUNT(*) FROM ' . prefixTable('nested_tree')
2837
+        'SELECT COUNT(*) FROM '.prefixTable('nested_tree')
2838 2838
     );
2839 2839
     
2840 2840
     $foldersPublic = DB::queryFirstField(
2841
-        'SELECT COUNT(*) FROM ' . prefixTable('nested_tree') . ' 
2841
+        'SELECT COUNT(*) FROM '.prefixTable('nested_tree').' 
2842 2842
         WHERE personal_folder = %i',
2843 2843
         0
2844 2844
     );
2845 2845
     
2846 2846
     $foldersPersonal = DB::queryFirstField(
2847
-        'SELECT COUNT(*) FROM ' . prefixTable('nested_tree') . ' 
2847
+        'SELECT COUNT(*) FROM '.prefixTable('nested_tree').' 
2848 2848
         WHERE personal_folder = %i',
2849 2849
         1
2850 2850
     );
@@ -2853,20 +2853,20 @@  discard block
 block discarded – undo
2853 2853
     $timestamp24h = time() - 86400;
2854 2854
     
2855 2855
     $logsActions = DB::queryFirstField(
2856
-        'SELECT COUNT(*) FROM ' . prefixTable('log_items') . ' 
2856
+        'SELECT COUNT(*) FROM '.prefixTable('log_items').' 
2857 2857
         WHERE date > %i',
2858 2858
         $timestamp24h
2859 2859
     );
2860 2860
     
2861 2861
     $logsAccesses = DB::queryFirstField(
2862
-        'SELECT COUNT(*) FROM ' . prefixTable('log_items') . ' 
2862
+        'SELECT COUNT(*) FROM '.prefixTable('log_items').' 
2863 2863
         WHERE date > %i AND action = %s',
2864 2864
         $timestamp24h,
2865 2865
         'at_shown'
2866 2866
     );
2867 2867
     
2868 2868
     $logsErrors = DB::queryFirstField(
2869
-        'SELECT COUNT(*) FROM ' . prefixTable('log_system') . ' 
2869
+        'SELECT COUNT(*) FROM '.prefixTable('log_system').' 
2870 2870
         WHERE date > %i AND type = %s',
2871 2871
         $timestamp24h,
2872 2872
         'error'
@@ -2923,9 +2923,9 @@  discard block
 block discarded – undo
2923 2923
     
2924 2924
     $activities = DB::query(
2925 2925
         'SELECT l.date, l.id_user, u.login, l.action, l.raison, l.id_item, i.label 
2926
-        FROM ' . prefixTable('log_items') . ' AS l
2927
-        LEFT JOIN ' . prefixTable('users') . ' AS u ON l.id_user = u.id
2928
-        LEFT JOIN ' . prefixTable('items') . ' AS i ON l.id_item = i.id
2926
+        FROM ' . prefixTable('log_items').' AS l
2927
+        LEFT JOIN ' . prefixTable('users').' AS u ON l.id_user = u.id
2928
+        LEFT JOIN ' . prefixTable('items').' AS i ON l.id_item = i.id
2929 2929
         WHERE l.date > %i
2930 2930
         ORDER BY l.date DESC
2931 2931
         LIMIT 10',
@@ -2999,13 +2999,13 @@  discard block
 block discarded – undo
2999 2999
         
3000 3000
     // Tasks queue count
3001 3001
     $tasksQueue = DB::queryFirstField(
3002
-        'SELECT COUNT(*) FROM ' . prefixTable('background_tasks') . ' 
3002
+        'SELECT COUNT(*) FROM '.prefixTable('background_tasks').' 
3003 3003
         WHERE finished_at IS NULL OR finished_at = 0'
3004 3004
     );
3005 3005
     
3006 3006
     // Last cron execution
3007 3007
     $lastCronLog = DB::queryFirstRow(
3008
-        'SELECT created_at FROM ' . prefixTable('background_tasks_logs') . ' 
3008
+        'SELECT created_at FROM '.prefixTable('background_tasks_logs').' 
3009 3009
         ORDER BY created_at DESC 
3010 3010
         LIMIT 1'
3011 3011
     );
@@ -3014,13 +3014,13 @@  discard block
 block discarded – undo
3014 3014
     if ($lastCronLog && isset($lastCronLog['created_at'])) {
3015 3015
         $timeDiff = time() - (int) $lastCronLog['created_at'];
3016 3016
         if ($timeDiff < 60) {
3017
-            $lastCronText = $timeDiff . 's ' . $lang->get('ago');
3017
+            $lastCronText = $timeDiff.'s '.$lang->get('ago');
3018 3018
         } elseif ($timeDiff < 3600) {
3019
-            $lastCronText = floor($timeDiff / 60) . 'm ' . $lang->get('ago');
3019
+            $lastCronText = floor($timeDiff / 60).'m '.$lang->get('ago');
3020 3020
         } elseif ($timeDiff < 86400) {
3021
-            $lastCronText = floor($timeDiff / 3600) . 'h ' . $lang->get('ago');
3021
+            $lastCronText = floor($timeDiff / 3600).'h '.$lang->get('ago');
3022 3022
         } else {
3023
-            $lastCronText = floor($timeDiff / 86400) . 'd ' . $lang->get('ago');
3023
+            $lastCronText = floor($timeDiff / 86400).'d '.$lang->get('ago');
3024 3024
         }
3025 3025
     }
3026 3026
     
@@ -3056,14 +3056,14 @@  discard block
 block discarded – undo
3056 3056
     $encryptionText = $lang->get('health_status_ok');
3057 3057
     
3058 3058
     // Check if secure file exists
3059
-    if (isset($SETTINGS['securepath']) && isset($SETTINGS['securefile']) && !file_exists($SETTINGS['securepath'] . DIRECTORY_SEPARATOR . $SETTINGS['securefile'])) {
3059
+    if (isset($SETTINGS['securepath']) && isset($SETTINGS['securefile']) && !file_exists($SETTINGS['securepath'].DIRECTORY_SEPARATOR.$SETTINGS['securefile'])) {
3060 3060
         $encryptionStatus = 'danger';
3061 3061
         $encryptionText = $lang->get('health_secure_file_missing');
3062 3062
     }
3063 3063
     
3064 3064
     // Active sessions count
3065 3065
     $sessionsCount = DB::queryFirstField(
3066
-        'SELECT COUNT(*) FROM ' . prefixTable('users') . ' 
3066
+        'SELECT COUNT(*) FROM '.prefixTable('users').' 
3067 3067
         WHERE session_end > %i',
3068 3068
         time()
3069 3069
     );
@@ -3071,7 +3071,7 @@  discard block
 block discarded – undo
3071 3071
     // Is cron installed
3072 3072
     DB::query(
3073 3073
         'SELECT valeur
3074
-        FROM ' . prefixTable('misc') . '
3074
+        FROM ' . prefixTable('misc').'
3075 3075
         WHERE type = %s AND intitule = %s and valeur >= %d',
3076 3076
         'admin',
3077 3077
         'last_cron_exec',
@@ -3084,7 +3084,7 @@  discard block
 block discarded – undo
3084 3084
     } else {
3085 3085
         // Cron check (last execution should be < 2 minutes ago)
3086 3086
         $lastCron = DB::queryFirstField(
3087
-            'SELECT created_at FROM ' . prefixTable('background_tasks_logs') . ' 
3087
+            'SELECT created_at FROM '.prefixTable('background_tasks_logs').' 
3088 3088
             ORDER BY created_at DESC 
3089 3089
             LIMIT 1'
3090 3090
         );
@@ -3100,7 +3100,7 @@  discard block
 block discarded – undo
3100 3100
     
3101 3101
     // Unknown files count
3102 3102
     $unknownFilesData = DB::queryFirstField(
3103
-        'SELECT valeur FROM ' . prefixTable('misc') . ' 
3103
+        'SELECT valeur FROM '.prefixTable('misc').' 
3104 3104
         WHERE type = %s AND intitule = %s',
3105 3105
         'admin',
3106 3106
         'unknown_files'
@@ -3180,7 +3180,7 @@  discard block
 block discarded – undo
3180 3180
         'clean_old_logs',
3181 3181
         (string) $session->get('user-id'),
3182 3182
         $session->get('user-login'),
3183
-        'Cleaned ' . $totalDeleted . ' old log entries'
3183
+        'Cleaned '.$totalDeleted.' old log entries'
3184 3184
     );
3185 3185
     
3186 3186
     echo prepareExchangedData(
@@ -3209,21 +3209,21 @@  discard block
 block discarded – undo
3209 3209
     
3210 3210
     try {
3211 3211
         // Test string
3212
-        $testString = 'TeamPass Encryption Test ' . time();
3212
+        $testString = 'TeamPass Encryption Test '.time();
3213 3213
         
3214 3214
         // Get encryption key
3215
-        $key = file_get_contents($SETTINGS['securepath'] . DIRECTORY_SEPARATOR . $SETTINGS['securefile']);
3215
+        $key = file_get_contents($SETTINGS['securepath'].DIRECTORY_SEPARATOR.$SETTINGS['securefile']);
3216 3216
         
3217 3217
         if ($key === false) {
3218 3218
             throw new Exception($lang->get('admin_encryption_key_not_found'));
3219 3219
         }
3220 3220
         
3221 3221
         // Use Defuse encryption (TeamPass's current encryption method)
3222
-        require_once $SETTINGS['cpassman_dir'] . '/vendor/defuse/php-encryption/src/Exception/EnvironmentIsBrokenException.php';
3223
-        require_once $SETTINGS['cpassman_dir'] . '/vendor/defuse/php-encryption/src/Exception/BadFormatException.php';
3224
-        require_once $SETTINGS['cpassman_dir'] . '/vendor/defuse/php-encryption/src/Exception/WrongKeyOrModifiedCiphertextException.php';
3225
-        require_once $SETTINGS['cpassman_dir'] . '/vendor/defuse/php-encryption/src/Crypto.php';
3226
-        require_once $SETTINGS['cpassman_dir'] . '/vendor/defuse/php-encryption/src/Key.php';
3222
+        require_once $SETTINGS['cpassman_dir'].'/vendor/defuse/php-encryption/src/Exception/EnvironmentIsBrokenException.php';
3223
+        require_once $SETTINGS['cpassman_dir'].'/vendor/defuse/php-encryption/src/Exception/BadFormatException.php';
3224
+        require_once $SETTINGS['cpassman_dir'].'/vendor/defuse/php-encryption/src/Exception/WrongKeyOrModifiedCiphertextException.php';
3225
+        require_once $SETTINGS['cpassman_dir'].'/vendor/defuse/php-encryption/src/Crypto.php';
3226
+        require_once $SETTINGS['cpassman_dir'].'/vendor/defuse/php-encryption/src/Key.php';
3227 3227
         
3228 3228
         $encryptionKey = \Defuse\Crypto\Key::loadFromAsciiSafeString($key);
3229 3229
         
@@ -3280,7 +3280,7 @@  discard block
 block discarded – undo
3280 3280
     
3281 3281
     // Set headers for CSV download
3282 3282
     header('Content-Type: text/csv; charset=utf-8');
3283
-    header('Content-Disposition: attachment; filename="teampass_statistics_' . date('Y-m-d_H-i-s') . '.csv"');
3283
+    header('Content-Disposition: attachment; filename="teampass_statistics_'.date('Y-m-d_H-i-s').'.csv"');
3284 3284
     
3285 3285
     // Create output stream
3286 3286
     $output = fopen('php://output', 'w');
@@ -3293,10 +3293,10 @@  discard block
 block discarded – undo
3293 3293
     
3294 3294
     // Gather statistics
3295 3295
     $stats = array(
3296
-        $lang->get('active_users') => DB::queryFirstField('SELECT COUNT(*) FROM ' . prefixTable('users') . ' WHERE disabled = 0'),
3297
-        $lang->get('total_items') => DB::queryFirstField('SELECT COUNT(*) FROM ' . prefixTable('items') . ' WHERE inactif = 0'),
3298
-        $lang->get('total_folders') => DB::queryFirstField('SELECT COUNT(*) FROM ' . prefixTable('nested_tree')),
3299
-        $lang->get('logs_24h') => DB::queryFirstField('SELECT COUNT(*) FROM ' . prefixTable('log_items') . ' WHERE date > ' . (time() - 86400)),
3296
+        $lang->get('active_users') => DB::queryFirstField('SELECT COUNT(*) FROM '.prefixTable('users').' WHERE disabled = 0'),
3297
+        $lang->get('total_items') => DB::queryFirstField('SELECT COUNT(*) FROM '.prefixTable('items').' WHERE inactif = 0'),
3298
+        $lang->get('total_folders') => DB::queryFirstField('SELECT COUNT(*) FROM '.prefixTable('nested_tree')),
3299
+        $lang->get('logs_24h') => DB::queryFirstField('SELECT COUNT(*) FROM '.prefixTable('log_items').' WHERE date > '.(time() - 86400)),
3300 3300
     );
3301 3301
     
3302 3302
     // Write statistics
@@ -3336,9 +3336,9 @@  discard block
 block discarded – undo
3336 3336
             COUNT(*) as total_users,
3337 3337
             SUM(CASE WHEN personal_items_migrated = 1 THEN 1 ELSE 0 END) as migrated_users,
3338 3338
             SUM(CASE WHEN personal_items_migrated = 0 THEN 1 ELSE 0 END) as pending_users
3339
-        FROM " . prefixTable('users') . "
3339
+        FROM " . prefixTable('users')."
3340 3340
         WHERE disabled = 0 AND deleted_at IS NULL AND id NOT IN %li",
3341
-        [TP_USER_ID, API_USER_ID, OTV_USER_ID,SSH_USER_ID]
3341
+        [TP_USER_ID, API_USER_ID, OTV_USER_ID, SSH_USER_ID]
3342 3342
     );
3343 3343
 
3344 3344
     $progressPercent = ($stats[0]['migrated_users'] / $stats[0]['total_users']) * 100;
@@ -3350,7 +3350,7 @@  discard block
 block discarded – undo
3350 3350
         WHERE personal_items_migrated = 0
3351 3351
         AND disabled = 0 AND deleted_at IS NULL AND id NOT IN %li
3352 3352
         ORDER BY last_connexion DESC",
3353
-        [TP_USER_ID, API_USER_ID, OTV_USER_ID,SSH_USER_ID]
3353
+        [TP_USER_ID, API_USER_ID, OTV_USER_ID, SSH_USER_ID]
3354 3354
     );
3355 3355
 
3356 3356
     // Get users ready
@@ -3360,7 +3360,7 @@  discard block
 block discarded – undo
3360 3360
         WHERE personal_items_migrated = 1
3361 3361
         AND disabled = 0 AND deleted_at IS NULL AND id NOT IN %li
3362 3362
         ORDER BY last_connexion DESC",
3363
-        [TP_USER_ID, API_USER_ID, OTV_USER_ID,SSH_USER_ID]
3363
+        [TP_USER_ID, API_USER_ID, OTV_USER_ID, SSH_USER_ID]
3364 3364
     );
3365 3365
 
3366 3366
     return [
@@ -3384,7 +3384,7 @@  discard block
 block discarded – undo
3384 3384
 {
3385 3385
     // Count auto-recoveries in last 24h
3386 3386
     $autoRecoveriesLast24h = DB::queryFirstField(
3387
-        'SELECT COUNT(*) FROM ' . prefixTable('log_system') . '
3387
+        'SELECT COUNT(*) FROM '.prefixTable('log_system').'
3388 3388
          WHERE label = %s
3389 3389
          AND date > %i',
3390 3390
         'auto_reencryption_success',
@@ -3393,21 +3393,21 @@  discard block
 block discarded – undo
3393 3393
 
3394 3394
     // Count failed recoveries (all time)
3395 3395
     $failedRecoveries = DB::queryFirstField(
3396
-        'SELECT COUNT(*) FROM ' . prefixTable('log_system') . '
3396
+        'SELECT COUNT(*) FROM '.prefixTable('log_system').'
3397 3397
          WHERE label = %s',
3398 3398
         'auto_reencryption_failed'
3399 3399
     );
3400 3400
 
3401 3401
     // Count critical failures (all time)
3402 3402
     $criticalFailures = DB::queryFirstField(
3403
-        'SELECT COUNT(*) FROM ' . prefixTable('log_system') . '
3403
+        'SELECT COUNT(*) FROM '.prefixTable('log_system').'
3404 3404
          WHERE label = %s',
3405 3405
         'auto_reencryption_critical_failure'
3406 3406
     );
3407 3407
 
3408 3408
     // Count users with transparent recovery enabled (have seed and backup)
3409 3409
     $usersMigrated = DB::queryFirstField(
3410
-        'SELECT COUNT(*) FROM ' . prefixTable('users') . '
3410
+        'SELECT COUNT(*) FROM '.prefixTable('users').'
3411 3411
          WHERE user_derivation_seed IS NOT NULL
3412 3412
          AND private_key_backup IS NOT NULL
3413 3413
          AND disabled = 0'
@@ -3415,7 +3415,7 @@  discard block
 block discarded – undo
3415 3415
 
3416 3416
     // Count total active users
3417 3417
     $totalUsers = DB::queryFirstField(
3418
-        'SELECT COUNT(*) FROM ' . prefixTable('users') . '
3418
+        'SELECT COUNT(*) FROM '.prefixTable('users').'
3419 3419
          WHERE disabled = 0
3420 3420
          AND private_key IS NOT NULL
3421 3421
          AND private_key != "none"'
@@ -3424,8 +3424,8 @@  discard block
 block discarded – undo
3424 3424
     // Get recent recovery events (last 10)
3425 3425
     $recentEvents = DB::query(
3426 3426
         'SELECT l.date, l.label, l.qui, u.login
3427
-         FROM ' . prefixTable('log_system') . ' AS l
3428
-         INNER JOIN ' . prefixTable('users') . ' AS u ON u.id = l.qui
3427
+         FROM ' . prefixTable('log_system').' AS l
3428
+         INNER JOIN ' . prefixTable('users').' AS u ON u.id = l.qui
3429 3429
          WHERE l.label IN %ls
3430 3430
          ORDER BY l.date DESC
3431 3431
          LIMIT 10',
@@ -3437,7 +3437,7 @@  discard block
 block discarded – undo
3437 3437
 
3438 3438
     // Calculate failure rate (last 30 days)
3439 3439
     $totalAttempts30d = DB::queryFirstField(
3440
-        'SELECT COUNT(*) FROM ' . prefixTable('log_system') . '
3440
+        'SELECT COUNT(*) FROM '.prefixTable('log_system').'
3441 3441
          WHERE label IN %ls
3442 3442
          AND date > %i',
3443 3443
         ['auto_reencryption_success', 'auto_reencryption_failed'],
@@ -3445,7 +3445,7 @@  discard block
 block discarded – undo
3445 3445
     );
3446 3446
 
3447 3447
     $failures30d = DB::queryFirstField(
3448
-        'SELECT COUNT(*) FROM ' . prefixTable('log_system') . '
3448
+        'SELECT COUNT(*) FROM '.prefixTable('log_system').'
3449 3449
          WHERE label = %s
3450 3450
          AND date > %i',
3451 3451
         'auto_reencryption_failed',
@@ -3482,7 +3482,7 @@  discard block
 block discarded – undo
3482 3482
     $lang = new Language($session->get('user-language') ?? 'english');
3483 3483
 
3484 3484
     $results = [];
3485
-    $fullPath = __DIR__ . '/../';
3485
+    $fullPath = __DIR__.'/../';
3486 3486
     
3487 3487
     foreach ($files as $file) {
3488 3488
         // Normalize path separators for cross-platform compatibility
@@ -3531,7 +3531,7 @@  discard block
 block discarded – undo
3531 3531
         }
3532 3532
         
3533 3533
         // Try to delete the file
3534
-        $deleteResult = '';//@unlink($normalizedPath);
3534
+        $deleteResult = ''; //@unlink($normalizedPath);
3535 3535
         
3536 3536
         if ($deleteResult) {
3537 3537
             $results[$normalizedPath] = [
@@ -3561,7 +3561,7 @@  discard block
 block discarded – undo
3561 3561
  */
3562 3562
 function filesIntegrityCheck($baseDir): array
3563 3563
 {
3564
-    $referenceFile = __DIR__ . '/../files_reference.txt';
3564
+    $referenceFile = __DIR__.'/../files_reference.txt';
3565 3565
 
3566 3566
     $unknownFiles = findUnknownFiles($baseDir, $referenceFile);
3567 3567
 
@@ -3599,7 +3599,7 @@  discard block
 block discarded – undo
3599 3599
                 $dir,
3600 3600
                 FilesystemIterator::SKIP_DOTS
3601 3601
             ),
3602
-            function ($current, $key, $iterator) {
3602
+            function($current, $key, $iterator) {
3603 3603
                 // Ignore hidden files and folders
3604 3604
                 if ($current->getFilename()[0] === '.') {
3605 3605
                     return false;
@@ -3613,7 +3613,7 @@  discard block
 block discarded – undo
3613 3613
     foreach ($iterator as $file) {
3614 3614
         try {
3615 3615
             if ($file->isFile()) {
3616
-                $relativePath = str_replace($dir . DIRECTORY_SEPARATOR, '', $file->getPathname());
3616
+                $relativePath = str_replace($dir.DIRECTORY_SEPARATOR, '', $file->getPathname());
3617 3617
                 $relativePath = str_replace('\\', '/', $relativePath); // Normalisation Windows/Linux
3618 3618
 
3619 3619
                 // Split relatif path into parts
@@ -3679,7 +3679,7 @@  discard block
 block discarded – undo
3679 3679
     // Get ignored files
3680 3680
     $ignoredFiles = DB::queryFirstField(
3681 3681
         'SELECT valeur 
3682
-        FROM ' . prefixTable('misc') . ' 
3682
+        FROM ' . prefixTable('misc').' 
3683 3683
         WHERE type = %s AND intitule = %s',
3684 3684
         'admin',
3685 3685
         'ignored_unknown_files'
@@ -3698,7 +3698,7 @@  discard block
 block discarded – undo
3698 3698
 function tablesIntegrityCheck(): array
3699 3699
 {
3700 3700
     // Get integrity tables file
3701
-    $integrityTablesFile = TEAMPASS_ROOT_PATH . '/includes/tables_integrity.json';
3701
+    $integrityTablesFile = TEAMPASS_ROOT_PATH.'/includes/tables_integrity.json';
3702 3702
     if (file_exists($integrityTablesFile) === false) {
3703 3703
         return [
3704 3704
             'error' => true,
@@ -3716,7 +3716,7 @@  discard block
 block discarded – undo
3716 3716
     // Get all tables
3717 3717
     $tables = [];
3718 3718
     foreach (DB::queryFirstColumn("SHOW TABLES") as $table) {
3719
-        $tables[] = str_replace(DB_PREFIX, "", $table);;
3719
+        $tables[] = str_replace(DB_PREFIX, "", $table); ;
3720 3720
     }
3721 3721
     // Prepare the integrity check
3722 3722
     $tablesInError = [];
@@ -3782,7 +3782,7 @@  discard block
 block discarded – undo
3782 3782
 
3783 3783
         // Compare hashes
3784 3784
         $expectedHash = $referenceData[$file];
3785
-        $actualHash = md5_file($baseDir . '/' . $file);
3785
+        $actualHash = md5_file($baseDir.'/'.$file);
3786 3786
 
3787 3787
         if ($expectedHash !== $actualHash) {
3788 3788
             $issues[] = "$file (expected: <i>$expectedHash</i>, actual: <i>$actualHash</i>)";
@@ -3835,7 +3835,7 @@  discard block
 block discarded – undo
3835 3835
     foreach ($iterator as $file) {
3836 3836
         if ($file->isFile()) {
3837 3837
             // Build relative path
3838
-            $relativePath = str_replace($dir . DIRECTORY_SEPARATOR, '', $file->getPathname());
3838
+            $relativePath = str_replace($dir.DIRECTORY_SEPARATOR, '', $file->getPathname());
3839 3839
             $relativePath = str_replace('\\', '/', $relativePath); // Normalize for Windows
3840 3840
             // Calculate hash
3841 3841
             $files[$relativePath] = md5_file($file->getPathname());
@@ -3865,8 +3865,8 @@  discard block
 block discarded – undo
3865 3865
     // Loop on items
3866 3866
     $item = DB::queryFirstRow(
3867 3867
         'SELECT i.id, i.pw, s.share_key, s.increment_id
3868
-        FROM ' . prefixTable('items') . ' i
3869
-        INNER JOIN ' . prefixTable('sharekeys_items') . ' s ON i.id = s.object_id
3868
+        FROM ' . prefixTable('items').' i
3869
+        INNER JOIN ' . prefixTable('sharekeys_items').' s ON i.id = s.object_id
3870 3870
         WHERE i.perso = %i
3871 3871
             AND s.user_id = %i
3872 3872
         ORDER BY RAND()
@@ -3895,7 +3895,7 @@  discard block
 block discarded – undo
3895 3895
         // Get all items in database
3896 3896
         $rows = DB::queryFirstRow(
3897 3897
             'SELECT count(*) as counter
3898
-            FROM ' . prefixTable('sharekeys_items') . ' s
3898
+            FROM ' . prefixTable('sharekeys_items').' s
3899 3899
             WHERE s.user_id = %i',
3900 3900
             TP_USER_ID
3901 3901
         );
Please login to merge, or discard this patch.
Switch Indentation   +246 added lines, -246 removed lines patch added patch discarded remove patch
@@ -2904,8 +2904,8 @@  discard block
 block discarded – undo
2904 2904
 // LIVE ACTIVITY ENDPOINT
2905 2905
 // ========================================
2906 2906
 
2907
-case 'get_live_activity':
2908
-    /**
2907
+    case 'get_live_activity':
2908
+        /**
2909 2909
      * Get recent activity (last 5 minutes, max 10 entries)
2910 2910
      * 
2911 2911
      * @return array [{
@@ -2919,25 +2919,25 @@  discard block
 block discarded – undo
2919 2919
      * }]
2920 2920
      */
2921 2921
     
2922
-    $timestamp5min = time() - 300; // 5 minutes ago
2922
+        $timestamp5min = time() - 300; // 5 minutes ago
2923 2923
     
2924
-    $activities = DB::query(
2925
-        'SELECT l.date, l.id_user, u.login, l.action, l.raison, l.id_item, i.label 
2924
+        $activities = DB::query(
2925
+            'SELECT l.date, l.id_user, u.login, l.action, l.raison, l.id_item, i.label 
2926 2926
         FROM ' . prefixTable('log_items') . ' AS l
2927 2927
         LEFT JOIN ' . prefixTable('users') . ' AS u ON l.id_user = u.id
2928 2928
         LEFT JOIN ' . prefixTable('items') . ' AS i ON l.id_item = i.id
2929 2929
         WHERE l.date > %i
2930 2930
         ORDER BY l.date DESC
2931 2931
         LIMIT 10',
2932
-        $timestamp5min
2933
-    );
2932
+            $timestamp5min
2933
+        );
2934 2934
     
2935
-    $activityList = array();
2935
+        $activityList = array();
2936 2936
     
2937
-    foreach ($activities as $activity) {
2938
-        // Translate action to readable text
2939
-        $actionText = '';
2940
-        switch ($activity['action']) {
2937
+        foreach ($activities as $activity) {
2938
+            // Translate action to readable text
2939
+            $actionText = '';
2940
+            switch ($activity['action']) {
2941 2941
             case 'at_shown':
2942 2942
                 $actionText = $lang->get('action_accessed');
2943 2943
                 break;
@@ -2961,7 +2961,7 @@  discard block
 block discarded – undo
2961 2961
                 break;
2962 2962
             default:
2963 2963
                 $actionText = $activity['action'];
2964
-        }
2964
+            }
2965 2965
         
2966 2966
         $activityList[] = array(
2967 2967
             'timestamp' => (int) $activity['date'],
@@ -2987,8 +2987,8 @@  discard block
 block discarded – undo
2987 2987
 // SYSTEM STATUS ENDPOINT
2988 2988
 // ========================================
2989 2989
 
2990
-case 'get_system_status':
2991
-    /**
2990
+    case 'get_system_status':
2991
+        /**
2992 2992
      * Get system status (tasks queue)
2993 2993
      * 
2994 2994
      * @return array {
@@ -2997,49 +2997,49 @@  discard block
 block discarded – undo
2997 2997
      * }
2998 2998
      */
2999 2999
         
3000
-    // Tasks queue count
3001
-    $tasksQueue = DB::queryFirstField(
3002
-        'SELECT COUNT(*) FROM ' . prefixTable('background_tasks') . ' 
3000
+        // Tasks queue count
3001
+        $tasksQueue = DB::queryFirstField(
3002
+            'SELECT COUNT(*) FROM ' . prefixTable('background_tasks') . ' 
3003 3003
         WHERE finished_at IS NULL OR finished_at = 0'
3004
-    );
3004
+        );
3005 3005
     
3006
-    // Last cron execution
3007
-    $lastCronLog = DB::queryFirstRow(
3008
-        'SELECT created_at FROM ' . prefixTable('background_tasks_logs') . ' 
3006
+        // Last cron execution
3007
+        $lastCronLog = DB::queryFirstRow(
3008
+            'SELECT created_at FROM ' . prefixTable('background_tasks_logs') . ' 
3009 3009
         ORDER BY created_at DESC 
3010 3010
         LIMIT 1'
3011
-    );
3011
+        );
3012 3012
     
3013
-    $lastCronText = $lang->get('never');
3014
-    if ($lastCronLog && isset($lastCronLog['created_at'])) {
3015
-        $timeDiff = time() - (int) $lastCronLog['created_at'];
3016
-        if ($timeDiff < 60) {
3017
-            $lastCronText = $timeDiff . 's ' . $lang->get('ago');
3018
-        } elseif ($timeDiff < 3600) {
3019
-            $lastCronText = floor($timeDiff / 60) . 'm ' . $lang->get('ago');
3020
-        } elseif ($timeDiff < 86400) {
3021
-            $lastCronText = floor($timeDiff / 3600) . 'h ' . $lang->get('ago');
3022
-        } else {
3023
-            $lastCronText = floor($timeDiff / 86400) . 'd ' . $lang->get('ago');
3013
+        $lastCronText = $lang->get('never');
3014
+        if ($lastCronLog && isset($lastCronLog['created_at'])) {
3015
+            $timeDiff = time() - (int) $lastCronLog['created_at'];
3016
+            if ($timeDiff < 60) {
3017
+                $lastCronText = $timeDiff . 's ' . $lang->get('ago');
3018
+            } elseif ($timeDiff < 3600) {
3019
+                $lastCronText = floor($timeDiff / 60) . 'm ' . $lang->get('ago');
3020
+            } elseif ($timeDiff < 86400) {
3021
+                $lastCronText = floor($timeDiff / 3600) . 'h ' . $lang->get('ago');
3022
+            } else {
3023
+                $lastCronText = floor($timeDiff / 86400) . 'd ' . $lang->get('ago');
3024
+            }
3024 3025
         }
3025
-    }
3026 3026
     
3027
-    echo prepareExchangedData(
3028
-        array(
3029
-            'error' => false,
3030
-            'tasks_queue' => (int) $tasksQueue,
3031
-            'last_cron' => $lastCronText,
3032
-        ),
3033
-        'encode'
3034
-    );
3035
-    break;
3027
+        echo prepareExchangedData(
3028
+            array(
3029
+                'error' => false,
3030
+                'tasks_queue' => (int) $tasksQueue,
3031
+                'last_cron' => $lastCronText,
3032
+            ),
3033
+            'encode'
3034
+        );
3035
+        break;
3036 3036
 
3037
-// ========================================
3038
-// SYSTEM HEALTH ENDPOINT
3039
-// ========================================
3037
+    // ========================================
3038
+    // SYSTEM HEALTH ENDPOINT
3039
+    // ========================================
3040 3040
 
3041
-case 'get_system_health':
3042
-    /**
3041
+    case 'get_system_health':
3042
+        /**
3043 3043
      * Get system health checks
3044 3044
      * 
3045 3045
      * @return array {
@@ -3051,97 +3051,97 @@  discard block
 block discarded – undo
3051 3051
      * }
3052 3052
      */
3053 3053
     
3054
-    // Encryption check
3055
-    $encryptionStatus = 'success';
3056
-    $encryptionText = $lang->get('health_status_ok');
3054
+        // Encryption check
3055
+        $encryptionStatus = 'success';
3056
+        $encryptionText = $lang->get('health_status_ok');
3057 3057
     
3058
-    // Check if secure file exists
3059
-    if (isset($SETTINGS['securepath']) && isset($SETTINGS['securefile']) && !file_exists($SETTINGS['securepath'] . DIRECTORY_SEPARATOR . $SETTINGS['securefile'])) {
3060
-        $encryptionStatus = 'danger';
3061
-        $encryptionText = $lang->get('health_secure_file_missing');
3062
-    }
3058
+        // Check if secure file exists
3059
+        if (isset($SETTINGS['securepath']) && isset($SETTINGS['securefile']) && !file_exists($SETTINGS['securepath'] . DIRECTORY_SEPARATOR . $SETTINGS['securefile'])) {
3060
+            $encryptionStatus = 'danger';
3061
+            $encryptionText = $lang->get('health_secure_file_missing');
3062
+        }
3063 3063
     
3064
-    // Active sessions count
3065
-    $sessionsCount = DB::queryFirstField(
3066
-        'SELECT COUNT(*) FROM ' . prefixTable('users') . ' 
3064
+        // Active sessions count
3065
+        $sessionsCount = DB::queryFirstField(
3066
+            'SELECT COUNT(*) FROM ' . prefixTable('users') . ' 
3067 3067
         WHERE session_end > %i',
3068
-        time()
3069
-    );
3068
+            time()
3069
+        );
3070 3070
     
3071
-    // Is cron installed
3072
-    DB::query(
3073
-        'SELECT valeur
3071
+        // Is cron installed
3072
+        DB::query(
3073
+            'SELECT valeur
3074 3074
         FROM ' . prefixTable('misc') . '
3075 3075
         WHERE type = %s AND intitule = %s and valeur >= %d',
3076
-        'admin',
3077
-        'last_cron_exec',
3078
-        time() - 600 // max 10 minutes
3079
-    );
3076
+            'admin',
3077
+            'last_cron_exec',
3078
+            time() - 600 // max 10 minutes
3079
+        );
3080 3080
 
3081
-    if (DB::count() === 0) {
3082
-        $cronStatus = 'danger';
3083
-        $cronText = $lang->get('error');
3084
-    } else {
3085
-        // Cron check (last execution should be < 2 minutes ago)
3086
-        $lastCron = DB::queryFirstField(
3087
-            'SELECT created_at FROM ' . prefixTable('background_tasks_logs') . ' 
3081
+        if (DB::count() === 0) {
3082
+            $cronStatus = 'danger';
3083
+            $cronText = $lang->get('error');
3084
+        } else {
3085
+            // Cron check (last execution should be < 2 minutes ago)
3086
+            $lastCron = DB::queryFirstField(
3087
+                'SELECT created_at FROM ' . prefixTable('background_tasks_logs') . ' 
3088 3088
             ORDER BY created_at DESC 
3089 3089
             LIMIT 1'
3090
-        );
3090
+            );
3091 3091
         
3092
-        $cronStatus = 'success';
3093
-        $cronText = $lang->get('health_status_ok');
3092
+            $cronStatus = 'success';
3093
+            $cronText = $lang->get('health_status_ok');
3094 3094
         
3095
-        if (!$lastCron || (time() - (int) $lastCron) > 120) {
3096
-            $cronStatus = 'warning';
3097
-            $cronText = $lang->get('health_cron_delayed');
3095
+            if (!$lastCron || (time() - (int) $lastCron) > 120) {
3096
+                $cronStatus = 'warning';
3097
+                $cronText = $lang->get('health_cron_delayed');
3098
+            }
3098 3099
         }
3099
-    }
3100 3100
     
3101
-    // Unknown files count
3102
-    $unknownFilesData = DB::queryFirstField(
3103
-        'SELECT valeur FROM ' . prefixTable('misc') . ' 
3101
+        // Unknown files count
3102
+        $unknownFilesData = DB::queryFirstField(
3103
+            'SELECT valeur FROM ' . prefixTable('misc') . ' 
3104 3104
         WHERE type = %s AND intitule = %s',
3105
-        'admin',
3106
-        'unknown_files'
3107
-    );
3105
+            'admin',
3106
+            'unknown_files'
3107
+        );
3108 3108
     
3109
-    $unknownFilesCount = 0;
3110
-    if ($unknownFilesData) {
3111
-        $unknownFiles = json_decode($unknownFilesData, true);
3112
-        if (is_array($unknownFiles)) {
3113
-            $unknownFilesCount = count($unknownFiles);
3109
+        $unknownFilesCount = 0;
3110
+        if ($unknownFilesData) {
3111
+            $unknownFiles = json_decode($unknownFilesData, true);
3112
+            if (is_array($unknownFiles)) {
3113
+                $unknownFilesCount = count($unknownFiles);
3114
+            }
3114 3115
         }
3115
-    }
3116 3116
     
3117
-    echo prepareExchangedData(
3118
-        array(
3119
-            'error' => false,
3120
-            'encryption' => array(
3121
-                'status' => $encryptionStatus,
3122
-                'text' => $encryptionText,
3123
-            ),
3124
-            'sessions' => array(
3125
-                'count' => (int) $sessionsCount,
3126
-            ),
3127
-            'cron' => array(
3128
-                'status' => $cronStatus,
3129
-                'text' => $cronText,
3130
-            ),
3131
-            'unknown_files' => array(
3132
-                'count' => $unknownFilesCount,
3117
+        echo prepareExchangedData(
3118
+            array(
3119
+                'error' => false,
3120
+                'encryption' => array(
3121
+                    'status' => $encryptionStatus,
3122
+                    'text' => $encryptionText,
3123
+                ),
3124
+                'sessions' => array(
3125
+                    'count' => (int) $sessionsCount,
3126
+                ),
3127
+                'cron' => array(
3128
+                    'status' => $cronStatus,
3129
+                    'text' => $cronText,
3130
+                ),
3131
+                'unknown_files' => array(
3132
+                    'count' => $unknownFilesCount,
3133
+                ),
3133 3134
             ),
3134
-        ),
3135
-        'encode'
3136
-    );
3137
-    break;
3135
+            'encode'
3136
+        );
3137
+        break;
3138 3138
 
3139
-// ========================================
3140
-// QUICK ACTIONS - CLEAN OLD LOGS
3141
-// ========================================
3139
+    // ========================================
3140
+    // QUICK ACTIONS - CLEAN OLD LOGS
3141
+    // ========================================
3142 3142
 
3143
-case 'clean_old_logs':
3144
-    /**
3143
+    case 'clean_old_logs':
3144
+        /**
3145 3145
      * Clean logs older than 90 days
3146 3146
      * 
3147 3147
      * @return array {
@@ -3151,54 +3151,54 @@  discard block
 block discarded – undo
3151 3151
      * }
3152 3152
      */
3153 3153
     
3154
-    $threshold = time() - (90 * 86400); // 90 days ago
3154
+        $threshold = time() - (90 * 86400); // 90 days ago
3155 3155
     
3156
-    // Delete old log_items entries
3157
-    DB::delete(
3158
-        prefixTable('log_items'),
3159
-        'date < %i',
3160
-        $threshold
3161
-    );
3156
+        // Delete old log_items entries
3157
+        DB::delete(
3158
+            prefixTable('log_items'),
3159
+            'date < %i',
3160
+            $threshold
3161
+        );
3162 3162
     
3163
-    $deletedItems = DB::affectedRows();
3163
+        $deletedItems = DB::affectedRows();
3164 3164
     
3165
-    // Delete old log_system entries
3166
-    DB::delete(
3167
-        prefixTable('log_system'),
3168
-        'date < %i',
3169
-        $threshold
3170
-    );
3165
+        // Delete old log_system entries
3166
+        DB::delete(
3167
+            prefixTable('log_system'),
3168
+            'date < %i',
3169
+            $threshold
3170
+        );
3171 3171
     
3172
-    $deletedSystem = DB::affectedRows();
3172
+        $deletedSystem = DB::affectedRows();
3173 3173
     
3174
-    $totalDeleted = $deletedItems + $deletedSystem;
3174
+        $totalDeleted = $deletedItems + $deletedSystem;
3175 3175
     
3176
-    // Log the action
3177
-    logEvents(
3178
-        $SETTINGS,
3179
-        'admin_action',
3180
-        'clean_old_logs',
3181
-        (string) $session->get('user-id'),
3182
-        $session->get('user-login'),
3183
-        'Cleaned ' . $totalDeleted . ' old log entries'
3184
-    );
3176
+        // Log the action
3177
+        logEvents(
3178
+            $SETTINGS,
3179
+            'admin_action',
3180
+            'clean_old_logs',
3181
+            (string) $session->get('user-id'),
3182
+            $session->get('user-login'),
3183
+            'Cleaned ' . $totalDeleted . ' old log entries'
3184
+        );
3185 3185
     
3186
-    echo prepareExchangedData(
3187
-        array(
3188
-            'error' => false,
3189
-            'message' => $lang->get('admin_logs_cleaned_success'),
3190
-            'deleted_count' => $totalDeleted,
3191
-        ),
3192
-        'encode'
3193
-    );
3194
-    break;
3186
+        echo prepareExchangedData(
3187
+            array(
3188
+                'error' => false,
3189
+                'message' => $lang->get('admin_logs_cleaned_success'),
3190
+                'deleted_count' => $totalDeleted,
3191
+            ),
3192
+            'encode'
3193
+        );
3194
+        break;
3195 3195
 
3196
-// ========================================
3197
-// QUICK ACTIONS - TEST ENCRYPTION (KEPT FOR COMPATIBILITY)
3198
-// ========================================
3196
+    // ========================================
3197
+    // QUICK ACTIONS - TEST ENCRYPTION (KEPT FOR COMPATIBILITY)
3198
+    // ========================================
3199 3199
 
3200
-case 'test_encryption':
3201
-    /**
3200
+    case 'test_encryption':
3201
+        /**
3202 3202
      * Test encryption system integrity
3203 3203
      * 
3204 3204
      * @return array {
@@ -3207,117 +3207,117 @@  discard block
 block discarded – undo
3207 3207
      * }
3208 3208
      */
3209 3209
     
3210
-    try {
3211
-        // Test string
3212
-        $testString = 'TeamPass Encryption Test ' . time();
3210
+        try {
3211
+            // Test string
3212
+            $testString = 'TeamPass Encryption Test ' . time();
3213 3213
         
3214
-        // Get encryption key
3215
-        $key = file_get_contents($SETTINGS['securepath'] . DIRECTORY_SEPARATOR . $SETTINGS['securefile']);
3214
+            // Get encryption key
3215
+            $key = file_get_contents($SETTINGS['securepath'] . DIRECTORY_SEPARATOR . $SETTINGS['securefile']);
3216 3216
         
3217
-        if ($key === false) {
3218
-            throw new Exception($lang->get('admin_encryption_key_not_found'));
3219
-        }
3217
+            if ($key === false) {
3218
+                throw new Exception($lang->get('admin_encryption_key_not_found'));
3219
+            }
3220 3220
         
3221
-        // Use Defuse encryption (TeamPass's current encryption method)
3222
-        require_once $SETTINGS['cpassman_dir'] . '/vendor/defuse/php-encryption/src/Exception/EnvironmentIsBrokenException.php';
3223
-        require_once $SETTINGS['cpassman_dir'] . '/vendor/defuse/php-encryption/src/Exception/BadFormatException.php';
3224
-        require_once $SETTINGS['cpassman_dir'] . '/vendor/defuse/php-encryption/src/Exception/WrongKeyOrModifiedCiphertextException.php';
3225
-        require_once $SETTINGS['cpassman_dir'] . '/vendor/defuse/php-encryption/src/Crypto.php';
3226
-        require_once $SETTINGS['cpassman_dir'] . '/vendor/defuse/php-encryption/src/Key.php';
3221
+            // Use Defuse encryption (TeamPass's current encryption method)
3222
+            require_once $SETTINGS['cpassman_dir'] . '/vendor/defuse/php-encryption/src/Exception/EnvironmentIsBrokenException.php';
3223
+            require_once $SETTINGS['cpassman_dir'] . '/vendor/defuse/php-encryption/src/Exception/BadFormatException.php';
3224
+            require_once $SETTINGS['cpassman_dir'] . '/vendor/defuse/php-encryption/src/Exception/WrongKeyOrModifiedCiphertextException.php';
3225
+            require_once $SETTINGS['cpassman_dir'] . '/vendor/defuse/php-encryption/src/Crypto.php';
3226
+            require_once $SETTINGS['cpassman_dir'] . '/vendor/defuse/php-encryption/src/Key.php';
3227 3227
         
3228
-        $encryptionKey = \Defuse\Crypto\Key::loadFromAsciiSafeString($key);
3228
+            $encryptionKey = \Defuse\Crypto\Key::loadFromAsciiSafeString($key);
3229 3229
         
3230
-        // Encrypt test string
3231
-        $encrypted = \Defuse\Crypto\Crypto::encrypt($testString, $encryptionKey);
3230
+            // Encrypt test string
3231
+            $encrypted = \Defuse\Crypto\Crypto::encrypt($testString, $encryptionKey);
3232 3232
         
3233
-        // Decrypt test string
3234
-        $decrypted = \Defuse\Crypto\Crypto::decrypt($encrypted, $encryptionKey);
3233
+            // Decrypt test string
3234
+            $decrypted = \Defuse\Crypto\Crypto::decrypt($encrypted, $encryptionKey);
3235 3235
         
3236
-        // Verify
3237
-        if ($decrypted !== $testString) {
3238
-            throw new Exception($lang->get('admin_encryption_test_failed'));
3239
-        }
3236
+            // Verify
3237
+            if ($decrypted !== $testString) {
3238
+                throw new Exception($lang->get('admin_encryption_test_failed'));
3239
+            }
3240 3240
         
3241
-        // Log the test
3242
-        logEvents(
3243
-            $SETTINGS,
3244
-            'admin_action',
3245
-            'test_encryption',
3246
-            (string) $session->get('user-id'),
3247
-            $session->get('user-login'),
3248
-            'Encryption test successful'
3249
-        );
3241
+            // Log the test
3242
+            logEvents(
3243
+                $SETTINGS,
3244
+                'admin_action',
3245
+                'test_encryption',
3246
+                (string) $session->get('user-id'),
3247
+                $session->get('user-login'),
3248
+                'Encryption test successful'
3249
+            );
3250 3250
         
3251
-        echo prepareExchangedData(
3252
-            array(
3253
-                'error' => false,
3254
-                'message' => $lang->get('admin_encryption_test_success'),
3255
-            ),
3256
-            'encode'
3257
-        );
3251
+            echo prepareExchangedData(
3252
+                array(
3253
+                    'error' => false,
3254
+                    'message' => $lang->get('admin_encryption_test_success'),
3255
+                ),
3256
+                'encode'
3257
+            );
3258 3258
         
3259
-    } catch (Exception $e) {
3260
-        echo prepareExchangedData(
3261
-            array(
3262
-                'error' => true,
3263
-                'message' => $e->getMessage(),
3264
-            ),
3265
-            'encode'
3266
-        );
3267
-    }
3268
-    break;
3259
+        } catch (Exception $e) {
3260
+            echo prepareExchangedData(
3261
+                array(
3262
+                    'error' => true,
3263
+                    'message' => $e->getMessage(),
3264
+                ),
3265
+                'encode'
3266
+            );
3267
+        }
3268
+        break;
3269 3269
 
3270
-// ========================================
3271
-// QUICK ACTIONS - EXPORT STATISTICS
3272
-// ========================================
3270
+    // ========================================
3271
+    // QUICK ACTIONS - EXPORT STATISTICS
3272
+    // ========================================
3273 3273
 
3274
-case 'export_statistics':
3275
-    /**
3274
+    case 'export_statistics':
3275
+        /**
3276 3276
      * Export statistics as CSV file
3277 3277
      * 
3278 3278
      * @return void (file download)
3279 3279
      */
3280 3280
     
3281
-    // Set headers for CSV download
3282
-    header('Content-Type: text/csv; charset=utf-8');
3283
-    header('Content-Disposition: attachment; filename="teampass_statistics_' . date('Y-m-d_H-i-s') . '.csv"');
3281
+        // Set headers for CSV download
3282
+        header('Content-Type: text/csv; charset=utf-8');
3283
+        header('Content-Disposition: attachment; filename="teampass_statistics_' . date('Y-m-d_H-i-s') . '.csv"');
3284 3284
     
3285
-    // Create output stream
3286
-    $output = fopen('php://output', 'w');
3285
+        // Create output stream
3286
+        $output = fopen('php://output', 'w');
3287 3287
     
3288
-    // Write CSV headers
3289
-    fputcsv($output, array(
3290
-        $lang->get('admin_export_metric'),
3291
-        $lang->get('admin_export_value'),
3292
-    ));
3288
+        // Write CSV headers
3289
+        fputcsv($output, array(
3290
+            $lang->get('admin_export_metric'),
3291
+            $lang->get('admin_export_value'),
3292
+        ));
3293 3293
     
3294
-    // Gather statistics
3295
-    $stats = array(
3296
-        $lang->get('active_users') => DB::queryFirstField('SELECT COUNT(*) FROM ' . prefixTable('users') . ' WHERE disabled = 0'),
3297
-        $lang->get('total_items') => DB::queryFirstField('SELECT COUNT(*) FROM ' . prefixTable('items') . ' WHERE inactif = 0'),
3298
-        $lang->get('total_folders') => DB::queryFirstField('SELECT COUNT(*) FROM ' . prefixTable('nested_tree')),
3299
-        $lang->get('logs_24h') => DB::queryFirstField('SELECT COUNT(*) FROM ' . prefixTable('log_items') . ' WHERE date > ' . (time() - 86400)),
3300
-    );
3294
+        // Gather statistics
3295
+        $stats = array(
3296
+            $lang->get('active_users') => DB::queryFirstField('SELECT COUNT(*) FROM ' . prefixTable('users') . ' WHERE disabled = 0'),
3297
+            $lang->get('total_items') => DB::queryFirstField('SELECT COUNT(*) FROM ' . prefixTable('items') . ' WHERE inactif = 0'),
3298
+            $lang->get('total_folders') => DB::queryFirstField('SELECT COUNT(*) FROM ' . prefixTable('nested_tree')),
3299
+            $lang->get('logs_24h') => DB::queryFirstField('SELECT COUNT(*) FROM ' . prefixTable('log_items') . ' WHERE date > ' . (time() - 86400)),
3300
+        );
3301 3301
     
3302
-    // Write statistics
3303
-    foreach ($stats as $metric => $value) {
3304
-        fputcsv($output, array($metric, $value));
3305
-    }
3302
+        // Write statistics
3303
+        foreach ($stats as $metric => $value) {
3304
+            fputcsv($output, array($metric, $value));
3305
+        }
3306 3306
     
3307
-    fclose($output);
3307
+        fclose($output);
3308 3308
     
3309
-    // Log the export
3310
-    logEvents(
3311
-        $SETTINGS,
3312
-        'admin_action',
3313
-        'export_statistics',
3314
-        (string) $session->get('user-id'),
3315
-        $session->get('user-login'),
3316
-        'Statistics exported'
3317
-    );
3309
+        // Log the export
3310
+        logEvents(
3311
+            $SETTINGS,
3312
+            'admin_action',
3313
+            'export_statistics',
3314
+            (string) $session->get('user-id'),
3315
+            $session->get('user-login'),
3316
+            'Statistics exported'
3317
+        );
3318 3318
     
3319
-    exit;
3320
-    break;
3319
+        exit;
3320
+        break;
3321 3321
     
3322 3322
 }
3323 3323
 
Please login to merge, or discard this patch.
licences/compliance-checker.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
         echo "=== Teampass License Compliance Checker ===\n\n";
33 33
         
34 34
         // Open report file for streaming write
35
-        $this->reportFile = fopen(__DIR__ . '/LICENSE_COMPLIANCE_REPORT.md', 'w');
35
+        $this->reportFile = fopen(__DIR__.'/LICENSE_COMPLIANCE_REPORT.md', 'w');
36 36
         
37 37
         $this->writeHeader();
38 38
         $this->processPhpDependencies();
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
     private function writeHeader(): void
62 62
     {
63 63
         $header = "# Teampass License Compliance Report\n\n";
64
-        $header .= "**Generated:** " . date('Y-m-d H:i:s') . "\n";
64
+        $header .= "**Generated:** ".date('Y-m-d H:i:s')."\n";
65 65
         $header .= "**Project License:** GNU General Public License v3.0\n\n";
66 66
         
67 67
         fwrite($this->reportFile, $header);
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
      */
75 75
     private function processPhpDependencies(): void
76 76
     {
77
-        $lockFile = __DIR__ . '/../composer.lock';
77
+        $lockFile = __DIR__.'/../composer.lock';
78 78
         
79 79
         if (!file_exists($lockFile)) {
80 80
             $this->errorCount++;
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
      */
140 140
     private function processJsDependencies(): void
141 141
     {
142
-        $jsFile = __DIR__ . '/javascript-dependencies.json';
142
+        $jsFile = __DIR__.'/javascript-dependencies.json';
143 143
         
144 144
         fwrite($this->reportFile, "## JavaScript/CSS Dependencies\n\n");
145 145
         
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
     private function writeFooter(): void
234 234
     {
235 235
         $footer = "## Summary\n\n";
236
-        $footer .= "- **Total Dependencies:** " . ($this->phpCount + $this->jsCount) . "\n";
236
+        $footer .= "- **Total Dependencies:** ".($this->phpCount + $this->jsCount)."\n";
237 237
         $footer .= "- **PHP Dependencies:** {$this->phpCount}\n";
238 238
         $footer .= "- **JavaScript Dependencies:** {$this->jsCount}\n";
239 239
         $footer .= "- **Errors:** {$this->errorCount}\n";
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
         $footer .= "```\n\n";
263 263
         
264 264
         $footer .= "---\n\n";
265
-        $footer .= "*Auto-generated report - Last updated: " . date('Y-m-d H:i:s') . "*\n";
265
+        $footer .= "*Auto-generated report - Last updated: ".date('Y-m-d H:i:s')."*\n";
266 266
         
267 267
         fwrite($this->reportFile, $footer);
268 268
     }
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
         ];
297 297
         
298 298
         file_put_contents(
299
-            __DIR__ . '/javascript-dependencies.json',
299
+            __DIR__.'/javascript-dependencies.json',
300 300
             json_encode($template, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)
301 301
         );
302 302
     }
Please login to merge, or discard this patch.
pages/admin.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('admin') === false) {
70 70
     // Not allowed page
71 71
     $session->set('system-error_code', ERR_NOT_ALLOWED);
72
-    include $SETTINGS['cpassman_dir'] . '/error.php';
72
+    include $SETTINGS['cpassman_dir'].'/error.php';
73 73
     exit;
74 74
 }
75 75
 
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 
318 318
                                         // Has the transparent recovery migration been done?
319 319
                                         DB::query(
320
-                                            "SELECT id FROM " . prefixTable('users') . "
320
+                                            "SELECT id FROM ".prefixTable('users')."
321 321
                                             WHERE (user_derivation_seed IS NULL
322 322
                                             OR private_key_backup IS NULL)
323 323
                                             AND disabled = 0"
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
                                                 COUNT(*) as total_users,
342 342
                                                 SUM(CASE WHEN personal_items_migrated = 1 THEN 1 ELSE 0 END) as migrated_users,
343 343
                                                 SUM(CASE WHEN personal_items_migrated = 0 THEN 1 ELSE 0 END) as pending_users
344
-                                            FROM " . prefixTable('users') . "
344
+                                            FROM " . prefixTable('users')."
345 345
                                             WHERE disabled = 0 AND deleted_at IS NULL"
346 346
                                         );
347 347
                                         $progressPercent = ($stats[0]['migrated_users'] / $stats[0]['total_users']) * 100;
@@ -377,11 +377,11 @@  discard block
 block discarded – undo
377 377
                                             ?>
378 378
                                         <li class="list-group-item d-flex justify-content-between align-items-center">
379 379
                                             <span><i class="fa-solid fa-hand text-warning"></i>
380
-                                            Password Encryption Migration Required <span class="badge badge-warning"><?php echo DB::count();?> remaing users</span>
380
+                                            Password Encryption Migration Required <span class="badge badge-warning"><?php echo DB::count(); ?> remaing users</span>
381 381
                                             </span>
382 382
                                             <span>
383
-                                            <i class="fa-solid fa-info-circle text-primary open-info" data-info="<?php echo DB::count();?> user accounts still use the legacy encryption library and must be migrated before upgrading to version 3.2.0.<br>
384
-                                            To migrate: Users must either log in once or have their password updated via the Users management page.<p class='mt-2'>List of remaining users: <?php echo $logins_list;?></p>" data-size="lg" data-title="Importante notice"></i>
383
+                                            <i class="fa-solid fa-info-circle text-primary open-info" data-info="<?php echo DB::count(); ?> user accounts still use the legacy encryption library and must be migrated before upgrading to version 3.2.0.<br>
384
+                                            To migrate: Users must either log in once or have their password updated via the Users management page.<p class='mt-2'>List of remaining users: <?php echo $logins_list; ?></p>" data-size="lg" data-title="Importante notice"></i>
385 385
                                             </span>
386 386
                                         </li>
387 387
                                             <?php
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
     // Get last cron execution timestamp
469 469
     DB::query(
470 470
         'SELECT valeur
471
-        FROM ' . prefixTable('misc') . '
471
+        FROM ' . prefixTable('misc').'
472 472
         WHERE type = %s AND intitule = %s and valeur >= %d',
473 473
         'admin',
474 474
         'last_cron_exec',
@@ -524,17 +524,17 @@  discard block
 block discarded – undo
524 524
     FROM information_schema.TABLES 
525 525
     WHERE table_schema = DATABASE()"
526 526
 );
527
-$dbSizeFormatted = $dbSize . ' MB';
527
+$dbSizeFormatted = $dbSize.' MB';
528 528
 
529 529
 // Get other PHP info
530 530
 $phpVersion = phpversion();
531 531
 $memoryLimit = ini_get('memory_limit');
532
-$memoryUsage = round(memory_get_usage() / 1024, 2) . ' KB';
533
-$maxExecutionTime = ini_get('max_execution_time') . 's';
532
+$memoryUsage = round(memory_get_usage() / 1024, 2).' KB';
533
+$maxExecutionTime = ini_get('max_execution_time').'s';
534 534
 $maxUploadSize = ini_get('upload_max_filesize');
535 535
 
536 536
 // Get OS info
537
-$osInfo = php_uname('s') . ' ' . php_uname('r');
537
+$osInfo = php_uname('s').' '.php_uname('r');
538 538
 
539 539
 // Get timezone
540 540
 $timezone = date_default_timezone_get();
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -490,8 +490,7 @@
 block discarded – undo
490 490
                                         </div>
491 491
         <?php
492 492
     }
493
-}
494
-catch (Exception $e) {
493
+} catch (Exception $e) {
495 494
     if (defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) {
496 495
         error_log('TEAMPASS Error - admin page - '.$e->getMessage());
497 496
     }
Please login to merge, or discard this patch.
scripts/traits/ItemHandlerTrait.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 trait ItemHandlerTrait {    
30 30
 
31 31
     private function generateUserPasswordKeys($arguments) {
32
-        if (LOG_TASKS=== true) $this->logger->log('Processing generateUserPasswordKeys : '.print_r($arguments, true), 'DEBUG');
32
+        if (LOG_TASKS === true) $this->logger->log('Processing generateUserPasswordKeys : '.print_r($arguments, true), 'DEBUG');
33 33
         // Generate keys for user passwords   
34 34
         storeUsersShareKey(
35 35
             'sharekeys_items',
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
      * @param array $taskData
50 50
      */
51 51
     private function generateUserFileKeys($taskData) {    
52
-        if (LOG_TASKS=== true) $this->logger->log('Processing generateUserFileKeys : '.print_r($taskData, true), 'DEBUG');
53
-        foreach($taskData['files_keys'] as $file) {
52
+        if (LOG_TASKS === true) $this->logger->log('Processing generateUserFileKeys : '.print_r($taskData, true), 'DEBUG');
53
+        foreach ($taskData['files_keys'] as $file) {
54 54
             storeUsersShareKey(
55 55
                 'sharekeys_files',
56 56
                 0,
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
      * @param array $arguments
71 71
      */
72 72
     private function generateUserFieldKeys($arguments) {
73
-        if (LOG_TASKS=== true) $this->logger->log('Processing generateUserFieldKeys : '.print_r($arguments, true), 'DEBUG');
74
-        foreach($arguments['fields_keys'] as $field) {
75
-            $this->logger->log('Processing generateUserFieldKeys for: ' . $field['object_id'], 'DEBUG');
73
+        if (LOG_TASKS === true) $this->logger->log('Processing generateUserFieldKeys : '.print_r($arguments, true), 'DEBUG');
74
+        foreach ($arguments['fields_keys'] as $field) {
75
+            $this->logger->log('Processing generateUserFieldKeys for: '.$field['object_id'], 'DEBUG');
76 76
             storeUsersShareKey(
77 77
                 'sharekeys_fields',
78 78
                 0,
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,7 +29,9 @@  discard block
 block discarded – undo
29 29
 trait ItemHandlerTrait {    
30 30
 
31 31
     private function generateUserPasswordKeys($arguments) {
32
-        if (LOG_TASKS=== true) $this->logger->log('Processing generateUserPasswordKeys : '.print_r($arguments, true), 'DEBUG');
32
+        if (LOG_TASKS=== true) {
33
+            $this->logger->log('Processing generateUserPasswordKeys : '.print_r($arguments, true), 'DEBUG');
34
+        }
33 35
         // Generate keys for user passwords   
34 36
         storeUsersShareKey(
35 37
             'sharekeys_items',
@@ -49,7 +51,9 @@  discard block
 block discarded – undo
49 51
      * @param array $taskData
50 52
      */
51 53
     private function generateUserFileKeys($taskData) {    
52
-        if (LOG_TASKS=== true) $this->logger->log('Processing generateUserFileKeys : '.print_r($taskData, true), 'DEBUG');
54
+        if (LOG_TASKS=== true) {
55
+            $this->logger->log('Processing generateUserFileKeys : '.print_r($taskData, true), 'DEBUG');
56
+        }
53 57
         foreach($taskData['files_keys'] as $file) {
54 58
             storeUsersShareKey(
55 59
                 'sharekeys_files',
@@ -70,7 +74,9 @@  discard block
 block discarded – undo
70 74
      * @param array $arguments
71 75
      */
72 76
     private function generateUserFieldKeys($arguments) {
73
-        if (LOG_TASKS=== true) $this->logger->log('Processing generateUserFieldKeys : '.print_r($arguments, true), 'DEBUG');
77
+        if (LOG_TASKS=== true) {
78
+            $this->logger->log('Processing generateUserFieldKeys : '.print_r($arguments, true), 'DEBUG');
79
+        }
74 80
         foreach($arguments['fields_keys'] as $field) {
75 81
             $this->logger->log('Processing generateUserFieldKeys for: ' . $field['object_id'], 'DEBUG');
76 82
             storeUsersShareKey(
Please login to merge, or discard this patch.
pages/admin.js.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('admin') === false) {
70 70
     // Not allowed page
71 71
     $session->set('system-error_code', ERR_NOT_ALLOWED);
72
-    include $SETTINGS['cpassman_dir'] . '/error.php';
72
+    include $SETTINGS['cpassman_dir'].'/error.php';
73 73
     exit;
74 74
 }
75 75
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
                 // error
156 156
                 toastr.remove();
157 157
                 toastr.error(
158
-                    '<?php echo $lang->get('server_answer_error') . '<br />' . $lang->get('server_returned_data') . ':<br />'; ?>' + data.error,
158
+                    '<?php echo $lang->get('server_answer_error').'<br />'.$lang->get('server_returned_data').':<br />'; ?>' + data.error,
159 159
                     '', {
160 160
                         closeButton: true,
161 161
                         positionClass: 'toast-bottom-right'
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
                 // error
278 278
                 toastr.remove();
279 279
                 toastr.error(
280
-                    '<?php echo $lang->get('server_answer_error') . '<br />' . $lang->get('server_returned_data') . ':<br />'; ?>' + data.error,
280
+                    '<?php echo $lang->get('server_answer_error').'<br />'.$lang->get('server_returned_data').':<br />'; ?>' + data.error,
281 281
                     '', {
282 282
                         closeButton: true,
283 283
                         positionClass: 'toast-bottom-right'
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
                 // error
476 476
                 toastr.remove();
477 477
                 toastr.error(
478
-                    '<?php echo $lang->get('server_answer_error') . '<br />' . $lang->get('server_returned_data') . ':<br />'; ?>' + data.error,
478
+                    '<?php echo $lang->get('server_answer_error').'<br />'.$lang->get('server_returned_data').':<br />'; ?>' + data.error,
479 479
                     '', {
480 480
                         closeButton: true,
481 481
                         positionClass: 'toast-bottom-right'
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
                 // error
537 537
                 toastr.remove();
538 538
                 toastr.error(
539
-                    '<?php echo $lang->get('server_answer_error') . '<br />' . $lang->get('server_returned_data') . ':<br />'; ?>' + data.error,
539
+                    '<?php echo $lang->get('server_answer_error').'<br />'.$lang->get('server_returned_data').':<br />'; ?>' + data.error,
540 540
                     '', {
541 541
                         closeButton: true,
542 542
                         positionClass: 'toast-bottom-right'
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
                 // error
606 606
                 toastr.remove();
607 607
                 toastr.error(
608
-                    '<?php echo $lang->get('server_answer_error') . '<br />' . $lang->get('server_returned_data') . ':<br />'; ?>' + data.error,
608
+                    '<?php echo $lang->get('server_answer_error').'<br />'.$lang->get('server_returned_data').':<br />'; ?>' + data.error,
609 609
                     '', {
610 610
                         closeButton: true,
611 611
                         positionClass: 'toast-bottom-right'
@@ -643,7 +643,7 @@  discard block
 block discarded – undo
643 643
                 // error
644 644
                 toastr.remove();
645 645
                 toastr.error(
646
-                    '<?php echo $lang->get('server_answer_error') . '<br />' . $lang->get('server_returned_data') . ':<br />'; ?>' + data.error,
646
+                    '<?php echo $lang->get('server_answer_error').'<br />'.$lang->get('server_returned_data').':<br />'; ?>' + data.error,
647 647
                     '', {
648 648
                         closeButton: true,
649 649
                         positionClass: 'toast-bottom-right'
@@ -937,7 +937,7 @@  discard block
 block discarded – undo
937 937
                 // error
938 938
                 toastr.remove();
939 939
                 toastr.error(
940
-                    '<?php echo $lang->get('server_answer_error') . '<br />' . $lang->get('server_returned_data') . ':<br />'; ?>' + data.error,
940
+                    '<?php echo $lang->get('server_answer_error').'<br />'.$lang->get('server_returned_data').':<br />'; ?>' + data.error,
941 941
                     '', {
942 942
                         closeButton: true,
943 943
                         positionClass: 'toast-bottom-right'
@@ -998,7 +998,7 @@  discard block
 block discarded – undo
998 998
                 // error
999 999
                 toastr.remove();
1000 1000
                 toastr.error(
1001
-                    '<?php echo $lang->get('server_answer_error') . '<br />' . $lang->get('server_returned_data') . ':<br />'; ?>' + data.error,
1001
+                    '<?php echo $lang->get('server_answer_error').'<br />'.$lang->get('server_returned_data').':<br />'; ?>' + data.error,
1002 1002
                     '', {
1003 1003
                         closeButton: true,
1004 1004
                         positionClass: 'toast-bottom-right'
@@ -1057,7 +1057,7 @@  discard block
 block discarded – undo
1057 1057
                 // error
1058 1058
                 toastr.remove();
1059 1059
                 toastr.error(
1060
-                    '<?php echo $lang->get('server_answer_error') . '<br />' . $lang->get('server_returned_data') . ':<br />'; ?>' + data.error,
1060
+                    '<?php echo $lang->get('server_answer_error').'<br />'.$lang->get('server_returned_data').':<br />'; ?>' + data.error,
1061 1061
                     '', {
1062 1062
                         closeButton: true,
1063 1063
                         positionClass: 'toast-bottom-right'
@@ -1156,7 +1156,7 @@  discard block
 block discarded – undo
1156 1156
                 // error
1157 1157
                 toastr.remove();
1158 1158
                 toastr.error(
1159
-                    '<?php echo $lang->get('server_answer_error') . '<br />' . $lang->get('server_returned_data') . ':<br />'; ?>' + data.error,
1159
+                    '<?php echo $lang->get('server_answer_error').'<br />'.$lang->get('server_returned_data').':<br />'; ?>' + data.error,
1160 1160
                     '', {
1161 1161
                         closeButton: true,
1162 1162
                         positionClass: 'toast-bottom-right'
@@ -1185,7 +1185,7 @@  discard block
 block discarded – undo
1185 1185
                 
1186 1186
                 //const className = result.success ? 'success' : 'error';
1187 1187
                 const icon = result.success ? '<i class="fa-solid fa-check text-success mr-1"></i>' : '<i class="fa-solid fa-xmark text-danger mr-1"></i>';
1188
-                const message = result.success ? '<?php echo $lang->get('server_returned_data');?>' : 'Error: ' + result.error;
1188
+                const message = result.success ? '<?php echo $lang->get('server_returned_data'); ?>' : 'Error: ' + result.error;
1189 1189
                 
1190 1190
                 output += '<li>' + icon + '<b>' + file + '</b><br/>' + message + '</li>';
1191 1191
             });
@@ -1227,7 +1227,7 @@  discard block
 block discarded – undo
1227 1227
                 // error
1228 1228
                 toastr.remove();
1229 1229
                 toastr.error(
1230
-                    '<?php echo $lang->get('server_answer_error') . '<br />' . $lang->get('server_returned_data') . ':<br />'; ?>' + data.error,
1230
+                    '<?php echo $lang->get('server_answer_error').'<br />'.$lang->get('server_returned_data').':<br />'; ?>' + data.error,
1231 1231
                     '', {
1232 1232
                         closeButton: true,
1233 1233
                         positionClass: 'toast-bottom-right'
@@ -1436,7 +1436,7 @@  discard block
 block discarded – undo
1436 1436
                 // error
1437 1437
                 toastr.remove();
1438 1438
                 toastr.error(
1439
-                    '<?php echo $lang->get('server_answer_error') . '<br />' . $lang->get('server_returned_data') . ':<br />'; ?>' + data.error,
1439
+                    '<?php echo $lang->get('server_answer_error').'<br />'.$lang->get('server_returned_data').':<br />'; ?>' + data.error,
1440 1440
                     '', {
1441 1441
                         closeButton: true,
1442 1442
                         positionClass: 'toast-bottom-right'
Please login to merge, or discard this patch.
pages/users.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('users') === false) {
70 70
     // Not allowed page
71 71
     $session->set('system-error_code', ERR_NOT_ALLOWED);
72
-    include $SETTINGS['cpassman_dir'] . '/error.php';
72
+    include $SETTINGS['cpassman_dir'].'/error.php';
73 73
     exit;
74 74
 }
75 75
 
@@ -92,24 +92,24 @@  discard block
 block discarded – undo
92 92
 // If administrator then all roles are shown
93 93
 // else only the Roles the users is associated to.
94 94
 if ((int) $session->get('user-admin') === 1) {
95
-    $optionsManagedBy .= '<option value="0">' . $lang->get('administrators_only') . '</option>';
95
+    $optionsManagedBy .= '<option value="0">'.$lang->get('administrators_only').'</option>';
96 96
 }
97 97
 
98 98
 $rows = DB::query(
99 99
     'SELECT id, title, creator_id
100
-    FROM ' . prefixTable('roles_title') . '
100
+    FROM ' . prefixTable('roles_title').'
101 101
     ORDER BY title ASC'
102 102
 );
103 103
 foreach ($rows as $record) {
104 104
     if ((int) $session->get('user-admin') === 1 || in_array($record['id'], $session->get('user-roles_array')) === true) {
105
-        $optionsManagedBy .= '<option value="' . $record['id'] . '">' . $lang->get('managers_of') . ' ' . addslashes($record['title']) . '</option>';
105
+        $optionsManagedBy .= '<option value="'.$record['id'].'">'.$lang->get('managers_of').' '.addslashes($record['title']).'</option>';
106 106
     }
107 107
     if (
108 108
         (int) $session->get('user-admin') === 1
109 109
         || (((int) $session->get('user-manager') === 1 || (int) $session->get('user-can_manage_all_users') === 1)
110 110
             && (in_array($record['id'], $userRoles) === true) || (int) $record['creator_id'] === (int) $session->get('user-id'))
111 111
     ) {
112
-        $optionsRoles .= '<option value="' . $record['id'] . '">' . addslashes($record['title']) . '</option>';
112
+        $optionsRoles .= '<option value="'.$record['id'].'">'.addslashes($record['title']).'</option>';
113 113
     }
114 114
 }
115 115
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
         for ($y = 1; $y < $t->nlevel; ++$y) {
125 125
             $ident .= '&nbsp;&nbsp;';
126 126
         }
127
-        $foldersList .= '<option value="' . $t->id . '">' . $ident . htmlspecialchars($t->title, ENT_COMPAT, 'UTF-8') . '</option>';
127
+        $foldersList .= '<option value="'.$t->id.'">'.$ident.htmlspecialchars($t->title, ENT_COMPAT, 'UTF-8').'</option>';
128 128
     }
129 129
 }
130 130
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 {
146 146
     // Table is teampass_users with the prefix {teampass_users} in MeekroDB context.
147 147
     // 'disabled = 1' indicates a deleted/disabled user account.
148
-    return (int)DB::queryFirstField("SELECT COUNT(id) FROM " . prefixTable('users') . " WHERE deleted_at IS NOT NULL");
148
+    return (int) DB::queryFirstField("SELECT COUNT(id) FROM ".prefixTable('users')." WHERE deleted_at IS NOT NULL");
149 149
 }
150 150
 
151 151
 $deleted_users_count = count_deleted_users();
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
     $blink_class = 'blink_me';
160 160
 
161 161
     // Create the badge HTML with the count
162
-    $count_badge_html = ' <span class="badge badge-danger ml-1">' . $deleted_users_count . '</span>';
162
+    $count_badge_html = ' <span class="badge badge-danger ml-1">'.$deleted_users_count.'</span>';
163 163
 }
164 164
 ?>
165 165
 
@@ -194,13 +194,13 @@  discard block
 block discarded – undo
194 194
                         </button><?php
195 195
                                     echo isset($SETTINGS['ldap_mode']) === true && (int) $SETTINGS['ldap_mode'] === 1 && (int) $session->get('user-admin') === 1 ?
196 196
                                         '<button type="button" class="btn btn-primary btn-sm tp-action mr-2" data-action="ldap-sync">
197
-                            <i class="fa-solid fa-address-card mr-2"></i>' . $lang->get('ldap_synchronization') . '
197
+                            <i class="fa-solid fa-address-card mr-2"></i>' . $lang->get('ldap_synchronization').'
198 198
                         </button>' : '';
199 199
                                     ?>
200 200
                         </button><?php
201 201
                                     echo isset($SETTINGS['oauth2_enabled']) === true && (int) $SETTINGS['oauth2_enabled'] === 1 && (int) $session->get('user-admin') === 1 ?
202 202
                                         '<button type="button" class="btn btn-primary btn-sm tp-action mr-2" data-action="oauth2-sync">
203
-                            <i class="fa-solid fa-plug mr-2"></i>' . $lang->get('oauth2_synchronization') . '
203
+                            <i class="fa-solid fa-plug mr-2"></i>' . $lang->get('oauth2_synchronization').'
204 204
                         </button>' : '';
205 205
                                     ?>
206 206
                         <button type="button" class="btn btn-primary btn-sm tp-action mr-2 <?php echo $blink_class; ?>" data-action="deleted-users">
@@ -210,8 +210,8 @@  discard block
 block discarded – undo
210 210
                 </div>
211 211
 
212 212
                 <!-- /.card-header -->
213
-                <div class="card-body form user-content with-header-menu <?php echo $showNewUser ? 'hidden' : '';?>" id="users-list" data-content="refresh">
214
-                    <label><input type="checkbox" id="warnings_display" class="tp-action pointer" data-action="refresh"><span class="ml-2 pointer"><?php echo $lang->get('display_warning_icons');?></span></label>
213
+                <div class="card-body form user-content with-header-menu <?php echo $showNewUser ? 'hidden' : ''; ?>" id="users-list" data-content="refresh">
214
+                    <label><input type="checkbox" id="warnings_display" class="tp-action pointer" data-action="refresh"><span class="ml-2 pointer"><?php echo $lang->get('display_warning_icons'); ?></span></label>
215 215
                     <table id="table-users" class="table table-striped nowrap table-responsive-sm">
216 216
                         <thead>
217 217
                             <tr>
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
                                             <?php
276 276
                                             foreach (TP_PW_COMPLEXITY as $entry) {
277 277
                                                 echo '
278
-                                            <option value="' . $entry[0] . '">' . addslashes($entry[1]) . '</option>';
278
+                                            <option value="' . $entry[0].'">'.addslashes($entry[1]).'</option>';
279 279
                                             }
280 280
                                             ?>
281 281
                                         </select>
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
                                             <?php
353 353
                                             foreach (TP_PW_COMPLEXITY as $entry) {
354 354
                                                 echo '
355
-                                            <option value="' . $entry[0] . '">' . addslashes($entry[1]) . '</option>';
355
+                                            <option value="' . $entry[0].'">'.addslashes($entry[1]).'</option>';
356 356
                                             }
357 357
                                             ?>
358 358
                                         </select>
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
     </div>
391 391
 
392 392
     <!-- USER FORM -->
393
-    <div class="row <?php echo $showNewUser ? '' : 'hidden';?> extra-form user-content" id="row-form" data-content="new" data-content-alternative="edit">
393
+    <div class="row <?php echo $showNewUser ? '' : 'hidden'; ?> extra-form user-content" id="row-form" data-content="new" data-content-alternative="edit">
394 394
         <div class="col-12">
395 395
             <div class="card card-primary">
396 396
                 <div class="card-header">
Please login to merge, or discard this patch.