Passed
Push — wip_sessions ( 486c48...513a65 )
by Nils
05:00
created
sources/core.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -54,16 +54,16 @@  discard block
 block discarded – undo
54 54
 {
55 55
     // Load AntiXSS
56 56
     $antiXss = new AntiXSS();
57
-    if (! headers_sent()) {    //If headers not sent yet... then do php redirect
58
-        header('Location: ' . $antiXss->xss_clean($url));
57
+    if (!headers_sent()) {    //If headers not sent yet... then do php redirect
58
+        header('Location: '.$antiXss->xss_clean($url));
59 59
     }
60 60
 
61 61
     //If headers are sent... do java redirect... if java disabled, do html redirect.
62 62
     echo '<script type="text/javascript">';
63
-    echo 'window.location.href="' . $antiXss->xss_clean($url) . '";';
63
+    echo 'window.location.href="'.$antiXss->xss_clean($url).'";';
64 64
     echo '</script>';
65 65
     echo '<noscript>';
66
-    echo '<meta http-equiv="refresh" content="0;url=' . $antiXss->xss_clean($url) . '" />';
66
+    echo '<meta http-equiv="refresh" content="0;url='.$antiXss->xss_clean($url).'" />';
67 67
     echo '</noscript>';
68 68
 }
69 69
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     && isset($SETTINGS['enable_sts']) === true
90 90
     && (int) $SETTINGS['enable_sts'] === 1
91 91
 ) {
92
-    teampassRedirect('https://' . $server['http_host'] . $server['request_uri']);
92
+    teampassRedirect('https://'.$server['http_host'].$server['request_uri']);
93 93
 }
94 94
 
95 95
 // Load pwComplexity
@@ -110,11 +110,11 @@  discard block
 block discarded – undo
110 110
 // LOAD CPASSMAN SETTINGS
111 111
 if (
112 112
     isset($SETTINGS['cpassman_dir']) === true
113
-    && is_dir($SETTINGS['cpassman_dir'] . '/install') === true
113
+    && is_dir($SETTINGS['cpassman_dir'].'/install') === true
114 114
 ) {
115 115
     // Should we delete folder INSTALL?
116 116
     $row = DB::queryFirstRow(
117
-        'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type=%s AND intitule=%s',
117
+        'SELECT valeur FROM '.prefixTable('misc').' WHERE type=%s AND intitule=%s',
118 118
         'install',
119 119
         'clear_install_folder'
120 120
     );
@@ -132,11 +132,11 @@  discard block
 block discarded – undo
132 132
             if ($directories !== false) {
133 133
                 $files = array_diff($directories, ['.', '..']);
134 134
                 foreach ($files as $file) {
135
-                    if (is_dir($dir . '/' . $file)) {
136
-                        delTree($dir . '/' . $file);
135
+                    if (is_dir($dir.'/'.$file)) {
136
+                        delTree($dir.'/'.$file);
137 137
                     } else {
138 138
                         try {
139
-                            unlink($dir . '/' . $file);
139
+                            unlink($dir.'/'.$file);
140 140
                         } catch (Exception $e) {
141 141
                             // do nothing... php will ignore and continue
142 142
                         }
@@ -150,13 +150,13 @@  discard block
 block discarded – undo
150 150
             return false;
151 151
         }
152 152
 
153
-        if (is_dir($SETTINGS['cpassman_dir'] . '/install')) {
153
+        if (is_dir($SETTINGS['cpassman_dir'].'/install')) {
154 154
             // Set the permissions on the install directory and delete
155 155
             // is server Windows or Linux?
156 156
             if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
157
-                recursiveChmod($SETTINGS['cpassman_dir'] . '/install', 0755, 0440);
157
+                recursiveChmod($SETTINGS['cpassman_dir'].'/install', 0755, 0440);
158 158
             }
159
-            delTree($SETTINGS['cpassman_dir'] . '/install');
159
+            delTree($SETTINGS['cpassman_dir'].'/install');
160 160
         }
161 161
 
162 162
         // Delete temporary install table
@@ -174,10 +174,10 @@  discard block
 block discarded – undo
174 174
 // Load Languages stuff
175 175
 if (isset($languagesList) === false) {
176 176
     $languagesList = [];
177
-    $rows = DB::query('SELECT * FROM ' . prefixTable('languages') . ' GROUP BY name, label, code, flag, id ORDER BY name ASC');
177
+    $rows = DB::query('SELECT * FROM '.prefixTable('languages').' GROUP BY name, label, code, flag, id ORDER BY name ASC');
178 178
     foreach ($rows as $record) {
179 179
         array_push($languagesList, $record['name']);
180
-        if ($session->get('user-language') === $record['name'] ) {
180
+        if ($session->get('user-language') === $record['name']) {
181 181
             $session->set('user-language_flag', $record['flag']);
182 182
             $session->set('user-language_code', $record['code']);
183 183
             //$session->set('user-language_label', $record['label']);
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 // CHECK IF SESSION EXISTS AND IF SESSION IS VALID
236 236
 if (empty($session->get('user-session_duration')) === false) {
237 237
     $dataSession = DB::queryFirstRow(
238
-        'SELECT key_tempo FROM ' . prefixTable('users') . ' WHERE id=%i',
238
+        'SELECT key_tempo FROM '.prefixTable('users').' WHERE id=%i',
239 239
         $session->get('user-id')
240 240
     );
241 241
 } else {
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
     && (null !== $session->get('user-admin') && $session->get('user-admin') === 1)
300 300
 ) {
301 301
     $row = DB::queryFirstRow(
302
-        'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type=%s_type AND intitule=%s_intitule',
302
+        'SELECT valeur FROM '.prefixTable('misc').' WHERE type=%s_type AND intitule=%s_intitule',
303 303
         [
304 304
             'type' => 'admin',
305 305
             'intitule' => 'teampass_version',
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 
341 341
         syslog(
342 342
             LOG_WARNING,
343
-            'Unlog user: ' . date('Y/m/d H:i:s') . " {$server['remote_addr']} ({$server['http_user_agent']})"
343
+            'Unlog user: '.date('Y/m/d H:i:s')." {$server['remote_addr']} ({$server['http_user_agent']})"
344 344
         );
345 345
         // erase session table
346 346
         $_SESSION = [];
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 if (null !== $session->get('user-id') && empty($session->get('user-id')) === false) {
397 397
     // query on user
398 398
     $data = DB::queryfirstrow(
399
-        'SELECT login, admin, gestionnaire, can_manage_all_users, groupes_visibles, groupes_interdits, fonction_id, last_connexion, roles_from_ad_groups FROM ' . prefixTable('users') . ' WHERE id=%i',
399
+        'SELECT login, admin, gestionnaire, can_manage_all_users, groupes_visibles, groupes_interdits, fonction_id, last_connexion, roles_from_ad_groups FROM '.prefixTable('users').' WHERE id=%i',
400 400
         $session->get('user-id')
401 401
     );
402 402
     //Check if user has been deleted or unlogged
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
             $data['groupes_visibles'],
444 444
             $data['groupes_interdits'],
445 445
             $data['admin'],
446
-            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']),
446
+            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']),
447 447
             $SETTINGS
448 448
         );
449 449
         if (null !== $session->get('user-can_create_root_folder') && (int) $session->get('user-can_create_root_folder') === 1) {
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
     $session->set('system-item_fields', []);
479 479
     $rows = DB::query(
480 480
         'SELECT *
481
-            FROM ' . prefixTable('categories') . '
481
+            FROM ' . prefixTable('categories').'
482 482
             WHERE level=%i',
483 483
         '0'
484 484
     );
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
         // get each field
488 488
         $rows2 = DB::query(
489 489
             'SELECT *
490
-            FROM ' . prefixTable('categories') . '
490
+            FROM ' . prefixTable('categories').'
491 491
             WHERE parent_id=%i
492 492
             ORDER BY `order` ASC',
493 493
             $record['id']
@@ -574,5 +574,5 @@  discard block
 block discarded – undo
574 574
 }
575 575
 
576 576
 /* CHECK NUMBER OF USER ONLINE */
577
-DB::query('SELECT * FROM ' . prefixTable('users') . ' WHERE timestamp>=%i', time() - 600);
577
+DB::query('SELECT * FROM '.prefixTable('users').' WHERE timestamp>=%i', time() - 600);
578 578
 $session->set('system-nb_users_online', DB::count());
Please login to merge, or discard this patch.
sources/main.functions.php 1 patch
Spacing   +149 added lines, -152 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
 // Load config if $SETTINGS not defined
52 52
 if (isset($SETTINGS['cpassman_dir']) === false || empty($SETTINGS['cpassman_dir']) === true) {
53
-    include_once __DIR__ . '/../includes/config/tp.config.php';
53
+    include_once __DIR__.'/../includes/config/tp.config.php';
54 54
 }
55 55
 
56 56
 header('Content-type: text/html; charset=utf-8');
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
  */
220 220
 function trimElement($chaine, string $element): string
221 221
 {
222
-    if (! empty($chaine)) {
222
+    if (!empty($chaine)) {
223 223
         if (is_array($chaine) === true) {
224 224
             $chaine = implode(';', $chaine);
225 225
         }
@@ -267,8 +267,8 @@  discard block
 block discarded – undo
267 267
  */
268 268
 function db_error_handler(array $params): void
269 269
 {
270
-    echo 'Error: ' . $params['error'] . "<br>\n";
271
-    echo 'Query: ' . $params['query'] . "<br>\n";
270
+    echo 'Error: '.$params['error']."<br>\n";
271
+    echo 'Query: '.$params['query']."<br>\n";
272 272
     throw new Exception('Error - Query', 1);
273 273
 }
274 274
 
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
     $globalsVisibleFolders = $session->get('user-accessible_folders');
349 349
     $globalsPersonalVisibleFolders = $session->get('user-personal_visible_folders');
350 350
     // Get list of Folders
351
-    $rows = DB::query('SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', 0);
351
+    $rows = DB::query('SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', 0);
352 352
     foreach ($rows as $record) {
353 353
         array_push($groupesVisibles, $record['id']);
354 354
     }
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
     }
368 368
     // Get ID of personal folder
369 369
     $persfld = DB::queryfirstrow(
370
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE title = %s',
370
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE title = %s',
371 371
         $globalsUserId
372 372
     );
373 373
     if (empty($persfld['id']) === false) {
@@ -387,20 +387,20 @@  discard block
 block discarded – undo
387 387
     // get complete list of ROLES
388 388
     $tmp = explode(';', $idFonctions);
389 389
     $rows = DB::query(
390
-        'SELECT * FROM ' . prefixTable('roles_title') . '
390
+        'SELECT * FROM '.prefixTable('roles_title').'
391 391
         ORDER BY title ASC'
392 392
     );
393 393
     foreach ($rows as $record) {
394
-        if (! empty($record['id']) && ! in_array($record['id'], $tmp)) {
394
+        if (!empty($record['id']) && !in_array($record['id'], $tmp)) {
395 395
             array_push($tmp, $record['id']);
396 396
         }
397 397
     }
398 398
     $session->set('user-roles', implode(';', $tmp));
399 399
     $session->set('user-admin', 1);
400 400
     // Check if admin has created Folders and Roles
401
-    DB::query('SELECT * FROM ' . prefixTable('nested_tree') . '');
401
+    DB::query('SELECT * FROM '.prefixTable('nested_tree').'');
402 402
     $session->set('user-nb_folders', DB::count());
403
-    DB::query('SELECT * FROM ' . prefixTable('roles_title'));
403
+    DB::query('SELECT * FROM '.prefixTable('roles_title'));
404 404
     $session->set('user-nb_roles', DB::count());
405 405
 
406 406
     return true;
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
     // Does this user is allowed to see other items
484 484
     $inc = 0;
485 485
     $rows = DB::query(
486
-        'SELECT id, id_tree FROM ' . prefixTable('items') . '
486
+        'SELECT id, id_tree FROM '.prefixTable('items').'
487 487
             WHERE restricted_to LIKE %ss AND inactif = %s'.
488 488
             (count($allowedFolders) > 0 ? ' AND id_tree NOT IN ('.implode(',', $allowedFolders).')' : ''),
489 489
         $globalsUserId,
@@ -500,8 +500,8 @@  discard block
 block discarded – undo
500 500
     // Check for the users roles if some specific rights exist on items
501 501
     $rows = DB::query(
502 502
         'SELECT i.id_tree, r.item_id
503
-        FROM ' . prefixTable('items') . ' as i
504
-        INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (r.item_id=i.id)
503
+        FROM ' . prefixTable('items').' as i
504
+        INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (r.item_id=i.id)
505 505
         WHERE i.id_tree <> "" '.
506 506
         (count($userRoles) > 0 ? 'AND r.role_id IN %li ' : '').
507 507
         'ORDER BY i.id_tree ASC',
@@ -555,16 +555,16 @@  discard block
 block discarded – undo
555 555
         ), SORT_NUMERIC)
556 556
     );
557 557
     // Folders and Roles numbers
558
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('nested_tree') . '');
558
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('nested_tree').'');
559 559
     $session->set('user-nb_folders', DB::count());
560
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('roles_title'));
560
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('roles_title'));
561 561
     $session->set('user-nb_roles', DB::count());
562 562
     // check if change proposals on User's items
563 563
     if (isset($SETTINGS['enable_suggestion']) === true && (int) $SETTINGS['enable_suggestion'] === 1) {
564 564
         $countNewItems = DB::query(
565 565
             'SELECT COUNT(*)
566
-            FROM ' . prefixTable('items_change') . ' AS c
567
-            LEFT JOIN ' . prefixTable('log_items') . ' AS i ON (c.item_id = i.id_item)
566
+            FROM ' . prefixTable('items_change').' AS c
567
+            LEFT JOIN ' . prefixTable('log_items').' AS i ON (c.item_id = i.id_item)
568 568
             WHERE i.action = %s AND i.id_user = %i',
569 569
             'at_creation',
570 570
             $globalsUserId
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
 {
592 592
     $rows = DB::query(
593 593
         'SELECT *
594
-        FROM ' . prefixTable('roles_values') . '
594
+        FROM ' . prefixTable('roles_values').'
595 595
         WHERE type IN %ls'.(count($userRoles) > 0 ? ' AND role_id IN %li' : ''),
596 596
         ['W', 'ND', 'NE', 'NDNE', 'R'],
597 597
         $userRoles,
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
     ) {
659 659
         $persoFld = DB::queryfirstrow(
660 660
             'SELECT id
661
-            FROM ' . prefixTable('nested_tree') . '
661
+            FROM ' . prefixTable('nested_tree').'
662 662
             WHERE title = %s AND personal_folder = %i'.
663 663
             (count($allowedFolders) > 0 ? ' AND id NOT IN ('.implode(',', $allowedFolders).')' : ''),
664 664
             $globalsUserId,
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
     }
692 692
     $persoFlds = DB::query(
693 693
         'SELECT id
694
-        FROM ' . prefixTable('nested_tree') . '
694
+        FROM ' . prefixTable('nested_tree').'
695 695
         WHERE %l',
696 696
         $where
697 697
     );
@@ -759,12 +759,12 @@  discard block
 block discarded – undo
759 759
     //Load Tree
760 760
     $tree = new NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
761 761
     // truncate table
762
-    DB::query('TRUNCATE TABLE ' . prefixTable('cache'));
762
+    DB::query('TRUNCATE TABLE '.prefixTable('cache'));
763 763
     // reload date
764 764
     $rows = DB::query(
765 765
         'SELECT *
766
-        FROM ' . prefixTable('items') . ' as i
767
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
766
+        FROM ' . prefixTable('items').' as i
767
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
768 768
         AND l.action = %s
769 769
         AND i.inactif = %i',
770 770
         'at_creation',
@@ -776,18 +776,18 @@  discard block
 block discarded – undo
776 776
             $tags = '';
777 777
             $itemTags = DB::query(
778 778
                 'SELECT tag
779
-                FROM ' . prefixTable('tags') . '
779
+                FROM ' . prefixTable('tags').'
780 780
                 WHERE item_id = %i AND tag != ""',
781 781
                 $record['id']
782 782
             );
783 783
             foreach ($itemTags as $itemTag) {
784
-                $tags .= $itemTag['tag'] . ' ';
784
+                $tags .= $itemTag['tag'].' ';
785 785
             }
786 786
 
787 787
             // Get renewal period
788 788
             $resNT = DB::queryfirstrow(
789 789
                 'SELECT renewal_period
790
-                FROM ' . prefixTable('nested_tree') . '
790
+                FROM ' . prefixTable('nested_tree').'
791 791
                 WHERE id = %i',
792 792
                 $record['id_tree']
793 793
             );
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
                     // Is this a User id?
801 801
                     $user = DB::queryfirstrow(
802 802
                         'SELECT id, login
803
-                        FROM ' . prefixTable('users') . '
803
+                        FROM ' . prefixTable('users').'
804 804
                         WHERE id = %i',
805 805
                         $elem->title
806 806
                     );
@@ -818,11 +818,11 @@  discard block
 block discarded – undo
818 818
                     'id' => $record['id'],
819 819
                     'label' => $record['label'],
820 820
                     'description' => $record['description'] ?? '',
821
-                    'url' => isset($record['url']) && ! empty($record['url']) ? $record['url'] : '0',
821
+                    'url' => isset($record['url']) && !empty($record['url']) ? $record['url'] : '0',
822 822
                     'tags' => $tags,
823 823
                     'id_tree' => $record['id_tree'],
824 824
                     'perso' => $record['perso'],
825
-                    'restricted_to' => isset($record['restricted_to']) && ! empty($record['restricted_to']) ? $record['restricted_to'] : '0',
825
+                    'restricted_to' => isset($record['restricted_to']) && !empty($record['restricted_to']) ? $record['restricted_to'] : '0',
826 826
                     'login' => $record['login'] ?? '',
827 827
                     'folder' => implode(' > ', $folder),
828 828
                     'author' => $record['id_user'],
@@ -851,7 +851,7 @@  discard block
 block discarded – undo
851 851
     // get new value from db
852 852
     $data = DB::queryfirstrow(
853 853
         'SELECT label, description, id_tree, perso, restricted_to, login, url
854
-        FROM ' . prefixTable('items') . '
854
+        FROM ' . prefixTable('items').'
855 855
         WHERE id=%i',
856 856
         $ident
857 857
     );
@@ -859,12 +859,12 @@  discard block
 block discarded – undo
859 859
     $tags = '';
860 860
     $itemTags = DB::query(
861 861
         'SELECT tag
862
-            FROM ' . prefixTable('tags') . '
862
+            FROM ' . prefixTable('tags').'
863 863
             WHERE item_id = %i AND tag != ""',
864 864
         $ident
865 865
     );
866 866
     foreach ($itemTags as $itemTag) {
867
-        $tags .= $itemTag['tag'] . ' ';
867
+        $tags .= $itemTag['tag'].' ';
868 868
     }
869 869
     // form id_tree to full foldername
870 870
     $folder = [];
@@ -875,7 +875,7 @@  discard block
 block discarded – undo
875 875
             // Is this a User id?
876 876
             $user = DB::queryfirstrow(
877 877
                 'SELECT id, login
878
-                FROM ' . prefixTable('users') . '
878
+                FROM ' . prefixTable('users').'
879 879
                 WHERE id = %i',
880 880
                 $elem->title
881 881
             );
@@ -893,10 +893,10 @@  discard block
 block discarded – undo
893 893
             'label' => $data['label'],
894 894
             'description' => $data['description'],
895 895
             'tags' => $tags,
896
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
896
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
897 897
             'id_tree' => $data['id_tree'],
898 898
             'perso' => $data['perso'],
899
-            'restricted_to' => isset($data['restricted_to']) && ! empty($data['restricted_to']) ? $data['restricted_to'] : '0',
899
+            'restricted_to' => isset($data['restricted_to']) && !empty($data['restricted_to']) ? $data['restricted_to'] : '0',
900 900
             'login' => $data['login'] ?? '',
901 901
             'folder' => implode(' » ', $folder),
902 902
             'author' => $session->get('user-id'),
@@ -926,8 +926,8 @@  discard block
 block discarded – undo
926 926
     // get new value from db
927 927
     $data = DB::queryFirstRow(
928 928
         'SELECT i.label, i.description, i.id_tree as id_tree, i.perso, i.restricted_to, i.id, i.login, i.url, l.date
929
-        FROM ' . prefixTable('items') . ' as i
930
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
929
+        FROM ' . prefixTable('items').' as i
930
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
931 931
         WHERE i.id = %i
932 932
         AND l.action = %s',
933 933
         $ident,
@@ -937,12 +937,12 @@  discard block
 block discarded – undo
937 937
     $tags = '';
938 938
     $itemTags = DB::query(
939 939
         'SELECT tag
940
-            FROM ' . prefixTable('tags') . '
940
+            FROM ' . prefixTable('tags').'
941 941
             WHERE item_id = %i AND tag != ""',
942 942
         $ident
943 943
     );
944 944
     foreach ($itemTags as $itemTag) {
945
-        $tags .= $itemTag['tag'] . ' ';
945
+        $tags .= $itemTag['tag'].' ';
946 946
     }
947 947
     // form id_tree to full foldername
948 948
     $folder = [];
@@ -953,7 +953,7 @@  discard block
 block discarded – undo
953 953
             // Is this a User id?
954 954
             $user = DB::queryfirstrow(
955 955
                 'SELECT id, login
956
-                FROM ' . prefixTable('users') . '
956
+                FROM ' . prefixTable('users').'
957 957
                 WHERE id = %i',
958 958
                 $elem->title
959 959
             );
@@ -972,7 +972,7 @@  discard block
 block discarded – undo
972 972
             'label' => $data['label'],
973 973
             'description' => $data['description'],
974 974
             'tags' => isset($tags) && empty($tags) === false ? $tags : 'None',
975
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
975
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
976 976
             'id_tree' => $data['id_tree'],
977 977
             'perso' => isset($data['perso']) && empty($data['perso']) === false && $data['perso'] !== 'None' ? $data['perso'] : '0',
978 978
             'restricted_to' => isset($data['restricted_to']) && empty($data['restricted_to']) === false ? $data['restricted_to'] : '0',
@@ -994,52 +994,52 @@  discard block
 block discarded – undo
994 994
 function getStatisticsData(array $SETTINGS): array
995 995
 {
996 996
     DB::query(
997
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
997
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
998 998
         0
999 999
     );
1000 1000
     $counter_folders = DB::count();
1001 1001
     DB::query(
1002
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
1002
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
1003 1003
         1
1004 1004
     );
1005 1005
     $counter_folders_perso = DB::count();
1006 1006
     DB::query(
1007
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
1007
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
1008 1008
         0
1009 1009
     );
1010 1010
     $counter_items = DB::count();
1011 1011
         DB::query(
1012
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
1012
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
1013 1013
         1
1014 1014
     );
1015 1015
     $counter_items_perso = DB::count();
1016 1016
         DB::query(
1017
-        'SELECT id FROM ' . prefixTable('users') . ''
1017
+        'SELECT id FROM '.prefixTable('users').''
1018 1018
     );
1019 1019
     $counter_users = DB::count();
1020 1020
         DB::query(
1021
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE admin = %i',
1021
+        'SELECT id FROM '.prefixTable('users').' WHERE admin = %i',
1022 1022
         1
1023 1023
     );
1024 1024
     $admins = DB::count();
1025 1025
     DB::query(
1026
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE gestionnaire = %i',
1026
+        'SELECT id FROM '.prefixTable('users').' WHERE gestionnaire = %i',
1027 1027
         1
1028 1028
     );
1029 1029
     $managers = DB::count();
1030 1030
     DB::query(
1031
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE read_only = %i',
1031
+        'SELECT id FROM '.prefixTable('users').' WHERE read_only = %i',
1032 1032
         1
1033 1033
     );
1034 1034
     $readOnly = DB::count();
1035 1035
     // list the languages
1036 1036
     $usedLang = [];
1037 1037
     $tp_languages = DB::query(
1038
-        'SELECT name FROM ' . prefixTable('languages')
1038
+        'SELECT name FROM '.prefixTable('languages')
1039 1039
     );
1040 1040
     foreach ($tp_languages as $tp_language) {
1041 1041
         DB::query(
1042
-            'SELECT * FROM ' . prefixTable('users') . ' WHERE user_language = %s',
1042
+            'SELECT * FROM '.prefixTable('users').' WHERE user_language = %s',
1043 1043
             $tp_language['name']
1044 1044
         );
1045 1045
         $usedLang[$tp_language['name']] = round((DB::count() * 100 / $counter_users), 0);
@@ -1048,12 +1048,12 @@  discard block
 block discarded – undo
1048 1048
     // get list of ips
1049 1049
     $usedIp = [];
1050 1050
     $tp_ips = DB::query(
1051
-        'SELECT user_ip FROM ' . prefixTable('users')
1051
+        'SELECT user_ip FROM '.prefixTable('users')
1052 1052
     );
1053 1053
     foreach ($tp_ips as $ip) {
1054 1054
         if (array_key_exists($ip['user_ip'], $usedIp)) {
1055 1055
             $usedIp[$ip['user_ip']] += $usedIp[$ip['user_ip']];
1056
-        } elseif (! empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1056
+        } elseif (!empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1057 1057
             $usedIp[$ip['user_ip']] = 1;
1058 1058
         }
1059 1059
     }
@@ -1206,7 +1206,7 @@  discard block
 block discarded – undo
1206 1206
 {
1207 1207
     // Load PHPMailer
1208 1208
     $mail = new PHPMailer(true);
1209
-    $languageDir = $SETTINGS['cpassman_dir'] . '/vendor/phpmailer/phpmailer/language/';
1209
+    $languageDir = $SETTINGS['cpassman_dir'].'/vendor/phpmailer/phpmailer/language/';
1210 1210
 
1211 1211
     try {
1212 1212
         // Set language and SMTPDebug
@@ -1357,7 +1357,7 @@  discard block
 block discarded – undo
1357 1357
         <table width="600" cellpadding="0" cellspacing="0" border="0" class="container" bgcolor="#ffffff" style="border-spacing: 0; border-bottom: 1px solid #e0e0e0; box-shadow: 0 0 3px #ddd; color: #434343; font-family: Helvetica, Verdana, sans-serif;">
1358 1358
         <tr><td class="container-padding" bgcolor="#ffffff" style="border-collapse: collapse; border-left: 1px solid #e0e0e0; background-color: #ffffff; padding-left: 30px; padding-right: 30px;">
1359 1359
         <br><div style="float:right;">' .
1360
-        $textMail .
1360
+        $textMail.
1361 1361
         '<br><br></td></tr></table>
1362 1362
     </td></tr></table>
1363 1363
     <br></body></html>';
@@ -1370,7 +1370,7 @@  discard block
 block discarded – undo
1370 1370
  */
1371 1371
 function generateKey(): string
1372 1372
 {
1373
-    return substr(md5(rand() . rand()), 0, 15);
1373
+    return substr(md5(rand().rand()), 0, 15);
1374 1374
 }
1375 1375
 
1376 1376
 /**
@@ -1448,7 +1448,7 @@  discard block
 block discarded – undo
1448 1448
 {
1449 1449
     array_walk_recursive(
1450 1450
         $array,
1451
-        static function (&$item): void {
1451
+        static function(&$item): void {
1452 1452
             if (mb_detect_encoding((string) $item, 'utf-8', true) === false) {
1453 1453
                 $item = mb_convert_encoding($item, 'ISO-8859-1', 'UTF-8');
1454 1454
             }
@@ -1475,7 +1475,7 @@  discard block
 block discarded – undo
1475 1475
         //$session->set('key', $cookieValue);
1476 1476
         //error_log('DEBUG : Réinitialisation de la clé de session ' . $session->get('key'));
1477 1477
     }
1478
-    error_log(strtoupper($type).' - Valeur de la clé de session ' . $session->get('key')." --- et la valeur du COOKIE : ".$cookieValue);
1478
+    error_log(strtoupper($type).' - Valeur de la clé de session '.$session->get('key')." --- et la valeur du COOKIE : ".$cookieValue);
1479 1479
     // Perform
1480 1480
     if ($type === 'encode' && is_array($data) === true) {
1481 1481
         // Now encode
@@ -1547,7 +1547,7 @@  discard block
 block discarded – undo
1547 1547
  */
1548 1548
 function prefixTable(string $table): string
1549 1549
 {
1550
-    $safeTable = htmlspecialchars(DB_PREFIX . $table);
1550
+    $safeTable = htmlspecialchars(DB_PREFIX.$table);
1551 1551
     if (empty($safeTable) === false) {
1552 1552
         // sanitize string
1553 1553
         return $safeTable;
@@ -1611,7 +1611,7 @@  discard block
 block discarded – undo
1611 1611
 function send_syslog($message, $host, $port, $component = 'teampass'): void
1612 1612
 {
1613 1613
     $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
1614
-    $syslog_message = '<123>' . date('M d H:i:s ') . $component . ': ' . $message;
1614
+    $syslog_message = '<123>'.date('M d H:i:s ').$component.': '.$message;
1615 1615
     socket_sendto($sock, (string) $syslog_message, strlen($syslog_message), 0, (string) $host, (int) $port);
1616 1616
     socket_close($sock);
1617 1617
 }
@@ -1658,14 +1658,14 @@  discard block
 block discarded – undo
1658 1658
     if (isset($SETTINGS['syslog_enable']) === true && (int) $SETTINGS['syslog_enable'] === 1) {
1659 1659
         if ($type === 'user_mngt') {
1660 1660
             send_syslog(
1661
-                'action=' . str_replace('at_', '', $label) . ' attribute=user user=' . $who . ' userid="' . $login . '" change="' . $field_1 . '" ',
1661
+                'action='.str_replace('at_', '', $label).' attribute=user user='.$who.' userid="'.$login.'" change="'.$field_1.'" ',
1662 1662
                 $SETTINGS['syslog_host'],
1663 1663
                 $SETTINGS['syslog_port'],
1664 1664
                 'teampass'
1665 1665
             );
1666 1666
         } else {
1667 1667
             send_syslog(
1668
-                'action=' . $type . ' attribute=' . $label . ' user=' . $who . ' userid="' . $login . '" ',
1668
+                'action='.$type.' attribute='.$label.' user='.$who.' userid="'.$login.'" ',
1669 1669
                 $SETTINGS['syslog_host'],
1670 1670
                 $SETTINGS['syslog_port'],
1671 1671
                 'teampass'
@@ -1739,7 +1739,7 @@  discard block
 block discarded – undo
1739 1739
         if (empty($item_label) === true) {
1740 1740
             $dataItem = DB::queryfirstrow(
1741 1741
                 'SELECT id, id_tree, label
1742
-                FROM ' . prefixTable('items') . '
1742
+                FROM ' . prefixTable('items').'
1743 1743
                 WHERE id = %i',
1744 1744
                 $item_id
1745 1745
             );
@@ -1747,11 +1747,11 @@  discard block
 block discarded – undo
1747 1747
         }
1748 1748
 
1749 1749
         send_syslog(
1750
-            'action=' . str_replace('at_', '', $action) .
1751
-                ' attribute=' . str_replace('at_', '', $attribute[0]) .
1752
-                ' itemno=' . $item_id .
1753
-                ' user=' . is_null($login) === true ? '' : addslashes((string) $login) .
1754
-                ' itemname="' . addslashes($item_label) . '"',
1750
+            'action='.str_replace('at_', '', $action).
1751
+                ' attribute='.str_replace('at_', '', $attribute[0]).
1752
+                ' itemno='.$item_id.
1753
+                ' user='.is_null($login) === true ? '' : addslashes((string) $login).
1754
+                ' itemname="'.addslashes($item_label).'"',
1755 1755
             $SETTINGS['syslog_host'],
1756 1756
             $SETTINGS['syslog_port'],
1757 1757
             'teampass'
@@ -1783,8 +1783,8 @@  discard block
 block discarded – undo
1783 1783
     $notification = DB::queryOneColumn(
1784 1784
         'email',
1785 1785
         'SELECT *
1786
-        FROM ' . prefixTable('notification') . ' AS n
1787
-        INNER JOIN ' . prefixTable('users') . ' AS u ON (n.user_id = u.id)
1786
+        FROM ' . prefixTable('notification').' AS n
1787
+        INNER JOIN ' . prefixTable('users').' AS u ON (n.user_id = u.id)
1788 1788
         WHERE n.item_id = %i AND n.user_id != %i',
1789 1789
         $item_id,
1790 1790
         $globalsUserId
@@ -1795,7 +1795,7 @@  discard block
 block discarded – undo
1795 1795
         // Get list of changes
1796 1796
         $htmlChanges = '<ul>';
1797 1797
         foreach ($changes as $change) {
1798
-            $htmlChanges .= '<li>' . $change . '</li>';
1798
+            $htmlChanges .= '<li>'.$change.'</li>';
1799 1799
         }
1800 1800
         $htmlChanges .= '</ul>';
1801 1801
         // send email
@@ -1832,15 +1832,15 @@  discard block
 block discarded – undo
1832 1832
     $path = '';
1833 1833
     foreach ($arbo as $elem) {
1834 1834
         if (empty($path) === true) {
1835
-            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' ';
1835
+            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' ';
1836 1836
         } else {
1837
-            $path .= '&#8594; ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1837
+            $path .= '&#8594; '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1838 1838
         }
1839 1839
     }
1840 1840
 
1841 1841
     // Build text to show user
1842 1842
     if (empty($label) === false) {
1843
-        return empty($path) === true ? addslashes($label) : addslashes($label) . ' (' . $path . ')';
1843
+        return empty($path) === true ? addslashes($label) : addslashes($label).' ('.$path.')';
1844 1844
     }
1845 1845
     return empty($path) === true ? '' : $path;
1846 1846
 }
@@ -1897,7 +1897,7 @@  discard block
 block discarded – undo
1897 1897
  */
1898 1898
 function handleConfigFile($action, $SETTINGS, $field = null, $value = null)
1899 1899
 {
1900
-    $tp_config_file = $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php';
1900
+    $tp_config_file = $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php';
1901 1901
 
1902 1902
     // Load class DB
1903 1903
     loadClasses('DB');
@@ -1905,8 +1905,8 @@  discard block
 block discarded – undo
1905 1905
     if (file_exists($tp_config_file) === false || $action === 'rebuild') {
1906 1906
         // perform a copy
1907 1907
         if (file_exists($tp_config_file)) {
1908
-            if (! copy($tp_config_file, $tp_config_file . '.' . date('Y_m_d_His', time()))) {
1909
-                return "ERROR: Could not copy file '" . $tp_config_file . "'";
1908
+            if (!copy($tp_config_file, $tp_config_file.'.'.date('Y_m_d_His', time()))) {
1909
+                return "ERROR: Could not copy file '".$tp_config_file."'";
1910 1910
             }
1911 1911
         }
1912 1912
 
@@ -1916,11 +1916,11 @@  discard block
 block discarded – undo
1916 1916
         $data[1] = "global \$SETTINGS;\n";
1917 1917
         $data[2] = "\$SETTINGS = array (\n";
1918 1918
         $rows = DB::query(
1919
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s',
1919
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s',
1920 1920
             'admin'
1921 1921
         );
1922 1922
         foreach ($rows as $record) {
1923
-            array_push($data, "    '" . $record['intitule'] . "' => '" . htmlspecialchars_decode($record['valeur'], ENT_COMPAT) . "',\n");
1923
+            array_push($data, "    '".$record['intitule']."' => '".htmlspecialchars_decode($record['valeur'], ENT_COMPAT)."',\n");
1924 1924
         }
1925 1925
         array_push($data, ");\n");
1926 1926
         $data = array_unique($data);
@@ -1934,15 +1934,15 @@  discard block
 block discarded – undo
1934 1934
                 break;
1935 1935
             }
1936 1936
 
1937
-            if (stristr($line, "'" . $field . "' => '")) {
1938
-                $data[$inc] = "    '" . $field . "' => '" . htmlspecialchars_decode($value ?? '', ENT_COMPAT) . "',\n";
1937
+            if (stristr($line, "'".$field."' => '")) {
1938
+                $data[$inc] = "    '".$field."' => '".htmlspecialchars_decode($value ?? '', ENT_COMPAT)."',\n";
1939 1939
                 $bFound = true;
1940 1940
                 break;
1941 1941
             }
1942 1942
             ++$inc;
1943 1943
         }
1944 1944
         if ($bFound === false) {
1945
-            $data[$inc] = "    '" . $field . "' => '" . htmlspecialchars_decode($value ?? '', ENT_COMPAT). "',\n);\n";
1945
+            $data[$inc] = "    '".$field."' => '".htmlspecialchars_decode($value ?? '', ENT_COMPAT)."',\n);\n";
1946 1946
         }
1947 1947
     }
1948 1948
 
@@ -1972,7 +1972,7 @@  discard block
 block discarded – undo
1972 1972
 {
1973 1973
     global $SETTINGS;
1974 1974
     /* LOAD CPASSMAN SETTINGS */
1975
-    if (! isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
1975
+    if (!isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
1976 1976
         $SETTINGS = [];
1977 1977
         $SETTINGS['duplicate_folder'] = 0;
1978 1978
         //by default, this is set to 0;
@@ -1982,7 +1982,7 @@  discard block
 block discarded – undo
1982 1982
         //by default, this value is set to 5;
1983 1983
         $settings = [];
1984 1984
         $rows = DB::query(
1985
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s_type OR type=%s_type2',
1985
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s_type OR type=%s_type2',
1986 1986
             [
1987 1987
                 'type' => 'admin',
1988 1988
                 'type2' => 'settings',
@@ -2014,7 +2014,7 @@  discard block
 block discarded – undo
2014 2014
     $source_cf = [];
2015 2015
     $rows = DB::QUERY(
2016 2016
         'SELECT id_category
2017
-            FROM ' . prefixTable('categories_folders') . '
2017
+            FROM ' . prefixTable('categories_folders').'
2018 2018
             WHERE id_folder = %i',
2019 2019
         $source_id
2020 2020
     );
@@ -2025,7 +2025,7 @@  discard block
 block discarded – undo
2025 2025
     $target_cf = [];
2026 2026
     $rows = DB::QUERY(
2027 2027
         'SELECT id_category
2028
-            FROM ' . prefixTable('categories_folders') . '
2028
+            FROM ' . prefixTable('categories_folders').'
2029 2029
             WHERE id_folder = %i',
2030 2030
         $target_id
2031 2031
     );
@@ -2243,7 +2243,7 @@  discard block
 block discarded – undo
2243 2243
     int  $dirPerm = 0755
2244 2244
 ) {
2245 2245
     // Check if the path exists
2246
-    if (! file_exists($path)) {
2246
+    if (!file_exists($path)) {
2247 2247
         return false;
2248 2248
     }
2249 2249
 
@@ -2296,7 +2296,7 @@  discard block
 block discarded – undo
2296 2296
     // Load item data
2297 2297
     $data = DB::queryFirstRow(
2298 2298
         'SELECT id_tree
2299
-        FROM ' . prefixTable('items') . '
2299
+        FROM ' . prefixTable('items').'
2300 2300
         WHERE id = %i',
2301 2301
         $item_id
2302 2302
     );
@@ -2359,7 +2359,7 @@  discard block
 block discarded – undo
2359 2359
         }
2360 2360
         $host .= substr(explode(".", $email[1])[0], -1, 1);
2361 2361
     }
2362
-    $email = $name . "@" . $host . "." . explode(".", $email[1])[1];
2362
+    $email = $name."@".$host.".".explode(".", $email[1])[1];
2363 2363
     return $email;
2364 2364
 }
2365 2365
 
@@ -2382,7 +2382,7 @@  discard block
 block discarded – undo
2382 2382
     
2383 2383
     // Insert log in DB
2384 2384
     return DB::query(
2385
-        'SELECT ' . $fields . '
2385
+        'SELECT '.$fields.'
2386 2386
         FROM ' . prefixTable($table)
2387 2387
     );
2388 2388
 }
@@ -2397,11 +2397,11 @@  discard block
 block discarded – undo
2397 2397
 function formatSizeUnits(int $bytes): string
2398 2398
 {
2399 2399
     if ($bytes >= 1073741824) {
2400
-        $bytes = number_format($bytes / 1073741824, 2) . ' GB';
2400
+        $bytes = number_format($bytes / 1073741824, 2).' GB';
2401 2401
     } elseif ($bytes >= 1048576) {
2402
-        $bytes = number_format($bytes / 1048576, 2) . ' MB';
2402
+        $bytes = number_format($bytes / 1048576, 2).' MB';
2403 2403
     } elseif ($bytes >= 1024) {
2404
-        $bytes = number_format($bytes / 1024, 2) . ' KB';
2404
+        $bytes = number_format($bytes / 1024, 2).' KB';
2405 2405
     } elseif ($bytes > 1) {
2406 2406
         $bytes .= ' bytes';
2407 2407
     } elseif ($bytes === 1) {
@@ -2646,14 +2646,14 @@  discard block
 block discarded – undo
2646 2646
 
2647 2647
         // Encrypt the file content
2648 2648
         $plaintext = file_get_contents(
2649
-            filter_var($fileInPath . '/' . $fileInName, FILTER_SANITIZE_URL)
2649
+            filter_var($fileInPath.'/'.$fileInName, FILTER_SANITIZE_URL)
2650 2650
         );
2651 2651
         $ciphertext = $cipher->encrypt($plaintext);
2652 2652
         // Save new file
2653 2653
         $hash = md5($plaintext);
2654
-        $fileOut = $fileInPath . '/' . TP_FILE_PREFIX . $hash;
2654
+        $fileOut = $fileInPath.'/'.TP_FILE_PREFIX.$hash;
2655 2655
         file_put_contents($fileOut, $ciphertext);
2656
-        unlink($fileInPath . '/' . $fileInName);
2656
+        unlink($fileInPath.'/'.$fileInName);
2657 2657
         return [
2658 2658
             'fileHash' => base64_encode($hash),
2659 2659
             'objectKey' => base64_encode($objectKey),
@@ -2674,7 +2674,7 @@  discard block
 block discarded – undo
2674 2674
  */
2675 2675
 function decryptFile(string $fileName, string $filePath, string $key): string
2676 2676
 {
2677
-    if (! defined('FILE_BUFFER_SIZE')) {
2677
+    if (!defined('FILE_BUFFER_SIZE')) {
2678 2678
         define('FILE_BUFFER_SIZE', 128 * 1024);
2679 2679
     }
2680 2680
     
@@ -2690,7 +2690,7 @@  discard block
 block discarded – undo
2690 2690
         $cipher->enableContinuousBuffer();
2691 2691
         $cipher->disablePadding();
2692 2692
         // Get file content
2693
-        $ciphertext = file_get_contents($filePath . '/' . TP_FILE_PREFIX . $fileName);
2693
+        $ciphertext = file_get_contents($filePath.'/'.TP_FILE_PREFIX.$fileName);
2694 2694
         // Decrypt file content and return
2695 2695
         return base64_encode($cipher->decrypt($ciphertext));
2696 2696
     /*} else {
@@ -2772,8 +2772,8 @@  discard block
 block discarded – undo
2772 2772
         // Only create the sharekey for a user
2773 2773
         $user = DB::queryFirstRow(
2774 2774
             'SELECT public_key
2775
-            FROM ' . prefixTable('users') . '
2776
-            WHERE id = ' . (int) $session->get('user-id') . '
2775
+            FROM ' . prefixTable('users').'
2776
+            WHERE id = ' . (int) $session->get('user-id').'
2777 2777
             AND public_key != ""'
2778 2778
         );
2779 2779
 
@@ -2809,10 +2809,9 @@  discard block
 block discarded – undo
2809 2809
         //DB::debugmode(true);
2810 2810
         $users = DB::query(
2811 2811
             'SELECT id, public_key
2812
-            FROM ' . prefixTable('users') . '
2812
+            FROM ' . prefixTable('users').'
2813 2813
             WHERE ' . ($onlyForUser === true ? 
2814
-                'id IN ("' . TP_USER_ID . '","' . $session->get('user-id') . '") ' : 
2815
-                'id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '") ') . '
2814
+                'id IN ("'.TP_USER_ID.'","'.$session->get('user-id').'") ' : 'id NOT IN ("'.OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'") ').'
2816 2815
             AND public_key != ""'
2817 2816
         );
2818 2817
         //DB::debugmode(false);
@@ -2859,7 +2858,7 @@  discard block
 block discarded – undo
2859 2858
 function isBase64(string $str): bool
2860 2859
 {
2861 2860
     $str = (string) trim($str);
2862
-    if (! isset($str[0])) {
2861
+    if (!isset($str[0])) {
2863 2862
         return false;
2864 2863
     }
2865 2864
 
@@ -2932,7 +2931,7 @@  discard block
 block discarded – undo
2932 2931
         $connection->connect();
2933 2932
     } catch (\LdapRecord\Auth\BindException $e) {
2934 2933
         $error = $e->getDetailedError();
2935
-        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage();
2934
+        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage();
2936 2935
         return false;
2937 2936
     }
2938 2937
 
@@ -2945,7 +2944,7 @@  discard block
 block discarded – undo
2945 2944
         }
2946 2945
     } catch (\LdapRecord\Auth\BindException $e) {
2947 2946
         $error = $e->getDetailedError();
2948
-        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage();
2947
+        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage();
2949 2948
         return false;
2950 2949
     }
2951 2950
 
@@ -2969,7 +2968,7 @@  discard block
 block discarded – undo
2969 2968
     // expect if personal item
2970 2969
     DB::delete(
2971 2970
         prefixTable('sharekeys_items'),
2972
-        'user_id = %i AND object_id NOT IN (SELECT i.id FROM ' . prefixTable('items') . ' AS i WHERE i.perso = 1)',
2971
+        'user_id = %i AND object_id NOT IN (SELECT i.id FROM '.prefixTable('items').' AS i WHERE i.perso = 1)',
2973 2972
         $userId
2974 2973
     );
2975 2974
     // Remove all item sharekeys files
@@ -2977,8 +2976,8 @@  discard block
 block discarded – undo
2977 2976
         prefixTable('sharekeys_files'),
2978 2977
         'user_id = %i AND object_id NOT IN (
2979 2978
             SELECT f.id 
2980
-            FROM ' . prefixTable('items') . ' AS i 
2981
-            INNER JOIN ' . prefixTable('files') . ' AS f ON f.id_item = i.id
2979
+            FROM ' . prefixTable('items').' AS i 
2980
+            INNER JOIN ' . prefixTable('files').' AS f ON f.id_item = i.id
2982 2981
             WHERE i.perso = 1
2983 2982
         )',
2984 2983
         $userId
@@ -2988,8 +2987,8 @@  discard block
 block discarded – undo
2988 2987
         prefixTable('sharekeys_fields'),
2989 2988
         'user_id = %i AND object_id NOT IN (
2990 2989
             SELECT c.id 
2991
-            FROM ' . prefixTable('items') . ' AS i 
2992
-            INNER JOIN ' . prefixTable('categories_items') . ' AS c ON c.item_id = i.id
2990
+            FROM ' . prefixTable('items').' AS i 
2991
+            INNER JOIN ' . prefixTable('categories_items').' AS c ON c.item_id = i.id
2993 2992
             WHERE i.perso = 1
2994 2993
         )',
2995 2994
         $userId
@@ -2997,13 +2996,13 @@  discard block
 block discarded – undo
2997 2996
     // Remove all item sharekeys logs
2998 2997
     DB::delete(
2999 2998
         prefixTable('sharekeys_logs'),
3000
-        'user_id = %i AND object_id NOT IN (SELECT i.id FROM ' . prefixTable('items') . ' AS i WHERE i.perso = 1)',
2999
+        'user_id = %i AND object_id NOT IN (SELECT i.id FROM '.prefixTable('items').' AS i WHERE i.perso = 1)',
3001 3000
         $userId
3002 3001
     );
3003 3002
     // Remove all item sharekeys suggestions
3004 3003
     DB::delete(
3005 3004
         prefixTable('sharekeys_suggestions'),
3006
-        'user_id = %i AND object_id NOT IN (SELECT i.id FROM ' . prefixTable('items') . ' AS i WHERE i.perso = 1)',
3005
+        'user_id = %i AND object_id NOT IN (SELECT i.id FROM '.prefixTable('items').' AS i WHERE i.perso = 1)',
3007 3006
         $userId
3008 3007
     );
3009 3008
     return false;
@@ -3024,7 +3023,7 @@  discard block
 block discarded – undo
3024 3023
         foreach (DateTimeZone::listIdentifiers() as $timezone) {
3025 3024
             $now->setTimezone(new DateTimeZone($timezone));
3026 3025
             $offsets[] = $offset = $now->getOffset();
3027
-            $timezones[$timezone] = '(' . format_GMT_offset($offset) . ') ' . format_timezone_name($timezone);
3026
+            $timezones[$timezone] = '('.format_GMT_offset($offset).') '.format_timezone_name($timezone);
3028 3027
         }
3029 3028
 
3030 3029
         array_multisort($offsets, $timezones);
@@ -3044,7 +3043,7 @@  discard block
 block discarded – undo
3044 3043
 {
3045 3044
     $hours = intval($offset / 3600);
3046 3045
     $minutes = abs(intval($offset % 3600 / 60));
3047
-    return 'GMT' . ($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
3046
+    return 'GMT'.($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
3048 3047
 }
3049 3048
 
3050 3049
 /**
@@ -3144,8 +3143,7 @@  discard block
 block discarded – undo
3144 3143
 {
3145 3144
     if (isset($array[$key]) === true
3146 3145
         && (is_int($value) === true ?
3147
-            (int) $array[$key] === $value :
3148
-            (string) $array[$key] === $value)
3146
+            (int) $array[$key] === $value : (string) $array[$key] === $value)
3149 3147
     ) {
3150 3148
         return true;
3151 3149
     }
@@ -3167,8 +3165,7 @@  discard block
 block discarded – undo
3167 3165
 {
3168 3166
     if (isset($var) === false
3169 3167
         || (is_int($value) === true ?
3170
-            (int) $var === $value :
3171
-            (string) $var === $value)
3168
+            (int) $var === $value : (string) $var === $value)
3172 3169
     ) {
3173 3170
         return true;
3174 3171
     }
@@ -3219,7 +3216,7 @@  discard block
 block discarded – undo
3219 3216
  */
3220 3217
 function isSetArrayOfValues(array $arrayOfValues): bool
3221 3218
 {
3222
-    foreach($arrayOfValues as $value) {
3219
+    foreach ($arrayOfValues as $value) {
3223 3220
         if (isset($value) === false) {
3224 3221
             return false;
3225 3222
         }
@@ -3241,7 +3238,7 @@  discard block
 block discarded – undo
3241 3238
     /*PHP8 - integer|string*/$value
3242 3239
 ) : bool
3243 3240
 {
3244
-    foreach($arrayOfVars as $variable) {
3241
+    foreach ($arrayOfVars as $variable) {
3245 3242
         if ($variable !== $value) {
3246 3243
             return false;
3247 3244
         }
@@ -3261,7 +3258,7 @@  discard block
 block discarded – undo
3261 3258
     /*PHP8 - integer|string*/$value
3262 3259
 ) : bool
3263 3260
 {
3264
-    foreach($arrayOfVars as $variable) {
3261
+    foreach ($arrayOfVars as $variable) {
3265 3262
         if ($variable === $value) {
3266 3263
             return true;
3267 3264
         }
@@ -3329,7 +3326,7 @@  discard block
 block discarded – undo
3329 3326
  * @param array     $filters
3330 3327
  * @return array|string
3331 3328
  */
3332
-function dataSanitizer(array $data, array $filters): array|string
3329
+function dataSanitizer(array $data, array $filters): array | string
3333 3330
 {
3334 3331
     // Load Sanitizer library
3335 3332
     $sanitizer = new Sanitizer($data, $filters);
@@ -3358,7 +3355,7 @@  discard block
 block discarded – undo
3358 3355
     // Exists ?
3359 3356
     $userCacheId = DB::queryfirstrow(
3360 3357
         'SELECT increment_id
3361
-        FROM ' . prefixTable('cache_tree') . '
3358
+        FROM ' . prefixTable('cache_tree').'
3362 3359
         WHERE user_id = %i',
3363 3360
         $user_id
3364 3361
     );
@@ -3409,7 +3406,7 @@  discard block
 block discarded – undo
3409 3406
  */
3410 3407
 function pourcentage(float $nombre, float $total, float $pourcentage): float
3411 3408
 { 
3412
-    $resultat = ($nombre/$total) * $pourcentage;
3409
+    $resultat = ($nombre / $total) * $pourcentage;
3413 3410
     return round($resultat);
3414 3411
 }
3415 3412
 
@@ -3439,7 +3436,7 @@  discard block
 block discarded – undo
3439 3436
 
3440 3437
     // Get last folder update
3441 3438
     $lastFolderChange = DB::queryfirstrow(
3442
-        'SELECT valeur FROM ' . prefixTable('misc') . '
3439
+        'SELECT valeur FROM '.prefixTable('misc').'
3443 3440
         WHERE type = %s AND intitule = %s',
3444 3441
         'timestamp',
3445 3442
         'last_folder_change'
@@ -3469,7 +3466,7 @@  discard block
 block discarded – undo
3469 3466
     // Does this user has a tree cache
3470 3467
     $userCacheTree = DB::queryfirstrow(
3471 3468
         'SELECT '.$fieldName.'
3472
-        FROM ' . prefixTable('cache_tree') . '
3469
+        FROM ' . prefixTable('cache_tree').'
3473 3470
         WHERE user_id = %i',
3474 3471
         $session->get('user-id')
3475 3472
     );
@@ -3511,7 +3508,7 @@  discard block
 block discarded – undo
3511 3508
     if (count($folderIds) === 0) {
3512 3509
         $folderIds = DB::queryFirstColumn(
3513 3510
             'SELECT id
3514
-            FROM ' . prefixTable('nested_tree') . '
3511
+            FROM ' . prefixTable('nested_tree').'
3515 3512
             WHERE personal_folder=%i',
3516 3513
             0
3517 3514
         );
@@ -3528,8 +3525,8 @@  discard block
 block discarded – undo
3528 3525
         $rows_tmp = DB::query(
3529 3526
             'SELECT c.id, c.title, c.level, c.type, c.masked, c.order, c.encrypted_data, c.role_visibility, c.is_mandatory,
3530 3527
             f.id_category AS category_id
3531
-            FROM ' . prefixTable('categories_folders') . ' AS f
3532
-            INNER JOIN ' . prefixTable('categories') . ' AS c ON (f.id_category = c.parent_id)
3528
+            FROM ' . prefixTable('categories_folders').' AS f
3529
+            INNER JOIN ' . prefixTable('categories').' AS c ON (f.id_category = c.parent_id)
3533 3530
             WHERE id_folder=%i',
3534 3531
             $folder
3535 3532
         );
@@ -3555,7 +3552,7 @@  discard block
 block discarded – undo
3555 3552
         $valTemp = '';
3556 3553
         $data = DB::queryFirstRow(
3557 3554
             'SELECT valeur
3558
-            FROM ' . prefixTable('misc') . '
3555
+            FROM ' . prefixTable('misc').'
3559 3556
             WHERE type = %s AND intitule=%i',
3560 3557
             'complex',
3561 3558
             $folder
@@ -3572,14 +3569,14 @@  discard block
 block discarded – undo
3572 3569
         $valTemp = '';
3573 3570
         $rows_tmp = DB::query(
3574 3571
             'SELECT t.title
3575
-            FROM ' . prefixTable('roles_values') . ' as v
3576
-            INNER JOIN ' . prefixTable('roles_title') . ' as t ON (v.role_id = t.id)
3572
+            FROM ' . prefixTable('roles_values').' as v
3573
+            INNER JOIN ' . prefixTable('roles_title').' as t ON (v.role_id = t.id)
3577 3574
             WHERE v.folder_id = %i
3578 3575
             GROUP BY title',
3579 3576
             $folder
3580 3577
         );
3581 3578
         foreach ($rows_tmp as $record) {
3582
-            $valTemp .= (empty($valTemp) === true ? '' : ' - ') . $record['title'];
3579
+            $valTemp .= (empty($valTemp) === true ? '' : ' - ').$record['title'];
3583 3580
         }
3584 3581
         $arr_data['visibilityRoles'] = $valTemp;
3585 3582
 
@@ -3612,7 +3609,7 @@  discard block
 block discarded – undo
3612 3609
         // loop on users and check if user has this role
3613 3610
         $rows = DB::query(
3614 3611
             'SELECT id, fonction_id
3615
-            FROM ' . prefixTable('users') . '
3612
+            FROM ' . prefixTable('users').'
3616 3613
             WHERE id != %i AND admin = 0 AND fonction_id IS NOT NULL AND fonction_id != ""',
3617 3614
             $session->get('user-id')
3618 3615
         );
@@ -3644,7 +3641,7 @@  discard block
 block discarded – undo
3644 3641
 
3645 3642
     $val = DB::queryfirstrow(
3646 3643
         'SELECT *
3647
-        FROM ' . prefixTable('users') . '
3644
+        FROM ' . prefixTable('users').'
3648 3645
         WHERE id = %i',
3649 3646
         $userId
3650 3647
     );
@@ -3660,12 +3657,12 @@  discard block
 block discarded – undo
3660 3657
 function upgradeRequired(): bool
3661 3658
 {
3662 3659
     // Get settings.php
3663
-    include_once __DIR__. '/../includes/config/settings.php';
3660
+    include_once __DIR__.'/../includes/config/settings.php';
3664 3661
 
3665 3662
     // Get timestamp in DB
3666 3663
     $val = DB::queryfirstrow(
3667 3664
         'SELECT valeur
3668
-        FROM ' . prefixTable('misc') . '
3665
+        FROM ' . prefixTable('misc').'
3669 3666
         WHERE type = %s AND intitule = %s',
3670 3667
         'admin',
3671 3668
         'upgrade_timestamp'
@@ -3720,7 +3717,7 @@  discard block
 block discarded – undo
3720 3717
     // prepapre background tasks for item keys generation        
3721 3718
     $userTP = DB::queryFirstRow(
3722 3719
         'SELECT pw, public_key, private_key
3723
-        FROM ' . prefixTable('users') . '
3720
+        FROM ' . prefixTable('users').'
3724 3721
         WHERE id = %i',
3725 3722
         TP_USER_ID
3726 3723
     );
@@ -3745,7 +3742,7 @@  discard block
 block discarded – undo
3745 3742
         }
3746 3743
 
3747 3744
         // Generate new keys
3748
-        if ($user_self_change === true && empty($recovery_public_key) === false && empty($recovery_private_key) === false){
3745
+        if ($user_self_change === true && empty($recovery_public_key) === false && empty($recovery_private_key) === false) {
3749 3746
             $userKeys = [
3750 3747
                 'public_key' => $recovery_public_key,
3751 3748
                 'private_key_clear' => $recovery_private_key,
@@ -3785,8 +3782,8 @@  discard block
 block discarded – undo
3785 3782
                 'process_type' => 'create_user_keys',
3786 3783
                 'arguments' => json_encode([
3787 3784
                     'new_user_id' => (int) $userId,
3788
-                    'new_user_pwd' => cryption($passwordClear, '','encrypt')['string'],
3789
-                    'new_user_code' => cryption(empty($encryptionKey) === true ? uniqidReal(20) : $encryptionKey, '','encrypt')['string'],
3785
+                    'new_user_pwd' => cryption($passwordClear, '', 'encrypt')['string'],
3786
+                    'new_user_code' => cryption(empty($encryptionKey) === true ? uniqidReal(20) : $encryptionKey, '', 'encrypt')['string'],
3790 3787
                     'owner_id' => (int) TP_USER_ID,
3791 3788
                     'creator_pwd' => $userTP['pw'],
3792 3789
                     'send_email' => $sendEmailToUser === true ? 1 : 0,
@@ -4082,7 +4079,7 @@  discard block
 block discarded – undo
4082 4079
  * @param integer $user_id
4083 4080
  * @return void
4084 4081
  */
4085
-function purgeUnnecessaryKeys(bool $allUsers = true, int $user_id=0)
4082
+function purgeUnnecessaryKeys(bool $allUsers = true, int $user_id = 0)
4086 4083
 {
4087 4084
     if ($allUsers === true) {
4088 4085
         // Load class DB
@@ -4092,7 +4089,7 @@  discard block
 block discarded – undo
4092 4089
 
4093 4090
         $users = DB::query(
4094 4091
             'SELECT id
4095
-            FROM ' . prefixTable('users') . '
4092
+            FROM ' . prefixTable('users').'
4096 4093
             WHERE id NOT IN ('.OTV_USER_ID.', '.TP_USER_ID.', '.SSH_USER_ID.', '.API_USER_ID.')
4097 4094
             ORDER BY login ASC'
4098 4095
         );
@@ -4110,7 +4107,7 @@  discard block
 block discarded – undo
4110 4107
  * @param integer $user_id
4111 4108
  * @return void
4112 4109
  */
4113
-function purgeUnnecessaryKeysForUser(int $user_id=0)
4110
+function purgeUnnecessaryKeysForUser(int $user_id = 0)
4114 4111
 {
4115 4112
     if ($user_id === 0) {
4116 4113
         return;
@@ -4121,8 +4118,8 @@  discard block
 block discarded – undo
4121 4118
 
4122 4119
     $personalItems = DB::queryFirstColumn(
4123 4120
         'SELECT id
4124
-        FROM ' . prefixTable('items') . ' AS i
4125
-        INNER JOIN ' . prefixTable('log_items') . ' AS li ON li.id_item = i.id
4121
+        FROM ' . prefixTable('items').' AS i
4122
+        INNER JOIN ' . prefixTable('log_items').' AS li ON li.id_item = i.id
4126 4123
         WHERE i.perso = 1 AND li.action = "at_creation" AND li.id_user IN (%i, '.TP_USER_ID.')',
4127 4124
         $user_id
4128 4125
     );
@@ -4171,7 +4168,7 @@  discard block
 block discarded – undo
4171 4168
     // Check if user exists
4172 4169
     $userInfo = DB::queryFirstRow(
4173 4170
         'SELECT pw, public_key, private_key, login, name
4174
-        FROM ' . prefixTable('users') . '
4171
+        FROM ' . prefixTable('users').'
4175 4172
         WHERE id = %i',
4176 4173
         $userId
4177 4174
     );
@@ -4181,7 +4178,7 @@  discard block
 block discarded – undo
4181 4178
 
4182 4179
         // Prepare file content
4183 4180
         $export_value = file_get_contents(__DIR__."/../includes/core/teampass_ascii.txt")."\n".
4184
-            "Generation date: ".date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], $now)."\n\n".
4181
+            "Generation date: ".date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], $now)."\n\n".
4185 4182
             "RECOVERY KEYS - Not to be shared - To be store safely\n\n".
4186 4183
             "Public Key:\n".$userInfo['public_key']."\n\n".
4187 4184
             "Private Key:\n".decryptPrivateKey($session->get('user-password'), $userInfo['private_key'])."\n\n";
@@ -4204,7 +4201,7 @@  discard block
 block discarded – undo
4204 4201
         return prepareExchangedData(
4205 4202
             array(
4206 4203
                 'error' => false,
4207
-                'datetime' => date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], $now),
4204
+                'datetime' => date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], $now),
4208 4205
                 'timestamp' => $now,
4209 4206
                 'content' => base64_encode($export_value),
4210 4207
                 'login' => $userInfo['login'],
@@ -4230,8 +4227,8 @@  discard block
 block discarded – undo
4230 4227
  */
4231 4228
 function loadClasses(string $className = ''): void
4232 4229
 {
4233
-    require_once __DIR__. '/../includes/config/include.php';
4234
-    require_once __DIR__. '/../includes/config/settings.php';
4230
+    require_once __DIR__.'/../includes/config/include.php';
4231
+    require_once __DIR__.'/../includes/config/settings.php';
4235 4232
     require_once __DIR__.'/../vendor/autoload.php';
4236 4233
 
4237 4234
     if (defined('DB_PASSWD_CLEAR') === false) {
Please login to merge, or discard this patch.
sources/identify.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     error_log('Identify.php L89 - REFUS - '.$checkUserAccess->checkSession());
90 90
     // Not allowed page
91 91
     $session->set('system-error_code', ERR_NOT_ALLOWED);
92
-    include $SETTINGS['cpassman_dir'] . '/error.php';
92
+    include $SETTINGS['cpassman_dir'].'/error.php';
93 93
     exit;
94 94
 }
95 95
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
      * @param array $SETTINGS
125 125
      * @return bool|string
126 126
      */
127
-    function handleAuthAttempts($post_data, $SETTINGS): bool|string
127
+    function handleAuthAttempts($post_data, $SETTINGS): bool | string
128 128
     {
129 129
         $session = SessionManager::getSession();
130 130
         $lang = new Language();
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
     $sessionPwdAttempts = $session->get('pwd_attempts');
238 238
     $sessionUrl = $session->get('user-initial_url');
239 239
     $server = [];
240
-    $server['PHP_AUTH_USER'] =  $request->server->get('PHP_AUTH_USER');
240
+    $server['PHP_AUTH_USER'] = $request->server->get('PHP_AUTH_USER');
241 241
     $server['PHP_AUTH_PW'] = $request->server->get('PHP_AUTH_PW');
242 242
     
243 243
     // decrypt and retreive data in JSON format
@@ -252,18 +252,18 @@  discard block
 block discarded – undo
252 252
     }
253 253
 
254 254
     // Check if Duo auth is in progress and pass the pw and login back to the standard login process
255
-    if(
255
+    if (
256 256
         isKeyExistingAndEqual('duo', 1, $SETTINGS) === true
257 257
         && $dataReceived['user_2fa_selection'] === 'duo'
258 258
         && $session->get('user-duo_status') === 'IN_PROGRESS'
259 259
         && !empty($dataReceived['duo_state'])
260
-    ){
260
+    ) {
261 261
         $key = hash('sha256', $dataReceived['duo_state']);
262 262
         $iv = substr(hash('sha256', $dataReceived['duo_state']), 0, 16);
263 263
         $duo_data_dec = openssl_decrypt(base64_decode($session->get('user-duo_status')), 'AES-256-CBC', $key, 0, $iv);
264 264
         // Clear the data from the Duo process to continue clean with the standard login process
265
-        $session->set('user-duo_data','');
266
-        if($duo_data_dec === false){
265
+        $session->set('user-duo_data', '');
266
+        if ($duo_data_dec === false) {
267 267
             echo prepareExchangedData(
268 268
                 [
269 269
                     'error' => true,
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
         $dataReceived['login'] = $duo_data['duo_login'];
279 279
     }
280 280
 
281
-    if(isset($dataReceived['pw']) === false || isset($dataReceived['login']) === false) {
281
+    if (isset($dataReceived['pw']) === false || isset($dataReceived['login']) === false) {
282 282
         echo json_encode([
283 283
             'data' => prepareExchangedData(
284 284
                 [
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
         }
548 548
         // Append with roles from AD groups
549 549
         if (is_null($userInfo['roles_from_ad_groups']) === false) {
550
-            $userInfo['fonction_id'] = empty($userInfo['fonction_id'])  === true ? $userInfo['roles_from_ad_groups'] : $userInfo['fonction_id']. ';' . $userInfo['roles_from_ad_groups'];
550
+            $userInfo['fonction_id'] = empty($userInfo['fonction_id']) === true ? $userInfo['roles_from_ad_groups'] : $userInfo['fonction_id'].';'.$userInfo['roles_from_ad_groups'];
551 551
         }
552 552
         // store
553 553
         $session->set('user-roles', $userInfo['fonction_id']);
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
         if (count($session->get('user-roles_array')) > 0) {
560 560
             $rolesList = DB::query(
561 561
                 'SELECT id, title, complexity
562
-                FROM ' . prefixTable('roles_title') . '
562
+                FROM ' . prefixTable('roles_title').'
563 563
                 WHERE id IN %li',
564 564
                 $session->get('user-roles_array')
565 565
             );
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
             if ($adjustPermissions) {
606 606
                 $session->set('user-admin', (int) $userInfo['admin']);
607 607
                 $session->set('user-manager', (int) $userInfo['gestionnaire']);
608
-                $session->set('user-can_manage_all_users',(int)  $userInfo['can_manage_all_users']);
608
+                $session->set('user-can_manage_all_users', (int) $userInfo['can_manage_all_users']);
609 609
                 $session->set('user-read_only', (int) $userInfo['read_only']);
610 610
                 DB::update(
611 611
                     prefixTable('users'),
@@ -677,10 +677,10 @@  discard block
 block discarded – undo
677 677
         $session->set('user-latest_items_tab', []);
678 678
         $session->set('user-nb_roles', 0);
679 679
         foreach ($session->get('user-latest_items') as $item) {
680
-            if (! empty($item)) {
680
+            if (!empty($item)) {
681 681
                 $dataLastItems = DB::queryFirstRow(
682 682
                     'SELECT id,label,id_tree
683
-                    FROM ' . prefixTable('items') . '
683
+                    FROM ' . prefixTable('items').'
684 684
                     WHERE id=%i',
685 685
                     $item
686 686
                 );
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
                     [
690 690
                         'id' => $item,
691 691
                         'label' => $dataLastItems['label'],
692
-                        'url' => 'index.php?page=items&amp;group=' . $dataLastItems['id_tree'] . '&amp;id=' . $item,
692
+                        'url' => 'index.php?page=items&amp;group='.$dataLastItems['id_tree'].'&amp;id='.$item,
693 693
                     ],
694 694
                     'add'
695 695
                 );
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
         // Get cahce tree info
700 700
         $cacheTreeData = DB::queryFirstRow(
701 701
             'SELECT visible_folders
702
-            FROM ' . prefixTable('cache_tree') . '
702
+            FROM ' . prefixTable('cache_tree').'
703 703
             WHERE user_id=%i',
704 704
             (int) $session->get('user-id')
705 705
         );
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
             && (int) $sessionAdmin !== 1
732 732
         ) {
733 733
             // get all Admin users
734
-            $val = DB::queryfirstrow('SELECT email FROM ' . prefixTable('users') . " WHERE admin = %i and email != ''", 1);
734
+            $val = DB::queryfirstrow('SELECT email FROM '.prefixTable('users')." WHERE admin = %i and email != ''", 1);
735 735
             if (DB::count() > 0) {
736 736
                 // Add email to table
737 737
                 prepareSendingEmail(
@@ -743,7 +743,7 @@  discard block
 block discarded – undo
743 743
                             '#tp_time#',
744 744
                         ],
745 745
                         [
746
-                            ' ' . $session->get('user-login') . ' (IP: ' . getClientIpServer() . ')',
746
+                            ' '.$session->get('user-login').' (IP: '.getClientIpServer().')',
747 747
                             date($SETTINGS['date_format'], (int) $session->get('user-last_connection')),
748 748
                             date($SETTINGS['time_format'], (int) $session->get('user-last_connection')),
749 749
                         ],
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
 {
892 892
     $rows = DB::query(
893 893
         'SELECT date
894
-        FROM ' . prefixTable('log_system') . "
894
+        FROM ' . prefixTable('log_system')."
895 895
         WHERE field_1 = %s
896 896
         AND type = 'failed_auth'
897 897
         AND label = 'password_is_not_correct'
@@ -905,7 +905,7 @@  discard block
 block discarded – undo
905 905
         foreach ($rows as $record) {
906 906
             array_push(
907 907
                 $arrAttempts,
908
-                date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date'])
908
+                date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date'])
909 909
             );
910 910
         }
911 911
     }
@@ -959,7 +959,7 @@  discard block
 block discarded – undo
959 959
     $ldapConnection
960 960
 ) : bool
961 961
 {
962
-    include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
962
+    include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
963 963
 
964 964
     if ((int) $userInfoDisabled === 1) {
965 965
         return false;
@@ -1167,7 +1167,7 @@  discard block
 block discarded – undo
1167 1167
                 $openLdapExtra = new OpenLdapExtra();
1168 1168
                 break;
1169 1169
             default:
1170
-                throw new Exception("Unsupported LDAP type: " . $SETTINGS['ldap_type']);
1170
+                throw new Exception("Unsupported LDAP type: ".$SETTINGS['ldap_type']);
1171 1171
         }
1172 1172
     } catch (Exception $e) {
1173 1173
         return [
@@ -1180,7 +1180,7 @@  discard block
 block discarded – undo
1180 1180
         // 2- Get user info from AD
1181 1181
         // We want to isolate attribute ldap_user_attribute or mostly samAccountName
1182 1182
         $userADInfos = $ldapConnection->query()
1183
-            ->where((isset($SETTINGS['ldap_user_attribute']) ===true && empty($SETTINGS['ldap_user_attribute']) === false) ? $SETTINGS['ldap_user_attribute'] : 'samaccountname', '=', $username)
1183
+            ->where((isset($SETTINGS['ldap_user_attribute']) === true && empty($SETTINGS['ldap_user_attribute']) === false) ? $SETTINGS['ldap_user_attribute'] : 'samaccountname', '=', $username)
1184 1184
             ->firstOrFail();
1185 1185
 
1186 1186
         // Is user enabled? Only ActiveDirectory
@@ -1199,7 +1199,7 @@  discard block
 block discarded – undo
1199 1199
         // For OpenLDAP and others, we use attribute dn
1200 1200
         $userAuthAttempt = $ldapConnection->auth()->attempt(
1201 1201
             $SETTINGS['ldap_type'] === 'ActiveDirectory' ?
1202
-                $userADInfos['userprincipalname'][0] :  // refering to https://ldaprecord.com/docs/core/v2/authentication#basic-authentication
1202
+                $userADInfos['userprincipalname'][0] : // refering to https://ldaprecord.com/docs/core/v2/authentication#basic-authentication
1203 1203
                 $userADInfos['dn'],
1204 1204
             $passwordClear
1205 1205
         );
@@ -1216,7 +1216,7 @@  discard block
 block discarded – undo
1216 1216
         $error = $e->getDetailedError();
1217 1217
         return [
1218 1218
             'error' => true,
1219
-            'message' => $lang->get('error')." - ".(isset($error) === true ? $error->getErrorCode()." - ".$error->getErrorMessage(). "<br>".$error->getDiagnosticMessage() : $e),
1219
+            'message' => $lang->get('error')." - ".(isset($error) === true ? $error->getErrorCode()." - ".$error->getErrorMessage()."<br>".$error->getDiagnosticMessage() : $e),
1220 1220
 
1221 1221
         ];
1222 1222
     }
@@ -1281,7 +1281,7 @@  discard block
 block discarded – undo
1281 1281
         // error
1282 1282
         return [
1283 1283
             'error' => true,
1284
-            'message' => "Error: Unsupported LDAP type: " . $SETTINGS['ldap_type'],
1284
+            'message' => "Error: Unsupported LDAP type: ".$SETTINGS['ldap_type'],
1285 1285
         ];
1286 1286
     }
1287 1287
     
@@ -1316,12 +1316,12 @@  discard block
 block discarded – undo
1316 1316
     if (isset($SETTINGS['enable_ad_users_with_ad_groups']) === true && (int) $SETTINGS['enable_ad_users_with_ad_groups'] === 1) {
1317 1317
         // Get user groups from AD
1318 1318
         $user_ad_groups = [];
1319
-        foreach($groups as $group) {
1319
+        foreach ($groups as $group) {
1320 1320
             //print_r($group);
1321 1321
             // get relation role id for AD group
1322 1322
             $role = DB::queryFirstRow(
1323 1323
                 'SELECT lgr.role_id
1324
-                FROM ' . prefixTable('ldap_groups_roles') . ' AS lgr
1324
+                FROM ' . prefixTable('ldap_groups_roles').' AS lgr
1325 1325
                 WHERE lgr.ldap_group_id = %i',
1326 1326
                 $group
1327 1327
             );
@@ -1470,7 +1470,7 @@  discard block
 block discarded – undo
1470 1470
     }
1471 1471
 
1472 1472
     // Now check yubico validity
1473
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/Yubico/Yubico.php';
1473
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/Yubico/Yubico.php';
1474 1474
     $yubi = new Auth_Yubico($yubico_user_id, $yubico_user_key);
1475 1475
     $auth = $yubi->verify($yubico_key);
1476 1476
     //, null, null, null, 60
@@ -1624,7 +1624,7 @@  discard block
 block discarded – undo
1624 1624
             $mfaMessage = $lang->get('ga_flash_qr_and_login');
1625 1625
             // generate new QR
1626 1626
             $new_2fa_qr = $tfa->getQRCodeImageAsDataUri(
1627
-                'Teampass - ' . $username,
1627
+                'Teampass - '.$username,
1628 1628
                 $userInfo['ga']
1629 1629
             );
1630 1630
             // clear temporary code from DB
@@ -1637,7 +1637,7 @@  discard block
 block discarded – undo
1637 1637
                 $userInfo['id']
1638 1638
             );
1639 1639
             $firstTime = [
1640
-                'value' => '<img src="' . $new_2fa_qr . '">',
1640
+                'value' => '<img src="'.$new_2fa_qr.'">',
1641 1641
                 'user_admin' => isset($sessionAdmin) ? (int) $sessionAdmin : '',
1642 1642
                 'initial_url' => isset($sessionUrl) === true ? $sessionUrl : '',
1643 1643
                 'pwd_attempts' => (int) $sessionPwdAttempts,
@@ -1793,7 +1793,7 @@  discard block
 block discarded – undo
1793 1793
         }*/
1794 1794
         return [
1795 1795
             'error' => true,
1796
-            'message' => $duo_error . $lang->get('duo_error_check_config'),
1796
+            'message' => $duo_error.$lang->get('duo_error_check_config'),
1797 1797
             'pwd_attempts' => (int) $sessionPwdAttempts,
1798 1798
             'debug_message' => $e->getMessage(),
1799 1799
             'proceedIdentification' => false,
@@ -1809,7 +1809,7 @@  discard block
 block discarded – undo
1809 1809
         } catch (DuoException $e) {
1810 1810
             return [
1811 1811
                 'error' => true,
1812
-                'message' => $duo_error . $lang->get('duo_error_url'),
1812
+                'message' => $duo_error.$lang->get('duo_error_url'),
1813 1813
                 'pwd_attempts' => (int) $sessionPwdAttempts,
1814 1814
                 'debug_message' => $e->getMessage(),
1815 1815
                 'proceedIdentification' => false,
@@ -1817,7 +1817,7 @@  discard block
 block discarded – undo
1817 1817
         }
1818 1818
         
1819 1819
         // Somethimes Duo return success but fail to return a URL, double check if the URL has been created
1820
-        if (!empty($duo_redirect_url) && isset($duo_redirect_url) && filter_var($duo_redirect_url,FILTER_SANITIZE_URL)) {
1820
+        if (!empty($duo_redirect_url) && isset($duo_redirect_url) && filter_var($duo_redirect_url, FILTER_SANITIZE_URL)) {
1821 1821
             // Since Duo Universal requires a redirect, let's store some info when the user get's back after completing the Duo prompt
1822 1822
             $key = hash('sha256', $duo_state);
1823 1823
             $iv = substr(hash('sha256', $duo_state), 0, 16);
@@ -1845,7 +1845,7 @@  discard block
 block discarded – undo
1845 1845
         } else {
1846 1846
             return [
1847 1847
                 'error' => true,
1848
-                'message' => $duo_error . $lang->get('duo_error_url'),
1848
+                'message' => $duo_error.$lang->get('duo_error_url'),
1849 1849
                 'pwd_attempts' => (int) $sessionPwdAttempts,
1850 1850
                 'proceedIdentification' => false,
1851 1851
             ];
@@ -1866,8 +1866,8 @@  discard block
 block discarded – undo
1866 1866
         // return the response (which should be the user name)
1867 1867
         if ($decoded_token['preferred_username'] === $username) {
1868 1868
             $session->set('user-duo_status', 'COMPLET');
1869
-            $session->set('user-duo_state','');
1870
-            $session->set('user-duo_data','');
1869
+            $session->set('user-duo_state', '');
1870
+            $session->set('user-duo_data', '');
1871 1871
             $session->set('user-login', $username);
1872 1872
 
1873 1873
             return [
@@ -1878,9 +1878,9 @@  discard block
 block discarded – undo
1878 1878
             ];
1879 1879
         } else {
1880 1880
             // Something wrong, username from the original Duo request is different than the one received now
1881
-            $session->set('user-duo_status','');
1882
-            $session->set('user-duo_state','');
1883
-            $session->set('user-duo_data','');
1881
+            $session->set('user-duo_status', '');
1882
+            $session->set('user-duo_state', '');
1883
+            $session->set('user-duo_data', '');
1884 1884
 
1885 1885
             return [
1886 1886
                 'error' => true,
@@ -1891,9 +1891,9 @@  discard block
 block discarded – undo
1891 1891
         }
1892 1892
     }
1893 1893
     // If we are here something wrong
1894
-    $session->set('user-duo_status','');
1895
-    $session->set('user-duo_state','');
1896
-    $session->set('user-duo_data','');
1894
+    $session->set('user-duo_status', '');
1895
+    $session->set('user-duo_state', '');
1896
+    $session->set('user-duo_data', '');
1897 1897
     return [
1898 1898
         'error' => true,
1899 1899
         'message' => $lang->get('duo_login_mismatch'),
@@ -2049,8 +2049,8 @@  discard block
 block discarded – undo
2049 2049
     public function get_user_info($login, $enable_ad_user_auto_creation) {
2050 2050
         $data = DB::queryFirstRow(
2051 2051
             'SELECT u.*, a.value AS api_key
2052
-            FROM ' . prefixTable('users') . ' AS u
2053
-            LEFT JOIN ' . prefixTable('api') . ' AS a ON (u.id = a.user_id)
2052
+            FROM ' . prefixTable('users').' AS u
2053
+            LEFT JOIN ' . prefixTable('api').' AS a ON (u.id = a.user_id)
2054 2054
             WHERE login = %s AND deleted_at IS NULL',
2055 2055
             $login
2056 2056
         );
@@ -2400,15 +2400,15 @@  discard block
 block discarded – undo
2400 2400
 
2401 2401
             if ($ret['error'] !== false) {
2402 2402
                 logEvents($SETTINGS, 'failed_auth', 'bad_duo_mfa', '', stripslashes($username), stripslashes($username));
2403
-                $session->set('user-duo_status','');
2404
-                $session->set('user-duo_state','');
2405
-                $session->set('user-duo_data','');
2403
+                $session->set('user-duo_status', '');
2404
+                $session->set('user-duo_state', '');
2405
+                $session->set('user-duo_data', '');
2406 2406
                 return [
2407 2407
                     'error' => true,
2408 2408
                     'mfaData' => $ret,
2409 2409
                     'mfaQRCodeInfos' => false,
2410 2410
                 ];
2411
-            } else if ($ret['duo_url_ready'] === true){
2411
+            } else if ($ret['duo_url_ready'] === true) {
2412 2412
                 return [
2413 2413
                     'error' => false,
2414 2414
                     'mfaData' => $ret,
Please login to merge, or discard this patch.
index.php 1 patch
Spacing   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 }
78 78
 
79 79
 // Load functions
80
-require_once __DIR__. '/includes/config/include.php';
80
+require_once __DIR__.'/includes/config/include.php';
81 81
 require_once __DIR__.'/sources/main.functions.php';
82 82
 //error_log('>>>>> '.SessionManager::getCookieValue('PHPSESSID'));
83 83
 // init
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 $request = Request::createFromGlobals();
88 88
 
89 89
 $session->set('key', SessionManager::getCookieValue('PHPSESSID'));
90
-error_log('DEBUG : KEY sur index.php ' . $session->get('key')." -- ".SessionManager::getCookieValue('PHPSESSID'));
90
+error_log('DEBUG : KEY sur index.php '.$session->get('key')." -- ".SessionManager::getCookieValue('PHPSESSID'));
91 91
 
92 92
 // Quick major version check -> upgrade needed?
93 93
 if (isset($SETTINGS['teampass_version']) === true && version_compare(TP_VERSION, $SETTINGS['teampass_version']) > 0) {
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 }
107 107
 
108 108
 // Load Core library
109
-require_once $SETTINGS['cpassman_dir'] . '/sources/core.php';
109
+require_once $SETTINGS['cpassman_dir'].'/sources/core.php';
110 110
 // Prepare POST variables
111 111
 $post_language = filter_input(INPUT_POST, 'language', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
112 112
 $session_user_language = $session->get('user-language');
@@ -132,8 +132,8 @@  discard block
 block discarded – undo
132 132
     //get default language
133 133
     $dataLanguage = DB::queryFirstRow(
134 134
         'SELECT m.valeur AS valeur, l.flag AS flag
135
-        FROM ' . prefixTable('misc') . ' AS m
136
-        INNER JOIN ' . prefixTable('languages') . ' AS l ON (m.valeur = l.name)
135
+        FROM ' . prefixTable('misc').' AS m
136
+        INNER JOIN ' . prefixTable('languages').' AS l ON (m.valeur = l.name)
137 137
         WHERE m.type=%s_type AND m.intitule=%s_intitule',
138 138
         [
139 139
             'type' => 'admin',
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
         $session_user_language = $SETTINGS['default_language'];
165 165
     }
166 166
 }
167
-$lang = new Language($session_user_language, __DIR__. '/includes/language/'); 
167
+$lang = new Language($session_user_language, __DIR__.'/includes/language/'); 
168 168
 
169 169
 if (isset($SETTINGS['cpassman_dir']) === false || $SETTINGS['cpassman_dir'] === '') {
170 170
     $SETTINGS['cpassman_dir'] = __DIR__;
@@ -226,10 +226,10 @@  discard block
 block discarded – undo
226 226
     <!-- Toastr -->
227 227
     <link rel="stylesheet" href="plugins/toastr/toastr.min.css" />
228 228
     <!-- favicon -->
229
-    <link rel="shortcut icon" type="image/png" href="<?php echo $SETTINGS['favicon'];?>"/>
229
+    <link rel="shortcut icon" type="image/png" href="<?php echo $SETTINGS['favicon']; ?>"/>
230 230
     <!-- Custom style -->
231 231
     <?php
232
-    if (file_exists(__DIR__ . '/includes/css/custom.css') === true) {?>
232
+    if (file_exists(__DIR__.'/includes/css/custom.css') === true) {?>
233 233
         <link rel="stylesheet" href="includes/css/custom.css">
234 234
     <?php
235 235
     } ?>
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
                         <div class="dropdown show">
294 294
                             <a class="btn btn-primary dropdown-toggle" href="#" data-toggle="dropdown">
295 295
                                 <?php
296
-                                    echo $session_name . '&nbsp;' . $session_lastname; ?>
296
+                                    echo $session_name.'&nbsp;'.$session_lastname; ?>
297 297
                             </a>
298 298
 
299 299
                             <div class="dropdown-menu dropdown-menu-right">
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
                                     </a>
318 318
                                 <?php
319 319
                                     } ?>
320
-                                <a class="dropdown-item user-menu<?php echo (int) $session_user_admin === 1 ? ' hidden' : '';?>" href="#" data-name="generate-new_keys">
320
+                                <a class="dropdown-item user-menu<?php echo (int) $session_user_admin === 1 ? ' hidden' : ''; ?>" href="#" data-name="generate-new_keys">
321 321
                                     <i class="fa-solid fa-spray-can-sparkles fa-fw mr-2"></i><?php echo $lang->get('generate_new_keys'); ?>
322 322
                                 </a>
323 323
 
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
             <!-- Main Sidebar Container -->
347 347
             <aside class="main-sidebar sidebar-dark-primary elevation-4">
348 348
                 <!-- Brand Logo -->
349
-                <a href="<?php echo $SETTINGS['cpassman_url'] . '/index.php?page=' . ((int) $session_user_admin === 1 ? 'admin' : 'items'); ?>" class="brand-link">
349
+                <a href="<?php echo $SETTINGS['cpassman_url'].'/index.php?page='.((int) $session_user_admin === 1 ? 'admin' : 'items'); ?>" class="brand-link">
350 350
                     <img src="includes/images/teampass-logo2-home.png" alt="Teampass Logo" class="brand-image">
351 351
                     <span class="brand-text font-weight-light"><?php echo TP_TOOL_NAME; ?></span>
352 352
                 </a>
@@ -364,20 +364,20 @@  discard block
 block discarded – undo
364 364
                         <a href="#" data-name="items" class="nav-link', $get['page'] === 'items' ? ' active' : '', '">
365 365
                         <i class="nav-icon fa-solid fa-key"></i>
366 366
                         <p>
367
-                            ' . $lang->get('pw') . '
367
+                            ' . $lang->get('pw').'
368 368
                         </p>
369 369
                         </a>
370 370
                     </li>';
371 371
                                 }
372 372
 
373 373
     // IMPORT menu
374
-    if (isset($SETTINGS['allow_import']) === true && (int) $SETTINGS['allow_import'] === 1&& $session_user_admin === 0) {
374
+    if (isset($SETTINGS['allow_import']) === true && (int) $SETTINGS['allow_import'] === 1 && $session_user_admin === 0) {
375 375
         echo '
376 376
                     <li class="nav-item">
377 377
                         <a href="#" data-name="import" class="nav-link', $get['page'] === 'import' ? ' active' : '', '">
378 378
                         <i class="nav-icon fa-solid fa-file-import"></i>
379 379
                         <p>
380
-                            ' . $lang->get('import') . '
380
+                            ' . $lang->get('import').'
381 381
                         </p>
382 382
                         </a>
383 383
                     </li>';
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
                         <a href="#" data-name="export" class="nav-link', $get['page'] === 'export' ? ' active' : '', '">
399 399
                         <i class="nav-icon fa-solid fa-file-export"></i>
400 400
                         <p>
401
-                            ' . $lang->get('export') . '
401
+                            ' . $lang->get('export').'
402 402
                         </p>
403 403
                         </a>
404 404
                     </li>';
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
                         <a href="#" data-name="search" class="nav-link', $get['page'] === 'search' ? ' active' : '', '">
426 426
                         <i class="nav-icon fa-solid fa-search"></i>
427 427
                         <p>
428
-                            ' . $lang->get('find') . '
428
+                            ' . $lang->get('find').'
429 429
                         </p>
430 430
                         </a>
431 431
                     </li>';
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
                         <a href="#" data-name="favourites" class="nav-link', $get['page'] === 'admin' ? ' favourites' : '', '">
442 442
                         <i class="nav-icon fa-solid fa-star"></i>
443 443
                         <p>
444
-                            ' . $lang->get('favorites') . '
444
+                            ' . $lang->get('favorites').'
445 445
                         </p>
446 446
                         </a>
447 447
                     </li>';
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
                         <a href="#" data-name="suggestion" class="nav-link', $get['page'] === 'suggestion' ? ' active' : '', '">
472 472
                         <i class="nav-icon fa-solid fa-lightbulb"></i>
473 473
                         <p>
474
-                            ' . $lang->get('suggestion_menu') . '
474
+                            ' . $lang->get('suggestion_menu').'
475 475
                         </p>
476 476
                         </a>
477 477
                     </li>';
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
                         <a href="#" data-name="admin" class="nav-link', $get['page'] === 'admin' ? ' active' : '', '">
485 485
                         <i class="nav-icon fa-solid fa-info"></i>
486 486
                         <p>
487
-                            ' . $lang->get('admin_main') . '
487
+                            ' . $lang->get('admin_main').'
488 488
                         </p>
489 489
                         </a>
490 490
                     </li>
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
                         <a href="#" class="nav-link">
493 493
                             <i class="nav-icon fa-solid fa-wrench"></i>
494 494
                             <p>
495
-                                ' . $lang->get('admin_settings') . '
495
+                                ' . $lang->get('admin_settings').'
496 496
                                 <i class="fa-solid fa-angle-left right"></i>
497 497
                             </p>
498 498
                         </a>
@@ -500,55 +500,55 @@  discard block
 block discarded – undo
500 500
                             <li class="nav-item">
501 501
                                 <a href="#" data-name="options" class="nav-link', $get['page'] === 'options' ? ' active' : '', '">
502 502
                                     <i class="fa-solid fa-check-double nav-icon"></i>
503
-                                    <p>' . $lang->get('options') . '</p>
503
+                                    <p>' . $lang->get('options').'</p>
504 504
                                 </a>
505 505
                             </li>
506 506
                             <li class="nav-item">
507 507
                                 <a href="#" data-name="2fa" class="nav-link', $get['page'] === '2fa' ? ' active' : '', '">
508 508
                                     <i class="fa-solid fa-qrcode nav-icon"></i>
509
-                                    <p>' . $lang->get('mfa_short') . '</p>
509
+                                    <p>' . $lang->get('mfa_short').'</p>
510 510
                                 </a>
511 511
                             </li>
512 512
                             <li class="nav-item">
513 513
                                 <a href="#" data-name="api" class="nav-link', $get['page'] === 'api' ? ' active' : '', '">
514 514
                                     <i class="fa-solid fa-cubes nav-icon"></i>
515
-                                    <p>' . $lang->get('api') . '</p>
515
+                                    <p>' . $lang->get('api').'</p>
516 516
                                 </a>
517 517
                             </li>
518 518
                             <li class="nav-item">
519 519
                                 <a href="#" data-name="backups" class="nav-link', $get['page'] === 'backups' ? ' active' : '', '">
520 520
                                     <i class="fa-solid fa-database nav-icon"></i>
521
-                                    <p>' . $lang->get('backups') . '</p>
521
+                                    <p>' . $lang->get('backups').'</p>
522 522
                                 </a>
523 523
                             </li>
524 524
                             <li class="nav-item">
525 525
                                 <a href="#" data-name="emails" class="nav-link', $get['page'] === 'emails' ? ' active' : '', '">
526 526
                                     <i class="fa-solid fa-envelope nav-icon"></i>
527
-                                    <p>' . $lang->get('emails') . '</p>
527
+                                    <p>' . $lang->get('emails').'</p>
528 528
                                 </a>
529 529
                             </li>
530 530
                             <li class="nav-item">
531 531
                                 <a href="#" data-name="fields" class="nav-link', $get['page'] === 'fields' ? ' active' : '', '">
532 532
                                     <i class="fa-solid fa-keyboard nav-icon"></i>
533
-                                    <p>' . $lang->get('fields') . '</p>
533
+                                    <p>' . $lang->get('fields').'</p>
534 534
                                 </a>
535 535
                             </li>
536 536
                             <li class="nav-item">
537 537
                                 <a href="#" data-name="ldap" class="nav-link', $get['page'] === 'ldap' ? ' active' : '', '">
538 538
                                     <i class="fa-solid fa-id-card nav-icon"></i>
539
-                                    <p>' . $lang->get('ldap') . '</p>
539
+                                    <p>' . $lang->get('ldap').'</p>
540 540
                                 </a>
541 541
                             </li>
542 542
                             <li class="nav-item">
543 543
                                 <a href="#" data-name="uploads" class="nav-link', $get['page'] === 'uploads' ? ' active' : '', '">
544 544
                                     <i class="fa-solid fa-file-upload nav-icon"></i>
545
-                                    <p>' . $lang->get('uploads') . '</p>
545
+                                    <p>' . $lang->get('uploads').'</p>
546 546
                                 </a>
547 547
                             </li>
548 548
                             <li class="nav-item">
549 549
                                 <a href="#" data-name="statistics" class="nav-link', $get['page'] === 'statistics' ? ' active' : '', '">
550 550
                                     <i class="fa-solid fa-chart-bar nav-icon"></i>
551
-                                    <p>' . $lang->get('statistics') . '</p>
551
+                                    <p>' . $lang->get('statistics').'</p>
552 552
                                 </a>
553 553
                             </li>
554 554
                         </ul>
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
                     <li class="nav-item">
560 560
                         <a href="#" data-name="tasks" class="nav-link', $get['page'] === 'tasks' ? ' active' : '', '">
561 561
                         <i class="fa-solid fa-tasks nav-icon"></i>
562
-                        <p>' . $lang->get('tasks') . '</p>
562
+                        <p>' . $lang->get('tasks').'</p>
563 563
                         </a>
564 564
                     </li>';
565 565
                     }
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
                         <a href="#" data-name="folders" class="nav-link', $get['page'] === 'folders' ? ' active' : '', '">
576 576
                         <i class="nav-icon fa-solid fa-folder-open"></i>
577 577
                         <p>
578
-                            ' . $lang->get('folders') . '
578
+                            ' . $lang->get('folders').'
579 579
                         </p>
580 580
                         </a>
581 581
                     </li>
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
                         <a href="#" data-name="roles" class="nav-link', $get['page'] === 'roles' ? ' active' : '', '">
584 584
                         <i class="nav-icon fa-solid fa-graduation-cap"></i>
585 585
                         <p>
586
-                            ' . $lang->get('roles') . '
586
+                            ' . $lang->get('roles').'
587 587
                         </p>
588 588
                         </a>
589 589
                     </li>
@@ -591,38 +591,38 @@  discard block
 block discarded – undo
591 591
                         <a href="#" data-name="users" class="nav-link', $get['page'] === 'users' ? ' active' : '', '">
592 592
                         <i class="nav-icon fa-solid fa-users"></i>
593 593
                         <p>
594
-                            ' . $lang->get('users') . '
594
+                            ' . $lang->get('users').'
595 595
                         </p>
596 596
                         </a>
597 597
                     </li>
598 598
                     <li class="nav-item has-treeview', $menuUtilities === true ? ' menu-open' : '', '">
599 599
                         <a href="#" class="nav-link">
600 600
                         <i class="nav-icon fa-solid fa-cubes"></i>
601
-                        <p>' . $lang->get('admin_views') . '<i class="fa-solid fa-angle-left right"></i></p>
601
+                        <p>' . $lang->get('admin_views').'<i class="fa-solid fa-angle-left right"></i></p>
602 602
                         </a>
603 603
                         <ul class="nav nav-treeview">
604 604
                             <li class="nav-item">
605 605
                                 <a href="#" data-name="utilities.renewal" class="nav-link', $get['page'] === 'utilities.renewal' ? ' active' : '', '">
606 606
                                 <i class="far fa-calendar-alt nav-icon"></i>
607
-                                <p>' . $lang->get('renewal') . '</p>
607
+                                <p>' . $lang->get('renewal').'</p>
608 608
                                 </a>
609 609
                             </li>
610 610
                             <li class="nav-item">
611 611
                                 <a href="#" data-name="utilities.deletion" class="nav-link', $get['page'] === 'utilities.deletion' ? ' active' : '', '">
612 612
                                 <i class="fa-solid fa-trash-alt nav-icon"></i>
613
-                                <p>' . $lang->get('deletion') . '</p>
613
+                                <p>' . $lang->get('deletion').'</p>
614 614
                                 </a>
615 615
                             </li>
616 616
                             <li class="nav-item">
617 617
                                 <a href="#" data-name="utilities.logs" class="nav-link', $get['page'] === 'utilities.logs' ? ' active' : '', '">
618 618
                                 <i class="fa-solid fa-history nav-icon"></i>
619
-                                <p>' . $lang->get('logs') . '</p>
619
+                                <p>' . $lang->get('logs').'</p>
620 620
                                 </a>
621 621
                             </li>
622 622
                             <li class="nav-item">
623 623
                                 <a href="#" data-name="utilities.database" class="nav-link', $get['page'] === 'utilities.database' ? ' active' : '', '">
624 624
                                 <i class="fa-solid fa-database nav-icon"></i>
625
-                                <p>' . $lang->get('database') . '</p>
625
+                                <p>' . $lang->get('database').'</p>
626 626
                                 </a>
627 627
                             </li>
628 628
                         </ul>
@@ -633,10 +633,10 @@  discard block
 block discarded – undo
633 633
                     <!-- /.sidebar-menu -->
634 634
                 <div class="menu-footer">
635 635
                     <div class="" id="sidebar-footer">
636
-                        <i class="fa-solid fa-clock-o mr-2 infotip text-info pointer" title="<?php echo $lang->get('server_time') . ' ' .
637
-                            date($SETTINGS['date_format'], (int) $server['request_time']) . ' - ' .
636
+                        <i class="fa-solid fa-clock-o mr-2 infotip text-info pointer" title="<?php echo $lang->get('server_time').' '.
637
+                            date($SETTINGS['date_format'], (int) $server['request_time']).' - '.
638 638
                             date($SETTINGS['time_format'], (int) $server['request_time']); ?>"></i>
639
-                        <i class="fa-solid fa-users mr-2 infotip text-info pointer" title="<?php echo $session_nb_users_online . ' ' . $lang->get('users_online'); ?>"></i>
639
+                        <i class="fa-solid fa-users mr-2 infotip text-info pointer" title="<?php echo $session_nb_users_online.' '.$lang->get('users_online'); ?>"></i>
640 640
                         <a href="<?php echo DOCUMENTATION_URL; ?>" target="_blank" class="text-info"><i class="fa-solid fa-book mr-2 infotip" title="<?php echo $lang->get('documentation_canal'); ?>"></i></a>
641 641
                         <a href="<?php echo HELP_URL; ?>" target="_blank" class="text-info"><i class="fa-solid fa-life-ring mr-2 infotip" title="<?php echo $lang->get('admin_help'); ?>"></i></a>
642 642
                         <i class="fa-solid fa-bug infotip pointer text-info" title="<?php echo $lang->get('bugs_page'); ?>" onclick="generateBugReport()"></i>
@@ -940,18 +940,18 @@  discard block
 block discarded – undo
940 940
                     } elseif ($get['page'] === 'items') {
941 941
                         // SHow page with Items
942 942
                         if ((int) $session_user_admin !== 1) {
943
-                            include $SETTINGS['cpassman_dir'] . '/pages/items.php';
943
+                            include $SETTINGS['cpassman_dir'].'/pages/items.php';
944 944
                         } elseif ((int) $session_user_admin === 1) {
945
-                            include $SETTINGS['cpassman_dir'] . '/pages/admin.php';
945
+                            include $SETTINGS['cpassman_dir'].'/pages/admin.php';
946 946
                         } else {
947 947
                             $session->set('system-error_code', ERR_NOT_ALLOWED);
948 948
                             //not allowed page
949
-                            include $SETTINGS['cpassman_dir'] . '/error.php';
949
+                            include $SETTINGS['cpassman_dir'].'/error.php';
950 950
                         }
951 951
                     } elseif (in_array($get['page'], array_keys($mngPages)) === true) {
952 952
                         // Define if user is allowed to see management pages
953 953
                         if ($session_user_admin === 1) {
954
-                            include $SETTINGS['cpassman_dir'] . '/pages/' . $mngPages[$get['page']];
954
+                            include $SETTINGS['cpassman_dir'].'/pages/'.$mngPages[$get['page']];
955 955
                         } elseif ($session_user_manager === 1 || $session_user_human_resources === 1) {
956 956
                             if ($get['page'] !== 'manage_main'
957 957
                                 && $get['page'] !== 'manage_settings'
@@ -960,15 +960,15 @@  discard block
 block discarded – undo
960 960
                             } else {
961 961
                                 $session->set('system-error_code', ERR_NOT_ALLOWED);
962 962
                                 //not allowed page
963
-                                include $SETTINGS['cpassman_dir'] . '/error.php';
963
+                                include $SETTINGS['cpassman_dir'].'/error.php';
964 964
                             }
965 965
                         } else {
966 966
                             $session->set('system-error_code', ERR_NOT_ALLOWED);
967 967
                             //not allowed page
968
-                            include $SETTINGS['cpassman_dir'] . '/error.php';
968
+                            include $SETTINGS['cpassman_dir'].'/error.php';
969 969
                         }
970 970
                     } elseif (empty($get['page']) === false) {
971
-                        include $SETTINGS['cpassman_dir'] . '/pages/' . $get['page'] . '.php';
971
+                        include $SETTINGS['cpassman_dir'].'/pages/'.$get['page'].'.php';
972 972
                     } else {
973 973
                         $session->set('system-array_roles', ERR_NOT_EXIST);
974 974
                         //page doesn't exist
@@ -1017,7 +1017,7 @@  discard block
 block discarded – undo
1017 1017
         echo '
1018 1018
 <input type="hidden" id="temps_restant" value="', $session->get('user-session_duration') ?? '', '" />';
1019 1019
 // display an item in the context of OTV link
1020
-} elseif ((null === $session->get('user-validite_pw')|| empty($session->get('user-validite_pw')) === true || empty($session->get('user-id')) === true)
1020
+} elseif ((null === $session->get('user-validite_pw') || empty($session->get('user-validite_pw')) === true || empty($session->get('user-id')) === true)
1021 1021
     && empty($get['otv']) === false
1022 1022
 ) {
1023 1023
     // case where one-shot viewer
@@ -1036,7 +1036,7 @@  discard block
 block discarded – undo
1036 1036
                 FILTER_SANITIZE_URL
1037 1037
             )
1038 1038
         );
1039
-        include $SETTINGS['cpassman_dir'] . '/error.php';
1039
+        include $SETTINGS['cpassman_dir'].'/error.php';
1040 1040
     }
1041 1041
 } elseif (//(empty($session->get('user-id')) === false && $session->get('user-id') !== null) ||
1042 1042
         empty($session->get('user-id')) === true
@@ -1071,7 +1071,7 @@  discard block
 block discarded – undo
1071 1071
     //session_regenerate_id(true);
1072 1072
     error_log('index.php L1069');
1073 1073
     // LOGIN form
1074
-    include $SETTINGS['cpassman_dir'] . '/includes/core/login.php';
1074
+    include $SETTINGS['cpassman_dir'].'/includes/core/login.php';
1075 1075
 } else {
1076 1076
     // Clear session
1077 1077
     error_log('index.php L1074');
@@ -1291,61 +1291,61 @@  discard block
 block discarded – undo
1291 1291
 
1292 1292
 // Load links, css and javascripts
1293 1293
 if (isset($SETTINGS['cpassman_dir']) === true) {
1294
-    include_once $SETTINGS['cpassman_dir'] . '/includes/core/load.js.php';
1294
+    include_once $SETTINGS['cpassman_dir'].'/includes/core/load.js.php';
1295 1295
     if ($menuAdmin === true) {
1296
-        include_once $SETTINGS['cpassman_dir'] . '/pages/admin.js.php';
1296
+        include_once $SETTINGS['cpassman_dir'].'/pages/admin.js.php';
1297 1297
         if ($get['page'] === '2fa') {
1298
-            include_once $SETTINGS['cpassman_dir'] . '/pages/2fa.js.php';
1298
+            include_once $SETTINGS['cpassman_dir'].'/pages/2fa.js.php';
1299 1299
         } elseif ($get['page'] === 'api') {
1300
-            include_once $SETTINGS['cpassman_dir'] . '/pages/api.js.php';
1300
+            include_once $SETTINGS['cpassman_dir'].'/pages/api.js.php';
1301 1301
         } elseif ($get['page'] === 'backups') {
1302
-            include_once $SETTINGS['cpassman_dir'] . '/pages/backups.js.php';
1302
+            include_once $SETTINGS['cpassman_dir'].'/pages/backups.js.php';
1303 1303
         } elseif ($get['page'] === 'emails') {
1304
-            include_once $SETTINGS['cpassman_dir'] . '/pages/emails.js.php';
1304
+            include_once $SETTINGS['cpassman_dir'].'/pages/emails.js.php';
1305 1305
         } elseif ($get['page'] === 'ldap') {
1306
-            include_once $SETTINGS['cpassman_dir'] . '/pages/ldap.js.php';
1306
+            include_once $SETTINGS['cpassman_dir'].'/pages/ldap.js.php';
1307 1307
         } elseif ($get['page'] === 'uploads') {
1308
-            include_once $SETTINGS['cpassman_dir'] . '/pages/uploads.js.php';
1308
+            include_once $SETTINGS['cpassman_dir'].'/pages/uploads.js.php';
1309 1309
         } elseif ($get['page'] === 'fields') {
1310
-            include_once $SETTINGS['cpassman_dir'] . '/pages/fields.js.php';
1310
+            include_once $SETTINGS['cpassman_dir'].'/pages/fields.js.php';
1311 1311
         } elseif ($get['page'] === 'options') {
1312
-            include_once $SETTINGS['cpassman_dir'] . '/pages/options.js.php';
1312
+            include_once $SETTINGS['cpassman_dir'].'/pages/options.js.php';
1313 1313
         } elseif ($get['page'] === 'statistics') {
1314
-            include_once $SETTINGS['cpassman_dir'] . '/pages/statistics.js.php';
1314
+            include_once $SETTINGS['cpassman_dir'].'/pages/statistics.js.php';
1315 1315
         } elseif ($get['page'] === 'tasks') {
1316
-            include_once $SETTINGS['cpassman_dir'] . '/pages/tasks.js.php';
1316
+            include_once $SETTINGS['cpassman_dir'].'/pages/tasks.js.php';
1317 1317
         }
1318 1318
     } elseif (isset($get['page']) === true && $get['page'] !== '') {
1319 1319
         if ($get['page'] === 'items') {
1320
-            include_once $SETTINGS['cpassman_dir'] . '/pages/items.js.php';
1320
+            include_once $SETTINGS['cpassman_dir'].'/pages/items.js.php';
1321 1321
         } elseif ($get['page'] === 'import') {
1322
-            include_once $SETTINGS['cpassman_dir'] . '/pages/import.js.php';
1322
+            include_once $SETTINGS['cpassman_dir'].'/pages/import.js.php';
1323 1323
         } elseif ($get['page'] === 'export') {
1324
-            include_once $SETTINGS['cpassman_dir'] . '/pages/export.js.php';
1324
+            include_once $SETTINGS['cpassman_dir'].'/pages/export.js.php';
1325 1325
         } elseif ($get['page'] === 'offline') {
1326
-            include_once $SETTINGS['cpassman_dir'] . '/pages/offline.js.php';
1326
+            include_once $SETTINGS['cpassman_dir'].'/pages/offline.js.php';
1327 1327
         } elseif ($get['page'] === 'search') {
1328
-            include_once $SETTINGS['cpassman_dir'] . '/pages/search.js.php';
1328
+            include_once $SETTINGS['cpassman_dir'].'/pages/search.js.php';
1329 1329
         } elseif ($get['page'] === 'profile') {
1330
-            include_once $SETTINGS['cpassman_dir'] . '/pages/profile.js.php';
1330
+            include_once $SETTINGS['cpassman_dir'].'/pages/profile.js.php';
1331 1331
         } elseif ($get['page'] === 'favourites') {
1332
-            include_once $SETTINGS['cpassman_dir'] . '/pages/favorites.js.php';
1332
+            include_once $SETTINGS['cpassman_dir'].'/pages/favorites.js.php';
1333 1333
         } elseif ($get['page'] === 'folders') {
1334
-            include_once $SETTINGS['cpassman_dir'] . '/pages/folders.js.php';
1334
+            include_once $SETTINGS['cpassman_dir'].'/pages/folders.js.php';
1335 1335
         } elseif ($get['page'] === 'users') {
1336
-            include_once $SETTINGS['cpassman_dir'] . '/pages/users.js.php';
1336
+            include_once $SETTINGS['cpassman_dir'].'/pages/users.js.php';
1337 1337
         } elseif ($get['page'] === 'roles') {
1338
-            include_once $SETTINGS['cpassman_dir'] . '/pages/roles.js.php';
1338
+            include_once $SETTINGS['cpassman_dir'].'/pages/roles.js.php';
1339 1339
         } elseif ($get['page'] === 'utilities.deletion') {
1340
-            include_once $SETTINGS['cpassman_dir'] . '/pages/utilities.deletion.js.php';
1340
+            include_once $SETTINGS['cpassman_dir'].'/pages/utilities.deletion.js.php';
1341 1341
         } elseif ($get['page'] === 'utilities.logs') {
1342
-            include_once $SETTINGS['cpassman_dir'] . '/pages/utilities.logs.js.php';
1342
+            include_once $SETTINGS['cpassman_dir'].'/pages/utilities.logs.js.php';
1343 1343
         } elseif ($get['page'] === 'utilities.database') {
1344
-            include_once $SETTINGS['cpassman_dir'] . '/pages/utilities.database.js.php';
1344
+            include_once $SETTINGS['cpassman_dir'].'/pages/utilities.database.js.php';
1345 1345
         } elseif ($get['page'] === 'utilities.renewal') {
1346
-            include_once $SETTINGS['cpassman_dir'] . '/pages/utilities.renewal.js.php';
1346
+            include_once $SETTINGS['cpassman_dir'].'/pages/utilities.renewal.js.php';
1347 1347
         }
1348 1348
     } else {
1349
-        include_once $SETTINGS['cpassman_dir'] . '/includes/core/login.js.php';
1349
+        include_once $SETTINGS['cpassman_dir'].'/includes/core/login.js.php';
1350 1350
     }
1351 1351
 }
Please login to merge, or discard this patch.
sources/users.datatable.php 1 patch
Spacing   +12 added lines, -14 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 ) {
73 73
     // Not allowed page
74 74
     $session->set('system-error_code', ERR_NOT_ALLOWED);
75
-    include $SETTINGS['cpassman_dir'] . '/error.php';
75
+    include $SETTINGS['cpassman_dir'].'/error.php';
76 76
     exit;
77 77
 }
78 78
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
     if (isset($order['column']) && preg_match('#^(asc|desc)$#i', $order['dir'])) {
120 120
         $columnIndex = filter_var($order['column'], FILTER_SANITIZE_NUMBER_INT);
121 121
         $dir = filter_var($order['dir'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
122
-        $sOrder .= $aColumns[$columnIndex] . ' ' . $dir . ', ';
122
+        $sOrder .= $aColumns[$columnIndex].' '.$dir.', ';
123 123
     }
124 124
 
125 125
     $sOrder = substr_replace($sOrder, '', -2);
@@ -143,15 +143,15 @@  discard block
 block discarded – undo
143 143
 
144 144
 if ($letter !== '' && $letter !== 'None') {
145 145
     $sWhere .= ' AND (';
146
-    $sWhere .= $aColumns[1] . " LIKE '" . $letter . "%' OR ";
147
-    $sWhere .= $aColumns[2] . " LIKE '" . $letter . "%' OR ";
148
-    $sWhere .= $aColumns[3] . " LIKE '" . $letter . "%' ";
146
+    $sWhere .= $aColumns[1]." LIKE '".$letter."%' OR ";
147
+    $sWhere .= $aColumns[2]." LIKE '".$letter."%' OR ";
148
+    $sWhere .= $aColumns[3]." LIKE '".$letter."%' ";
149 149
     $sWhere .= ')';
150 150
 } elseif ($searchValue !== '') {
151 151
     $sWhere .= ' AND (';
152
-    $sWhere .= $aColumns[1] . " LIKE '" . $searchValue . "%' OR ";
153
-    $sWhere .= $aColumns[2] . " LIKE '" . $searchValue . "%' OR ";
154
-    $sWhere .= $aColumns[3] . " LIKE '" . $searchValue . "%' ";
152
+    $sWhere .= $aColumns[1]." LIKE '".$searchValue."%' OR ";
153
+    $sWhere .= $aColumns[2]." LIKE '".$searchValue."%' OR ";
154
+    $sWhere .= $aColumns[3]." LIKE '".$searchValue."%' ";
155 155
     $sWhere .= ')';
156 156
 }
157 157
 
@@ -239,22 +239,20 @@  discard block
 block discarded – undo
239 239
 
240 240
         // Get some infos about user
241 241
         $userDisplayInfos = 
242
-            (isset($userDate['date']) ? '<i class=\"fas fa-calendar-day infotip text-info ml-2\" title=\"'.$lang->get('creation_date').': '.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $userDate['date']).'\"></i>' : '')
242
+            (isset($userDate['date']) ? '<i class=\"fas fa-calendar-day infotip text-info ml-2\" title=\"'.$lang->get('creation_date').': '.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $userDate['date']).'\"></i>' : '')
243 243
             .
244 244
             ((int) $record['last_connexion'] > 0 ? '<i class=\"far fa-clock infotip text-info ml-2\" title=\"'.$lang->get('index_last_seen').": ".
245
-            date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['last_connexion']).'\"></i>' : '')
245
+            date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['last_connexion']).'\"></i>' : '')
246 246
             .
247 247
             ((int) $record['user_ip'] > 0 ? '<i class=\"fas fa-street-view infotip text-info ml-1\" title=\"'.$lang->get('ip').": ".($record['user_ip']).'\"></i>' : '')
248 248
             .
249 249
             ($record['auth_type'] === 'ldap' ? '<i class=\"far fa-address-book infotip text-warning ml-1\" title=\"'.$lang->get('managed_through_ad').'\"></i>' : '')
250 250
             .
251 251
             ((in_array($record['id'], [OTV_USER_ID, TP_USER_ID, SSH_USER_ID, API_USER_ID]) === false && (int) $record['admin'] !== 1 && ((int) $SETTINGS['duo'] === 1 || (int) $SETTINGS['google_authentication'] === 1)) ?
252
-                ((int) $record['mfa_enabled'] === 1 ? '' : '<i class=\"fa-solid fa-fingerprint infotip ml-1\" style=\"color:Tomato\" title=\"'.$lang->get('mfa_disabled_for_user').'\"></i>') :
253
-                ''
252
+                ((int) $record['mfa_enabled'] === 1 ? '' : '<i class=\"fa-solid fa-fingerprint infotip ml-1\" style=\"color:Tomato\" title=\"'.$lang->get('mfa_disabled_for_user').'\"></i>') : ''
254 253
             ).
255 254
             ((in_array($record['id'], [OTV_USER_ID, TP_USER_ID, SSH_USER_ID, API_USER_ID]) === false && (int) $record['admin'] !== 1 && is_null($record['keys_recovery_time']) === true) ? 
256
-                '<i class=\"fa-solid fa-download infotip ml-1\" style=\"color:Tomato\" title=\"'.$lang->get('recovery_keys_not_downloaded').'\"></i>' :
257
-                ''
255
+                '<i class=\"fa-solid fa-download infotip ml-1\" style=\"color:Tomato\" title=\"'.$lang->get('recovery_keys_not_downloaded').'\"></i>' : ''
258 256
             );
259 257
         
260 258
         $sOutput .= '["<span data-id=\"'.$record['id'].'\" data-fullname=\"'.
Please login to merge, or discard this patch.
sources/expired.datatables.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 ) {
74 74
     // Not allowed page
75 75
     $session->set('system-error_code', ERR_NOT_ALLOWED);
76
-    include $SETTINGS['cpassman_dir'] . '/error.php';
76
+    include $SETTINGS['cpassman_dir'].'/error.php';
77 77
     exit;
78 78
 }
79 79
 
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 // Is a date sent?
99 99
 $dateCriteria = $request->query->get('dateCriteria');
100 100
 if ($dateCriteria !== null && !empty($dateCriteria)) {
101
-    $sWhere .= ' AND a.del_value < ' . round(filter_var($dateCriteria, FILTER_SANITIZE_NUMBER_INT) / 1000, 0);
101
+    $sWhere .= ' AND a.del_value < '.round(filter_var($dateCriteria, FILTER_SANITIZE_NUMBER_INT) / 1000, 0);
102 102
 }
103 103
 //echo $sWhere;
104 104
 /* BUILD QUERY */
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 $start = $request->query->getInt('start', 0);
108 108
 $length = $request->query->getInt('length', -1);
109 109
 if ($length !== -1) {
110
-    $sLimit = ' LIMIT ' . $start . ', ' . $length;
110
+    $sLimit = ' LIMIT '.$start.', '.$length;
111 111
 }
112 112
 
113 113
 //Ordering
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
         $columnIndex = filter_var($order[0]['column'], FILTER_SANITIZE_NUMBER_INT);
121 121
 
122 122
         if (array_key_exists($columnIndex, $aColumns)) {
123
-            $sOrder .= $aColumns[$columnIndex] . ' ' . $order[0]['dir'];
123
+            $sOrder .= $aColumns[$columnIndex].' '.$order[0]['dir'];
124 124
         }
125 125
 
126 126
         // Supprimez la virgule finale si elle existe
@@ -145,9 +145,9 @@  discard block
 block discarded – undo
145 145
 
146 146
     if ($letter !== '' && $letter !== 'None') {
147 147
         $sWhere .= ' AND ';
148
-        $sWhere .= $aColumns[1] . " LIKE '" . $letter . "%' OR ";
149
-        $sWhere .= $aColumns[2] . " LIKE '" . $letter . "%' OR ";
150
-        $sWhere .= $aColumns[3] . " LIKE '" . $letter . "%' ";
148
+        $sWhere .= $aColumns[1]." LIKE '".$letter."%' OR ";
149
+        $sWhere .= $aColumns[2]." LIKE '".$letter."%' OR ";
150
+        $sWhere .= $aColumns[3]." LIKE '".$letter."%' ";
151 151
     }
152 152
 }
153 153
 
@@ -159,26 +159,26 @@  discard block
 block discarded – undo
159 159
 
160 160
         if ($searchValue !== '') {
161 161
             $sWhere = ' AND ';
162
-            $sWhere .= $aColumns[1] . " LIKE '" . $searchValue . "%' OR ";
163
-            $sWhere .= $aColumns[2] . " LIKE '" . $searchValue . "%' OR ";
164
-            $sWhere .= $aColumns[3] . " LIKE '" . $searchValue . "%' ";
162
+            $sWhere .= $aColumns[1]." LIKE '".$searchValue."%' OR ";
163
+            $sWhere .= $aColumns[2]." LIKE '".$searchValue."%' OR ";
164
+            $sWhere .= $aColumns[3]." LIKE '".$searchValue."%' ";
165 165
         }
166 166
     }
167 167
 }
168 168
 
169 169
 $rows = DB::query(
170 170
     'SELECT a.item_id, i.label, a.del_value, i.id_tree
171
-    FROM ' . prefixTable('automatic_del') . ' AS a
172
-    INNER JOIN ' . prefixTable('items') . ' AS i ON (i.id = a.item_id)' .
171
+    FROM ' . prefixTable('automatic_del').' AS a
172
+    INNER JOIN ' . prefixTable('items').' AS i ON (i.id = a.item_id)'.
173 173
     $sWhere.
174 174
     (string) $sOrder
175 175
 );
176 176
 $iTotal = DB::count();
177 177
 $rows = DB::query(
178 178
     'SELECT a.item_id, i.label, a.del_value, i.id_tree
179
-    FROM ' . prefixTable('automatic_del') . ' AS a
180
-    INNER JOIN ' . prefixTable('items') . ' AS i ON (i.id = a.item_id)' .
181
-        $sWhere .
179
+    FROM ' . prefixTable('automatic_del').' AS a
180
+    INNER JOIN ' . prefixTable('items').' AS i ON (i.id = a.item_id)'.
181
+        $sWhere.
182 182
         $sLimit
183 183
 );
184 184
 $iFilteredTotal = DB::count();
@@ -196,18 +196,18 @@  discard block
 block discarded – undo
196 196
     // start the line
197 197
     $sOutput .= '[';
198 198
     // Column 1
199
-    $sOutput .= '"<i class=\"fas fa-external-link-alt pointer text-primary mr-2\" onclick=\"showItemCard($(this))\" data-item-id=\"' . $record['item_id'] . '\"  data-item-tree-id=\"' . $record['id_tree'] . '\"></i>", ';
199
+    $sOutput .= '"<i class=\"fas fa-external-link-alt pointer text-primary mr-2\" onclick=\"showItemCard($(this))\" data-item-id=\"'.$record['item_id'].'\"  data-item-tree-id=\"'.$record['id_tree'].'\"></i>", ';
200 200
     // Column 2
201
-    $sOutput .= '"' . $record['label'] . '", ';
201
+    $sOutput .= '"'.$record['label'].'", ';
202 202
     // Column 3
203
-    $sOutput .= '"' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['del_value']) . '", ';
203
+    $sOutput .= '"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['del_value']).'", ';
204 204
     // Column 4
205 205
     $path = [];
206 206
     $treeDesc = $tree->getPath($record['id_tree'], true);
207 207
     foreach ($treeDesc as $t) {
208 208
         array_push($path, $t->title);
209 209
     }
210
-    $sOutput .= '"' . implode('<i class=\"fas fa-angle-right ml-1 mr-1\"></i>', $path) . '"],';
210
+    $sOutput .= '"'.implode('<i class=\"fas fa-angle-right ml-1 mr-1\"></i>', $path).'"],';
211 211
 }
212 212
 
213 213
 if ($iTotal > 0) {
@@ -220,4 +220,4 @@  discard block
 block discarded – undo
220 220
 }
221 221
 
222 222
 // finalize output
223
-echo '{"recordsTotal": ' . $iTotal . ', "recordsFiltered": ' . $iFilteredTotal . ', "data": ' . $sOutput;
223
+echo '{"recordsTotal": '.$iTotal.', "recordsFiltered": '.$iFilteredTotal.', "data": '.$sOutput;
Please login to merge, or discard this patch.
sources/logs.datatables.php 1 patch
Spacing   +65 added lines, -66 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 ) {
72 72
     // Not allowed page
73 73
     $session->set('system-error_code', ERR_NOT_ALLOWED);
74
-    include $SETTINGS['cpassman_dir'] . '/error.php';
74
+    include $SETTINGS['cpassman_dir'].'/error.php';
75 75
     exit;
76 76
 }
77 77
 
@@ -115,9 +115,9 @@  discard block
 block discarded – undo
115 115
 
116 116
             $columnIndex = filter_var($order['column'], FILTER_SANITIZE_NUMBER_INT);
117 117
             $dir = filter_var($order['dir'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
118
-            $sOrder = 'ORDER BY ' . $aColumns[$columnIndex] . ' ' . $dir . ' ';
118
+            $sOrder = 'ORDER BY '.$aColumns[$columnIndex].' '.$dir.' ';
119 119
         } else {
120
-            $sOrder = 'ORDER BY ' . $aColumns[0] . ' DESC';
120
+            $sOrder = 'ORDER BY '.$aColumns[0].' DESC';
121 121
         }
122 122
     }
123 123
 
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
         if ($searchValue !== '') {
129 129
             $sWhere .= ' AND (';
130 130
             foreach ($aColumns as $column) {
131
-                $sWhere .= $column . " LIKE '%" . $searchValue . "%' OR ";
131
+                $sWhere .= $column." LIKE '%".$searchValue."%' OR ";
132 132
             }
133
-            $sWhere = substr_replace($sWhere, '', -3) . ')';
133
+            $sWhere = substr_replace($sWhere, '', -3).')';
134 134
         }
135 135
     }
136 136
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
            * Output
156 156
         */
157 157
     $sOutput = '{';
158
-    $sOutput .= '"sEcho": '. (int) $request->query->get('draw') . ', ';
158
+    $sOutput .= '"sEcho": '.(int) $request->query->get('draw').', ';
159 159
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
160 160
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
161 161
     $sOutput .= '"aaData": ';
@@ -194,9 +194,9 @@  discard block
 block discarded – undo
194 194
 
195 195
         $columnIndex = filter_var($order['column'], FILTER_SANITIZE_NUMBER_INT);
196 196
         $dir = filter_var($order['dir'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
197
-        $sOrder = 'ORDER BY ' . $aColumns[$columnIndex] . ' ' . $dir . ' ';
197
+        $sOrder = 'ORDER BY '.$aColumns[$columnIndex].' '.$dir.' ';
198 198
     } else {
199
-        $sOrder = 'ORDER BY ' . $aColumns[0] . ' DESC';
199
+        $sOrder = 'ORDER BY '.$aColumns[0].' DESC';
200 200
     }
201 201
 
202 202
     // Filtering
@@ -205,9 +205,9 @@  discard block
 block discarded – undo
205 205
     if ($sSearch !== '') {
206 206
         $sWhere .= ' AND (';
207 207
         foreach ($aColumns as $i => $column) {
208
-            $sWhere .= $column . " LIKE '%". filter_var($sSearch, FILTER_SANITIZE_FULL_SPECIAL_CHARS) . "%' OR ";
208
+            $sWhere .= $column." LIKE '%".filter_var($sSearch, FILTER_SANITIZE_FULL_SPECIAL_CHARS)."%' OR ";
209 209
         }
210
-        $sWhere = substr_replace($sWhere, '', -3) . ')';
210
+        $sWhere = substr_replace($sWhere, '', -3).')';
211 211
     }
212 212
 
213 213
     $iTotal = DB::queryFirstField(
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
     $iFilteredTotal = DB::count();
231 231
     // Output
232 232
     $sOutput = '{';
233
-    $sOutput .= '"sEcho": '. (int) $request->query->get('draw') . ', ';
233
+    $sOutput .= '"sEcho": '.(int) $request->query->get('draw').', ';
234 234
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
235 235
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
236 236
     $sOutput .= '"aaData": ';
@@ -269,9 +269,9 @@  discard block
 block discarded – undo
269 269
 
270 270
         $columnIndex = filter_var($order['column'], FILTER_SANITIZE_NUMBER_INT);
271 271
         $dir = filter_var($order['dir'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
272
-        $sOrder = 'ORDER BY ' . $aColumns[$columnIndex] . ' ' . $dir . ' ';
272
+        $sOrder = 'ORDER BY '.$aColumns[$columnIndex].' '.$dir.' ';
273 273
     } else {
274
-        $sOrder = 'ORDER BY ' . $aColumns[0] . ' DESC';
274
+        $sOrder = 'ORDER BY '.$aColumns[0].' DESC';
275 275
     }
276 276
 
277 277
     // Filtering
@@ -280,9 +280,9 @@  discard block
 block discarded – undo
280 280
     if ($searchValue !== '') {
281 281
         $sWhere .= ' AND (';
282 282
         foreach ($aColumns as $column) {
283
-            $sWhere .= $column . " LIKE '%" . filter_var($searchValue, FILTER_SANITIZE_FULL_SPECIAL_CHARS) . "%' OR ";
283
+            $sWhere .= $column." LIKE '%".filter_var($searchValue, FILTER_SANITIZE_FULL_SPECIAL_CHARS)."%' OR ";
284 284
         }
285
-        $sWhere = substr_replace($sWhere, '', -3) . ')';
285
+        $sWhere = substr_replace($sWhere, '', -3).')';
286 286
     }
287 287
 
288 288
     $iTotal = DB::queryFirstField(
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
     $iFilteredTotal = DB::count();
306 306
     // Output
307 307
     $sOutput = '{';
308
-    $sOutput .= '"sEcho": '. (int) $request->query->get('draw') . ', ';
308
+    $sOutput .= '"sEcho": '.(int) $request->query->get('draw').', ';
309 309
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
310 310
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
311 311
     $sOutput .= '"aaData": ';
@@ -344,9 +344,9 @@  discard block
 block discarded – undo
344 344
         
345 345
         $columnIndex = filter_var($order['column'], FILTER_SANITIZE_NUMBER_INT);
346 346
         $dir = filter_var($order['dir'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
347
-        $sOrder = 'ORDER BY ' . $aColumns[$columnIndex] . ' ' . $dir . ' ';
347
+        $sOrder = 'ORDER BY '.$aColumns[$columnIndex].' '.$dir.' ';
348 348
     } else {
349
-        $sOrder = 'ORDER BY ' . $aColumns[0] . ' DESC';
349
+        $sOrder = 'ORDER BY '.$aColumns[0].' DESC';
350 350
     }
351 351
 
352 352
     // Filtering
@@ -355,9 +355,9 @@  discard block
 block discarded – undo
355 355
     if ($searchValue !== '') {
356 356
         $sWhere .= ' AND (';
357 357
         foreach ($aColumns as $column) {
358
-            $sWhere .= $column . " LIKE '%" . filter_var($searchValue, FILTER_SANITIZE_FULL_SPECIAL_CHARS) . "%' OR ";
358
+            $sWhere .= $column." LIKE '%".filter_var($searchValue, FILTER_SANITIZE_FULL_SPECIAL_CHARS)."%' OR ";
359 359
         }
360
-        $sWhere = substr_replace($sWhere, '', -3) . ')';
360
+        $sWhere = substr_replace($sWhere, '', -3).')';
361 361
     }
362 362
 
363 363
     $iTotal = DB::queryFirstField(
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
          * Output
380 380
         */
381 381
     $sOutput = '{';
382
-    $sOutput .= '"sEcho": '. (int) $request->query->get('draw') . ', ';
382
+    $sOutput .= '"sEcho": '.(int) $request->query->get('draw').', ';
383 383
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
384 384
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
385 385
     $sOutput .= '"aaData": [ ';
@@ -447,9 +447,9 @@  discard block
 block discarded – undo
447 447
 
448 448
         $columnIndex = filter_var($order['column'], FILTER_SANITIZE_NUMBER_INT);
449 449
         $dir = filter_var($order['dir'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
450
-        $sOrder = 'ORDER BY ' . $aColumns[$columnIndex] . ' ' . $dir . ' ';
450
+        $sOrder = 'ORDER BY '.$aColumns[$columnIndex].' '.$dir.' ';
451 451
     } else {
452
-        $sOrder = 'ORDER BY ' . $aColumns[0] . ' DESC';
452
+        $sOrder = 'ORDER BY '.$aColumns[0].' DESC';
453 453
     }
454 454
 
455 455
     // Filtering
@@ -459,12 +459,12 @@  discard block
 block discarded – undo
459 459
     if ($searchValue !== '') {
460 460
         $sWhere .= ' WHERE (';
461 461
         if (isset($search['column']) && $search['column'] !== 'all') {
462
-            $sWhere .= $search['column'] . " LIKE '%" . filter_var($searchValue, FILTER_SANITIZE_FULL_SPECIAL_CHARS) . "%') ";
462
+            $sWhere .= $search['column']." LIKE '%".filter_var($searchValue, FILTER_SANITIZE_FULL_SPECIAL_CHARS)."%') ";
463 463
         } else {
464 464
             foreach ($aColumns as $column) {
465
-                $sWhere .= $column . " LIKE '%" . filter_var($searchValue, FILTER_SANITIZE_FULL_SPECIAL_CHARS) . "%' OR ";
465
+                $sWhere .= $column." LIKE '%".filter_var($searchValue, FILTER_SANITIZE_FULL_SPECIAL_CHARS)."%' OR ";
466 466
             }
467
-            $sWhere = substr($sWhere, 0, -3) . ') ';
467
+            $sWhere = substr($sWhere, 0, -3).') ';
468 468
         }
469 469
     }
470 470
     
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
     $iFilteredTotal = DB::count();
494 494
     // Output
495 495
     $sOutput = '{';
496
-    $sOutput .= '"sEcho": '. (int) $request->query->get('draw') . ', ';
496
+    $sOutput .= '"sEcho": '.(int) $request->query->get('draw').', ';
497 497
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
498 498
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
499 499
     $sOutput .= '"aaData": [ ';
@@ -542,9 +542,9 @@  discard block
 block discarded – undo
542 542
 
543 543
         $columnIndex = filter_var($order['column'], FILTER_SANITIZE_NUMBER_INT);
544 544
         $dir = filter_var($order['dir'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
545
-        $sOrder = 'ORDER BY ' . $aColumns[$columnIndex] . ' ' . $dir . ' ';
545
+        $sOrder = 'ORDER BY '.$aColumns[$columnIndex].' '.$dir.' ';
546 546
     } else {
547
-        $sOrder = 'ORDER BY ' . $aColumns[0] . ' DESC';
547
+        $sOrder = 'ORDER BY '.$aColumns[0].' DESC';
548 548
     }
549 549
 
550 550
     // Filtering
@@ -553,9 +553,9 @@  discard block
 block discarded – undo
553 553
     if ($searchValue !== '') {
554 554
         $sWhere .= ' AND (';
555 555
         foreach ($aColumns as $column) {
556
-            $sWhere .= $column . " LIKE '%" . filter_var($searchValue, FILTER_SANITIZE_FULL_SPECIAL_CHARS) . "%' OR ";
556
+            $sWhere .= $column." LIKE '%".filter_var($searchValue, FILTER_SANITIZE_FULL_SPECIAL_CHARS)."%' OR ";
557 557
         }
558
-        $sWhere = substr_replace($sWhere, '', -3) . ')';
558
+        $sWhere = substr_replace($sWhere, '', -3).')';
559 559
     }
560 560
 
561 561
     $iTotal = DB::queryFirstField(
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
         $iTotal = 0;
577 577
     }
578 578
     $sOutput = '{';
579
-    $sOutput .= '"sEcho": '. (int) $request->query->get('draw') . ', ';
579
+    $sOutput .= '"sEcho": '.(int) $request->query->get('draw').', ';
580 580
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
581 581
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
582 582
     $sOutput .= '"aaData": ';
@@ -618,9 +618,9 @@  discard block
 block discarded – undo
618 618
 
619 619
         $columnIndex = filter_var($order['column'], FILTER_SANITIZE_NUMBER_INT);
620 620
         $dir = filter_var($order['dir'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
621
-        $sOrder = 'ORDER BY ' . $aColumns[$columnIndex] . ' ' . $dir . ' ';
621
+        $sOrder = 'ORDER BY '.$aColumns[$columnIndex].' '.$dir.' ';
622 622
     } else {
623
-        $sOrder = 'ORDER BY ' . $aColumns[0] . ' DESC';
623
+        $sOrder = 'ORDER BY '.$aColumns[0].' DESC';
624 624
     }
625 625
 
626 626
     // Filtering
@@ -629,9 +629,9 @@  discard block
 block discarded – undo
629 629
     if ($searchValue !== '') {
630 630
         $sWhere .= ' AND (';
631 631
         foreach ($aColumns as $column) {
632
-            $sWhere .= $column . " LIKE '%" . filter_var($searchValue, FILTER_SANITIZE_FULL_SPECIAL_CHARS) . "%' OR ";
632
+            $sWhere .= $column." LIKE '%".filter_var($searchValue, FILTER_SANITIZE_FULL_SPECIAL_CHARS)."%' OR ";
633 633
         }
634
-        $sWhere = substr_replace($sWhere, '', -3) . ')';
634
+        $sWhere = substr_replace($sWhere, '', -3).')';
635 635
     }
636 636
 
637 637
     $iTotal = DB::queryFirstField(
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
     $iFilteredTotal = DB::count();
654 654
     // Output
655 655
     $sOutput = '{';
656
-    $sOutput .= '"sEcho": '. (int) $request->query->get('draw') . ', ';
656
+    $sOutput .= '"sEcho": '.(int) $request->query->get('draw').', ';
657 657
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
658 658
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
659 659
     $sOutput .= '"aaData": ';
@@ -690,9 +690,9 @@  discard block
 block discarded – undo
690 690
 
691 691
         $columnIndex = filter_var($order['column'], FILTER_SANITIZE_NUMBER_INT);
692 692
         $dir = filter_var($order['dir'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
693
-        $sOrder = 'ORDER BY ' . $aColumns[$columnIndex] . ' ' . $dir . ' ';
693
+        $sOrder = 'ORDER BY '.$aColumns[$columnIndex].' '.$dir.' ';
694 694
     } else {
695
-        $sOrder = 'ORDER BY ' . $aColumns[0] . ' DESC';
695
+        $sOrder = 'ORDER BY '.$aColumns[0].' DESC';
696 696
     }
697 697
 
698 698
     // Filtering
@@ -701,9 +701,9 @@  discard block
 block discarded – undo
701 701
     if ($searchValue !== '') {
702 702
         $sWhere = ' WHERE (';
703 703
         foreach ($aColumns as $column) {
704
-            $sWhere .= $column . " LIKE '%" . filter_var($searchValue, FILTER_SANITIZE_FULL_SPECIAL_CHARS) . "%' OR ";
704
+            $sWhere .= $column." LIKE '%".filter_var($searchValue, FILTER_SANITIZE_FULL_SPECIAL_CHARS)."%' OR ";
705 705
         }
706
-        $sWhere = substr_replace($sWhere, '', -3) . ')';
706
+        $sWhere = substr_replace($sWhere, '', -3).')';
707 707
     }
708 708
 
709 709
     $iTotal = DB::queryFirstField(
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
     $iFilteredTotal = DB::count();
727 727
     // Output
728 728
     $sOutput = '{';
729
-    $sOutput .= '"sEcho": '. (int) $request->query->get('draw') . ', ';
729
+    $sOutput .= '"sEcho": '.(int) $request->query->get('draw').', ';
730 730
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
731 731
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
732 732
     $sOutput .= '"aaData": ';
@@ -768,9 +768,9 @@  discard block
 block discarded – undo
768 768
 
769 769
         $columnIndex = filter_var($order['column'], FILTER_SANITIZE_NUMBER_INT);
770 770
         $dir = filter_var($order['dir'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
771
-        $sOrder = 'ORDER BY ' . $aColumns[$columnIndex] . ' ' . $dir . ' ';
771
+        $sOrder = 'ORDER BY '.$aColumns[$columnIndex].' '.$dir.' ';
772 772
     } else {
773
-        $sOrder = 'ORDER BY ' . $aColumns[0] . ' DESC';
773
+        $sOrder = 'ORDER BY '.$aColumns[0].' DESC';
774 774
     }
775 775
 
776 776
     // Where clause
@@ -779,9 +779,9 @@  discard block
 block discarded – undo
779 779
     if ($searchValue !== '') {
780 780
         $sWhere .= ' AND (';
781 781
         foreach ($aColumns as $column) {
782
-            $sWhere .= $column . " LIKE '%" . filter_var($searchValue, FILTER_SANITIZE_FULL_SPECIAL_CHARS) . "%' OR ";
782
+            $sWhere .= $column." LIKE '%".filter_var($searchValue, FILTER_SANITIZE_FULL_SPECIAL_CHARS)."%' OR ";
783 783
         }
784
-        $sWhere = substr_replace($sWhere, '', -3) . ') ';
784
+        $sWhere = substr_replace($sWhere, '', -3).') ';
785 785
     }
786 786
     $sWhere .= ') ';
787 787
     $iTotal = DB::queryFirstField(
@@ -799,7 +799,7 @@  discard block
 block discarded – undo
799 799
     $iFilteredTotal = DB::count();
800 800
     // Output
801 801
     $sOutput = '{';
802
-    $sOutput .= '"sEcho": '. (int) $request->query->get('draw') . ', ';
802
+    $sOutput .= '"sEcho": '.(int) $request->query->get('draw').', ';
803 803
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
804 804
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
805 805
     $sOutput .= '"aaData": ';
@@ -848,9 +848,9 @@  discard block
 block discarded – undo
848 848
 
849 849
         $columnIndex = filter_var($order['column'], FILTER_SANITIZE_NUMBER_INT);
850 850
         $dir = filter_var($order['dir'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
851
-        $sOrder = 'ORDER BY ' . $aColumns[$columnIndex] . ' ' . $dir . ' ';
851
+        $sOrder = 'ORDER BY '.$aColumns[$columnIndex].' '.$dir.' ';
852 852
     } else {
853
-        $sOrder = 'ORDER BY ' . $aColumns[0] . ' DESC';
853
+        $sOrder = 'ORDER BY '.$aColumns[0].' DESC';
854 854
     }
855 855
 
856 856
     // Where clause
@@ -859,9 +859,9 @@  discard block
 block discarded – undo
859 859
     if ($searchValue !== '') {
860 860
         $sWhere .= ' AND (';
861 861
         foreach ($aColumns as $column) {
862
-            $sWhere .= $column . " LIKE '%" . filter_var($searchValue, FILTER_SANITIZE_FULL_SPECIAL_CHARS) . "%' OR ";
862
+            $sWhere .= $column." LIKE '%".filter_var($searchValue, FILTER_SANITIZE_FULL_SPECIAL_CHARS)."%' OR ";
863 863
         }
864
-        $sWhere = substr_replace($sWhere, '', -3) . ')';
864
+        $sWhere = substr_replace($sWhere, '', -3).')';
865 865
     }
866 866
     $sWhere .= ') ';
867 867
     DB::debugmode(false);
@@ -882,7 +882,7 @@  discard block
 block discarded – undo
882 882
     $iFilteredTotal = DB::count();
883 883
     // Output
884 884
     $sOutput = '{';
885
-    $sOutput .= '"sEcho": '. (int) $request->query->get('draw') . ', ';
885
+    $sOutput .= '"sEcho": '.(int) $request->query->get('draw').', ';
886 886
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
887 887
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
888 888
     $sOutput .= '"aaData": ';
@@ -894,15 +894,15 @@  discard block
 block discarded – undo
894 894
         //col1
895 895
         $sOutput .= '"<span data-done=\"'.$record['is_in_progress'].'\" data-type=\"'.$record['process_type'].'\" data-process-id=\"'.$record['increment_id'].'\"></span>", ';
896 896
         //col2
897
-        $sOutput .= '"'.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['created_at']).'", ';
897
+        $sOutput .= '"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['created_at']).'", ';
898 898
         //col3
899
-        $sOutput .= '"'.($record['updated_at'] === '' ? '-' : date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['updated_at'])).'", ';
899
+        $sOutput .= '"'.($record['updated_at'] === '' ? '-' : date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['updated_at'])).'", ';
900 900
         //col4
901 901
         $sOutput .= '"'.$record['process_type'].'", ';
902 902
         // col5
903 903
         if (in_array($record['process_type'], array('create_user_keys', 'item_copy')) === true) {
904 904
             $data_user = DB::queryfirstrow(
905
-                'SELECT name, lastname FROM ' . prefixTable('users') . '
905
+                'SELECT name, lastname FROM '.prefixTable('users').'
906 906
                 WHERE id = %i',
907 907
                 json_decode($record['arguments'], true)['new_user_id']
908 908
             );
@@ -934,9 +934,9 @@  discard block
 block discarded – undo
934 934
 
935 935
         $columnIndex = filter_var($order['column'], FILTER_SANITIZE_NUMBER_INT);
936 936
         $dir = filter_var($order['dir'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
937
-        $sOrder = 'ORDER BY ' . $aColumns[$columnIndex] . ' ' . $dir . ' ';
937
+        $sOrder = 'ORDER BY '.$aColumns[$columnIndex].' '.$dir.' ';
938 938
     } else {
939
-        $sOrder = 'ORDER BY ' . $aColumns[0] . ' DESC';
939
+        $sOrder = 'ORDER BY '.$aColumns[0].' DESC';
940 940
     }
941 941
 
942 942
     // Where clause
@@ -945,9 +945,9 @@  discard block
 block discarded – undo
945 945
     if ($searchValue !== '') {
946 946
         $sWhere .= ' AND (';
947 947
         foreach ($aColumns as $column) {
948
-            $sWhere .= $column . " LIKE '%" . filter_var($searchValue, FILTER_SANITIZE_FULL_SPECIAL_CHARS) . "%' OR ";
948
+            $sWhere .= $column." LIKE '%".filter_var($searchValue, FILTER_SANITIZE_FULL_SPECIAL_CHARS)."%' OR ";
949 949
         }
950
-        $sWhere = substr_replace($sWhere, '', -3) . ')';
950
+        $sWhere = substr_replace($sWhere, '', -3).')';
951 951
     }
952 952
     $sWhere .= ') ';
953 953
     
@@ -970,7 +970,7 @@  discard block
 block discarded – undo
970 970
     $iFilteredTotal = DB::count();
971 971
     // Output
972 972
     $sOutput = '{';
973
-    $sOutput .= '"sEcho": '. (int) $request->query->get('draw') . ', ';
973
+    $sOutput .= '"sEcho": '.(int) $request->query->get('draw').', ';
974 974
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
975 975
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
976 976
     $sOutput .= '"aaData": ';
@@ -986,13 +986,12 @@  discard block
 block discarded – undo
986 986
         //col1
987 987
         $sOutput .= '"", ';
988 988
         //col2
989
-        $sOutput .= '"'.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['created_at']).'", ';
989
+        $sOutput .= '"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['created_at']).'", ';
990 990
         //col3
991 991
         $sOutput .= is_null($record['started_at']) === false ?
992
-            ('"'.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['started_at']).'", ') :
993
-                ('"'.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['created_at']).'", ');
992
+            ('"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['started_at']).'", ') : ('"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['created_at']).'", ');
994 993
         //col4
995
-        $sOutput .= '"'.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['finished_at']).'", ';
994
+        $sOutput .= '"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['finished_at']).'", ';
996 995
         // col7
997 996
         $sOutput .= '"'.gmdate('H:i:s', (int) $record['finished_at'] - (is_null($record['started_at']) === false ? (int) $record['started_at'] : (int) $record['created_at'])).'",';
998 997
         //col5
@@ -1011,7 +1010,7 @@  discard block
 block discarded – undo
1011 1010
         $newUserId = array_key_exists('new_user_id', $arguments) ? $arguments['new_user_id'] : null;
1012 1011
         if ($record['process_type'] === 'create_user_keys' && is_null($newUserId) === false && empty($newUserId) === false) {
1013 1012
             $data_user = DB::queryfirstrow(
1014
-                'SELECT name, lastname, login FROM ' . prefixTable('users') . '
1013
+                'SELECT name, lastname, login FROM '.prefixTable('users').'
1015 1014
                 WHERE id = %i',
1016 1015
                 $newUserId
1017 1016
             );
@@ -1027,7 +1026,7 @@  discard block
 block discarded – undo
1027 1026
         } elseif ($record['process_type'] === 'user_build_cache_tree') {
1028 1027
             $user = json_decode($record['arguments'], true)['user_id'];
1029 1028
             $data_user = DB::queryfirstrow(
1030
-                'SELECT name, lastname, login FROM ' . prefixTable('users') . '
1029
+                'SELECT name, lastname, login FROM '.prefixTable('users').'
1031 1030
                 WHERE id = %i',
1032 1031
                 $user
1033 1032
             );
Please login to merge, or discard this patch.
pages/backups.js.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('backups') === false) {
69 69
     // Not allowed page
70 70
     $session->set('system-error_code', ERR_NOT_ALLOWED);
71
-    include $SETTINGS['cpassman_dir'] . '/error.php';
71
+    include $SETTINGS['cpassman_dir'].'/error.php';
72 72
     exit;
73 73
 }
74 74
 ?>
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
                             // ERROR
138 138
                             toastr.remove();
139 139
                             toastr.error(
140
-                                '<?php echo $lang->get('server_answer_error') . '<br />' . $lang->get('server_returned_data') . ':<br />'; ?>' + data.error,
140
+                                '<?php echo $lang->get('server_answer_error').'<br />'.$lang->get('server_returned_data').':<br />'; ?>' + data.error,
141 141
                                 '<?php echo $lang->get('error'); ?>', {
142 142
                                     timeOut: 5000,
143 143
                                     progressBar: true
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
                                         // error
165 165
                                         toastr.remove();
166 166
                                         toastr.error(
167
-                                            '<?php echo $lang->get('server_answer_error') . '<br />' . $lang->get('server_returned_data') . ':<br />'; ?>' + data.error,
167
+                                            '<?php echo $lang->get('server_answer_error').'<br />'.$lang->get('server_returned_data').':<br />'; ?>' + data.error,
168 168
                                             '<?php echo $lang->get('error'); ?>', {
169 169
                                                 timeOut: 5000,
170 170
                                                 progressBar: true
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
                             // ERROR
236 236
                             toastr.remove();
237 237
                             toastr.error(
238
-                                '<?php echo $lang->get('server_answer_error') . '<br />' . $lang->get('server_returned_data') . ':<br />'; ?>' + data.error,
238
+                                '<?php echo $lang->get('server_answer_error').'<br />'.$lang->get('server_returned_data').':<br />'; ?>' + data.error,
239 239
                                 '<?php echo $lang->get('error'); ?>', {
240 240
                                     timeOut: 5000,
241 241
                                     progressBar: true
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
     // PREPARE UPLOADER with plupload
272 272
 <?php
273 273
 $maxFileSize = (strrpos($SETTINGS['upload_maxfilesize'], 'mb') === false)
274
-    ? $SETTINGS['upload_maxfilesize'] . 'mb'
274
+    ? $SETTINGS['upload_maxfilesize'].'mb'
275 275
     : $SETTINGS['upload_maxfilesize'];
276 276
 ?>
277 277
 
Please login to merge, or discard this patch.