Passed
Push — master ( a7ae84...1f91ec )
by Nils
09:31
created
sources/users.queries.php 1 patch
Spacing   +180 added lines, -180 removed lines patch added patch discarded remove patch
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 }
49 49
 
50 50
 /* do checks */
51
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
52
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
51
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
52
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
53 53
 // Prepare post variables
54 54
 $post_key = filter_input(INPUT_POST, 'key', FILTER_SANITIZE_STRING);
55 55
 $post_type = filter_input(INPUT_POST, 'type', FILTER_SANITIZE_STRING);
@@ -62,21 +62,21 @@  discard block
 block discarded – undo
62 62
     (checkUser($_SESSION['user_id'], $_SESSION['key'], 'users', $SETTINGS) === false)
63 63
     && (checkUser($_SESSION['user_id'], $_SESSION['key'], 'profile', $SETTINGS) === false 
64 64
         && (null === $isprofileupdate || $isprofileupdate === false)
65
-        && !in_array($post_type, ['user_profile_update','save_user_change'], true))
65
+        && !in_array($post_type, ['user_profile_update', 'save_user_change'], true))
66 66
 ) {
67 67
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
68
-    include $SETTINGS['cpassman_dir'] . '/error.php';
68
+    include $SETTINGS['cpassman_dir'].'/error.php';
69 69
     exit();
70 70
 }
71 71
 
72
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
72
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
73 73
 header('Content-type: text/html; charset=utf-8');
74
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user']['user_language'] . '.php';
75
-require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
76
-require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
74
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user']['user_language'].'.php';
75
+require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
76
+require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
77 77
 
78 78
 // Connect to mysql server
79
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
79
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
80 80
 if (defined('DB_PASSWD_CLEAR') === false) {
81 81
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
82 82
 }
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
             // Prepare variables
126 126
             $login = filter_var($dataReceived['login'], FILTER_SANITIZE_STRING);
127 127
             $email = filter_var($dataReceived['email'], FILTER_SANITIZE_EMAIL);
128
-            $password = '';//filter_var($dataReceived['pw'], FILTER_SANITIZE_STRING);
128
+            $password = ''; //filter_var($dataReceived['pw'], FILTER_SANITIZE_STRING);
129 129
             $lastname = filter_var($dataReceived['lastname'], FILTER_SANITIZE_STRING);
130 130
             $name = filter_var($dataReceived['name'], FILTER_SANITIZE_STRING);
131 131
             $is_admin = filter_var($dataReceived['admin'], FILTER_SANITIZE_NUMBER_INT);
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
             // Check if user already exists
156 156
             $data = DB::query(
157 157
                 'SELECT id, fonction_id, groupes_interdits, groupes_visibles
158
-                FROM ' . prefixTable('users') . '
158
+                FROM ' . prefixTable('users').'
159 159
                 WHERE login = %s',
160 160
                 $login
161 161
             );
@@ -374,14 +374,14 @@  discard block
 block discarded – undo
374 374
 
375 375
             // decrypt and retrieve data in JSON format
376 376
             $dataReceived = prepareExchangedData(
377
-                    $SETTINGS['cpassman_dir'],$post_data, 'decode');
377
+                    $SETTINGS['cpassman_dir'], $post_data, 'decode');
378 378
 
379 379
             // Prepare variables
380 380
             $post_id = filter_var($dataReceived['user_id'], FILTER_SANITIZE_NUMBER_INT);
381 381
 
382 382
             // Get info about user to delete
383 383
             $data_user = DB::queryfirstrow(
384
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
384
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
385 385
                 WHERE id = %i',
386 386
                 $post_id
387 387
             );
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
                 );
407 407
                 // delete personal folder and subfolders
408 408
                 $data = DB::queryfirstrow(
409
-                    'SELECT id FROM ' . prefixTable('nested_tree') . '
409
+                    'SELECT id FROM '.prefixTable('nested_tree').'
410 410
                     WHERE title = %s AND personal_folder = %i',
411 411
                     $post_id,
412 412
                     '1'
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
                         DB::delete(prefixTable('nested_tree'), 'id = %i AND personal_folder = %i', $folder->id, '1');
420 420
                         // delete items & logs
421 421
                         $items = DB::query(
422
-                            'SELECT id FROM ' . prefixTable('items') . '
422
+                            'SELECT id FROM '.prefixTable('items').'
423 423
                             WHERE id_tree=%i AND perso = %i',
424 424
                             $folder->id,
425 425
                             '1'
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
                 // Delete any process related to user
444 444
                 $processes = DB::query(
445 445
                     'SELECT increment_id
446
-                    FROM ' . prefixTable('processes') . '
446
+                    FROM ' . prefixTable('processes').'
447 447
                     WHERE JSON_EXTRACT(arguments, "$.new_user_id") = %i',
448 448
                     $post_id
449 449
                 );
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
             // Check KEY
500 500
             if (filter_input(INPUT_POST, 'key', FILTER_SANITIZE_STRING) !== filter_var($_SESSION['key'], FILTER_SANITIZE_STRING)) {
501 501
                 echo prepareExchangedData(
502
-                    $SETTINGS['cpassman_dir'],array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode');
502
+                    $SETTINGS['cpassman_dir'], array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode');
503 503
                 break;
504 504
             }
505 505
 
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
 
508 508
             // Get info about user to delete
509 509
             $data_user = DB::queryfirstrow(
510
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
510
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
511 511
                 WHERE id = %i',
512 512
                 $post_id
513 513
             );
@@ -527,10 +527,10 @@  discard block
 block discarded – undo
527 527
                     $post_id
528 528
                 );
529 529
                 echo prepareExchangedData(
530
-                    $SETTINGS['cpassman_dir'],array('error' => ''), 'encode');
530
+                    $SETTINGS['cpassman_dir'], array('error' => ''), 'encode');
531 531
             } else {
532 532
                 echo prepareExchangedData(
533
-                    $SETTINGS['cpassman_dir'],array('error' => 'not_allowed'), 'encode');
533
+                    $SETTINGS['cpassman_dir'], array('error' => 'not_allowed'), 'encode');
534 534
             }
535 535
             break;
536 536
             /*
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
                 || $_SESSION['is_admin'] !== '1'
544 544
             ) {
545 545
                 echo prepareExchangedData(
546
-                    $SETTINGS['cpassman_dir'],array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode');
546
+                    $SETTINGS['cpassman_dir'], array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode');
547 547
                 exit();
548 548
             }
549 549
 
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 
553 553
             // Get info about user to delete
554 554
             $data_user = DB::queryfirstrow(
555
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
555
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
556 556
                 WHERE id = %i',
557 557
                 $post_id
558 558
             );
@@ -575,10 +575,10 @@  discard block
 block discarded – undo
575 575
                 );
576 576
 
577 577
                 echo prepareExchangedData(
578
-                    $SETTINGS['cpassman_dir'],array('error' => ''), 'encode');
578
+                    $SETTINGS['cpassman_dir'], array('error' => ''), 'encode');
579 579
             } else {
580 580
                 echo prepareExchangedData(
581
-                    $SETTINGS['cpassman_dir'],array('error' => 'not_allowed'), 'encode');
581
+                    $SETTINGS['cpassman_dir'], array('error' => 'not_allowed'), 'encode');
582 582
             }
583 583
             break;
584 584
             /*
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
             // Check KEY
589 589
             if (filter_input(INPUT_POST, 'key', FILTER_SANITIZE_STRING) !== filter_var($_SESSION['key'], FILTER_SANITIZE_STRING)) {
590 590
                 echo prepareExchangedData(
591
-                    $SETTINGS['cpassman_dir'],array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode');
591
+                    $SETTINGS['cpassman_dir'], array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode');
592 592
                 break;
593 593
             }
594 594
 
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
             // Get info about user to delete
599 599
             $data_user = DB::queryfirstrow(
600 600
                 'SELECT admin, isAdministratedByRole, can_manage_all_users, gestionnaire
601
-                FROM ' . prefixTable('users') . '
601
+                FROM ' . prefixTable('users').'
602 602
                 WHERE id = %i',
603 603
                 $post_id
604 604
             );
@@ -623,10 +623,10 @@  discard block
 block discarded – undo
623 623
                     $post_id
624 624
                 );
625 625
                 echo prepareExchangedData(
626
-                    $SETTINGS['cpassman_dir'],array('error' => ''), 'encode');
626
+                    $SETTINGS['cpassman_dir'], array('error' => ''), 'encode');
627 627
             } else {
628 628
                 echo prepareExchangedData(
629
-                    $SETTINGS['cpassman_dir'],array('error' => 'not_allowed'), 'encode');
629
+                    $SETTINGS['cpassman_dir'], array('error' => 'not_allowed'), 'encode');
630 630
             }
631 631
             break;
632 632
             /*
@@ -636,7 +636,7 @@  discard block
 block discarded – undo
636 636
             // Check KEY
637 637
             if (filter_input(INPUT_POST, 'key', FILTER_SANITIZE_STRING) !== filter_var($_SESSION['key'], FILTER_SANITIZE_STRING)) {
638 638
                 echo prepareExchangedData(
639
-                    $SETTINGS['cpassman_dir'],array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode');
639
+                    $SETTINGS['cpassman_dir'], array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode');
640 640
                 break;
641 641
             }
642 642
 
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
 
646 646
             // Get info about user to delete
647 647
             $data_user = DB::queryfirstrow(
648
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
648
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
649 649
                 WHERE id = %i',
650 650
                 $post_id
651 651
             );
@@ -667,10 +667,10 @@  discard block
 block discarded – undo
667 667
                     $post_id
668 668
                 );
669 669
                 echo prepareExchangedData(
670
-                    $SETTINGS['cpassman_dir'],array('error' => ''), 'encode');
670
+                    $SETTINGS['cpassman_dir'], array('error' => ''), 'encode');
671 671
             } else {
672 672
                 echo prepareExchangedData(
673
-                    $SETTINGS['cpassman_dir'],array('error' => 'not_allowed'), 'encode');
673
+                    $SETTINGS['cpassman_dir'], array('error' => 'not_allowed'), 'encode');
674 674
             }
675 675
             break;
676 676
             /*
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
             // Check KEY
682 682
             if (filter_input(INPUT_POST, 'key', FILTER_SANITIZE_STRING) !== filter_var($_SESSION['key'], FILTER_SANITIZE_STRING)) {
683 683
                 echo prepareExchangedData(
684
-                    $SETTINGS['cpassman_dir'],array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode');
684
+                    $SETTINGS['cpassman_dir'], array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode');
685 685
                 break;
686 686
             }
687 687
 
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
             // Get info about user to delete
692 692
             $data_user = DB::queryfirstrow(
693 693
                 'SELECT admin, isAdministratedByRole, gestionnaire
694
-                FROM ' . prefixTable('users') . '
694
+                FROM ' . prefixTable('users').'
695 695
                 WHERE id = %i',
696 696
                 $post_id
697 697
             );
@@ -714,10 +714,10 @@  discard block
 block discarded – undo
714 714
                     $post_id
715 715
                 );
716 716
                 echo prepareExchangedData(
717
-                    $SETTINGS['cpassman_dir'],array('error' => ''), 'encode');
717
+                    $SETTINGS['cpassman_dir'], array('error' => ''), 'encode');
718 718
             } else {
719 719
                 echo prepareExchangedData(
720
-                    $SETTINGS['cpassman_dir'],array('error' => 'not_allowed'), 'encode');
720
+                    $SETTINGS['cpassman_dir'], array('error' => 'not_allowed'), 'encode');
721 721
             }
722 722
             break;
723 723
             /*
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
             // Check KEY
728 728
             if (filter_input(INPUT_POST, 'key', FILTER_SANITIZE_STRING) !== filter_var($_SESSION['key'], FILTER_SANITIZE_STRING)) {
729 729
                 echo prepareExchangedData(
730
-                    $SETTINGS['cpassman_dir'],array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode');
730
+                    $SETTINGS['cpassman_dir'], array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode');
731 731
                 break;
732 732
             }
733 733
 
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
             // Get info about user to delete
738 738
             $data_user = DB::queryfirstrow(
739 739
                 'SELECT admin, isAdministratedByRole, gestionnaire
740
-                FROM ' . prefixTable('users') . '
740
+                FROM ' . prefixTable('users').'
741 741
                 WHERE id = %i',
742 742
                 $post_id
743 743
             );
@@ -757,10 +757,10 @@  discard block
 block discarded – undo
757 757
                     $post_id
758 758
                 );
759 759
                 echo prepareExchangedData(
760
-                    $SETTINGS['cpassman_dir'],array('error' => ''), 'encode');
760
+                    $SETTINGS['cpassman_dir'], array('error' => ''), 'encode');
761 761
             } else {
762 762
                 echo prepareExchangedData(
763
-                    $SETTINGS['cpassman_dir'],array('error' => 'not_allowed'), 'encode');
763
+                    $SETTINGS['cpassman_dir'], array('error' => 'not_allowed'), 'encode');
764 764
             }
765 765
             break;
766 766
 
@@ -779,7 +779,7 @@  discard block
 block discarded – undo
779 779
             // Get info about user to delete
780 780
             $data_user = DB::queryfirstrow(
781 781
                 'SELECT admin, isAdministratedByRole, gestionnaire
782
-                FROM ' . prefixTable('users') . '
782
+                FROM ' . prefixTable('users').'
783 783
                 WHERE id = %i',
784 784
                 $post_id
785 785
             );
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
             $return = array();
819 819
             // Check if folder exists
820 820
             $data = DB::query(
821
-                'SELECT * FROM ' . prefixTable('nested_tree') . '
821
+                'SELECT * FROM '.prefixTable('nested_tree').'
822 822
                 WHERE title = %s AND parent_id = %i',
823 823
                 filter_input(INPUT_POST, 'domain', FILTER_SANITIZE_STRING),
824 824
                 '0'
@@ -831,7 +831,7 @@  discard block
 block discarded – undo
831 831
             }
832 832
             // Check if role exists
833 833
             $data = DB::query(
834
-                'SELECT * FROM ' . prefixTable('roles_title') . '
834
+                'SELECT * FROM '.prefixTable('roles_title').'
835 835
                 WHERE title = %s',
836 836
                 filter_input(INPUT_POST, 'domain', FILTER_SANITIZE_STRING)
837 837
             );
@@ -851,7 +851,7 @@  discard block
 block discarded – undo
851 851
         case 'user_log_items':
852 852
             $nb_pages = 1;
853 853
             $logs = $sql_filter = '';
854
-            $pages = '<table style=\'border-top:1px solid #969696;\'><tr><td>' . langHdl('pages') . '&nbsp;:&nbsp;</td>';
854
+            $pages = '<table style=\'border-top:1px solid #969696;\'><tr><td>'.langHdl('pages').'&nbsp;:&nbsp;</td>';
855 855
 
856 856
             // Prepare POST variables
857 857
             $post_nb_items_by_page = filter_input(INPUT_POST, 'nb_items_by_page', FILTER_SANITIZE_NUMBER_INT);
@@ -863,14 +863,14 @@  discard block
 block discarded – undo
863 863
                     && !empty(filter_input(INPUT_POST, 'filter', FILTER_SANITIZE_STRING))
864 864
                     && filter_input(INPUT_POST, 'filter', FILTER_SANITIZE_STRING) !== 'all'
865 865
                 ) {
866
-                    $sql_filter = " AND l.action = '" . filter_input(INPUT_POST, 'filter', FILTER_SANITIZE_STRING) . "'";
866
+                    $sql_filter = " AND l.action = '".filter_input(INPUT_POST, 'filter', FILTER_SANITIZE_STRING)."'";
867 867
                 }
868 868
                 // get number of pages
869 869
                 DB::query(
870 870
                     'SELECT *
871
-                    FROM ' . prefixTable('log_items') . ' as l
872
-                    INNER JOIN ' . prefixTable('items') . ' as i ON (l.id_item=i.id)
873
-                    INNER JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id)
871
+                    FROM ' . prefixTable('log_items').' as l
872
+                    INNER JOIN ' . prefixTable('items').' as i ON (l.id_item=i.id)
873
+                    INNER JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id)
874 874
                     WHERE l.id_user = %i ' . $sql_filter,
875 875
                     filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT)
876 876
                 );
@@ -888,19 +888,19 @@  discard block
 block discarded – undo
888 888
                 // launch query
889 889
                 $rows = DB::query(
890 890
                     'SELECT l.date as date, u.login as login, i.label as label, l.action as action
891
-                    FROM ' . prefixTable('log_items') . ' as l
892
-                    INNER JOIN ' . prefixTable('items') . ' as i ON (l.id_item=i.id)
893
-                    INNER JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id)
894
-                    WHERE l.id_user = %i ' . $sql_filter . '
891
+                    FROM ' . prefixTable('log_items').' as l
892
+                    INNER JOIN ' . prefixTable('items').' as i ON (l.id_item=i.id)
893
+                    INNER JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id)
894
+                    WHERE l.id_user = %i ' . $sql_filter.'
895 895
                     ORDER BY date DESC
896
-                    LIMIT ' . intval($start) . ',' . intval($post_nb_items_by_page),
896
+                    LIMIT ' . intval($start).','.intval($post_nb_items_by_page),
897 897
                     filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT)
898 898
                 );
899 899
             } else {
900 900
                 // get number of pages
901 901
                 DB::query(
902 902
                     'SELECT *
903
-                    FROM ' . prefixTable('log_system') . '
903
+                    FROM ' . prefixTable('log_system').'
904 904
                     WHERE type = %s AND field_1=%i',
905 905
                     'user_mngt',
906 906
                     filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT)
@@ -919,7 +919,7 @@  discard block
 block discarded – undo
919 919
                 // launch query
920 920
                 $rows = DB::query(
921 921
                     'SELECT *
922
-                    FROM ' . prefixTable('log_system') . '
922
+                    FROM ' . prefixTable('log_system').'
923 923
                     WHERE type = %s AND field_1 = %i
924 924
                     ORDER BY date DESC
925 925
                     LIMIT %i, %i',
@@ -933,7 +933,7 @@  discard block
 block discarded – undo
933 933
             if (isset($counter) && $counter != 0) {
934 934
                 $nb_pages = ceil($counter / intval($post_nb_items_by_page));
935 935
                 for ($i = 1; $i <= $nb_pages; ++$i) {
936
-                    $pages .= '<td onclick=\'displayLogs(' . $i . ',\"' . $post_scope . '\")\'><span style=\'cursor:pointer;' . (filter_input(INPUT_POST, 'page', FILTER_SANITIZE_NUMBER_INT) === $i ? 'font-weight:bold;font-size:18px;\'>' . $i : '\'>' . $i) . '</span></td>';
936
+                    $pages .= '<td onclick=\'displayLogs('.$i.',\"'.$post_scope.'\")\'><span style=\'cursor:pointer;'.(filter_input(INPUT_POST, 'page', FILTER_SANITIZE_NUMBER_INT) === $i ? 'font-weight:bold;font-size:18px;\'>'.$i : '\'>'.$i).'</span></td>';
937 937
                 }
938 938
             }
939 939
             $pages .= '</tr></table>';
@@ -942,7 +942,7 @@  discard block
 block discarded – undo
942 942
                     if ($post_scope === 'user_mngt') {
943 943
                         $user = DB::queryfirstrow(
944 944
                             'SELECT login
945
-                            from ' . prefixTable('users') . '
945
+                            from ' . prefixTable('users').'
946 946
                             WHERE id=%i',
947 947
                             $record['qui']
948 948
                         );
@@ -952,7 +952,7 @@  discard block
 block discarded – undo
952 952
                         if ($tmp[0] == 'at_user_initial_pwd_changed') {
953 953
                             $label = langHdl('log_user_initial_pwd_changed');
954 954
                         } elseif ($tmp[0] == 'at_user_email_changed') {
955
-                            $label = langHdl('log_user_email_changed') . $tmp[1];
955
+                            $label = langHdl('log_user_email_changed').$tmp[1];
956 956
                         } elseif ($tmp[0] == 'at_user_added') {
957 957
                             $label = langHdl('log_user_created');
958 958
                         } elseif ($tmp[0] == 'at_user_locked') {
@@ -963,14 +963,14 @@  discard block
 block discarded – undo
963 963
                             $label = langHdl('log_user_pwd_changed');
964 964
                         }
965 965
                         // prepare log
966
-                        $logs .= '<tr><td>' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) . '</td><td align=\"center\">' . $label . '</td><td align=\"center\">' . $user['login'] . '</td><td align=\"center\"></td></tr>';
966
+                        $logs .= '<tr><td>'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']).'</td><td align=\"center\">'.$label.'</td><td align=\"center\">'.$user['login'].'</td><td align=\"center\"></td></tr>';
967 967
                     } else {
968
-                        $logs .= '<tr><td>' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) . '</td><td align=\"center\">' . str_replace('"', '\"', $record['label']) . '</td><td align=\"center\">' . $record['login'] . '</td><td align=\"center\">' . langHdl($record['action']) . '</td></tr>';
968
+                        $logs .= '<tr><td>'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']).'</td><td align=\"center\">'.str_replace('"', '\"', $record['label']).'</td><td align=\"center\">'.$record['login'].'</td><td align=\"center\">'.langHdl($record['action']).'</td></tr>';
969 969
                     }
970 970
                 }
971 971
             }
972 972
 
973
-            echo '[ { "table_logs": "' . ($logs) . '", "pages": "' . ($pages) . '", "error" : "no" } ]';
973
+            echo '[ { "table_logs": "'.($logs).'", "pages": "'.($pages).'", "error" : "no" } ]';
974 974
             break;
975 975
 
976 976
             /*
@@ -996,7 +996,7 @@  discard block
 block discarded – undo
996 996
             } else {
997 997
                 // Get folder id for Admin
998 998
                 $admin_folder = DB::queryFirstRow(
999
-                    'SELECT id FROM ' . prefixTable('nested_tree') . '
999
+                    'SELECT id FROM '.prefixTable('nested_tree').'
1000 1000
                     WHERE title = %i AND personal_folder = %i',
1001 1001
                     intval($_SESSION['user_id']),
1002 1002
                     '1'
@@ -1007,15 +1007,15 @@  discard block
 block discarded – undo
1007 1007
                     // Get each Items in PF
1008 1008
                     $rows = DB::query(
1009 1009
                         'SELECT i.pw, i.label, l.id_user
1010
-                        FROM ' . prefixTable('items') . ' as i
1011
-                        LEFT JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item=i.id)
1010
+                        FROM ' . prefixTable('items').' as i
1011
+                        LEFT JOIN ' . prefixTable('log_items').' as l ON (l.id_item=i.id)
1012 1012
                         WHERE l.action = %s AND i.perso=%i AND i.id_tree=%i',
1013 1013
                         'at_creation',
1014 1014
                         '1',
1015 1015
                         intval($folder->id)
1016 1016
                     );
1017 1017
                     foreach ($rows as $record) {
1018
-                        echo $record['label'] . ' - ';
1018
+                        echo $record['label'].' - ';
1019 1019
                         // Change user
1020 1020
                         DB::update(
1021 1021
                             prefixTable('log_items'),
@@ -1050,7 +1050,7 @@  discard block
 block discarded – undo
1050 1050
             // Get info about user to delete
1051 1051
             $data_user = DB::queryfirstrow(
1052 1052
                 'SELECT admin, isAdministratedByRole, gestionnaire
1053
-                FROM ' . prefixTable('users') . '
1053
+                FROM ' . prefixTable('users').'
1054 1054
                 WHERE id = %i',
1055 1055
                 $post_user_id
1056 1056
             );
@@ -1087,7 +1087,7 @@  discard block
 block discarded – undo
1087 1087
 
1088 1088
             // Do
1089 1089
             $rows = DB::query(
1090
-                'SELECT id FROM ' . prefixTable('users') . '
1090
+                'SELECT id FROM '.prefixTable('users').'
1091 1091
                 WHERE timestamp != %s AND admin != %i',
1092 1092
                 '',
1093 1093
                 '1'
@@ -1096,7 +1096,7 @@  discard block
 block discarded – undo
1096 1096
                 // Get info about user to delete
1097 1097
                 $data_user = DB::queryfirstrow(
1098 1098
                     'SELECT admin, isAdministratedByRole, gestionnaire
1099
-                    FROM ' . prefixTable('users') . '
1099
+                    FROM ' . prefixTable('users').'
1100 1100
                     WHERE id = %i',
1101 1101
                     $record['id']
1102 1102
                 );
@@ -1149,7 +1149,7 @@  discard block
 block discarded – undo
1149 1149
 
1150 1150
             // decrypt and retrieve data in JSON format
1151 1151
             $dataReceived = prepareExchangedData(
1152
-                    $SETTINGS['cpassman_dir'],$post_data, 'decode');
1152
+                    $SETTINGS['cpassman_dir'], $post_data, 'decode');
1153 1153
             
1154 1154
             // Prepare variables
1155 1155
             $post_id = filter_var($dataReceived['user_id'], FILTER_SANITIZE_NUMBER_INT);
@@ -1157,7 +1157,7 @@  discard block
 block discarded – undo
1157 1157
             // Get info about user
1158 1158
             $rowUser = DB::queryfirstrow(
1159 1159
                 'SELECT *
1160
-                FROM ' . prefixTable('users') . '
1160
+                FROM ' . prefixTable('users').'
1161 1161
                 WHERE id = %i',
1162 1162
                 $post_id
1163 1163
             );
@@ -1175,7 +1175,7 @@  discard block
 block discarded – undo
1175 1175
                 $arrFldAllowed = array();
1176 1176
 
1177 1177
                 //Build tree
1178
-                $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1178
+                $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
1179 1179
                 $tree->register();
1180 1180
                 $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
1181 1181
 
@@ -1186,7 +1186,7 @@  discard block
 block discarded – undo
1186 1186
                 // array of roles for actual user
1187 1187
                 $my_functions = explode(';', $_SESSION['fonction_id']);
1188 1188
 
1189
-                $rows = DB::query('SELECT id,title,creator_id FROM ' . prefixTable('roles_title'));
1189
+                $rows = DB::query('SELECT id,title,creator_id FROM '.prefixTable('roles_title'));
1190 1190
                 foreach ($rows as $record) {
1191 1191
                     if (
1192 1192
                         (int) $_SESSION['is_admin'] === 1
@@ -1222,7 +1222,7 @@  discard block
 block discarded – undo
1222 1222
                 $rolesList = array();
1223 1223
                 $managedBy = array();
1224 1224
                 $selected = '';
1225
-                $rows = DB::query('SELECT id,title FROM ' . prefixTable('roles_title') . ' ORDER BY title ASC');
1225
+                $rows = DB::query('SELECT id,title FROM '.prefixTable('roles_title').' ORDER BY title ASC');
1226 1226
                 foreach ($rows as $reccord) {
1227 1227
                     $rolesList[$reccord['id']] = array('id' => $reccord['id'], 'title' => $reccord['title']);
1228 1228
                 }
@@ -1253,7 +1253,7 @@  discard block
 block discarded – undo
1253 1253
                         array_push(
1254 1254
                             $managedBy,
1255 1255
                             array(
1256
-                                'title' => langHdl('managers_of') . ' ' . $fonction['title'],
1256
+                                'title' => langHdl('managers_of').' '.$fonction['title'],
1257 1257
                                 'id' => $fonction['id'],
1258 1258
                                 'selected' => $selected,
1259 1259
                             )
@@ -1335,9 +1335,9 @@  discard block
 block discarded – undo
1335 1335
 
1336 1336
                 // get USER STATUS
1337 1337
                 if ($rowUser['disabled'] == 1) {
1338
-                    $arrData['info'] = langHdl('user_info_locked') . '<br><input type="checkbox" value="unlock" name="1" class="chk">&nbsp;<label for="1">' . langHdl('user_info_unlock_question') . '</label><br><input type="checkbox"  value="delete" id="account_delete" class="chk mr-2" name="2" onclick="confirmDeletion()">label for="2">' . langHdl('user_info_delete_question') . '</label>';
1338
+                    $arrData['info'] = langHdl('user_info_locked').'<br><input type="checkbox" value="unlock" name="1" class="chk">&nbsp;<label for="1">'.langHdl('user_info_unlock_question').'</label><br><input type="checkbox"  value="delete" id="account_delete" class="chk mr-2" name="2" onclick="confirmDeletion()">label for="2">'.langHdl('user_info_delete_question').'</label>';
1339 1339
                 } else {
1340
-                    $arrData['info'] = langHdl('user_info_active') . '<br><input type="checkbox" value="lock" class="chk">&nbsp;' . langHdl('user_info_lock_question');
1340
+                    $arrData['info'] = langHdl('user_info_active').'<br><input type="checkbox" value="lock" class="chk">&nbsp;'.langHdl('user_info_lock_question');
1341 1341
                 }
1342 1342
 
1343 1343
                 $arrData['error'] = false;
@@ -1409,7 +1409,7 @@  discard block
 block discarded – undo
1409 1409
 
1410 1410
             // decrypt and retrieve data in JSON format
1411 1411
             $dataReceived = prepareExchangedData(
1412
-                    $SETTINGS['cpassman_dir'],$post_data, 'decode');
1412
+                    $SETTINGS['cpassman_dir'], $post_data, 'decode');
1413 1413
 
1414 1414
             // Prepare variables
1415 1415
             $post_id = filter_var($dataReceived['user_id'], FILTER_SANITIZE_STRING);
@@ -1434,7 +1434,7 @@  discard block
 block discarded – undo
1434 1434
                 // count number of admins
1435 1435
                 $users = DB::query(
1436 1436
                     'SELECT id
1437
-                    FROM ' . prefixTable('users') . '
1437
+                    FROM ' . prefixTable('users').'
1438 1438
                     WHERE admin = 1 AND email != "" AND pw != ""'
1439 1439
                 );
1440 1440
                 if (DB::count() === 1) {
@@ -1523,7 +1523,7 @@  discard block
 block discarded – undo
1523 1523
 
1524 1524
             // Get info about user to delete
1525 1525
             $data_user = DB::queryfirstrow(
1526
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
1526
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
1527 1527
                 WHERE id = %i',
1528 1528
                 $post_id
1529 1529
             );
@@ -1544,7 +1544,7 @@  discard block
 block discarded – undo
1544 1544
                     );
1545 1545
                     // delete personal folder and subfolders
1546 1546
                     $data = DB::queryfirstrow(
1547
-                        'SELECT id FROM ' . prefixTable('nested_tree') . '
1547
+                        'SELECT id FROM '.prefixTable('nested_tree').'
1548 1548
                         WHERE title = %s AND personal_folder = %i',
1549 1549
                         $post_id,
1550 1550
                         '1'
@@ -1557,7 +1557,7 @@  discard block
 block discarded – undo
1557 1557
                             DB::delete(prefixTable('nested_tree'), 'id = %i AND personal_folder = %i', $folder->id, '1');
1558 1558
                             // delete items & logs
1559 1559
                             $items = DB::query(
1560
-                                'SELECT id FROM ' . prefixTable('items') . '
1560
+                                'SELECT id FROM '.prefixTable('items').'
1561 1561
                                 WHERE id_tree=%i AND perso = %i',
1562 1562
                                 $folder->id,
1563 1563
                                 '1'
@@ -1578,7 +1578,7 @@  discard block
 block discarded – undo
1578 1578
                 } else {
1579 1579
                     // Get old data about user
1580 1580
                     $oldData = DB::queryfirstrow(
1581
-                        'SELECT * FROM ' . prefixTable('users') . '
1581
+                        'SELECT * FROM '.prefixTable('users').'
1582 1582
                         WHERE id = %i',
1583 1583
                         $post_id
1584 1584
                     );
@@ -1615,7 +1615,7 @@  discard block
 block discarded – undo
1615 1615
 
1616 1616
                     // update LOG
1617 1617
                     if ($oldData['email'] !== $post_email) {
1618
-                        logEvents($SETTINGS, 'user_mngt', 'at_user_email_changed:' . $oldData['email'], (string) $_SESSION['user_id'], $_SESSION['login'], $post_id);
1618
+                        logEvents($SETTINGS, 'user_mngt', 'at_user_email_changed:'.$oldData['email'], (string) $_SESSION['user_id'], $_SESSION['login'], $post_id);
1619 1619
                     }
1620 1620
                 }
1621 1621
                 echo prepareExchangedData(
@@ -1668,14 +1668,14 @@  discard block
 block discarded – undo
1668 1668
 
1669 1669
             // decrypt and retrieve data in JSON format
1670 1670
             $dataReceived = prepareExchangedData(
1671
-                    $SETTINGS['cpassman_dir'],$post_data, 'decode');
1671
+                    $SETTINGS['cpassman_dir'], $post_data, 'decode');
1672 1672
 
1673 1673
             // Prepare variables
1674 1674
             $post_id = filter_var($dataReceived['user_id'], FILTER_SANITIZE_NUMBER_INT);
1675 1675
 
1676 1676
             // Get info about user to delete
1677 1677
             $data_user = DB::queryfirstrow(
1678
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
1678
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
1679 1679
                 WHERE id = %i',
1680 1680
                 $post_id
1681 1681
             );
@@ -1727,7 +1727,7 @@  discard block
 block discarded – undo
1727 1727
             }
1728 1728
 
1729 1729
             DB::queryfirstrow(
1730
-                'SELECT * FROM ' . prefixTable('users') . '
1730
+                'SELECT * FROM '.prefixTable('users').'
1731 1731
                 WHERE login = %s',
1732 1732
                 filter_input(INPUT_POST, 'login', FILTER_SANITIZE_STRING)
1733 1733
             );
@@ -1776,14 +1776,14 @@  discard block
 block discarded – undo
1776 1776
             $arrData = array();
1777 1777
 
1778 1778
             //Build tree
1779
-            $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1779
+            $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
1780 1780
             $tree->register();
1781 1781
             $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
1782 1782
 
1783 1783
             // get User info
1784 1784
             $rowUser = DB::queryFirstRow(
1785 1785
                 'SELECT login, name, lastname, email, disabled, fonction_id, groupes_interdits, groupes_visibles, isAdministratedByRole, avatar_thumb, roles_from_ad_groups
1786
-                FROM ' . prefixTable('users') . '
1786
+                FROM ' . prefixTable('users').'
1787 1787
                 WHERE id = %i',
1788 1788
                 $post_id
1789 1789
             );
@@ -1793,7 +1793,7 @@  discard block
 block discarded – undo
1793 1793
             $html = '';
1794 1794
 
1795 1795
             if (isset($SETTINGS['ldap_mode']) === true && (int) $SETTINGS['ldap_mode'] === 1 && isset($SETTINGS['enable_ad_users_with_ad_groups']) === true && (int) $SETTINGS['enable_ad_users_with_ad_groups'] === 1) {
1796
-                $rowUser['fonction_id'] = empty($rowUser['fonction_id'])  === true ? $rowUser['roles_from_ad_groups'] : $rowUser['fonction_id']. ';' . $rowUser['roles_from_ad_groups'];
1796
+                $rowUser['fonction_id'] = empty($rowUser['fonction_id']) === true ? $rowUser['roles_from_ad_groups'] : $rowUser['fonction_id'].';'.$rowUser['roles_from_ad_groups'];
1797 1797
             }
1798 1798
             $arrData['functions'] = array_filter(explode(';', $rowUser['fonction_id']));
1799 1799
             $arrData['allowed_folders'] = array_filter(explode(';', $rowUser['groupes_visibles']));
@@ -1804,7 +1804,7 @@  discard block
 block discarded – undo
1804 1804
                 // refine folders based upon roles
1805 1805
                 $rows = DB::query(
1806 1806
                     'SELECT folder_id, type
1807
-                    FROM ' . prefixTable('roles_values') . '
1807
+                    FROM ' . prefixTable('roles_values').'
1808 1808
                     WHERE role_id IN %ls
1809 1809
                     ORDER BY folder_id ASC',
1810 1810
                     $arrData['functions']
@@ -1827,7 +1827,7 @@  discard block
 block discarded – undo
1827 1827
                 }
1828 1828
 
1829 1829
                 // add allowed folders
1830
-                foreach($arrData['allowed_folders'] as $Fld) {
1830
+                foreach ($arrData['allowed_folders'] as $Fld) {
1831 1831
                     array_push($arrFolders, array('id' => $Fld, 'type' => 'W', 'special' => true));
1832 1832
                 }
1833 1833
                 
@@ -1838,7 +1838,7 @@  discard block
 block discarded – undo
1838 1838
                             // get folder name
1839 1839
                             $row = DB::queryFirstRow(
1840 1840
                                 'SELECT title, nlevel, id
1841
-                                FROM ' . prefixTable('nested_tree') . '
1841
+                                FROM ' . prefixTable('nested_tree').'
1842 1842
                                 WHERE id = %i',
1843 1843
                                 $fld['id']
1844 1844
                             );
@@ -1851,38 +1851,38 @@  discard block
 block discarded – undo
1851 1851
 
1852 1852
                             // manage right icon
1853 1853
                             if ($fld['type'] == 'W') {
1854
-                                $label = '<i class="fas fa-indent infotip text-success mr-2" title="' . langHdl('write') . '"></i>' .
1855
-                                    '<i class="fas fa-edit infotip text-success mr-2" title="' . langHdl('edit') . '"></i>' .
1856
-                                    '<i class="fas fa-eraser infotip text-success" title="' . langHdl('delete') . '"></i>';
1854
+                                $label = '<i class="fas fa-indent infotip text-success mr-2" title="'.langHdl('write').'"></i>'.
1855
+                                    '<i class="fas fa-edit infotip text-success mr-2" title="'.langHdl('edit').'"></i>'.
1856
+                                    '<i class="fas fa-eraser infotip text-success" title="'.langHdl('delete').'"></i>';
1857 1857
                             } elseif ($fld['type'] == 'ND') {
1858
-                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . langHdl('write') . '"></i>' .
1859
-                                    '<i class="fas fa-edit infotip text-success mr-2" title="' . langHdl('edit') . '"></i>' .
1860
-                                    '<i class="fas fa-eraser infotip text-danger" title="' . langHdl('no_delete') . '"></i>';
1858
+                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.langHdl('write').'"></i>'.
1859
+                                    '<i class="fas fa-edit infotip text-success mr-2" title="'.langHdl('edit').'"></i>'.
1860
+                                    '<i class="fas fa-eraser infotip text-danger" title="'.langHdl('no_delete').'"></i>';
1861 1861
                             } elseif ($fld['type'] == 'NE') {
1862
-                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . langHdl('write') . '"></i>' .
1863
-                                    '<i class="fas fa-edit infotip text-danger mr-2" title="' . langHdl('no_edit') . '"></i>' .
1864
-                                    '<i class="fas fa-eraser infotip text-success" title="' . langHdl('delete') . '"></i>';
1862
+                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.langHdl('write').'"></i>'.
1863
+                                    '<i class="fas fa-edit infotip text-danger mr-2" title="'.langHdl('no_edit').'"></i>'.
1864
+                                    '<i class="fas fa-eraser infotip text-success" title="'.langHdl('delete').'"></i>';
1865 1865
                             } elseif ($fld['type'] == 'NDNE') {
1866
-                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . langHdl('write') . '"></i>' .
1867
-                                    '<i class="fas fa-edit infotip text-danger mr-2" title="' . langHdl('no_edit') . '"></i>' .
1868
-                                    '<i class="fas fa-eraser infotip text-danger" title="' . langHdl('no_delete') . '"></i>';
1866
+                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.langHdl('write').'"></i>'.
1867
+                                    '<i class="fas fa-edit infotip text-danger mr-2" title="'.langHdl('no_edit').'"></i>'.
1868
+                                    '<i class="fas fa-eraser infotip text-danger" title="'.langHdl('no_delete').'"></i>';
1869 1869
                             } elseif ($fld['type'] == '') {
1870
-                                $label = '<i class="fas fa-eye-slash infotip text-danger mr-2" title="' . langHdl('no_access') . '"></i>';
1870
+                                $label = '<i class="fas fa-eye-slash infotip text-danger mr-2" title="'.langHdl('no_access').'"></i>';
1871 1871
                             } else {
1872
-                                $label = '<i class="fas fa-eye infotip text-info mr-2" title="' . langHdl('read') . '"></i>';
1872
+                                $label = '<i class="fas fa-eye infotip text-info mr-2" title="'.langHdl('read').'"></i>';
1873 1873
                             }
1874 1874
 
1875
-                            $html .= '<tr><td>' . $ident . $row['title'] .
1876
-                                ' <small class="text-info">[' . $row['id'] . ']</small>'.
1877
-                                ($fld['special'] === true ? '<i class="fas fa-user-tag infotip text-primary ml-5" title="' . langHdl('user_specific_right') . '"></i>' : '').
1878
-                                '</td><td>' . $label . '</td></tr>';
1875
+                            $html .= '<tr><td>'.$ident.$row['title'].
1876
+                                ' <small class="text-info">['.$row['id'].']</small>'.
1877
+                                ($fld['special'] === true ? '<i class="fas fa-user-tag infotip text-primary ml-5" title="'.langHdl('user_specific_right').'"></i>' : '').
1878
+                                '</td><td>'.$label.'</td></tr>';
1879 1879
                             break;
1880 1880
                         }
1881 1881
                     }
1882 1882
                 }
1883 1883
 
1884
-                $html_full = '<table id="table-folders" class="table table-bordered table-striped dt-responsive nowrap" style="width:100%"><tbody>' .
1885
-                    $html . '</tbody></table>';
1884
+                $html_full = '<table id="table-folders" class="table table-bordered table-striped dt-responsive nowrap" style="width:100%"><tbody>'.
1885
+                    $html.'</tbody></table>';
1886 1886
             } else {
1887 1887
                 $html_full = '';
1888 1888
             }
@@ -1931,7 +1931,7 @@  discard block
 block discarded – undo
1931 1931
             if ((int) $_SESSION['is_admin'] === 0 && (int) $_SESSION['user_can_manage_all_users'] === 0) {
1932 1932
                 $rows = DB::query(
1933 1933
                     'SELECT *
1934
-                    FROM ' . prefixTable('users') . '
1934
+                    FROM ' . prefixTable('users').'
1935 1935
                     WHERE admin = %i AND isAdministratedByRole IN %ls',
1936 1936
                     '0',
1937 1937
                     array_filter($_SESSION['user_roles'])
@@ -1939,7 +1939,7 @@  discard block
 block discarded – undo
1939 1939
             } else {
1940 1940
                 $rows = DB::query(
1941 1941
                     'SELECT *
1942
-                    FROM ' . prefixTable('users') . '
1942
+                    FROM ' . prefixTable('users').'
1943 1943
                     WHERE admin = %i',
1944 1944
                     '0'
1945 1945
                 );
@@ -1951,7 +1951,7 @@  discard block
 block discarded – undo
1951 1951
                 $groupIds = [];
1952 1952
                 foreach (explode(';', $record['fonction_id']) as $group) {
1953 1953
                     $tmp = DB::queryfirstrow(
1954
-                        'SELECT id, title FROM ' . prefixTable('roles_title') . '
1954
+                        'SELECT id, title FROM '.prefixTable('roles_title').'
1955 1955
                         WHERE id = %i',
1956 1956
                         $group
1957 1957
                     );
@@ -1963,7 +1963,7 @@  discard block
 block discarded – undo
1963 1963
 
1964 1964
                 // Get managed_by
1965 1965
                 $managedBy = DB::queryfirstrow(
1966
-                    'SELECT id, title FROM ' . prefixTable('roles_title') . '
1966
+                    'SELECT id, title FROM '.prefixTable('roles_title').'
1967 1967
                     WHERE id = %i',
1968 1968
                     $record['isAdministratedByRole']
1969 1969
                 );
@@ -1973,7 +1973,7 @@  discard block
 block discarded – undo
1973 1973
                 $foldersAllowedIds = [];
1974 1974
                 foreach (explode(';', $record['groupes_visibles']) as $role) {
1975 1975
                     $tmp = DB::queryfirstrow(
1976
-                        'SELECT id, title FROM ' . prefixTable('nested_tree') . '
1976
+                        'SELECT id, title FROM '.prefixTable('nested_tree').'
1977 1977
                         WHERE id = %i',
1978 1978
                         $role
1979 1979
                     );
@@ -1986,7 +1986,7 @@  discard block
 block discarded – undo
1986 1986
                 $foldersForbiddenIds = [];
1987 1987
                 foreach (explode(';', $record['groupes_interdits']) as $role) {
1988 1988
                     $tmp = DB::queryfirstrow(
1989
-                        'SELECT id, title FROM ' . prefixTable('nested_tree') . '
1989
+                        'SELECT id, title FROM '.prefixTable('nested_tree').'
1990 1990
                         WHERE id = %i',
1991 1991
                         $role
1992 1992
                     );
@@ -2004,7 +2004,7 @@  discard block
 block discarded – undo
2004 2004
                         'login' => $record['login'],
2005 2005
                         'groups' => implode(', ', $groups),
2006 2006
                         'groupIds' => $groupIds,
2007
-                        'managedBy' => $managedBy=== null ? langHdl('administrator') : $managedBy['title'],
2007
+                        'managedBy' => $managedBy === null ? langHdl('administrator') : $managedBy['title'],
2008 2008
                         'managedById' => $managedBy === null ? 0 : $managedBy['id'],
2009 2009
                         'foldersAllowed' => implode(', ', $foldersAllowed),
2010 2010
                         'foldersAllowedIds' => $foldersAllowedIds,
@@ -2060,7 +2060,7 @@  discard block
 block discarded – undo
2060 2060
 
2061 2061
             // decrypt and retreive data in JSON format
2062 2062
             $dataReceived = prepareExchangedData(
2063
-                    $SETTINGS['cpassman_dir'],$post_data, 'decode');
2063
+                    $SETTINGS['cpassman_dir'], $post_data, 'decode');
2064 2064
 
2065 2065
             $post_source_id = filter_var(htmlspecialchars_decode($dataReceived['source_id']), FILTER_SANITIZE_NUMBER_INT);
2066 2066
             $post_destination_ids = filter_var_array($dataReceived['destination_ids'], FILTER_SANITIZE_NUMBER_INT);
@@ -2086,7 +2086,7 @@  discard block
 block discarded – undo
2086 2086
 
2087 2087
             // Get info about user
2088 2088
             $data_user = DB::queryfirstrow(
2089
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
2089
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
2090 2090
                 WHERE id = %i',
2091 2091
                 $post_source_id
2092 2092
             );
@@ -2257,14 +2257,14 @@  discard block
 block discarded – undo
2257 2257
             if (empty($post_context) === false && $post_context === 'add_one_role_to_user') {
2258 2258
                 $data_user = DB::queryfirstrow(
2259 2259
                     'SELECT fonction_id, public_key
2260
-                    FROM ' . prefixTable('users') . '
2260
+                    FROM ' . prefixTable('users').'
2261 2261
                     WHERE id = %i',
2262 2262
                     $post_user_id
2263 2263
                 );
2264 2264
 
2265 2265
                 if ($data_user) {
2266 2266
                     // Ensure array is unique
2267
-                    $post_new_value = str_replace(',', ';', $data_user['fonction_id']) . ';' . $post_new_value;
2267
+                    $post_new_value = str_replace(',', ';', $data_user['fonction_id']).';'.$post_new_value;
2268 2268
                     $post_new_value = implode(';', array_unique(explode(';', $post_new_value)));
2269 2269
                 } else {
2270 2270
                     // User not found
@@ -2281,7 +2281,7 @@  discard block
 block discarded – undo
2281 2281
             }
2282 2282
 
2283 2283
             // Manage specific case of api key
2284
-            if($post_field === 'user_api_key') {
2284
+            if ($post_field === 'user_api_key') {
2285 2285
                 $encrypted_key = encryptUserObjectKey(base64_encode($post_new_value), $_SESSION['user']['public_key']);
2286 2286
                 $_SESSION['user']['api-key'] = $post_new_value;
2287 2287
 
@@ -2362,7 +2362,7 @@  discard block
 block discarded – undo
2362 2362
             if (filter_input(INPUT_POST, 'step', FILTER_SANITIZE_STRING) === 'refresh') {
2363 2363
                 $record = DB::queryFirstRow(
2364 2364
                     'SELECT user_ip_lastdate
2365
-                    FROM ' . prefixTable('users') . '
2365
+                    FROM ' . prefixTable('users').'
2366 2366
                     WHERE id = %i',
2367 2367
                     $_SESSION['user_id']
2368 2368
                 );
@@ -2431,38 +2431,38 @@  discard block
 block discarded – undo
2431 2431
             }
2432 2432
 
2433 2433
             // Load expected libraries
2434
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
2435
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php';
2436
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Symfony/contracts/Translation/TranslatorInterface.php';
2437
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonTimeZone.php';
2438
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Units.php';
2439
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Week.php';
2440
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Timestamp.php';
2441
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Test.php';
2442
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/ObjectInitialisation.php';
2443
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Serialization.php';
2444
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/IntervalRounding.php';
2445
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Rounding.php';
2446
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Localization.php';
2447
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Options.php';
2448
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Cast.php';
2449
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mutability.php';
2450
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Modifiers.php';
2451
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mixin.php';
2452
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Macro.php';
2453
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Difference.php';
2454
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Creator.php';
2455
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Converter.php';
2456
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Comparison.php';
2457
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Boundaries.php';
2458
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Date.php';
2459
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonInterface.php';
2460
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Carbon.php';
2461
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php';
2462
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php';
2463
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php';
2464
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/HandlesConnection.php';
2465
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php';
2434
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
2435
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php';
2436
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Symfony/contracts/Translation/TranslatorInterface.php';
2437
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonTimeZone.php';
2438
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Units.php';
2439
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Week.php';
2440
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Timestamp.php';
2441
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Test.php';
2442
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/ObjectInitialisation.php';
2443
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Serialization.php';
2444
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/IntervalRounding.php';
2445
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Rounding.php';
2446
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Localization.php';
2447
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Options.php';
2448
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Cast.php';
2449
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mutability.php';
2450
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Modifiers.php';
2451
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mixin.php';
2452
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Macro.php';
2453
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Difference.php';
2454
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Creator.php';
2455
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Converter.php';
2456
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Comparison.php';
2457
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Boundaries.php';
2458
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Date.php';
2459
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonInterface.php';
2460
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Carbon.php';
2461
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php';
2462
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php';
2463
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php';
2464
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/HandlesConnection.php';
2465
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php';
2466 2466
 
2467 2467
             // Build ldap configuration array
2468 2468
             $config = [
@@ -2502,7 +2502,7 @@  discard block
 block discarded – undo
2502 2502
                     $SETTINGS['cpassman_dir'],
2503 2503
                     array(
2504 2504
                         'error' => true,
2505
-                        'message' => "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage(). "<br>".$error->getDiagnosticMessage(),
2505
+                        'message' => "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage()."<br>".$error->getDiagnosticMessage(),
2506 2506
                     ),
2507 2507
                     'encode'
2508 2508
                 );
@@ -2517,8 +2517,8 @@  discard block
 block discarded – undo
2517 2517
                 ->whereHas($SETTINGS['ldap_user_attribute'])
2518 2518
                 ->chunk(
2519 2519
                     10000,
2520
-                    function ($users, $SETTINGS) use (&$output) {
2521
-                        include __DIR__ . '/../includes/config/tp.config.php';
2520
+                    function($users, $SETTINGS) use (&$output) {
2521
+                        include __DIR__.'/../includes/config/tp.config.php';
2522 2522
                         $adUsersToSync = array();
2523 2523
                         $adRoles = array();
2524 2524
                         $usersAlreadyInTeampass = array();
@@ -2527,11 +2527,11 @@  discard block
 block discarded – undo
2527 2527
                             'memberof', 'name', 'displayname', 'cn', 'shadowexpire', 'distinguishedname'
2528 2528
                         );
2529 2529
                         
2530
-                        foreach($users as $i => $adUser) {
2530
+                        foreach ($users as $i => $adUser) {
2531 2531
                             if (isset($adUser[$SETTINGS['ldap_user_attribute']][0]) === false) continue;
2532 2532
                             // Build the list of all groups in AD
2533 2533
                             if (isset($adUser['memberof']) === true) {
2534
-                                foreach($adUser['memberof'] as $j => $adUserGroup) {
2534
+                                foreach ($adUser['memberof'] as $j => $adUserGroup) {
2535 2535
                                     if (empty($adUserGroup) === false && $j !== "count") {
2536 2536
                                         $adGroup = substr($adUserGroup, 3, strpos($adUserGroup, ',') - 3);
2537 2537
                                         if (in_array($adGroup, $adRoles) === false && empty($adGroup) === false) {
@@ -2547,7 +2547,7 @@  discard block
 block discarded – undo
2547 2547
                                 // Get his ID
2548 2548
                                 $userInfo = DB::queryfirstrow(
2549 2549
                                     'SELECT id, login, fonction_id, auth_type
2550
-                                    FROM ' . prefixTable('users') . '
2550
+                                    FROM ' . prefixTable('users').'
2551 2551
                                     WHERE login = %s',
2552 2552
                                     $userLogin
2553 2553
                                 );
@@ -2592,7 +2592,7 @@  discard block
 block discarded – undo
2592 2592
 
2593 2593
             // Get all groups in Teampass
2594 2594
             $teampassRoles = array();
2595
-            $rows = DB::query('SELECT id,title FROM ' . prefixTable('roles_title'));
2595
+            $rows = DB::query('SELECT id,title FROM '.prefixTable('roles_title'));
2596 2596
             foreach ($rows as $record) {
2597 2597
                 array_push(
2598 2598
                     $teampassRoles,
@@ -2666,7 +2666,7 @@  discard block
 block discarded – undo
2666 2666
             // Check if user already exists
2667 2667
             $data = DB::query(
2668 2668
                 'SELECT id, fonction_id, groupes_interdits, groupes_visibles
2669
-                FROM ' . prefixTable('users') . '
2669
+                FROM ' . prefixTable('users').'
2670 2670
                 WHERE login = %s',
2671 2671
                 $post_login
2672 2672
             );
@@ -2778,7 +2778,7 @@  discard block
 block discarded – undo
2778 2778
                 );
2779 2779
 
2780 2780
                 // Rebuild tree
2781
-                $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
2781
+                $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
2782 2782
                 $tree->register();
2783 2783
                 $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
2784 2784
                 $tree->rebuild();
@@ -2855,12 +2855,12 @@  discard block
 block discarded – undo
2855 2855
             // Send mail to user with new OTP
2856 2856
             $userInfo = DB::queryFirstRow(
2857 2857
                 'SELECT email
2858
-                FROM ' . prefixTable('users') . '
2858
+                FROM ' . prefixTable('users').'
2859 2859
                 WHERE id = %i',
2860 2860
                 $post_userId
2861 2861
             );
2862 2862
             sendEmail(
2863
-                'TEAMPASS - ' . langHdl('temporary_encryption_code'),
2863
+                'TEAMPASS - '.langHdl('temporary_encryption_code'),
2864 2864
                 str_replace(
2865 2865
                     array('#enc_code#'),
2866 2866
                     array($post_otp),
@@ -2926,7 +2926,7 @@  discard block
 block discarded – undo
2926 2926
             // Check if user already exists
2927 2927
             DB::query(
2928 2928
                 'SELECT id
2929
-                FROM ' . prefixTable('users') . '
2929
+                FROM ' . prefixTable('users').'
2930 2930
                 WHERE id = %i',
2931 2931
                 $post_id
2932 2932
             );
@@ -2983,7 +2983,7 @@  discard block
 block discarded – undo
2983 2983
 
2984 2984
             // decrypt and retrieve data in JSON format
2985 2985
             $dataReceived = prepareExchangedData(
2986
-                    $SETTINGS['cpassman_dir'],$post_data, 'decode');
2986
+                    $SETTINGS['cpassman_dir'], $post_data, 'decode');
2987 2987
 
2988 2988
             // Prepare variables
2989 2989
             $post_userid = filter_var($dataReceived['user_id'], FILTER_SANITIZE_NUMBER_INT);
@@ -3007,7 +3007,7 @@  discard block
 block discarded – undo
3007 3007
             // Check if user already exists
3008 3008
             $userInfo = DB::queryfirstrow(
3009 3009
                 'SELECT id, private_key, public_key
3010
-                FROM ' . prefixTable('users') . '
3010
+                FROM ' . prefixTable('users').'
3011 3011
                 WHERE id = %i',
3012 3012
                 $post_userid
3013 3013
             );
@@ -3056,7 +3056,7 @@  discard block
 block discarded – undo
3056 3056
             if (count($_SESSION['personal_folders']) > 0) {
3057 3057
                 DB::query(
3058 3058
                     'SELECT id
3059
-                    FROM ' . prefixTable('items') . '
3059
+                    FROM ' . prefixTable('items').'
3060 3060
                     WHERE id_tree IN %ls',
3061 3061
                     $_SESSION['personal_folders']
3062 3062
                 );
@@ -3141,7 +3141,7 @@  discard block
 block discarded – undo
3141 3141
             // Check if user already exists
3142 3142
             DB::query(
3143 3143
                 'SELECT id
3144
-                FROM ' . prefixTable('users') . '
3144
+                FROM ' . prefixTable('users').'
3145 3145
                 WHERE id = %i',
3146 3146
                 $post_id
3147 3147
             );
@@ -3223,10 +3223,10 @@  discard block
 block discarded – undo
3223 3223
                     'process_type' => 'create_user_keys',
3224 3224
                     'arguments' => json_encode([
3225 3225
                         'new_user_id' => (int) $post_user_id,
3226
-                        'new_user_pwd' => cryption($post_user_pwd, '','encrypt', $SETTINGS)['string'],
3227
-                        'new_user_code' => cryption($post_user_code, '','encrypt', $SETTINGS)['string'],
3226
+                        'new_user_pwd' => cryption($post_user_pwd, '', 'encrypt', $SETTINGS)['string'],
3227
+                        'new_user_code' => cryption($post_user_code, '', 'encrypt', $SETTINGS)['string'],
3228 3228
                         'owner_id' => (int) $_SESSION['user_id'],
3229
-                        'creator_pwd' => cryption($_SESSION['user_pwd'], '','encrypt', $SETTINGS)['string'],
3229
+                        'creator_pwd' => cryption($_SESSION['user_pwd'], '', 'encrypt', $SETTINGS)['string'],
3230 3230
                     ]),
3231 3231
                     'updated_at' => '',
3232 3232
                     'finished_at' => '',
@@ -3388,7 +3388,7 @@  discard block
 block discarded – undo
3388 3388
             // get user info
3389 3389
             $userInfo = DB::queryFirstRow(
3390 3390
                 'SELECT *
3391
-                FROM ' . prefixTable('users') . '
3391
+                FROM ' . prefixTable('users').'
3392 3392
                 WHERE id = %i',
3393 3393
                 $user_id
3394 3394
             );
@@ -3444,7 +3444,7 @@  discard block
 block discarded – undo
3444 3444
 
3445 3445
     // Get info about user
3446 3446
     $data_user = DB::queryfirstrow(
3447
-        'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
3447
+        'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
3448 3448
         WHERE id = %i',
3449 3449
         $value[1]
3450 3450
     );
@@ -3477,7 +3477,7 @@  discard block
 block discarded – undo
3477 3477
             logEvents(
3478 3478
                 $SETTINGS,
3479 3479
                 'user_mngt',
3480
-                'at_user_new_' . $value[0] . ':' . $value[1],
3480
+                'at_user_new_'.$value[0].':'.$value[1],
3481 3481
                 (string) $_SESSION['user_id'],
3482 3482
                 $_SESSION['login'],
3483 3483
                 filter_input(INPUT_POST, 'id', FILTER_SANITIZE_STRING)
@@ -3508,7 +3508,7 @@  discard block
 block discarded – undo
3508 3508
 
3509 3509
     // Get info about user
3510 3510
     $data_user = DB::queryfirstrow(
3511
-        'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
3511
+        'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
3512 3512
         WHERE id = %i',
3513 3513
         $value[1]
3514 3514
     );
Please login to merge, or discard this patch.
sources/admin.queries.php 1 patch
Spacing   +184 added lines, -184 removed lines patch added patch discarded remove patch
@@ -47,25 +47,25 @@  discard block
 block discarded – undo
47 47
 }
48 48
 
49 49
 /* do checks */
50
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
51
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
50
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
51
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
52 52
 if (!checkUser($_SESSION['user_id'], $_SESSION['key'], 'options', $SETTINGS)) {
53 53
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
54
-    include $SETTINGS['cpassman_dir'] . '/error.php';
54
+    include $SETTINGS['cpassman_dir'].'/error.php';
55 55
     exit;
56 56
 }
57 57
 
58
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user']['user_language'] . '.php';
59
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
60
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php';
58
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user']['user_language'].'.php';
59
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
60
+require_once $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php';
61 61
 
62 62
 header('Content-type: text/html; charset=utf-8');
63 63
 header('Cache-Control: no-cache, no-store, must-revalidate');
64 64
 
65
-require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
65
+require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
66 66
 
67 67
 // connect to the server
68
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
68
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
69 69
 if (defined('DB_PASSWD_CLEAR') === false) {
70 70
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
71 71
 }
@@ -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_FULL;
142
+                    $text .= '<li><u>'.$LANG['your_version'].'</u> : '.TP_VERSION_FULL;
143 143
                     if (floatval(TP_VERSION_FULL) < 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
         //##########################################################
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
         //get through all users
194 194
         $rows = DB::query(
195 195
             'SELECT id, login, email
196
-            FROM ' . prefixTable('users') . '
196
+            FROM ' . prefixTable('users').'
197 197
             ORDER BY login ASC'
198 198
         );
199 199
         foreach ($rows as $record) {
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
             //if folder doesn't exist then create it
211 211
             $data = DB::queryfirstrow(
212 212
                 'SELECT id
213
-                FROM ' . prefixTable('nested_tree') . '
213
+                FROM ' . prefixTable('nested_tree').'
214 214
                 WHERE title = %s AND parent_id = %i',
215 215
                 $record['id'],
216 216
                 0
@@ -274,8 +274,8 @@  discard block
 block discarded – undo
274 274
     $SETTINGS['cpassman_dir'],
275 275
             array(
276 276
                 'error' => false,
277
-                'message' => langHdl('last_execution') . ' ' .
278
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
277
+                'message' => langHdl('last_execution').' '.
278
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
279 279
                     '<i class="fas fa-check text-success ml-2"></i>',
280 280
             ),
281 281
             'encode'
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
         }
312 312
 
313 313
         //Libraries call
314
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
314
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
315 315
 
316 316
         //init
317 317
         $foldersIds = array();
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
             }
326 326
         }
327 327
 
328
-        $items = DB::query('SELECT id,label FROM ' . prefixTable('items') . ' WHERE id_tree NOT IN %li', $foldersIds);
328
+        $items = DB::query('SELECT id,label FROM '.prefixTable('items').' WHERE id_tree NOT IN %li', $foldersIds);
329 329
         foreach ($items as $item) {
330 330
             //Delete item
331 331
             DB::DELETE(prefixTable('items'), 'id = %i', $item['id']);
@@ -346,12 +346,12 @@  discard block
 block discarded – undo
346 346
         // delete orphan items
347 347
         $rows = DB::query(
348 348
             'SELECT id
349
-            FROM ' . prefixTable('items') . '
349
+            FROM ' . prefixTable('items').'
350 350
             ORDER BY id ASC'
351 351
         );
352 352
         foreach ($rows as $item) {
353 353
             DB::query(
354
-                'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i AND action = %s',
354
+                'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i AND action = %s',
355 355
                 $item['id'],
356 356
                 'at_creation'
357 357
             );
@@ -382,11 +382,11 @@  discard block
 block discarded – undo
382 382
     $SETTINGS['cpassman_dir'],
383 383
             array(
384 384
                 'error' => false,
385
-                'message' => langHdl('last_execution') . ' ' .
386
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
385
+                'message' => langHdl('last_execution').' '.
386
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
387 387
                     '<i class="fas fa-check text-success ml-2 mr-3"></i>
388 388
                     <i class="fas fa-chevron-right mr-2"></i>' .
389
-                    $nbItemsDeleted . ' ' . langHdl('deleted_items'),
389
+                    $nbItemsDeleted.' '.langHdl('deleted_items'),
390 390
             ),
391 391
             'encode'
392 392
         );
@@ -420,21 +420,21 @@  discard block
 block discarded – undo
420 420
             break;
421 421
         }
422 422
 
423
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
423
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
424 424
         $return = '';
425 425
 
426 426
         //Get all tables
427 427
         $tables = array();
428 428
         $result = DB::query('SHOW TABLES');
429 429
         foreach ($result as $row) {
430
-            $tables[] = $row['Tables_in_' . $database];
430
+            $tables[] = $row['Tables_in_'.$database];
431 431
         }
432 432
 
433 433
         //cycle through
434 434
         foreach ($tables as $table) {
435 435
             if (defined('DB_PREFIX') || substr_count($table, DB_PREFIX) > 0) {
436 436
                 // Do query
437
-                $result = DB::queryRaw('SELECT * FROM ' . $table);
437
+                $result = DB::queryRaw('SELECT * FROM '.$table);
438 438
                 DB::queryRaw(
439 439
                     'SELECT *
440 440
                     FROM INFORMATION_SCHEMA.COLUMNS
@@ -446,19 +446,19 @@  discard block
 block discarded – undo
446 446
                 $numFields = DB::count();
447 447
 
448 448
                 // prepare a drop table
449
-                $return .= 'DROP TABLE ' . $table . ';';
450
-                $row2 = DB::queryfirstrow('SHOW CREATE TABLE ' . $table);
451
-                $return .= "\n\n" . $row2['Create Table'] . ";\n\n";
449
+                $return .= 'DROP TABLE '.$table.';';
450
+                $row2 = DB::queryfirstrow('SHOW CREATE TABLE '.$table);
451
+                $return .= "\n\n".$row2['Create Table'].";\n\n";
452 452
 
453 453
                 //prepare all fields and datas
454 454
                 for ($i = 0; $i < $numFields; ++$i) {
455 455
                     while ($row = $result->fetch_row()) {
456
-                        $return .= 'INSERT INTO ' . $table . ' VALUES(';
456
+                        $return .= 'INSERT INTO '.$table.' VALUES(';
457 457
                         for ($j = 0; $j < $numFields; ++$j) {
458 458
                             $row[$j] = addslashes($row[$j]);
459 459
                             $row[$j] = preg_replace("/\n/", '\\n', $row[$j]);
460 460
                             if (isset($row[$j])) {
461
-                                $return .= '"' . $row[$j] . '"';
461
+                                $return .= '"'.$row[$j].'"';
462 462
                             } else {
463 463
                                 $return .= 'NULL';
464 464
                             }
@@ -478,8 +478,8 @@  discard block
 block discarded – undo
478 478
             $token = GenerateCryptKey(20, false, true, true, false, true, $SETTINGS);
479 479
 
480 480
             //save file
481
-            $filename = time() . '-' . $token . '.sql';
482
-            $handle = fopen($SETTINGS['path_to_files_folder'] . '/' . $filename, 'w+');
481
+            $filename = time().'-'.$token.'.sql';
482
+            $handle = fopen($SETTINGS['path_to_files_folder'].'/'.$filename, 'w+');
483 483
             if ($handle !== false) {
484 484
                 //write file
485 485
                 fwrite($handle, $return);
@@ -491,17 +491,17 @@  discard block
 block discarded – undo
491 491
                 // Encrypt the file
492 492
                 prepareFileWithDefuse(
493 493
                     'encrypt',
494
-                    $SETTINGS['path_to_files_folder'] . '/' . $filename,
495
-                    $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
494
+                    $SETTINGS['path_to_files_folder'].'/'.$filename,
495
+                    $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
496 496
                     $SETTINGS,
497 497
                     $post_option
498 498
                 );
499 499
 
500 500
                 // Do clean
501
-                unlink($SETTINGS['path_to_files_folder'] . '/' . $filename);
501
+                unlink($SETTINGS['path_to_files_folder'].'/'.$filename);
502 502
                 rename(
503
-                    $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
504
-                    $SETTINGS['path_to_files_folder'] . '/' . $filename
503
+                    $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
504
+                    $SETTINGS['path_to_files_folder'].'/'.$filename
505 505
                 );
506 506
             }
507 507
 
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
             //update LOG
512 512
             logEvents($SETTINGS, 'admin_action', 'dataBase backup', (string) $_SESSION['user_id'], $_SESSION['login']);
513 513
 
514
-            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"}]';
514
+            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"}]';
515 515
         }
516 516
         break;
517 517
 
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
             );
543 543
             break;
544 544
         }
545
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
545
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
546 546
 
547 547
         $dataPost = explode('&', $post_option);
548 548
         $file = htmlspecialchars($dataPost[0]);
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
         // Get filename from database
552 552
         $data = DB::queryFirstRow(
553 553
             'SELECT valeur
554
-            FROM ' . prefixTable('misc') . '
554
+            FROM ' . prefixTable('misc').'
555 555
             WHERE increment_id = %i',
556 556
             $file
557 557
         );
@@ -570,22 +570,22 @@  discard block
 block discarded – undo
570 570
             // Decrypt the file
571 571
             $ret = prepareFileWithDefuse(
572 572
                 'decrypt',
573
-                $SETTINGS['path_to_files_folder'] . '/' . $file,
574
-                $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $file,
573
+                $SETTINGS['path_to_files_folder'].'/'.$file,
574
+                $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$file,
575 575
                 $SETTINGS,
576 576
                 $key
577 577
             );
578 578
 
579 579
             if (empty($ret) === false) {
580
-                echo '[{"result":"db_restore" , "message":"' . $ret . '"}]';
580
+                echo '[{"result":"db_restore" , "message":"'.$ret.'"}]';
581 581
                 break;
582 582
             }
583 583
 
584 584
             // Do clean
585
-            fileDelete($SETTINGS['path_to_files_folder'] . '/' . $file, $SETTINGS);
586
-            $file = $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $file;
585
+            fileDelete($SETTINGS['path_to_files_folder'].'/'.$file, $SETTINGS);
586
+            $file = $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$file;
587 587
         } else {
588
-            $file = $SETTINGS['path_to_files_folder'] . '/' . $file;
588
+            $file = $SETTINGS['path_to_files_folder'].'/'.$file;
589 589
         }
590 590
 
591 591
         //read sql file
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
         fclose($handle);
603 603
 
604 604
         //delete file
605
-        unlink($SETTINGS['path_to_files_folder'] . '/' . $file);
605
+        unlink($SETTINGS['path_to_files_folder'].'/'.$file);
606 606
 
607 607
         //Show done
608 608
         echo '[{"result":"db_restore" , "message":""}]';
@@ -642,8 +642,8 @@  discard block
 block discarded – undo
642 642
             foreach ($table as $i => $tablename) {
643 643
                 if (substr_count($tablename, DB_PREFIX) > 0) {
644 644
                     // launch optimization quieries
645
-                    DB::query('ANALYZE TABLE `' . $tablename . '`');
646
-                    DB::query('OPTIMIZE TABLE `' . $tablename . '`');
645
+                    DB::query('ANALYZE TABLE `'.$tablename.'`');
646
+                    DB::query('OPTIMIZE TABLE `'.$tablename.'`');
647 647
                 }
648 648
             }
649 649
         }
@@ -651,12 +651,12 @@  discard block
 block discarded – undo
651 651
         //Clean up LOG_ITEMS table
652 652
         $rows = DB::query(
653 653
             'SELECT id
654
-            FROM ' . prefixTable('items') . '
654
+            FROM ' . prefixTable('items').'
655 655
             ORDER BY id ASC'
656 656
         );
657 657
         foreach ($rows as $item) {
658 658
             DB::query(
659
-                'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i AND action = %s',
659
+                'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i AND action = %s',
660 660
                 $item['id'],
661 661
                 'at_creation'
662 662
             );
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
             if ($counter === 0) {
665 665
                 //Create new at_creation entry
666 666
                 $rowTmp = DB::queryFirstRow(
667
-                    'SELECT date, id_user FROM ' . prefixTable('log_items') . ' WHERE id_item=%i ORDER BY date ASC',
667
+                    'SELECT date, id_user FROM '.prefixTable('log_items').' WHERE id_item=%i ORDER BY date ASC',
668 668
                     $item['id']
669 669
                 );
670 670
                 DB::insert(
@@ -695,8 +695,8 @@  discard block
 block discarded – undo
695 695
     $SETTINGS['cpassman_dir'],
696 696
             array(
697 697
                 'error' => false,
698
-                'message' => langHdl('last_execution') . ' ' .
699
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
698
+                'message' => langHdl('last_execution').' '.
699
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
700 700
                     '<i class="fas fa-check text-success ml-2"></i>',
701 701
             ),
702 702
             'encode'
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
             break;
732 732
         }
733 733
 
734
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
734
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
735 735
 
736 736
         //read folder
737 737
         if (is_dir($SETTINGS['path_to_files_folder']) === false) {
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
     $SETTINGS['cpassman_dir'],
740 740
                 array(
741 741
                     'error' => true,
742
-                    'message' => langHdl('file_folder_not_accessible') . ": " . $SETTINGS['path_to_files_folder'],
742
+                    'message' => langHdl('file_folder_not_accessible').": ".$SETTINGS['path_to_files_folder'],
743 743
                 ),
744 744
                 'encode'
745 745
             );
@@ -751,8 +751,8 @@  discard block
 block discarded – undo
751 751
             //delete file FILES
752 752
             while (false !== ($f = readdir($dir))) {
753 753
                 if ($f !== '.' && $f !== '..' && $f !== '.htaccess') {
754
-                    if (file_exists($dir . $f) && ((time() - filectime($dir . $f)) > 604800)) {
755
-                        fileDelete($dir . '/' . $f, $SETTINGS);
754
+                    if (file_exists($dir.$f) && ((time() - filectime($dir.$f)) > 604800)) {
755
+                        fileDelete($dir.'/'.$f, $SETTINGS);
756 756
                     }
757 757
                 }
758 758
             }
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
     $SETTINGS['cpassman_dir'],
768 768
                 array(
769 769
                     'error' => true,
770
-                    'message' => langHdl('file_folder_not_accessible') . ": " . $SETTINGS['path_to_upload_folder'],
770
+                    'message' => langHdl('file_folder_not_accessible').": ".$SETTINGS['path_to_upload_folder'],
771 771
                 ),
772 772
                 'encode'
773 773
             );
@@ -781,7 +781,7 @@  discard block
 block discarded – undo
781 781
             while (false !== ($f = readdir($dir))) {
782 782
                 if ($f !== '.' && $f !== '..') {
783 783
                     if (strpos($f, '_delete.') > 0) {
784
-                        fileDelete($SETTINGS['path_to_upload_folder'] . '/' . $f, $SETTINGS);
784
+                        fileDelete($SETTINGS['path_to_upload_folder'].'/'.$f, $SETTINGS);
785 785
                     }
786 786
                 }
787 787
             }
@@ -804,11 +804,11 @@  discard block
 block discarded – undo
804 804
     $SETTINGS['cpassman_dir'],
805 805
             array(
806 806
                 'error' => false,
807
-                'message' => langHdl('last_execution') . ' ' .
808
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
807
+                'message' => langHdl('last_execution').' '.
808
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
809 809
                     '<i class="fas fa-check text-success ml-2 mr-3"></i>
810 810
                     <i class="fas fa-chevron-right mr-2"></i>' .
811
-                    $nbItemsDeleted . ' ' . langHdl('deleted_items'),
811
+                    $nbItemsDeleted.' '.langHdl('deleted_items'),
812 812
             ),
813 813
             'encode'
814 814
         );
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
             break;
844 844
         }
845 845
 
846
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
846
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
847 847
         updateCacheTable('reload', $SETTINGS, NULL);
848 848
 
849 849
         // Log
@@ -860,8 +860,8 @@  discard block
 block discarded – undo
860 860
     $SETTINGS['cpassman_dir'],
861 861
             [
862 862
                 'error' => false,
863
-                'message' => langHdl('last_execution') . ' ' .
864
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
863
+                'message' => langHdl('last_execution').' '.
864
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
865 865
                     '<i class="fas fa-check text-success mr-2"></i>',
866 866
             ],
867 867
             'encode'
@@ -898,7 +898,7 @@  discard block
 block discarded – undo
898 898
         }
899 899
 
900 900
         // Perform
901
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
901
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
902 902
         $ret = handleConfigFile('rebuild', $SETTINGS);
903 903
 
904 904
         // Log
@@ -927,8 +927,8 @@  discard block
 block discarded – undo
927 927
     $SETTINGS['cpassman_dir'],
928 928
             array(
929 929
                 'error' => false,
930
-                'message' => langHdl('last_execution') . ' ' .
931
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
930
+                'message' => langHdl('last_execution').' '.
931
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
932 932
                     '<i class="fas fa-check text-success ml-2"></i>',
933 933
             ),
934 934
             'encode'
@@ -970,33 +970,33 @@  discard block
 block discarded – undo
970 970
         $filename = $post_option;
971 971
         $tp_settings = [];
972 972
         //get backups infos
973
-        $rows = DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s', 'admin');
973
+        $rows = DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s', 'admin');
974 974
         foreach ($rows as $record) {
975 975
             $tp_settings[$record['intitule']] = $record['valeur'];
976 976
         }
977 977
 
978 978
         // check if backup file is in DB.
979 979
         // If YES then it is encrypted with DEFUSE
980
-        $bck = DB::queryFirstRow('SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'backup', 'filename');
980
+        $bck = DB::queryFirstRow('SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'backup', 'filename');
981 981
 
982 982
         //read file
983 983
         $return = '';
984
-        $Fnm = $tp_settings['bck_script_path'] . '/' . $filename . '.sql';
984
+        $Fnm = $tp_settings['bck_script_path'].'/'.$filename.'.sql';
985 985
         if (file_exists($Fnm)) {
986 986
             if (!empty($bck) && $bck['valeur'] === $filename) {
987 987
                 $err = '';
988 988
 
989 989
                 // it means that file is DEFUSE encrypted
990
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Crypto.php';
991
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/DerivedKeys.php';
992
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/KeyOrPassword.php';
993
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/File.php';
994
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Core.php';
990
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Crypto.php';
991
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/DerivedKeys.php';
992
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/KeyOrPassword.php';
993
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/File.php';
994
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Core.php';
995 995
 
996 996
                 try {
997 997
                     \Defuse\Crypto\File::decryptFileWithPassword(
998
-                        $SETTINGS['bck_script_path'] . '/' . $post_option . '.sql',
999
-                        $SETTINGS['bck_script_path'] . '/' . str_replace('encrypted', 'clear', $filename) . '.sql',
998
+                        $SETTINGS['bck_script_path'].'/'.$post_option.'.sql',
999
+                        $SETTINGS['bck_script_path'].'/'.str_replace('encrypted', 'clear', $filename).'.sql',
1000 1000
                         base64_decode($SETTINGS['bck_script_key'])
1001 1001
                     );
1002 1002
                 } catch (Defuse\Crypto\Exception\WrongKeyOrModifiedCiphertextException $ex) {
@@ -1004,7 +1004,7 @@  discard block
 block discarded – undo
1004 1004
                 }
1005 1005
 
1006 1006
                 if (!empty($err)) {
1007
-                    echo '[{ "result":"backup_decrypt_fails" , "msg":"' . $err . '"}]';
1007
+                    echo '[{ "result":"backup_decrypt_fails" , "msg":"'.$err.'"}]';
1008 1008
                     break;
1009 1009
                 }
1010 1010
             } else {
@@ -1026,19 +1026,19 @@  discard block
 block discarded – undo
1026 1026
                 );
1027 1027
 
1028 1028
                 //save the file
1029
-                $handle = fopen($tp_settings['bck_script_path'] . '/' . $filename . '.clear.sql', 'w+');
1029
+                $handle = fopen($tp_settings['bck_script_path'].'/'.$filename.'.clear.sql', 'w+');
1030 1030
                 if ($handle !== false) {
1031 1031
                     fwrite($handle, $return);
1032 1032
                     fclose($handle);
1033 1033
                 }
1034 1034
             }
1035 1035
             $result = 'backup_decrypt_success';
1036
-            $msg = $tp_settings['bck_script_path'] . '/' . $filename . '.clear.sql';
1036
+            $msg = $tp_settings['bck_script_path'].'/'.$filename.'.clear.sql';
1037 1037
         } else {
1038 1038
             $result = 'backup_decrypt_fails';
1039
-            $msg = 'File not found: ' . $Fnm;
1039
+            $msg = 'File not found: '.$Fnm;
1040 1040
         }
1041
-        echo '[{ "result":"' . $result . '" , "msg":"' . $msg . '"}]';
1041
+        echo '[{ "result":"'.$result.'" , "msg":"'.$msg.'"}]';
1042 1042
         break;
1043 1043
 
1044 1044
         /*
@@ -1077,7 +1077,7 @@  discard block
 block discarded – undo
1077 1077
         $_SESSION['reencrypt_old_salt'] = file_get_contents(SECUREPATH.'/'.SECUREFILE);
1078 1078
 
1079 1079
         // generate new saltkey
1080
-        $old_sk_filename = SECUREPATH.'/'.SECUREFILE . date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))) . '.' . time();
1080
+        $old_sk_filename = SECUREPATH.'/'.SECUREFILE.date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))).'.'.time();
1081 1081
         copy(
1082 1082
             SECUREPATH.'/'.SECUREFILE,
1083 1083
             $old_sk_filename
@@ -1105,13 +1105,13 @@  discard block
 block discarded – undo
1105 1105
         logEvents($SETTINGS, 'system', 'change_salt_key', (string) $_SESSION['user_id'], $_SESSION['login']);
1106 1106
 
1107 1107
         // get number of items to change
1108
-        DB::query('SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i', 0);
1108
+        DB::query('SELECT id FROM '.prefixTable('items').' WHERE perso = %i', 0);
1109 1109
         $nb_of_items = DB::count();
1110 1110
 
1111 1111
         // create backup table
1112
-        DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
1112
+        DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup'));
1113 1113
         DB::query(
1114
-            'CREATE TABLE `' . prefixTable('sk_reencrypt_backup') . '` (
1114
+            'CREATE TABLE `'.prefixTable('sk_reencrypt_backup').'` (
1115 1115
             `id` int(12) NOT null AUTO_INCREMENT,
1116 1116
             `current_table` varchar(100) NOT NULL,
1117 1117
             `current_field` varchar(500) NOT NULL,
@@ -1139,7 +1139,7 @@  discard block
 block discarded – undo
1139 1139
         );
1140 1140
 
1141 1141
         // delete previous backup files
1142
-        $files = glob($SETTINGS['path_to_upload_folder'] . '/*'); // get all file names
1142
+        $files = glob($SETTINGS['path_to_upload_folder'].'/*'); // get all file names
1143 1143
         foreach ($files as $file) { // iterate files
1144 1144
             if (is_file($file)) {
1145 1145
                 $file_parts = pathinfo($file);
@@ -1226,7 +1226,7 @@  discard block
 block discarded – undo
1226 1226
     $SETTINGS['cpassman_dir'],
1227 1227
                     array(
1228 1228
                         'error' => true,
1229
-                        'message' => 'Input `' . $objects[0] . '` is not allowed',
1229
+                        'message' => 'Input `'.$objects[0].'` is not allowed',
1230 1230
                         'nbOfItems' => '',
1231 1231
                         'nextAction' => '',
1232 1232
                     ),
@@ -1239,9 +1239,9 @@  discard block
 block discarded – undo
1239 1239
                 //change all encrypted data in Items (passwords)
1240 1240
                 $rows = DB::query(
1241 1241
                     'SELECT id, pw, pw_iv
1242
-                    FROM ' . prefixTable('items') . '
1242
+                    FROM ' . prefixTable('items').'
1243 1243
                     WHERE perso = %s
1244
-                    LIMIT ' . $post_start . ', ' . $post_length,
1244
+                    LIMIT ' . $post_start.', '.$post_length,
1245 1245
                     '0'
1246 1246
                 );
1247 1247
                 foreach ($rows as $record) {
@@ -1253,7 +1253,7 @@  discard block
 block discarded – undo
1253 1253
                             'current_field' => 'pw',
1254 1254
                             'value_id' => $record['id'],
1255 1255
                             'value' => $record['pw'],
1256
-                            'current_sql' => 'UPDATE ' . prefixTable('items') . " SET pw = '" . $record['pw'] . "' WHERE id = '" . $record['id'] . "';",
1256
+                            'current_sql' => 'UPDATE '.prefixTable('items')." SET pw = '".$record['pw']."' WHERE id = '".$record['id']."';",
1257 1257
                             'value2' => 'none',
1258 1258
                             'result' => 'none',
1259 1259
                         )
@@ -1302,9 +1302,9 @@  discard block
 block discarded – undo
1302 1302
                 //change all encrypted data in Logs (passwords)
1303 1303
                 $rows = DB::query(
1304 1304
                     'SELECT raison, increment_id
1305
-                    FROM ' . prefixTable('log_items') . "
1305
+                    FROM ' . prefixTable('log_items')."
1306 1306
                     WHERE action = %s AND raison LIKE 'at_pw :%'
1307
-                    LIMIT " . $post_start . ', ' . $post_length,
1307
+                    LIMIT " . $post_start.', '.$post_length,
1308 1308
                     'at_modification'
1309 1309
                 );
1310 1310
                 foreach ($rows as $record) {
@@ -1316,7 +1316,7 @@  discard block
 block discarded – undo
1316 1316
                             'current_field' => 'raison',
1317 1317
                             'value_id' => $record['increment_id'],
1318 1318
                             'value' => $record['raison'],
1319
-                            'current_sql' => 'UPDATE ' . prefixTable('log_items') . " SET raison = '" . $record['raison'] . "' WHERE increment_id = '" . $record['increment_id'] . "';",
1319
+                            'current_sql' => 'UPDATE '.prefixTable('log_items')." SET raison = '".$record['raison']."' WHERE increment_id = '".$record['increment_id']."';",
1320 1320
                             'value2' => 'none',
1321 1321
                             'result' => 'none',
1322 1322
                         )
@@ -1344,7 +1344,7 @@  discard block
 block discarded – undo
1344 1344
                         DB::update(
1345 1345
                             prefixTable('log_items'),
1346 1346
                             array(
1347
-                                'raison' => 'at_pw :' . $encrypt['string'],
1347
+                                'raison' => 'at_pw :'.$encrypt['string'],
1348 1348
                                 'encryption_type' => 'defuse',
1349 1349
                             ),
1350 1350
                             'increment_id = %i',
@@ -1369,8 +1369,8 @@  discard block
 block discarded – undo
1369 1369
                 //change all encrypted data in CATEGORIES (passwords)
1370 1370
                 $rows = DB::query(
1371 1371
                     'SELECT id, data
1372
-                    FROM ' . prefixTable('categories_items') . '
1373
-                    LIMIT ' . $post_start . ', ' . $post_length
1372
+                    FROM ' . prefixTable('categories_items').'
1373
+                    LIMIT ' . $post_start.', '.$post_length
1374 1374
                 );
1375 1375
                 foreach ($rows as $record) {
1376 1376
                     // backup data
@@ -1381,7 +1381,7 @@  discard block
 block discarded – undo
1381 1381
                             'current_field' => 'data',
1382 1382
                             'value_id' => $record['id'],
1383 1383
                             'value' => $record['data'],
1384
-                            'current_sql' => 'UPDATE ' . prefixTable('categories_items') . " SET data = '" . $record['data'] . "' WHERE id = '" . $record['id'] . "';",
1384
+                            'current_sql' => 'UPDATE '.prefixTable('categories_items')." SET data = '".$record['data']."' WHERE id = '".$record['id']."';",
1385 1385
                             'value2' => 'none',
1386 1386
                             'result' => 'none',
1387 1387
                         )
@@ -1429,9 +1429,9 @@  discard block
 block discarded – undo
1429 1429
                 // Change all encrypted data in FILES (passwords)
1430 1430
                 $rows = DB::query(
1431 1431
                     'SELECT id, file, status
1432
-                    FROM ' . prefixTable('files') . "
1432
+                    FROM ' . prefixTable('files')."
1433 1433
                     WHERE status = 'encrypted'
1434
-                    LIMIT " . $post_start . ', ' . $post_length
1434
+                    LIMIT " . $post_start.', '.$post_length
1435 1435
                 );
1436 1436
                 foreach ($rows as $record) {
1437 1437
                     // backup data
@@ -1449,20 +1449,20 @@  discard block
 block discarded – undo
1449 1449
                     );
1450 1450
                     $newID = DB::insertId();
1451 1451
 
1452
-                    if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['file'])) {
1452
+                    if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['file'])) {
1453 1453
                         // make a copy of file
1454 1454
                         if (!copy(
1455
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
1456
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '.copy'
1455
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
1456
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'.copy'
1457 1457
                         )) {
1458 1458
                             $error = 'Copy not possible';
1459 1459
                             exit;
1460 1460
                         } else {
1461 1461
                             // prepare a bck of file (that will not be deleted)
1462
-                            $backup_filename = $record['file'] . '.bck-change-sk.' . time();
1462
+                            $backup_filename = $record['file'].'.bck-change-sk.'.time();
1463 1463
                             copy(
1464
-                                $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
1465
-                                $SETTINGS['path_to_upload_folder'] . '/' . $backup_filename
1464
+                                $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
1465
+                                $SETTINGS['path_to_upload_folder'].'/'.$backup_filename
1466 1466
                             );
1467 1467
                         }
1468 1468
 
@@ -1470,24 +1470,24 @@  discard block
 block discarded – undo
1470 1470
                         // STEP1 - Do decryption
1471 1471
                         prepareFileWithDefuse(
1472 1472
                             'decrypt',
1473
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
1474
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted',
1473
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
1474
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted',
1475 1475
                             $SETTINGS
1476 1476
                         );
1477 1477
 
1478 1478
                         // Do cleanup of files
1479
-                        unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['file']);
1479
+                        unlink($SETTINGS['path_to_upload_folder'].'/'.$record['file']);
1480 1480
 
1481 1481
                         // STEP2 - Do encryption
1482 1482
                         prepareFileWithDefuse(
1483 1483
                             'encryp',
1484
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted',
1485
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
1484
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted',
1485
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
1486 1486
                             $SETTINGS
1487 1487
                         );
1488 1488
 
1489 1489
                         // Do cleanup of files
1490
-                        unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted');
1490
+                        unlink($SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted');
1491 1491
 
1492 1492
                         // Update backup table
1493 1493
                         DB::update(
@@ -1513,13 +1513,13 @@  discard block
 block discarded – undo
1513 1513
                 // do some things for new object
1514 1514
                 if (isset($objects[0])) {
1515 1515
                     if ($objects[0] === 'logs') {
1516
-                        DB::query('SELECT increment_id FROM ' . prefixTable('log_items') . " WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
1516
+                        DB::query('SELECT increment_id FROM '.prefixTable('log_items')." WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
1517 1517
                     } elseif ($objects[0] === 'files') {
1518
-                        DB::query('SELECT id FROM ' . prefixTable('files'));
1518
+                        DB::query('SELECT id FROM '.prefixTable('files'));
1519 1519
                     } elseif ($objects[0] === 'categories') {
1520
-                        DB::query('SELECT id FROM ' . prefixTable('categories_items'));
1520
+                        DB::query('SELECT id FROM '.prefixTable('categories_items'));
1521 1521
                     } elseif ($objects[0] === 'custfields') {
1522
-                        DB::query('SELECT raison FROM ' . prefixTable('log_items') . " WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
1522
+                        DB::query('SELECT raison FROM '.prefixTable('log_items')." WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
1523 1523
                     }
1524 1524
                     $nb_of_items = DB::count();
1525 1525
                 } else {
@@ -1644,12 +1644,12 @@  discard block
 block discarded – undo
1644 1644
                 );
1645 1645
             } elseif ($record['current_table'] === 'files') {
1646 1646
                 // restore backup file
1647
-                if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value'])) {
1648
-                    unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['value']);
1649
-                    if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value2'])) {
1647
+                if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value'])) {
1648
+                    unlink($SETTINGS['path_to_upload_folder'].'/'.$record['value']);
1649
+                    if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value2'])) {
1650 1650
                         rename(
1651
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['value2'],
1652
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['value']
1651
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['value2'],
1652
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['value']
1653 1653
                         );
1654 1654
                     }
1655 1655
                 }
@@ -1668,7 +1668,7 @@  discard block
 block discarded – undo
1668 1668
         }
1669 1669
 
1670 1670
         // drop table
1671
-        DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
1671
+        DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup'));
1672 1672
 
1673 1673
         // Send back
1674 1674
         echo prepareExchangedData(
@@ -1714,17 +1714,17 @@  discard block
 block discarded – undo
1714 1714
         // delete files
1715 1715
         $rows = DB::query(
1716 1716
             'SELECT value, value2
1717
-            FROM ' . prefixTable('sk_reencrypt_backup') . "
1717
+            FROM ' . prefixTable('sk_reencrypt_backup')."
1718 1718
             WHERE current_table = 'files'"
1719 1719
         );
1720 1720
         foreach ($rows as $record) {
1721
-            if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value2'])) {
1722
-                unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['value2']);
1721
+            if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value2'])) {
1722
+                unlink($SETTINGS['path_to_upload_folder'].'/'.$record['value2']);
1723 1723
             }
1724 1724
         }
1725 1725
 
1726 1726
         // drop table
1727
-        DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
1727
+        DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup'));
1728 1728
 
1729 1729
         echo '[{"status":"done"}]';
1730 1730
         break;
@@ -1758,7 +1758,7 @@  discard block
 block discarded – undo
1758 1758
             );
1759 1759
             break;
1760 1760
         } else {
1761
-            require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1761
+            require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1762 1762
 
1763 1763
             //send email
1764 1764
             sendEmail(
@@ -1796,11 +1796,11 @@  discard block
 block discarded – undo
1796 1796
             break;
1797 1797
         }
1798 1798
 
1799
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1799
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1800 1800
 
1801 1801
         $rows = DB::query(
1802 1802
             'SELECT *
1803
-            FROM ' . prefixTable('emails') . '
1803
+            FROM ' . prefixTable('emails').'
1804 1804
             WHERE status = %s OR status = %s',
1805 1805
             'not_sent',
1806 1806
             ''
@@ -1887,9 +1887,9 @@  discard block
 block discarded – undo
1887 1887
             break;
1888 1888
         }
1889 1889
 
1890
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1890
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1891 1891
 
1892
-        $rows = DB::query('SELECT * FROM ' . prefixTable('emails') . ' WHERE status = %s OR status = %s', 'not_sent', '');
1892
+        $rows = DB::query('SELECT * FROM '.prefixTable('emails').' WHERE status = %s OR status = %s', 'not_sent', '');
1893 1893
         foreach ($rows as $record) {
1894 1894
             //send email
1895 1895
             $ret = json_decode(
@@ -1960,7 +1960,7 @@  discard block
 block discarded – undo
1960 1960
             break;
1961 1961
         }
1962 1962
 
1963
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1963
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1964 1964
 
1965 1965
         // init
1966 1966
         $filesList = array();
@@ -1973,7 +1973,7 @@  discard block
 block discarded – undo
1973 1973
                 FROM ' . prefixTable('files')
1974 1974
             );
1975 1975
             foreach ($rows as $record) {
1976
-                if (is_file($SETTINGS['path_to_upload_folder'] . '/' . $record['file'])) {
1976
+                if (is_file($SETTINGS['path_to_upload_folder'].'/'.$record['file'])) {
1977 1977
                     $addFile = false;
1978 1978
                     if (($post_option === 'attachments-decrypt' && $record['status'] === 'encrypted')
1979 1979
                         || ($post_option === 'attachments-encrypt' && $record['status'] === 'clear')
@@ -2042,8 +2042,8 @@  discard block
 block discarded – undo
2042 2042
         $post_list = filter_var_array($post_list, FILTER_SANITIZE_STRING);
2043 2043
         $post_counter = filter_var($post_counter, FILTER_SANITIZE_NUMBER_INT);
2044 2044
 
2045
-        include $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2046
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
2045
+        include $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2046
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
2047 2047
 
2048 2048
         $cpt = 0;
2049 2049
         $continu = true;
@@ -2051,15 +2051,15 @@  discard block
 block discarded – undo
2051 2051
         $message = '';
2052 2052
 
2053 2053
         // load PhpEncryption library
2054
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Crypto.php';
2055
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Encoding.php';
2056
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/DerivedKeys.php';
2057
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Key.php';
2058
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/KeyOrPassword.php';
2059
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/File.php';
2060
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/RuntimeTests.php';
2061
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/KeyProtectedByPassword.php';
2062
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Core.php';
2054
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Crypto.php';
2055
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Encoding.php';
2056
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/DerivedKeys.php';
2057
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Key.php';
2058
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/KeyOrPassword.php';
2059
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/File.php';
2060
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/RuntimeTests.php';
2061
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/KeyProtectedByPassword.php';
2062
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Core.php';
2063 2063
 
2064 2064
         // treat 10 files
2065 2065
         foreach ($post_list as $file) {
@@ -2067,35 +2067,35 @@  discard block
 block discarded – undo
2067 2067
                 // Get file name
2068 2068
                 $file_info = DB::queryfirstrow(
2069 2069
                     'SELECT file
2070
-                    FROM ' . prefixTable('files') . '
2070
+                    FROM ' . prefixTable('files').'
2071 2071
                     WHERE id = %i',
2072 2072
                     $file
2073 2073
                 );
2074 2074
 
2075 2075
                 // skip file is Coherancey not respected
2076
-                if (is_file($SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'])) {
2076
+                if (is_file($SETTINGS['path_to_upload_folder'].'/'.$file_info['file'])) {
2077 2077
                     // Case where we want to decrypt
2078 2078
                     if ($post_option === 'decrypt') {
2079 2079
                         prepareFileWithDefuse(
2080 2080
                             'decrypt',
2081
-                            $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'],
2082
-                            $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
2081
+                            $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'],
2082
+                            $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
2083 2083
                             $SETTINGS
2084 2084
                         );
2085 2085
                         // Case where we want to encrypt
2086 2086
                     } elseif ($post_option === 'encrypt') {
2087 2087
                         prepareFileWithDefuse(
2088 2088
                             'encrypt',
2089
-                            $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'],
2090
-                            $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
2089
+                            $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'],
2090
+                            $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
2091 2091
                             $SETTINGS
2092 2092
                         );
2093 2093
                     }
2094 2094
                     // Do file cleanup
2095
-                    fileDelete($SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'], $SETTINGS);
2095
+                    fileDelete($SETTINGS['path_to_upload_folder'].'/'.$file_info['file'], $SETTINGS);
2096 2096
                     rename(
2097
-                        $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
2098
-                        $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file']
2097
+                        $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
2098
+                        $SETTINGS['path_to_upload_folder'].'/'.$file_info['file']
2099 2099
                     );
2100 2100
 
2101 2101
                     // store in DB
@@ -2130,8 +2130,8 @@  discard block
 block discarded – undo
2130 2130
                 $post_option === 'attachments-decrypt' ? 'clear' : 'encrypted'
2131 2131
             );
2132 2132
 
2133
-            $message = langHdl('last_execution') . ' ' .
2134
-                date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
2133
+            $message = langHdl('last_execution').' '.
2134
+                date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
2135 2135
                 '<i class="fas fa-check text-success ml-2 mr-3"></i>';
2136 2136
         }
2137 2137
 
@@ -2229,7 +2229,7 @@  discard block
 block discarded – undo
2229 2229
             $post_id = filter_var($dataReceived['id'], FILTER_SANITIZE_STRING);
2230 2230
 
2231 2231
             DB::query(
2232
-                'DELETE FROM ' . prefixTable('api') . ' WHERE increment_id = %i',
2232
+                'DELETE FROM '.prefixTable('api').' WHERE increment_id = %i',
2233 2233
                 $post_id
2234 2234
             );
2235 2235
         }
@@ -2328,7 +2328,7 @@  discard block
 block discarded – undo
2328 2328
             // Delete existing key
2329 2329
         } elseif (null !== $post_action && $post_action === 'delete') {
2330 2330
             $post_id = filter_var($dataReceived['id'], FILTER_SANITIZE_STRING);
2331
-            DB::query('DELETE FROM ' . prefixTable('api') . ' WHERE increment_id=%i', $post_id);
2331
+            DB::query('DELETE FROM '.prefixTable('api').' WHERE increment_id=%i', $post_id);
2332 2332
         }
2333 2333
 
2334 2334
         echo prepareExchangedData(
@@ -2344,7 +2344,7 @@  discard block
 block discarded – undo
2344 2344
 
2345 2345
     case 'save_api_status':
2346 2346
         // Do query
2347
-        DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'api');
2347
+        DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'api');
2348 2348
         $counter = DB::count();
2349 2349
         if ($counter === 0) {
2350 2350
             DB::insert(
@@ -2371,7 +2371,7 @@  discard block
 block discarded – undo
2371 2371
 
2372 2372
     case 'run_duo_config_check':
2373 2373
         //Libraries call
2374
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
2374
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
2375 2375
         // Check KEY
2376 2376
         if ($post_key !== $_SESSION['key']) {
2377 2377
             echo prepareExchangedData(
@@ -2427,7 +2427,7 @@  discard block
 block discarded – undo
2427 2427
                 $SETTINGS['cpassman_dir'],
2428 2428
                     array(
2429 2429
                         'error' => true,
2430
-                        'message' => langHdl('duo_config_error') . "<br/>Duo: " . $e->getMessage(),
2430
+                        'message' => langHdl('duo_config_error')."<br/>Duo: ".$e->getMessage(),
2431 2431
                     ),
2432 2432
                     'encode'
2433 2433
             );
@@ -2447,7 +2447,7 @@  discard block
 block discarded – undo
2447 2447
                 $duo_error = langHdl('duo_error_secure');
2448 2448
                 $data["duo_check"] = "failed";
2449 2449
             }*/
2450
-            $duo_error = langHdl('duo_error_check_config') . "<br/>Duo: " . $e->getMessage();
2450
+            $duo_error = langHdl('duo_error_check_config')."<br/>Duo: ".$e->getMessage();
2451 2451
             echo prepareExchangedData(
2452 2452
                 $SETTINGS['cpassman_dir'],
2453 2453
                     array(
@@ -2496,7 +2496,7 @@  discard block
 block discarded – undo
2496 2496
         } else {
2497 2497
             $tmp = 1;
2498 2498
         }
2499
-        DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'google_authentication');
2499
+        DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'google_authentication');
2500 2500
         $counter = DB::count();
2501 2501
         if ($counter === 0) {
2502 2502
             DB::insert(
@@ -2522,7 +2522,7 @@  discard block
 block discarded – undo
2522 2522
 
2523 2523
         // ga_website_name
2524 2524
         if (is_null($dataReceived['ga_website_name']) === false) {
2525
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'ga_website_name');
2525
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'ga_website_name');
2526 2526
             $counter = DB::count();
2527 2527
             if ($counter === 0) {
2528 2528
                 DB::insert(
@@ -2553,7 +2553,7 @@  discard block
 block discarded – undo
2553 2553
         }
2554 2554
 
2555 2555
         // send data
2556
-        echo '[{"result" : "' . addslashes($LANG['done']) . '" , "error" : ""}]';
2556
+        echo '[{"result" : "'.addslashes($LANG['done']).'" , "error" : ""}]';
2557 2557
         break;
2558 2558
 
2559 2559
     case 'save_agses_options':
@@ -2578,7 +2578,7 @@  discard block
 block discarded – undo
2578 2578
 
2579 2579
         // agses_hosted_url
2580 2580
         if (!is_null($dataReceived['agses_hosted_url'])) {
2581
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_url');
2581
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_url');
2582 2582
             $counter = DB::count();
2583 2583
             if ($counter === 0) {
2584 2584
                 DB::insert(
@@ -2607,7 +2607,7 @@  discard block
 block discarded – undo
2607 2607
 
2608 2608
         // agses_hosted_id
2609 2609
         if (!is_null($dataReceived['agses_hosted_id'])) {
2610
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_id');
2610
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_id');
2611 2611
             $counter = DB::count();
2612 2612
             if ($counter === 0) {
2613 2613
                 DB::insert(
@@ -2636,7 +2636,7 @@  discard block
 block discarded – undo
2636 2636
 
2637 2637
         // agses_hosted_apikey
2638 2638
         if (!is_null($dataReceived['agses_hosted_apikey'])) {
2639
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_apikey');
2639
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_apikey');
2640 2640
             $counter = DB::count();
2641 2641
             if ($counter === 0) {
2642 2642
                 DB::insert(
@@ -2664,7 +2664,7 @@  discard block
 block discarded – undo
2664 2664
         }
2665 2665
 
2666 2666
         // send data
2667
-        echo '[{"result" : "' . addslashes($LANG['done']) . '" , "error" : ""}]';
2667
+        echo '[{"result" : "'.addslashes($LANG['done']).'" , "error" : ""}]';
2668 2668
         break;
2669 2669
 
2670 2670
     case 'save_option_change':
@@ -2705,7 +2705,7 @@  discard block
 block discarded – undo
2705 2705
 
2706 2706
         // Check if setting is already in DB. If NO then insert, if YES then update.
2707 2707
         $data = DB::query(
2708
-            'SELECT * FROM ' . prefixTable('misc') . '
2708
+            'SELECT * FROM '.prefixTable('misc').'
2709 2709
             WHERE type = %s AND intitule = %s',
2710 2710
             'admin',
2711 2711
             $post_field
@@ -2727,7 +2727,7 @@  discard block
 block discarded – undo
2727 2727
                     array(
2728 2728
                         'valeur' => time(),
2729 2729
                         'type' => 'admin',
2730
-                        'intitule' => $post_field . '_time',
2730
+                        'intitule' => $post_field.'_time',
2731 2731
                     )
2732 2732
                 );
2733 2733
             }
@@ -2745,10 +2745,10 @@  discard block
 block discarded – undo
2745 2745
             if ($post_field === 'send_stats') {
2746 2746
                 // Check if previous time exists, if not them insert this value in DB
2747 2747
                 DB::query(
2748
-                    'SELECT * FROM ' . prefixTable('misc') . '
2748
+                    'SELECT * FROM '.prefixTable('misc').'
2749 2749
                     WHERE type = %s AND intitule = %s',
2750 2750
                     'admin',
2751
-                    $post_field . '_time'
2751
+                    $post_field.'_time'
2752 2752
                 );
2753 2753
                 $counter = DB::count();
2754 2754
                 if ($counter === 0) {
@@ -2757,7 +2757,7 @@  discard block
 block discarded – undo
2757 2757
                         array(
2758 2758
                             'valeur' => 0,
2759 2759
                             'type' => 'admin',
2760
-                            'intitule' => $post_field . '_time',
2760
+                            'intitule' => $post_field.'_time',
2761 2761
                         )
2762 2762
                     );
2763 2763
                 } else {
@@ -2777,13 +2777,13 @@  discard block
 block discarded – undo
2777 2777
         // special Cases
2778 2778
         if ($post_field === 'cpassman_url') {
2779 2779
             // update also jsUrl for CSFP protection
2780
-            $jsUrl = $post_value . '/includes/libraries/csrfp/js/csrfprotector.js';
2780
+            $jsUrl = $post_value.'/includes/libraries/csrfp/js/csrfprotector.js';
2781 2781
             $csrfp_file = '../includes/libraries/csrfp/libs/csrfp.config.php';
2782 2782
             $data = file_get_contents($csrfp_file);
2783 2783
             $posJsUrl = strpos($data, '"jsUrl" => "');
2784 2784
             $posEndLine = strpos($data, '",', $posJsUrl);
2785 2785
             $line = substr($data, $posJsUrl, ($posEndLine - $posJsUrl + 2));
2786
-            $newdata = str_replace($line, '"jsUrl" => "' . filter_var($jsUrl, FILTER_SANITIZE_STRING) . '",', $data);
2786
+            $newdata = str_replace($line, '"jsUrl" => "'.filter_var($jsUrl, FILTER_SANITIZE_STRING).'",', $data);
2787 2787
             file_put_contents($csrfp_file, $newdata);
2788 2788
         } elseif ($post_field === 'restricted_to_input' && (int) $post_value === 0) {
2789 2789
             DB::update(
@@ -2813,7 +2813,7 @@  discard block
 block discarded – undo
2813 2813
             $SETTINGS['cpassman_dir'],
2814 2814
             array(
2815 2815
                 'error' => false,
2816
-                'misc' => $counter . ' ; ' . $SETTINGS[$post_field],
2816
+                'misc' => $counter.' ; '.$SETTINGS[$post_field],
2817 2817
             ),
2818 2818
             'encode'
2819 2819
         );
@@ -2858,7 +2858,7 @@  discard block
 block discarded – undo
2858 2858
 
2859 2859
         // send statistics
2860 2860
         if (null !== $post_status) {
2861
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'send_stats');
2861
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'send_stats');
2862 2862
             $counter = DB::count();
2863 2863
             if ($counter === 0) {
2864 2864
                 DB::insert(
@@ -2890,7 +2890,7 @@  discard block
 block discarded – undo
2890 2890
 
2891 2891
         // send statistics items
2892 2892
         if (null !== $post_list) {
2893
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'send_statistics_items');
2893
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'send_statistics_items');
2894 2894
             $counter = DB::count();
2895 2895
             if ($counter === 0) {
2896 2896
                 DB::insert(
@@ -2938,7 +2938,7 @@  discard block
 block discarded – undo
2938 2938
             break;
2939 2939
         }
2940 2940
 
2941
-        if (DB::query("SHOW TABLES LIKE '" . prefixTable('sk_reencrypt_backup') . "'")) {
2941
+        if (DB::query("SHOW TABLES LIKE '".prefixTable('sk_reencrypt_backup')."'")) {
2942 2942
             if (DB::count() === 1) {
2943 2943
                 echo 1;
2944 2944
             } else {
@@ -2977,7 +2977,7 @@  discard block
 block discarded – undo
2977 2977
 
2978 2978
         $rows = DB::query(
2979 2979
             'SELECT id, title
2980
-                FROM ' . prefixTable('roles_title') . '
2980
+                FROM ' . prefixTable('roles_title').'
2981 2981
                 ORDER BY title ASC'
2982 2982
         );
2983 2983
         foreach ($rows as $record) {
Please login to merge, or discard this patch.
sources/identify.php 1 patch
Spacing   +114 added lines, -114 removed lines patch added patch discarded remove patch
@@ -44,16 +44,16 @@  discard block
 block discarded – undo
44 44
     throw new Exception("Error file '/includes/config/tp.config.php' not exists", 1);
45 45
 }
46 46
 
47
-if (! isset($SETTINGS['cpassman_dir']) || empty($SETTINGS['cpassman_dir']) === true || $SETTINGS['cpassman_dir'] === '.') {
47
+if (!isset($SETTINGS['cpassman_dir']) || empty($SETTINGS['cpassman_dir']) === true || $SETTINGS['cpassman_dir'] === '.') {
48 48
     $SETTINGS = [];
49 49
     $SETTINGS['cpassman_dir'] = '..';
50 50
 }
51 51
 
52 52
 // Load libraries
53
-require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
54
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
55
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
56
-include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
53
+require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
54
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
55
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
56
+include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
57 57
 $superGlobal = new protect\SuperGlobal\SuperGlobal();
58 58
 
59 59
 // Prepare POST variables
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 if (defined('DB_PASSWD_CLEAR') === false) {
67 67
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
68 68
 }
69
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
69
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
70 70
 if (defined('DB_PASSWD_CLEAR') === false) {
71 71
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
72 72
 }
@@ -88,12 +88,12 @@  discard block
 block discarded – undo
88 88
     defineComplexity();
89 89
 
90 90
     // Load superGlobals
91
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
91
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
92 92
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
93 93
 
94 94
     // If Debug then clean the files
95 95
     if (DEBUGLDAP === true) {
96
-        define('DEBUGLDAPFILE', $SETTINGS['path_to_files_folder'] . '/ldap.debug.txt');
96
+        define('DEBUGLDAPFILE', $SETTINGS['path_to_files_folder'].'/ldap.debug.txt');
97 97
         file_put_contents(DEBUGLDAPFILE, '');
98 98
     }
99 99
 
@@ -180,19 +180,19 @@  discard block
 block discarded – undo
180 180
     if (findTpConfigFile() === false) {
181 181
         throw new Exception("Error file '/includes/config/tp.config.php' not exists", 1);
182 182
     }
183
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
184
-    include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
185
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
183
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
184
+    include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
185
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
186 186
     
187 187
     header('Content-type: text/html; charset=utf-8');
188 188
     error_reporting(E_ERROR);
189 189
 
190 190
     // Load AntiXSS
191
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php';
191
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php';
192 192
     $antiXss = new voku\helper\AntiXSS();
193 193
 
194 194
     // Load superGlobals
195
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
195
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
196 196
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
197 197
 
198 198
     // Prepare GET variables
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
     $server['PHP_AUTH_PW'] = $superGlobal->get('PHP_AUTH_PW', 'SERVER');
207 207
 
208 208
     // connect to the server
209
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
209
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
210 210
     DB::$host = DB_HOST;
211 211
     DB::$user = DB_USER;
212 212
     DB::$password = defined('DB_PASSWD_CLEAR') === false ? defuseReturnDecrypted(DB_PASSWD, $SETTINGS) : DB_PASSWD_CLEAR;
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
     DB::$ssl = DB_SSL;
217 217
     DB::$connect_options = DB_CONNECT_OPTIONS;
218 218
     // User's language loading
219
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $sessionUserLanguage . '.php';
219
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$sessionUserLanguage.'.php';
220 220
     
221 221
     // decrypt and retreive data in JSON format
222 222
     if (empty($sessionKey) === true) {
@@ -232,18 +232,18 @@  discard block
 block discarded – undo
232 232
     }
233 233
 
234 234
     // Check if Duo auth is in progress and pass the pw and login back to the standard login process
235
-    if(
235
+    if (
236 236
         isKeyExistingAndEqual('duo', 1, $SETTINGS) === true
237 237
         && $dataReceived['user_2fa_selection'] === 'duo'
238
-        && $superGlobal->get('duo_status','SESSION') === 'IN_PROGRESS'
238
+        && $superGlobal->get('duo_status', 'SESSION') === 'IN_PROGRESS'
239 239
         && !empty($dataReceived['duo_state'])
240
-    ){
240
+    ) {
241 241
         $key = hash('sha256', $dataReceived['duo_state']);
242 242
         $iv = substr(hash('sha256', $dataReceived['duo_state']), 0, 16);
243
-        $duo_data_dec = openssl_decrypt(base64_decode($superGlobal->get('duo_data','SESSION')), 'AES-256-CBC', $key, 0, $iv);
243
+        $duo_data_dec = openssl_decrypt(base64_decode($superGlobal->get('duo_data', 'SESSION')), 'AES-256-CBC', $key, 0, $iv);
244 244
         // Clear the data from the Duo process to continue clean with the standard login process
245
-        $superGlobal->forget('duo_data','SESSION');
246
-        if($duo_data_dec === false){
245
+        $superGlobal->forget('duo_data', 'SESSION');
246
+        if ($duo_data_dec === false) {
247 247
             echo prepareExchangedData(
248 248
                 $SETTINGS['cpassman_dir'],
249 249
                 [
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
         $dataReceived['login'] = $duo_data['duo_login'];
260 260
     }
261 261
 
262
-    if(isset($dataReceived['pw']) === false || isset($dataReceived['login']) === false) {
262
+    if (isset($dataReceived['pw']) === false || isset($dataReceived['login']) === false) {
263 263
         echo json_encode([
264 264
             'data' => prepareExchangedData(
265 265
                 $SETTINGS['cpassman_dir'],
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
     if (isset($userLdap['user_info']) === true && $userLdap['user_info']['has_been_created'] === 1) {
327 327
         $userInfo = DB::queryfirstrow(
328 328
             'SELECT *
329
-            FROM ' . prefixTable('users') . '
329
+            FROM ' . prefixTable('users').'
330 330
             WHERE login = %s',
331 331
             $username
332 332
         );
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
         }
554 554
         // Append with roles from AD groups
555 555
         if (is_null($userInfo['roles_from_ad_groups']) === false) {
556
-            $userInfo['fonction_id'] = empty($userInfo['fonction_id'])  === true ? $userInfo['roles_from_ad_groups'] : $userInfo['fonction_id']. ';' . $userInfo['roles_from_ad_groups'];
556
+            $userInfo['fonction_id'] = empty($userInfo['fonction_id']) === true ? $userInfo['roles_from_ad_groups'] : $userInfo['fonction_id'].';'.$userInfo['roles_from_ad_groups'];
557 557
         }
558 558
         // store
559 559
         $superGlobal->put('fonction_id', $userInfo['fonction_id'], 'SESSION');
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
         if (count($superGlobal->get('user_roles', 'SESSION')) > 0) {
565 565
             $rolesList = DB::query(
566 566
                 'SELECT id, title, complexity
567
-                FROM ' . prefixTable('roles_title') . '
567
+                FROM ' . prefixTable('roles_title').'
568 568
                 WHERE id IN %li',
569 569
                 $superGlobal->get('user_roles', 'SESSION')
570 570
             );
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 
588 588
         // build complete array of roles
589 589
         $superGlobal->put('arr_roles_full', [], 'SESSION');
590
-        $rows = DB::query('SELECT id, title FROM ' . prefixTable('roles_title') . ' ORDER BY title ASC');
590
+        $rows = DB::query('SELECT id, title FROM '.prefixTable('roles_title').' ORDER BY title ASC');
591 591
         foreach ($rows as $record) {
592 592
             $superGlobal->put(
593 593
                 $record['id'],
@@ -654,10 +654,10 @@  discard block
 block discarded – undo
654 654
         $superGlobal->put('latest_items_tab', [], 'SESSION');
655 655
         $superGlobal->put('nb_roles', 0, 'SESSION');
656 656
         foreach ($superGlobal->get('latest_items', 'SESSION') as $item) {
657
-            if (! empty($item)) {
657
+            if (!empty($item)) {
658 658
                 $dataLastItems = DB::queryFirstRow(
659 659
                     'SELECT id,label,id_tree
660
-                    FROM ' . prefixTable('items') . '
660
+                    FROM ' . prefixTable('items').'
661 661
                     WHERE id=%i',
662 662
                     $item
663 663
                 );
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
                     [
667 667
                         'id' => $item,
668 668
                         'label' => $dataLastItems['label'],
669
-                        'url' => 'index.php?page=items&amp;group=' . $dataLastItems['id_tree'] . '&amp;id=' . $item,
669
+                        'url' => 'index.php?page=items&amp;group='.$dataLastItems['id_tree'].'&amp;id='.$item,
670 670
                     ],
671 671
                     'SESSION',
672 672
                     'latest_items_tab'
@@ -682,12 +682,12 @@  discard block
 block discarded – undo
682 682
         ) {
683 683
             // get all Admin users
684 684
             $receivers = '';
685
-            $rows = DB::query('SELECT email FROM ' . prefixTable('users') . " WHERE admin = %i and email != ''", 1);
685
+            $rows = DB::query('SELECT email FROM '.prefixTable('users')." WHERE admin = %i and email != ''", 1);
686 686
             foreach ($rows as $record) {
687 687
                 if (empty($receivers)) {
688 688
                     $receivers = $record['email'];
689 689
                 } else {
690
-                    $receivers = ',' . $record['email'];
690
+                    $receivers = ','.$record['email'];
691 691
                 }
692 692
             }
693 693
             // Add email to table
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
                             '#tp_time#',
704 704
                         ],
705 705
                         [
706
-                            ' ' . $superGlobal->get('login', 'SESSION') . ' (IP: ' . getClientIpServer() . ')',
706
+                            ' '.$superGlobal->get('login', 'SESSION').' (IP: '.getClientIpServer().')',
707 707
                             date($SETTINGS['date_format'], (int) $superGlobal->get('last_connection', 'SESSION')),
708 708
                             date($SETTINGS['time_format'], (int) $superGlobal->get('last_connection', 'SESSION')),
709 709
                         ],
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
 {
857 857
     $rows = DB::query(
858 858
         'SELECT date
859
-        FROM ' . prefixTable('log_system') . "
859
+        FROM ' . prefixTable('log_system')."
860 860
         WHERE field_1 = %s
861 861
         AND type = 'failed_auth'
862 862
         AND label = 'password_is_not_correct'
@@ -870,7 +870,7 @@  discard block
 block discarded – undo
870 870
         foreach ($rows as $record) {
871 871
             array_push(
872 872
                 $arrAttempts,
873
-                date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date'])
873
+                date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date'])
874 874
             );
875 875
         }
876 876
     }
@@ -924,7 +924,7 @@  discard block
 block discarded – undo
924 924
     $ldapConnection
925 925
 ) : bool
926 926
 {
927
-    include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
927
+    include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
928 928
 
929 929
     if ((int) $userInfoDisabled === 1) {
930 930
         return false;
@@ -1116,45 +1116,45 @@  discard block
 block discarded – undo
1116 1116
 function authenticateThroughAD(string $username, array $userInfo, string $passwordClear, array $SETTINGS): array
1117 1117
 {
1118 1118
     // Load expected libraries
1119
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Illuminate/Contracts/Auth/Authenticatable.php';
1120
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Illuminate/Contracts/Support/Arrayable.php';
1121
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/EnumeratesValues.php';
1122
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
1123
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/helpers.php';
1124
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php';
1125
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Contracts/Support/Jsonable.php';
1126
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Contracts/Support/Arrayable.php';
1127
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Enumerable.php';
1128
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Collection.php';
1129
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonTimeZone.php';
1130
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Units.php';
1131
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Week.php';
1132
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Timestamp.php';
1133
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Test.php';
1134
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/ObjectInitialisation.php';
1135
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Serialization.php';
1136
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/IntervalRounding.php';
1137
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Rounding.php';
1138
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Localization.php';
1139
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Options.php';
1140
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Cast.php';
1141
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mutability.php';
1142
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Modifiers.php';
1143
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mixin.php';
1144
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Macro.php';
1145
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Difference.php';
1146
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Creator.php';
1147
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Converter.php';
1148
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Comparison.php';
1149
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Boundaries.php';
1150
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Date.php';
1151
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonInterface.php';
1152
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Carbon.php';
1153
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php';
1154
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php';
1155
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php';
1156
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/HandlesConnection.php';
1157
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php';
1119
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Illuminate/Contracts/Auth/Authenticatable.php';
1120
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Illuminate/Contracts/Support/Arrayable.php';
1121
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/EnumeratesValues.php';
1122
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
1123
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/helpers.php';
1124
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php';
1125
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Contracts/Support/Jsonable.php';
1126
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Contracts/Support/Arrayable.php';
1127
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Enumerable.php';
1128
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Collection.php';
1129
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonTimeZone.php';
1130
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Units.php';
1131
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Week.php';
1132
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Timestamp.php';
1133
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Test.php';
1134
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/ObjectInitialisation.php';
1135
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Serialization.php';
1136
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/IntervalRounding.php';
1137
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Rounding.php';
1138
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Localization.php';
1139
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Options.php';
1140
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Cast.php';
1141
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mutability.php';
1142
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Modifiers.php';
1143
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mixin.php';
1144
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Macro.php';
1145
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Difference.php';
1146
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Creator.php';
1147
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Converter.php';
1148
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Comparison.php';
1149
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Boundaries.php';
1150
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Date.php';
1151
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonInterface.php';
1152
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Carbon.php';
1153
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php';
1154
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php';
1155
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php';
1156
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/HandlesConnection.php';
1157
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php';
1158 1158
     $ad = new SplClassLoader('LdapRecord', '../includes/libraries');
1159 1159
     $ad->register();
1160 1160
 
@@ -1191,7 +1191,7 @@  discard block
 block discarded – undo
1191 1191
         // Get user info from AD
1192 1192
         // We want to isolate attribute ldap_user_attribute
1193 1193
         $userADInfos = $connection->query()
1194
-            ->where((isset($SETTINGS['ldap_user_attribute']) ===true && empty($SETTINGS['ldap_user_attribute']) === false) ? strtolower($SETTINGS['ldap_user_attribute']) : 'distinguishedname', '=', $username)
1194
+            ->where((isset($SETTINGS['ldap_user_attribute']) === true && empty($SETTINGS['ldap_user_attribute']) === false) ? strtolower($SETTINGS['ldap_user_attribute']) : 'distinguishedname', '=', $username)
1195 1195
             ->firstOrFail();
1196 1196
 
1197 1197
         // Check shadowexpire attribute - if === 1 then user disabled
@@ -1225,7 +1225,7 @@  discard block
 block discarded – undo
1225 1225
         $error = $e->getDetailedError();
1226 1226
         return [
1227 1227
             'error' => true,
1228
-            'message' => langHdl('error').' : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage(),
1228
+            'message' => langHdl('error').' : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage(),
1229 1229
 
1230 1230
         ];
1231 1231
     }
@@ -1303,12 +1303,12 @@  discard block
 block discarded – undo
1303 1303
     if (isset($SETTINGS['enable_ad_users_with_ad_groups']) === true && (int) $SETTINGS['enable_ad_users_with_ad_groups'] === 1) {
1304 1304
         // Get user groups from AD
1305 1305
         $user_ad_groups = [];
1306
-        foreach($groups as $group) {
1306
+        foreach ($groups as $group) {
1307 1307
             //print_r($group);
1308 1308
             // get relation role id for AD group
1309 1309
             $role = DB::queryFirstRow(
1310 1310
                 'SELECT lgr.role_id
1311
-                FROM ' . prefixTable('ldap_groups_roles') . ' AS lgr
1311
+                FROM ' . prefixTable('ldap_groups_roles').' AS lgr
1312 1312
                 WHERE lgr.ldap_group_id = %i',
1313 1313
                 $group
1314 1314
             );
@@ -1358,7 +1358,7 @@  discard block
 block discarded – undo
1358 1358
 ): void
1359 1359
 {
1360 1360
     // load passwordLib library
1361
-    $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1361
+    $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries');
1362 1362
     $pwdlib->register();
1363 1363
     $pwdlib = new PasswordLib\PasswordLib();
1364 1364
     $hashedPassword = $pwdlib->createPasswordHash($passwordClear);
@@ -1411,7 +1411,7 @@  discard block
 block discarded – undo
1411 1411
 function yubicoMFACheck($dataReceived, string $userInfo, array $SETTINGS): array
1412 1412
 {
1413 1413
     // Load superGlobals
1414
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1414
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1415 1415
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1416 1416
     $sessionAdmin = $superGlobal->get('user_admin', 'SESSION');
1417 1417
     $sessionUrl = $superGlobal->get('initial_url', 'SESSION');
@@ -1450,7 +1450,7 @@  discard block
 block discarded – undo
1450 1450
     }
1451 1451
 
1452 1452
     // Now check yubico validity
1453
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/Yubico/Yubico.php';
1453
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/Yubico/Yubico.php';
1454 1454
     $yubi = new Auth_Yubico($yubico_user_id, $yubico_user_key);
1455 1455
     $auth = $yubi->verify($yubico_key);
1456 1456
     //, null, null, null, 60
@@ -1491,7 +1491,7 @@  discard block
 block discarded – undo
1491 1491
     $userKeys = generateUserKeys($passwordClear);
1492 1492
 
1493 1493
     // load passwordLib library
1494
-    $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1494
+    $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries');
1495 1495
     $pwdlib->register();
1496 1496
     $pwdlib = new PasswordLib\PasswordLib();
1497 1497
     $hashedPassword = $pwdlib->createPasswordHash($passwordClear);
@@ -1549,7 +1549,7 @@  discard block
 block discarded – undo
1549 1549
             ]
1550 1550
         );
1551 1551
         // Rebuild tree
1552
-        $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1552
+        $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
1553 1553
         $tree->register();
1554 1554
         $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
1555 1555
         $tree->rebuild();
@@ -1581,13 +1581,13 @@  discard block
 block discarded – undo
1581 1581
         && empty($dataReceived['GACode']) === false
1582 1582
     ) {
1583 1583
         // Load superGlobals
1584
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1584
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1585 1585
         $superGlobal = new protect\SuperGlobal\SuperGlobal();
1586 1586
         $sessionAdmin = $superGlobal->get('user_admin', 'SESSION');
1587 1587
         $sessionUrl = $superGlobal->get('initial_url', 'SESSION');
1588 1588
         $sessionPwdAttempts = $superGlobal->get('pwd_attempts', 'SESSION');
1589 1589
         // load library
1590
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php';
1590
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php';
1591 1591
         // create new instance
1592 1592
         $tfa = new Authentication\TwoFactorAuth\TwoFactorAuth($SETTINGS['ga_website_name']);
1593 1593
         // Init
@@ -1610,7 +1610,7 @@  discard block
 block discarded – undo
1610 1610
             $mfaMessage = langHdl('ga_flash_qr_and_login');
1611 1611
             // generate new QR
1612 1612
             $new_2fa_qr = $tfa->getQRCodeImageAsDataUri(
1613
-                'Teampass - ' . $username,
1613
+                'Teampass - '.$username,
1614 1614
                 $userInfo['ga']
1615 1615
             );
1616 1616
             // clear temporary code from DB
@@ -1623,7 +1623,7 @@  discard block
 block discarded – undo
1623 1623
                 $userInfo['id']
1624 1624
             );
1625 1625
             $firstTime = [
1626
-                'value' => '<img src="' . $new_2fa_qr . '">',
1626
+                'value' => '<img src="'.$new_2fa_qr.'">',
1627 1627
                 'user_admin' => isset($sessionAdmin) ? (int) $sessionAdmin : '',
1628 1628
                 'initial_url' => isset($sessionUrl) === true ? $sessionUrl : '',
1629 1629
                 'pwd_attempts' => (int) $sessionPwdAttempts,
@@ -1678,12 +1678,12 @@  discard block
 block discarded – undo
1678 1678
 ): array
1679 1679
 {
1680 1680
     // Load superGlobals
1681
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';            
1681
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';            
1682 1682
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1683 1683
 
1684 1684
     $sessionPwdAttempts = $superGlobal->get('pwd_attempts', 'SESSION');
1685
-    $saved_state = null !== $superGlobal->get('duo_state','SESSION') ? $superGlobal->get('duo_state','SESSION') : '';
1686
-    $duo_status = null !== $superGlobal->get('duo_status','SESSION') ? $superGlobal->get('duo_status','SESSION') : '';
1685
+    $saved_state = null !== $superGlobal->get('duo_state', 'SESSION') ? $superGlobal->get('duo_state', 'SESSION') : '';
1686
+    $duo_status = null !== $superGlobal->get('duo_status', 'SESSION') ? $superGlobal->get('duo_status', 'SESSION') : '';
1687 1687
 
1688 1688
     // Ensure state and login are set
1689 1689
     if (
@@ -1741,7 +1741,7 @@  discard block
 block discarded – undo
1741 1741
 ): array
1742 1742
 {
1743 1743
     // Load superGlobals
1744
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';            
1744
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';            
1745 1745
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1746 1746
 
1747 1747
     // load libraries
@@ -1787,7 +1787,7 @@  discard block
 block discarded – undo
1787 1787
         }*/
1788 1788
         return [
1789 1789
             'error' => true,
1790
-            'message' => $duo_error . langHdl('duo_error_check_config'),
1790
+            'message' => $duo_error.langHdl('duo_error_check_config'),
1791 1791
             'pwd_attempts' => (int) $sessionPwdAttempts,
1792 1792
             'debug_message' => $e->getMessage(),
1793 1793
             'proceedIdentification' => false,
@@ -1803,7 +1803,7 @@  discard block
 block discarded – undo
1803 1803
         } catch (Duo\DuoUniversal\DuoException $e) {
1804 1804
             return [
1805 1805
                 'error' => true,
1806
-                'message' => $duo_error . langHdl('duo_error_url'),
1806
+                'message' => $duo_error.langHdl('duo_error_url'),
1807 1807
                 'pwd_attempts' => (int) $sessionPwdAttempts,
1808 1808
                 'debug_message' => $e->getMessage(),
1809 1809
                 'proceedIdentification' => false,
@@ -1811,7 +1811,7 @@  discard block
 block discarded – undo
1811 1811
         }
1812 1812
         
1813 1813
         // Somethimes Duo return success but fail to return a URL, double check if the URL has been created
1814
-        if (!empty($duo_redirect_url) && isset($duo_redirect_url) && filter_var($duo_redirect_url,FILTER_SANITIZE_URL)) {
1814
+        if (!empty($duo_redirect_url) && isset($duo_redirect_url) && filter_var($duo_redirect_url, FILTER_SANITIZE_URL)) {
1815 1815
             // Since Duo Universal requires a redirect, let's store some info when the user get's back after completing the Duo prompt
1816 1816
             $key = hash('sha256', $duo_state);
1817 1817
             $iv = substr(hash('sha256', $duo_state), 0, 16);
@@ -1837,7 +1837,7 @@  discard block
 block discarded – undo
1837 1837
         } else {
1838 1838
             return [
1839 1839
                 'error' => true,
1840
-                'message' => $duo_error . langHdl('duo_error_url'),
1840
+                'message' => $duo_error.langHdl('duo_error_url'),
1841 1841
                 'pwd_attempts' => (int) $sessionPwdAttempts,
1842 1842
                 'proceedIdentification' => false,
1843 1843
             ];
@@ -1858,8 +1858,8 @@  discard block
 block discarded – undo
1858 1858
         // return the response (which should be the user name)
1859 1859
         if ($decoded_token['preferred_username'] === $username) {
1860 1860
             $superGlobal->put('duo_status', 'COMPLET', 'SESSION');
1861
-            $superGlobal->forget('duo_state','SESSION');
1862
-            $superGlobal->forget('duo_data','SESSION');
1861
+            $superGlobal->forget('duo_state', 'SESSION');
1862
+            $superGlobal->forget('duo_data', 'SESSION');
1863 1863
             unset($superGlobal);
1864 1864
 
1865 1865
             return [
@@ -1870,9 +1870,9 @@  discard block
 block discarded – undo
1870 1870
             ];
1871 1871
         } else {
1872 1872
             // Something wrong, username from the original Duo request is different than the one received now
1873
-            $superGlobal->forget('duo_status','SESSION');
1874
-            $superGlobal->forget('duo_state','SESSION');
1875
-            $superGlobal->forget('duo_data','SESSION');
1873
+            $superGlobal->forget('duo_status', 'SESSION');
1874
+            $superGlobal->forget('duo_state', 'SESSION');
1875
+            $superGlobal->forget('duo_data', 'SESSION');
1876 1876
             unset($superGlobal);
1877 1877
 
1878 1878
             return [
@@ -1884,9 +1884,9 @@  discard block
 block discarded – undo
1884 1884
         }
1885 1885
     }
1886 1886
     // If we are here something wrong
1887
-    $superGlobal->forget('duo_status','SESSION');
1888
-    $superGlobal->forget('duo_state','SESSION');
1889
-    $superGlobal->forget('duo_data','SESSION');
1887
+    $superGlobal->forget('duo_status', 'SESSION');
1888
+    $superGlobal->forget('duo_state', 'SESSION');
1889
+    $superGlobal->forget('duo_data', 'SESSION');
1890 1890
     unset($superGlobal);
1891 1891
     return [
1892 1892
         'error' => true,
@@ -1912,8 +1912,8 @@  discard block
 block discarded – undo
1912 1912
     // Set to false
1913 1913
     $userPasswordVerified = false;
1914 1914
     // load passwordLib library
1915
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1916
-    $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1915
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1916
+    $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries');
1917 1917
     $pwdlib->register();
1918 1918
     $pwdlib = new PasswordLib\PasswordLib();
1919 1919
     // Check if old encryption used
@@ -2046,8 +2046,8 @@  discard block
 block discarded – undo
2046 2046
     public function get_user_info($login, $enable_ad_user_auto_creation) {
2047 2047
         $data = DB::queryFirstRow(
2048 2048
             'SELECT u.*, a.value AS api_key
2049
-            FROM ' . prefixTable('users') . ' AS u
2050
-            LEFT JOIN ' . prefixTable('api') . ' AS a ON (u.id = a.user_id)
2049
+            FROM ' . prefixTable('users').' AS u
2050
+            LEFT JOIN ' . prefixTable('api').' AS a ON (u.id = a.user_id)
2051 2051
             WHERE login = %s',
2052 2052
             $login
2053 2053
         );
@@ -2067,7 +2067,7 @@  discard block
 block discarded – undo
2067 2067
         }*/
2068 2068
 
2069 2069
         // Prepare user roles (fonction_id + roles_from_ad_groups)
2070
-        $data['fonction_id'] = is_null($data['roles_from_ad_groups']) === true ? $data['fonction_id'] : (empty($data['roles_from_ad_groups']) === true ? $data['fonction_id'] : $data['fonction_id'] . ';' . $data['roles_from_ad_groups']);
2070
+        $data['fonction_id'] = is_null($data['roles_from_ad_groups']) === true ? $data['fonction_id'] : (empty($data['roles_from_ad_groups']) === true ? $data['fonction_id'] : $data['fonction_id'].';'.$data['roles_from_ad_groups']);
2071 2071
 
2072 2072
         return $data;
2073 2073
     }
@@ -2146,7 +2146,7 @@  discard block
 block discarded – undo
2146 2146
         $checks->get_is_too_much_attempts($sessionPwdAttempts);
2147 2147
     } catch (Exception $e) {
2148 2148
         // Load superGlobals
2149
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2149
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2150 2150
         $superGlobal = new protect\SuperGlobal\SuperGlobal();
2151 2151
         $superGlobal->put('next_possible_pwd_attempts', time() + 10, 'SESSION');
2152 2152
         $superGlobal->put('pwd_attempts', 0, 'SESSION');
@@ -2392,19 +2392,19 @@  discard block
 block discarded – undo
2392 2392
             if ($ret['error'] !== false) {
2393 2393
                 logEvents($SETTINGS, 'failed_auth', 'bad_duo_mfa', '', stripslashes($username), stripslashes($username));
2394 2394
                 // Load superGlobals
2395
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2395
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2396 2396
                 # Retrieve the previously stored state and username from the session
2397 2397
                 $superGlobal = new protect\SuperGlobal\SuperGlobal();
2398
-                $superGlobal->forget('duo_state','SESSION');
2399
-                $superGlobal->forget('duo_data','SESSION');
2400
-                $superGlobal->forget('duo_status','SESSION');
2398
+                $superGlobal->forget('duo_state', 'SESSION');
2399
+                $superGlobal->forget('duo_data', 'SESSION');
2400
+                $superGlobal->forget('duo_status', 'SESSION');
2401 2401
                 unset($superGlobal);
2402 2402
                 return [
2403 2403
                     'error' => true,
2404 2404
                     'mfaData' => $ret,
2405 2405
                     'mfaQRCodeInfos' => false,
2406 2406
                 ];
2407
-            } else if ($ret['duo_url_ready'] === true){
2407
+            } else if ($ret['duo_url_ready'] === true) {
2408 2408
                 return [
2409 2409
                     'error' => false,
2410 2410
                     'mfaData' => $ret,
Please login to merge, or discard this patch.