Passed
Push — dev ( 8b84d5...475726 )
by Nils
05:50
created
sources/admin.queries.php 1 patch
Spacing   +143 added lines, -143 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('admin') === false) {
68 68
     // Not allowed page
69 69
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
70
-    include $SETTINGS['cpassman_dir'] . '/error.php';
70
+    include $SETTINGS['cpassman_dir'].'/error.php';
71 71
     exit;
72 72
 }
73 73
 
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
                         array(
121 121
                             'http' => array(
122 122
                                 'ignore_errors' => true,
123
-                                'proxy' => $SETTINGS['proxy_ip'] . ':' . $SETTINGS['proxy_port'],
123
+                                'proxy' => $SETTINGS['proxy_ip'].':'.$SETTINGS['proxy_port'],
124 124
                             ),
125 125
                         )
126 126
                     );
@@ -139,16 +139,16 @@  discard block
 block discarded – undo
139 139
                     $json_array = json_decode($json, true);
140 140
 
141 141
                     // About version
142
-                    $text .= '<li><u>' . $LANG['your_version'] . '</u> : ' . TP_VERSION;
142
+                    $text .= '<li><u>'.$LANG['your_version'].'</u> : '.TP_VERSION;
143 143
                     if (floatval(TP_VERSION) < floatval($json_array['info']['version'])) {
144
-                        $text .= '&nbsp;&nbsp;<b>' . $LANG['please_update'] . '</b>';
144
+                        $text .= '&nbsp;&nbsp;<b>'.$LANG['please_update'].'</b>';
145 145
                     }
146 146
                     $text .= '</li>';
147 147
 
148 148
                     // Libraries
149 149
                     $text .= '<li><u>Libraries</u> :</li>';
150 150
                     foreach ($json_array['libraries'] as $key => $val) {
151
-                        $text .= "<li>&nbsp;<span class='fa fa-caret-right'></span>&nbsp;" . $key . " (<a href='" . $val . "' target='_blank'>" . $val . '</a>)</li>';
151
+                        $text .= "<li>&nbsp;<span class='fa fa-caret-right'></span>&nbsp;".$key." (<a href='".$val."' target='_blank'>".$val.'</a>)</li>';
152 152
                     }
153 153
                 }
154 154
             } else {
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
         }
160 160
         $text .= '</ul>';
161 161
 
162
-        echo '[{"error":"' . $error . '" , "output":"' . str_replace(array("\n", "\t", "\r"), '', $text) . '"}]';
162
+        echo '[{"error":"'.$error.'" , "output":"'.str_replace(array("\n", "\t", "\r"), '', $text).'"}]';
163 163
         break;
164 164
         
165 165
 
@@ -189,21 +189,21 @@  discard block
 block discarded – undo
189 189
             break;
190 190
         }
191 191
 
192
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
192
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
193 193
         $return = '';
194 194
 
195 195
         //Get all tables
196 196
         $tables = array();
197 197
         $result = DB::query('SHOW TABLES');
198 198
         foreach ($result as $row) {
199
-            $tables[] = $row['Tables_in_' . $database];
199
+            $tables[] = $row['Tables_in_'.$database];
200 200
         }
201 201
 
202 202
         //cycle through
203 203
         foreach ($tables as $table) {
204 204
             if (defined('DB_PREFIX') || substr_count($table, DB_PREFIX) > 0) {
205 205
                 // Do query
206
-                $result = DB::queryRaw('SELECT * FROM ' . $table);
206
+                $result = DB::queryRaw('SELECT * FROM '.$table);
207 207
                 DB::queryRaw(
208 208
                     'SELECT *
209 209
                     FROM INFORMATION_SCHEMA.COLUMNS
@@ -215,19 +215,19 @@  discard block
 block discarded – undo
215 215
                 $numFields = DB::count();
216 216
 
217 217
                 // prepare a drop table
218
-                $return .= 'DROP TABLE ' . $table . ';';
219
-                $row2 = DB::queryfirstrow('SHOW CREATE TABLE ' . $table);
220
-                $return .= "\n\n" . $row2['Create Table'] . ";\n\n";
218
+                $return .= 'DROP TABLE '.$table.';';
219
+                $row2 = DB::queryfirstrow('SHOW CREATE TABLE '.$table);
220
+                $return .= "\n\n".$row2['Create Table'].";\n\n";
221 221
 
222 222
                 //prepare all fields and datas
223 223
                 for ($i = 0; $i < $numFields; ++$i) {
224 224
                     while ($row = $result->fetch_row()) {
225
-                        $return .= 'INSERT INTO ' . $table . ' VALUES(';
225
+                        $return .= 'INSERT INTO '.$table.' VALUES(';
226 226
                         for ($j = 0; $j < $numFields; ++$j) {
227 227
                             $row[$j] = addslashes($row[$j]);
228 228
                             $row[$j] = preg_replace("/\n/", '\\n', $row[$j]);
229 229
                             if (isset($row[$j])) {
230
-                                $return .= '"' . $row[$j] . '"';
230
+                                $return .= '"'.$row[$j].'"';
231 231
                             } else {
232 232
                                 $return .= 'NULL';
233 233
                             }
@@ -247,8 +247,8 @@  discard block
 block discarded – undo
247 247
             $token = GenerateCryptKey(20, false, true, true, false, true, $SETTINGS);
248 248
 
249 249
             //save file
250
-            $filename = time() . '-' . $token . '.sql';
251
-            $handle = fopen($SETTINGS['path_to_files_folder'] . '/' . $filename, 'w+');
250
+            $filename = time().'-'.$token.'.sql';
251
+            $handle = fopen($SETTINGS['path_to_files_folder'].'/'.$filename, 'w+');
252 252
             if ($handle !== false) {
253 253
                 //write file
254 254
                 fwrite($handle, $return);
@@ -260,17 +260,17 @@  discard block
 block discarded – undo
260 260
                 // Encrypt the file
261 261
                 prepareFileWithDefuse(
262 262
                     'encrypt',
263
-                    $SETTINGS['path_to_files_folder'] . '/' . $filename,
264
-                    $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
263
+                    $SETTINGS['path_to_files_folder'].'/'.$filename,
264
+                    $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
265 265
                     $SETTINGS,
266 266
                     $post_option
267 267
                 );
268 268
 
269 269
                 // Do clean
270
-                unlink($SETTINGS['path_to_files_folder'] . '/' . $filename);
270
+                unlink($SETTINGS['path_to_files_folder'].'/'.$filename);
271 271
                 rename(
272
-                    $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
273
-                    $SETTINGS['path_to_files_folder'] . '/' . $filename
272
+                    $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
273
+                    $SETTINGS['path_to_files_folder'].'/'.$filename
274 274
                 );
275 275
             }
276 276
 
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
             //update LOG
281 281
             logEvents($SETTINGS, 'admin_action', 'dataBase backup', (string) $_SESSION['user_id'], $_SESSION['login']);
282 282
 
283
-            echo '[{"result":"db_backup" , "href":"sources/downloadFile.php?name=' . urlencode($filename) . '&sub=files&file=' . $filename . '&type=sql&key=' . $_SESSION['key'] . '&key_tmp=' . $_SESSION['key_tmp'] . '&pathIsFiles=1"}]';
283
+            echo '[{"result":"db_backup" , "href":"sources/downloadFile.php?name='.urlencode($filename).'&sub=files&file='.$filename.'&type=sql&key='.$_SESSION['key'].'&key_tmp='.$_SESSION['key_tmp'].'&pathIsFiles=1"}]';
284 284
         }
285 285
         break;
286 286
 
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
             );
310 310
             break;
311 311
         }
312
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
312
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
313 313
 
314 314
         $dataPost = explode('&', $post_option);
315 315
         $file = htmlspecialchars($dataPost[0]);
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
         // Get filename from database
319 319
         $data = DB::queryFirstRow(
320 320
             'SELECT valeur
321
-            FROM ' . prefixTable('misc') . '
321
+            FROM ' . prefixTable('misc').'
322 322
             WHERE increment_id = %i',
323 323
             $file
324 324
         );
@@ -337,22 +337,22 @@  discard block
 block discarded – undo
337 337
             // Decrypt the file
338 338
             $ret = prepareFileWithDefuse(
339 339
                 'decrypt',
340
-                $SETTINGS['path_to_files_folder'] . '/' . $file,
341
-                $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $file,
340
+                $SETTINGS['path_to_files_folder'].'/'.$file,
341
+                $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$file,
342 342
                 $SETTINGS,
343 343
                 $key
344 344
             );
345 345
 
346 346
             if (empty($ret) === false) {
347
-                echo '[{"result":"db_restore" , "message":"' . $ret . '"}]';
347
+                echo '[{"result":"db_restore" , "message":"'.$ret.'"}]';
348 348
                 break;
349 349
             }
350 350
 
351 351
             // Do clean
352
-            fileDelete($SETTINGS['path_to_files_folder'] . '/' . $file, $SETTINGS);
353
-            $file = $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $file;
352
+            fileDelete($SETTINGS['path_to_files_folder'].'/'.$file, $SETTINGS);
353
+            $file = $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$file;
354 354
         } else {
355
-            $file = $SETTINGS['path_to_files_folder'] . '/' . $file;
355
+            $file = $SETTINGS['path_to_files_folder'].'/'.$file;
356 356
         }
357 357
 
358 358
         //read sql file
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
         fclose($handle);
370 370
 
371 371
         //delete file
372
-        unlink($SETTINGS['path_to_files_folder'] . '/' . $file);
372
+        unlink($SETTINGS['path_to_files_folder'].'/'.$file);
373 373
 
374 374
         //Show done
375 375
         echo '[{"result":"db_restore" , "message":""}]';
@@ -407,8 +407,8 @@  discard block
 block discarded – undo
407 407
             foreach ($table as $i => $tablename) {
408 408
                 if (substr_count($tablename, DB_PREFIX) > 0) {
409 409
                     // launch optimization quieries
410
-                    DB::query('ANALYZE TABLE `' . $tablename . '`');
411
-                    DB::query('OPTIMIZE TABLE `' . $tablename . '`');
410
+                    DB::query('ANALYZE TABLE `'.$tablename.'`');
411
+                    DB::query('OPTIMIZE TABLE `'.$tablename.'`');
412 412
                 }
413 413
             }
414 414
         }
@@ -416,12 +416,12 @@  discard block
 block discarded – undo
416 416
         //Clean up LOG_ITEMS table
417 417
         $rows = DB::query(
418 418
             'SELECT id
419
-            FROM ' . prefixTable('items') . '
419
+            FROM ' . prefixTable('items').'
420 420
             ORDER BY id ASC'
421 421
         );
422 422
         foreach ($rows as $item) {
423 423
             DB::query(
424
-                'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i AND action = %s',
424
+                'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i AND action = %s',
425 425
                 $item['id'],
426 426
                 'at_creation'
427 427
             );
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
             if ($counter === 0) {
430 430
                 //Create new at_creation entry
431 431
                 $rowTmp = DB::queryFirstRow(
432
-                    'SELECT date, id_user FROM ' . prefixTable('log_items') . ' WHERE id_item=%i ORDER BY date ASC',
432
+                    'SELECT date, id_user FROM '.prefixTable('log_items').' WHERE id_item=%i ORDER BY date ASC',
433 433
                     $item['id']
434 434
                 );
435 435
                 DB::insert(
@@ -459,8 +459,8 @@  discard block
 block discarded – undo
459 459
         echo prepareExchangedData(
460 460
             array(
461 461
                 'error' => false,
462
-                'message' => langHdl('last_execution') . ' ' .
463
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
462
+                'message' => langHdl('last_execution').' '.
463
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
464 464
                     '<i class="fas fa-check text-success ml-2"></i>',
465 465
             ),
466 466
             'encode'
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
             break;
497 497
         }
498 498
 
499
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
499
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
500 500
         updateCacheTable('reload', $SETTINGS, NULL);
501 501
 
502 502
         // Log
@@ -512,8 +512,8 @@  discard block
 block discarded – undo
512 512
         echo prepareExchangedData(
513 513
             [
514 514
                 'error' => false,
515
-                'message' => langHdl('last_execution') . ' ' .
516
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
515
+                'message' => langHdl('last_execution').' '.
516
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
517 517
                     '<i class="fas fa-check text-success mr-2"></i>',
518 518
             ],
519 519
             'encode'
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
         }
549 549
 
550 550
         // Perform
551
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
551
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
552 552
         $ret = handleConfigFile('rebuild', $SETTINGS);
553 553
 
554 554
         // Log
@@ -575,8 +575,8 @@  discard block
 block discarded – undo
575 575
         echo prepareExchangedData(
576 576
             array(
577 577
                 'error' => false,
578
-                'message' => langHdl('last_execution') . ' ' .
579
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
578
+                'message' => langHdl('last_execution').' '.
579
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
580 580
                     '<i class="fas fa-check text-success ml-2"></i>',
581 581
             ),
582 582
             'encode'
@@ -616,18 +616,18 @@  discard block
 block discarded – undo
616 616
         $filename = $post_option;
617 617
         $tp_settings = [];
618 618
         //get backups infos
619
-        $rows = DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s', 'admin');
619
+        $rows = DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s', 'admin');
620 620
         foreach ($rows as $record) {
621 621
             $tp_settings[$record['intitule']] = $record['valeur'];
622 622
         }
623 623
 
624 624
         // check if backup file is in DB.
625 625
         // If YES then it is encrypted with DEFUSE
626
-        $bck = DB::queryFirstRow('SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'backup', 'filename');
626
+        $bck = DB::queryFirstRow('SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'backup', 'filename');
627 627
 
628 628
         //read file
629 629
         $return = '';
630
-        $Fnm = $tp_settings['bck_script_path'] . '/' . $filename . '.sql';
630
+        $Fnm = $tp_settings['bck_script_path'].'/'.$filename.'.sql';
631 631
         if (file_exists($Fnm)) {
632 632
             if (!empty($bck) && $bck['valeur'] === $filename) {
633 633
                 $err = '';
@@ -635,8 +635,8 @@  discard block
 block discarded – undo
635 635
                 // it means that file is DEFUSE encrypted
636 636
                 try {
637 637
                     File::decryptFileWithPassword(
638
-                        $SETTINGS['bck_script_path'] . '/' . $post_option . '.sql',
639
-                        $SETTINGS['bck_script_path'] . '/' . str_replace('encrypted', 'clear', $filename) . '.sql',
638
+                        $SETTINGS['bck_script_path'].'/'.$post_option.'.sql',
639
+                        $SETTINGS['bck_script_path'].'/'.str_replace('encrypted', 'clear', $filename).'.sql',
640 640
                         base64_decode($SETTINGS['bck_script_key'])
641 641
                     );
642 642
                 } catch (Exception\WrongKeyOrModifiedCiphertextException $ex) {
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
                 }
645 645
 
646 646
                 if (!empty($err)) {
647
-                    echo '[{ "result":"backup_decrypt_fails" , "msg":"' . $err . '"}]';
647
+                    echo '[{ "result":"backup_decrypt_fails" , "msg":"'.$err.'"}]';
648 648
                     break;
649 649
                 }
650 650
             } else {
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
 
667 667
                 //save the file
668 668
                 if (is_null($return) === false) {
669
-                    $handle = fopen($tp_settings['bck_script_path'] . '/' . $filename . '.clear.sql', 'w+');
669
+                    $handle = fopen($tp_settings['bck_script_path'].'/'.$filename.'.clear.sql', 'w+');
670 670
                     if ($handle !== false) {
671 671
                         fwrite($handle, $return);
672 672
                         fclose($handle);
@@ -674,12 +674,12 @@  discard block
 block discarded – undo
674 674
                 }
675 675
             }
676 676
             $result = 'backup_decrypt_success';
677
-            $msg = $tp_settings['bck_script_path'] . '/' . $filename . '.clear.sql';
677
+            $msg = $tp_settings['bck_script_path'].'/'.$filename.'.clear.sql';
678 678
         } else {
679 679
             $result = 'backup_decrypt_fails';
680
-            $msg = 'File not found: ' . $Fnm;
680
+            $msg = 'File not found: '.$Fnm;
681 681
         }
682
-        echo '[{ "result":"' . $result . '" , "msg":"' . $msg . '"}]';
682
+        echo '[{ "result":"'.$result.'" , "msg":"'.$msg.'"}]';
683 683
         break;
684 684
 
685 685
         /*
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
         $_SESSION['reencrypt_old_salt'] = file_get_contents(SECUREPATH.'/'.SECUREFILE);
717 717
 
718 718
         // generate new saltkey
719
-        $old_sk_filename = SECUREPATH.'/'.SECUREFILE . date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))) . '.' . time();
719
+        $old_sk_filename = SECUREPATH.'/'.SECUREFILE.date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))).'.'.time();
720 720
         copy(
721 721
             SECUREPATH.'/'.SECUREFILE,
722 722
             $old_sk_filename
@@ -744,13 +744,13 @@  discard block
 block discarded – undo
744 744
         logEvents($SETTINGS, 'system', 'change_salt_key', (string) $_SESSION['user_id'], $_SESSION['login']);
745 745
 
746 746
         // get number of items to change
747
-        DB::query('SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i', 0);
747
+        DB::query('SELECT id FROM '.prefixTable('items').' WHERE perso = %i', 0);
748 748
         $nb_of_items = DB::count();
749 749
 
750 750
         // create backup table
751
-        DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
751
+        DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup'));
752 752
         DB::query(
753
-            'CREATE TABLE `' . prefixTable('sk_reencrypt_backup') . '` (
753
+            'CREATE TABLE `'.prefixTable('sk_reencrypt_backup').'` (
754 754
             `id` int(12) NOT null AUTO_INCREMENT,
755 755
             `current_table` varchar(100) NOT NULL,
756 756
             `current_field` varchar(500) NOT NULL,
@@ -778,7 +778,7 @@  discard block
 block discarded – undo
778 778
         );
779 779
 
780 780
         // delete previous backup files
781
-        $files = glob($SETTINGS['path_to_upload_folder'] . '/*'); // get all file names
781
+        $files = glob($SETTINGS['path_to_upload_folder'].'/*'); // get all file names
782 782
         foreach ($files as $file) { // iterate files
783 783
             if (is_file($file)) {
784 784
                 $file_parts = pathinfo($file);
@@ -860,7 +860,7 @@  discard block
 block discarded – undo
860 860
                 echo prepareExchangedData(
861 861
                     array(
862 862
                         'error' => true,
863
-                        'message' => 'Input `' . $objects[0] . '` is not allowed',
863
+                        'message' => 'Input `'.$objects[0].'` is not allowed',
864 864
                         'nbOfItems' => '',
865 865
                         'nextAction' => '',
866 866
                     ),
@@ -873,9 +873,9 @@  discard block
 block discarded – undo
873 873
                 //change all encrypted data in Items (passwords)
874 874
                 $rows = DB::query(
875 875
                     'SELECT id, pw, pw_iv
876
-                    FROM ' . prefixTable('items') . '
876
+                    FROM ' . prefixTable('items').'
877 877
                     WHERE perso = %s
878
-                    LIMIT ' . $post_start . ', ' . $post_length,
878
+                    LIMIT ' . $post_start.', '.$post_length,
879 879
                     '0'
880 880
                 );
881 881
                 foreach ($rows as $record) {
@@ -887,7 +887,7 @@  discard block
 block discarded – undo
887 887
                             'current_field' => 'pw',
888 888
                             'value_id' => $record['id'],
889 889
                             'value' => $record['pw'],
890
-                            'current_sql' => 'UPDATE ' . prefixTable('items') . " SET pw = '" . $record['pw'] . "' WHERE id = '" . $record['id'] . "';",
890
+                            'current_sql' => 'UPDATE '.prefixTable('items')." SET pw = '".$record['pw']."' WHERE id = '".$record['id']."';",
891 891
                             'value2' => 'none',
892 892
                             'result' => 'none',
893 893
                         )
@@ -936,9 +936,9 @@  discard block
 block discarded – undo
936 936
                 //change all encrypted data in Logs (passwords)
937 937
                 $rows = DB::query(
938 938
                     'SELECT raison, increment_id
939
-                    FROM ' . prefixTable('log_items') . "
939
+                    FROM ' . prefixTable('log_items')."
940 940
                     WHERE action = %s AND raison LIKE 'at_pw :%'
941
-                    LIMIT " . $post_start . ', ' . $post_length,
941
+                    LIMIT " . $post_start.', '.$post_length,
942 942
                     'at_modification'
943 943
                 );
944 944
                 foreach ($rows as $record) {
@@ -950,7 +950,7 @@  discard block
 block discarded – undo
950 950
                             'current_field' => 'raison',
951 951
                             'value_id' => $record['increment_id'],
952 952
                             'value' => $record['raison'],
953
-                            'current_sql' => 'UPDATE ' . prefixTable('log_items') . " SET raison = '" . $record['raison'] . "' WHERE increment_id = '" . $record['increment_id'] . "';",
953
+                            'current_sql' => 'UPDATE '.prefixTable('log_items')." SET raison = '".$record['raison']."' WHERE increment_id = '".$record['increment_id']."';",
954 954
                             'value2' => 'none',
955 955
                             'result' => 'none',
956 956
                         )
@@ -978,7 +978,7 @@  discard block
 block discarded – undo
978 978
                         DB::update(
979 979
                             prefixTable('log_items'),
980 980
                             array(
981
-                                'raison' => 'at_pw :' . $encrypt['string'],
981
+                                'raison' => 'at_pw :'.$encrypt['string'],
982 982
                                 'encryption_type' => 'defuse',
983 983
                             ),
984 984
                             'increment_id = %i',
@@ -1003,8 +1003,8 @@  discard block
 block discarded – undo
1003 1003
                 //change all encrypted data in CATEGORIES (passwords)
1004 1004
                 $rows = DB::query(
1005 1005
                     'SELECT id, data
1006
-                    FROM ' . prefixTable('categories_items') . '
1007
-                    LIMIT ' . $post_start . ', ' . $post_length
1006
+                    FROM ' . prefixTable('categories_items').'
1007
+                    LIMIT ' . $post_start.', '.$post_length
1008 1008
                 );
1009 1009
                 foreach ($rows as $record) {
1010 1010
                     // backup data
@@ -1015,7 +1015,7 @@  discard block
 block discarded – undo
1015 1015
                             'current_field' => 'data',
1016 1016
                             'value_id' => $record['id'],
1017 1017
                             'value' => $record['data'],
1018
-                            'current_sql' => 'UPDATE ' . prefixTable('categories_items') . " SET data = '" . $record['data'] . "' WHERE id = '" . $record['id'] . "';",
1018
+                            'current_sql' => 'UPDATE '.prefixTable('categories_items')." SET data = '".$record['data']."' WHERE id = '".$record['id']."';",
1019 1019
                             'value2' => 'none',
1020 1020
                             'result' => 'none',
1021 1021
                         )
@@ -1063,9 +1063,9 @@  discard block
 block discarded – undo
1063 1063
                 // Change all encrypted data in FILES (passwords)
1064 1064
                 $rows = DB::query(
1065 1065
                     'SELECT id, file, status
1066
-                    FROM ' . prefixTable('files') . "
1066
+                    FROM ' . prefixTable('files')."
1067 1067
                     WHERE status = 'encrypted'
1068
-                    LIMIT " . $post_start . ', ' . $post_length
1068
+                    LIMIT " . $post_start.', '.$post_length
1069 1069
                 );
1070 1070
                 foreach ($rows as $record) {
1071 1071
                     // backup data
@@ -1083,20 +1083,20 @@  discard block
 block discarded – undo
1083 1083
                     );
1084 1084
                     $newID = DB::insertId();
1085 1085
 
1086
-                    if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['file'])) {
1086
+                    if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['file'])) {
1087 1087
                         // make a copy of file
1088 1088
                         if (!copy(
1089
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
1090
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '.copy'
1089
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
1090
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'.copy'
1091 1091
                         )) {
1092 1092
                             $error = 'Copy not possible';
1093 1093
                             exit;
1094 1094
                         } else {
1095 1095
                             // prepare a bck of file (that will not be deleted)
1096
-                            $backup_filename = $record['file'] . '.bck-change-sk.' . time();
1096
+                            $backup_filename = $record['file'].'.bck-change-sk.'.time();
1097 1097
                             copy(
1098
-                                $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
1099
-                                $SETTINGS['path_to_upload_folder'] . '/' . $backup_filename
1098
+                                $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
1099
+                                $SETTINGS['path_to_upload_folder'].'/'.$backup_filename
1100 1100
                             );
1101 1101
                         }
1102 1102
 
@@ -1104,24 +1104,24 @@  discard block
 block discarded – undo
1104 1104
                         // STEP1 - Do decryption
1105 1105
                         prepareFileWithDefuse(
1106 1106
                             'decrypt',
1107
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
1108
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted',
1107
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
1108
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted',
1109 1109
                             $SETTINGS
1110 1110
                         );
1111 1111
 
1112 1112
                         // Do cleanup of files
1113
-                        unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['file']);
1113
+                        unlink($SETTINGS['path_to_upload_folder'].'/'.$record['file']);
1114 1114
 
1115 1115
                         // STEP2 - Do encryption
1116 1116
                         prepareFileWithDefuse(
1117 1117
                             'encryp',
1118
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted',
1119
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
1118
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted',
1119
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
1120 1120
                             $SETTINGS
1121 1121
                         );
1122 1122
 
1123 1123
                         // Do cleanup of files
1124
-                        unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted');
1124
+                        unlink($SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted');
1125 1125
 
1126 1126
                         // Update backup table
1127 1127
                         DB::update(
@@ -1147,13 +1147,13 @@  discard block
 block discarded – undo
1147 1147
                 // do some things for new object
1148 1148
                 if (isset($objects[0])) {
1149 1149
                     if ($objects[0] === 'logs') {
1150
-                        DB::query('SELECT increment_id FROM ' . prefixTable('log_items') . " WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
1150
+                        DB::query('SELECT increment_id FROM '.prefixTable('log_items')." WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
1151 1151
                     } elseif ($objects[0] === 'files') {
1152
-                        DB::query('SELECT id FROM ' . prefixTable('files'));
1152
+                        DB::query('SELECT id FROM '.prefixTable('files'));
1153 1153
                     } elseif ($objects[0] === 'categories') {
1154
-                        DB::query('SELECT id FROM ' . prefixTable('categories_items'));
1154
+                        DB::query('SELECT id FROM '.prefixTable('categories_items'));
1155 1155
                     } elseif ($objects[0] === 'custfields') {
1156
-                        DB::query('SELECT raison FROM ' . prefixTable('log_items') . " WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
1156
+                        DB::query('SELECT raison FROM '.prefixTable('log_items')." WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
1157 1157
                     }
1158 1158
                     $nb_of_items = DB::count();
1159 1159
                 } else {
@@ -1272,12 +1272,12 @@  discard block
 block discarded – undo
1272 1272
                 );
1273 1273
             } elseif ($record['current_table'] === 'files') {
1274 1274
                 // restore backup file
1275
-                if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value'])) {
1276
-                    unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['value']);
1277
-                    if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value2'])) {
1275
+                if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value'])) {
1276
+                    unlink($SETTINGS['path_to_upload_folder'].'/'.$record['value']);
1277
+                    if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value2'])) {
1278 1278
                         rename(
1279
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['value2'],
1280
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['value']
1279
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['value2'],
1280
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['value']
1281 1281
                         );
1282 1282
                     }
1283 1283
                 }
@@ -1296,7 +1296,7 @@  discard block
 block discarded – undo
1296 1296
         }
1297 1297
 
1298 1298
         // drop table
1299
-        DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
1299
+        DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup'));
1300 1300
 
1301 1301
         // Send back
1302 1302
         echo prepareExchangedData(
@@ -1339,17 +1339,17 @@  discard block
 block discarded – undo
1339 1339
         // delete files
1340 1340
         $rows = DB::query(
1341 1341
             'SELECT value, value2
1342
-            FROM ' . prefixTable('sk_reencrypt_backup') . "
1342
+            FROM ' . prefixTable('sk_reencrypt_backup')."
1343 1343
             WHERE current_table = 'files'"
1344 1344
         );
1345 1345
         foreach ($rows as $record) {
1346
-            if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value2'])) {
1347
-                unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['value2']);
1346
+            if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value2'])) {
1347
+                unlink($SETTINGS['path_to_upload_folder'].'/'.$record['value2']);
1348 1348
             }
1349 1349
         }
1350 1350
 
1351 1351
         // drop table
1352
-        DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
1352
+        DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup'));
1353 1353
 
1354 1354
         echo '[{"status":"done"}]';
1355 1355
         break;
@@ -1381,7 +1381,7 @@  discard block
 block discarded – undo
1381 1381
             );
1382 1382
             break;
1383 1383
         } else {
1384
-            require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1384
+            require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1385 1385
 
1386 1386
             //send email
1387 1387
             sendEmail(
@@ -1417,11 +1417,11 @@  discard block
 block discarded – undo
1417 1417
             break;
1418 1418
         }
1419 1419
 
1420
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1420
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1421 1421
 
1422 1422
         $rows = DB::query(
1423 1423
             'SELECT *
1424
-            FROM ' . prefixTable('emails') . '
1424
+            FROM ' . prefixTable('emails').'
1425 1425
             WHERE status = %s OR status = %s',
1426 1426
             'not_sent',
1427 1427
             ''
@@ -1506,9 +1506,9 @@  discard block
 block discarded – undo
1506 1506
             break;
1507 1507
         }
1508 1508
 
1509
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1509
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1510 1510
 
1511
-        $rows = DB::query('SELECT * FROM ' . prefixTable('emails') . ' WHERE status = %s OR status = %s', 'not_sent', '');
1511
+        $rows = DB::query('SELECT * FROM '.prefixTable('emails').' WHERE status = %s OR status = %s', 'not_sent', '');
1512 1512
         foreach ($rows as $record) {
1513 1513
             //send email
1514 1514
             $ret = json_decode(
@@ -1576,7 +1576,7 @@  discard block
 block discarded – undo
1576 1576
             break;
1577 1577
         }
1578 1578
 
1579
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1579
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1580 1580
 
1581 1581
         // init
1582 1582
         $filesList = array();
@@ -1589,7 +1589,7 @@  discard block
 block discarded – undo
1589 1589
                 FROM ' . prefixTable('files')
1590 1590
             );
1591 1591
             foreach ($rows as $record) {
1592
-                if (is_file($SETTINGS['path_to_upload_folder'] . '/' . $record['file'])) {
1592
+                if (is_file($SETTINGS['path_to_upload_folder'].'/'.$record['file'])) {
1593 1593
                     $addFile = false;
1594 1594
                     if (($post_option === 'attachments-decrypt' && $record['status'] === 'encrypted')
1595 1595
                         || ($post_option === 'attachments-encrypt' && $record['status'] === 'clear')
@@ -1654,8 +1654,8 @@  discard block
 block discarded – undo
1654 1654
         $post_list = filter_var_array($post_list, FILTER_SANITIZE_FULL_SPECIAL_CHARS);
1655 1655
         $post_counter = filter_var($post_counter, FILTER_SANITIZE_NUMBER_INT);
1656 1656
 
1657
-        include $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
1658
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1657
+        include $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
1658
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1659 1659
 
1660 1660
         $cpt = 0;
1661 1661
         $continu = true;
@@ -1668,35 +1668,35 @@  discard block
 block discarded – undo
1668 1668
                 // Get file name
1669 1669
                 $file_info = DB::queryfirstrow(
1670 1670
                     'SELECT file
1671
-                    FROM ' . prefixTable('files') . '
1671
+                    FROM ' . prefixTable('files').'
1672 1672
                     WHERE id = %i',
1673 1673
                     $file
1674 1674
                 );
1675 1675
 
1676 1676
                 // skip file is Coherancey not respected
1677
-                if (is_file($SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'])) {
1677
+                if (is_file($SETTINGS['path_to_upload_folder'].'/'.$file_info['file'])) {
1678 1678
                     // Case where we want to decrypt
1679 1679
                     if ($post_option === 'decrypt') {
1680 1680
                         prepareFileWithDefuse(
1681 1681
                             'decrypt',
1682
-                            $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'],
1683
-                            $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
1682
+                            $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'],
1683
+                            $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
1684 1684
                             $SETTINGS
1685 1685
                         );
1686 1686
                         // Case where we want to encrypt
1687 1687
                     } elseif ($post_option === 'encrypt') {
1688 1688
                         prepareFileWithDefuse(
1689 1689
                             'encrypt',
1690
-                            $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'],
1691
-                            $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
1690
+                            $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'],
1691
+                            $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
1692 1692
                             $SETTINGS
1693 1693
                         );
1694 1694
                     }
1695 1695
                     // Do file cleanup
1696
-                    fileDelete($SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'], $SETTINGS);
1696
+                    fileDelete($SETTINGS['path_to_upload_folder'].'/'.$file_info['file'], $SETTINGS);
1697 1697
                     rename(
1698
-                        $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
1699
-                        $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file']
1698
+                        $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
1699
+                        $SETTINGS['path_to_upload_folder'].'/'.$file_info['file']
1700 1700
                     );
1701 1701
 
1702 1702
                     // store in DB
@@ -1731,8 +1731,8 @@  discard block
 block discarded – undo
1731 1731
                 $post_option === 'attachments-decrypt' ? 'clear' : 'encrypted'
1732 1732
             );
1733 1733
 
1734
-            $message = langHdl('last_execution') . ' ' .
1735
-                date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
1734
+            $message = langHdl('last_execution').' '.
1735
+                date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
1736 1736
                 '<i class="fas fa-check text-success ml-2 mr-3"></i>';
1737 1737
         }
1738 1738
 
@@ -1826,7 +1826,7 @@  discard block
 block discarded – undo
1826 1826
             $post_id = filter_var($dataReceived['id'], FILTER_SANITIZE_NUMBER_INT);
1827 1827
 
1828 1828
             DB::query(
1829
-                'DELETE FROM ' . prefixTable('api') . ' WHERE increment_id = %i',
1829
+                'DELETE FROM '.prefixTable('api').' WHERE increment_id = %i',
1830 1830
                 $post_id
1831 1831
             );
1832 1832
         }
@@ -1921,7 +1921,7 @@  discard block
 block discarded – undo
1921 1921
             // Delete existing key
1922 1922
         } elseif (null !== $post_action && $post_action === 'delete') {
1923 1923
             $post_id = filter_var($dataReceived['id'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
1924
-            DB::query('DELETE FROM ' . prefixTable('api') . ' WHERE increment_id=%i', $post_id);
1924
+            DB::query('DELETE FROM '.prefixTable('api').' WHERE increment_id=%i', $post_id);
1925 1925
         }
1926 1926
 
1927 1927
         echo prepareExchangedData(
@@ -1936,7 +1936,7 @@  discard block
 block discarded – undo
1936 1936
 
1937 1937
     case 'save_api_status':
1938 1938
         // Do query
1939
-        DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'api');
1939
+        DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'api');
1940 1940
         $counter = DB::count();
1941 1941
         if ($counter === 0) {
1942 1942
             DB::insert(
@@ -1963,7 +1963,7 @@  discard block
 block discarded – undo
1963 1963
 
1964 1964
     case 'run_duo_config_check':
1965 1965
         //Libraries call
1966
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1966
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1967 1967
         // Check KEY
1968 1968
         if ($post_key !== $_SESSION['key']) {
1969 1969
             echo prepareExchangedData(
@@ -2006,7 +2006,7 @@  discard block
 block discarded – undo
2006 2006
             echo prepareExchangedData(
2007 2007
                     array(
2008 2008
                         'error' => true,
2009
-                        'message' => langHdl('duo_config_error') . "<br/>Duo: " . $e->getMessage(),
2009
+                        'message' => langHdl('duo_config_error')."<br/>Duo: ".$e->getMessage(),
2010 2010
                     ),
2011 2011
                     'encode'
2012 2012
             );
@@ -2026,7 +2026,7 @@  discard block
 block discarded – undo
2026 2026
                 $duo_error = langHdl('duo_error_secure');
2027 2027
                 $data["duo_check"] = "failed";
2028 2028
             }*/
2029
-            $duo_error = langHdl('duo_error_check_config') . "<br/>Duo: " . $e->getMessage();
2029
+            $duo_error = langHdl('duo_error_check_config')."<br/>Duo: ".$e->getMessage();
2030 2030
             echo prepareExchangedData(
2031 2031
                     array(
2032 2032
                         'error' => true,
@@ -2071,7 +2071,7 @@  discard block
 block discarded – undo
2071 2071
         } else {
2072 2072
             $tmp = 1;
2073 2073
         }
2074
-        DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'google_authentication');
2074
+        DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'google_authentication');
2075 2075
         $counter = DB::count();
2076 2076
         if ($counter === 0) {
2077 2077
             DB::insert(
@@ -2097,7 +2097,7 @@  discard block
 block discarded – undo
2097 2097
 
2098 2098
         // ga_website_name
2099 2099
         if (is_null($dataReceived['ga_website_name']) === false) {
2100
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'ga_website_name');
2100
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'ga_website_name');
2101 2101
             $counter = DB::count();
2102 2102
             if ($counter === 0) {
2103 2103
                 DB::insert(
@@ -2128,7 +2128,7 @@  discard block
 block discarded – undo
2128 2128
         }
2129 2129
 
2130 2130
         // send data
2131
-        echo '[{"result" : "' . addslashes($LANG['done']) . '" , "error" : ""}]';
2131
+        echo '[{"result" : "'.addslashes($LANG['done']).'" , "error" : ""}]';
2132 2132
         break;
2133 2133
 
2134 2134
     case 'save_agses_options':
@@ -2151,7 +2151,7 @@  discard block
 block discarded – undo
2151 2151
 
2152 2152
         // agses_hosted_url
2153 2153
         if (!is_null($dataReceived['agses_hosted_url'])) {
2154
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_url');
2154
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_url');
2155 2155
             $counter = DB::count();
2156 2156
             if ($counter === 0) {
2157 2157
                 DB::insert(
@@ -2180,7 +2180,7 @@  discard block
 block discarded – undo
2180 2180
 
2181 2181
         // agses_hosted_id
2182 2182
         if (!is_null($dataReceived['agses_hosted_id'])) {
2183
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_id');
2183
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_id');
2184 2184
             $counter = DB::count();
2185 2185
             if ($counter === 0) {
2186 2186
                 DB::insert(
@@ -2209,7 +2209,7 @@  discard block
 block discarded – undo
2209 2209
 
2210 2210
         // agses_hosted_apikey
2211 2211
         if (!is_null($dataReceived['agses_hosted_apikey'])) {
2212
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_apikey');
2212
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_apikey');
2213 2213
             $counter = DB::count();
2214 2214
             if ($counter === 0) {
2215 2215
                 DB::insert(
@@ -2237,7 +2237,7 @@  discard block
 block discarded – undo
2237 2237
         }
2238 2238
 
2239 2239
         // send data
2240
-        echo '[{"result" : "' . addslashes($LANG['done']) . '" , "error" : ""}]';
2240
+        echo '[{"result" : "'.addslashes($LANG['done']).'" , "error" : ""}]';
2241 2241
         break;
2242 2242
 
2243 2243
     case 'save_option_change':
@@ -2277,7 +2277,7 @@  discard block
 block discarded – undo
2277 2277
 
2278 2278
         // Check if setting is already in DB. If NO then insert, if YES then update.
2279 2279
         $data = DB::query(
2280
-            'SELECT * FROM ' . prefixTable('misc') . '
2280
+            'SELECT * FROM '.prefixTable('misc').'
2281 2281
             WHERE type = %s AND intitule = %s',
2282 2282
             'admin',
2283 2283
             $post_field
@@ -2299,7 +2299,7 @@  discard block
 block discarded – undo
2299 2299
                     array(
2300 2300
                         'valeur' => time(),
2301 2301
                         'type' => 'admin',
2302
-                        'intitule' => $post_field . '_time',
2302
+                        'intitule' => $post_field.'_time',
2303 2303
                     )
2304 2304
                 );
2305 2305
             }
@@ -2317,10 +2317,10 @@  discard block
 block discarded – undo
2317 2317
             if ($post_field === 'send_stats') {
2318 2318
                 // Check if previous time exists, if not them insert this value in DB
2319 2319
                 DB::query(
2320
-                    'SELECT * FROM ' . prefixTable('misc') . '
2320
+                    'SELECT * FROM '.prefixTable('misc').'
2321 2321
                     WHERE type = %s AND intitule = %s',
2322 2322
                     'admin',
2323
-                    $post_field . '_time'
2323
+                    $post_field.'_time'
2324 2324
                 );
2325 2325
                 $counter = DB::count();
2326 2326
                 if ($counter === 0) {
@@ -2329,7 +2329,7 @@  discard block
 block discarded – undo
2329 2329
                         array(
2330 2330
                             'valeur' => 0,
2331 2331
                             'type' => 'admin',
2332
-                            'intitule' => $post_field . '_time',
2332
+                            'intitule' => $post_field.'_time',
2333 2333
                         )
2334 2334
                     );
2335 2335
                 } else {
@@ -2349,13 +2349,13 @@  discard block
 block discarded – undo
2349 2349
         // special Cases
2350 2350
         if ($post_field === 'cpassman_url') {
2351 2351
             // update also jsUrl for CSFP protection
2352
-            $jsUrl = $post_value . '/includes/libraries/csrfp/js/csrfprotector.js';
2352
+            $jsUrl = $post_value.'/includes/libraries/csrfp/js/csrfprotector.js';
2353 2353
             $csrfp_file = '../includes/libraries/csrfp/libs/csrfp.config.php';
2354 2354
             $data = file_get_contents($csrfp_file);
2355 2355
             $posJsUrl = strpos($data, '"jsUrl" => "');
2356 2356
             $posEndLine = strpos($data, '",', $posJsUrl);
2357 2357
             $line = substr($data, $posJsUrl, ($posEndLine - $posJsUrl + 2));
2358
-            $newdata = str_replace($line, '"jsUrl" => "' . filter_var($jsUrl, FILTER_SANITIZE_FULL_SPECIAL_CHARS) . '",', $data);
2358
+            $newdata = str_replace($line, '"jsUrl" => "'.filter_var($jsUrl, FILTER_SANITIZE_FULL_SPECIAL_CHARS).'",', $data);
2359 2359
             file_put_contents($csrfp_file, $newdata);
2360 2360
         } elseif ($post_field === 'restricted_to_input' && (int) $post_value === 0) {
2361 2361
             DB::update(
@@ -2384,7 +2384,7 @@  discard block
 block discarded – undo
2384 2384
         echo prepareExchangedData(
2385 2385
             array(
2386 2386
                 'error' => false,
2387
-                'misc' => $counter . ' ; ' . $SETTINGS[$post_field],
2387
+                'misc' => $counter.' ; '.$SETTINGS[$post_field],
2388 2388
                 'message' => empty($post_translate) === false ? langHdl($post_translate) : '',
2389 2389
             ),
2390 2390
             'encode'
@@ -2427,7 +2427,7 @@  discard block
 block discarded – undo
2427 2427
 
2428 2428
         // send statistics
2429 2429
         if (null !== $post_status) {
2430
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'send_stats');
2430
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'send_stats');
2431 2431
             $counter = DB::count();
2432 2432
             if ($counter === 0) {
2433 2433
                 DB::insert(
@@ -2459,7 +2459,7 @@  discard block
 block discarded – undo
2459 2459
 
2460 2460
         // send statistics items
2461 2461
         if (null !== $post_list) {
2462
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'send_statistics_items');
2462
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'send_statistics_items');
2463 2463
             $counter = DB::count();
2464 2464
             if ($counter === 0) {
2465 2465
                 DB::insert(
@@ -2506,7 +2506,7 @@  discard block
 block discarded – undo
2506 2506
             break;
2507 2507
         }
2508 2508
 
2509
-        if (DB::query("SHOW TABLES LIKE '" . prefixTable('sk_reencrypt_backup') . "'")) {
2509
+        if (DB::query("SHOW TABLES LIKE '".prefixTable('sk_reencrypt_backup')."'")) {
2510 2510
             if (DB::count() === 1) {
2511 2511
                 echo 1;
2512 2512
             } else {
@@ -2544,7 +2544,7 @@  discard block
 block discarded – undo
2544 2544
 
2545 2545
         $rows = DB::query(
2546 2546
             'SELECT id, title
2547
-                FROM ' . prefixTable('roles_title') . '
2547
+                FROM ' . prefixTable('roles_title').'
2548 2548
                 ORDER BY title ASC'
2549 2549
         );
2550 2550
         foreach ($rows as $record) {
Please login to merge, or discard this patch.