Passed
Push — master ( d259cf...6abf99 )
by Nils
17:18 queued 10:07
created
sources/main.functions.php 3 patches
Indentation   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2225,7 +2225,7 @@  discard block
 block discarded – undo
2225 2225
  * <tt>exec("find ".$path." -type d -exec chmod 755 {} \;");</tt>
2226 2226
  *
2227 2227
  * @author Jeppe Toustrup (tenzer at tenzer dot dk)
2228
-  *
2228
+ *
2229 2229
  * @param string $path      An either relative or absolute path to a file or directory which should be processed.
2230 2230
  * @param int    $filePerm The permissions any found files should get.
2231 2231
  * @param int    $dirPerm  The permissions any found folder should get.
@@ -3848,7 +3848,6 @@  discard block
 block discarded – undo
3848 3848
  * @param integer $processId
3849 3849
  * @param integer $nbItemsToTreat
3850 3850
  * @return void
3851
- 
3852 3851
  */
3853 3852
 function createUserTasks($processId, $nbItemsToTreat): void
3854 3853
 {
Please login to merge, or discard this patch.
Spacing   +152 added lines, -154 removed lines patch added patch discarded remove patch
@@ -134,19 +134,19 @@  discard block
 block discarded – undo
134 134
             $text = Crypto::decrypt($message, $key);
135 135
         }
136 136
     } catch (CryptoException\WrongKeyOrModifiedCiphertextException $ex) {
137
-        error_log('TEAMPASS-Error-Wrong key or modified ciphertext: ' . $ex->getMessage());
137
+        error_log('TEAMPASS-Error-Wrong key or modified ciphertext: '.$ex->getMessage());
138 138
         $err = 'wrong_key_or_modified_ciphertext';
139 139
     } catch (CryptoException\BadFormatException $ex) {
140
-        error_log('TEAMPASS-Error-Bad format exception: ' . $ex->getMessage());
140
+        error_log('TEAMPASS-Error-Bad format exception: '.$ex->getMessage());
141 141
         $err = 'bad_format';
142 142
     } catch (CryptoException\EnvironmentIsBrokenException $ex) {
143
-        error_log('TEAMPASS-Error-Environment: ' . $ex->getMessage());
143
+        error_log('TEAMPASS-Error-Environment: '.$ex->getMessage());
144 144
         $err = 'environment_error';
145 145
     } catch (CryptoException\IOException $ex) {
146
-        error_log('TEAMPASS-Error-IO: ' . $ex->getMessage());
146
+        error_log('TEAMPASS-Error-IO: '.$ex->getMessage());
147 147
         $err = 'io_error';
148 148
     } catch (Exception $ex) {
149
-        error_log('TEAMPASS-Error-Unexpected exception: ' . $ex->getMessage());
149
+        error_log('TEAMPASS-Error-Unexpected exception: '.$ex->getMessage());
150 150
         $err = 'unexpected_error';
151 151
     }
152 152
 
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
  */
232 232
 function trimElement($chaine, string $element): string
233 233
 {
234
-    if (! empty($chaine)) {
234
+    if (!empty($chaine)) {
235 235
         if (is_array($chaine) === true) {
236 236
             $chaine = implode(';', $chaine);
237 237
         }
@@ -279,8 +279,8 @@  discard block
 block discarded – undo
279 279
  */
280 280
 function db_error_handler(array $params): void
281 281
 {
282
-    echo 'Error: ' . $params['error'] . "<br>\n";
283
-    echo 'Query: ' . $params['query'] . "<br>\n";
282
+    echo 'Error: '.$params['error']."<br>\n";
283
+    echo 'Query: '.$params['query']."<br>\n";
284 284
     throw new Exception('Error - Query', 1);
285 285
 }
286 286
 
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
     $session->set('user-forbiden_personal_folders', []);
359 359
     
360 360
     // Get list of Folders
361
-    $rows = DB::query('SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', 0);
361
+    $rows = DB::query('SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', 0);
362 362
     foreach ($rows as $record) {
363 363
         array_push($groupesVisibles, $record['id']);
364 364
     }
@@ -368,20 +368,20 @@  discard block
 block discarded – undo
368 368
     // get complete list of ROLES
369 369
     $tmp = explode(';', $idFonctions);
370 370
     $rows = DB::query(
371
-        'SELECT * FROM ' . prefixTable('roles_title') . '
371
+        'SELECT * FROM '.prefixTable('roles_title').'
372 372
         ORDER BY title ASC'
373 373
     );
374 374
     foreach ($rows as $record) {
375
-        if (! empty($record['id']) && ! in_array($record['id'], $tmp)) {
375
+        if (!empty($record['id']) && !in_array($record['id'], $tmp)) {
376 376
             array_push($tmp, $record['id']);
377 377
         }
378 378
     }
379 379
     $session->set('user-roles', implode(';', $tmp));
380 380
     $session->set('user-admin', 1);
381 381
     // Check if admin has created Folders and Roles
382
-    DB::query('SELECT * FROM ' . prefixTable('nested_tree') . '');
382
+    DB::query('SELECT * FROM '.prefixTable('nested_tree').'');
383 383
     $session->set('user-nb_folders', DB::count());
384
-    DB::query('SELECT * FROM ' . prefixTable('roles_title'));
384
+    DB::query('SELECT * FROM '.prefixTable('roles_title'));
385 385
     $session->set('user-nb_roles', DB::count());
386 386
 
387 387
     return true;
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
     // Does this user is allowed to see other items
465 465
     $inc = 0;
466 466
     $rows = DB::query(
467
-        'SELECT id, id_tree FROM ' . prefixTable('items') . '
467
+        'SELECT id, id_tree FROM '.prefixTable('items').'
468 468
             WHERE restricted_to LIKE %ss AND inactif = %s'.
469 469
             (count($allowedFolders) > 0 ? ' AND id_tree NOT IN ('.implode(',', $allowedFolders).')' : ''),
470 470
         $globalsUserId,
@@ -481,8 +481,8 @@  discard block
 block discarded – undo
481 481
     // Check for the users roles if some specific rights exist on items
482 482
     $rows = DB::query(
483 483
         'SELECT i.id_tree, r.item_id
484
-        FROM ' . prefixTable('items') . ' as i
485
-        INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (r.item_id=i.id)
484
+        FROM ' . prefixTable('items').' as i
485
+        INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (r.item_id=i.id)
486 486
         WHERE i.id_tree <> "" '.
487 487
         (count($userRoles) > 0 ? 'AND r.role_id IN %li ' : '').
488 488
         'ORDER BY i.id_tree ASC',
@@ -536,16 +536,16 @@  discard block
 block discarded – undo
536 536
         ), SORT_NUMERIC)
537 537
     );
538 538
     // Folders and Roles numbers
539
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('nested_tree') . '');
539
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('nested_tree').'');
540 540
     $session->set('user-nb_folders', DB::count());
541
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('roles_title'));
541
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('roles_title'));
542 542
     $session->set('user-nb_roles', DB::count());
543 543
     // check if change proposals on User's items
544 544
     if (isset($SETTINGS['enable_suggestion']) === true && (int) $SETTINGS['enable_suggestion'] === 1) {
545 545
         $countNewItems = DB::query(
546 546
             'SELECT COUNT(*)
547
-            FROM ' . prefixTable('items_change') . ' AS c
548
-            LEFT JOIN ' . prefixTable('log_items') . ' AS i ON (c.item_id = i.id_item)
547
+            FROM ' . prefixTable('items_change').' AS c
548
+            LEFT JOIN ' . prefixTable('log_items').' AS i ON (c.item_id = i.id_item)
549 549
             WHERE i.action = %s AND i.id_user = %i',
550 550
             'at_creation',
551 551
             $globalsUserId
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
 {
573 573
     $rows = DB::query(
574 574
         'SELECT *
575
-        FROM ' . prefixTable('roles_values') . '
575
+        FROM ' . prefixTable('roles_values').'
576 576
         WHERE type IN %ls'.(count($userRoles) > 0 ? ' AND role_id IN %li' : ''),
577 577
         ['W', 'ND', 'NE', 'NDNE', 'R'],
578 578
         $userRoles,
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
     ) {
640 640
         $persoFld = DB::queryfirstrow(
641 641
             'SELECT id
642
-            FROM ' . prefixTable('nested_tree') . '
642
+            FROM ' . prefixTable('nested_tree').'
643 643
             WHERE title = %s AND personal_folder = %i'.
644 644
             (count($allowedFolders) > 0 ? ' AND id NOT IN ('.implode(',', $allowedFolders).')' : ''),
645 645
             $globalsUserId,
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
     }
673 673
     $persoFlds = DB::query(
674 674
         'SELECT id
675
-        FROM ' . prefixTable('nested_tree') . '
675
+        FROM ' . prefixTable('nested_tree').'
676 676
         WHERE %l',
677 677
         $where
678 678
     );
@@ -740,12 +740,12 @@  discard block
 block discarded – undo
740 740
     //Load Tree
741 741
     $tree = new NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
742 742
     // truncate table
743
-    DB::query('TRUNCATE TABLE ' . prefixTable('cache'));
743
+    DB::query('TRUNCATE TABLE '.prefixTable('cache'));
744 744
     // reload date
745 745
     $rows = DB::query(
746 746
         'SELECT *
747
-        FROM ' . prefixTable('items') . ' as i
748
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
747
+        FROM ' . prefixTable('items').' as i
748
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
749 749
         AND l.action = %s
750 750
         AND i.inactif = %i',
751 751
         'at_creation',
@@ -757,18 +757,18 @@  discard block
 block discarded – undo
757 757
             $tags = '';
758 758
             $itemTags = DB::query(
759 759
                 'SELECT tag
760
-                FROM ' . prefixTable('tags') . '
760
+                FROM ' . prefixTable('tags').'
761 761
                 WHERE item_id = %i AND tag != ""',
762 762
                 $record['id']
763 763
             );
764 764
             foreach ($itemTags as $itemTag) {
765
-                $tags .= $itemTag['tag'] . ' ';
765
+                $tags .= $itemTag['tag'].' ';
766 766
             }
767 767
 
768 768
             // Get renewal period
769 769
             $resNT = DB::queryfirstrow(
770 770
                 'SELECT renewal_period
771
-                FROM ' . prefixTable('nested_tree') . '
771
+                FROM ' . prefixTable('nested_tree').'
772 772
                 WHERE id = %i',
773 773
                 $record['id_tree']
774 774
             );
@@ -781,7 +781,7 @@  discard block
 block discarded – undo
781 781
                     // Is this a User id?
782 782
                     $user = DB::queryfirstrow(
783 783
                         'SELECT id, login
784
-                        FROM ' . prefixTable('users') . '
784
+                        FROM ' . prefixTable('users').'
785 785
                         WHERE id = %i',
786 786
                         $elem->title
787 787
                     );
@@ -799,11 +799,11 @@  discard block
 block discarded – undo
799 799
                     'id' => $record['id'],
800 800
                     'label' => $record['label'],
801 801
                     'description' => $record['description'] ?? '',
802
-                    'url' => isset($record['url']) && ! empty($record['url']) ? $record['url'] : '0',
802
+                    'url' => isset($record['url']) && !empty($record['url']) ? $record['url'] : '0',
803 803
                     'tags' => $tags,
804 804
                     'id_tree' => $record['id_tree'],
805 805
                     'perso' => $record['perso'],
806
-                    'restricted_to' => isset($record['restricted_to']) && ! empty($record['restricted_to']) ? $record['restricted_to'] : '0',
806
+                    'restricted_to' => isset($record['restricted_to']) && !empty($record['restricted_to']) ? $record['restricted_to'] : '0',
807 807
                     'login' => $record['login'] ?? '',
808 808
                     'folder' => implode(' > ', $folder),
809 809
                     'author' => $record['id_user'],
@@ -832,7 +832,7 @@  discard block
 block discarded – undo
832 832
     // get new value from db
833 833
     $data = DB::queryfirstrow(
834 834
         'SELECT label, description, id_tree, perso, restricted_to, login, url
835
-        FROM ' . prefixTable('items') . '
835
+        FROM ' . prefixTable('items').'
836 836
         WHERE id=%i',
837 837
         $ident
838 838
     );
@@ -840,12 +840,12 @@  discard block
 block discarded – undo
840 840
     $tags = '';
841 841
     $itemTags = DB::query(
842 842
         'SELECT tag
843
-            FROM ' . prefixTable('tags') . '
843
+            FROM ' . prefixTable('tags').'
844 844
             WHERE item_id = %i AND tag != ""',
845 845
         $ident
846 846
     );
847 847
     foreach ($itemTags as $itemTag) {
848
-        $tags .= $itemTag['tag'] . ' ';
848
+        $tags .= $itemTag['tag'].' ';
849 849
     }
850 850
     // form id_tree to full foldername
851 851
     $folder = [];
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
             // Is this a User id?
857 857
             $user = DB::queryfirstrow(
858 858
                 'SELECT id, login
859
-                FROM ' . prefixTable('users') . '
859
+                FROM ' . prefixTable('users').'
860 860
                 WHERE id = %i',
861 861
                 $elem->title
862 862
             );
@@ -874,10 +874,10 @@  discard block
 block discarded – undo
874 874
             'label' => $data['label'],
875 875
             'description' => $data['description'],
876 876
             'tags' => $tags,
877
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
877
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
878 878
             'id_tree' => $data['id_tree'],
879 879
             'perso' => $data['perso'],
880
-            'restricted_to' => isset($data['restricted_to']) && ! empty($data['restricted_to']) ? $data['restricted_to'] : '0',
880
+            'restricted_to' => isset($data['restricted_to']) && !empty($data['restricted_to']) ? $data['restricted_to'] : '0',
881 881
             'login' => $data['login'] ?? '',
882 882
             'folder' => implode(' » ', $folder),
883 883
             'author' => $session->get('user-id'),
@@ -907,8 +907,8 @@  discard block
 block discarded – undo
907 907
     // get new value from db
908 908
     $data = DB::queryFirstRow(
909 909
         'SELECT i.label, i.description, i.id_tree as id_tree, i.perso, i.restricted_to, i.id, i.login, i.url, l.date
910
-        FROM ' . prefixTable('items') . ' as i
911
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
910
+        FROM ' . prefixTable('items').' as i
911
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
912 912
         WHERE i.id = %i
913 913
         AND l.action = %s',
914 914
         $ident,
@@ -918,12 +918,12 @@  discard block
 block discarded – undo
918 918
     $tags = '';
919 919
     $itemTags = DB::query(
920 920
         'SELECT tag
921
-            FROM ' . prefixTable('tags') . '
921
+            FROM ' . prefixTable('tags').'
922 922
             WHERE item_id = %i AND tag != ""',
923 923
         $ident
924 924
     );
925 925
     foreach ($itemTags as $itemTag) {
926
-        $tags .= $itemTag['tag'] . ' ';
926
+        $tags .= $itemTag['tag'].' ';
927 927
     }
928 928
     // form id_tree to full foldername
929 929
     $folder = [];
@@ -934,7 +934,7 @@  discard block
 block discarded – undo
934 934
             // Is this a User id?
935 935
             $user = DB::queryfirstrow(
936 936
                 'SELECT id, login
937
-                FROM ' . prefixTable('users') . '
937
+                FROM ' . prefixTable('users').'
938 938
                 WHERE id = %i',
939 939
                 $elem->title
940 940
             );
@@ -953,7 +953,7 @@  discard block
 block discarded – undo
953 953
             'label' => $data['label'],
954 954
             'description' => $data['description'],
955 955
             'tags' => isset($tags) && empty($tags) === false ? $tags : 'None',
956
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
956
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
957 957
             'id_tree' => $data['id_tree'],
958 958
             'perso' => isset($data['perso']) && empty($data['perso']) === false && $data['perso'] !== 'None' ? $data['perso'] : '0',
959 959
             'restricted_to' => isset($data['restricted_to']) && empty($data['restricted_to']) === false ? $data['restricted_to'] : '0',
@@ -975,53 +975,53 @@  discard block
 block discarded – undo
975 975
 function getStatisticsData(array $SETTINGS): array
976 976
 {
977 977
     DB::query(
978
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
978
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
979 979
         0
980 980
     );
981 981
     $counter_folders = DB::count();
982 982
     DB::query(
983
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
983
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
984 984
         1
985 985
     );
986 986
     $counter_folders_perso = DB::count();
987 987
     DB::query(
988
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
988
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
989 989
         0
990 990
     );
991 991
     $counter_items = DB::count();
992 992
         DB::query(
993
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
993
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
994 994
         1
995 995
     );
996 996
     $counter_items_perso = DB::count();
997 997
         DB::query(
998
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE login NOT IN (%s, %s, %s)',
998
+        'SELECT id FROM '.prefixTable('users').' WHERE login NOT IN (%s, %s, %s)',
999 999
         'OTV', 'TP', 'API'
1000 1000
     );
1001 1001
     $counter_users = DB::count();
1002 1002
         DB::query(
1003
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE admin = %i',
1003
+        'SELECT id FROM '.prefixTable('users').' WHERE admin = %i',
1004 1004
         1
1005 1005
     );
1006 1006
     $admins = DB::count();
1007 1007
     DB::query(
1008
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE gestionnaire = %i',
1008
+        'SELECT id FROM '.prefixTable('users').' WHERE gestionnaire = %i',
1009 1009
         1
1010 1010
     );
1011 1011
     $managers = DB::count();
1012 1012
     DB::query(
1013
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE read_only = %i',
1013
+        'SELECT id FROM '.prefixTable('users').' WHERE read_only = %i',
1014 1014
         1
1015 1015
     );
1016 1016
     $readOnly = DB::count();
1017 1017
     // list the languages
1018 1018
     $usedLang = [];
1019 1019
     $tp_languages = DB::query(
1020
-        'SELECT name FROM ' . prefixTable('languages')
1020
+        'SELECT name FROM '.prefixTable('languages')
1021 1021
     );
1022 1022
     foreach ($tp_languages as $tp_language) {
1023 1023
         DB::query(
1024
-            'SELECT * FROM ' . prefixTable('users') . ' WHERE user_language = %s',
1024
+            'SELECT * FROM '.prefixTable('users').' WHERE user_language = %s',
1025 1025
             $tp_language['name']
1026 1026
         );
1027 1027
         $usedLang[$tp_language['name']] = round((DB::count() * 100 / $counter_users), 0);
@@ -1030,12 +1030,12 @@  discard block
 block discarded – undo
1030 1030
     // get list of ips
1031 1031
     $usedIp = [];
1032 1032
     $tp_ips = DB::query(
1033
-        'SELECT user_ip FROM ' . prefixTable('users')
1033
+        'SELECT user_ip FROM '.prefixTable('users')
1034 1034
     );
1035 1035
     foreach ($tp_ips as $ip) {
1036 1036
         if (array_key_exists($ip['user_ip'], $usedIp)) {
1037 1037
             $usedIp[$ip['user_ip']] += $usedIp[$ip['user_ip']];
1038
-        } elseif (! empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1038
+        } elseif (!empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1039 1039
             $usedIp[$ip['user_ip']] = 1;
1040 1040
         }
1041 1041
     }
@@ -1130,7 +1130,7 @@  discard block
 block discarded – undo
1130 1130
         <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;">
1131 1131
         <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;">
1132 1132
         <br><div style="float:right;">' .
1133
-        $textMail .
1133
+        $textMail.
1134 1134
         '<br><br></td></tr></table>
1135 1135
     </td></tr></table>
1136 1136
     <br></body></html>';
@@ -1211,7 +1211,7 @@  discard block
 block discarded – undo
1211 1211
 {
1212 1212
     array_walk_recursive(
1213 1213
         $array,
1214
-        static function (&$item): void {
1214
+        static function(&$item): void {
1215 1215
             if (mb_detect_encoding((string) $item, 'utf-8', true) === false) {
1216 1216
                 $item = mb_convert_encoding($item, 'ISO-8859-1', 'UTF-8');
1217 1217
             }
@@ -1322,7 +1322,7 @@  discard block
 block discarded – undo
1322 1322
  */
1323 1323
 function prefixTable(string $table): string
1324 1324
 {
1325
-    $safeTable = htmlspecialchars(DB_PREFIX . $table);
1325
+    $safeTable = htmlspecialchars(DB_PREFIX.$table);
1326 1326
     if (empty($safeTable) === false) {
1327 1327
         // sanitize string
1328 1328
         return $safeTable;
@@ -1444,7 +1444,7 @@  discard block
 block discarded – undo
1444 1444
 function send_syslog($message, $host, $port, $component = 'teampass'): void
1445 1445
 {
1446 1446
     $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
1447
-    $syslog_message = '<123>' . date('M d H:i:s ') . $component . ': ' . $message;
1447
+    $syslog_message = '<123>'.date('M d H:i:s ').$component.': '.$message;
1448 1448
     socket_sendto($sock, (string) $syslog_message, strlen($syslog_message), 0, (string) $host, (int) $port);
1449 1449
     socket_close($sock);
1450 1450
 }
@@ -1491,14 +1491,14 @@  discard block
 block discarded – undo
1491 1491
     if (isset($SETTINGS['syslog_enable']) === true && (int) $SETTINGS['syslog_enable'] === 1) {
1492 1492
         if ($type === 'user_mngt') {
1493 1493
             send_syslog(
1494
-                'action=' . str_replace('at_', '', $label) . ' attribute=user user=' . $who . ' userid="' . $login . '" change="' . $field_1 . '" ',
1494
+                'action='.str_replace('at_', '', $label).' attribute=user user='.$who.' userid="'.$login.'" change="'.$field_1.'" ',
1495 1495
                 $SETTINGS['syslog_host'],
1496 1496
                 $SETTINGS['syslog_port'],
1497 1497
                 'teampass'
1498 1498
             );
1499 1499
         } else {
1500 1500
             send_syslog(
1501
-                'action=' . $type . ' attribute=' . $label . ' user=' . $who . ' userid="' . $login . '" ',
1501
+                'action='.$type.' attribute='.$label.' user='.$who.' userid="'.$login.'" ',
1502 1502
                 $SETTINGS['syslog_host'],
1503 1503
                 $SETTINGS['syslog_port'],
1504 1504
                 'teampass'
@@ -1573,7 +1573,7 @@  discard block
 block discarded – undo
1573 1573
         if (empty($item_label) === true) {
1574 1574
             $dataItem = DB::queryfirstrow(
1575 1575
                 'SELECT id, id_tree, label
1576
-                FROM ' . prefixTable('items') . '
1576
+                FROM ' . prefixTable('items').'
1577 1577
                 WHERE id = %i',
1578 1578
                 $item_id
1579 1579
             );
@@ -1581,11 +1581,11 @@  discard block
 block discarded – undo
1581 1581
         }
1582 1582
 
1583 1583
         send_syslog(
1584
-            'action=' . str_replace('at_', '', $action) .
1585
-                ' attribute=' . str_replace('at_', '', $attribute[0]) .
1586
-                ' itemno=' . $item_id .
1587
-                ' user=' . (is_null($login) === true ? '' : addslashes((string) $login)) .
1588
-                ' itemname="' . addslashes($item_label) . '"',
1584
+            'action='.str_replace('at_', '', $action).
1585
+                ' attribute='.str_replace('at_', '', $attribute[0]).
1586
+                ' itemno='.$item_id.
1587
+                ' user='.(is_null($login) === true ? '' : addslashes((string) $login)).
1588
+                ' itemname="'.addslashes($item_label).'"',
1589 1589
             $SETTINGS['syslog_host'],
1590 1590
             $SETTINGS['syslog_port'],
1591 1591
             'teampass'
@@ -1617,8 +1617,8 @@  discard block
 block discarded – undo
1617 1617
     $notification = DB::queryOneColumn(
1618 1618
         'email',
1619 1619
         'SELECT *
1620
-        FROM ' . prefixTable('notification') . ' AS n
1621
-        INNER JOIN ' . prefixTable('users') . ' AS u ON (n.user_id = u.id)
1620
+        FROM ' . prefixTable('notification').' AS n
1621
+        INNER JOIN ' . prefixTable('users').' AS u ON (n.user_id = u.id)
1622 1622
         WHERE n.item_id = %i AND n.user_id != %i',
1623 1623
         $item_id,
1624 1624
         $globalsUserId
@@ -1629,7 +1629,7 @@  discard block
 block discarded – undo
1629 1629
         // Get list of changes
1630 1630
         $htmlChanges = '<ul>';
1631 1631
         foreach ($changes as $change) {
1632
-            $htmlChanges .= '<li>' . $change . '</li>';
1632
+            $htmlChanges .= '<li>'.$change.'</li>';
1633 1633
         }
1634 1634
         $htmlChanges .= '</ul>';
1635 1635
         // send email
@@ -1666,15 +1666,15 @@  discard block
 block discarded – undo
1666 1666
     $path = '';
1667 1667
     foreach ($arbo as $elem) {
1668 1668
         if (empty($path) === true) {
1669
-            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' ';
1669
+            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' ';
1670 1670
         } else {
1671
-            $path .= '&#8594; ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1671
+            $path .= '&#8594; '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1672 1672
         }
1673 1673
     }
1674 1674
 
1675 1675
     // Build text to show user
1676 1676
     if (empty($label) === false) {
1677
-        return empty($path) === true ? addslashes($label) : addslashes($label) . ' (' . $path . ')';
1677
+        return empty($path) === true ? addslashes($label) : addslashes($label).' ('.$path.')';
1678 1678
     }
1679 1679
     return empty($path) === true ? '' : $path;
1680 1680
 }
@@ -1730,7 +1730,7 @@  discard block
 block discarded – undo
1730 1730
 {
1731 1731
     // Perform a copy if the file exists
1732 1732
     if (file_exists($configFilePath)) {
1733
-        $backupFilePath = $configFilePath . '.' . date('Y_m_d_His', time());
1733
+        $backupFilePath = $configFilePath.'.'.date('Y_m_d_His', time());
1734 1734
         if (!copy($configFilePath, $backupFilePath)) {
1735 1735
             return "ERROR: Could not copy file '$configFilePath'";
1736 1736
         }
@@ -1738,10 +1738,10 @@  discard block
 block discarded – undo
1738 1738
 
1739 1739
     // Regenerate the config file
1740 1740
     $data = ["<?php\n", "global \$SETTINGS;\n", "\$SETTINGS = array (\n"];
1741
-    $rows = DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s', 'admin');
1741
+    $rows = DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type=%s', 'admin');
1742 1742
     foreach ($rows as $record) {
1743 1743
         $value = getEncryptedValue($record['valeur'], $record['is_encrypted']);
1744
-        $data[] = "    '{$record['intitule']}' => '". htmlspecialchars_decode($value, ENT_COMPAT) . "',\n";
1744
+        $data[] = "    '{$record['intitule']}' => '".htmlspecialchars_decode($value, ENT_COMPAT)."',\n";
1745 1745
     }
1746 1746
     $data[] = ");\n";
1747 1747
     $data = array_unique($data);
@@ -1786,7 +1786,7 @@  discard block
 block discarded – undo
1786 1786
 {
1787 1787
     global $SETTINGS;
1788 1788
     /* LOAD CPASSMAN SETTINGS */
1789
-    if (! isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
1789
+    if (!isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
1790 1790
         $SETTINGS = [];
1791 1791
         $SETTINGS['duplicate_folder'] = 0;
1792 1792
         //by default, this is set to 0;
@@ -1796,7 +1796,7 @@  discard block
 block discarded – undo
1796 1796
         //by default, this value is set to 5;
1797 1797
         $settings = [];
1798 1798
         $rows = DB::query(
1799
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s_type OR type=%s_type2',
1799
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s_type OR type=%s_type2',
1800 1800
             [
1801 1801
                 'type' => 'admin',
1802 1802
                 'type2' => 'settings',
@@ -1828,7 +1828,7 @@  discard block
 block discarded – undo
1828 1828
     $source_cf = [];
1829 1829
     $rows = DB::QUERY(
1830 1830
         'SELECT id_category
1831
-            FROM ' . prefixTable('categories_folders') . '
1831
+            FROM ' . prefixTable('categories_folders').'
1832 1832
             WHERE id_folder = %i',
1833 1833
         $source_id
1834 1834
     );
@@ -1839,7 +1839,7 @@  discard block
 block discarded – undo
1839 1839
     $target_cf = [];
1840 1840
     $rows = DB::QUERY(
1841 1841
         'SELECT id_category
1842
-            FROM ' . prefixTable('categories_folders') . '
1842
+            FROM ' . prefixTable('categories_folders').'
1843 1843
             WHERE id_folder = %i',
1844 1844
         $target_id
1845 1845
     );
@@ -1934,10 +1934,10 @@  discard block
 block discarded – undo
1934 1934
     } catch (CryptoException\WrongKeyOrModifiedCiphertextException $ex) {
1935 1935
         $err = 'wrong_key';
1936 1936
     } catch (CryptoException\EnvironmentIsBrokenException $ex) {
1937
-        error_log('TEAMPASS-Error-Environment: ' . $ex->getMessage());
1937
+        error_log('TEAMPASS-Error-Environment: '.$ex->getMessage());
1938 1938
         $err = 'environment_error';
1939 1939
     } catch (CryptoException\IOException $ex) {
1940
-        error_log('TEAMPASS-Error-General: ' . $ex->getMessage());
1940
+        error_log('TEAMPASS-Error-General: '.$ex->getMessage());
1941 1941
         $err = 'general_error';
1942 1942
     }
1943 1943
 
@@ -1970,10 +1970,10 @@  discard block
 block discarded – undo
1970 1970
     } catch (CryptoException\WrongKeyOrModifiedCiphertextException $ex) {
1971 1971
         $err = 'wrong_key';
1972 1972
     } catch (CryptoException\EnvironmentIsBrokenException $ex) {
1973
-        error_log('TEAMPASS-Error-Environment: ' . $ex->getMessage());
1973
+        error_log('TEAMPASS-Error-Environment: '.$ex->getMessage());
1974 1974
         $err = 'environment_error';
1975 1975
     } catch (CryptoException\IOException $ex) {
1976
-        error_log('TEAMPASS-Error-General: ' . $ex->getMessage());
1976
+        error_log('TEAMPASS-Error-General: '.$ex->getMessage());
1977 1977
         $err = 'general_error';
1978 1978
     }
1979 1979
 
@@ -2059,7 +2059,7 @@  discard block
 block discarded – undo
2059 2059
 ) {
2060 2060
     // Check if the path exists
2061 2061
     $path = basename($path);
2062
-    if (! file_exists($path)) {
2062
+    if (!file_exists($path)) {
2063 2063
         return false;
2064 2064
     }
2065 2065
 
@@ -2112,7 +2112,7 @@  discard block
 block discarded – undo
2112 2112
     // Load item data
2113 2113
     $data = DB::queryFirstRow(
2114 2114
         'SELECT id_tree
2115
-        FROM ' . prefixTable('items') . '
2115
+        FROM ' . prefixTable('items').'
2116 2116
         WHERE id = %i',
2117 2117
         $item_id
2118 2118
     );
@@ -2175,7 +2175,7 @@  discard block
 block discarded – undo
2175 2175
         }
2176 2176
         $host .= substr(explode(".", $email[1])[0], -1, 1);
2177 2177
     }
2178
-    $email = $name . "@" . $host . "." . explode(".", $email[1])[1];
2178
+    $email = $name."@".$host.".".explode(".", $email[1])[1];
2179 2179
     return $email;
2180 2180
 }
2181 2181
 
@@ -2206,11 +2206,11 @@  discard block
 block discarded – undo
2206 2206
 function formatSizeUnits(int $bytes): string
2207 2207
 {
2208 2208
     if ($bytes >= 1073741824) {
2209
-        $bytes = number_format($bytes / 1073741824, 2) . ' GB';
2209
+        $bytes = number_format($bytes / 1073741824, 2).' GB';
2210 2210
     } elseif ($bytes >= 1048576) {
2211
-        $bytes = number_format($bytes / 1048576, 2) . ' MB';
2211
+        $bytes = number_format($bytes / 1048576, 2).' MB';
2212 2212
     } elseif ($bytes >= 1024) {
2213
-        $bytes = number_format($bytes / 1024, 2) . ' KB';
2213
+        $bytes = number_format($bytes / 1024, 2).' KB';
2214 2214
     } elseif ($bytes > 1) {
2215 2215
         $bytes .= ' bytes';
2216 2216
     } elseif ($bytes === 1) {
@@ -2456,7 +2456,7 @@  discard block
 block discarded – undo
2456 2456
     $cipher->enableContinuousBuffer();
2457 2457
 
2458 2458
     // Encrypt the file content
2459
-    $filePath = filter_var($fileInPath . '/' . $fileInName, FILTER_SANITIZE_URL);
2459
+    $filePath = filter_var($fileInPath.'/'.$fileInName, FILTER_SANITIZE_URL);
2460 2460
     $fileContent = file_get_contents($filePath);
2461 2461
     $plaintext = $fileContent;
2462 2462
     $ciphertext = $cipher->encrypt($plaintext);
@@ -2464,9 +2464,9 @@  discard block
 block discarded – undo
2464 2464
     // Save new file
2465 2465
     // deepcode ignore InsecureHash: is simply used to get a unique name
2466 2466
     $hash = md5($plaintext);
2467
-    $fileOut = $fileInPath . '/' . TP_FILE_PREFIX . $hash;
2467
+    $fileOut = $fileInPath.'/'.TP_FILE_PREFIX.$hash;
2468 2468
     file_put_contents($fileOut, $ciphertext);
2469
-    unlink($fileInPath . '/' . $fileInName);
2469
+    unlink($fileInPath.'/'.$fileInName);
2470 2470
     return [
2471 2471
         'fileHash' => base64_encode($hash),
2472 2472
         'objectKey' => base64_encode($objectKey),
@@ -2482,9 +2482,9 @@  discard block
 block discarded – undo
2482 2482
  *
2483 2483
  * @return string|array
2484 2484
  */
2485
-function decryptFile(string $fileName, string $filePath, string $key): string|array
2485
+function decryptFile(string $fileName, string $filePath, string $key): string | array
2486 2486
 {
2487
-    if (! defined('FILE_BUFFER_SIZE')) {
2487
+    if (!defined('FILE_BUFFER_SIZE')) {
2488 2488
         define('FILE_BUFFER_SIZE', 128 * 1024);
2489 2489
     }
2490 2490
     
@@ -2501,7 +2501,7 @@  discard block
 block discarded – undo
2501 2501
     $cipher->enableContinuousBuffer();
2502 2502
     $cipher->disablePadding();
2503 2503
     // Get file content
2504
-    $safeFilePath = realpath($filePath . '/' . TP_FILE_PREFIX . $safeFileName);
2504
+    $safeFilePath = realpath($filePath.'/'.TP_FILE_PREFIX.$safeFileName);
2505 2505
     if ($safeFilePath !== false && file_exists($safeFilePath)) {
2506 2506
         $ciphertext = file_get_contents(filter_var($safeFilePath, FILTER_SANITIZE_URL));
2507 2507
     } else {
@@ -2597,7 +2597,7 @@  discard block
 block discarded – undo
2597 2597
         // Only create the sharekey for a user
2598 2598
         $user = DB::queryFirstRow(
2599 2599
             'SELECT public_key
2600
-            FROM ' . prefixTable('users') . '
2600
+            FROM ' . prefixTable('users').'
2601 2601
             WHERE id = %i
2602 2602
             AND public_key != ""',
2603 2603
             $userId
@@ -2638,7 +2638,7 @@  discard block
 block discarded – undo
2638 2638
         }
2639 2639
         $users = DB::query(
2640 2640
             'SELECT id, public_key
2641
-            FROM ' . prefixTable('users') . '
2641
+            FROM ' . prefixTable('users').'
2642 2642
             WHERE id NOT IN %li
2643 2643
             AND public_key != ""',
2644 2644
             $user_ids
@@ -2647,7 +2647,7 @@  discard block
 block discarded – undo
2647 2647
         foreach ($users as $user) {
2648 2648
             // Insert in DB the new object key for this item by user
2649 2649
             if (count($objectKeyArray) === 0) {
2650
-                if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case1 - ' . $object_name . ' - ' . $post_object_id . ' - ' . $user['id'] . ' - ' . $objectKey);
2650
+                if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case1 - '.$object_name.' - '.$post_object_id.' - '.$user['id'].' - '.$objectKey);
2651 2651
                 DB::insert(
2652 2652
                     $object_name,
2653 2653
                     [
@@ -2661,7 +2661,7 @@  discard block
 block discarded – undo
2661 2661
                 );
2662 2662
             } else {
2663 2663
                 foreach ($objectKeyArray as $object) {
2664
-                    if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case2 - ' . $object_name . ' - ' . $object['objectId'] . ' - ' . $user['id'] . ' - ' . $object['objectKey']);
2664
+                    if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case2 - '.$object_name.' - '.$object['objectId'].' - '.$user['id'].' - '.$object['objectKey']);
2665 2665
                     DB::insert(
2666 2666
                         $object_name,
2667 2667
                         [
@@ -2689,7 +2689,7 @@  discard block
 block discarded – undo
2689 2689
 function isBase64(string $str): bool
2690 2690
 {
2691 2691
     $str = (string) trim($str);
2692
-    if (! isset($str[0])) {
2692
+    if (!isset($str[0])) {
2693 2693
         return false;
2694 2694
     }
2695 2695
 
@@ -2763,7 +2763,7 @@  discard block
 block discarded – undo
2763 2763
     } catch (\LdapRecord\Auth\BindException $e) {
2764 2764
         $error = $e->getDetailedError();
2765 2765
         if ($error && defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) {
2766
-            error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage(). " - ".$error->getDiagnosticMessage());
2766
+            error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage()." - ".$error->getDiagnosticMessage());
2767 2767
         }
2768 2768
         // deepcode ignore ServerLeak: No important data is sent
2769 2769
         echo 'An error occurred.';
@@ -2780,7 +2780,7 @@  discard block
 block discarded – undo
2780 2780
     } catch (\LdapRecord\Auth\BindException $e) {
2781 2781
         $error = $e->getDetailedError();
2782 2782
         if ($error && defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) {
2783
-            error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage(). " - ".$error->getDiagnosticMessage());
2783
+            error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage()." - ".$error->getDiagnosticMessage());
2784 2784
         }
2785 2785
         // deepcode ignore ServerLeak: No important data is sent
2786 2786
         echo 'An error occurred.';
@@ -2807,7 +2807,7 @@  discard block
 block discarded – undo
2807 2807
     // expect if personal item
2808 2808
     DB::delete(
2809 2809
         prefixTable('sharekeys_items'),
2810
-        'user_id = %i AND object_id NOT IN (SELECT i.id FROM ' . prefixTable('items') . ' AS i WHERE i.perso = 1)',
2810
+        'user_id = %i AND object_id NOT IN (SELECT i.id FROM '.prefixTable('items').' AS i WHERE i.perso = 1)',
2811 2811
         $userId
2812 2812
     );
2813 2813
     // Remove all item sharekeys files
@@ -2815,8 +2815,8 @@  discard block
 block discarded – undo
2815 2815
         prefixTable('sharekeys_files'),
2816 2816
         'user_id = %i AND object_id NOT IN (
2817 2817
             SELECT f.id 
2818
-            FROM ' . prefixTable('items') . ' AS i 
2819
-            INNER JOIN ' . prefixTable('files') . ' AS f ON f.id_item = i.id
2818
+            FROM ' . prefixTable('items').' AS i 
2819
+            INNER JOIN ' . prefixTable('files').' AS f ON f.id_item = i.id
2820 2820
             WHERE i.perso = 1
2821 2821
         )',
2822 2822
         $userId
@@ -2826,8 +2826,8 @@  discard block
 block discarded – undo
2826 2826
         prefixTable('sharekeys_fields'),
2827 2827
         'user_id = %i AND object_id NOT IN (
2828 2828
             SELECT c.id 
2829
-            FROM ' . prefixTable('items') . ' AS i 
2830
-            INNER JOIN ' . prefixTable('categories_items') . ' AS c ON c.item_id = i.id
2829
+            FROM ' . prefixTable('items').' AS i 
2830
+            INNER JOIN ' . prefixTable('categories_items').' AS c ON c.item_id = i.id
2831 2831
             WHERE i.perso = 1
2832 2832
         )',
2833 2833
         $userId
@@ -2835,13 +2835,13 @@  discard block
 block discarded – undo
2835 2835
     // Remove all item sharekeys logs
2836 2836
     DB::delete(
2837 2837
         prefixTable('sharekeys_logs'),
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
     // Remove all item sharekeys suggestions
2842 2842
     DB::delete(
2843 2843
         prefixTable('sharekeys_suggestions'),
2844
-        'user_id = %i AND object_id NOT IN (SELECT i.id FROM ' . prefixTable('items') . ' AS i WHERE i.perso = 1)',
2844
+        'user_id = %i AND object_id NOT IN (SELECT i.id FROM '.prefixTable('items').' AS i WHERE i.perso = 1)',
2845 2845
         $userId
2846 2846
     );
2847 2847
     return false;
@@ -2862,7 +2862,7 @@  discard block
 block discarded – undo
2862 2862
         foreach (DateTimeZone::listIdentifiers() as $timezone) {
2863 2863
             $now->setTimezone(new DateTimeZone($timezone));
2864 2864
             $offsets[] = $offset = $now->getOffset();
2865
-            $timezones[$timezone] = '(' . format_GMT_offset($offset) . ') ' . format_timezone_name($timezone);
2865
+            $timezones[$timezone] = '('.format_GMT_offset($offset).') '.format_timezone_name($timezone);
2866 2866
         }
2867 2867
 
2868 2868
         array_multisort($offsets, $timezones);
@@ -2882,7 +2882,7 @@  discard block
 block discarded – undo
2882 2882
 {
2883 2883
     $hours = intval($offset / 3600);
2884 2884
     $minutes = abs(intval($offset % 3600 / 60));
2885
-    return 'GMT' . ($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
2885
+    return 'GMT'.($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
2886 2886
 }
2887 2887
 
2888 2888
 /**
@@ -2982,8 +2982,7 @@  discard block
 block discarded – undo
2982 2982
 {
2983 2983
     if (isset($array[$key]) === true
2984 2984
         && (is_int($value) === true ?
2985
-            (int) $array[$key] === $value :
2986
-            (string) $array[$key] === $value)
2985
+            (int) $array[$key] === $value : (string) $array[$key] === $value)
2987 2986
     ) {
2988 2987
         return true;
2989 2988
     }
@@ -3005,8 +3004,7 @@  discard block
 block discarded – undo
3005 3004
 {
3006 3005
     if (isset($var) === false
3007 3006
         || (is_int($value) === true ?
3008
-            (int) $var === $value :
3009
-            (string) $var === $value)
3007
+            (int) $var === $value : (string) $var === $value)
3010 3008
     ) {
3011 3009
         return true;
3012 3010
     }
@@ -3057,7 +3055,7 @@  discard block
 block discarded – undo
3057 3055
  */
3058 3056
 function isSetArrayOfValues(array $arrayOfValues): bool
3059 3057
 {
3060
-    foreach($arrayOfValues as $value) {
3058
+    foreach ($arrayOfValues as $value) {
3061 3059
         if (isset($value) === false) {
3062 3060
             return false;
3063 3061
         }
@@ -3079,7 +3077,7 @@  discard block
 block discarded – undo
3079 3077
     /*PHP8 - integer|string*/$value
3080 3078
 ) : bool
3081 3079
 {
3082
-    foreach($arrayOfVars as $variable) {
3080
+    foreach ($arrayOfVars as $variable) {
3083 3081
         if ($variable !== $value) {
3084 3082
             return false;
3085 3083
         }
@@ -3099,7 +3097,7 @@  discard block
 block discarded – undo
3099 3097
     /*PHP8 - integer|string*/$value
3100 3098
 ) : bool
3101 3099
 {
3102
-    foreach($arrayOfVars as $variable) {
3100
+    foreach ($arrayOfVars as $variable) {
3103 3101
         if ($variable === $value) {
3104 3102
             return true;
3105 3103
         }
@@ -3168,7 +3166,7 @@  discard block
 block discarded – undo
3168 3166
  * @param array     $filters
3169 3167
  * @return array|string
3170 3168
  */
3171
-function dataSanitizer(array $data, array $filters): array|string
3169
+function dataSanitizer(array $data, array $filters): array | string
3172 3170
 {
3173 3171
     // Load Sanitizer library
3174 3172
     $sanitizer = new Sanitizer($data, $filters);
@@ -3197,7 +3195,7 @@  discard block
 block discarded – undo
3197 3195
     // Exists ?
3198 3196
     $userCacheId = DB::queryfirstrow(
3199 3197
         'SELECT increment_id
3200
-        FROM ' . prefixTable('cache_tree') . '
3198
+        FROM ' . prefixTable('cache_tree').'
3201 3199
         WHERE user_id = %i',
3202 3200
         $user_id
3203 3201
     );
@@ -3248,7 +3246,7 @@  discard block
 block discarded – undo
3248 3246
  */
3249 3247
 function pourcentage(float $nombre, float $total, float $pourcentage): float
3250 3248
 { 
3251
-    $resultat = ($nombre/$total) * $pourcentage;
3249
+    $resultat = ($nombre / $total) * $pourcentage;
3252 3250
     return round($resultat);
3253 3251
 }
3254 3252
 
@@ -3278,7 +3276,7 @@  discard block
 block discarded – undo
3278 3276
 
3279 3277
     // Get last folder update
3280 3278
     $lastFolderChange = DB::queryfirstrow(
3281
-        'SELECT valeur FROM ' . prefixTable('misc') . '
3279
+        'SELECT valeur FROM '.prefixTable('misc').'
3282 3280
         WHERE type = %s AND intitule = %s',
3283 3281
         'timestamp',
3284 3282
         'last_folder_change'
@@ -3309,7 +3307,7 @@  discard block
 block discarded – undo
3309 3307
     // Does this user has a tree cache
3310 3308
     $userCacheTree = DB::queryfirstrow(
3311 3309
         'SELECT '.$fieldName.'
3312
-        FROM ' . prefixTable('cache_tree') . '
3310
+        FROM ' . prefixTable('cache_tree').'
3313 3311
         WHERE user_id = %i',
3314 3312
         $session->get('user-id')
3315 3313
     );
@@ -3352,7 +3350,7 @@  discard block
 block discarded – undo
3352 3350
     if (count($folderIds) === 0) {
3353 3351
         $folderIds = DB::queryFirstColumn(
3354 3352
             'SELECT id
3355
-            FROM ' . prefixTable('nested_tree') . '
3353
+            FROM ' . prefixTable('nested_tree').'
3356 3354
             WHERE personal_folder=%i',
3357 3355
             0
3358 3356
         );
@@ -3369,8 +3367,8 @@  discard block
 block discarded – undo
3369 3367
         $rows_tmp = DB::query(
3370 3368
             'SELECT c.id, c.title, c.level, c.type, c.masked, c.order, c.encrypted_data, c.role_visibility, c.is_mandatory,
3371 3369
             f.id_category AS category_id
3372
-            FROM ' . prefixTable('categories_folders') . ' AS f
3373
-            INNER JOIN ' . prefixTable('categories') . ' AS c ON (f.id_category = c.parent_id)
3370
+            FROM ' . prefixTable('categories_folders').' AS f
3371
+            INNER JOIN ' . prefixTable('categories').' AS c ON (f.id_category = c.parent_id)
3374 3372
             WHERE id_folder=%i',
3375 3373
             $folder
3376 3374
         );
@@ -3396,7 +3394,7 @@  discard block
 block discarded – undo
3396 3394
         $valTemp = '';
3397 3395
         $data = DB::queryFirstRow(
3398 3396
             'SELECT valeur
3399
-            FROM ' . prefixTable('misc') . '
3397
+            FROM ' . prefixTable('misc').'
3400 3398
             WHERE type = %s AND intitule=%i',
3401 3399
             'complex',
3402 3400
             $folder
@@ -3413,14 +3411,14 @@  discard block
 block discarded – undo
3413 3411
         $valTemp = '';
3414 3412
         $rows_tmp = DB::query(
3415 3413
             'SELECT t.title
3416
-            FROM ' . prefixTable('roles_values') . ' as v
3417
-            INNER JOIN ' . prefixTable('roles_title') . ' as t ON (v.role_id = t.id)
3414
+            FROM ' . prefixTable('roles_values').' as v
3415
+            INNER JOIN ' . prefixTable('roles_title').' as t ON (v.role_id = t.id)
3418 3416
             WHERE v.folder_id = %i
3419 3417
             GROUP BY title',
3420 3418
             $folder
3421 3419
         );
3422 3420
         foreach ($rows_tmp as $record) {
3423
-            $valTemp .= (empty($valTemp) === true ? '' : ' - ') . $record['title'];
3421
+            $valTemp .= (empty($valTemp) === true ? '' : ' - ').$record['title'];
3424 3422
         }
3425 3423
         $arr_data['visibilityRoles'] = $valTemp;
3426 3424
 
@@ -3453,7 +3451,7 @@  discard block
 block discarded – undo
3453 3451
         // loop on users and check if user has this role
3454 3452
         $rows = DB::query(
3455 3453
             'SELECT id, fonction_id
3456
-            FROM ' . prefixTable('users') . '
3454
+            FROM ' . prefixTable('users').'
3457 3455
             WHERE id != %i AND admin = 0 AND fonction_id IS NOT NULL AND fonction_id != ""',
3458 3456
             $session->get('user-id')
3459 3457
         );
@@ -3485,7 +3483,7 @@  discard block
 block discarded – undo
3485 3483
 
3486 3484
     $val = DB::queryfirstrow(
3487 3485
         'SELECT *
3488
-        FROM ' . prefixTable('users') . '
3486
+        FROM ' . prefixTable('users').'
3489 3487
         WHERE id = %i',
3490 3488
         $userId
3491 3489
     );
@@ -3501,12 +3499,12 @@  discard block
 block discarded – undo
3501 3499
 function upgradeRequired(): bool
3502 3500
 {
3503 3501
     // Get settings.php
3504
-    include_once __DIR__. '/../includes/config/settings.php';
3502
+    include_once __DIR__.'/../includes/config/settings.php';
3505 3503
 
3506 3504
     // Get timestamp in DB
3507 3505
     $val = DB::queryfirstrow(
3508 3506
         'SELECT valeur
3509
-        FROM ' . prefixTable('misc') . '
3507
+        FROM ' . prefixTable('misc').'
3510 3508
         WHERE type = %s AND intitule = %s',
3511 3509
         'admin',
3512 3510
         'upgrade_timestamp'
@@ -3557,7 +3555,7 @@  discard block
 block discarded – undo
3557 3555
     // prepapre background tasks for item keys generation        
3558 3556
     $userTP = DB::queryFirstRow(
3559 3557
         'SELECT pw, public_key, private_key
3560
-        FROM ' . prefixTable('users') . '
3558
+        FROM ' . prefixTable('users').'
3561 3559
         WHERE id = %i',
3562 3560
         TP_USER_ID
3563 3561
     );
@@ -3618,7 +3616,7 @@  discard block
 block discarded – undo
3618 3616
     }
3619 3617
 
3620 3618
     // Generate new keys
3621
-    if ($user_self_change === true && empty($recovery_public_key) === false && empty($recovery_private_key) === false){
3619
+    if ($user_self_change === true && empty($recovery_public_key) === false && empty($recovery_private_key) === false) {
3622 3620
         $userKeys = [
3623 3621
             'public_key' => $recovery_public_key,
3624 3622
             'private_key_clear' => $recovery_private_key,
@@ -3661,8 +3659,8 @@  discard block
 block discarded – undo
3661 3659
             'process_type' => 'create_user_keys',
3662 3660
             'arguments' => json_encode([
3663 3661
                 'new_user_id' => (int) $userId,
3664
-                'new_user_pwd' => cryption($passwordClear, '','encrypt')['string'],
3665
-                'new_user_code' => cryption(empty($encryptionKey) === true ? uniqidReal(20) : $encryptionKey, '','encrypt')['string'],
3662
+                'new_user_pwd' => cryption($passwordClear, '', 'encrypt')['string'],
3663
+                'new_user_code' => cryption(empty($encryptionKey) === true ? uniqidReal(20) : $encryptionKey, '', 'encrypt')['string'],
3666 3664
                 'owner_id' => (int) TP_USER_ID,
3667 3665
                 'creator_pwd' => $userTP['pw'],
3668 3666
                 'send_email' => $sendEmailToUser === true ? 1 : 0,
@@ -3952,7 +3950,7 @@  discard block
 block discarded – undo
3952 3950
  */
3953 3951
 function createTaskForItem(
3954 3952
     string $processType,
3955
-    string|array $taskName,
3953
+    string | array $taskName,
3956 3954
     int $itemId,
3957 3955
     int $userId,
3958 3956
     string $objectKey,
@@ -3976,7 +3974,7 @@  discard block
 block discarded – undo
3976 3974
                 'object_key' => $objectKey,
3977 3975
                 'author' => (int) $userId,
3978 3976
             ]),
3979
-            'item_id' => (int) $parentId !== -1 ?  $parentId : null,
3977
+            'item_id' => (int) $parentId !== -1 ? $parentId : null,
3980 3978
         )
3981 3979
     );
3982 3980
     $processId = DB::insertId();
@@ -3986,7 +3984,7 @@  discard block
 block discarded – undo
3986 3984
     if (is_array($taskName) === false) {
3987 3985
         $taskName = [$taskName];
3988 3986
     }
3989
-    foreach($taskName as $task) {
3987
+    foreach ($taskName as $task) {
3990 3988
         if (WIP === true) error_log('createTaskForItem - task: '.$task);
3991 3989
         switch ($task) {
3992 3990
             case 'item_password':
@@ -4083,7 +4081,7 @@  discard block
 block discarded – undo
4083 4081
  * @param integer $user_id
4084 4082
  * @return void
4085 4083
  */
4086
-function purgeUnnecessaryKeys(bool $allUsers = true, int $user_id=0)
4084
+function purgeUnnecessaryKeys(bool $allUsers = true, int $user_id = 0)
4087 4085
 {
4088 4086
     if ($allUsers === true) {
4089 4087
         // Load class DB
@@ -4093,7 +4091,7 @@  discard block
 block discarded – undo
4093 4091
 
4094 4092
         $users = DB::query(
4095 4093
             'SELECT id
4096
-            FROM ' . prefixTable('users') . '
4094
+            FROM ' . prefixTable('users').'
4097 4095
             WHERE id NOT IN ('.OTV_USER_ID.', '.TP_USER_ID.', '.SSH_USER_ID.', '.API_USER_ID.')
4098 4096
             ORDER BY login ASC'
4099 4097
         );
@@ -4111,7 +4109,7 @@  discard block
 block discarded – undo
4111 4109
  * @param integer $user_id
4112 4110
  * @return void
4113 4111
  */
4114
-function purgeUnnecessaryKeysForUser(int $user_id=0)
4112
+function purgeUnnecessaryKeysForUser(int $user_id = 0)
4115 4113
 {
4116 4114
     if ($user_id === 0) {
4117 4115
         return;
@@ -4122,8 +4120,8 @@  discard block
 block discarded – undo
4122 4120
 
4123 4121
     $personalItems = DB::queryFirstColumn(
4124 4122
         'SELECT id
4125
-        FROM ' . prefixTable('items') . ' AS i
4126
-        INNER JOIN ' . prefixTable('log_items') . ' AS li ON li.id_item = i.id
4123
+        FROM ' . prefixTable('items').' AS i
4124
+        INNER JOIN ' . prefixTable('log_items').' AS li ON li.id_item = i.id
4127 4125
         WHERE i.perso = 1 AND li.action = "at_creation" AND li.id_user IN (%i, '.TP_USER_ID.')',
4128 4126
         $user_id
4129 4127
     );
@@ -4172,7 +4170,7 @@  discard block
 block discarded – undo
4172 4170
     // Check if user exists
4173 4171
     $userInfo = DB::queryFirstRow(
4174 4172
         'SELECT login
4175
-        FROM ' . prefixTable('users') . '
4173
+        FROM ' . prefixTable('users').'
4176 4174
         WHERE id = %i',
4177 4175
         $userId
4178 4176
     );
@@ -4181,7 +4179,7 @@  discard block
 block discarded – undo
4181 4179
         $now = (int) time();
4182 4180
         // Prepare file content
4183 4181
         $export_value = file_get_contents(__DIR__."/../includes/core/teampass_ascii.txt")."\n".
4184
-            "Generation date: ".date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], $now)."\n\n".
4182
+            "Generation date: ".date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], $now)."\n\n".
4185 4183
             "RECOVERY KEYS - Not to be shared - To be store safely\n\n".
4186 4184
             "Public Key:\n".$session->get('user-public_key')."\n\n".
4187 4185
             "Private Key:\n".$session->get('user-private_key')."\n\n";
@@ -4204,7 +4202,7 @@  discard block
 block discarded – undo
4204 4202
         return prepareExchangedData(
4205 4203
             array(
4206 4204
                 'error' => false,
4207
-                'datetime' => date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], $now),
4205
+                'datetime' => date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], $now),
4208 4206
                 'timestamp' => $now,
4209 4207
                 'content' => base64_encode($export_value),
4210 4208
                 'login' => $userInfo['login'],
@@ -4230,8 +4228,8 @@  discard block
 block discarded – undo
4230 4228
  */
4231 4229
 function loadClasses(string $className = ''): void
4232 4230
 {
4233
-    require_once __DIR__. '/../includes/config/include.php';
4234
-    require_once __DIR__. '/../includes/config/settings.php';
4231
+    require_once __DIR__.'/../includes/config/include.php';
4232
+    require_once __DIR__.'/../includes/config/settings.php';
4235 4233
     require_once __DIR__.'/../vendor/autoload.php';
4236 4234
 
4237 4235
     if (defined('DB_PASSWD_CLEAR') === false) {
@@ -4442,7 +4440,7 @@  discard block
 block discarded – undo
4442 4440
 
4443 4441
     // Get current user hash
4444 4442
     $userHash = DB::queryFirstRow(
4445
-        "SELECT pw FROM " . prefixtable('users') . " WHERE id = %d;",
4443
+        "SELECT pw FROM ".prefixtable('users')." WHERE id = %d;",
4446 4444
         $session->get('user-id')
4447 4445
     )['pw'];
4448 4446
 
Please login to merge, or discard this patch.
Braces   +24 added lines, -11 removed lines patch added patch discarded remove patch
@@ -2366,7 +2366,9 @@  discard block
 block discarded – undo
2366 2366
 function encryptUserObjectKey(string $key, string $publicKey): string
2367 2367
 {
2368 2368
     // Empty password
2369
-    if (empty($key)) return '';
2369
+    if (empty($key)) {
2370
+        return '';
2371
+    }
2370 2372
 
2371 2373
     // Sanitize
2372 2374
     $antiXss = new AntiXSS();
@@ -2515,7 +2517,9 @@  discard block
 block discarded – undo
2515 2517
         ];
2516 2518
     }
2517 2519
 
2518
-    if (WIP) error_log('DEBUG: File image url -> '.filter_var($safeFilePath, FILTER_SANITIZE_URL));
2520
+    if (WIP) {
2521
+        error_log('DEBUG: File image url -> '.filter_var($safeFilePath, FILTER_SANITIZE_URL));
2522
+    }
2519 2523
 
2520 2524
     // Decrypt file content and return
2521 2525
     return base64_encode($cipher->decrypt($ciphertext));
@@ -2650,7 +2654,9 @@  discard block
 block discarded – undo
2650 2654
         foreach ($users as $user) {
2651 2655
             // Insert in DB the new object key for this item by user
2652 2656
             if (count($objectKeyArray) === 0) {
2653
-                if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case1 - ' . $object_name . ' - ' . $post_object_id . ' - ' . $user['id'] . ' - ' . $objectKey);
2657
+                if (WIP === true) {
2658
+                    error_log('TEAMPASS Debug - storeUsersShareKey case1 - ' . $object_name . ' - ' . $post_object_id . ' - ' . $user['id'] . ' - ' . $objectKey);
2659
+                }
2654 2660
                 DB::insert(
2655 2661
                     $object_name,
2656 2662
                     [
@@ -2664,7 +2670,9 @@  discard block
 block discarded – undo
2664 2670
                 );
2665 2671
             } else {
2666 2672
                 foreach ($objectKeyArray as $object) {
2667
-                    if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case2 - ' . $object_name . ' - ' . $object['objectId'] . ' - ' . $user['id'] . ' - ' . $object['objectKey']);
2673
+                    if (WIP === true) {
2674
+                        error_log('TEAMPASS Debug - storeUsersShareKey case2 - ' . $object_name . ' - ' . $object['objectId'] . ' - ' . $user['id'] . ' - ' . $object['objectKey']);
2675
+                    }
2668 2676
                     DB::insert(
2669 2677
                         $object_name,
2670 2678
                         [
@@ -3990,7 +3998,9 @@  discard block
 block discarded – undo
3990 3998
         $taskName = [$taskName];
3991 3999
     }
3992 4000
     foreach($taskName as $task) {
3993
-        if (WIP === true) error_log('createTaskForItem - task: '.$task);
4001
+        if (WIP === true) {
4002
+            error_log('createTaskForItem - task: '.$task);
4003
+        }
3994 4004
         switch ($task) {
3995 4005
             case 'item_password':
3996 4006
                 
@@ -4421,19 +4431,22 @@  discard block
 block discarded – undo
4421 4431
 
4422 4432
             // Organisation name (removed username@ and .tld)
4423 4433
             $domain = explode('.', $emailParts[1]);
4424
-            if (count($domain) > 1)
4425
-                $forbiddenWords[] = $domain[0];
4434
+            if (count($domain) > 1) {
4435
+                            $forbiddenWords[] = $domain[0];
4436
+            }
4426 4437
         }
4427 4438
     }
4428 4439
 
4429 4440
     // Search forbidden words in password
4430 4441
     foreach ($forbiddenWords as $word) {
4431
-        if (empty($word))
4432
-            continue;
4442
+        if (empty($word)) {
4443
+                    continue;
4444
+        }
4433 4445
 
4434 4446
         // Stop if forbidden word found in password
4435
-        if (stripos($password, $word) !== false)
4436
-            return false;
4447
+        if (stripos($password, $word) !== false) {
4448
+                    return false;
4449
+        }
4437 4450
     }
4438 4451
 
4439 4452
     // Get password complexity
Please login to merge, or discard this patch.
sources/expired.datatables.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 ) {
74 74
     // Not allowed page
75 75
     $session->set('system-error_code', ERR_NOT_ALLOWED);
76
-    include $SETTINGS['cpassman_dir'] . '/error.php';
76
+    include $SETTINGS['cpassman_dir'].'/error.php';
77 77
     exit;
78 78
 }
79 79
 
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 // Is a date sent?
99 99
 $dateCriteria = $request->query->get('dateCriteria');
100 100
 if ($dateCriteria !== null && !empty($dateCriteria)) {
101
-    $sWhere .= ' AND a.del_value < ' . round(filter_var($dateCriteria, FILTER_SANITIZE_NUMBER_INT) / 1000, 0);
101
+    $sWhere .= ' AND a.del_value < '.round(filter_var($dateCriteria, FILTER_SANITIZE_NUMBER_INT) / 1000, 0);
102 102
 }
103 103
 //echo $sWhere;
104 104
 /* BUILD QUERY */
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 $start = $request->query->getInt('start', 0);
108 108
 $length = $request->query->getInt('length', -1);
109 109
 if ($length !== -1) {
110
-    $sLimit = ' LIMIT ' . $start . ', ' . $length;
110
+    $sLimit = ' LIMIT '.$start.', '.$length;
111 111
 }
112 112
 
113 113
 //Ordering
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
         $columnIndex = filter_var($order[0]['column'], FILTER_SANITIZE_NUMBER_INT);
121 121
 
122 122
         if (array_key_exists($columnIndex, $aColumns)) {
123
-            $sOrder .= $aColumns[$columnIndex] . ' ' . $order[0]['dir'];
123
+            $sOrder .= $aColumns[$columnIndex].' '.$order[0]['dir'];
124 124
         }
125 125
 
126 126
         // Supprimez la virgule finale si elle existe
@@ -144,9 +144,9 @@  discard block
 block discarded – undo
144 144
 
145 145
     if ($letter !== '' && $letter !== 'None') {
146 146
         $sWhere .= ' AND ';
147
-        $sWhere .= $aColumns[1] . " LIKE '" . $letter . "%' OR ";
148
-        $sWhere .= $aColumns[2] . " LIKE '" . $letter . "%' OR ";
149
-        $sWhere .= $aColumns[3] . " LIKE '" . $letter . "%' ";
147
+        $sWhere .= $aColumns[1]." LIKE '".$letter."%' OR ";
148
+        $sWhere .= $aColumns[2]." LIKE '".$letter."%' OR ";
149
+        $sWhere .= $aColumns[3]." LIKE '".$letter."%' ";
150 150
     }
151 151
 }
152 152
 
@@ -157,26 +157,26 @@  discard block
 block discarded – undo
157 157
 
158 158
         if ($searchValue !== '') {
159 159
             $sWhere = ' AND ';
160
-            $sWhere .= $aColumns[1] . " LIKE '" . $searchValue . "%' OR ";
161
-            $sWhere .= $aColumns[2] . " LIKE '" . $searchValue . "%' OR ";
162
-            $sWhere .= $aColumns[3] . " LIKE '" . $searchValue . "%' ";
160
+            $sWhere .= $aColumns[1]." LIKE '".$searchValue."%' OR ";
161
+            $sWhere .= $aColumns[2]." LIKE '".$searchValue."%' OR ";
162
+            $sWhere .= $aColumns[3]." LIKE '".$searchValue."%' ";
163 163
         }
164 164
     }
165 165
 }
166 166
 
167 167
 $rows = DB::query(
168 168
     'SELECT a.item_id, i.label, a.del_value, i.id_tree
169
-    FROM ' . prefixTable('automatic_del') . ' AS a
170
-    INNER JOIN ' . prefixTable('items') . ' AS i ON (i.id = a.item_id)' .
169
+    FROM ' . prefixTable('automatic_del').' AS a
170
+    INNER JOIN ' . prefixTable('items').' AS i ON (i.id = a.item_id)'.
171 171
     $sWhere.
172 172
     (string) $sOrder
173 173
 );
174 174
 $iTotal = DB::count();
175 175
 $rows = DB::query(
176 176
     'SELECT a.item_id, i.label, a.del_value, i.id_tree
177
-    FROM ' . prefixTable('automatic_del') . ' AS a
178
-    INNER JOIN ' . prefixTable('items') . ' AS i ON (i.id = a.item_id)' .
179
-        $sWhere .
177
+    FROM ' . prefixTable('automatic_del').' AS a
178
+    INNER JOIN ' . prefixTable('items').' AS i ON (i.id = a.item_id)'.
179
+        $sWhere.
180 180
         $sLimit
181 181
 );
182 182
 $iFilteredTotal = DB::count();
@@ -194,18 +194,18 @@  discard block
 block discarded – undo
194 194
     // start the line
195 195
     $sOutput .= '[';
196 196
     // Column 1
197
-    $sOutput .= '"<i class=\"fas fa-external-link-alt pointer text-primary mr-2\" onclick=\"showItemCard($(this))\" data-item-id=\"' . $record['item_id'] . '\"  data-item-tree-id=\"' . $record['id_tree'] . '\"></i>", ';
197
+    $sOutput .= '"<i class=\"fas fa-external-link-alt pointer text-primary mr-2\" onclick=\"showItemCard($(this))\" data-item-id=\"'.$record['item_id'].'\"  data-item-tree-id=\"'.$record['id_tree'].'\"></i>", ';
198 198
     // Column 2
199
-    $sOutput .= '"' . $record['label'] . '", ';
199
+    $sOutput .= '"'.$record['label'].'", ';
200 200
     // Column 3
201
-    $sOutput .= '"' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['del_value']) . '", ';
201
+    $sOutput .= '"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['del_value']).'", ';
202 202
     // Column 4
203 203
     $path = [];
204 204
     $treeDesc = $tree->getPath($record['id_tree'], true);
205 205
     foreach ($treeDesc as $t) {
206 206
         array_push($path, $t->title);
207 207
     }
208
-    $sOutput .= '"' . implode('<i class=\"fas fa-angle-right ml-1 mr-1\"></i>', $path) . '"],';
208
+    $sOutput .= '"'.implode('<i class=\"fas fa-angle-right ml-1 mr-1\"></i>', $path).'"],';
209 209
 }
210 210
 
211 211
 if ($iTotal > 0) {
@@ -218,4 +218,4 @@  discard block
 block discarded – undo
218 218
 }
219 219
 
220 220
 // finalize output
221
-echo '{"recordsTotal": ' . (int) $iTotal . ', "recordsFiltered": ' . (int) $iFilteredTotal . ', "data": ' . htmlspecialchars($sOutput);
221
+echo '{"recordsTotal": '.(int) $iTotal.', "recordsFiltered": '.(int) $iFilteredTotal.', "data": '.htmlspecialchars($sOutput);
Please login to merge, or discard this patch.
pages/backups.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('backups') === false) {
69 69
     // Not allowed page
70 70
     $session->set('system-error_code', ERR_NOT_ALLOWED);
71
-    include $SETTINGS['cpassman_dir'] . '/error.php';
71
+    include $SETTINGS['cpassman_dir'].'/error.php';
72 72
     exit;
73 73
 }
74 74
 
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
                                             </div>
179 179
                                             <div class="alert alert-info ml-2 mt-3 mr-2 hidden" id="onthefly-restore-progress">
180 180
                                                 <h5><i class="icon fa fa-info mr-2"></i><?php echo $lang->get('in_progress'); ?></h5>
181
-                                                <i class="mr-2 fa-solid fa-rocket fa-beat"></i><?php echo $lang->get('restore_in_progress');?> <b><span id="onthefly-restore-progress-text">0</span>%</b>
181
+                                                <i class="mr-2 fa-solid fa-rocket fa-beat"></i><?php echo $lang->get('restore_in_progress'); ?> <b><span id="onthefly-restore-progress-text">0</span>%</b>
182 182
                                             </div>
183 183
                                             <div class="row mt-3 hidden" id="onthefly-restore-finished"></div>
184 184
                                             <div class="row mt-3">
Please login to merge, or discard this patch.
includes/core/otv.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         filter_input(INPUT_GET, 'code', FILTER_SANITIZE_FULL_SPECIAL_CHARS)
87 87
     );
88 88
     
89
-    if (DB::count() > 0  && (int) $data['timestamp'] === (int) filter_input(INPUT_GET, 'stamp', FILTER_VALIDATE_INT)) {
89
+    if (DB::count() > 0 && (int) $data['timestamp'] === (int) filter_input(INPUT_GET, 'stamp', FILTER_VALIDATE_INT)) {
90 90
         // otv is too old
91 91
         if ($data['time_limit'] < time() || ($data['views'] + 1) > $data['max_views']) {
92 92
             $html = '<div class="text-center text-danger">
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
                 <tr><th>URL:</th><td>'.$url.'</td></tr>
191 191
                 </table></div>
192 192
                 <p class="mt-3 text-info"><i class="fas fa-info mr-2"></i>Copy carefully the data you need.<br>This page is visible until <b>'.
193
-                date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $dataItem['time_limit']).'</b> OR <b>'.($dataItem['max_views'] - ($dataItem['views']+1)).' more time(s)</b>.</div>
193
+                date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $dataItem['time_limit']).'</b> OR <b>'.($dataItem['max_views'] - ($dataItem['views'] + 1)).' more time(s)</b>.</div>
194 194
                 </div>';
195 195
             // log
196 196
             logItems(
Please login to merge, or discard this patch.
pages/users.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('users') === false) {
67 67
     // Not allowed page
68 68
     $session->set('system-error_code', ERR_NOT_ALLOWED);
69
-    include $SETTINGS['cpassman_dir'] . '/error.php';
69
+    include $SETTINGS['cpassman_dir'].'/error.php';
70 70
     exit;
71 71
 }
72 72
 
@@ -89,24 +89,24 @@  discard block
 block discarded – undo
89 89
 // If administrator then all roles are shown
90 90
 // else only the Roles the users is associated to.
91 91
 if ((int) $session->get('user-admin') === 1) {
92
-    $optionsManagedBy .= '<option value="0">' . $lang->get('administrators_only') . '</option>';
92
+    $optionsManagedBy .= '<option value="0">'.$lang->get('administrators_only').'</option>';
93 93
 }
94 94
 
95 95
 $rows = DB::query(
96 96
     'SELECT id, title, creator_id
97
-    FROM ' . prefixTable('roles_title') . '
97
+    FROM ' . prefixTable('roles_title').'
98 98
     ORDER BY title ASC'
99 99
 );
100 100
 foreach ($rows as $record) {
101 101
     if ((int) $session->get('user-admin') === 1 || in_array($record['id'], $session->get('user-roles_array')) === true) {
102
-        $optionsManagedBy .= '<option value="' . $record['id'] . '">' . $lang->get('managers_of') . ' ' . addslashes($record['title']) . '</option>';
102
+        $optionsManagedBy .= '<option value="'.$record['id'].'">'.$lang->get('managers_of').' '.addslashes($record['title']).'</option>';
103 103
     }
104 104
     if (
105 105
         (int) $session->get('user-admin') === 1
106 106
         || (((int) $session->get('user-manager') === 1 || (int) $session->get('user-can_manage_all_users') === 1)
107 107
             && (in_array($record['id'], $userRoles) === true) || (int) $record['creator_id'] === (int) $session->get('user-id'))
108 108
     ) {
109
-        $optionsRoles .= '<option value="' . $record['id'] . '">' . addslashes($record['title']) . '</option>';
109
+        $optionsRoles .= '<option value="'.$record['id'].'">'.addslashes($record['title']).'</option>';
110 110
     }
111 111
 }
112 112
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
         for ($y = 1; $y < $t->nlevel; ++$y) {
122 122
             $ident .= '&nbsp;&nbsp;';
123 123
         }
124
-        $foldersList .= '<option value="' . $t->id . '">' . $ident . htmlspecialchars($t->title, ENT_COMPAT, 'UTF-8') . '</option>';
124
+        $foldersList .= '<option value="'.$t->id.'">'.$ident.htmlspecialchars($t->title, ENT_COMPAT, 'UTF-8').'</option>';
125 125
     }
126 126
 }
127 127
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
                         </button><?php
159 159
                                     echo isset($SETTINGS['ldap_mode']) === true && (int) $SETTINGS['ldap_mode'] === 1 && (int) $session->get('user-admin') === 1 ?
160 160
                                         '<button type="button" class="btn btn-primary btn-sm tp-action mr-2" data-action="ldap-sync">
161
-                            <i class="fa-solid fa-address-card mr-2"></i>' . $lang->get('ldap_synchronization') . '
161
+                            <i class="fa-solid fa-address-card mr-2"></i>' . $lang->get('ldap_synchronization').'
162 162
                         </button>' : '';
163 163
                                     ?>
164 164
                     </h3>
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 
167 167
                 <!-- /.card-header -->
168 168
                 <div class="card-body form" id="users-list">
169
-                    <label><input type="checkbox" id="warnings_display" class="tp-action pointer" data-action="refresh"><span class="ml-2 pointer"><?php echo $lang->get('display_warning_icons');?></span></label>
169
+                    <label><input type="checkbox" id="warnings_display" class="tp-action pointer" data-action="refresh"><span class="ml-2 pointer"><?php echo $lang->get('display_warning_icons'); ?></span></label>
170 170
                     <table id="table-users" class="table table-striped nowrap table-responsive-sm">
171 171
                         <thead>
172 172
                             <tr>
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
                                             <?php
232 232
                                             foreach (TP_PW_COMPLEXITY as $entry) {
233 233
                                                 echo '
234
-                                            <option value="' . $entry[0] . '">' . addslashes($entry[1]) . '</option>';
234
+                                            <option value="' . $entry[0].'">'.addslashes($entry[1]).'</option>';
235 235
                                             }
236 236
                                             ?>
237 237
                                         </select>
Please login to merge, or discard this patch.
scripts/background_tasks___items_handler_subtask.php 2 patches
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -74,7 +74,9 @@  discard block
 block discarded – undo
74 74
 if ($args['step'] === 'create_users_files_key') {
75 75
     // Loop on all files for this item
76 76
     // and encrypt them for each user
77
-    if (WIP === true) provideLog('[DEBUG] '.print_r($args['files_keys'], true), $SETTINGS);
77
+    if (WIP === true) {
78
+        provideLog('[DEBUG] '.print_r($args['files_keys'], true), $SETTINGS);
79
+    }
78 80
     foreach($args['files_keys'] as $file) {
79 81
         storeUsersShareKey(
80 82
             prefixTable('sharekeys_items'),
@@ -91,7 +93,9 @@  discard block
 block discarded – undo
91 93
 } elseif ($args['step'] === 'create_users_fields_key') {
92 94
     // Loop on all encrypted fields for this item
93 95
     // and encrypt them for each user
94
-    if (WIP === true) provideLog('[DEBUG] '.print_r($args, true), $SETTINGS);
96
+    if (WIP === true) {
97
+        provideLog('[DEBUG] '.print_r($args, true), $SETTINGS);
98
+    }
95 99
     foreach($args['fields_keys'] as $field) {
96 100
         storeUsersShareKey(
97 101
             prefixTable('sharekeys_fields'),
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
 $subtask = DB::queryfirstrow(
58 58
     'SELECT *
59
-    FROM ' . prefixTable('background_subtasks') . '
59
+    FROM ' . prefixTable('background_subtasks').'
60 60
     WHERE process_id = %i AND finished_at IS NULL
61 61
     ORDER BY increment_id ASC',
62 62
     (int) $request->request->get('subTask')
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 
65 65
 list($taskArguments) = DB::queryFirstField(
66 66
     'SELECT arguments
67
-    FROM ' . prefixTable('background_tasks') . '
67
+    FROM ' . prefixTable('background_tasks').'
68 68
     WHERE increment_id = %i',
69 69
     $subtask['process_id']
70 70
 );
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
     // Loop on all files for this item
76 76
     // and encrypt them for each user
77 77
     if (WIP === true) provideLog('[DEBUG] '.print_r($args['files_keys'], true), $SETTINGS);
78
-    foreach($args['files_keys'] as $file) {
78
+    foreach ($args['files_keys'] as $file) {
79 79
         storeUsersShareKey(
80 80
             prefixTable('sharekeys_items'),
81 81
             0,
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
     // Loop on all encrypted fields for this item
93 93
     // and encrypt them for each user
94 94
     if (WIP === true) provideLog('[DEBUG] '.print_r($args, true), $SETTINGS);
95
-    foreach($args['fields_keys'] as $field) {
95
+    foreach ($args['fields_keys'] as $field) {
96 96
         storeUsersShareKey(
97 97
             prefixTable('sharekeys_fields'),
98 98
             0,
Please login to merge, or discard this patch.
sources/downloadFile.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -149,7 +149,9 @@
 block discarded – undo
149 149
     }
150 150
     $filePath = realpath($filePath);
151 151
 
152
-    if (WIP === true) error_log('downloadFile.php: filePath: ' . $filePath." - ");
152
+    if (WIP === true) {
153
+        error_log('downloadFile.php: filePath: ' . $filePath." - ");
154
+    }
153 155
 
154 156
     if ($filePath && is_readable($filePath) && strpos($filePath, realpath($SETTINGS['path_to_upload_folder'])) === 0) {
155 157
         header('Content-Description: File Transfer');
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 ) {
77 77
     // Not allowed page
78 78
     $session->set('system-error_code', ERR_NOT_ALLOWED);
79
-    include $SETTINGS['cpassman_dir'] . '/error.php';
79
+    include $SETTINGS['cpassman_dir'].'/error.php';
80 80
     exit;
81 81
 }
82 82
 
@@ -118,19 +118,19 @@  discard block
 block discarded – undo
118 118
 $get_filename = str_replace('"', '\"', $get_filename);
119 119
 
120 120
 // Use Content-Disposition header with double quotes around filename
121
-header('Content-Disposition: attachment; filename="' . rawurldecode($get_filename) . '"');
121
+header('Content-Disposition: attachment; filename="'.rawurldecode($get_filename).'"');
122 122
 header('Content-Type: application/octet-stream');
123 123
 header('Cache-Control: must-revalidate, no-cache, no-store');
124 124
 header('Expires: 0');
125 125
 if (null !== $request->query->get('pathIsFiles') && (int) $get_pathIsFiles === 1) {
126
-    readfile($SETTINGS['path_to_files_folder'] . '/' . basename($get_filename));
126
+    readfile($SETTINGS['path_to_files_folder'].'/'.basename($get_filename));
127 127
 } else {
128 128
     // get file key
129 129
     $file_info = DB::queryfirstrow(
130 130
         'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status, f.extension AS extension,
131 131
         s.share_key AS share_key
132
-        FROM ' . prefixTable('files') . ' AS f
133
-        INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id)
132
+        FROM ' . prefixTable('files').' AS f
133
+        INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id)
134 134
         WHERE s.user_id = %i AND s.object_id = %i',
135 135
         $session->get('user-id'),
136 136
         $get_fileid
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
         // if not encrypted
150 150
         $file_info = DB::queryfirstrow(
151 151
             'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status, f.extension AS extension
152
-            FROM ' . prefixTable('files') . ' AS f
152
+            FROM ' . prefixTable('files').' AS f
153 153
             WHERE f.id = %i',
154 154
             $get_fileid
155 155
         );
@@ -159,25 +159,25 @@  discard block
 block discarded – undo
159 159
     // Set the filename of the download
160 160
     $filename = basename($file_info['name'], '.'.$file_info['extension']);
161 161
     $filename = isBase64($filename) === true ? base64_decode($filename) : $filename;
162
-    $filename = $filename . '.' . $file_info['extension'];
162
+    $filename = $filename.'.'.$file_info['extension'];
163 163
     // Get the full path to the file to be downloaded
164
-    if (file_exists($SETTINGS['path_to_upload_folder'] . '/' .TP_FILE_PREFIX . $file_info['file'])) {
165
-        $filePath = $SETTINGS['path_to_upload_folder'] . '/' . TP_FILE_PREFIX . $file_info['file'];
164
+    if (file_exists($SETTINGS['path_to_upload_folder'].'/'.TP_FILE_PREFIX.$file_info['file'])) {
165
+        $filePath = $SETTINGS['path_to_upload_folder'].'/'.TP_FILE_PREFIX.$file_info['file'];
166 166
     } else {
167
-        $filePath = $SETTINGS['path_to_upload_folder'] . '/' . TP_FILE_PREFIX . base64_decode($file_info['file']);
167
+        $filePath = $SETTINGS['path_to_upload_folder'].'/'.TP_FILE_PREFIX.base64_decode($file_info['file']);
168 168
     }
169 169
     $filePath = realpath($filePath);
170 170
 
171
-    if (WIP === true) error_log('downloadFile.php: filePath: ' . $filePath." - ");
171
+    if (WIP === true) error_log('downloadFile.php: filePath: '.$filePath." - ");
172 172
 
173 173
     if ($filePath && is_readable($filePath) && strpos($filePath, realpath($SETTINGS['path_to_upload_folder'])) === 0) {
174 174
         header('Content-Description: File Transfer');
175 175
         header('Content-Type: application/octet-stream');
176
-        header('Content-Disposition: attachment; filename="' . basename($filename) . '"');
176
+        header('Content-Disposition: attachment; filename="'.basename($filename).'"');
177 177
         header('Expires: 0');
178 178
         header('Cache-Control: must-revalidate');
179 179
         header('Pragma: public');
180
-        header('Content-Length: ' . filesize($filePath));
180
+        header('Content-Length: '.filesize($filePath));
181 181
         flush(); // Clear system output buffer
182 182
         if (empty($fileContent) === true) {
183 183
             // deepcode ignore PT: File and path are secured directly inside the function decryptFile()
Please login to merge, or discard this patch.
sources/tasks.queries.php 1 patch
Spacing   +3 added lines, -3 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
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
     // get exec from processes table
164 164
     $rows = DB::query(
165 165
         'SELECT max(finished_at), process_type
166
-        FROM ' . prefixTable('background_tasks') . '
166
+        FROM ' . prefixTable('background_tasks').'
167 167
         GROUP BY process_type'
168 168
     );
169 169
     foreach ($rows as $row) {
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
     // get exec from background_tasks_log table
180 180
     $rows = DB::query(
181 181
         'SELECT MAX(finished_at) AS max_finished_at, job AS process_type 
182
-        FROM ' . prefixTable('background_tasks_logs') . '
182
+        FROM ' . prefixTable('background_tasks_logs').'
183 183
         WHERE finished_at >= UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 7 DAY))
184 184
         GROUP BY process_type'
185 185
     );
Please login to merge, or discard this patch.
sources/utilities.queries.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 ) {
80 80
     // Not allowed page
81 81
     $session->set('system-error_code', ERR_NOT_ALLOWED);
82
-    include $SETTINGS['cpassman_dir'] . '/error.php';
82
+    include $SETTINGS['cpassman_dir'].'/error.php';
83 83
     exit;
84 84
 }
85 85
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
             $arrFolders = array();
131 131
             $rows = DB::query(
132 132
                 'SELECT valeur, intitule
133
-                FROM ' . prefixTable('misc') . '
133
+                FROM ' . prefixTable('misc').'
134 134
                 WHERE type  = %s',
135 135
                 'folder_deleted'
136 136
             );
@@ -152,10 +152,10 @@  discard block
 block discarded – undo
152 152
                 'SELECT u.login as login, u.name as name, u.lastname as lastname,
153 153
                 i.id as id, i.label as label,
154 154
                 i.id_tree as id_tree, l.date as date, n.title as folder_title
155
-                FROM ' . prefixTable('log_items') . ' as l
156
-                INNER JOIN ' . prefixTable('items') . ' as i ON (l.id_item=i.id)
157
-                LEFT JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id)
158
-                LEFT JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree=n.id)
155
+                FROM ' . prefixTable('log_items').' as l
156
+                INNER JOIN ' . prefixTable('items').' as i ON (l.id_item=i.id)
157
+                LEFT JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id)
158
+                LEFT JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree=n.id)
159 159
                 WHERE i.inactif = %i
160 160
                 AND l.action = %s',
161 161
                 1,
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
                             'label' => $record['label'],
178 178
                             'date' => date($SETTINGS['date_format'], (int) $record['date']),
179 179
                             'login' => $record['login'],
180
-                            'name' => $record['name'] . ' ' . $record['lastname'],
180
+                            'name' => $record['name'].' '.$record['lastname'],
181 181
                             'folder_label' => $record['folder_title'],
182 182
                             'folder_deleted' => $thisFolder,
183 183
                         )
@@ -235,10 +235,10 @@  discard block
 block discarded – undo
235 235
             foreach ($post_folders as $folderId) {
236 236
                 $data = DB::queryfirstrow(
237 237
                     'SELECT valeur
238
-                    FROM ' . prefixTable('misc') . "
238
+                    FROM ' . prefixTable('misc')."
239 239
                     WHERE type = 'folder_deleted'
240 240
                     AND intitule = %s",
241
-                    'f' . $folderId
241
+                    'f'.$folderId
242 242
                 );
243 243
                 if ((int) $data['valeur'] !== 0) {
244 244
                     $folderData = explode(', ', $data['valeur']);
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
                         prefixTable('misc'),
266 266
                         'type = %s AND intitule = %s',
267 267
                         'folder_deleted',
268
-                        'f' . $folderId
268
+                        'f'.$folderId
269 269
                     );
270 270
 
271 271
                     // Restore all items in this folder
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
                     // Get list of all items in thos folder
282 282
                     $items = DB::query(
283 283
                         'SELECT id
284
-                        FROM ' . prefixTable('items') . '
284
+                        FROM ' . prefixTable('items').'
285 285
                         WHERE id_tree = %i',
286 286
                         $folderId
287 287
                     );
@@ -370,10 +370,10 @@  discard block
 block discarded – undo
370 370
             foreach ($post_folders as $folderId) {
371 371
                 $data = DB::queryfirstrow(
372 372
                     'SELECT valeur
373
-                    FROM ' . prefixTable('misc') . "
373
+                    FROM ' . prefixTable('misc')."
374 374
                     WHERE type = 'folder_deleted'
375 375
                     AND intitule = %s",
376
-                    'f' . $folderId
376
+                    'f'.$folderId
377 377
                 );
378 378
                 if ((int) $data['valeur'] !== 0) {
379 379
                     $exploded = explode(',', $data['valeur']);
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
                         prefixTable('misc'),
385 385
                         'type = %s AND intitule = %s',
386 386
                         'folder_deleted',
387
-                        'f' . $folderData[0]
387
+                        'f'.$folderData[0]
388 388
                     );
389 389
 
390 390
                     // Delete all items in this folder
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
                     // Get list of all items in thos folder
399 399
                     $items = DB::query(
400 400
                         'SELECT id
401
-                        FROM ' . prefixTable('items') . '
401
+                        FROM ' . prefixTable('items').'
402 402
                         WHERE id_tree = %i',
403 403
                         $folderData[0]
404 404
                     );
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
                         // Delete all fields
416 416
                         $fields = DB::query(
417 417
                             'SELECT id
418
-                            FROM ' . prefixTable('categories_items') . '
418
+                            FROM ' . prefixTable('categories_items').'
419 419
                             WHERE item_id = %i',
420 420
                             $folderData[0]
421 421
                         );
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
                         // Delete all files
436 436
                         $files = DB::query(
437 437
                             'SELECT id
438
-                            FROM ' . prefixTable('files') . '
438
+                            FROM ' . prefixTable('files').'
439 439
                             WHERE id_item = %i',
440 440
                             $folderData[0]
441 441
                         );
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
                 // Delete sharekey fields
493 493
                 $itemFields = DB::query(
494 494
                     'SELECT id
495
-                    FROM ' . prefixTable('categories_items') . '
495
+                    FROM ' . prefixTable('categories_items').'
496 496
                     WHERE item_id = %i',
497 497
                     $itemId
498 498
                 );
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
                 // Delete sharekey files
508 508
                 $itemFiles = DB::query(
509 509
                     'SELECT id
510
-                    FROM ' . prefixTable('files') . '
510
+                    FROM ' . prefixTable('files').'
511 511
                     WHERE id_item = %i',
512 512
                     $itemId
513 513
                 );
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
             ) {
585 585
                 if ($post_log_type === 'items') {
586 586
                     DB::query(
587
-                        'SELECT * FROM ' . prefixTable('log_items') . '
587
+                        'SELECT * FROM '.prefixTable('log_items').'
588 588
                         WHERE (date BETWEEN %i AND %i)'
589 589
                         . ($post_filter_action === 'all' ? '' : ' AND action = "'.$post_filter_action.'"')
590 590
                         . ((int) $post_filter_user === -1 ? '' : ' AND id_user = '.(int) $post_filter_user),
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
                 } elseif ($post_log_type === 'connections') {
605 605
                     //db::debugmode(true);
606 606
                     DB::query(
607
-                        'SELECT * FROM ' . prefixTable('log_system') . '
607
+                        'SELECT * FROM '.prefixTable('log_system').'
608 608
                         WHERE type=%s '
609 609
                         . 'AND (date BETWEEN %i AND %i)'
610 610
                         . ($post_filter_action === 'all' ? '' : ' AND action = '.$post_filter_action)
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
                     );
628 628
                 } elseif ($post_log_type === 'errors') {
629 629
                     DB::query(
630
-                        'SELECT * FROM ' . prefixTable('log_system') . ' WHERE type=%s ' .
630
+                        'SELECT * FROM '.prefixTable('log_system').' WHERE type=%s '.
631 631
                             'AND (date BETWEEN %i AND %i)',
632 632
                         'error',
633 633
                         $post_date_from,
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
                     );
645 645
                 } elseif ($post_log_type === 'copy') {
646 646
                     DB::query(
647
-                        'SELECT * FROM ' . prefixTable('log_items') . ' WHERE action=%s ' .
647
+                        'SELECT * FROM '.prefixTable('log_items').' WHERE action=%s '.
648 648
                             'AND (date BETWEEN %i AND %i)',
649 649
                         'at_copy',
650 650
                         $post_date_from,
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
                     );
662 662
                 } elseif ($post_log_type === 'admin') {
663 663
                     DB::query(
664
-                        'SELECT * FROM ' . prefixTable('log_system') . ' WHERE type=%s ' .
664
+                        'SELECT * FROM '.prefixTable('log_system').' WHERE type=%s '.
665 665
                             'AND (date BETWEEN %i AND %i)',
666 666
                         'admin_action',
667 667
                         $post_date_from,
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
                     );
679 679
                 } elseif ($post_log_type === 'failed') {
680 680
                     DB::query(
681
-                        'SELECT * FROM ' . prefixTable('log_system') . ' WHERE type=%s ' .
681
+                        'SELECT * FROM '.prefixTable('log_system').' WHERE type=%s '.
682 682
                             'AND (date BETWEEN %i AND %i)',
683 683
                         'failed_auth',
684 684
                         $post_date_from,
@@ -749,19 +749,19 @@  discard block
 block discarded – undo
749 749
             // Get info about task
750 750
             $taskInfo = DB::queryfirstrow(
751 751
                 'SELECT p.process_type as process_type
752
-                FROM ' . prefixTable('background_tasks') . ' as p
752
+                FROM ' . prefixTable('background_tasks').' as p
753 753
                 WHERE p.increment_id = %i',
754 754
                 $post_id
755 755
             );
756 756
             if ($taskInfo !== null) {
757 757
                 // delete task
758 758
                 DB::query(
759
-                    'DELETE FROM ' . prefixTable('background_subtasks') . '
759
+                    'DELETE FROM '.prefixTable('background_subtasks').'
760 760
                     WHERE task_id = %i',
761 761
                     $post_id
762 762
                 );
763 763
                 DB::query(
764
-                    'DELETE FROM ' . prefixTable('background_tasks') . '
764
+                    'DELETE FROM '.prefixTable('background_tasks').'
765 765
                     WHERE increment_id = %i',
766 766
                     $post_id
767 767
                 );
@@ -828,7 +828,7 @@  discard block
 block discarded – undo
828 828
                         ->setDayOfMonth('*')
829 829
                         ->setMonths('*')
830 830
                         ->setDayOfWeek('*')
831
-                        ->setTaskCommandLine($phpBinaryPath . ' ' . $SETTINGS['cpassman_dir'] . '/sources/scheduler.php')
831
+                        ->setTaskCommandLine($phpBinaryPath.' '.$SETTINGS['cpassman_dir'].'/sources/scheduler.php')
832 832
                         ->setComments('Teampass scheduler');
833 833
                     
834 834
                     $crontabRepository->addJob($crontabJob);
Please login to merge, or discard this patch.