Passed
Push — master ( e824e6...9b9d31 )
by Nils
05:57
created
sources/admin.queries.php 1 patch
Spacing   +154 added lines, -154 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',
@@ -2795,9 +2795,9 @@  discard block
 block discarded – undo
2795 2795
             COUNT(*) as total_users,
2796 2796
             SUM(CASE WHEN personal_items_migrated = 1 THEN 1 ELSE 0 END) as migrated_users,
2797 2797
             SUM(CASE WHEN personal_items_migrated = 0 THEN 1 ELSE 0 END) as pending_users
2798
-        FROM " . prefixTable('users') . "
2798
+        FROM " . prefixTable('users')."
2799 2799
         WHERE disabled = 0 AND deleted_at IS NULL AND id NOT IN %li",
2800
-        [TP_USER_ID, API_USER_ID, OTV_USER_ID,SSH_USER_ID]
2800
+        [TP_USER_ID, API_USER_ID, OTV_USER_ID, SSH_USER_ID]
2801 2801
     );
2802 2802
 
2803 2803
     $progressPercent = ($stats[0]['migrated_users'] / $stats[0]['total_users']) * 100;
@@ -2809,7 +2809,7 @@  discard block
 block discarded – undo
2809 2809
         WHERE personal_items_migrated = 0
2810 2810
         AND disabled = 0 AND deleted_at IS NULL AND id NOT IN %li
2811 2811
         ORDER BY last_connexion DESC",
2812
-        [TP_USER_ID, API_USER_ID, OTV_USER_ID,SSH_USER_ID]
2812
+        [TP_USER_ID, API_USER_ID, OTV_USER_ID, SSH_USER_ID]
2813 2813
     );
2814 2814
 
2815 2815
     // Get users ready
@@ -2819,7 +2819,7 @@  discard block
 block discarded – undo
2819 2819
         WHERE personal_items_migrated = 1
2820 2820
         AND disabled = 0 AND deleted_at IS NULL AND id NOT IN %li
2821 2821
         ORDER BY last_connexion DESC",
2822
-        [TP_USER_ID, API_USER_ID, OTV_USER_ID,SSH_USER_ID]
2822
+        [TP_USER_ID, API_USER_ID, OTV_USER_ID, SSH_USER_ID]
2823 2823
     );
2824 2824
 
2825 2825
     return [
@@ -2843,7 +2843,7 @@  discard block
 block discarded – undo
2843 2843
 {
2844 2844
     // Count auto-recoveries in last 24h
2845 2845
     $autoRecoveriesLast24h = DB::queryFirstField(
2846
-        'SELECT COUNT(*) FROM ' . prefixTable('log_system') . '
2846
+        'SELECT COUNT(*) FROM '.prefixTable('log_system').'
2847 2847
          WHERE label = %s
2848 2848
          AND date > %i',
2849 2849
         'auto_reencryption_success',
@@ -2852,21 +2852,21 @@  discard block
 block discarded – undo
2852 2852
 
2853 2853
     // Count failed recoveries (all time)
2854 2854
     $failedRecoveries = DB::queryFirstField(
2855
-        'SELECT COUNT(*) FROM ' . prefixTable('log_system') . '
2855
+        'SELECT COUNT(*) FROM '.prefixTable('log_system').'
2856 2856
          WHERE label = %s',
2857 2857
         'auto_reencryption_failed'
2858 2858
     );
2859 2859
 
2860 2860
     // Count critical failures (all time)
2861 2861
     $criticalFailures = DB::queryFirstField(
2862
-        'SELECT COUNT(*) FROM ' . prefixTable('log_system') . '
2862
+        'SELECT COUNT(*) FROM '.prefixTable('log_system').'
2863 2863
          WHERE label = %s',
2864 2864
         'auto_reencryption_critical_failure'
2865 2865
     );
2866 2866
 
2867 2867
     // Count users with transparent recovery enabled (have seed and backup)
2868 2868
     $usersMigrated = DB::queryFirstField(
2869
-        'SELECT COUNT(*) FROM ' . prefixTable('users') . '
2869
+        'SELECT COUNT(*) FROM '.prefixTable('users').'
2870 2870
          WHERE user_derivation_seed IS NOT NULL
2871 2871
          AND private_key_backup IS NOT NULL
2872 2872
          AND disabled = 0'
@@ -2874,7 +2874,7 @@  discard block
 block discarded – undo
2874 2874
 
2875 2875
     // Count total active users
2876 2876
     $totalUsers = DB::queryFirstField(
2877
-        'SELECT COUNT(*) FROM ' . prefixTable('users') . '
2877
+        'SELECT COUNT(*) FROM '.prefixTable('users').'
2878 2878
          WHERE disabled = 0
2879 2879
          AND private_key IS NOT NULL
2880 2880
          AND private_key != "none"'
@@ -2883,8 +2883,8 @@  discard block
 block discarded – undo
2883 2883
     // Get recent recovery events (last 10)
2884 2884
     $recentEvents = DB::query(
2885 2885
         'SELECT l.date, l.label, l.qui, u.login
2886
-         FROM ' . prefixTable('log_system') . ' AS l
2887
-         INNER JOIN ' . prefixTable('users') . ' AS u ON u.id = l.qui
2886
+         FROM ' . prefixTable('log_system').' AS l
2887
+         INNER JOIN ' . prefixTable('users').' AS u ON u.id = l.qui
2888 2888
          WHERE l.label IN %ls
2889 2889
          ORDER BY l.date DESC
2890 2890
          LIMIT 10',
@@ -2896,7 +2896,7 @@  discard block
 block discarded – undo
2896 2896
 
2897 2897
     // Calculate failure rate (last 30 days)
2898 2898
     $totalAttempts30d = DB::queryFirstField(
2899
-        'SELECT COUNT(*) FROM ' . prefixTable('log_system') . '
2899
+        'SELECT COUNT(*) FROM '.prefixTable('log_system').'
2900 2900
          WHERE label IN %ls
2901 2901
          AND date > %i',
2902 2902
         ['auto_reencryption_success', 'auto_reencryption_failed'],
@@ -2904,7 +2904,7 @@  discard block
 block discarded – undo
2904 2904
     );
2905 2905
 
2906 2906
     $failures30d = DB::queryFirstField(
2907
-        'SELECT COUNT(*) FROM ' . prefixTable('log_system') . '
2907
+        'SELECT COUNT(*) FROM '.prefixTable('log_system').'
2908 2908
          WHERE label = %s
2909 2909
          AND date > %i',
2910 2910
         'auto_reencryption_failed',
@@ -2941,7 +2941,7 @@  discard block
 block discarded – undo
2941 2941
     $lang = new Language($session->get('user-language') ?? 'english');
2942 2942
 
2943 2943
     $results = [];
2944
-    $fullPath = __DIR__ . '/../';
2944
+    $fullPath = __DIR__.'/../';
2945 2945
     
2946 2946
     foreach ($files as $file) {
2947 2947
         // Normalize path separators for cross-platform compatibility
@@ -2990,7 +2990,7 @@  discard block
 block discarded – undo
2990 2990
         }
2991 2991
         
2992 2992
         // Try to delete the file
2993
-        $deleteResult = '';//@unlink($normalizedPath);
2993
+        $deleteResult = ''; //@unlink($normalizedPath);
2994 2994
         
2995 2995
         if ($deleteResult) {
2996 2996
             $results[$normalizedPath] = [
@@ -3020,7 +3020,7 @@  discard block
 block discarded – undo
3020 3020
  */
3021 3021
 function filesIntegrityCheck($baseDir): array
3022 3022
 {
3023
-    $referenceFile = __DIR__ . '/../files_reference.txt';
3023
+    $referenceFile = __DIR__.'/../files_reference.txt';
3024 3024
 
3025 3025
     $unknownFiles = findUnknownFiles($baseDir, $referenceFile);
3026 3026
 
@@ -3058,7 +3058,7 @@  discard block
 block discarded – undo
3058 3058
                 $dir,
3059 3059
                 FilesystemIterator::SKIP_DOTS
3060 3060
             ),
3061
-            function ($current, $key, $iterator) {
3061
+            function($current, $key, $iterator) {
3062 3062
                 // Ignore hidden files and folders
3063 3063
                 if ($current->getFilename()[0] === '.') {
3064 3064
                     return false;
@@ -3072,7 +3072,7 @@  discard block
 block discarded – undo
3072 3072
     foreach ($iterator as $file) {
3073 3073
         try {
3074 3074
             if ($file->isFile()) {
3075
-                $relativePath = str_replace($dir . DIRECTORY_SEPARATOR, '', $file->getPathname());
3075
+                $relativePath = str_replace($dir.DIRECTORY_SEPARATOR, '', $file->getPathname());
3076 3076
                 $relativePath = str_replace('\\', '/', $relativePath); // Normalisation Windows/Linux
3077 3077
 
3078 3078
                 // Split relatif path into parts
@@ -3138,7 +3138,7 @@  discard block
 block discarded – undo
3138 3138
     // Get ignored files
3139 3139
     $ignoredFiles = DB::queryFirstField(
3140 3140
         'SELECT valeur 
3141
-        FROM ' . prefixTable('misc') . ' 
3141
+        FROM ' . prefixTable('misc').' 
3142 3142
         WHERE type = %s AND intitule = %s',
3143 3143
         'admin',
3144 3144
         'ignored_unknown_files'
@@ -3157,7 +3157,7 @@  discard block
 block discarded – undo
3157 3157
 function tablesIntegrityCheck(): array
3158 3158
 {
3159 3159
     // Get integrity tables file
3160
-    $integrityTablesFile = TEAMPASS_ROOT_PATH . '/includes/tables_integrity.json';
3160
+    $integrityTablesFile = TEAMPASS_ROOT_PATH.'/includes/tables_integrity.json';
3161 3161
     if (file_exists($integrityTablesFile) === false) {
3162 3162
         return [
3163 3163
             'error' => true,
@@ -3175,7 +3175,7 @@  discard block
 block discarded – undo
3175 3175
     // Get all tables
3176 3176
     $tables = [];
3177 3177
     foreach (DB::queryFirstColumn("SHOW TABLES") as $table) {
3178
-        $tables[] = str_replace(DB_PREFIX, "", $table);;
3178
+        $tables[] = str_replace(DB_PREFIX, "", $table); ;
3179 3179
     }
3180 3180
     // Prepare the integrity check
3181 3181
     $tablesInError = [];
@@ -3241,7 +3241,7 @@  discard block
 block discarded – undo
3241 3241
 
3242 3242
         // Compare hashes
3243 3243
         $expectedHash = $referenceData[$file];
3244
-        $actualHash = md5_file($baseDir . '/' . $file);
3244
+        $actualHash = md5_file($baseDir.'/'.$file);
3245 3245
 
3246 3246
         if ($expectedHash !== $actualHash) {
3247 3247
             $issues[] = "$file (expected: <i>$expectedHash</i>, actual: <i>$actualHash</i>)";
@@ -3294,7 +3294,7 @@  discard block
 block discarded – undo
3294 3294
     foreach ($iterator as $file) {
3295 3295
         if ($file->isFile()) {
3296 3296
             // Build relative path
3297
-            $relativePath = str_replace($dir . DIRECTORY_SEPARATOR, '', $file->getPathname());
3297
+            $relativePath = str_replace($dir.DIRECTORY_SEPARATOR, '', $file->getPathname());
3298 3298
             $relativePath = str_replace('\\', '/', $relativePath); // Normalize for Windows
3299 3299
             // Calculate hash
3300 3300
             $files[$relativePath] = md5_file($file->getPathname());
@@ -3324,8 +3324,8 @@  discard block
 block discarded – undo
3324 3324
     // Loop on items
3325 3325
     $item = DB::queryFirstRow(
3326 3326
         'SELECT i.id, i.pw, s.share_key, s.increment_id
3327
-        FROM ' . prefixTable('items') . ' i
3328
-        INNER JOIN ' . prefixTable('sharekeys_items') . ' s ON i.id = s.object_id
3327
+        FROM ' . prefixTable('items').' i
3328
+        INNER JOIN ' . prefixTable('sharekeys_items').' s ON i.id = s.object_id
3329 3329
         WHERE i.perso = %i
3330 3330
             AND s.user_id = %i
3331 3331
         ORDER BY RAND()
@@ -3354,7 +3354,7 @@  discard block
 block discarded – undo
3354 3354
         // Get all items in database
3355 3355
         $rows = DB::queryFirstRow(
3356 3356
             'SELECT count(*) as counter
3357
-            FROM ' . prefixTable('sharekeys_items') . ' s
3357
+            FROM ' . prefixTable('sharekeys_items').' s
3358 3358
             WHERE s.user_id = %i',
3359 3359
             TP_USER_ID
3360 3360
         );
Please login to merge, or discard this patch.
scripts/traits/MigrateUserHandlerTrait.php 2 patches
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -40,24 +40,24 @@  discard block
 block discarded – undo
40 40
     private function migratePersonalItems($arguments) {
41 41
         // Get all subtasks related to this task
42 42
         $subtasks = DB::query(
43
-            'SELECT * FROM ' . prefixTable('background_subtasks') . ' WHERE task_id = %i AND is_in_progress = 0 ORDER BY `task` ASC',
43
+            'SELECT * FROM '.prefixTable('background_subtasks').' WHERE task_id = %i AND is_in_progress = 0 ORDER BY `task` ASC',
44 44
             $this->taskId
45 45
         );
46 46
     
47 47
         if (empty($subtasks)) {
48
-            if (LOG_TASKS=== true) $this->logger->log("No subtask was found for task {$this->taskId}");
48
+            if (LOG_TASKS === true) $this->logger->log("No subtask was found for task {$this->taskId}");
49 49
             return;
50 50
         }
51 51
     
52 52
         // Process each subtask
53 53
         foreach ($subtasks as $subtask) {
54
-            if (LOG_TASKS=== true) $this->logger->log("Processing subtask {$subtask['increment_id']} for task {$this->taskId}");
54
+            if (LOG_TASKS === true) $this->logger->log("Processing subtask {$subtask['increment_id']} for task {$this->taskId}");
55 55
             $this->processMigratePersonalItemsSubtask($subtask, $arguments);
56 56
         }
57 57
     
58 58
         // Are all subtasks completed?
59 59
         $remainingSubtasks = DB::queryFirstField(
60
-            'SELECT COUNT(*) FROM ' . prefixTable('background_subtasks') . ' WHERE task_id = %i AND is_in_progress = 0',
60
+            'SELECT COUNT(*) FROM '.prefixTable('background_subtasks').' WHERE task_id = %i AND is_in_progress = 0',
61 61
             $this->taskId
62 62
         );    
63 63
         if ($remainingSubtasks == 0) {
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
                 $subtask['increment_id']
89 89
             );
90 90
             
91
-            if (LOG_TASKS=== true) $this->logger->log("Subtask is in progress: ".$taskData['step'], 'INFO');
91
+            if (LOG_TASKS === true) $this->logger->log("Subtask is in progress: ".$taskData['step'], 'INFO');
92 92
             switch ($taskData['step'] ?? '') {
93 93
                 case 'user-personal-items-migration-step10':
94 94
                     $this->migratePersonalItemsStep10($taskData, $arguments);
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
                 $subtask['increment_id']
141 141
             );
142 142
             
143
-            $this->logger->log("Subtask {$subtask['increment_id']} failure: " . $e->getMessage(), 'ERROR');
143
+            $this->logger->log("Subtask {$subtask['increment_id']} failure: ".$e->getMessage(), 'ERROR');
144 144
         }
145 145
     }
146 146
     
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
         // get TP_USER private key
164 164
         $userTP = DB::queryFirstRow(
165 165
             'SELECT pw, public_key, private_key
166
-            FROM ' . prefixTable('users') . '
166
+            FROM ' . prefixTable('users').'
167 167
             WHERE id = %i',
168 168
             TP_USER_ID
169 169
         );
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
         // Loop on items
175 175
         $rows = DB::query(
176 176
             'SELECT id, pw
177
-            FROM ' . prefixTable('items') . '
177
+            FROM ' . prefixTable('items').'
178 178
             WHERE perso =  1
179 179
             AND id_tree IN %li
180 180
             ORDER BY id ASC
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
             // Get itemKey from current user
189 189
             $shareKeyForItem = DB::queryFirstRow(
190 190
                 'SELECT share_key, increment_id
191
-                FROM ' . prefixTable('sharekeys_items') . '
191
+                FROM ' . prefixTable('sharekeys_items').'
192 192
                 WHERE object_id = %i AND user_id = %i',
193 193
                 $item['id'],
194 194
                 (int) $arguments['user_id']
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
         // get TP_USER private key
291 291
         $userTP = DB::queryFirstRow(
292 292
             'SELECT pw, public_key, private_key
293
-            FROM ' . prefixTable('users') . '
293
+            FROM ' . prefixTable('users').'
294 294
             WHERE id = %i',
295 295
             TP_USER_ID
296 296
         );
@@ -301,16 +301,16 @@  discard block
 block discarded – undo
301 301
         // Loop on logs
302 302
         $rows = DB::query(
303 303
             'SELECT increment_id
304
-            FROM ' . prefixTable('log_items') . '
304
+            FROM ' . prefixTable('log_items').'
305 305
             WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"
306 306
             ORDER BY increment_id ASC
307
-            LIMIT ' . $taskData['index'] . ', ' . $taskData['nb']
307
+            LIMIT ' . $taskData['index'].', '.$taskData['nb']
308 308
         );
309 309
         foreach ($rows as $record) {
310 310
             // Get itemKey from current user
311 311
             $currentUserKey = DB::queryFirstRow(
312 312
                 'SELECT share_key
313
-                FROM ' . prefixTable('sharekeys_logs') . '
313
+                FROM ' . prefixTable('sharekeys_logs').'
314 314
                 WHERE object_id = %i AND user_id = %i',
315 315
                 $record['increment_id'],
316 316
                 $arguments['user_id']
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
         // get TP_USER private key
367 367
         $userTP = DB::queryFirstRow(
368 368
             'SELECT pw, public_key, private_key
369
-            FROM ' . prefixTable('users') . '
369
+            FROM ' . prefixTable('users').'
370 370
             WHERE id = %i',
371 371
             TP_USER_ID
372 372
         );
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
         // Loop on fields
378 378
         $rows = DB::query(
379 379
             'SELECT id
380
-            FROM ' . prefixTable('categories_items') . '
380
+            FROM ' . prefixTable('categories_items').'
381 381
             WHERE encryption_type = "teampass_aes"
382 382
             ORDER BY id ASC
383 383
             LIMIT %i, %i',
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
             // Get itemKey from current user
389 389
             $currentUserKey = DB::queryFirstRow(
390 390
                 'SELECT share_key
391
-                FROM ' . prefixTable('sharekeys_fields') . '
391
+                FROM ' . prefixTable('sharekeys_fields').'
392 392
                 WHERE object_id = %i AND user_id = %i',
393 393
                 $record['id'],
394 394
                 $arguments['user_id']
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
         // get TP_USER private key
442 442
         $userTP = DB::queryFirstRow(
443 443
             'SELECT pw, public_key, private_key
444
-            FROM ' . prefixTable('users') . '
444
+            FROM ' . prefixTable('users').'
445 445
             WHERE id = %i',
446 446
             TP_USER_ID
447 447
         );
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
         // Loop on suggestions
453 453
         $rows = DB::query(
454 454
             'SELECT id
455
-            FROM ' . prefixTable('suggestion') . '
455
+            FROM ' . prefixTable('suggestion').'
456 456
             ORDER BY id ASC
457 457
             LIMIT %i, %i',
458 458
             $taskData['index'],
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
             // Get itemKey from current user
463 463
             $currentUserKey = DB::queryFirstRow(
464 464
                 'SELECT share_key
465
-                FROM ' . prefixTable('sharekeys_suggestions') . '
465
+                FROM ' . prefixTable('sharekeys_suggestions').'
466 466
                 WHERE object_id = %i AND user_id = %i',
467 467
                 $record['id'],
468 468
                 $arguments['user_id']
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
         // get TP_USER private key
519 519
         $userTP = DB::queryFirstRow(
520 520
             'SELECT pw, public_key, private_key
521
-            FROM ' . prefixTable('users') . '
521
+            FROM ' . prefixTable('users').'
522 522
             WHERE id = %i',
523 523
             TP_USER_ID
524 524
         );
@@ -529,9 +529,9 @@  discard block
 block discarded – undo
529 529
         // Loop on files
530 530
         $rows = DB::query(
531 531
             'SELECT f.id AS id, i.perso AS perso
532
-            FROM ' . prefixTable('files') . ' AS f
533
-            INNER JOIN ' . prefixTable('items') . ' AS i ON i.id = f.id_item
534
-            WHERE f.status = "' . TP_ENCRYPTION_NAME . '"
532
+            FROM ' . prefixTable('files').' AS f
533
+            INNER JOIN ' . prefixTable('items').' AS i ON i.id = f.id_item
534
+            WHERE f.status = "' . TP_ENCRYPTION_NAME.'"
535 535
             LIMIT %i, %i',
536 536
             $taskData['index'],
537 537
             $taskData['nb']
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
             // Get itemKey from current user
541 541
             $currentUserKey = DB::queryFirstRow(
542 542
                 'SELECT share_key, increment_id
543
-                FROM ' . prefixTable('sharekeys_files') . '
543
+                FROM ' . prefixTable('sharekeys_files').'
544 544
                 WHERE object_id = %i AND user_id = %i',
545 545
                 $record['id'],
546 546
                 (int) $arguments['user_id']
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -45,13 +45,17 @@  discard block
 block discarded – undo
45 45
         );
46 46
     
47 47
         if (empty($subtasks)) {
48
-            if (LOG_TASKS=== true) $this->logger->log("No subtask was found for task {$this->taskId}");
48
+            if (LOG_TASKS=== true) {
49
+                $this->logger->log("No subtask was found for task {$this->taskId}");
50
+            }
49 51
             return;
50 52
         }
51 53
     
52 54
         // Process each subtask
53 55
         foreach ($subtasks as $subtask) {
54
-            if (LOG_TASKS=== true) $this->logger->log("Processing subtask {$subtask['increment_id']} for task {$this->taskId}");
56
+            if (LOG_TASKS=== true) {
57
+                $this->logger->log("Processing subtask {$subtask['increment_id']} for task {$this->taskId}");
58
+            }
55 59
             $this->processMigratePersonalItemsSubtask($subtask, $arguments);
56 60
         }
57 61
     
@@ -88,7 +92,9 @@  discard block
 block discarded – undo
88 92
                 $subtask['increment_id']
89 93
             );
90 94
             
91
-            if (LOG_TASKS=== true) $this->logger->log("Subtask is in progress: ".$taskData['step'], 'INFO');
95
+            if (LOG_TASKS=== true) {
96
+                $this->logger->log("Subtask is in progress: ".$taskData['step'], 'INFO');
97
+            }
92 98
             switch ($taskData['step'] ?? '') {
93 99
                 case 'user-personal-items-migration-step10':
94 100
                     $this->migratePersonalItemsStep10($taskData, $arguments);
Please login to merge, or discard this patch.
pages/admin.js.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('admin') === false) {
69 69
     // Not allowed page
70 70
     $session->set('system-error_code', ERR_NOT_ALLOWED);
71
-    include $SETTINGS['cpassman_dir'] . '/error.php';
71
+    include $SETTINGS['cpassman_dir'].'/error.php';
72 72
     exit;
73 73
 }
74 74
 
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
                     // error
154 154
                     toastr.remove();
155 155
                     toastr.error(
156
-                        '<?php echo $lang->get('server_answer_error') . '<br />' . $lang->get('server_returned_data') . ':<br />'; ?>' + data.error,
156
+                        '<?php echo $lang->get('server_answer_error').'<br />'.$lang->get('server_returned_data').':<br />'; ?>' + data.error,
157 157
                         '', {
158 158
                             closeButton: true,
159 159
                             positionClass: 'toast-bottom-right'
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
                     // error
276 276
                     toastr.remove();
277 277
                     toastr.error(
278
-                        '<?php echo $lang->get('server_answer_error') . '<br />' . $lang->get('server_returned_data') . ':<br />'; ?>' + data.error,
278
+                        '<?php echo $lang->get('server_answer_error').'<br />'.$lang->get('server_returned_data').':<br />'; ?>' + data.error,
279 279
                         '', {
280 280
                             closeButton: true,
281 281
                             positionClass: 'toast-bottom-right'
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
                     // error
344 344
                     toastr.remove();
345 345
                     toastr.error(
346
-                        '<?php echo $lang->get('server_answer_error') . '<br />' . $lang->get('server_returned_data') . ':<br />'; ?>' + data.error,
346
+                        '<?php echo $lang->get('server_answer_error').'<br />'.$lang->get('server_returned_data').':<br />'; ?>' + data.error,
347 347
                         '', {
348 348
                             closeButton: true,
349 349
                             positionClass: 'toast-bottom-right'
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
                     // error
553 553
                     toastr.remove();
554 554
                     toastr.error(
555
-                        '<?php echo $lang->get('server_answer_error') . '<br />' . $lang->get('server_returned_data') . ':<br />'; ?>' + data.error,
555
+                        '<?php echo $lang->get('server_answer_error').'<br />'.$lang->get('server_returned_data').':<br />'; ?>' + data.error,
556 556
                         '', {
557 557
                             closeButton: true,
558 558
                             positionClass: 'toast-bottom-right'
@@ -798,7 +798,7 @@  discard block
 block discarded – undo
798 798
                     // error
799 799
                     toastr.remove();
800 800
                     toastr.error(
801
-                        '<?php echo $lang->get('server_answer_error') . '<br />' . $lang->get('server_returned_data') . ':<br />'; ?>' + data.error,
801
+                        '<?php echo $lang->get('server_answer_error').'<br />'.$lang->get('server_returned_data').':<br />'; ?>' + data.error,
802 802
                         '', {
803 803
                             closeButton: true,
804 804
                             positionClass: 'toast-bottom-right'
@@ -897,7 +897,7 @@  discard block
 block discarded – undo
897 897
                     // error
898 898
                     toastr.remove();
899 899
                     toastr.error(
900
-                        '<?php echo $lang->get('server_answer_error') . '<br />' . $lang->get('server_returned_data') . ':<br />'; ?>' + data.error,
900
+                        '<?php echo $lang->get('server_answer_error').'<br />'.$lang->get('server_returned_data').':<br />'; ?>' + data.error,
901 901
                         '', {
902 902
                             closeButton: true,
903 903
                             positionClass: 'toast-bottom-right'
@@ -926,7 +926,7 @@  discard block
 block discarded – undo
926 926
                     
927 927
                     //const className = result.success ? 'success' : 'error';
928 928
                     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>';
929
-                    const message = result.success ? '<?php echo $lang->get('server_returned_data');?>' : 'Error: ' + result.error;
929
+                    const message = result.success ? '<?php echo $lang->get('server_returned_data'); ?>' : 'Error: ' + result.error;
930 930
                     
931 931
                     output += '<li>' + icon + '<b>' + file + '</b><br/>' + message + '</li>';
932 932
                 });
@@ -957,7 +957,7 @@  discard block
 block discarded – undo
957 957
                     // error
958 958
                     toastr.remove();
959 959
                     toastr.error(
960
-                        '<?php echo $lang->get('server_answer_error') . '<br />' . $lang->get('server_returned_data') . ':<br />'; ?>' + data.error,
960
+                        '<?php echo $lang->get('server_answer_error').'<br />'.$lang->get('server_returned_data').':<br />'; ?>' + data.error,
961 961
                         '', {
962 962
                             closeButton: true,
963 963
                             positionClass: 'toast-bottom-right'
@@ -1021,7 +1021,7 @@  discard block
 block discarded – undo
1021 1021
                     // error
1022 1022
                     toastr.remove();
1023 1023
                     toastr.error(
1024
-                        '<?php echo $lang->get('server_answer_error') . '<br />' . $lang->get('server_returned_data') . ':<br />'; ?>' + data.error,
1024
+                        '<?php echo $lang->get('server_answer_error').'<br />'.$lang->get('server_returned_data').':<br />'; ?>' + data.error,
1025 1025
                         '', {
1026 1026
                             closeButton: true,
1027 1027
                             positionClass: 'toast-bottom-right'
Please login to merge, or discard this patch.
scripts/traits/UserHandlerTrait.php 2 patches
Braces   +13 added lines, -5 removed lines patch added patch discarded remove patch
@@ -55,13 +55,17 @@  discard block
 block discarded – undo
55 55
         );
56 56
     
57 57
         if (empty($subtasks)) {
58
-            if (LOG_TASKS=== true) $this->logger->log("No subtask was found for task {$this->taskId}");
58
+            if (LOG_TASKS=== true) {
59
+                $this->logger->log("No subtask was found for task {$this->taskId}");
60
+            }
59 61
             return;
60 62
         }
61 63
     
62 64
         // Process each subtask
63 65
         foreach ($subtasks as $subtask) {
64
-            if (LOG_TASKS=== true) $this->logger->log("Processing subtask {$subtask['increment_id']} for task {$this->taskId}");
66
+            if (LOG_TASKS=== true) {
67
+                $this->logger->log("Processing subtask {$subtask['increment_id']} for task {$this->taskId}");
68
+            }
65 69
             $this->processGenerateUserKeysSubtask($subtask, $arguments);
66 70
         }
67 71
     
@@ -98,7 +102,9 @@  discard block
 block discarded – undo
98 102
                 $subtask['increment_id']
99 103
             );
100 104
             
101
-            if (LOG_TASKS=== true) $this->logger->log("Subtask is in progress: ".$taskData['step'], 'INFO');
105
+            if (LOG_TASKS=== true) {
106
+                $this->logger->log("Subtask is in progress: ".$taskData['step'], 'INFO');
107
+            }
102 108
             switch ($taskData['step'] ?? '') {
103 109
                 case 'step0':
104 110
                     $this->generateNewUserStep0($arguments);
@@ -165,7 +171,9 @@  discard block
 block discarded – undo
165 171
     private function generateNewUserStep0($arguments) {
166 172
         // CLear old sharekeys
167 173
         if ($arguments['user_self_change'] === 0) {
168
-            if (LOG_TASKS=== true) $this->logger->log("Deleting old sharekeys for user {$arguments['new_user_id']}", 'INFO');
174
+            if (LOG_TASKS=== true) {
175
+                $this->logger->log("Deleting old sharekeys for user {$arguments['new_user_id']}", 'INFO');
176
+            }
169 177
             deleteUserObjetsKeys($arguments['new_user_id'], $this->settings);
170 178
         }
171 179
     }
@@ -780,7 +788,7 @@  discard block
 block discarded – undo
780 788
                 'login' => $userInfo['login'],
781 789
                 'name' => $userInfo['name'],
782 790
             ];
783
-        }else {
791
+        } else {
784 792
             // Normal case
785 793
             return [
786 794
                 'private_key' => decryptPrivateKey($pwd, $userInfo['private_key']),
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -50,24 +50,24 @@  discard block
 block discarded – undo
50 50
     private function generateUserKeys($arguments) {
51 51
         // Get all subtasks related to this task
52 52
         $subtasks = DB::query(
53
-            'SELECT * FROM ' . prefixTable('background_subtasks') . ' WHERE task_id = %i AND is_in_progress = 0 ORDER BY `task` ASC',
53
+            'SELECT * FROM '.prefixTable('background_subtasks').' WHERE task_id = %i AND is_in_progress = 0 ORDER BY `task` ASC',
54 54
             $this->taskId
55 55
         );
56 56
     
57 57
         if (empty($subtasks)) {
58
-            if (LOG_TASKS=== true) $this->logger->log("No subtask was found for task {$this->taskId}");
58
+            if (LOG_TASKS === true) $this->logger->log("No subtask was found for task {$this->taskId}");
59 59
             return;
60 60
         }
61 61
     
62 62
         // Process each subtask
63 63
         foreach ($subtasks as $subtask) {
64
-            if (LOG_TASKS=== true) $this->logger->log("Processing subtask {$subtask['increment_id']} for task {$this->taskId}");
64
+            if (LOG_TASKS === true) $this->logger->log("Processing subtask {$subtask['increment_id']} for task {$this->taskId}");
65 65
             $this->processGenerateUserKeysSubtask($subtask, $arguments);
66 66
         }
67 67
     
68 68
         // Are all subtasks completed?
69 69
         $remainingSubtasks = DB::queryFirstField(
70
-            'SELECT COUNT(*) FROM ' . prefixTable('background_subtasks') . ' WHERE task_id = %i AND is_in_progress = 0',
70
+            'SELECT COUNT(*) FROM '.prefixTable('background_subtasks').' WHERE task_id = %i AND is_in_progress = 0',
71 71
             $this->taskId
72 72
         );    
73 73
         if ($remainingSubtasks == 0) {
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
                 $subtask['increment_id']
99 99
             );
100 100
             
101
-            if (LOG_TASKS=== true) $this->logger->log("Subtask is in progress: ".$taskData['step'], 'INFO');
101
+            if (LOG_TASKS === true) $this->logger->log("Subtask is in progress: ".$taskData['step'], 'INFO');
102 102
             switch ($taskData['step'] ?? '') {
103 103
                 case 'step0':
104 104
                     $this->generateNewUserStep0($arguments);
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
                 $subtask['increment_id']
153 153
             );
154 154
             
155
-            $this->logger->log("Subtask {$subtask['increment_id']} failure: " . $e->getMessage(), 'ERROR');
155
+            $this->logger->log("Subtask {$subtask['increment_id']} failure: ".$e->getMessage(), 'ERROR');
156 156
         }
157 157
     }
158 158
     
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
     private function generateNewUserStep0($arguments) {
166 166
         // CLear old sharekeys
167 167
         if ($arguments['user_self_change'] === 0) {
168
-            if (LOG_TASKS=== true) $this->logger->log("Deleting old sharekeys for user {$arguments['new_user_id']}", 'INFO');
168
+            if (LOG_TASKS === true) $this->logger->log("Deleting old sharekeys for user {$arguments['new_user_id']}", 'INFO');
169 169
             deleteUserObjetsKeys($arguments['new_user_id'], $this->settings);
170 170
         }
171 171
     }
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
         // Loop on items
195 195
         $rows = DB::query(
196 196
             'SELECT id, pw, perso
197
-            FROM ' . prefixTable('items') . '
197
+            FROM ' . prefixTable('items').'
198 198
             ORDER BY id ASC
199 199
             LIMIT %i, %i',
200 200
             $taskData['index'],
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
             // Get itemKey from current user
206 206
             $itemShareKey = DB::queryFirstRow(
207 207
                 'SELECT share_key, increment_id
208
-                FROM ' . prefixTable('sharekeys_items') . '
208
+                FROM ' . prefixTable('sharekeys_items').'
209 209
                 WHERE object_id = %i AND user_id = %i',
210 210
                 $record['id'],
211 211
                 (int) $arguments['owner_id']
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
             }
232 232
             
233 233
             // If user is changing his own keys
234
-            if (isset($arguments['user_self_change']) &&(int) $arguments['user_self_change'] === 1) {
234
+            if (isset($arguments['user_self_change']) && (int) $arguments['user_self_change'] === 1) {
235 235
                 // Save the new sharekey correctly encrypted in DB
236 236
                 $affected = DB::update(
237 237
                     prefixTable('sharekeys_items'),
@@ -297,16 +297,16 @@  discard block
 block discarded – undo
297 297
         // Loop on logs
298 298
         $rows = DB::query(
299 299
             'SELECT increment_id
300
-            FROM ' . prefixTable('log_items') . '
300
+            FROM ' . prefixTable('log_items').'
301 301
             WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"
302 302
             ORDER BY increment_id ASC
303
-            LIMIT ' . $taskData['index'] . ', ' . $taskData['nb']
303
+            LIMIT ' . $taskData['index'].', '.$taskData['nb']
304 304
         );
305 305
         foreach ($rows as $record) {
306 306
             // Get itemKey from current user
307 307
             $currentUserKey = DB::queryFirstRow(
308 308
                 'SELECT share_key
309
-                FROM ' . prefixTable('sharekeys_logs') . '
309
+                FROM ' . prefixTable('sharekeys_logs').'
310 310
                 WHERE object_id = %i AND user_id = %i',
311 311
                 $record['increment_id'],
312 312
                 $arguments['owner_id']
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
                 if ((int) $arguments['new_user_id'] !== (int) $arguments['owner_id']) {
339 339
                     $currentUserKey = DB::queryFirstRow(
340 340
                         'SELECT increment_id
341
-                        FROM ' . prefixTable('sharekeys_items') . '
341
+                        FROM ' . prefixTable('sharekeys_items').'
342 342
                         WHERE object_id = %i AND user_id = %i',
343 343
                         $record['id'],
344 344
                         $arguments['new_user_id']
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
         // Loop on fields
387 387
         $rows = DB::query(
388 388
             'SELECT id
389
-            FROM ' . prefixTable('categories_items') . '
389
+            FROM ' . prefixTable('categories_items').'
390 390
             WHERE encryption_type = "teampass_aes"
391 391
             ORDER BY id ASC
392 392
             LIMIT %i, %i',
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
             // Get itemKey from current user
398 398
             $currentUserKey = DB::queryFirstRow(
399 399
                 'SELECT share_key
400
-                FROM ' . prefixTable('sharekeys_fields') . '
400
+                FROM ' . prefixTable('sharekeys_fields').'
401 401
                 WHERE object_id = %i AND user_id = %i',
402 402
                 $record['id'],
403 403
                 $arguments['owner_id']
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
                     if ((int) $arguments['new_user_id'] !== (int) $arguments['owner_id']) {
426 426
                         $currentUserKey = DB::queryFirstRow(
427 427
                             'SELECT increment_id
428
-                            FROM ' . prefixTable('sharekeys_items') . '
428
+                            FROM ' . prefixTable('sharekeys_items').'
429 429
                             WHERE object_id = %i AND user_id = %i',
430 430
                             $record['id'],
431 431
                             $arguments['new_user_id']
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
         // Loop on suggestions
475 475
         $rows = DB::query(
476 476
             'SELECT id
477
-            FROM ' . prefixTable('suggestion') . '
477
+            FROM ' . prefixTable('suggestion').'
478 478
             ORDER BY id ASC
479 479
             LIMIT %i, %i',
480 480
             $taskData['index'],
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
             // Get itemKey from current user
485 485
             $currentUserKey = DB::queryFirstRow(
486 486
                 'SELECT share_key
487
-                FROM ' . prefixTable('sharekeys_suggestions') . '
487
+                FROM ' . prefixTable('sharekeys_suggestions').'
488 488
                 WHERE object_id = %i AND user_id = %i',
489 489
                 $record['id'],
490 490
                 $arguments['owner_id']
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
                 if ((int) $arguments['new_user_id'] !== (int) $arguments['owner_id']) {
517 517
                     $currentUserKey = DB::queryFirstRow(
518 518
                         'SELECT increment_id
519
-                        FROM ' . prefixTable('sharekeys_items') . '
519
+                        FROM ' . prefixTable('sharekeys_items').'
520 520
                         WHERE object_id = %i AND user_id = %i',
521 521
                         $record['id'],
522 522
                         $arguments['new_user_id']
@@ -564,9 +564,9 @@  discard block
 block discarded – undo
564 564
         // Loop on files
565 565
         $rows = DB::query(
566 566
             'SELECT f.id AS id, i.perso AS perso
567
-            FROM ' . prefixTable('files') . ' AS f
568
-            INNER JOIN ' . prefixTable('items') . ' AS i ON i.id = f.id_item
569
-            WHERE f.status = "' . TP_ENCRYPTION_NAME . '"
567
+            FROM ' . prefixTable('files').' AS f
568
+            INNER JOIN ' . prefixTable('items').' AS i ON i.id = f.id_item
569
+            WHERE f.status = "' . TP_ENCRYPTION_NAME.'"
570 570
             LIMIT %i, %i',
571 571
             $taskData['index'],
572 572
             $taskData['nb']
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
             // Get itemKey from current user
576 576
             $currentUserKey = DB::queryFirstRow(
577 577
                 'SELECT share_key, increment_id
578
-                FROM ' . prefixTable('sharekeys_files') . '
578
+                FROM ' . prefixTable('sharekeys_files').'
579 579
                 WHERE object_id = %i AND user_id = %i',
580 580
                 $record['id'],
581 581
                 (int) $record['perso'] === 0 ? $arguments['owner_id'] : $arguments['new_user_id']
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
 
604 604
             $currentUserKey = DB::queryFirstRow(
605 605
                 'SELECT increment_id
606
-                FROM ' . prefixTable('sharekeys_files') . '
606
+                FROM ' . prefixTable('sharekeys_files').'
607 607
                 WHERE object_id = %i AND user_id = %i',
608 608
                 $record['id'],
609 609
                 $arguments['new_user_id']
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
         // get user info
682 682
         $userInfo = DB::queryFirstRow(
683 683
             'SELECT u.email, u.login, u.auth_type, u.special, u.lastname, u.name
684
-            FROM ' . prefixTable('users') . ' AS u
684
+            FROM ' . prefixTable('users').' AS u
685 685
             WHERE u.id = %i',
686 686
             $arguments['new_user_id']
687 687
         );
@@ -696,10 +696,10 @@  discard block
 block discarded – undo
696 696
                 filter_var($userInfo['email'], FILTER_SANITIZE_EMAIL),
697 697
                 // @scrutinizer ignore-type
698 698
                 empty($arguments['email_body']) === false ? $arguments['email_body'] : $lang->get('email_body_user_config_1'),
699
-                'TEAMPASS - ' . $lang->get('login_credentials'),
699
+                'TEAMPASS - '.$lang->get('login_credentials'),
700 700
                 (array) filter_var_array(
701 701
                     [
702
-                        '#code#' => cryption($arguments['new_user_code'], '','decrypt', $this->settings)['string'],
702
+                        '#code#' => cryption($arguments['new_user_code'], '', 'decrypt', $this->settings)['string'],
703 703
                         '#lastname#' => isset($userInfo['name']) === true ? $userInfo['name'] : '',
704 704
                         '#login#' => isset($userInfo['login']) === true ? $userInfo['login'] : '',
705 705
                     ],
@@ -763,24 +763,24 @@  discard block
 block discarded – undo
763 763
     private function getOwnerInfos(int $owner_id, string $owner_pwd, ?int $only_personal_items = 0, ?string $owner_private_key = ''): array {
764 764
         $userInfo = DB::queryFirstRow(
765 765
             'SELECT pw, public_key, private_key, login, name
766
-            FROM ' . prefixTable('users') . '
766
+            FROM ' . prefixTable('users').'
767 767
             WHERE id = %i',
768 768
             $owner_id
769 769
         );
770 770
 
771 771
         // decrypt owner password 
772
-        $pwd = cryption($owner_pwd, '','decrypt', $this->settings)['string'];
772
+        $pwd = cryption($owner_pwd, '', 'decrypt', $this->settings)['string'];
773 773
 
774 774
         // decrypt private key and send back
775 775
         if ((int) $only_personal_items === 1 && empty($owner_private_key) === false) {
776 776
             // Explicitely case where we only want personal items and where user has provided his private key
777 777
             return [
778
-                'private_key' => cryption($owner_private_key, '','decrypt')['string'],
778
+                'private_key' => cryption($owner_private_key, '', 'decrypt')['string'],
779 779
                 'public_key' => $userInfo['public_key'],
780 780
                 'login' => $userInfo['login'],
781 781
                 'name' => $userInfo['name'],
782 782
             ];
783
-        }else {
783
+        } else {
784 784
             // Normal case
785 785
             return [
786 786
                 'private_key' => decryptPrivateKey($pwd, $userInfo['private_key']),
Please login to merge, or discard this patch.
scripts/background_tasks___functions.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -101,11 +101,11 @@  discard block
 block discarded – undo
101 101
 function provideLog(string $message, array $SETTINGS)
102 102
 {
103 103
     if (defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) {
104
-        error_log((string) date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], time()) . ' - '.$message);
104
+        error_log((string) date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], time()).' - '.$message);
105 105
     }
106 106
 }
107 107
 
108
-function performVisibleFoldersHtmlUpdate (int $user_id)
108
+function performVisibleFoldersHtmlUpdate(int $user_id)
109 109
 {
110 110
     $html = [];
111 111
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 
116 116
     // get current folders visible for user
117 117
     $cache_tree = DB::queryFirstRow(
118
-        'SELECT increment_id, data FROM ' . prefixTable('cache_tree') . ' WHERE user_id = %i',
118
+        'SELECT increment_id, data FROM '.prefixTable('cache_tree').' WHERE user_id = %i',
119 119
         $user_id
120 120
     );
121 121
     $folders = json_decode($cache_tree['data'], true);
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 
132 132
         // get folder info
133 133
         $folder = DB::queryFirstRow(
134
-            'SELECT title, parent_id, personal_folder FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
134
+            'SELECT title, parent_id, personal_folder FROM '.prefixTable('nested_tree').' WHERE id = %i',
135 135
             $idFolder
136 136
         );
137 137
 
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 function subTaskStatus($taskId)
167 167
 {
168 168
     $subTasks = DB::query(
169
-        'SELECT * FROM ' . prefixTable('background_subtasks') . ' WHERE task_id = %i',
169
+        'SELECT * FROM '.prefixTable('background_subtasks').' WHERE task_id = %i',
170 170
         $taskId
171 171
     );
172 172
 
Please login to merge, or discard this patch.
pages/users.js.php 1 patch
Spacing   +11 added lines, -11 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('users') === 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
 ?>
@@ -318,8 +318,8 @@  discard block
 block discarded – undo
318 318
         if (store.get('teampassApplication').formUserAction === "add_new_user") {
319 319
             var data = {
320 320
                 'receipt': $('#form-email').val(),
321
-                'subject': 'TEAMPASS - <?php echo $lang->get('temporary_encryption_code');?>',
322
-                'body': '<?php echo $lang->get('email_body_new_user');?>',
321
+                'subject': 'TEAMPASS - <?php echo $lang->get('temporary_encryption_code'); ?>',
322
+                'body': '<?php echo $lang->get('email_body_new_user'); ?>',
323 323
                 'pre_replace' : {
324 324
                     '#code#' : store.get('teampassUser').admin_new_user_temporary_encryption_code,
325 325
                     '#login#' : store.get('teampassUser').admin_new_user_login,
@@ -329,8 +329,8 @@  discard block
 block discarded – undo
329 329
         } else {
330 330
             var data = {
331 331
                 'receipt': $('#form-email').val(),
332
-                'subject': 'TEAMPASS - <?php echo $lang->get('temporary_encryption_code');?>',
333
-                'body': '<?php echo $lang->get('email_body_temporary_encryption_code');?>',
332
+                'subject': 'TEAMPASS - <?php echo $lang->get('temporary_encryption_code'); ?>',
333
+                'body': '<?php echo $lang->get('email_body_temporary_encryption_code'); ?>',
334 334
                 'pre_replace' : {
335 335
                     '#enc_code#' : store.get('teampassUser').admin_new_user_temporary_encryption_code,
336 336
                 }
@@ -525,14 +525,14 @@  discard block
 block discarded – undo
525 525
             }
526 526
             // Inform user
527 527
             $("#warningModalBody").html('<b><?php echo $lang->get('encryption_keys'); ?> - ' +
528
-                stepText + '</b> [' + start + ' - ' + (parseInt(start) + <?php echo NUMBER_ITEMS_IN_BATCH;?>) + ']<span id="warningModalBody_extra">' + $nbItemsToConvert + '</span> ' +
528
+                stepText + '</b> [' + start + ' - ' + (parseInt(start) + <?php echo NUMBER_ITEMS_IN_BATCH; ?>) + ']<span id="warningModalBody_extra">' + $nbItemsToConvert + '</span> ' +
529 529
                 '... <?php echo $lang->get('please_wait'); ?><i class="fa-solid fa-spinner fa-pulse ml-3 text-primary"></i>');
530 530
 
531 531
             // If expected, show the OPT to the admin
532 532
             if (constVisibleOTP === true) {
533 533
                 toastr.info(
534
-                    '<?php echo $lang->get('show_encryption_code_to_admin');?> <div><input class="form-control form-item-control flex-nowrap" value="' + userTemporaryCode + '" readonly></div>'
535
-                    + '<br /><button type="button" class="btn clear"><?php echo $lang->get('close');?></button>',
534
+                    '<?php echo $lang->get('show_encryption_code_to_admin'); ?> <div><input class="form-control form-item-control flex-nowrap" value="' + userTemporaryCode + '" readonly></div>'
535
+                    + '<br /><button type="button" class="btn clear"><?php echo $lang->get('close'); ?></button>',
536 536
                     '<?php echo $lang->get('information'); ?>',
537 537
                     {
538 538
                         extendedTimeOut: 0,
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
             var data = {
552 552
                 action: step,
553 553
                 start: start,
554
-                length: <?php echo NUMBER_ITEMS_IN_BATCH;?>,
554
+                length: <?php echo NUMBER_ITEMS_IN_BATCH; ?>,
555 555
                 user_id: userId,
556 556
             }
557 557
             if (debugJavascript === true) {
@@ -1405,7 +1405,7 @@  discard block
 block discarded – undo
1405 1405
                         } else {
1406 1406
                             // Show icon or not
1407 1407
                             if ($('#user-disabled').prop('checked') === true) {
1408
-                                $('#user-login-'+userID).before('<i class="fa-solid fa-user-slash infotip text-danger mr-2" title="<?php echo $lang->get('account_is_locked');?>" id="user-disable-'+userID+'"></i>');
1408
+                                $('#user-login-'+userID).before('<i class="fa-solid fa-user-slash infotip text-danger mr-2" title="<?php echo $lang->get('account_is_locked'); ?>" id="user-disable-'+userID+'"></i>');
1409 1409
                             } else {
1410 1410
                                 $('#user-disable-'+userID).remove();
1411 1411
                             }
@@ -3037,7 +3037,7 @@  discard block
 block discarded – undo
3037 3037
             const data_otc = {
3038 3038
                 error: false,
3039 3039
                 code: userTemporaryCode,
3040
-                visible_otp: <?php echo ADMIN_VISIBLE_OTP_ON_LDAP_IMPORT;?>  // Pas besoin de montrer le OTP car il est déjà fourni
3040
+                visible_otp: <?php echo ADMIN_VISIBLE_OTP_ON_LDAP_IMPORT; ?>  // Pas besoin de montrer le OTP car il est déjà fourni
3041 3041
             };
3042 3042
 
3043 3043
             // Passer directement à la création des tâches
Please login to merge, or discard this patch.