Passed
Pull Request — master (#4822)
by Nils
06:14
created
sources/main.functions.php 1 patch
Spacing   +163 added lines, -165 removed lines patch added patch discarded remove patch
@@ -129,19 +129,19 @@  discard block
 block discarded – undo
129 129
             $text = Crypto::decrypt($message, $key);
130 130
         }
131 131
     } catch (CryptoException\WrongKeyOrModifiedCiphertextException $ex) {
132
-        error_log('TEAMPASS-Error-Wrong key or modified ciphertext: ' . $ex->getMessage());
132
+        error_log('TEAMPASS-Error-Wrong key or modified ciphertext: '.$ex->getMessage());
133 133
         $err = 'wrong_key_or_modified_ciphertext';
134 134
     } catch (CryptoException\BadFormatException $ex) {
135
-        error_log('TEAMPASS-Error-Bad format exception: ' . $ex->getMessage());
135
+        error_log('TEAMPASS-Error-Bad format exception: '.$ex->getMessage());
136 136
         $err = 'bad_format';
137 137
     } catch (CryptoException\EnvironmentIsBrokenException $ex) {
138
-        error_log('TEAMPASS-Error-Environment: ' . $ex->getMessage());
138
+        error_log('TEAMPASS-Error-Environment: '.$ex->getMessage());
139 139
         $err = 'environment_error';
140 140
     } catch (CryptoException\IOException $ex) {
141
-        error_log('TEAMPASS-Error-IO: ' . $ex->getMessage());
141
+        error_log('TEAMPASS-Error-IO: '.$ex->getMessage());
142 142
         $err = 'io_error';
143 143
     } catch (Exception $ex) {
144
-        error_log('TEAMPASS-Error-Unexpected exception: ' . $ex->getMessage());
144
+        error_log('TEAMPASS-Error-Unexpected exception: '.$ex->getMessage());
145 145
         $err = 'unexpected_error';
146 146
     }
147 147
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
  */
227 227
 function trimElement($chaine, string $element): string
228 228
 {
229
-    if (! empty($chaine)) {
229
+    if (!empty($chaine)) {
230 230
         if (is_array($chaine) === true) {
231 231
             $chaine = implode(';', $chaine);
232 232
         }
@@ -274,8 +274,8 @@  discard block
 block discarded – undo
274 274
  */
275 275
 function db_error_handler(array $params): void
276 276
 {
277
-    echo 'Error: ' . $params['error'] . "<br>\n";
278
-    echo 'Query: ' . $params['query'] . "<br>\n";
277
+    echo 'Error: '.$params['error']."<br>\n";
278
+    echo 'Query: '.$params['query']."<br>\n";
279 279
     throw new Exception('Error - Query', 1);
280 280
 }
281 281
 
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
     $session->set('user-forbiden_personal_folders', []);
354 354
     
355 355
     // Get list of Folders
356
-    $rows = DB::query('SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', 0);
356
+    $rows = DB::query('SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', 0);
357 357
     foreach ($rows as $record) {
358 358
         array_push($groupesVisibles, $record['id']);
359 359
     }
@@ -363,20 +363,20 @@  discard block
 block discarded – undo
363 363
     // get complete list of ROLES
364 364
     $tmp = explode(';', $idFonctions);
365 365
     $rows = DB::query(
366
-        'SELECT * FROM ' . prefixTable('roles_title') . '
366
+        'SELECT * FROM '.prefixTable('roles_title').'
367 367
         ORDER BY title ASC'
368 368
     );
369 369
     foreach ($rows as $record) {
370
-        if (! empty($record['id']) && ! in_array($record['id'], $tmp)) {
370
+        if (!empty($record['id']) && !in_array($record['id'], $tmp)) {
371 371
             array_push($tmp, $record['id']);
372 372
         }
373 373
     }
374 374
     $session->set('user-roles', implode(';', $tmp));
375 375
     $session->set('user-admin', 1);
376 376
     // Check if admin has created Folders and Roles
377
-    DB::query('SELECT * FROM ' . prefixTable('nested_tree') . '');
377
+    DB::query('SELECT * FROM '.prefixTable('nested_tree').'');
378 378
     $session->set('user-nb_folders', DB::count());
379
-    DB::query('SELECT * FROM ' . prefixTable('roles_title'));
379
+    DB::query('SELECT * FROM '.prefixTable('roles_title'));
380 380
     $session->set('user-nb_roles', DB::count());
381 381
 
382 382
     return true;
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
     // Does this user is allowed to see other items
460 460
     $inc = 0;
461 461
     $rows = DB::query(
462
-        'SELECT id, id_tree FROM ' . prefixTable('items') . '
462
+        'SELECT id, id_tree FROM '.prefixTable('items').'
463 463
             WHERE restricted_to LIKE %ss AND inactif = %s'.
464 464
             (count($allowedFolders) > 0 ? ' AND id_tree NOT IN ('.implode(',', $allowedFolders).')' : ''),
465 465
         $globalsUserId,
@@ -476,8 +476,8 @@  discard block
 block discarded – undo
476 476
     // Check for the users roles if some specific rights exist on items
477 477
     $rows = DB::query(
478 478
         'SELECT i.id_tree, r.item_id
479
-        FROM ' . prefixTable('items') . ' as i
480
-        INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (r.item_id=i.id)
479
+        FROM ' . prefixTable('items').' as i
480
+        INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (r.item_id=i.id)
481 481
         WHERE i.id_tree <> "" '.
482 482
         (count($userRoles) > 0 ? 'AND r.role_id IN %li ' : '').
483 483
         'ORDER BY i.id_tree ASC',
@@ -531,18 +531,18 @@  discard block
 block discarded – undo
531 531
         ), SORT_NUMERIC)
532 532
     );
533 533
     // Folders and Roles numbers
534
-    DB::queryFirstRow('SELECT id FROM ' . prefixTable('nested_tree') . '');
535
-    DB::queryFirstRow('SELECT id FROM ' . prefixTable('nested_tree') . '');
534
+    DB::queryFirstRow('SELECT id FROM '.prefixTable('nested_tree').'');
535
+    DB::queryFirstRow('SELECT id FROM '.prefixTable('nested_tree').'');
536 536
     $session->set('user-nb_folders', DB::count());
537
-    DB::queryFirstRow('SELECT id FROM ' . prefixTable('roles_title'));
538
-    DB::queryFirstRow('SELECT id FROM ' . prefixTable('roles_title'));
537
+    DB::queryFirstRow('SELECT id FROM '.prefixTable('roles_title'));
538
+    DB::queryFirstRow('SELECT id FROM '.prefixTable('roles_title'));
539 539
     $session->set('user-nb_roles', DB::count());
540 540
     // check if change proposals on User's items
541 541
     if (isset($SETTINGS['enable_suggestion']) === true && (int) $SETTINGS['enable_suggestion'] === 1) {
542 542
         $countNewItems = DB::query(
543 543
             'SELECT COUNT(*)
544
-            FROM ' . prefixTable('items_change') . ' AS c
545
-            LEFT JOIN ' . prefixTable('log_items') . ' AS i ON (c.item_id = i.id_item)
544
+            FROM ' . prefixTable('items_change').' AS c
545
+            LEFT JOIN ' . prefixTable('log_items').' AS i ON (c.item_id = i.id_item)
546 546
             WHERE i.action = %s AND i.id_user = %i',
547 547
             'at_creation',
548 548
             $globalsUserId
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 {
570 570
     $rows = DB::query(
571 571
         'SELECT *
572
-        FROM ' . prefixTable('roles_values') . '
572
+        FROM ' . prefixTable('roles_values').'
573 573
         WHERE type IN %ls'.(count($userRoles) > 0 ? ' AND role_id IN %li' : ''),
574 574
         ['W', 'ND', 'NE', 'NDNE', 'R'],
575 575
         $userRoles,
@@ -636,7 +636,7 @@  discard block
 block discarded – undo
636 636
     ) {
637 637
         $persoFld = DB::queryFirstRow(
638 638
             'SELECT id
639
-            FROM ' . prefixTable('nested_tree') . '
639
+            FROM ' . prefixTable('nested_tree').'
640 640
             WHERE title = %s AND personal_folder = %i'.
641 641
             (count($allowedFolders) > 0 ? ' AND id NOT IN ('.implode(',', $allowedFolders).')' : ''),
642 642
             $globalsUserId,
@@ -669,7 +669,7 @@  discard block
 block discarded – undo
669 669
     }
670 670
     $persoFlds = DB::query(
671 671
         'SELECT id
672
-        FROM ' . prefixTable('nested_tree') . '
672
+        FROM ' . prefixTable('nested_tree').'
673 673
         WHERE %l',
674 674
         $where
675 675
     );
@@ -737,12 +737,12 @@  discard block
 block discarded – undo
737 737
     //Load Tree
738 738
     $tree = new NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
739 739
     // truncate table
740
-    DB::query('TRUNCATE TABLE ' . prefixTable('cache'));
740
+    DB::query('TRUNCATE TABLE '.prefixTable('cache'));
741 741
     // reload date
742 742
     $rows = DB::query(
743 743
         'SELECT *
744
-        FROM ' . prefixTable('items') . ' as i
745
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
744
+        FROM ' . prefixTable('items').' as i
745
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
746 746
         AND l.action = %s
747 747
         AND i.inactif = %i',
748 748
         'at_creation',
@@ -754,18 +754,18 @@  discard block
 block discarded – undo
754 754
             $tags = '';
755 755
             $itemTags = DB::query(
756 756
                 'SELECT tag
757
-                FROM ' . prefixTable('tags') . '
757
+                FROM ' . prefixTable('tags').'
758 758
                 WHERE item_id = %i AND tag != ""',
759 759
                 $record['id']
760 760
             );
761 761
             foreach ($itemTags as $itemTag) {
762
-                $tags .= $itemTag['tag'] . ' ';
762
+                $tags .= $itemTag['tag'].' ';
763 763
             }
764 764
 
765 765
             // Get renewal period
766 766
             $resNT = DB::queryFirstRow(
767 767
                 'SELECT renewal_period
768
-                FROM ' . prefixTable('nested_tree') . '
768
+                FROM ' . prefixTable('nested_tree').'
769 769
                 WHERE id = %i',
770 770
                 $record['id_tree']
771 771
             );
@@ -778,7 +778,7 @@  discard block
 block discarded – undo
778 778
                     // Is this a User id?
779 779
                     $user = DB::queryFirstRow(
780 780
                         'SELECT id, login
781
-                        FROM ' . prefixTable('users') . '
781
+                        FROM ' . prefixTable('users').'
782 782
                         WHERE id = %i',
783 783
                         $elem->title
784 784
                     );
@@ -796,11 +796,11 @@  discard block
 block discarded – undo
796 796
                     'id' => $record['id'],
797 797
                     'label' => $record['label'],
798 798
                     'description' => $record['description'] ?? '',
799
-                    'url' => isset($record['url']) && ! empty($record['url']) ? $record['url'] : '0',
799
+                    'url' => isset($record['url']) && !empty($record['url']) ? $record['url'] : '0',
800 800
                     'tags' => $tags,
801 801
                     'id_tree' => $record['id_tree'],
802 802
                     'perso' => $record['perso'],
803
-                    'restricted_to' => isset($record['restricted_to']) && ! empty($record['restricted_to']) ? $record['restricted_to'] : '0',
803
+                    'restricted_to' => isset($record['restricted_to']) && !empty($record['restricted_to']) ? $record['restricted_to'] : '0',
804 804
                     'login' => $record['login'] ?? '',
805 805
                     'folder' => implode(' » ', $folder),
806 806
                     'author' => $record['id_user'],
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
     // get new value from db
830 830
     $data = DB::queryFirstRow(
831 831
         'SELECT label, description, id_tree, perso, restricted_to, login, url
832
-        FROM ' . prefixTable('items') . '
832
+        FROM ' . prefixTable('items').'
833 833
         WHERE id=%i',
834 834
         $ident
835 835
     );
@@ -837,12 +837,12 @@  discard block
 block discarded – undo
837 837
     $tags = '';
838 838
     $itemTags = DB::query(
839 839
         'SELECT tag
840
-            FROM ' . prefixTable('tags') . '
840
+            FROM ' . prefixTable('tags').'
841 841
             WHERE item_id = %i AND tag != ""',
842 842
         $ident
843 843
     );
844 844
     foreach ($itemTags as $itemTag) {
845
-        $tags .= $itemTag['tag'] . ' ';
845
+        $tags .= $itemTag['tag'].' ';
846 846
     }
847 847
     // form id_tree to full foldername
848 848
     $folder = [];
@@ -853,7 +853,7 @@  discard block
 block discarded – undo
853 853
             // Is this a User id?
854 854
             $user = DB::queryFirstRow(
855 855
                 'SELECT id, login
856
-                FROM ' . prefixTable('users') . '
856
+                FROM ' . prefixTable('users').'
857 857
                 WHERE id = %i',
858 858
                 $elem->title
859 859
             );
@@ -871,10 +871,10 @@  discard block
 block discarded – undo
871 871
             'label' => $data['label'],
872 872
             'description' => $data['description'],
873 873
             'tags' => $tags,
874
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
874
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
875 875
             'id_tree' => $data['id_tree'],
876 876
             'perso' => $data['perso'],
877
-            'restricted_to' => isset($data['restricted_to']) && ! empty($data['restricted_to']) ? $data['restricted_to'] : '0',
877
+            'restricted_to' => isset($data['restricted_to']) && !empty($data['restricted_to']) ? $data['restricted_to'] : '0',
878 878
             'login' => $data['login'] ?? '',
879 879
             'folder' => implode(' » ', $folder),
880 880
             'author' => $session->get('user-id'),
@@ -904,8 +904,8 @@  discard block
 block discarded – undo
904 904
     // get new value from db
905 905
     $data = DB::queryFirstRow(
906 906
         'SELECT i.label, i.description, i.id_tree as id_tree, i.perso, i.restricted_to, i.id, i.login, i.url, l.date
907
-        FROM ' . prefixTable('items') . ' as i
908
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
907
+        FROM ' . prefixTable('items').' as i
908
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
909 909
         WHERE i.id = %i
910 910
         AND l.action = %s',
911 911
         $ident,
@@ -915,12 +915,12 @@  discard block
 block discarded – undo
915 915
     $tags = '';
916 916
     $itemTags = DB::query(
917 917
         'SELECT tag
918
-            FROM ' . prefixTable('tags') . '
918
+            FROM ' . prefixTable('tags').'
919 919
             WHERE item_id = %i AND tag != ""',
920 920
         $ident
921 921
     );
922 922
     foreach ($itemTags as $itemTag) {
923
-        $tags .= $itemTag['tag'] . ' ';
923
+        $tags .= $itemTag['tag'].' ';
924 924
     }
925 925
     // form id_tree to full foldername
926 926
     $folder = [];
@@ -931,7 +931,7 @@  discard block
 block discarded – undo
931 931
             // Is this a User id?
932 932
             $user = DB::queryFirstRow(
933 933
                 'SELECT id, login
934
-                FROM ' . prefixTable('users') . '
934
+                FROM ' . prefixTable('users').'
935 935
                 WHERE id = %i',
936 936
                 $elem->title
937 937
             );
@@ -950,7 +950,7 @@  discard block
 block discarded – undo
950 950
             'label' => $data['label'],
951 951
             'description' => $data['description'],
952 952
             'tags' => empty($tags) === false ? $tags : 'None',
953
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
953
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
954 954
             'id_tree' => $data['id_tree'],
955 955
             'perso' => isset($data['perso']) && empty($data['perso']) === false && $data['perso'] !== 'None' ? $data['perso'] : '0',
956 956
             'restricted_to' => isset($data['restricted_to']) && empty($data['restricted_to']) === false ? $data['restricted_to'] : '0',
@@ -972,53 +972,53 @@  discard block
 block discarded – undo
972 972
 function getStatisticsData(array $SETTINGS): array
973 973
 {
974 974
     DB::query(
975
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
975
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
976 976
         0
977 977
     );
978 978
     $counter_folders = DB::count();
979 979
     DB::query(
980
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
980
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
981 981
         1
982 982
     );
983 983
     $counter_folders_perso = DB::count();
984 984
     DB::query(
985
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
985
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
986 986
         0
987 987
     );
988 988
     $counter_items = DB::count();
989 989
         DB::query(
990
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
990
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
991 991
         1
992 992
     );
993 993
     $counter_items_perso = DB::count();
994 994
         DB::query(
995
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE login NOT IN (%s, %s, %s)',
995
+        'SELECT id FROM '.prefixTable('users').' WHERE login NOT IN (%s, %s, %s)',
996 996
         'OTV', 'TP', 'API'
997 997
     );
998 998
     $counter_users = DB::count();
999 999
         DB::query(
1000
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE admin = %i',
1000
+        'SELECT id FROM '.prefixTable('users').' WHERE admin = %i',
1001 1001
         1
1002 1002
     );
1003 1003
     $admins = DB::count();
1004 1004
     DB::query(
1005
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE gestionnaire = %i',
1005
+        'SELECT id FROM '.prefixTable('users').' WHERE gestionnaire = %i',
1006 1006
         1
1007 1007
     );
1008 1008
     $managers = DB::count();
1009 1009
     DB::query(
1010
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE read_only = %i',
1010
+        'SELECT id FROM '.prefixTable('users').' WHERE read_only = %i',
1011 1011
         1
1012 1012
     );
1013 1013
     $readOnly = DB::count();
1014 1014
     // list the languages
1015 1015
     $usedLang = [];
1016 1016
     $tp_languages = DB::query(
1017
-        'SELECT name FROM ' . prefixTable('languages')
1017
+        'SELECT name FROM '.prefixTable('languages')
1018 1018
     );
1019 1019
     foreach ($tp_languages as $tp_language) {
1020 1020
         DB::query(
1021
-            'SELECT * FROM ' . prefixTable('users') . ' WHERE user_language = %s',
1021
+            'SELECT * FROM '.prefixTable('users').' WHERE user_language = %s',
1022 1022
             $tp_language['name']
1023 1023
         );
1024 1024
         $usedLang[$tp_language['name']] = round((DB::count() * 100 / $counter_users), 0);
@@ -1027,12 +1027,12 @@  discard block
 block discarded – undo
1027 1027
     // get list of ips
1028 1028
     $usedIp = [];
1029 1029
     $tp_ips = DB::query(
1030
-        'SELECT user_ip FROM ' . prefixTable('users')
1030
+        'SELECT user_ip FROM '.prefixTable('users')
1031 1031
     );
1032 1032
     foreach ($tp_ips as $ip) {
1033 1033
         if (array_key_exists($ip['user_ip'], $usedIp)) {
1034 1034
             $usedIp[$ip['user_ip']] += $usedIp[$ip['user_ip']];
1035
-        } elseif (! empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1035
+        } elseif (!empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1036 1036
             $usedIp[$ip['user_ip']] = 1;
1037 1037
         }
1038 1038
     }
@@ -1127,7 +1127,7 @@  discard block
 block discarded – undo
1127 1127
         <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;">
1128 1128
         <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;">
1129 1129
         <br><div style="float:right;">' .
1130
-        $textMail .
1130
+        $textMail.
1131 1131
         '<br><br></td></tr></table>
1132 1132
     </td></tr></table>
1133 1133
     <br></body></html>';
@@ -1208,7 +1208,7 @@  discard block
 block discarded – undo
1208 1208
 {
1209 1209
     array_walk_recursive(
1210 1210
         $array,
1211
-        static function (&$item): void {
1211
+        static function(&$item): void {
1212 1212
             if (mb_detect_encoding((string) $item, 'utf-8', true) === false) {
1213 1213
                 $item = mb_convert_encoding($item, 'ISO-8859-1', 'UTF-8');
1214 1214
             }
@@ -1319,7 +1319,7 @@  discard block
 block discarded – undo
1319 1319
  */
1320 1320
 function prefixTable(string $table): string
1321 1321
 {
1322
-    $safeTable = htmlspecialchars(DB_PREFIX . $table);
1322
+    $safeTable = htmlspecialchars(DB_PREFIX.$table);
1323 1323
     return $safeTable;
1324 1324
 }
1325 1325
 
@@ -1436,7 +1436,7 @@  discard block
 block discarded – undo
1436 1436
 function send_syslog($message, $host, $port, $component = 'teampass'): void
1437 1437
 {
1438 1438
     $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
1439
-    $syslog_message = '<123>' . date('M d H:i:s ') . $component . ': ' . $message;
1439
+    $syslog_message = '<123>'.date('M d H:i:s ').$component.': '.$message;
1440 1440
     socket_sendto($sock, (string) $syslog_message, strlen($syslog_message), 0, (string) $host, (int) $port);
1441 1441
     socket_close($sock);
1442 1442
 }
@@ -1483,14 +1483,14 @@  discard block
 block discarded – undo
1483 1483
     if (isset($SETTINGS['syslog_enable']) === true && (int) $SETTINGS['syslog_enable'] === 1) {
1484 1484
         if ($type === 'user_mngt') {
1485 1485
             send_syslog(
1486
-                'action=' . str_replace('at_', '', $label) . ' attribute=user user=' . $who . ' userid="' . $login . '" change="' . $field_1 . '" ',
1486
+                'action='.str_replace('at_', '', $label).' attribute=user user='.$who.' userid="'.$login.'" change="'.$field_1.'" ',
1487 1487
                 $SETTINGS['syslog_host'],
1488 1488
                 $SETTINGS['syslog_port'],
1489 1489
                 'teampass'
1490 1490
             );
1491 1491
         } else {
1492 1492
             send_syslog(
1493
-                'action=' . $type . ' attribute=' . $label . ' user=' . $who . ' userid="' . $login . '" ',
1493
+                'action='.$type.' attribute='.$label.' user='.$who.' userid="'.$login.'" ',
1494 1494
                 $SETTINGS['syslog_host'],
1495 1495
                 $SETTINGS['syslog_port'],
1496 1496
                 'teampass'
@@ -1565,7 +1565,7 @@  discard block
 block discarded – undo
1565 1565
         if (empty($item_label) === true) {
1566 1566
             $dataItem = DB::queryFirstRow(
1567 1567
                 'SELECT id, id_tree, label
1568
-                FROM ' . prefixTable('items') . '
1568
+                FROM ' . prefixTable('items').'
1569 1569
                 WHERE id = %i',
1570 1570
                 $item_id
1571 1571
             );
@@ -1573,11 +1573,11 @@  discard block
 block discarded – undo
1573 1573
         }
1574 1574
 
1575 1575
         send_syslog(
1576
-            'action=' . str_replace('at_', '', $action) .
1577
-                ' attribute=' . str_replace('at_', '', $attribute[0]) .
1578
-                ' itemno=' . $item_id .
1579
-                ' user=' . (is_null($login) === true ? '' : addslashes((string) $login)) .
1580
-                ' itemname="' . addslashes($item_label) . '"',
1576
+            'action='.str_replace('at_', '', $action).
1577
+                ' attribute='.str_replace('at_', '', $attribute[0]).
1578
+                ' itemno='.$item_id.
1579
+                ' user='.(is_null($login) === true ? '' : addslashes((string) $login)).
1580
+                ' itemname="'.addslashes($item_label).'"',
1581 1581
             $SETTINGS['syslog_host'],
1582 1582
             $SETTINGS['syslog_port'],
1583 1583
             'teampass'
@@ -1608,8 +1608,8 @@  discard block
 block discarded – undo
1608 1608
     // send email to user that what to be notified
1609 1609
     $notification = DB::queryFirstField(
1610 1610
         'SELECT email
1611
-        FROM ' . prefixTable('notification') . ' AS n
1612
-        INNER JOIN ' . prefixTable('users') . ' AS u ON (n.user_id = u.id)
1611
+        FROM ' . prefixTable('notification').' AS n
1612
+        INNER JOIN ' . prefixTable('users').' AS u ON (n.user_id = u.id)
1613 1613
         WHERE n.item_id = %i AND n.user_id != %i',
1614 1614
         $item_id,
1615 1615
         $globalsUserId
@@ -1620,7 +1620,7 @@  discard block
 block discarded – undo
1620 1620
         // Get list of changes
1621 1621
         $htmlChanges = '<ul>';
1622 1622
         foreach ($changes as $change) {
1623
-            $htmlChanges .= '<li>' . $change . '</li>';
1623
+            $htmlChanges .= '<li>'.$change.'</li>';
1624 1624
         }
1625 1625
         $htmlChanges .= '</ul>';
1626 1626
         // send email
@@ -1657,15 +1657,15 @@  discard block
 block discarded – undo
1657 1657
     $path = '';
1658 1658
     foreach ($arbo as $elem) {
1659 1659
         if (empty($path) === true) {
1660
-            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' ';
1660
+            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' ';
1661 1661
         } else {
1662
-            $path .= '&#8594; ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1662
+            $path .= '&#8594; '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1663 1663
         }
1664 1664
     }
1665 1665
 
1666 1666
     // Build text to show user
1667 1667
     if (empty($label) === false) {
1668
-        return empty($path) === true ? addslashes($label) : addslashes($label) . ' (' . $path . ')';
1668
+        return empty($path) === true ? addslashes($label) : addslashes($label).' ('.$path.')';
1669 1669
     }
1670 1670
     return empty($path) === true ? '' : $path;
1671 1671
 }
@@ -1721,7 +1721,7 @@  discard block
 block discarded – undo
1721 1721
 {
1722 1722
     // Perform a copy if the file exists
1723 1723
     if (file_exists($configFilePath)) {
1724
-        $backupFilePath = $configFilePath . '.' . date('Y_m_d_His', time());
1724
+        $backupFilePath = $configFilePath.'.'.date('Y_m_d_His', time());
1725 1725
         if (!copy($configFilePath, $backupFilePath)) {
1726 1726
             return "ERROR: Could not copy file '$configFilePath'";
1727 1727
         }
@@ -1729,10 +1729,10 @@  discard block
 block discarded – undo
1729 1729
 
1730 1730
     // Regenerate the config file
1731 1731
     $data = ["<?php\n", "global \$SETTINGS;\n", "\$SETTINGS = array (\n"];
1732
-    $rows = DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s', 'admin');
1732
+    $rows = DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type=%s', 'admin');
1733 1733
     foreach ($rows as $record) {
1734 1734
         $value = getEncryptedValue($record['valeur'], $record['is_encrypted']);
1735
-        $data[] = "    '{$record['intitule']}' => '". htmlspecialchars_decode($value, ENT_COMPAT) . "',\n";
1735
+        $data[] = "    '{$record['intitule']}' => '".htmlspecialchars_decode($value, ENT_COMPAT)."',\n";
1736 1736
     }
1737 1737
     $data[] = ");\n";
1738 1738
     $data = array_unique($data);
@@ -1777,7 +1777,7 @@  discard block
 block discarded – undo
1777 1777
 {
1778 1778
     global $SETTINGS;
1779 1779
     /* LOAD CPASSMAN SETTINGS */
1780
-    if (! isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
1780
+    if (!isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
1781 1781
         $SETTINGS = [];
1782 1782
         $SETTINGS['duplicate_folder'] = 0;
1783 1783
         //by default, this is set to 0;
@@ -1787,7 +1787,7 @@  discard block
 block discarded – undo
1787 1787
         //by default, this value is set to 5;
1788 1788
         $settings = [];
1789 1789
         $rows = DB::query(
1790
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s_type OR type=%s_type2',
1790
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s_type OR type=%s_type2',
1791 1791
             [
1792 1792
                 'type' => 'admin',
1793 1793
                 'type2' => 'settings',
@@ -1819,7 +1819,7 @@  discard block
 block discarded – undo
1819 1819
     $source_cf = [];
1820 1820
     $rows = DB::query(
1821 1821
         'SELECT id_category
1822
-            FROM ' . prefixTable('categories_folders') . '
1822
+            FROM ' . prefixTable('categories_folders').'
1823 1823
             WHERE id_folder = %i',
1824 1824
         $source_id
1825 1825
     );
@@ -1830,7 +1830,7 @@  discard block
 block discarded – undo
1830 1830
     $target_cf = [];
1831 1831
     $rows = DB::query(
1832 1832
         'SELECT id_category
1833
-            FROM ' . prefixTable('categories_folders') . '
1833
+            FROM ' . prefixTable('categories_folders').'
1834 1834
             WHERE id_folder = %i',
1835 1835
         $target_id
1836 1836
     );
@@ -1925,10 +1925,10 @@  discard block
 block discarded – undo
1925 1925
     } catch (CryptoException\WrongKeyOrModifiedCiphertextException $ex) {
1926 1926
         $err = 'wrong_key';
1927 1927
     } catch (CryptoException\EnvironmentIsBrokenException $ex) {
1928
-        error_log('TEAMPASS-Error-Environment: ' . $ex->getMessage());
1928
+        error_log('TEAMPASS-Error-Environment: '.$ex->getMessage());
1929 1929
         $err = 'environment_error';
1930 1930
     } catch (CryptoException\IOException $ex) {
1931
-        error_log('TEAMPASS-Error-General: ' . $ex->getMessage());
1931
+        error_log('TEAMPASS-Error-General: '.$ex->getMessage());
1932 1932
         $err = 'general_error';
1933 1933
     }
1934 1934
 
@@ -1961,10 +1961,10 @@  discard block
 block discarded – undo
1961 1961
     } catch (CryptoException\WrongKeyOrModifiedCiphertextException $ex) {
1962 1962
         $err = 'wrong_key';
1963 1963
     } catch (CryptoException\EnvironmentIsBrokenException $ex) {
1964
-        error_log('TEAMPASS-Error-Environment: ' . $ex->getMessage());
1964
+        error_log('TEAMPASS-Error-Environment: '.$ex->getMessage());
1965 1965
         $err = 'environment_error';
1966 1966
     } catch (CryptoException\IOException $ex) {
1967
-        error_log('TEAMPASS-Error-General: ' . $ex->getMessage());
1967
+        error_log('TEAMPASS-Error-General: '.$ex->getMessage());
1968 1968
         $err = 'general_error';
1969 1969
     }
1970 1970
 
@@ -2050,7 +2050,7 @@  discard block
 block discarded – undo
2050 2050
 ) {
2051 2051
     // Check if the path exists
2052 2052
     $path = basename($path);
2053
-    if (! file_exists($path)) {
2053
+    if (!file_exists($path)) {
2054 2054
         return false;
2055 2055
     }
2056 2056
 
@@ -2103,7 +2103,7 @@  discard block
 block discarded – undo
2103 2103
     // Load item data
2104 2104
     $data = DB::queryFirstRow(
2105 2105
         'SELECT id_tree
2106
-        FROM ' . prefixTable('items') . '
2106
+        FROM ' . prefixTable('items').'
2107 2107
         WHERE id = %i',
2108 2108
         $item_id
2109 2109
     );
@@ -2166,7 +2166,7 @@  discard block
 block discarded – undo
2166 2166
         }
2167 2167
         $host .= substr(explode(".", $email[1])[0], -1, 1);
2168 2168
     }
2169
-    $email = $name . "@" . $host . "." . explode(".", $email[1])[1];
2169
+    $email = $name."@".$host.".".explode(".", $email[1])[1];
2170 2170
     return $email;
2171 2171
 }
2172 2172
 
@@ -2197,11 +2197,11 @@  discard block
 block discarded – undo
2197 2197
 function formatSizeUnits(int $bytes): string
2198 2198
 {
2199 2199
     if ($bytes >= 1073741824) {
2200
-        $bytes = number_format($bytes / 1073741824, 2) . ' GB';
2200
+        $bytes = number_format($bytes / 1073741824, 2).' GB';
2201 2201
     } elseif ($bytes >= 1048576) {
2202
-        $bytes = number_format($bytes / 1048576, 2) . ' MB';
2202
+        $bytes = number_format($bytes / 1048576, 2).' MB';
2203 2203
     } elseif ($bytes >= 1024) {
2204
-        $bytes = number_format($bytes / 1024, 2) . ' KB';
2204
+        $bytes = number_format($bytes / 1024, 2).' KB';
2205 2205
     } elseif ($bytes > 1) {
2206 2206
         $bytes .= ' bytes';
2207 2207
     } elseif ($bytes === 1) {
@@ -2450,7 +2450,7 @@  discard block
 block discarded – undo
2450 2450
     $cipher->enableContinuousBuffer();
2451 2451
 
2452 2452
     // Encrypt the file content
2453
-    $filePath = filter_var($fileInPath . '/' . $fileInName, FILTER_SANITIZE_URL);
2453
+    $filePath = filter_var($fileInPath.'/'.$fileInName, FILTER_SANITIZE_URL);
2454 2454
     $fileContent = file_get_contents($filePath);
2455 2455
     $plaintext = $fileContent;
2456 2456
     $ciphertext = $cipher->encrypt($plaintext);
@@ -2458,9 +2458,9 @@  discard block
 block discarded – undo
2458 2458
     // Save new file
2459 2459
     // deepcode ignore InsecureHash: is simply used to get a unique name
2460 2460
     $hash = uniqid('', true);
2461
-    $fileOut = $fileInPath . '/' . TP_FILE_PREFIX . $hash;
2461
+    $fileOut = $fileInPath.'/'.TP_FILE_PREFIX.$hash;
2462 2462
     file_put_contents($fileOut, $ciphertext);
2463
-    unlink($fileInPath . '/' . $fileInName);
2463
+    unlink($fileInPath.'/'.$fileInName);
2464 2464
     return [
2465 2465
         'fileHash' => base64_encode($hash),
2466 2466
         'objectKey' => base64_encode($objectKey),
@@ -2476,9 +2476,9 @@  discard block
 block discarded – undo
2476 2476
  *
2477 2477
  * @return string|array
2478 2478
  */
2479
-function decryptFile(string $fileName, string $filePath, string $key): string|array
2479
+function decryptFile(string $fileName, string $filePath, string $key): string | array
2480 2480
 {
2481
-    if (! defined('FILE_BUFFER_SIZE')) {
2481
+    if (!defined('FILE_BUFFER_SIZE')) {
2482 2482
         define('FILE_BUFFER_SIZE', 128 * 1024);
2483 2483
     }
2484 2484
     
@@ -2495,7 +2495,7 @@  discard block
 block discarded – undo
2495 2495
     $cipher->enableContinuousBuffer();
2496 2496
     $cipher->disablePadding();
2497 2497
     // Get file content
2498
-    $safeFilePath = realpath($filePath . '/' . TP_FILE_PREFIX . $safeFileName);
2498
+    $safeFilePath = realpath($filePath.'/'.TP_FILE_PREFIX.$safeFileName);
2499 2499
     if ($safeFilePath !== false && file_exists($safeFilePath)) {
2500 2500
         $ciphertext = file_get_contents(filter_var($safeFilePath, FILTER_SANITIZE_URL));
2501 2501
     } else {
@@ -2591,7 +2591,7 @@  discard block
 block discarded – undo
2591 2591
         // Only create the sharekey for a user
2592 2592
         $user = DB::queryFirstRow(
2593 2593
             'SELECT public_key
2594
-            FROM ' . prefixTable('users') . '
2594
+            FROM ' . prefixTable('users').'
2595 2595
             WHERE id = %i
2596 2596
             AND public_key != ""',
2597 2597
             $userId
@@ -2632,7 +2632,7 @@  discard block
 block discarded – undo
2632 2632
         }
2633 2633
         $users = DB::query(
2634 2634
             'SELECT id, public_key
2635
-            FROM ' . prefixTable('users') . '
2635
+            FROM ' . prefixTable('users').'
2636 2636
             WHERE id NOT IN %li
2637 2637
             AND public_key != ""',
2638 2638
             $user_ids
@@ -2641,7 +2641,7 @@  discard block
 block discarded – undo
2641 2641
         foreach ($users as $user) {
2642 2642
             // Insert in DB the new object key for this item by user
2643 2643
             if (count($objectKeyArray) === 0) {
2644
-                if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case1 - ' . $object_name . ' - ' . $post_object_id . ' - ' . $user['id'] . ' - ' . $objectKey);
2644
+                if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case1 - '.$object_name.' - '.$post_object_id.' - '.$user['id'].' - '.$objectKey);
2645 2645
                 DB::insert(
2646 2646
                     $object_name,
2647 2647
                     [
@@ -2655,7 +2655,7 @@  discard block
 block discarded – undo
2655 2655
                 );
2656 2656
             } else {
2657 2657
                 foreach ($objectKeyArray as $object) {
2658
-                    if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case2 - ' . $object_name . ' - ' . $object['objectId'] . ' - ' . $user['id'] . ' - ' . $object['objectKey']);
2658
+                    if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case2 - '.$object_name.' - '.$object['objectId'].' - '.$user['id'].' - '.$object['objectKey']);
2659 2659
                     DB::insert(
2660 2660
                         $object_name,
2661 2661
                         [
@@ -2683,7 +2683,7 @@  discard block
 block discarded – undo
2683 2683
 function isBase64(string $str): bool
2684 2684
 {
2685 2685
     $str = (string) trim($str);
2686
-    if (! isset($str[0])) {
2686
+    if (!isset($str[0])) {
2687 2687
         return false;
2688 2688
     }
2689 2689
 
@@ -2757,7 +2757,7 @@  discard block
 block discarded – undo
2757 2757
     } catch (\LdapRecord\Auth\BindException $e) {
2758 2758
         $error = $e->getDetailedError();
2759 2759
         if ($error && defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) {
2760
-            error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage(). " - ".$error->getDiagnosticMessage());
2760
+            error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage()." - ".$error->getDiagnosticMessage());
2761 2761
         }
2762 2762
         // deepcode ignore ServerLeak: No important data is sent
2763 2763
         echo 'An error occurred.';
@@ -2774,7 +2774,7 @@  discard block
 block discarded – undo
2774 2774
     } catch (\LdapRecord\Auth\BindException $e) {
2775 2775
         $error = $e->getDetailedError();
2776 2776
         if ($error && defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) {
2777
-            error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage(). " - ".$error->getDiagnosticMessage());
2777
+            error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage()." - ".$error->getDiagnosticMessage());
2778 2778
         }
2779 2779
         // deepcode ignore ServerLeak: No important data is sent
2780 2780
         echo 'An error occurred.';
@@ -2801,7 +2801,7 @@  discard block
 block discarded – undo
2801 2801
     // expect if personal item
2802 2802
     DB::delete(
2803 2803
         prefixTable('sharekeys_items'),
2804
-        'user_id = %i AND object_id NOT IN (SELECT i.id FROM ' . prefixTable('items') . ' AS i WHERE i.perso = 1)',
2804
+        'user_id = %i AND object_id NOT IN (SELECT i.id FROM '.prefixTable('items').' AS i WHERE i.perso = 1)',
2805 2805
         $userId
2806 2806
     );
2807 2807
     // Remove all item sharekeys files
@@ -2809,8 +2809,8 @@  discard block
 block discarded – undo
2809 2809
         prefixTable('sharekeys_files'),
2810 2810
         'user_id = %i AND object_id NOT IN (
2811 2811
             SELECT f.id 
2812
-            FROM ' . prefixTable('items') . ' AS i 
2813
-            INNER JOIN ' . prefixTable('files') . ' AS f ON f.id_item = i.id
2812
+            FROM ' . prefixTable('items').' AS i 
2813
+            INNER JOIN ' . prefixTable('files').' AS f ON f.id_item = i.id
2814 2814
             WHERE i.perso = 1
2815 2815
         )',
2816 2816
         $userId
@@ -2820,8 +2820,8 @@  discard block
 block discarded – undo
2820 2820
         prefixTable('sharekeys_fields'),
2821 2821
         'user_id = %i AND object_id NOT IN (
2822 2822
             SELECT c.id 
2823
-            FROM ' . prefixTable('items') . ' AS i 
2824
-            INNER JOIN ' . prefixTable('categories_items') . ' AS c ON c.item_id = i.id
2823
+            FROM ' . prefixTable('items').' AS i 
2824
+            INNER JOIN ' . prefixTable('categories_items').' AS c ON c.item_id = i.id
2825 2825
             WHERE i.perso = 1
2826 2826
         )',
2827 2827
         $userId
@@ -2829,13 +2829,13 @@  discard block
 block discarded – undo
2829 2829
     // Remove all item sharekeys logs
2830 2830
     DB::delete(
2831 2831
         prefixTable('sharekeys_logs'),
2832
-        'user_id = %i AND object_id NOT IN (SELECT i.id FROM ' . prefixTable('items') . ' AS i WHERE i.perso = 1)',
2832
+        'user_id = %i AND object_id NOT IN (SELECT i.id FROM '.prefixTable('items').' AS i WHERE i.perso = 1)',
2833 2833
         $userId
2834 2834
     );
2835 2835
     // Remove all item sharekeys suggestions
2836 2836
     DB::delete(
2837 2837
         prefixTable('sharekeys_suggestions'),
2838
-        'user_id = %i AND object_id NOT IN (SELECT i.id FROM ' . prefixTable('items') . ' AS i WHERE i.perso = 1)',
2838
+        'user_id = %i AND object_id NOT IN (SELECT i.id FROM '.prefixTable('items').' AS i WHERE i.perso = 1)',
2839 2839
         $userId
2840 2840
     );
2841 2841
     return false;
@@ -2856,7 +2856,7 @@  discard block
 block discarded – undo
2856 2856
         foreach (DateTimeZone::listIdentifiers() as $timezone) {
2857 2857
             $now->setTimezone(new DateTimeZone($timezone));
2858 2858
             $offsets[] = $offset = $now->getOffset();
2859
-            $timezones[$timezone] = '(' . format_GMT_offset($offset) . ') ' . format_timezone_name($timezone);
2859
+            $timezones[$timezone] = '('.format_GMT_offset($offset).') '.format_timezone_name($timezone);
2860 2860
         }
2861 2861
 
2862 2862
         array_multisort($offsets, $timezones);
@@ -2876,7 +2876,7 @@  discard block
 block discarded – undo
2876 2876
 {
2877 2877
     $hours = intval($offset / 3600);
2878 2878
     $minutes = abs(intval($offset % 3600 / 60));
2879
-    return 'GMT' . ($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
2879
+    return 'GMT'.($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
2880 2880
 }
2881 2881
 
2882 2882
 /**
@@ -2975,8 +2975,7 @@  discard block
 block discarded – undo
2975 2975
 {
2976 2976
     if (isset($array[$key]) === true
2977 2977
         && (is_int($value) === true ?
2978
-            (int) $array[$key] === $value :
2979
-            (string) $array[$key] === $value)
2978
+            (int) $array[$key] === $value : (string) $array[$key] === $value)
2980 2979
     ) {
2981 2980
         return true;
2982 2981
     }
@@ -2998,8 +2997,7 @@  discard block
 block discarded – undo
2998 2997
 {
2999 2998
     if (isset($var) === false
3000 2999
         || (is_int($value) === true ?
3001
-            (int) $var === $value :
3002
-            (string) $var === $value)
3000
+            (int) $var === $value : (string) $var === $value)
3003 3001
     ) {
3004 3002
         return true;
3005 3003
     }
@@ -3050,7 +3048,7 @@  discard block
 block discarded – undo
3050 3048
  */
3051 3049
 function isSetArrayOfValues(array $arrayOfValues): bool
3052 3050
 {
3053
-    foreach($arrayOfValues as $value) {
3051
+    foreach ($arrayOfValues as $value) {
3054 3052
         if (isset($value) === false) {
3055 3053
             return false;
3056 3054
         }
@@ -3072,7 +3070,7 @@  discard block
 block discarded – undo
3072 3070
     /*PHP8 - integer|string*/$value
3073 3071
 ) : bool
3074 3072
 {
3075
-    foreach($arrayOfVars as $variable) {
3073
+    foreach ($arrayOfVars as $variable) {
3076 3074
         if ($variable !== $value) {
3077 3075
             return false;
3078 3076
         }
@@ -3092,7 +3090,7 @@  discard block
 block discarded – undo
3092 3090
     /*PHP8 - integer|string*/$value
3093 3091
 ) : bool
3094 3092
 {
3095
-    foreach($arrayOfVars as $variable) {
3093
+    foreach ($arrayOfVars as $variable) {
3096 3094
         if ($variable === $value) {
3097 3095
             return true;
3098 3096
         }
@@ -3106,7 +3104,7 @@  discard block
 block discarded – undo
3106 3104
  * @param string|int|null $value
3107 3105
  * @return boolean
3108 3106
  */
3109
-function isValueSetNullEmpty(string|int|null $value) : bool
3107
+function isValueSetNullEmpty(string | int | null $value) : bool
3110 3108
 {
3111 3109
     if (is_null($value) === true || empty($value) === true) {
3112 3110
         return true;
@@ -3161,7 +3159,7 @@  discard block
 block discarded – undo
3161 3159
  * @param array     $filters
3162 3160
  * @return array|string
3163 3161
  */
3164
-function dataSanitizer(array $data, array $filters): array|string
3162
+function dataSanitizer(array $data, array $filters): array | string
3165 3163
 {
3166 3164
     // Load Sanitizer library
3167 3165
     $sanitizer = new Sanitizer($data, $filters);
@@ -3190,7 +3188,7 @@  discard block
 block discarded – undo
3190 3188
     // Exists ?
3191 3189
     $userCacheId = DB::queryFirstRow(
3192 3190
         'SELECT increment_id
3193
-        FROM ' . prefixTable('cache_tree') . '
3191
+        FROM ' . prefixTable('cache_tree').'
3194 3192
         WHERE user_id = %i',
3195 3193
         $user_id
3196 3194
     );
@@ -3241,7 +3239,7 @@  discard block
 block discarded – undo
3241 3239
  */
3242 3240
 function pourcentage(float $nombre, float $total, float $pourcentage): float
3243 3241
 { 
3244
-    $resultat = ($nombre/$total) * $pourcentage;
3242
+    $resultat = ($nombre / $total) * $pourcentage;
3245 3243
     return round($resultat);
3246 3244
 }
3247 3245
 
@@ -3271,7 +3269,7 @@  discard block
 block discarded – undo
3271 3269
 
3272 3270
     // Get last folder update
3273 3271
     $lastFolderChange = DB::queryFirstRow(
3274
-        'SELECT valeur FROM ' . prefixTable('misc') . '
3272
+        'SELECT valeur FROM '.prefixTable('misc').'
3275 3273
         WHERE type = %s AND intitule = %s',
3276 3274
         'timestamp',
3277 3275
         'last_folder_change'
@@ -3302,7 +3300,7 @@  discard block
 block discarded – undo
3302 3300
     // Does this user has a tree cache
3303 3301
     $userCacheTree = DB::queryFirstRow(
3304 3302
         'SELECT '.$fieldName.'
3305
-        FROM ' . prefixTable('cache_tree') . '
3303
+        FROM ' . prefixTable('cache_tree').'
3306 3304
         WHERE user_id = %i',
3307 3305
         $session->get('user-id')
3308 3306
     );
@@ -3345,7 +3343,7 @@  discard block
 block discarded – undo
3345 3343
     if (count($folderIds) === 0) {
3346 3344
         $folderIds = DB::queryFirstColumn(
3347 3345
             'SELECT id
3348
-            FROM ' . prefixTable('nested_tree') . '
3346
+            FROM ' . prefixTable('nested_tree').'
3349 3347
             WHERE personal_folder=%i',
3350 3348
             0
3351 3349
         );
@@ -3362,8 +3360,8 @@  discard block
 block discarded – undo
3362 3360
         $rows_tmp = DB::query(
3363 3361
             'SELECT c.id, c.title, c.level, c.type, c.masked, c.order, c.encrypted_data, c.role_visibility, c.is_mandatory,
3364 3362
             f.id_category AS category_id
3365
-            FROM ' . prefixTable('categories_folders') . ' AS f
3366
-            INNER JOIN ' . prefixTable('categories') . ' AS c ON (f.id_category = c.parent_id)
3363
+            FROM ' . prefixTable('categories_folders').' AS f
3364
+            INNER JOIN ' . prefixTable('categories').' AS c ON (f.id_category = c.parent_id)
3367 3365
             WHERE id_folder=%i',
3368 3366
             $folder
3369 3367
         );
@@ -3389,7 +3387,7 @@  discard block
 block discarded – undo
3389 3387
         $valTemp = '';
3390 3388
         $data = DB::queryFirstRow(
3391 3389
             'SELECT valeur
3392
-            FROM ' . prefixTable('misc') . '
3390
+            FROM ' . prefixTable('misc').'
3393 3391
             WHERE type = %s AND intitule=%i',
3394 3392
             'complex',
3395 3393
             $folder
@@ -3406,14 +3404,14 @@  discard block
 block discarded – undo
3406 3404
         $valTemp = '';
3407 3405
         $rows_tmp = DB::query(
3408 3406
             'SELECT t.title
3409
-            FROM ' . prefixTable('roles_values') . ' as v
3410
-            INNER JOIN ' . prefixTable('roles_title') . ' as t ON (v.role_id = t.id)
3407
+            FROM ' . prefixTable('roles_values').' as v
3408
+            INNER JOIN ' . prefixTable('roles_title').' as t ON (v.role_id = t.id)
3411 3409
             WHERE v.folder_id = %i
3412 3410
             GROUP BY title',
3413 3411
             $folder
3414 3412
         );
3415 3413
         foreach ($rows_tmp as $record) {
3416
-            $valTemp .= (empty($valTemp) === true ? '' : ' - ') . $record['title'];
3414
+            $valTemp .= (empty($valTemp) === true ? '' : ' - ').$record['title'];
3417 3415
         }
3418 3416
         $arr_data['visibilityRoles'] = $valTemp;
3419 3417
 
@@ -3446,7 +3444,7 @@  discard block
 block discarded – undo
3446 3444
         // loop on users and check if user has this role
3447 3445
         $rows = DB::query(
3448 3446
             'SELECT id, fonction_id
3449
-            FROM ' . prefixTable('users') . '
3447
+            FROM ' . prefixTable('users').'
3450 3448
             WHERE id != %i AND admin = 0 AND fonction_id IS NOT NULL AND fonction_id != ""',
3451 3449
             $session->get('user-id')
3452 3450
         );
@@ -3478,7 +3476,7 @@  discard block
 block discarded – undo
3478 3476
 
3479 3477
     $val = DB::queryFirstRow(
3480 3478
         'SELECT *
3481
-        FROM ' . prefixTable('users') . '
3479
+        FROM ' . prefixTable('users').'
3482 3480
         WHERE id = %i',
3483 3481
         $userId
3484 3482
     );
@@ -3494,12 +3492,12 @@  discard block
 block discarded – undo
3494 3492
 function upgradeRequired(): bool
3495 3493
 {
3496 3494
     // Get settings.php
3497
-    include_once __DIR__. '/../includes/config/settings.php';
3495
+    include_once __DIR__.'/../includes/config/settings.php';
3498 3496
 
3499 3497
     // Get timestamp in DB
3500 3498
     $val = DB::queryFirstRow(
3501 3499
         'SELECT valeur
3502
-        FROM ' . prefixTable('misc') . '
3500
+        FROM ' . prefixTable('misc').'
3503 3501
         WHERE type = %s AND intitule = %s',
3504 3502
         'admin',
3505 3503
         'upgrade_timestamp'
@@ -3547,7 +3545,7 @@  discard block
 block discarded – undo
3547 3545
         $session = SessionManager::getSession();
3548 3546
         $lang = new Language($session->get('user-language') ?? 'english');
3549 3547
 
3550
-        error_log('TEAMPASS Debug - handleUserKeys - userId: ' . $userId . ' - generate_user_new_password: ' . ($generate_user_new_password ? 'true' : 'false'));
3548
+        error_log('TEAMPASS Debug - handleUserKeys - userId: '.$userId.' - generate_user_new_password: '.($generate_user_new_password ? 'true' : 'false'));
3551 3549
         // Validate user existence
3552 3550
         $userTP = validateUserExistence($userId);
3553 3551
         if ($userTP === null) {
@@ -3636,7 +3634,7 @@  discard block
 block discarded – undo
3636 3634
 function validateUserExistence(int $userId): ?array {
3637 3635
     $userTP = DB::queryFirstRow(
3638 3636
         'SELECT pw, public_key, private_key
3639
-        FROM ' . prefixTable('users') . '
3637
+        FROM ' . prefixTable('users').'
3640 3638
         WHERE id = %i',
3641 3639
         TP_USER_ID
3642 3640
     );
@@ -3708,7 +3706,7 @@  discard block
 block discarded – undo
3708 3706
 ): bool {
3709 3707
     $session = SessionManager::getSession();
3710 3708
     $passwordManager = new PasswordManager();
3711
-    $affectedRows  = DB::update(
3709
+    $affectedRows = DB::update(
3712 3710
         prefixTable('users'),
3713 3711
         [
3714 3712
             'pw' => $passwordManager->hashPassword($passwordClear),
@@ -3821,19 +3819,19 @@  discard block
 block discarded – undo
3821 3819
 
3822 3820
     // Prepare the subtask queries
3823 3821
     $queries = [
3824
-        'step20' => 'SELECT * FROM ' . prefixTable('items'),
3822
+        'step20' => 'SELECT * FROM '.prefixTable('items'),
3825 3823
 
3826
-        'step30' => 'SELECT * FROM ' . prefixTable('log_items') . 
3824
+        'step30' => 'SELECT * FROM '.prefixTable('log_items'). 
3827 3825
                     ' WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"',
3828 3826
 
3829
-        'step40' => 'SELECT * FROM ' . prefixTable('categories_items') . 
3827
+        'step40' => 'SELECT * FROM '.prefixTable('categories_items'). 
3830 3828
                     ' WHERE encryption_type = "teampass_aes"',
3831 3829
 
3832
-        'step50' => 'SELECT * FROM ' . prefixTable('suggestion'),
3830
+        'step50' => 'SELECT * FROM '.prefixTable('suggestion'),
3833 3831
 
3834
-        'step60' => 'SELECT * FROM ' . prefixTable('files') . ' AS f
3835
-                        INNER JOIN ' . prefixTable('items') . ' AS i ON i.id = f.id_item
3836
-                        WHERE f.status = "' . TP_ENCRYPTION_NAME . '"'
3832
+        'step60' => 'SELECT * FROM '.prefixTable('files').' AS f
3833
+                        INNER JOIN ' . prefixTable('items').' AS i ON i.id = f.id_item
3834
+                        WHERE f.status = "' . TP_ENCRYPTION_NAME.'"'
3837 3835
     ];
3838 3836
 
3839 3837
     // Perform loop on $queries to create sub-tasks
@@ -4023,7 +4021,7 @@  discard block
 block discarded – undo
4023 4021
  */
4024 4022
 function createTaskForItem(
4025 4023
     string $processType,
4026
-    string|array $taskName,
4024
+    string | array $taskName,
4027 4025
     int $itemId,
4028 4026
     int $userId,
4029 4027
     string $objectKey,
@@ -4047,7 +4045,7 @@  discard block
 block discarded – undo
4047 4045
                 'object_key' => $objectKey,
4048 4046
                 'author' => (int) $userId,
4049 4047
             ]),
4050
-            'item_id' => (int) $parentId !== -1 ?  $parentId : null,
4048
+            'item_id' => (int) $parentId !== -1 ? $parentId : null,
4051 4049
         )
4052 4050
     );
4053 4051
     $processId = DB::insertId();
@@ -4057,7 +4055,7 @@  discard block
 block discarded – undo
4057 4055
     if (is_array($taskName) === false) {
4058 4056
         $taskName = [$taskName];
4059 4057
     }
4060
-    foreach($taskName as $task) {
4058
+    foreach ($taskName as $task) {
4061 4059
         if (WIP === true) error_log('createTaskForItem - task: '.$task);
4062 4060
         switch ($task) {
4063 4061
             case 'item_password':
@@ -4154,7 +4152,7 @@  discard block
 block discarded – undo
4154 4152
  * @param integer $user_id
4155 4153
  * @return void
4156 4154
  */
4157
-function purgeUnnecessaryKeys(bool $allUsers = true, int $user_id=0)
4155
+function purgeUnnecessaryKeys(bool $allUsers = true, int $user_id = 0)
4158 4156
 {
4159 4157
     if ($allUsers === true) {
4160 4158
         // Load class DB
@@ -4164,7 +4162,7 @@  discard block
 block discarded – undo
4164 4162
 
4165 4163
         $users = DB::query(
4166 4164
             'SELECT id
4167
-            FROM ' . prefixTable('users') . '
4165
+            FROM ' . prefixTable('users').'
4168 4166
             WHERE id NOT IN ('.OTV_USER_ID.', '.TP_USER_ID.', '.SSH_USER_ID.', '.API_USER_ID.')
4169 4167
             ORDER BY login ASC'
4170 4168
         );
@@ -4182,7 +4180,7 @@  discard block
 block discarded – undo
4182 4180
  * @param integer $user_id
4183 4181
  * @return void
4184 4182
  */
4185
-function purgeUnnecessaryKeysForUser(int $user_id=0)
4183
+function purgeUnnecessaryKeysForUser(int $user_id = 0)
4186 4184
 {
4187 4185
     if ($user_id === 0) {
4188 4186
         return;
@@ -4193,8 +4191,8 @@  discard block
 block discarded – undo
4193 4191
 
4194 4192
     $personalItems = DB::queryFirstColumn(
4195 4193
         'SELECT id
4196
-        FROM ' . prefixTable('items') . ' AS i
4197
-        INNER JOIN ' . prefixTable('log_items') . ' AS li ON li.id_item = i.id
4194
+        FROM ' . prefixTable('items').' AS i
4195
+        INNER JOIN ' . prefixTable('log_items').' AS li ON li.id_item = i.id
4198 4196
         WHERE i.perso = 1 AND li.action = "at_creation" AND li.id_user IN (%i, '.TP_USER_ID.')',
4199 4197
         $user_id
4200 4198
     );
@@ -4243,7 +4241,7 @@  discard block
 block discarded – undo
4243 4241
     // Check if user exists
4244 4242
     $userInfo = DB::queryFirstRow(
4245 4243
         'SELECT login
4246
-        FROM ' . prefixTable('users') . '
4244
+        FROM ' . prefixTable('users').'
4247 4245
         WHERE id = %i',
4248 4246
         $userId
4249 4247
     );
@@ -4252,7 +4250,7 @@  discard block
 block discarded – undo
4252 4250
         $now = (int) time();
4253 4251
         // Prepare file content
4254 4252
         $export_value = file_get_contents(__DIR__."/../includes/core/teampass_ascii.txt")."\n".
4255
-            "Generation date: ".date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], $now)."\n\n".
4253
+            "Generation date: ".date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], $now)."\n\n".
4256 4254
             "RECOVERY KEYS - Not to be shared - To be store safely\n\n".
4257 4255
             "Public Key:\n".$session->get('user-public_key')."\n\n".
4258 4256
             "Private Key:\n".$session->get('user-private_key')."\n\n";
@@ -4275,7 +4273,7 @@  discard block
 block discarded – undo
4275 4273
         return prepareExchangedData(
4276 4274
             array(
4277 4275
                 'error' => false,
4278
-                'datetime' => date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], $now),
4276
+                'datetime' => date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], $now),
4279 4277
                 'timestamp' => $now,
4280 4278
                 'content' => base64_encode($export_value),
4281 4279
                 'login' => $userInfo['login'],
@@ -4301,8 +4299,8 @@  discard block
 block discarded – undo
4301 4299
  */
4302 4300
 function loadClasses(string $className = ''): void
4303 4301
 {
4304
-    require_once __DIR__. '/../includes/config/include.php';
4305
-    require_once __DIR__. '/../includes/config/settings.php';
4302
+    require_once __DIR__.'/../includes/config/include.php';
4303
+    require_once __DIR__.'/../includes/config/settings.php';
4306 4304
     require_once __DIR__.'/../vendor/autoload.php';
4307 4305
 
4308 4306
     if (defined('DB_PASSWD_CLEAR') === false) {
@@ -4515,7 +4513,7 @@  discard block
 block discarded – undo
4515 4513
 
4516 4514
     // Get current user hash
4517 4515
     $userHash = DB::queryFirstRow(
4518
-        "SELECT pw FROM " . prefixtable('users') . " WHERE id = %d;",
4516
+        "SELECT pw FROM ".prefixtable('users')." WHERE id = %d;",
4519 4517
         $session->get('user-id')
4520 4518
     )['pw'];
4521 4519
 
@@ -4563,11 +4561,11 @@  discard block
 block discarded – undo
4563 4561
         }
4564 4562
         
4565 4563
         // Alternative: serialize ou json selon le contexte
4566
-        return get_class($value) . (method_exists($value, 'getId') ? '#' . $value->getId() : '');
4564
+        return get_class($value).(method_exists($value, 'getId') ? '#'.$value->getId() : '');
4567 4565
     }
4568 4566
     
4569 4567
     if (is_resource($value)) {
4570
-        return 'Resource#' . get_resource_id($value) . ' of type ' . get_resource_type($value);
4568
+        return 'Resource#'.get_resource_id($value).' of type '.get_resource_type($value);
4571 4569
     }
4572 4570
     
4573 4571
     // Cas par défaut
Please login to merge, or discard this patch.
sources/core/services/QRCodeService.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     {
53 53
         if ($this->isResetBlocked($params['origin'])) {
54 54
             return $this->respondError(
55
-                "113 " . $this->lang->get('error_not_allowed_to') . " - " .
55
+                "113 ".$this->lang->get('error_not_allowed_to')." - ".
56 56
                 isKeyExistingAndEqual('ga_reset_by_user', 1, $this->settings)
57 57
             );
58 58
         }
@@ -83,10 +83,10 @@  discard block
 block discarded – undo
83 83
 
84 84
         [$secretKey, $temporaryCode] = $this->generateAndStoreSecret($user['id']);
85 85
 
86
-        logEvents($this->settings, 'user_connection', 'at_2fa_google_code_send_by_email', (string)$user['id'], stripslashes($params['login']), stripslashes($params['login']));
86
+        logEvents($this->settings, 'user_connection', 'at_2fa_google_code_send_by_email', (string) $user['id'], stripslashes($params['login']), stripslashes($params['login']));
87 87
         DB::update(prefixTable('tokens'), ['end_timestamp' => time()], 'id = %i', $tokenId);
88 88
 
89
-        if ((int)$params['send_mail'] === 1) {
89
+        if ((int) $params['send_mail'] === 1) {
90 90
             $this->send2FACodeByEmail($user['email'], $temporaryCode);
91 91
 
92 92
             return $this->respondSuccess($user['email'], $params['send_mail']);
@@ -105,12 +105,12 @@  discard block
 block discarded – undo
105 105
     {
106 106
         if (isValueSetNullEmpty($id)) {
107 107
             $user = DB::queryFirstRow(
108
-                'SELECT id, email, pw FROM ' . prefixTable('users') . ' WHERE login = %s',
108
+                'SELECT id, email, pw FROM '.prefixTable('users').' WHERE login = %s',
109 109
                 $login
110 110
             );
111 111
         } else {
112 112
             $user = DB::queryFirstRow(
113
-                'SELECT id, login, email, pw FROM ' . prefixTable('users') . ' WHERE id = %i',
113
+                'SELECT id, login, email, pw FROM '.prefixTable('users').' WHERE id = %i',
114 114
                 $id
115 115
             );
116 116
             $login = $user['login'] ?? $login;
@@ -119,10 +119,10 @@  discard block
 block discarded – undo
119 119
         return DB::count() > 0 ? $user : null;
120 120
     }
121 121
 
122
-    private function handleToken(string $token, int $userId): int|false
122
+    private function handleToken(string $token, int $userId): int | false
123 123
     {
124 124
         $dataToken = DB::queryFirstRow(
125
-            'SELECT end_timestamp, reason FROM ' . prefixTable('tokens') . ' WHERE token = %s AND user_id = %i',
125
+            'SELECT end_timestamp, reason FROM '.prefixTable('tokens').' WHERE token = %s AND user_id = %i',
126 126
             $token,
127 127
             $userId
128 128
         );
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
             return DB::insertId();
146 146
         }
147 147
 
148
-        return (int) DB::queryFirstField('SELECT id FROM ' . prefixTable('tokens') . ' WHERE token = %s AND user_id = %i', $token, $userId);
148
+        return (int) DB::queryFirstField('SELECT id FROM '.prefixTable('tokens').' WHERE token = %s AND user_id = %i', $token, $userId);
149 149
     }
150 150
 
151 151
     private function generateAndStoreSecret(int $userId): array
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
             'email' => $email,
186 186
             'email_result' => str_replace(
187 187
                 '#email#',
188
-                '<b>' . obfuscateEmail($email) . '</b>',
188
+                '<b>'.obfuscateEmail($email).'</b>',
189 189
                 addslashes($this->lang->get('admin_email_result_ok'))
190 190
             ),
191 191
         ], 'encode');
Please login to merge, or discard this patch.
sources/core/services/OneTimeCodeService.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
65 65
     private function getUser(int $userId): ?array
66 66
     {
67 67
         $user = DB::queryFirstRow(
68
-            'SELECT email, auth_type, login FROM ' . prefixTable('users') . ' WHERE id = %i',
68
+            'SELECT email, auth_type, login FROM '.prefixTable('users').' WHERE id = %i',
69 69
             $userId
70 70
         );
71 71
 
Please login to merge, or discard this patch.
sources/identify.php 1 patch
Spacing   +41 added lines, -42 removed lines patch added patch discarded remove patch
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
         return $dataReceived;
488 488
     }
489 489
 
490
-    private function handleDuoAuthentication(array $dataReceived): array|false
490
+    private function handleDuoAuthentication(array $dataReceived): array | false
491 491
     {
492 492
         if (!$this->isDuoAuthInProgress($dataReceived)) {
493 493
             return $dataReceived;
@@ -659,8 +659,7 @@  discard block
 block discarded – undo
659 659
         }
660 660
 
661 661
         // Setup API key
662
-        $apiKey = empty($userInfo['api_key']) ? '' : 
663
-            base64_decode(decryptUserObjectKey($userInfo['api_key'], $returnKeys['private_key_clear']));
662
+        $apiKey = empty($userInfo['api_key']) ? '' : base64_decode(decryptUserObjectKey($userInfo['api_key'], $returnKeys['private_key_clear']));
664 663
         $this->session->set('user-api_key', $apiKey);
665 664
     }
666 665
 
@@ -681,7 +680,7 @@  discard block
 block discarded – undo
681 680
         if (!is_null($userInfo['roles_from_ad_groups'])) {
682 681
             $userInfo['fonction_id'] = empty($userInfo['fonction_id']) 
683 682
                 ? $userInfo['roles_from_ad_groups'] 
684
-                : $userInfo['fonction_id'] . ';' . $userInfo['roles_from_ad_groups'];
683
+                : $userInfo['fonction_id'].';'.$userInfo['roles_from_ad_groups'];
685 684
         }
686 685
 
687 686
         $this->session->set('user-roles', $userInfo['fonction_id']);
@@ -701,7 +700,7 @@  discard block
 block discarded – undo
701 700
         }
702 701
 
703 702
         $rolesList = DB::query(
704
-            'SELECT id, title, complexity FROM ' . prefixTable('roles_title') . ' WHERE id IN %li',
703
+            'SELECT id, title, complexity FROM '.prefixTable('roles_title').' WHERE id IN %li',
705 704
             $this->session->get('user-roles_array')
706 705
         );
707 706
 
@@ -855,7 +854,7 @@  discard block
 block discarded – undo
855 854
     private function setupUserCache(array $userInfo): void
856 855
     {
857 856
         $cacheTreeData = DB::queryFirstRow(
858
-            'SELECT visible_folders FROM ' . prefixTable('cache_tree') . ' WHERE user_id=%i',
857
+            'SELECT visible_folders FROM '.prefixTable('cache_tree').' WHERE user_id=%i',
859 858
             (int) $this->session->get('user-id')
860 859
         );
861 860
 
@@ -886,7 +885,7 @@  discard block
 block discarded – undo
886 885
         foreach ($this->session->get('user-latest_items') as $item) {
887 886
             if (!empty($item)) {
888 887
                 $dataLastItems = DB::queryFirstRow(
889
-                    'SELECT id,label,id_tree FROM ' . prefixTable('items') . ' WHERE id=%i',
888
+                    'SELECT id,label,id_tree FROM '.prefixTable('items').' WHERE id=%i',
890 889
                     $item
891 890
                 );
892 891
                 
@@ -895,7 +894,7 @@  discard block
 block discarded – undo
895 894
                     [
896 895
                         'id' => $item,
897 896
                         'label' => $dataLastItems['label'],
898
-                        'url' => 'index.php?page=items&amp;group=' . $dataLastItems['id_tree'] . '&amp;id=' . $item,
897
+                        'url' => 'index.php?page=items&amp;group='.$dataLastItems['id_tree'].'&amp;id='.$item,
899 898
                     ],
900 899
                     'add'
901 900
                 );
@@ -911,7 +910,7 @@  discard block
 block discarded – undo
911 910
         }
912 911
 
913 912
         $adminUser = DB::queryFirstRow(
914
-            'SELECT email FROM ' . prefixTable('users') . " WHERE admin = %i and email != ''", 
913
+            'SELECT email FROM '.prefixTable('users')." WHERE admin = %i and email != ''", 
915 914
             1
916 915
         );
917 916
         
@@ -924,7 +923,7 @@  discard block
 block discarded – undo
924 923
             str_replace(
925 924
                 ['#tp_user#', '#tp_date#', '#tp_time#'],
926 925
                 [
927
-                    ' ' . $this->session->get('user-login') . ' (IP: ' . getClientIpServer() . ')',
926
+                    ' '.$this->session->get('user-login').' (IP: '.getClientIpServer().')',
928 927
                     date($this->settings['date_format'], (int) $this->session->get('user-last_connection')),
929 928
                     date($this->settings['time_format'], (int) $this->session->get('user-last_connection')),
930 929
                 ],
@@ -1072,7 +1071,7 @@  discard block
 block discarded – undo
1072 1071
 {
1073 1072
     $rows = DB::query(
1074 1073
         'SELECT date
1075
-        FROM ' . prefixTable('log_system') . "
1074
+        FROM ' . prefixTable('log_system')."
1076 1075
         WHERE field_1 = %s
1077 1076
         AND type = 'failed_auth'
1078 1077
         AND label = 'user_not_exists'
@@ -1086,7 +1085,7 @@  discard block
 block discarded – undo
1086 1085
         foreach ($rows as $record) {
1087 1086
             array_push(
1088 1087
                 $arrAttempts,
1089
-                date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date'])
1088
+                date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date'])
1090 1089
             );
1091 1090
         }
1092 1091
     }
@@ -1121,7 +1120,7 @@  discard block
 block discarded – undo
1121 1120
     $ldapConnection
1122 1121
 ) : bool
1123 1122
 {
1124
-    include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1123
+    include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1125 1124
 
1126 1125
     if ((int) $userInfoDisabled === 1) {
1127 1126
         return false;
@@ -1316,7 +1315,7 @@  discard block
 block discarded – undo
1316 1315
     } catch (Exception $e) {
1317 1316
         return [
1318 1317
             'error' => true,
1319
-            'message' => "Error: " . $e->getMessage(),
1318
+            'message' => "Error: ".$e->getMessage(),
1320 1319
         ];
1321 1320
     }
1322 1321
 }
@@ -1347,7 +1346,7 @@  discard block
 block discarded – undo
1347 1346
                 'type' => 'OpenLDAP'
1348 1347
             ];
1349 1348
         default:
1350
-            throw new Exception("Unsupported LDAP type: " . $SETTINGS['ldap_type']);
1349
+            throw new Exception("Unsupported LDAP type: ".$SETTINGS['ldap_type']);
1351 1350
     }
1352 1351
 }
1353 1352
 
@@ -1484,7 +1483,7 @@  discard block
 block discarded – undo
1484 1483
         );
1485 1484
     }
1486 1485
     
1487
-    throw new Exception("Unsupported LDAP type: " . $ldapHandler['type']);
1486
+    throw new Exception("Unsupported LDAP type: ".$ldapHandler['type']);
1488 1487
 }
1489 1488
 
1490 1489
 /**
@@ -1501,12 +1500,12 @@  discard block
 block discarded – undo
1501 1500
     if (isset($SETTINGS['enable_ad_users_with_ad_groups']) === true && (int) $SETTINGS['enable_ad_users_with_ad_groups'] === 1) {
1502 1501
         // Get user groups from AD
1503 1502
         $user_ad_groups = [];
1504
-        foreach($groups as $group) {
1503
+        foreach ($groups as $group) {
1505 1504
             //print_r($group);
1506 1505
             // get relation role id for AD group
1507 1506
             $role = DB::queryFirstRow(
1508 1507
                 'SELECT lgr.role_id
1509
-                FROM ' . prefixTable('ldap_groups_roles') . ' AS lgr
1508
+                FROM ' . prefixTable('ldap_groups_roles').' AS lgr
1510 1509
                 WHERE lgr.ldap_group_id = %s',
1511 1510
                 $group
1512 1511
             );
@@ -1637,7 +1636,7 @@  discard block
 block discarded – undo
1637 1636
             // Check if exists in DB
1638 1637
             $groupData = DB::queryFirstRow(
1639 1638
                 'SELECT id
1640
-                FROM ' . prefixTable('roles_title') . '
1639
+                FROM ' . prefixTable('roles_title').'
1641 1640
                 WHERE title = %s',
1642 1641
                 $group["displayName"]
1643 1642
             );
@@ -1778,7 +1777,7 @@  discard block
 block discarded – undo
1778 1777
             
1779 1778
             // generate new QR
1780 1779
             $new_2fa_qr = $tfa->getQRCodeImageAsDataUri(
1781
-                'Teampass - ' . $username,
1780
+                'Teampass - '.$username,
1782 1781
                 $userInfo['ga']
1783 1782
             );
1784 1783
             // clear temporary code from DB
@@ -1791,7 +1790,7 @@  discard block
 block discarded – undo
1791 1790
                 $userInfo['id']
1792 1791
             );
1793 1792
             $firstTime = [
1794
-                'value' => '<img src="' . $new_2fa_qr . '">',
1793
+                'value' => '<img src="'.$new_2fa_qr.'">',
1795 1794
                 'user_admin' => isset($sessionAdmin) ? (int) $sessionAdmin : '',
1796 1795
                 'initial_url' => isset($sessionUrl) === true ? $sessionUrl : '',
1797 1796
                 'pwd_attempts' => (int) $sessionPwdAttempts,
@@ -1947,7 +1946,7 @@  discard block
 block discarded – undo
1947 1946
         }*/
1948 1947
         return [
1949 1948
             'error' => true,
1950
-            'message' => $duo_error . $lang->get('duo_error_check_config'),
1949
+            'message' => $duo_error.$lang->get('duo_error_check_config'),
1951 1950
             'pwd_attempts' => (int) $sessionPwdAttempts,
1952 1951
             'debug_message' => $e->getMessage(),
1953 1952
             'proceedIdentification' => false,
@@ -1963,7 +1962,7 @@  discard block
 block discarded – undo
1963 1962
         } catch (DuoException $e) {
1964 1963
             return [
1965 1964
                 'error' => true,
1966
-                'message' => $duo_error . $lang->get('duo_error_url'),
1965
+                'message' => $duo_error.$lang->get('duo_error_url'),
1967 1966
                 'pwd_attempts' => (int) $sessionPwdAttempts,
1968 1967
                 'debug_message' => $e->getMessage(),
1969 1968
                 'proceedIdentification' => false,
@@ -1971,7 +1970,7 @@  discard block
 block discarded – undo
1971 1970
         }
1972 1971
         
1973 1972
         // Somethimes Duo return success but fail to return a URL, double check if the URL has been created
1974
-        if (!empty($duo_redirect_url) && filter_var($duo_redirect_url,FILTER_SANITIZE_URL)) {
1973
+        if (!empty($duo_redirect_url) && filter_var($duo_redirect_url, FILTER_SANITIZE_URL)) {
1975 1974
             // Since Duo Universal requires a redirect, let's store some info when the user get's back after completing the Duo prompt
1976 1975
             $key = hash('sha256', $duo_state);
1977 1976
             $iv = substr(hash('sha256', $duo_state), 0, 16);
@@ -1999,7 +1998,7 @@  discard block
 block discarded – undo
1999 1998
         } else {
2000 1999
             return [
2001 2000
                 'error' => true,
2002
-                'message' => $duo_error . $lang->get('duo_error_url'),
2001
+                'message' => $duo_error.$lang->get('duo_error_url'),
2003 2002
                 'pwd_attempts' => (int) $sessionPwdAttempts,
2004 2003
                 'proceedIdentification' => false,
2005 2004
             ];
@@ -2020,8 +2019,8 @@  discard block
 block discarded – undo
2020 2019
         // return the response (which should be the user name)
2021 2020
         if ($decoded_token['preferred_username'] === $username) {
2022 2021
             $session->set('user-duo_status', 'COMPLET');
2023
-            $session->set('user-duo_state','');
2024
-            $session->set('user-duo_data','');
2022
+            $session->set('user-duo_state', '');
2023
+            $session->set('user-duo_data', '');
2025 2024
             $session->set('user-login', $username);
2026 2025
 
2027 2026
             return [
@@ -2032,9 +2031,9 @@  discard block
 block discarded – undo
2032 2031
             ];
2033 2032
         } else {
2034 2033
             // Something wrong, username from the original Duo request is different than the one received now
2035
-            $session->set('user-duo_status','');
2036
-            $session->set('user-duo_state','');
2037
-            $session->set('user-duo_data','');
2034
+            $session->set('user-duo_status', '');
2035
+            $session->set('user-duo_state', '');
2036
+            $session->set('user-duo_data', '');
2038 2037
 
2039 2038
             return [
2040 2039
                 'error' => true,
@@ -2045,9 +2044,9 @@  discard block
 block discarded – undo
2045 2044
         }
2046 2045
     }
2047 2046
     // If we are here something wrong
2048
-    $session->set('user-duo_status','');
2049
-    $session->set('user-duo_state','');
2050
-    $session->set('user-duo_data','');
2047
+    $session->set('user-duo_status', '');
2048
+    $session->set('user-duo_state', '');
2049
+    $session->set('user-duo_data', '');
2051 2050
     return [
2052 2051
         'error' => true,
2053 2052
         'message' => $lang->get('duo_login_mismatch'),
@@ -2159,7 +2158,7 @@  discard block
 block discarded – undo
2159 2158
         // Check for existing lock
2160 2159
         $unlock_at = DB::queryFirstField(
2161 2160
             'SELECT MAX(unlock_at)
2162
-             FROM ' . prefixTable('auth_failures') . '
2161
+             FROM ' . prefixTable('auth_failures').'
2163 2162
              WHERE unlock_at > %s
2164 2163
              AND ((source = %s AND value = %s) OR (source = %s AND value = %s))',
2165 2164
             date('Y-m-d H:i:s', time()),
@@ -2181,8 +2180,8 @@  discard block
 block discarded – undo
2181 2180
         // Get user info from DB
2182 2181
         $data = DB::queryFirstRow(
2183 2182
             'SELECT u.*, a.value AS api_key
2184
-            FROM ' . prefixTable('users') . ' AS u
2185
-            LEFT JOIN ' . prefixTable('api') . ' AS a ON (u.id = a.user_id)
2183
+            FROM ' . prefixTable('users').' AS u
2184
+            LEFT JOIN ' . prefixTable('api').' AS a ON (u.id = a.user_id)
2186 2185
             WHERE login = %s AND deleted_at IS NULL',
2187 2186
             $login
2188 2187
         );
@@ -2300,7 +2299,7 @@  discard block
 block discarded – undo
2300 2299
             'array' => [
2301 2300
                 'value' => 'bruteforce_wait',
2302 2301
                 'error' => true,
2303
-                'message' => $lang->get('bruteforce_wait') . (string) $e->getMessage(),
2302
+                'message' => $lang->get('bruteforce_wait').(string) $e->getMessage(),
2304 2303
             ]
2305 2304
         ];
2306 2305
     }
@@ -2837,15 +2836,15 @@  discard block
 block discarded – undo
2837 2836
 
2838 2837
             if ($ret['error'] !== false) {
2839 2838
                 logEvents($SETTINGS, 'failed_auth', 'bad_duo_mfa', '', stripslashes($username), stripslashes($username));
2840
-                $session->set('user-duo_status','');
2841
-                $session->set('user-duo_state','');
2842
-                $session->set('user-duo_data','');
2839
+                $session->set('user-duo_status', '');
2840
+                $session->set('user-duo_state', '');
2841
+                $session->set('user-duo_data', '');
2843 2842
                 return [
2844 2843
                     'error' => true,
2845 2844
                     'mfaData' => $ret,
2846 2845
                     'mfaQRCodeInfos' => false,
2847 2846
                 ];
2848
-            } else if ($ret['duo_url_ready'] === true){
2847
+            } else if ($ret['duo_url_ready'] === true) {
2849 2848
                 return [
2850 2849
                     'error' => false,
2851 2850
                     'mfaData' => $ret,
@@ -2909,7 +2908,7 @@  discard block
 block discarded – undo
2909 2908
     // Count failed attempts from this source
2910 2909
     $count = DB::queryFirstField(
2911 2910
         'SELECT COUNT(*)
2912
-        FROM ' . prefixTable('auth_failures') . '
2911
+        FROM ' . prefixTable('auth_failures').'
2913 2912
         WHERE source = %s AND value = %s',
2914 2913
         $source,
2915 2914
         $value
Please login to merge, or discard this patch.
sources/main.queries.php 1 patch
Spacing   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 ) {
79 79
     // Not allowed page
80 80
     $session->set('system-error_code', ERR_NOT_ALLOWED);
81
-    include $SETTINGS['cpassman_dir'] . '/error.php';
81
+    include $SETTINGS['cpassman_dir'].'/error.php';
82 82
     exit;
83 83
 }
84 84
 
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 
267 267
             // Get current user hash
268 268
             $userHash = DB::queryFirstRow(
269
-                "SELECT pw FROM " . prefixtable('users') . " WHERE id = %d;",
269
+                "SELECT pw FROM ".prefixtable('users')." WHERE id = %d;",
270 270
                 $session->get('user-id')
271 271
             )['pw'];
272 272
 
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
  * @param string $post_key
322 322
  * @return string
323 323
  */
324
-function userHandler(string $post_type, array|null|string $dataReceived, array $SETTINGS, string $post_key): string
324
+function userHandler(string $post_type, array | null | string $dataReceived, array $SETTINGS, string $post_key): string
325 325
 {
326 326
     $session = SessionManager::getSession();
327 327
 
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
     if (isset($dataReceived['user_id'])) {
357 357
         // Get info about user to modify
358 358
         $targetUserInfos = DB::queryFirstRow(
359
-            'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM ' . prefixTable('users') . '
359
+            'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM '.prefixTable('users').'
360 360
             WHERE id = %i',
361 361
             $dataReceived['user_id']
362 362
         );
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
         case 'mail_me'://action_mail
506 506
             // Get info about user to send email
507 507
             $data_user = DB::queryFirstRow(
508
-                'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM ' . prefixTable('users') . '
508
+                'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM '.prefixTable('users').'
509 509
                 WHERE email = %s',
510 510
                 filter_var($dataReceived['receipt'], FILTER_SANITIZE_FULL_SPECIAL_CHARS)
511 511
             );
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
     if (isset($dataReceived['user_id'])) {
619 619
         // Get info about user to modify
620 620
         $targetUserInfos = DB::queryFirstRow(
621
-            'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM ' . prefixTable('users') . '
621
+            'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM '.prefixTable('users').'
622 622
             WHERE id = %i',
623 623
             $dataReceived['user_id']
624 624
         );
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
 
697 697
             // Get current user hash
698 698
             $userHash = DB::queryFirstRow(
699
-                "SELECT pw FROM " . prefixtable('users') . " WHERE id = %d;",
699
+                "SELECT pw FROM ".prefixtable('users')." WHERE id = %d;",
700 700
                 $session->get('user-id')
701 701
             )['pw'];
702 702
 
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
 
735 735
                 // Get current user hash
736 736
                 $userHash = DB::queryFirstRow(
737
-                    "SELECT pw FROM " . prefixtable('users') . " WHERE id = %d;",
737
+                    "SELECT pw FROM ".prefixtable('users')." WHERE id = %d;",
738 738
                     $session->get('user-id')
739 739
                 )['pw'];
740 740
 
@@ -778,7 +778,7 @@  discard block
 block discarded – undo
778 778
 
779 779
                 // Get current user hash
780 780
                 $userHash = DB::queryFirstRow(
781
-                    "SELECT pw FROM " . prefixtable('users') . " WHERE id = %i;",
781
+                    "SELECT pw FROM ".prefixtable('users')." WHERE id = %i;",
782 782
                     $session->get('user-id')
783 783
                 )['pw'];
784 784
 
@@ -857,7 +857,7 @@  discard block
 block discarded – undo
857 857
     }
858 858
 
859 859
     return prepareSuccessResponse([
860
-        'count' => getNumberOfItemsToTreat((int)$userId, $SETTINGS)
860
+        'count' => getNumberOfItemsToTreat((int) $userId, $SETTINGS)
861 861
     ]);
862 862
 }
863 863
 
@@ -953,12 +953,12 @@  discard block
 block discarded – undo
953 953
     // Generate token
954 954
     $passwordManager = new PasswordManager();
955 955
     $token = $passwordManager->generatePassword(
956
-        (int)$params['size'],
957
-        (bool)$params['secure'],
958
-        (bool)$params['numeric'],
959
-        (bool)$params['capital'],
960
-        (bool)$params['symbols'],
961
-        (bool)$params['lowercase']
956
+        (int) $params['size'],
957
+        (bool) $params['secure'],
958
+        (bool) $params['numeric'],
959
+        (bool) $params['capital'],
960
+        (bool) $params['symbols'],
961
+        (bool) $params['lowercase']
962 962
     );
963 963
 
964 964
     DB::insert(prefixTable('tokens'), [
@@ -966,7 +966,7 @@  discard block
 block discarded – undo
966 966
         'token' => $token,
967 967
         'reason' => $params['reason'],
968 968
         'creation_timestamp' => time(),
969
-        'end_timestamp' => time() + (int)$params['duration'],
969
+        'end_timestamp' => time() + (int) $params['duration'],
970 970
     ]);
971 971
 
972 972
     return prepareSuccessResponse(['token' => $token]);
@@ -1013,7 +1013,7 @@  discard block
 block discarded – undo
1013 1013
 
1014 1014
 
1015 1015
 
1016
-function utilsHandler(string $post_type, array|null|string $dataReceived, array $SETTINGS): string
1016
+function utilsHandler(string $post_type, array | null | string $dataReceived, array $SETTINGS): string
1017 1017
 {
1018 1018
     switch ($post_type) {
1019 1019
         /*
@@ -1082,7 +1082,7 @@  discard block
 block discarded – undo
1082 1082
         array(
1083 1083
             'error' => false,
1084 1084
             'timestamp' => $session->get('user-session_duration'),
1085
-            'max_time_to_add' => intdiv((($maximum_session_expiration_time*60) - ((int) $session->get('user-session_duration') - time())), 60),
1085
+            'max_time_to_add' => intdiv((($maximum_session_expiration_time * 60) - ((int) $session->get('user-session_duration') - time())), 60),
1086 1086
             'max_session_duration' => $maximum_session_expiration_time,
1087 1087
         ),
1088 1088
         'encode'
@@ -1134,7 +1134,7 @@  discard block
 block discarded – undo
1134 1134
     // get number of items
1135 1135
     DB::queryFirstRow(
1136 1136
         'SELECT increment_id
1137
-        FROM ' . prefixTable('sharekeys_items') .
1137
+        FROM ' . prefixTable('sharekeys_items').
1138 1138
         ' WHERE user_id = %i',
1139 1139
         $userId
1140 1140
     );
@@ -1189,7 +1189,7 @@  discard block
 block discarded – undo
1189 1189
         // check if expected security level is reached
1190 1190
         $dataUser = DB::queryFirstRow(
1191 1191
             'SELECT *
1192
-            FROM ' . prefixTable('users') . ' WHERE id = %i',
1192
+            FROM ' . prefixTable('users').' WHERE id = %i',
1193 1193
             $post_user_id
1194 1194
         );
1195 1195
 
@@ -1210,8 +1210,8 @@  discard block
 block discarded – undo
1210 1210
         if (empty($dataUser['fonction_id']) === false) {
1211 1211
             $data = DB::queryFirstRow(
1212 1212
                 'SELECT complexity
1213
-                FROM ' . prefixTable('roles_title') . '
1214
-                WHERE id IN (' . $dataUser['fonction_id'] . ')
1213
+                FROM ' . prefixTable('roles_title').'
1214
+                WHERE id IN (' . $dataUser['fonction_id'].')
1215 1215
                 ORDER BY complexity DESC'
1216 1216
             );
1217 1217
         } else {
@@ -1224,8 +1224,8 @@  discard block
 block discarded – undo
1224 1224
             return prepareExchangedData(
1225 1225
                 array(
1226 1226
                     'error' => true,
1227
-                    'message' => '<div style="margin:10px 0 10px 15px;">' . $lang->get('complexity_level_not_reached') . '.<br>' .
1228
-                        $lang->get('expected_complexity_level') . ': <b>' . TP_PW_COMPLEXITY[$data['complexity']][1] . '</b></div>',
1227
+                    'message' => '<div style="margin:10px 0 10px 15px;">'.$lang->get('complexity_level_not_reached').'.<br>'.
1228
+                        $lang->get('expected_complexity_level').': <b>'.TP_PW_COMPLEXITY[$data['complexity']][1].'</b></div>',
1229 1229
                 ),
1230 1230
                 'encode'
1231 1231
             );
@@ -1310,7 +1310,7 @@  discard block
 block discarded – undo
1310 1310
 
1311 1311
     if (isKeyExistingAndEqual('enable_send_email_on_user_login', 1, $SETTINGS) === true) {
1312 1312
         $row = DB::queryFirstRow(
1313
-            'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s',
1313
+            'SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s',
1314 1314
             'cron',
1315 1315
             'sending_emails'
1316 1316
         );
@@ -1318,7 +1318,7 @@  discard block
 block discarded – undo
1318 1318
         if ((int) (time() - $row['valeur']) >= 300 || (int) $row['valeur'] === 0) {
1319 1319
             $rows = DB::query(
1320 1320
                 'SELECT *
1321
-                FROM ' . prefixTable('emails') .
1321
+                FROM ' . prefixTable('emails').
1322 1322
                 ' WHERE status != %s',
1323 1323
                 'sent'
1324 1324
             );
@@ -1375,8 +1375,8 @@  discard block
 block discarded – undo
1375 1375
     $arr_html = array();
1376 1376
     $rows = DB::query(
1377 1377
         'SELECT i.id AS id, i.label AS label, i.id_tree AS id_tree, l.date, i.perso AS perso, i.restricted_to AS restricted
1378
-        FROM ' . prefixTable('log_items') . ' AS l
1379
-        RIGHT JOIN ' . prefixTable('items') . ' AS i ON (l.id_item = i.id)
1378
+        FROM ' . prefixTable('log_items').' AS l
1379
+        RIGHT JOIN ' . prefixTable('items').' AS i ON (l.id_item = i.id)
1380 1380
         WHERE l.action = %s AND l.id_user = %i
1381 1381
         ORDER BY l.date DESC
1382 1382
         LIMIT 0, 100',
@@ -1408,7 +1408,7 @@  discard block
 block discarded – undo
1408 1408
     if (isKeyExistingAndEqual('enable_suggestion', 1, $SETTINGS) === true
1409 1409
         && ((int) $session->get('user-admin') === 1 || (int) $session->get('user-manager') === 1)
1410 1410
     ) {
1411
-        DB::query('SELECT * FROM ' . prefixTable('suggestion'));
1411
+        DB::query('SELECT * FROM '.prefixTable('suggestion'));
1412 1412
         $nb_suggestions_waiting = DB::count();
1413 1413
     }
1414 1414
 
@@ -1448,13 +1448,13 @@  discard block
 block discarded – undo
1448 1448
             if ($data === 'stat_languages') {
1449 1449
                 $tmp = '';
1450 1450
                 foreach ($stats_data[$data] as $key => $value) {
1451
-                    $tmp .= $tmp === '' ? $key . '-' . $value : ',' . $key . '-' . $value;
1451
+                    $tmp .= $tmp === '' ? $key.'-'.$value : ','.$key.'-'.$value;
1452 1452
                 }
1453 1453
                 $statsToSend[$data] = $tmp;
1454 1454
             } elseif ($data === 'stat_country') {
1455 1455
                 $tmp = '';
1456 1456
                 foreach ($stats_data[$data] as $key => $value) {
1457
-                    $tmp .= $tmp === '' ? $key . '-' . $value : ',' . $key . '-' . $value;
1457
+                    $tmp .= $tmp === '' ? $key.'-'.$value : ','.$key.'-'.$value;
1458 1458
                 }
1459 1459
                 $statsToSend[$data] = $tmp;
1460 1460
             } else {
@@ -1540,7 +1540,7 @@  discard block
 block discarded – undo
1540 1540
     $anonymUrl = '';
1541 1541
     if (!empty($urlFound)) {
1542 1542
         $parsed = parse_url($urlFound);
1543
-        $anonymUrl = $parsed['scheme'] . '://<anonym_url>' . ($parsed['path'] ?? '');
1543
+        $anonymUrl = $parsed['scheme'].'://<anonym_url>'.($parsed['path'] ?? '');
1544 1544
     }
1545 1545
 
1546 1546
     // Filtrage et tri des réglages
@@ -1561,21 +1561,21 @@  discard block
 block discarded – undo
1561 1561
     // Récupère dernière erreur PHP
1562 1562
     $phpError = error_get_last();
1563 1563
     $phpErrorMsg = $phpError
1564
-        ? $phpError['message'] . ' - ' . $phpError['file'] . ' (' . $phpError['line'] . ')'
1564
+        ? $phpError['message'].' - '.$phpError['file'].' ('.$phpError['line'].')'
1565 1565
         : $lang->get('no_error_logged');
1566 1566
 
1567 1567
     // Dernières erreurs Teampass
1568 1568
     $teampassErrors = [];
1569 1569
     $errors = DB::query(
1570 1570
         'SELECT label, date AS error_date
1571
-         FROM ' . prefixTable('log_system') . "
1571
+         FROM ' . prefixTable('log_system')."
1572 1572
          WHERE `type` = 'error'
1573 1573
          ORDER BY `date` DESC
1574 1574
          LIMIT 10"
1575 1575
     );
1576 1576
 
1577 1577
     foreach ($errors as $record) {
1578
-        $teampassErrors[] = ' * ' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['error_date']) . ' - ' . $record['label'];
1578
+        $teampassErrors[] = ' * '.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['error_date']).' - '.$record['label'];
1579 1579
     }
1580 1580
     $teampassErrors = count($teampassErrors) > 0 ? implode("\n", $teampassErrors) : $lang->get('no_error_logged');
1581 1581
 
@@ -1664,7 +1664,7 @@  discard block
 block discarded – undo
1664 1664
         // Check if user exists
1665 1665
         $userInfo = DB::queryFirstRow(
1666 1666
             'SELECT public_key, private_key, pw, auth_type
1667
-            FROM ' . prefixTable('users') . '
1667
+            FROM ' . prefixTable('users').'
1668 1668
             WHERE id = %i',
1669 1669
             $post_user_id
1670 1670
         );
@@ -1673,9 +1673,9 @@  discard block
 block discarded – undo
1673 1673
             // Get one item
1674 1674
             $currentUserKey = DB::queryFirstRow(
1675 1675
                 'SELECT object_id, share_key, increment_id
1676
-                FROM ' . prefixTable('sharekeys_items') . ' AS si
1677
-                INNER JOIN ' . prefixTable('items') . ' AS i ON  (i.id = si.object_id)
1678
-                INNER JOIN ' . prefixTable('nested_tree') . ' AS nt ON  (i.id_tree = nt.id)
1676
+                FROM ' . prefixTable('sharekeys_items').' AS si
1677
+                INNER JOIN ' . prefixTable('items').' AS i ON  (i.id = si.object_id)
1678
+                INNER JOIN ' . prefixTable('nested_tree').' AS nt ON  (i.id_tree = nt.id)
1679 1679
                 WHERE user_id = %i AND nt.personal_folder = %i',
1680 1680
                 $post_user_id,
1681 1681
                 0
@@ -1769,7 +1769,7 @@  discard block
 block discarded – undo
1769 1769
         // Get user info
1770 1770
         $userData = DB::queryFirstRow(
1771 1771
             'SELECT private_key
1772
-            FROM ' . prefixTable('users') . '
1772
+            FROM ' . prefixTable('users').'
1773 1773
             WHERE id = %i',
1774 1774
             $post_user_id
1775 1775
         );
@@ -1850,7 +1850,7 @@  discard block
 block discarded – undo
1850 1850
         // Get user info
1851 1851
         $userData = DB::queryFirstRow(
1852 1852
             'SELECT email, auth_type, login
1853
-            FROM ' . prefixTable('users') . '
1853
+            FROM ' . prefixTable('users').'
1854 1854
             WHERE id = %i',
1855 1855
             $post_user_id
1856 1856
         );
@@ -1958,7 +1958,7 @@  discard block
 block discarded – undo
1958 1958
         // Check if user exists
1959 1959
         DB::queryFirstRow(
1960 1960
             'SELECT *
1961
-            FROM ' . prefixTable('users') . '
1961
+            FROM ' . prefixTable('users').'
1962 1962
             WHERE id = %i',
1963 1963
             $post_user_id
1964 1964
         );
@@ -2028,7 +2028,7 @@  discard block
 block discarded – undo
2028 2028
         // Check if user exists
2029 2029
         $userInfo = DB::queryFirstRow(
2030 2030
             'SELECT public_key
2031
-            FROM ' . prefixTable('users') . '
2031
+            FROM ' . prefixTable('users').'
2032 2032
             WHERE id = %i',
2033 2033
             $post_user_id
2034 2034
         );
@@ -2176,15 +2176,15 @@  discard block
 block discarded – undo
2176 2176
     // Loop on items
2177 2177
     $rows = DB::query(
2178 2178
         'SELECT id, pw
2179
-        FROM ' . prefixTable('items') . '
2179
+        FROM ' . prefixTable('items').'
2180 2180
         WHERE perso = 0
2181
-        LIMIT ' . $post_start . ', ' . $post_length
2181
+        LIMIT ' . $post_start.', '.$post_length
2182 2182
     );
2183 2183
     foreach ($rows as $record) {
2184 2184
         // Get itemKey from current user
2185 2185
         $currentUserKey = DB::queryFirstRow(
2186 2186
             'SELECT share_key, increment_id
2187
-            FROM ' . prefixTable('sharekeys_items') . '
2187
+            FROM ' . prefixTable('sharekeys_items').'
2188 2188
             WHERE object_id = %i AND user_id = %i',
2189 2189
             $record['id'],
2190 2190
             $session->get('user-id')
@@ -2216,7 +2216,7 @@  discard block
 block discarded – undo
2216 2216
             if ((int) $post_user_id !== (int) $session->get('user-id')) {
2217 2217
                 $currentUserKey = DB::queryFirstRow(
2218 2218
                     'SELECT increment_id
2219
-                    FROM ' . prefixTable('sharekeys_items') . '
2219
+                    FROM ' . prefixTable('sharekeys_items').'
2220 2220
                     WHERE object_id = %i AND user_id = %i',
2221 2221
                     $record['id'],
2222 2222
                     $post_user_id
@@ -2249,7 +2249,7 @@  discard block
 block discarded – undo
2249 2249
     // SHould we change step?
2250 2250
     DB::query(
2251 2251
         'SELECT *
2252
-        FROM ' . prefixTable('items') . '
2252
+        FROM ' . prefixTable('items').'
2253 2253
         WHERE perso = 0'
2254 2254
     );
2255 2255
 
@@ -2274,15 +2274,15 @@  discard block
 block discarded – undo
2274 2274
     // Loop on logs
2275 2275
     $rows = DB::query(
2276 2276
         'SELECT increment_id
2277
-        FROM ' . prefixTable('log_items') . '
2277
+        FROM ' . prefixTable('log_items').'
2278 2278
         WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"
2279
-        LIMIT ' . $post_start . ', ' . $post_length
2279
+        LIMIT ' . $post_start.', '.$post_length
2280 2280
     );
2281 2281
     foreach ($rows as $record) {
2282 2282
         // Get itemKey from current user
2283 2283
         $currentUserKey = DB::queryFirstRow(
2284 2284
             'SELECT share_key
2285
-            FROM ' . prefixTable('sharekeys_logs') . '
2285
+            FROM ' . prefixTable('sharekeys_logs').'
2286 2286
             WHERE object_id = %i AND user_id = %i',
2287 2287
             $record['increment_id'],
2288 2288
             $session->get('user-id')
@@ -2314,7 +2314,7 @@  discard block
 block discarded – undo
2314 2314
             if ((int) $post_user_id !== (int) $session->get('user-id')) {
2315 2315
                 $currentUserKey = DB::queryFirstRow(
2316 2316
                     'SELECT increment_id
2317
-                    FROM ' . prefixTable('sharekeys_items') . '
2317
+                    FROM ' . prefixTable('sharekeys_items').'
2318 2318
                     WHERE object_id = %i AND user_id = %i',
2319 2319
                     $record['id'],
2320 2320
                     $post_user_id
@@ -2336,7 +2336,7 @@  discard block
 block discarded – undo
2336 2336
     // SHould we change step?
2337 2337
     DB::query(
2338 2338
         'SELECT increment_id
2339
-        FROM ' . prefixTable('log_items') . '
2339
+        FROM ' . prefixTable('log_items').'
2340 2340
         WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"'
2341 2341
     );
2342 2342
 
@@ -2361,15 +2361,15 @@  discard block
 block discarded – undo
2361 2361
     // Loop on fields
2362 2362
     $rows = DB::query(
2363 2363
         'SELECT id
2364
-        FROM ' . prefixTable('categories_items') . '
2364
+        FROM ' . prefixTable('categories_items').'
2365 2365
         WHERE encryption_type = "teampass_aes"
2366
-        LIMIT ' . $post_start . ', ' . $post_length
2366
+        LIMIT ' . $post_start.', '.$post_length
2367 2367
     );
2368 2368
     foreach ($rows as $record) {
2369 2369
         // Get itemKey from current user
2370 2370
         $currentUserKey = DB::queryFirstRow(
2371 2371
             'SELECT share_key
2372
-            FROM ' . prefixTable('sharekeys_fields') . '
2372
+            FROM ' . prefixTable('sharekeys_fields').'
2373 2373
             WHERE object_id = %i AND user_id = %i',
2374 2374
             $record['id'],
2375 2375
             $session->get('user-id')
@@ -2401,7 +2401,7 @@  discard block
 block discarded – undo
2401 2401
             if ((int) $post_user_id !== (int) $session->get('user-id')) {
2402 2402
                 $currentUserKey = DB::queryFirstRow(
2403 2403
                     'SELECT increment_id
2404
-                    FROM ' . prefixTable('sharekeys_items') . '
2404
+                    FROM ' . prefixTable('sharekeys_items').'
2405 2405
                     WHERE object_id = %i AND user_id = %i',
2406 2406
                     $record['id'],
2407 2407
                     $post_user_id
@@ -2423,7 +2423,7 @@  discard block
 block discarded – undo
2423 2423
     // SHould we change step?
2424 2424
     DB::query(
2425 2425
         'SELECT *
2426
-        FROM ' . prefixTable('categories_items') . '
2426
+        FROM ' . prefixTable('categories_items').'
2427 2427
         WHERE encryption_type = "teampass_aes"'
2428 2428
     );
2429 2429
 
@@ -2448,14 +2448,14 @@  discard block
 block discarded – undo
2448 2448
     // Loop on suggestions
2449 2449
     $rows = DB::query(
2450 2450
         'SELECT id
2451
-        FROM ' . prefixTable('suggestion') . '
2452
-        LIMIT ' . $post_start . ', ' . $post_length
2451
+        FROM ' . prefixTable('suggestion').'
2452
+        LIMIT ' . $post_start.', '.$post_length
2453 2453
     );
2454 2454
     foreach ($rows as $record) {
2455 2455
         // Get itemKey from current user
2456 2456
         $currentUserKey = DB::queryFirstRow(
2457 2457
             'SELECT share_key
2458
-            FROM ' . prefixTable('sharekeys_suggestions') . '
2458
+            FROM ' . prefixTable('sharekeys_suggestions').'
2459 2459
             WHERE object_id = %i AND user_id = %i',
2460 2460
             $record['id'],
2461 2461
             $session->get('user-id')
@@ -2487,7 +2487,7 @@  discard block
 block discarded – undo
2487 2487
             if ((int) $post_user_id !== (int) $session->get('user-id')) {
2488 2488
                 $currentUserKey = DB::queryFirstRow(
2489 2489
                     'SELECT increment_id
2490
-                    FROM ' . prefixTable('sharekeys_items') . '
2490
+                    FROM ' . prefixTable('sharekeys_items').'
2491 2491
                     WHERE object_id = %i AND user_id = %i',
2492 2492
                     $record['id'],
2493 2493
                     $post_user_id
@@ -2533,15 +2533,15 @@  discard block
 block discarded – undo
2533 2533
     // Loop on files
2534 2534
     $rows = DB::query(
2535 2535
         'SELECT id
2536
-        FROM ' . prefixTable('files') . '
2537
-        WHERE status = "' . TP_ENCRYPTION_NAME . '"
2538
-        LIMIT ' . $post_start . ', ' . $post_length
2536
+        FROM ' . prefixTable('files').'
2537
+        WHERE status = "' . TP_ENCRYPTION_NAME.'"
2538
+        LIMIT ' . $post_start.', '.$post_length
2539 2539
     ); //aes_encryption
2540 2540
     foreach ($rows as $record) {
2541 2541
         // Get itemKey from current user
2542 2542
         $currentUserKey = DB::queryFirstRow(
2543 2543
             'SELECT share_key
2544
-            FROM ' . prefixTable('sharekeys_files') . '
2544
+            FROM ' . prefixTable('sharekeys_files').'
2545 2545
             WHERE object_id = %i AND user_id = %i',
2546 2546
             $record['id'],
2547 2547
             $session->get('user-id')
@@ -2573,7 +2573,7 @@  discard block
 block discarded – undo
2573 2573
             if ((int) $post_user_id !== (int) $session->get('user-id')) {
2574 2574
                 $currentUserKey = DB::queryFirstRow(
2575 2575
                     'SELECT increment_id
2576
-                    FROM ' . prefixTable('sharekeys_items') . '
2576
+                    FROM ' . prefixTable('sharekeys_items').'
2577 2577
                     WHERE object_id = %i AND user_id = %i',
2578 2578
                     $record['id'],
2579 2579
                     $post_user_id
@@ -2595,8 +2595,8 @@  discard block
 block discarded – undo
2595 2595
     // SHould we change step?
2596 2596
     DB::query(
2597 2597
         'SELECT *
2598
-        FROM ' . prefixTable('files') . '
2599
-        WHERE status = "' . TP_ENCRYPTION_NAME . '"'
2598
+        FROM ' . prefixTable('files').'
2599
+        WHERE status = "' . TP_ENCRYPTION_NAME.'"'
2600 2600
     );
2601 2601
 
2602 2602
     $next_start = (int) $post_start + (int) $post_length;
@@ -2629,9 +2629,9 @@  discard block
 block discarded – undo
2629 2629
     if (count($session->get('user-personal_folders')) > 0) {
2630 2630
         $rows = DB::query(
2631 2631
             'SELECT id, pw
2632
-            FROM ' . prefixTable('items') . '
2632
+            FROM ' . prefixTable('items').'
2633 2633
             WHERE perso = 1 AND id_tree IN %ls AND encryption_type = %s
2634
-            LIMIT ' . $post_start . ', ' . $post_length,
2634
+            LIMIT ' . $post_start.', '.$post_length,
2635 2635
             $session->get('user-personal_folders'),
2636 2636
             "defuse"
2637 2637
         );
@@ -2639,7 +2639,7 @@  discard block
 block discarded – undo
2639 2639
             // Get itemKey from current user
2640 2640
             $currentUserKey = DB::queryFirstRow(
2641 2641
                 'SELECT share_key, increment_id
2642
-                FROM ' . prefixTable('sharekeys_items') . '
2642
+                FROM ' . prefixTable('sharekeys_items').'
2643 2643
                 WHERE object_id = %i AND user_id = %i',
2644 2644
                 $record['id'],
2645 2645
                 $session->get('user-id')
@@ -2666,7 +2666,7 @@  discard block
 block discarded – undo
2666 2666
                 if ((int) $post_user_id !== (int) $session->get('user-id')) {
2667 2667
                     $currentUserKey = DB::queryFirstRow(
2668 2668
                         'SELECT increment_id
2669
-                        FROM ' . prefixTable('sharekeys_items') . '
2669
+                        FROM ' . prefixTable('sharekeys_items').'
2670 2670
                         WHERE object_id = %i AND user_id = %i',
2671 2671
                         $record['id'],
2672 2672
                         $post_user_id
@@ -2689,7 +2689,7 @@  discard block
 block discarded – undo
2689 2689
     // SHould we change step?
2690 2690
     DB::query(
2691 2691
         'SELECT *
2692
-        FROM ' . prefixTable('items') . '
2692
+        FROM ' . prefixTable('items').'
2693 2693
         WHERE perso = 0'
2694 2694
     );
2695 2695
 
@@ -2717,7 +2717,7 @@  discard block
 block discarded – undo
2717 2717
         // Check if user exists
2718 2718
         $userInfo = DB::queryFirstRow(
2719 2719
             'SELECT public_key, encrypted_psk
2720
-            FROM ' . prefixTable('users') . '
2720
+            FROM ' . prefixTable('users').'
2721 2721
             WHERE id = %i',
2722 2722
             $post_user_id
2723 2723
         );
@@ -2743,7 +2743,7 @@  discard block
 block discarded – undo
2743 2743
                 if ($post_counterItemsToTreat === -1) {
2744 2744
                     DB::query(
2745 2745
                         'SELECT id
2746
-                        FROM ' . prefixTable('items') . '
2746
+                        FROM ' . prefixTable('items').'
2747 2747
                         WHERE perso = 1 AND id_tree IN %ls AND encryption_type != %s',
2748 2748
                         $session->get('user-personal_folders'),
2749 2749
                         'teampass_aes'
@@ -2756,7 +2756,7 @@  discard block
 block discarded – undo
2756 2756
                 // Loop on persoanl items
2757 2757
                 $rows = DB::query(
2758 2758
                     'SELECT id, pw
2759
-                    FROM ' . prefixTable('items') . '
2759
+                    FROM ' . prefixTable('items').'
2760 2760
                     WHERE perso = 1 AND id_tree IN %ls AND encryption_type != %s
2761 2761
                     LIMIT ' . $post_length,
2762 2762
                     $session->get('user-personal_folders'),
@@ -2800,7 +2800,7 @@  discard block
 block discarded – undo
2800 2800
                     // Loop on files
2801 2801
                     $rows = DB::query(
2802 2802
                         'SELECT id, file
2803
-                        FROM ' . prefixTable('files') . '
2803
+                        FROM ' . prefixTable('files').'
2804 2804
                         WHERE status != %s
2805 2805
                         AND id_item = %i',
2806 2806
                         TP_ENCRYPTION_NAME,
@@ -2811,13 +2811,13 @@  discard block
 block discarded – undo
2811 2811
                         // Now decrypt the file
2812 2812
                         prepareFileWithDefuse(
2813 2813
                             'decrypt',
2814
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record2['file'],
2815
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record2['file'] . '.delete',
2814
+                            $SETTINGS['path_to_upload_folder'].'/'.$record2['file'],
2815
+                            $SETTINGS['path_to_upload_folder'].'/'.$record2['file'].'.delete',
2816 2816
                             $post_user_psk
2817 2817
                         );
2818 2818
 
2819 2819
                         // Encrypt the file
2820
-                        $encryptedFile = encryptFile($record2['file'] . '.delete', $SETTINGS['path_to_upload_folder']);
2820
+                        $encryptedFile = encryptFile($record2['file'].'.delete', $SETTINGS['path_to_upload_folder']);
2821 2821
 
2822 2822
                         DB::update(
2823 2823
                             prefixTable('files'),
@@ -2840,7 +2840,7 @@  discard block
 block discarded – undo
2840 2840
                         );
2841 2841
 
2842 2842
                         // Unlink original file
2843
-                        unlink($SETTINGS['path_to_upload_folder'] . '/' . $record2['file']);
2843
+                        unlink($SETTINGS['path_to_upload_folder'].'/'.$record2['file']);
2844 2844
                     }
2845 2845
                 }
2846 2846
 
@@ -2848,7 +2848,7 @@  discard block
 block discarded – undo
2848 2848
                 $next_start = (int) $post_start + (int) $post_length;
2849 2849
                 DB::query(
2850 2850
                     'SELECT id
2851
-                    FROM ' . prefixTable('items') . '
2851
+                    FROM ' . prefixTable('items').'
2852 2852
                     WHERE perso = 1 AND id_tree IN %ls AND encryption_type != %s',
2853 2853
                     $session->get('user-personal_folders'),
2854 2854
                     'teampass_aes'
@@ -2918,7 +2918,7 @@  discard block
 block discarded – undo
2918 2918
         // Get user info
2919 2919
         $userData = DB::queryFirstRow(
2920 2920
             'SELECT special, auth_type, is_ready_for_usage, ongoing_process_id, otp_provided, keys_recovery_time
2921
-            FROM ' . prefixTable('users') . '
2921
+            FROM ' . prefixTable('users').'
2922 2922
             WHERE id = %i',
2923 2923
             $post_user_id
2924 2924
         );
@@ -2965,7 +2965,7 @@  discard block
 block discarded – undo
2965 2965
         // Get user info
2966 2966
         $userData = DB::queryFirstRow(
2967 2967
             'SELECT auth_type, login, private_key
2968
-            FROM ' . prefixTable('users') . '
2968
+            FROM ' . prefixTable('users').'
2969 2969
             WHERE id = %i',
2970 2970
             $post_user_id
2971 2971
         );
@@ -3015,7 +3015,7 @@  discard block
 block discarded – undo
3015 3015
                 return prepareExchangedData(
3016 3016
                     array(
3017 3017
                         'error' => false,
3018
-                        'message' => $lang->get('done'),'',
3018
+                        'message' => $lang->get('done'), '',
3019 3019
                     ),
3020 3020
                     'encode'
3021 3021
                 );
@@ -3063,7 +3063,7 @@  discard block
 block discarded – undo
3063 3063
         // Get user info
3064 3064
         $userData = DB::queryFirstRow(
3065 3065
             'SELECT auth_type, login, private_key, special
3066
-            FROM ' . prefixTable('users') . '
3066
+            FROM ' . prefixTable('users').'
3067 3067
             WHERE id = %i',
3068 3068
             $post_user_id
3069 3069
         );
@@ -3097,7 +3097,7 @@  discard block
 block discarded – undo
3097 3097
                 return prepareExchangedData(
3098 3098
                     array(
3099 3099
                         'error' => false,
3100
-                        'message' => $lang->get('done'),'',
3100
+                        'message' => $lang->get('done'), '',
3101 3101
                     ),
3102 3102
                     'encode'
3103 3103
                 );
@@ -3119,8 +3119,8 @@  discard block
 block discarded – undo
3119 3119
             // Get one itemKey from current user
3120 3120
             $currentUserKey = DB::queryFirstRow(
3121 3121
                 'SELECT ski.share_key, ski.increment_id, l.id_user
3122
-                FROM ' . prefixTable('sharekeys_items') . ' AS ski
3123
-                INNER JOIN ' . prefixTable('log_items') . ' AS l ON ski.object_id = l.id_item
3122
+                FROM ' . prefixTable('sharekeys_items').' AS ski
3123
+                INNER JOIN ' . prefixTable('log_items').' AS l ON ski.object_id = l.id_item
3124 3124
                 WHERE ski.user_id = %i
3125 3125
                 ORDER BY RAND()
3126 3126
                 LIMIT 1',
@@ -3210,7 +3210,7 @@  discard block
 block discarded – undo
3210 3210
             $session->get('user-id')
3211 3211
         );
3212 3212
         // Return data
3213
-        return '[{"new_value":"' . $session->get('user-session_duration') . '"}]';
3213
+        return '[{"new_value":"'.$session->get('user-session_duration').'"}]';
3214 3214
     }
3215 3215
     
3216 3216
     return '[{"new_value":"expired"}]';
Please login to merge, or discard this patch.
sources/backups.queries.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 ) {
78 78
     // Not allowed page
79 79
     $session->set('system-error_code', ERR_NOT_ALLOWED);
80
-    include $SETTINGS['cpassman_dir'] . '/error.php';
80
+    include $SETTINGS['cpassman_dir'].'/error.php';
81 81
     exit;
82 82
 }
83 83
 
@@ -138,15 +138,15 @@  discard block
 block discarded – undo
138 138
             // Prepare variables
139 139
             $post_key = filter_var($dataReceived['encryptionKey'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
140 140
         
141
-            require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
141
+            require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
142 142
         
143 143
             // get a token
144 144
             $passwordManager = new PasswordManager();
145 145
             $token = $passwordManager->generatePassword(20, false, true, true, false, true);
146 146
         
147 147
             //save file
148
-            $filename = time() . '-' . $token . '.sql';
149
-            $filepath = $SETTINGS['path_to_files_folder'] . '/' . $filename;
148
+            $filename = time().'-'.$token.'.sql';
149
+            $filepath = $SETTINGS['path_to_files_folder'].'/'.$filename;
150 150
             $handle = fopen($filepath, 'w+');
151 151
             
152 152
             if ($handle === false) {
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
             $tables = array();
165 165
             $result = DB::query('SHOW TABLES');
166 166
             foreach ($result as $row) {
167
-                $tables[] = $row['Tables_in_' . DB_NAME];
167
+                $tables[] = $row['Tables_in_'.DB_NAME];
168 168
             }
169 169
         
170 170
             $backupSuccess = true;
@@ -174,9 +174,9 @@  discard block
 block discarded – undo
174 174
                 if (empty($pre) || substr_count($table, $pre) > 0) {
175 175
                     $table = safeString($table);
176 176
                     // Write table drop and creation
177
-                    fwrite($handle, 'DROP TABLE IF EXISTS ' . $table . ";\n");
178
-                    $row2 = DB::queryFirstRow('SHOW CREATE TABLE ' . $table);
179
-                    fwrite($handle, safeString($row2['Create Table']) . ";\n\n");
177
+                    fwrite($handle, 'DROP TABLE IF EXISTS '.$table.";\n");
178
+                    $row2 = DB::queryFirstRow('SHOW CREATE TABLE '.$table);
179
+                    fwrite($handle, safeString($row2['Create Table']).";\n\n");
180 180
         
181 181
                     // Get field information
182 182
                     DB::query(
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
                         }
202 202
                         
203 203
                         foreach ($rows as $record) {
204
-                            $insertQuery = 'INSERT INTO ' . $table . ' VALUES(';
204
+                            $insertQuery = 'INSERT INTO '.$table.' VALUES(';
205 205
                             $values = array();
206 206
                             
207 207
                             foreach ($record as $value) {
@@ -209,11 +209,11 @@  discard block
 block discarded – undo
209 209
                                 if ($value === null) {
210 210
                                     $values[] = 'NULL';
211 211
                                 } else {
212
-                                    $values[] = '"' . addslashes(preg_replace("/\n/", '\\n', $value)) . '"';
212
+                                    $values[] = '"'.addslashes(preg_replace("/\n/", '\\n', $value)).'"';
213 213
                                 }
214 214
                             }
215 215
                             
216
-                            $insertQuery .= implode(',', $values) . ");\n";
216
+                            $insertQuery .= implode(',', $values).");\n";
217 217
                             fwrite($handle, $insertQuery);
218 218
                             
219 219
                             // Flush buffer periodically to free memory
@@ -243,14 +243,14 @@  discard block
 block discarded – undo
243 243
                 prepareFileWithDefuse(
244 244
                     'encrypt',
245 245
                     $filepath,
246
-                    $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
246
+                    $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
247 247
                     $post_key
248 248
                 );
249 249
         
250 250
                 // Do clean
251 251
                 unlink($filepath);
252 252
                 rename(
253
-                    $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
253
+                    $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
254 254
                     $filepath
255 255
                 );
256 256
             }
@@ -273,9 +273,9 @@  discard block
 block discarded – undo
273 273
                 array(
274 274
                     'error' => false,
275 275
                     'message' => '',
276
-                    'download' => 'sources/downloadFile.php?name=' . urlencode($filename) .
277
-                        '&sub=files&file=' . $filename . '&type=sql&key=' . $session->get('key') . '&key_tmp=' .
278
-                        $session->get('user-key_tmp') . '&pathIsFiles=1',
276
+                    'download' => 'sources/downloadFile.php?name='.urlencode($filename).
277
+                        '&sub=files&file='.$filename.'&type=sql&key='.$session->get('key').'&key_tmp='.
278
+                        $session->get('user-key_tmp').'&pathIsFiles=1',
279 279
                 ),
280 280
                 'encode'
281 281
             );
@@ -336,13 +336,13 @@  discard block
 block discarded – undo
336 336
                 error_log('DEBUG: Offset -> '.$post_offset.'/'.$post_totalSize.' | File -> '.$post_clearFilename.' | key -> '.$post_key);
337 337
             }
338 338
         
339
-            include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
339
+            include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
340 340
         
341 341
             if (empty($post_clearFilename) === true) {
342 342
                 // Get filename from database
343 343
                 $data = DB::queryFirstRow(
344 344
                     'SELECT valeur
345
-                    FROM ' . prefixTable('misc') . '
345
+                    FROM ' . prefixTable('misc').'
346 346
                     WHERE increment_id = %i',
347 347
                     $post_backupFile
348 348
                 );
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
                 $post_backupFile = safeString($data['valeur']);
370 370
                 
371 371
                 // Verify file exists
372
-                if (!file_exists($SETTINGS['path_to_files_folder'] . '/' . $post_backupFile)) {
372
+                if (!file_exists($SETTINGS['path_to_files_folder'].'/'.$post_backupFile)) {
373 373
                     echo prepareExchangedData(
374 374
                         array(
375 375
                             'error' => true,
@@ -386,8 +386,8 @@  discard block
 block discarded – undo
386 386
                     // Decrypt the file
387 387
                     $ret = prepareFileWithDefuse(
388 388
                         'decrypt',
389
-                        $SETTINGS['path_to_files_folder'] . '/' . $post_backupFile,
390
-                        $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $post_backupFile,
389
+                        $SETTINGS['path_to_files_folder'].'/'.$post_backupFile,
390
+                        $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$post_backupFile,
391 391
                         $post_key
392 392
                     );
393 393
                     
@@ -404,8 +404,8 @@  discard block
 block discarded – undo
404 404
                     }
405 405
         
406 406
                     // Do clean
407
-                    fileDelete($SETTINGS['path_to_files_folder'] . '/' . $post_backupFile, $SETTINGS);
408
-                    $post_backupFile = $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $post_backupFile;
407
+                    fileDelete($SETTINGS['path_to_files_folder'].'/'.$post_backupFile, $SETTINGS);
408
+                    $post_backupFile = $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$post_backupFile;
409 409
                 } else {
410 410
                     echo prepareExchangedData(
411 411
                         array(
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
                                 DB::query($query);
488 488
                                 $executedQueries++;
489 489
                             } catch (Exception $e) {
490
-                                $errors[] = "Error executing query: " . $e->getMessage() . " - Query: " . substr($query, 0, 100) . "...";
490
+                                $errors[] = "Error executing query: ".$e->getMessage()." - Query: ".substr($query, 0, 100)."...";
491 491
                             }
492 492
                             $query = '';
493 493
                         }
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
             } catch (Exception $e) {
504 504
                 // Rollback transaction on any exception
505 505
                 DB::rollback();
506
-                $errors[] = "Transaction failed: " . $e->getMessage();
506
+                $errors[] = "Transaction failed: ".$e->getMessage();
507 507
             }
508 508
         
509 509
             // Calculate the new offset
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
                 echo prepareExchangedData(
519 519
                     array(
520 520
                         'error' => true,
521
-                        'message' => 'Errors occurred during import: ' . implode('; ', $errors),
521
+                        'message' => 'Errors occurred during import: '.implode('; ', $errors),
522 522
                         'newOffset' => $newOffset,
523 523
                         'totalSize' => $post_totalSize,
524 524
                         'clearFilename' => $post_backupFile,
Please login to merge, or discard this patch.
sources/admin.queries.php 1 patch
Spacing   +135 added lines, -135 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('admin') === false) {
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
 
@@ -134,14 +134,14 @@  discard block
 block discarded – undo
134 134
             break;
135 135
         }
136 136
 
137
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
137
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
138 138
         $return = '';
139 139
 
140 140
         //Get all tables
141 141
         $tables = array();
142 142
         $result = DB::query('SHOW TABLES');
143 143
         foreach ($result as $row) {
144
-            $tables[] = $row['Tables_in_' . DB_NAME];
144
+            $tables[] = $row['Tables_in_'.DB_NAME];
145 145
         }
146 146
 
147 147
         //cycle through
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
             if (defined('DB_PREFIX') || substr_count($table, DB_PREFIX) > 0) {
150 150
                 $table = (is_string($table) ? $table : strval($table));
151 151
                 // Do query
152
-                $result = DB::query('SELECT * FROM ' . $table);
152
+                $result = DB::query('SELECT * FROM '.$table);
153 153
                 DB::query(
154 154
                     'SELECT *
155 155
                     FROM INFORMATION_SCHEMA.COLUMNS
@@ -161,20 +161,20 @@  discard block
 block discarded – undo
161 161
                 $numFields = DB::count();
162 162
 
163 163
                 // prepare a drop table
164
-                $return .= 'DROP TABLE ' . $table . ';';
165
-                $row2 = DB::queryFirstRow('SHOW CREATE TABLE ' . $table);
166
-                $return .= "\n\n" . strval($row2['Create Table']) . ";\n\n";
164
+                $return .= 'DROP TABLE '.$table.';';
165
+                $row2 = DB::queryFirstRow('SHOW CREATE TABLE '.$table);
166
+                $return .= "\n\n".strval($row2['Create Table']).";\n\n";
167 167
 
168 168
                 //prepare all fields and datas
169 169
                 for ($i = 0; $i < $numFields; ++$i) {
170 170
                     if (is_object($result)) {
171 171
                         while ($row = $result->fetch_row()) {
172
-                            $return .= 'INSERT INTO ' . $table . ' VALUES(';
172
+                            $return .= 'INSERT INTO '.$table.' VALUES(';
173 173
                             for ($j = 0; $j < $numFields; ++$j) {
174 174
                                 $row[$j] = addslashes($row[$j]);
175 175
                                 $row[$j] = preg_replace("/\n/", '\\n', $row[$j]);
176 176
                                 if (isset($row[$j])) {
177
-                                    $return .= '"' . $row[$j] . '"';
177
+                                    $return .= '"'.$row[$j].'"';
178 178
                                 } else {
179 179
                                     $return .= 'NULL';
180 180
                                 }
@@ -196,8 +196,8 @@  discard block
 block discarded – undo
196 196
             $token = $passwordManager->generatePassword(20, false, true, true, false, true);
197 197
 
198 198
             //save file
199
-            $filename = time() . '-' . $token . '.sql';
200
-            $handle = fopen($SETTINGS['path_to_files_folder'] . '/' . $filename, 'w+');
199
+            $filename = time().'-'.$token.'.sql';
200
+            $handle = fopen($SETTINGS['path_to_files_folder'].'/'.$filename, 'w+');
201 201
             if ($handle !== false) {
202 202
                 //write file
203 203
                 fwrite($handle, $return);
@@ -209,16 +209,16 @@  discard block
 block discarded – undo
209 209
                 // Encrypt the file
210 210
                 prepareFileWithDefuse(
211 211
                     'encrypt',
212
-                    $SETTINGS['path_to_files_folder'] . '/' . $filename,
213
-                    $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
212
+                    $SETTINGS['path_to_files_folder'].'/'.$filename,
213
+                    $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
214 214
                     $post_option
215 215
                 );
216 216
 
217 217
                 // Do clean
218
-                unlink($SETTINGS['path_to_files_folder'] . '/' . $filename);
218
+                unlink($SETTINGS['path_to_files_folder'].'/'.$filename);
219 219
                 rename(
220
-                    $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
221
-                    $SETTINGS['path_to_files_folder'] . '/' . $filename
220
+                    $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
221
+                    $SETTINGS['path_to_files_folder'].'/'.$filename
222 222
                 );
223 223
             }
224 224
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
             //update LOG
231 231
             logEvents($SETTINGS, 'admin_action', 'dataBase backup', (string) $session->get('user-id'), $session->get('user-login'));
232 232
 
233
-            echo '[{"result":"db_backup" , "href":"sources/downloadFile.php?name=' . urlencode($filename) . '&sub=files&file=' . $filename . '&type=sql&key=' . $session->get('key') . '&key_tmp=' . $session->get('user-key_tmp') . '&pathIsFiles=1"}]';
233
+            echo '[{"result":"db_backup" , "href":"sources/downloadFile.php?name='.urlencode($filename).'&sub=files&file='.$filename.'&type=sql&key='.$session->get('key').'&key_tmp='.$session->get('user-key_tmp').'&pathIsFiles=1"}]';
234 234
         }
235 235
         break;
236 236
 
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
             );
260 260
             break;
261 261
         }
262
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
262
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
263 263
 
264 264
         $dataPost = explode('&', $post_option);
265 265
         $file = htmlspecialchars($dataPost[0]);
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
         // Get filename from database
269 269
         $data = DB::queryFirstRow(
270 270
             'SELECT valeur
271
-            FROM ' . prefixTable('misc') . '
271
+            FROM ' . prefixTable('misc').'
272 272
             WHERE increment_id = %i',
273 273
             $file
274 274
         );
@@ -287,8 +287,8 @@  discard block
 block discarded – undo
287 287
             // Decrypt the file
288 288
             $ret = prepareFileWithDefuse(
289 289
                 'decrypt',
290
-                $SETTINGS['path_to_files_folder'] . '/' . $file,
291
-                $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $file,
290
+                $SETTINGS['path_to_files_folder'].'/'.$file,
291
+                $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$file,
292 292
                 $key
293 293
             );
294 294
 
@@ -299,10 +299,10 @@  discard block
 block discarded – undo
299 299
             }
300 300
 
301 301
             // Do clean
302
-            fileDelete($SETTINGS['path_to_files_folder'] . '/' . $file, $SETTINGS);
303
-            $file = $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $file;
302
+            fileDelete($SETTINGS['path_to_files_folder'].'/'.$file, $SETTINGS);
303
+            $file = $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$file;
304 304
         } else {
305
-            $file = $SETTINGS['path_to_files_folder'] . '/' . $file;
305
+            $file = $SETTINGS['path_to_files_folder'].'/'.$file;
306 306
         }
307 307
 
308 308
         //read sql file
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
         fclose($handle);
320 320
 
321 321
         //delete file
322
-        unlink($SETTINGS['path_to_files_folder'] . '/' . $file);
322
+        unlink($SETTINGS['path_to_files_folder'].'/'.$file);
323 323
 
324 324
         //Show done
325 325
         echo '[{"result":"db_restore" , "message":""}]';
@@ -358,8 +358,8 @@  discard block
 block discarded – undo
358 358
                 $tablename = (is_string($tablename) ? $tablename : strval($tablename));
359 359
                 if (substr_count($tablename, DB_PREFIX) > 0) {
360 360
                     // launch optimization quieries
361
-                    DB::query('ANALYZE TABLE `' . $tablename . '`');
362
-                    DB::query('OPTIMIZE TABLE `' . $tablename . '`');
361
+                    DB::query('ANALYZE TABLE `'.$tablename.'`');
362
+                    DB::query('OPTIMIZE TABLE `'.$tablename.'`');
363 363
                 }
364 364
             }
365 365
         }
@@ -367,12 +367,12 @@  discard block
 block discarded – undo
367 367
         //Clean up LOG_ITEMS table
368 368
         $rows = DB::query(
369 369
             'SELECT id
370
-            FROM ' . prefixTable('items') . '
370
+            FROM ' . prefixTable('items').'
371 371
             ORDER BY id ASC'
372 372
         );
373 373
         foreach ($rows as $item) {
374 374
             DB::query(
375
-                'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i AND action = %s',
375
+                'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i AND action = %s',
376 376
                 $item['id'],
377 377
                 'at_creation'
378 378
             );
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
             if ($counter === 0) {
381 381
                 //Create new at_creation entry
382 382
                 $rowTmp = DB::queryFirstRow(
383
-                    'SELECT date, id_user FROM ' . prefixTable('log_items') . ' WHERE id_item=%i ORDER BY date ASC',
383
+                    'SELECT date, id_user FROM '.prefixTable('log_items').' WHERE id_item=%i ORDER BY date ASC',
384 384
                     $item['id']
385 385
                 );
386 386
                 DB::insert(
@@ -410,8 +410,8 @@  discard block
 block discarded – undo
410 410
         echo prepareExchangedData(
411 411
             array(
412 412
                 'error' => false,
413
-                'message' => $lang->get('last_execution') . ' ' .
414
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
413
+                'message' => $lang->get('last_execution').' '.
414
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
415 415
                     '<i class="fas fa-check text-success ml-2"></i>',
416 416
             ),
417 417
             'encode'
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
             break;
448 448
         }
449 449
 
450
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
450
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
451 451
         updateCacheTable('reload', NULL);
452 452
 
453 453
         // Log
@@ -463,8 +463,8 @@  discard block
 block discarded – undo
463 463
         echo prepareExchangedData(
464 464
             [
465 465
                 'error' => false,
466
-                'message' => $lang->get('last_execution') . ' ' .
467
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
466
+                'message' => $lang->get('last_execution').' '.
467
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
468 468
                     '<i class="fas fa-check text-success mr-2"></i>',
469 469
             ],
470 470
             'encode'
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
         $session->set('user-reencrypt_old_salt', file_get_contents(SECUREPATH.'/'.SECUREFILE));
507 507
 
508 508
         // generate new saltkey
509
-        $old_sk_filename = SECUREPATH.'/'.SECUREFILE . date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))) . '.' . time();
509
+        $old_sk_filename = SECUREPATH.'/'.SECUREFILE.date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))).'.'.time();
510 510
         copy(
511 511
             SECUREPATH.'/'.SECUREFILE,
512 512
             $old_sk_filename
@@ -535,13 +535,13 @@  discard block
 block discarded – undo
535 535
         logEvents($SETTINGS, 'system', 'change_salt_key', (string) $session->get('user-id'), $session->get('user-login'));
536 536
 
537 537
         // get number of items to change
538
-        DB::query('SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i', 0);
538
+        DB::query('SELECT id FROM '.prefixTable('items').' WHERE perso = %i', 0);
539 539
         $nb_of_items = DB::count();
540 540
 
541 541
         // create backup table
542
-        DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
542
+        DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup'));
543 543
         DB::query(
544
-            'CREATE TABLE `' . prefixTable('sk_reencrypt_backup') . '` (
544
+            'CREATE TABLE `'.prefixTable('sk_reencrypt_backup').'` (
545 545
             `id` int(12) NOT null AUTO_INCREMENT,
546 546
             `current_table` varchar(100) NOT NULL,
547 547
             `current_field` varchar(500) NOT NULL,
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
         );
570 570
 
571 571
         // delete previous backup files
572
-        $files = glob($SETTINGS['path_to_upload_folder'] . '/*'); // get all file names
572
+        $files = glob($SETTINGS['path_to_upload_folder'].'/*'); // get all file names
573 573
         foreach ($files as $file) { // iterate files
574 574
             if (is_file($file)) {
575 575
                 $file_parts = pathinfo($file);
@@ -656,7 +656,7 @@  discard block
 block discarded – undo
656 656
                 echo prepareExchangedData(
657 657
                     array(
658 658
                         'error' => true,
659
-                        'message' => 'Input `' . $objects[0] . '` is not allowed',
659
+                        'message' => 'Input `'.$objects[0].'` is not allowed',
660 660
                         'nbOfItems' => '',
661 661
                         'nextAction' => '',
662 662
                     ),
@@ -669,9 +669,9 @@  discard block
 block discarded – undo
669 669
                 //change all encrypted data in Items (passwords)
670 670
                 $rows = DB::query(
671 671
                     'SELECT id, pw, pw_iv
672
-                    FROM ' . prefixTable('items') . '
672
+                    FROM ' . prefixTable('items').'
673 673
                     WHERE perso = %s
674
-                    LIMIT ' . $post_start . ', ' . $post_length,
674
+                    LIMIT ' . $post_start.', '.$post_length,
675 675
                     '0'
676 676
                 );
677 677
                 foreach ($rows as $record) {
@@ -683,7 +683,7 @@  discard block
 block discarded – undo
683 683
                             'current_field' => 'pw',
684 684
                             'value_id' => $record['id'],
685 685
                             'value' => $record['pw'],
686
-                            'current_sql' => 'UPDATE ' . prefixTable('items') . " SET pw = '" . $record['pw'] . "' WHERE id = '" . $record['id'] . "';",
686
+                            'current_sql' => 'UPDATE '.prefixTable('items')." SET pw = '".$record['pw']."' WHERE id = '".$record['id']."';",
687 687
                             'value2' => 'none',
688 688
                             'result' => 'none',
689 689
                         )
@@ -732,9 +732,9 @@  discard block
 block discarded – undo
732 732
                 //change all encrypted data in Logs (passwords)
733 733
                 $rows = DB::query(
734 734
                     'SELECT raison, increment_id
735
-                    FROM ' . prefixTable('log_items') . "
735
+                    FROM ' . prefixTable('log_items')."
736 736
                     WHERE action = %s AND raison LIKE 'at_pw :%'
737
-                    LIMIT " . $post_start . ', ' . $post_length,
737
+                    LIMIT " . $post_start.', '.$post_length,
738 738
                     'at_modification'
739 739
                 );
740 740
                 foreach ($rows as $record) {
@@ -746,7 +746,7 @@  discard block
 block discarded – undo
746 746
                             'current_field' => 'raison',
747 747
                             'value_id' => $record['increment_id'],
748 748
                             'value' => $record['raison'],
749
-                            'current_sql' => 'UPDATE ' . prefixTable('log_items') . " SET raison = '" . $record['raison'] . "' WHERE increment_id = '" . $record['increment_id'] . "';",
749
+                            'current_sql' => 'UPDATE '.prefixTable('log_items')." SET raison = '".$record['raison']."' WHERE increment_id = '".$record['increment_id']."';",
750 750
                             'value2' => 'none',
751 751
                             'result' => 'none',
752 752
                         )
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
                         DB::update(
775 775
                             prefixTable('log_items'),
776 776
                             array(
777
-                                'raison' => 'at_pw :' . $encrypt['string'],
777
+                                'raison' => 'at_pw :'.$encrypt['string'],
778 778
                                 'encryption_type' => 'defuse',
779 779
                             ),
780 780
                             'increment_id = %i',
@@ -799,8 +799,8 @@  discard block
 block discarded – undo
799 799
                 //change all encrypted data in CATEGORIES (passwords)
800 800
                 $rows = DB::query(
801 801
                     'SELECT id, data
802
-                    FROM ' . prefixTable('categories_items') . '
803
-                    LIMIT ' . $post_start . ', ' . $post_length
802
+                    FROM ' . prefixTable('categories_items').'
803
+                    LIMIT ' . $post_start.', '.$post_length
804 804
                 );
805 805
                 foreach ($rows as $record) {
806 806
                     // backup data
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
                             'current_field' => 'data',
812 812
                             'value_id' => $record['id'],
813 813
                             'value' => $record['data'],
814
-                            'current_sql' => 'UPDATE ' . prefixTable('categories_items') . " SET data = '" . $record['data'] . "' WHERE id = '" . $record['id'] . "';",
814
+                            'current_sql' => 'UPDATE '.prefixTable('categories_items')." SET data = '".$record['data']."' WHERE id = '".$record['id']."';",
815 815
                             'value2' => 'none',
816 816
                             'result' => 'none',
817 817
                         )
@@ -859,9 +859,9 @@  discard block
 block discarded – undo
859 859
                 // Change all encrypted data in FILES (passwords)
860 860
                 $rows = DB::query(
861 861
                     'SELECT id, file, status
862
-                    FROM ' . prefixTable('files') . "
862
+                    FROM ' . prefixTable('files')."
863 863
                     WHERE status = 'encrypted'
864
-                    LIMIT " . $post_start . ', ' . $post_length
864
+                    LIMIT " . $post_start.', '.$post_length
865 865
                 );
866 866
                 foreach ($rows as $record) {
867 867
                     // backup data
@@ -879,20 +879,20 @@  discard block
 block discarded – undo
879 879
                     );
880 880
                     $newID = DB::insertId();
881 881
 
882
-                    if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['file'])) {
882
+                    if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['file'])) {
883 883
                         // make a copy of file
884 884
                         if (!copy(
885
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
886
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '.copy'
885
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
886
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'.copy'
887 887
                         )) {
888 888
                             $error = 'Copy not possible';
889 889
                             exit;
890 890
                         } else {
891 891
                             // prepare a bck of file (that will not be deleted)
892
-                            $backup_filename = $record['file'] . '.bck-change-sk.' . time();
892
+                            $backup_filename = $record['file'].'.bck-change-sk.'.time();
893 893
                             copy(
894
-                                $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
895
-                                $SETTINGS['path_to_upload_folder'] . '/' . $backup_filename
894
+                                $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
895
+                                $SETTINGS['path_to_upload_folder'].'/'.$backup_filename
896 896
                             );
897 897
                         }
898 898
 
@@ -900,22 +900,22 @@  discard block
 block discarded – undo
900 900
                         // STEP1 - Do decryption
901 901
                         prepareFileWithDefuse(
902 902
                             'decrypt',
903
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
904
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted'
903
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
904
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted'
905 905
                         );
906 906
 
907 907
                         // Do cleanup of files
908
-                        unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['file']);
908
+                        unlink($SETTINGS['path_to_upload_folder'].'/'.$record['file']);
909 909
 
910 910
                         // STEP2 - Do encryption
911 911
                         prepareFileWithDefuse(
912 912
                             'encryp',
913
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted',
914
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file']
913
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted',
914
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file']
915 915
                         );
916 916
 
917 917
                         // Do cleanup of files
918
-                        unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted');
918
+                        unlink($SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted');
919 919
 
920 920
                         // Update backup table
921 921
                         DB::update(
@@ -941,13 +941,13 @@  discard block
 block discarded – undo
941 941
                 // do some things for new object
942 942
                 if (isset($objects[0])) {
943 943
                     if ($objects[0] === 'logs') {
944
-                        DB::query('SELECT increment_id FROM ' . prefixTable('log_items') . " WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
944
+                        DB::query('SELECT increment_id FROM '.prefixTable('log_items')." WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
945 945
                     } elseif ($objects[0] === 'files') {
946
-                        DB::query('SELECT id FROM ' . prefixTable('files'));
946
+                        DB::query('SELECT id FROM '.prefixTable('files'));
947 947
                     } elseif ($objects[0] === 'categories') {
948
-                        DB::query('SELECT id FROM ' . prefixTable('categories_items'));
948
+                        DB::query('SELECT id FROM '.prefixTable('categories_items'));
949 949
                     } elseif ($objects[0] === 'custfields') {
950
-                        DB::query('SELECT raison FROM ' . prefixTable('log_items') . " WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
950
+                        DB::query('SELECT raison FROM '.prefixTable('log_items')." WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
951 951
                     }
952 952
                     $nb_of_items = DB::count();
953 953
                 } else {
@@ -1067,12 +1067,12 @@  discard block
 block discarded – undo
1067 1067
                 );
1068 1068
             } elseif ($record['current_table'] === 'files') {
1069 1069
                 // restore backup file
1070
-                if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value'])) {
1071
-                    unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['value']);
1072
-                    if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value2'])) {
1070
+                if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value'])) {
1071
+                    unlink($SETTINGS['path_to_upload_folder'].'/'.$record['value']);
1072
+                    if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value2'])) {
1073 1073
                         rename(
1074
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['value2'],
1075
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['value']
1074
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['value2'],
1075
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['value']
1076 1076
                         );
1077 1077
                     }
1078 1078
                 }
@@ -1091,7 +1091,7 @@  discard block
 block discarded – undo
1091 1091
         }
1092 1092
 
1093 1093
         // drop table
1094
-        DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
1094
+        DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup'));
1095 1095
 
1096 1096
         // Send back
1097 1097
         echo prepareExchangedData(
@@ -1134,17 +1134,17 @@  discard block
 block discarded – undo
1134 1134
         // delete files
1135 1135
         $rows = DB::query(
1136 1136
             'SELECT value, value2
1137
-            FROM ' . prefixTable('sk_reencrypt_backup') . "
1137
+            FROM ' . prefixTable('sk_reencrypt_backup')."
1138 1138
             WHERE current_table = 'files'"
1139 1139
         );
1140 1140
         foreach ($rows as $record) {
1141
-            if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value2'])) {
1142
-                unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['value2']);
1141
+            if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value2'])) {
1142
+                unlink($SETTINGS['path_to_upload_folder'].'/'.$record['value2']);
1143 1143
             }
1144 1144
         }
1145 1145
 
1146 1146
         // drop table
1147
-        DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
1147
+        DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup'));
1148 1148
 
1149 1149
         echo '[{"status":"done"}]';
1150 1150
         break;
@@ -1175,7 +1175,7 @@  discard block
 block discarded – undo
1175 1175
                 'encode'
1176 1176
             );
1177 1177
         } else {
1178
-            require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1178
+            require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1179 1179
 
1180 1180
             //send email
1181 1181
             $emailSettings = new EmailSettings($SETTINGS);
@@ -1213,13 +1213,13 @@  discard block
 block discarded – undo
1213 1213
             break;
1214 1214
         }
1215 1215
 
1216
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1216
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1217 1217
         $emailSettings = new EmailSettings($SETTINGS);
1218 1218
         $emailService = new EmailService();
1219 1219
 
1220 1220
         $rows = DB::query(
1221 1221
             'SELECT *
1222
-            FROM ' . prefixTable('emails') . '
1222
+            FROM ' . prefixTable('emails').'
1223 1223
             WHERE status = %s OR status = %s',
1224 1224
             'not_sent',
1225 1225
             ''
@@ -1305,13 +1305,13 @@  discard block
 block discarded – undo
1305 1305
             break;
1306 1306
         }
1307 1307
 
1308
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1308
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1309 1309
 
1310 1310
         // Instatiate email settings and service
1311 1311
         $emailSettings = new EmailSettings($SETTINGS);
1312 1312
         $emailService = new EmailService();
1313 1313
 
1314
-        $rows = DB::query('SELECT * FROM ' . prefixTable('emails') . ' WHERE status = %s OR status = %s', 'not_sent', '');
1314
+        $rows = DB::query('SELECT * FROM '.prefixTable('emails').' WHERE status = %s OR status = %s', 'not_sent', '');
1315 1315
         foreach ($rows as $record) {
1316 1316
             //send email
1317 1317
             $email = $emailService->sendMail(
@@ -1380,7 +1380,7 @@  discard block
 block discarded – undo
1380 1380
             break;
1381 1381
         }
1382 1382
 
1383
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1383
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1384 1384
 
1385 1385
         // init
1386 1386
         $filesList = array();
@@ -1393,7 +1393,7 @@  discard block
 block discarded – undo
1393 1393
                 FROM ' . prefixTable('files')
1394 1394
             );
1395 1395
             foreach ($rows as $record) {
1396
-                if (is_file($SETTINGS['path_to_upload_folder'] . '/' . $record['file'])) {
1396
+                if (is_file($SETTINGS['path_to_upload_folder'].'/'.$record['file'])) {
1397 1397
                     $addFile = false;
1398 1398
                     if (($post_option === 'attachments-decrypt' && $record['status'] === 'encrypted')
1399 1399
                         || ($post_option === 'attachments-encrypt' && $record['status'] === 'clear')
@@ -1458,8 +1458,8 @@  discard block
 block discarded – undo
1458 1458
         $post_list = filter_var_array($post_list, FILTER_SANITIZE_FULL_SPECIAL_CHARS);
1459 1459
         $post_counter = filter_var($post_counter, FILTER_SANITIZE_NUMBER_INT);
1460 1460
 
1461
-        include $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
1462
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1461
+        include $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
1462
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1463 1463
 
1464 1464
         $cpt = 0;
1465 1465
         $continu = true;
@@ -1472,33 +1472,33 @@  discard block
 block discarded – undo
1472 1472
                 // Get file name
1473 1473
                 $file_info = DB::queryFirstRow(
1474 1474
                     'SELECT file
1475
-                    FROM ' . prefixTable('files') . '
1475
+                    FROM ' . prefixTable('files').'
1476 1476
                     WHERE id = %i',
1477 1477
                     $file
1478 1478
                 );
1479 1479
 
1480 1480
                 // skip file is Coherancey not respected
1481
-                if (is_file($SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'])) {
1481
+                if (is_file($SETTINGS['path_to_upload_folder'].'/'.$file_info['file'])) {
1482 1482
                     // Case where we want to decrypt
1483 1483
                     if ($post_option === 'decrypt') {
1484 1484
                         prepareFileWithDefuse(
1485 1485
                             'decrypt',
1486
-                            $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'],
1487
-                            $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
1486
+                            $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'],
1487
+                            $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
1488 1488
                         );
1489 1489
                         // Case where we want to encrypt
1490 1490
                     } elseif ($post_option === 'encrypt') {
1491 1491
                         prepareFileWithDefuse(
1492 1492
                             'encrypt',
1493
-                            $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'],
1494
-                            $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
1493
+                            $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'],
1494
+                            $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
1495 1495
                         );
1496 1496
                     }
1497 1497
                     // Do file cleanup
1498
-                    fileDelete($SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'], $SETTINGS);
1498
+                    fileDelete($SETTINGS['path_to_upload_folder'].'/'.$file_info['file'], $SETTINGS);
1499 1499
                     rename(
1500
-                        $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
1501
-                        $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file']
1500
+                        $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
1501
+                        $SETTINGS['path_to_upload_folder'].'/'.$file_info['file']
1502 1502
                     );
1503 1503
 
1504 1504
                     // store in DB
@@ -1533,8 +1533,8 @@  discard block
 block discarded – undo
1533 1533
                 $post_option === 'attachments-decrypt' ? 'clear' : 'encrypted'
1534 1534
             );
1535 1535
 
1536
-            $message = $lang->get('last_execution') . ' ' .
1537
-                date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
1536
+            $message = $lang->get('last_execution').' '.
1537
+                date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
1538 1538
                 '<i class="fas fa-check text-success ml-2 mr-3"></i>';
1539 1539
         }
1540 1540
 
@@ -1629,7 +1629,7 @@  discard block
 block discarded – undo
1629 1629
             $post_id = filter_var($dataReceived['id'], FILTER_SANITIZE_NUMBER_INT);
1630 1630
 
1631 1631
             DB::query(
1632
-                'DELETE FROM ' . prefixTable('api') . ' WHERE increment_id = %i',
1632
+                'DELETE FROM '.prefixTable('api').' WHERE increment_id = %i',
1633 1633
                 $post_id
1634 1634
             );
1635 1635
         }
@@ -1724,7 +1724,7 @@  discard block
 block discarded – undo
1724 1724
             // Delete existing key
1725 1725
         } elseif (null !== $post_action && $post_action === 'delete') {
1726 1726
             $post_id = filter_var($dataReceived['id'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
1727
-            DB::query('DELETE FROM ' . prefixTable('api') . ' WHERE increment_id=%i', $post_id);
1727
+            DB::query('DELETE FROM '.prefixTable('api').' WHERE increment_id=%i', $post_id);
1728 1728
         }
1729 1729
 
1730 1730
         echo prepareExchangedData(
@@ -1739,7 +1739,7 @@  discard block
 block discarded – undo
1739 1739
 
1740 1740
     case 'save_api_status':
1741 1741
         // Do query
1742
-        DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'api');
1742
+        DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'api');
1743 1743
         $counter = DB::count();
1744 1744
         if ($counter === 0) {
1745 1745
             DB::insert(
@@ -1768,7 +1768,7 @@  discard block
 block discarded – undo
1768 1768
 
1769 1769
     case 'run_duo_config_check':
1770 1770
         //Libraries call
1771
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1771
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1772 1772
         // Check KEY
1773 1773
         if ($post_key !== $session->get('key')) {
1774 1774
             echo prepareExchangedData(
@@ -1874,7 +1874,7 @@  discard block
 block discarded – undo
1874 1874
         } else {
1875 1875
             $tmp = 1;
1876 1876
         }
1877
-        DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'google_authentication');
1877
+        DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'google_authentication');
1878 1878
         $counter = DB::count();
1879 1879
         if ($counter === 0) {
1880 1880
             DB::insert(
@@ -1902,7 +1902,7 @@  discard block
 block discarded – undo
1902 1902
 
1903 1903
         // ga_website_name
1904 1904
         if (is_null($dataReceived['ga_website_name']) === false) {
1905
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'ga_website_name');
1905
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'ga_website_name');
1906 1906
             $counter = DB::count();
1907 1907
             if ($counter === 0) {
1908 1908
                 DB::insert(
@@ -1932,7 +1932,7 @@  discard block
 block discarded – undo
1932 1932
         }
1933 1933
 
1934 1934
         // send data
1935
-        echo '[{"result" : "' . addslashes($lang['done']) . '" , "error" : ""}]';
1935
+        echo '[{"result" : "'.addslashes($lang['done']).'" , "error" : ""}]';
1936 1936
         break;
1937 1937
 
1938 1938
     case 'save_agses_options':
@@ -1955,7 +1955,7 @@  discard block
 block discarded – undo
1955 1955
 
1956 1956
         // agses_hosted_url
1957 1957
         if (!is_null($dataReceived['agses_hosted_url'])) {
1958
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_url');
1958
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_url');
1959 1959
             $counter = DB::count();
1960 1960
             if ($counter === 0) {
1961 1961
                 DB::insert(
@@ -1986,7 +1986,7 @@  discard block
 block discarded – undo
1986 1986
 
1987 1987
         // agses_hosted_id
1988 1988
         if (!is_null($dataReceived['agses_hosted_id'])) {
1989
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_id');
1989
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_id');
1990 1990
             $counter = DB::count();
1991 1991
             if ($counter === 0) {
1992 1992
                 DB::insert(
@@ -2017,7 +2017,7 @@  discard block
 block discarded – undo
2017 2017
 
2018 2018
         // agses_hosted_apikey
2019 2019
         if (!is_null($dataReceived['agses_hosted_apikey'])) {
2020
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_apikey');
2020
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_apikey');
2021 2021
             $counter = DB::count();
2022 2022
             if ($counter === 0) {
2023 2023
                 DB::insert(
@@ -2047,7 +2047,7 @@  discard block
 block discarded – undo
2047 2047
         }
2048 2048
 
2049 2049
         // send data
2050
-        echo '[{"result" : "' . addslashes($lang['done']) . '" , "error" : ""}]';
2050
+        echo '[{"result" : "'.addslashes($lang['done']).'" , "error" : ""}]';
2051 2051
         break;
2052 2052
 
2053 2053
     case 'save_option_change':
@@ -2088,7 +2088,7 @@  discard block
 block discarded – undo
2088 2088
 
2089 2089
         // Check if setting is already in DB. If NO then insert, if YES then update.
2090 2090
         $data = DB::query(
2091
-            'SELECT * FROM ' . prefixTable('misc') . '
2091
+            'SELECT * FROM '.prefixTable('misc').'
2092 2092
             WHERE type = %s AND intitule = %s',
2093 2093
             'admin',
2094 2094
             $post_field
@@ -2111,7 +2111,7 @@  discard block
 block discarded – undo
2111 2111
                     array(
2112 2112
                         'valeur' => time(),
2113 2113
                         'type' => 'admin',
2114
-                        'intitule' => $post_field . '_time',
2114
+                        'intitule' => $post_field.'_time',
2115 2115
                         'updated_at' => time(),
2116 2116
                     )
2117 2117
                 );
@@ -2133,10 +2133,10 @@  discard block
 block discarded – undo
2133 2133
             if ($post_field === 'send_stats') {
2134 2134
                 // Check if previous time exists, if not them insert this value in DB
2135 2135
                 DB::query(
2136
-                    'SELECT * FROM ' . prefixTable('misc') . '
2136
+                    'SELECT * FROM '.prefixTable('misc').'
2137 2137
                     WHERE type = %s AND intitule = %s',
2138 2138
                     'admin',
2139
-                    $post_field . '_time'
2139
+                    $post_field.'_time'
2140 2140
                 );
2141 2141
                 $counter = DB::count();
2142 2142
                 if ($counter === 0) {
@@ -2145,7 +2145,7 @@  discard block
 block discarded – undo
2145 2145
                         array(
2146 2146
                             'valeur' => 0,
2147 2147
                             'type' => 'admin',
2148
-                            'intitule' => $post_field . '_time',
2148
+                            'intitule' => $post_field.'_time',
2149 2149
                             'created_at' => time(),
2150 2150
                         )
2151 2151
                     );
@@ -2167,13 +2167,13 @@  discard block
 block discarded – undo
2167 2167
         // special Cases
2168 2168
         if ($post_field === 'cpassman_url') {
2169 2169
             // update also jsUrl for CSFP protection
2170
-            $jsUrl = $post_value . '/includes/libraries/csrfp/js/csrfprotector.js';
2170
+            $jsUrl = $post_value.'/includes/libraries/csrfp/js/csrfprotector.js';
2171 2171
             $csrfp_file = '../includes/libraries/csrfp/libs/csrfp.config.php';
2172 2172
             $data = file_get_contents($csrfp_file);
2173 2173
             $posJsUrl = strpos($data, '"jsUrl" => "');
2174 2174
             $posEndLine = strpos($data, '",', $posJsUrl);
2175 2175
             $line = substr($data, $posJsUrl, ($posEndLine - $posJsUrl + 2));
2176
-            $newdata = str_replace($line, '"jsUrl" => "' . filter_var($jsUrl, FILTER_SANITIZE_FULL_SPECIAL_CHARS) . '",', $data);
2176
+            $newdata = str_replace($line, '"jsUrl" => "'.filter_var($jsUrl, FILTER_SANITIZE_FULL_SPECIAL_CHARS).'",', $data);
2177 2177
             file_put_contents($csrfp_file, $newdata);
2178 2178
         } elseif ($post_field === 'restricted_to_input' && (int) $post_value === 0) {
2179 2179
             DB::update(
@@ -2198,7 +2198,7 @@  discard block
 block discarded – undo
2198 2198
         echo prepareExchangedData(
2199 2199
             array(
2200 2200
                 'error' => false,
2201
-                'misc' => $counter . ' ; ' . $SETTINGS[$post_field],
2201
+                'misc' => $counter.' ; '.$SETTINGS[$post_field],
2202 2202
                 'message' => empty($post_translate) === false ? $lang->get($post_translate) : '',
2203 2203
             ),
2204 2204
             'encode'
@@ -2241,7 +2241,7 @@  discard block
 block discarded – undo
2241 2241
 
2242 2242
         // send statistics
2243 2243
         if (null !== $post_status) {
2244
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'send_stats');
2244
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'send_stats');
2245 2245
             $counter = DB::count();
2246 2246
             if ($counter === 0) {
2247 2247
                 DB::insert(
@@ -2272,7 +2272,7 @@  discard block
 block discarded – undo
2272 2272
 
2273 2273
         // send statistics items
2274 2274
         if (null !== $post_list) {
2275
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'send_statistics_items');
2275
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'send_statistics_items');
2276 2276
             $counter = DB::count();
2277 2277
             if ($counter === 0) {
2278 2278
                 DB::insert(
@@ -2318,7 +2318,7 @@  discard block
 block discarded – undo
2318 2318
             break;
2319 2319
         }
2320 2320
 
2321
-        if (DB::query("SHOW TABLES LIKE '" . prefixTable('sk_reencrypt_backup') . "'")) {
2321
+        if (DB::query("SHOW TABLES LIKE '".prefixTable('sk_reencrypt_backup')."'")) {
2322 2322
             if (DB::count() === 1) {
2323 2323
                 echo 1;
2324 2324
             } else {
@@ -2379,7 +2379,7 @@  discard block
 block discarded – undo
2379 2379
 
2380 2380
         $rows = DB::query(
2381 2381
             'SELECT id, title
2382
-                FROM ' . prefixTable('roles_title') . '
2382
+                FROM ' . prefixTable('roles_title').'
2383 2383
                 ORDER BY title ASC'
2384 2384
         );
2385 2385
         foreach ($rows as $record) {
@@ -2511,7 +2511,7 @@  discard block
 block discarded – undo
2511 2511
 
2512 2512
         $ignoredFiles = DB::queryFirstField(
2513 2513
             'SELECT valeur 
2514
-            FROM ' . prefixTable('misc') . ' 
2514
+            FROM ' . prefixTable('misc').' 
2515 2515
             WHERE type = %s AND intitule = %s',
2516 2516
             'admin',
2517 2517
             'ignored_unknown_files'
@@ -2554,7 +2554,7 @@  discard block
 block discarded – undo
2554 2554
         // Get ignored unknown files
2555 2555
         $existingData = DB::queryFirstRow(
2556 2556
             'SELECT valeur 
2557
-            FROM ' . prefixTable('misc') . ' 
2557
+            FROM ' . prefixTable('misc').' 
2558 2558
             WHERE type = %s AND intitule = %s',
2559 2559
             'admin',
2560 2560
             'ignored_unknown_files'
@@ -2611,7 +2611,7 @@  discard block
 block discarded – undo
2611 2611
         // Get the list of files to delete
2612 2612
         $filesToDelete = DB::queryFirstField(
2613 2613
             'SELECT valeur 
2614
-            FROM ' . prefixTable('misc') . ' 
2614
+            FROM ' . prefixTable('misc').' 
2615 2615
             WHERE type = %s AND intitule = %s',
2616 2616
             'admin',
2617 2617
             'unknown_files'
@@ -2658,7 +2658,7 @@  discard block
 block discarded – undo
2658 2658
     $lang = new Language($session->get('user-language') ?? 'english');
2659 2659
 
2660 2660
     $results = [];
2661
-    $fullPath = __DIR__ . '/../';
2661
+    $fullPath = __DIR__.'/../';
2662 2662
     
2663 2663
     foreach ($files as $file) {
2664 2664
         // Normalize path separators for cross-platform compatibility
@@ -2707,7 +2707,7 @@  discard block
 block discarded – undo
2707 2707
         }
2708 2708
         
2709 2709
         // Try to delete the file
2710
-        $deleteResult = '';//@unlink($normalizedPath);
2710
+        $deleteResult = ''; //@unlink($normalizedPath);
2711 2711
         
2712 2712
         if ($deleteResult) {
2713 2713
             $results[$normalizedPath] = [
@@ -2737,7 +2737,7 @@  discard block
 block discarded – undo
2737 2737
  */
2738 2738
 function filesIntegrityCheck($baseDir): array
2739 2739
 {
2740
-    $referenceFile = __DIR__ . '/../files_reference.txt';
2740
+    $referenceFile = __DIR__.'/../files_reference.txt';
2741 2741
 
2742 2742
     $unknownFiles = findUnknownFiles($baseDir, $referenceFile);
2743 2743
 
@@ -2775,7 +2775,7 @@  discard block
 block discarded – undo
2775 2775
                 $dir,
2776 2776
                 FilesystemIterator::SKIP_DOTS
2777 2777
             ),
2778
-            function ($current, $key, $iterator) {
2778
+            function($current, $key, $iterator) {
2779 2779
                 // Ignore hidden files and folders
2780 2780
                 if ($current->getFilename()[0] === '.') {
2781 2781
                     return false;
@@ -2789,7 +2789,7 @@  discard block
 block discarded – undo
2789 2789
     foreach ($iterator as $file) {
2790 2790
         try {
2791 2791
             if ($file->isFile()) {
2792
-                $relativePath = str_replace($dir . DIRECTORY_SEPARATOR, '', $file->getPathname());
2792
+                $relativePath = str_replace($dir.DIRECTORY_SEPARATOR, '', $file->getPathname());
2793 2793
                 $relativePath = str_replace('\\', '/', $relativePath); // Normalisation Windows/Linux
2794 2794
 
2795 2795
                 // Split relatif path into parts
@@ -2855,7 +2855,7 @@  discard block
 block discarded – undo
2855 2855
     // Get ignored files
2856 2856
     $ignoredFiles = DB::queryFirstField(
2857 2857
         'SELECT valeur 
2858
-        FROM ' . prefixTable('misc') . ' 
2858
+        FROM ' . prefixTable('misc').' 
2859 2859
         WHERE type = %s AND intitule = %s',
2860 2860
         'admin',
2861 2861
         'ignored_unknown_files'
@@ -2874,7 +2874,7 @@  discard block
 block discarded – undo
2874 2874
 function tablesIntegrityCheck(): array
2875 2875
 {
2876 2876
     // Get integrity tables file
2877
-    $integrityTablesFile = TEAMPASS_ROOT_PATH . '/includes/tables_integrity.json';
2877
+    $integrityTablesFile = TEAMPASS_ROOT_PATH.'/includes/tables_integrity.json';
2878 2878
     if (file_exists($integrityTablesFile) === false) {
2879 2879
         return [
2880 2880
             'error' => true,
@@ -2892,7 +2892,7 @@  discard block
 block discarded – undo
2892 2892
     // Get all tables
2893 2893
     $tables = [];
2894 2894
     foreach (DB::queryFirstColumn("SHOW TABLES") as $table) {
2895
-        $tables[] = str_replace(DB_PREFIX, "", $table);;
2895
+        $tables[] = str_replace(DB_PREFIX, "", $table); ;
2896 2896
     }
2897 2897
     // Prepare the integrity check
2898 2898
     $tablesInError = [];
@@ -2958,7 +2958,7 @@  discard block
 block discarded – undo
2958 2958
 
2959 2959
         // Compare hashes
2960 2960
         $expectedHash = $referenceData[$file];
2961
-        $actualHash = md5_file($baseDir . '/' . $file);
2961
+        $actualHash = md5_file($baseDir.'/'.$file);
2962 2962
 
2963 2963
         if ($expectedHash !== $actualHash) {
2964 2964
             $issues[] = "$file (expected: <i>$expectedHash</i>, actual: <i>$actualHash</i>)";
@@ -3011,7 +3011,7 @@  discard block
 block discarded – undo
3011 3011
     foreach ($iterator as $file) {
3012 3012
         if ($file->isFile()) {
3013 3013
             // Build relative path
3014
-            $relativePath = str_replace($dir . DIRECTORY_SEPARATOR, '', $file->getPathname());
3014
+            $relativePath = str_replace($dir.DIRECTORY_SEPARATOR, '', $file->getPathname());
3015 3015
             $relativePath = str_replace('\\', '/', $relativePath); // Normalize for Windows
3016 3016
             // Calculate hash
3017 3017
             $files[$relativePath] = md5_file($file->getPathname());
Please login to merge, or discard this patch.