Passed
Push — master ( 8045ef...5a3ed5 )
by Nils
06:16 queued 14s
created
sources/main.functions.php 1 patch
Spacing   +164 added lines, -166 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,18 +536,18 @@  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') . '');
540
-    DB::queryFirstRow('SELECT id FROM ' . prefixTable('nested_tree') . '');
539
+    DB::queryFirstRow('SELECT id FROM '.prefixTable('nested_tree').'');
540
+    DB::queryFirstRow('SELECT id FROM '.prefixTable('nested_tree').'');
541 541
     $session->set('user-nb_folders', DB::count());
542
-    DB::queryFirstRow('SELECT id FROM ' . prefixTable('roles_title'));
543
-    DB::queryFirstRow('SELECT id FROM ' . prefixTable('roles_title'));
542
+    DB::queryFirstRow('SELECT id FROM '.prefixTable('roles_title'));
543
+    DB::queryFirstRow('SELECT id FROM '.prefixTable('roles_title'));
544 544
     $session->set('user-nb_roles', DB::count());
545 545
     // check if change proposals on User's items
546 546
     if (isset($SETTINGS['enable_suggestion']) === true && (int) $SETTINGS['enable_suggestion'] === 1) {
547 547
         $countNewItems = DB::query(
548 548
             'SELECT COUNT(*)
549
-            FROM ' . prefixTable('items_change') . ' AS c
550
-            LEFT JOIN ' . prefixTable('log_items') . ' AS i ON (c.item_id = i.id_item)
549
+            FROM ' . prefixTable('items_change').' AS c
550
+            LEFT JOIN ' . prefixTable('log_items').' AS i ON (c.item_id = i.id_item)
551 551
             WHERE i.action = %s AND i.id_user = %i',
552 552
             'at_creation',
553 553
             $globalsUserId
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
 {
575 575
     $rows = DB::query(
576 576
         'SELECT *
577
-        FROM ' . prefixTable('roles_values') . '
577
+        FROM ' . prefixTable('roles_values').'
578 578
         WHERE type IN %ls'.(count($userRoles) > 0 ? ' AND role_id IN %li' : ''),
579 579
         ['W', 'ND', 'NE', 'NDNE', 'R'],
580 580
         $userRoles,
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
     ) {
642 642
         $persoFld = DB::queryFirstRow(
643 643
             'SELECT id
644
-            FROM ' . prefixTable('nested_tree') . '
644
+            FROM ' . prefixTable('nested_tree').'
645 645
             WHERE title = %s AND personal_folder = %i'.
646 646
             (count($allowedFolders) > 0 ? ' AND id NOT IN ('.implode(',', $allowedFolders).')' : ''),
647 647
             $globalsUserId,
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
     }
675 675
     $persoFlds = DB::query(
676 676
         'SELECT id
677
-        FROM ' . prefixTable('nested_tree') . '
677
+        FROM ' . prefixTable('nested_tree').'
678 678
         WHERE %l',
679 679
         $where
680 680
     );
@@ -742,12 +742,12 @@  discard block
 block discarded – undo
742 742
     //Load Tree
743 743
     $tree = new NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
744 744
     // truncate table
745
-    DB::query('TRUNCATE TABLE ' . prefixTable('cache'));
745
+    DB::query('TRUNCATE TABLE '.prefixTable('cache'));
746 746
     // reload date
747 747
     $rows = DB::query(
748 748
         'SELECT *
749
-        FROM ' . prefixTable('items') . ' as i
750
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
749
+        FROM ' . prefixTable('items').' as i
750
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
751 751
         AND l.action = %s
752 752
         AND i.inactif = %i',
753 753
         'at_creation',
@@ -759,18 +759,18 @@  discard block
 block discarded – undo
759 759
             $tags = '';
760 760
             $itemTags = DB::query(
761 761
                 'SELECT tag
762
-                FROM ' . prefixTable('tags') . '
762
+                FROM ' . prefixTable('tags').'
763 763
                 WHERE item_id = %i AND tag != ""',
764 764
                 $record['id']
765 765
             );
766 766
             foreach ($itemTags as $itemTag) {
767
-                $tags .= $itemTag['tag'] . ' ';
767
+                $tags .= $itemTag['tag'].' ';
768 768
             }
769 769
 
770 770
             // Get renewal period
771 771
             $resNT = DB::queryFirstRow(
772 772
                 'SELECT renewal_period
773
-                FROM ' . prefixTable('nested_tree') . '
773
+                FROM ' . prefixTable('nested_tree').'
774 774
                 WHERE id = %i',
775 775
                 $record['id_tree']
776 776
             );
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
                     // Is this a User id?
784 784
                     $user = DB::queryFirstRow(
785 785
                         'SELECT id, login
786
-                        FROM ' . prefixTable('users') . '
786
+                        FROM ' . prefixTable('users').'
787 787
                         WHERE id = %i',
788 788
                         $elem->title
789 789
                     );
@@ -801,11 +801,11 @@  discard block
 block discarded – undo
801 801
                     'id' => $record['id'],
802 802
                     'label' => $record['label'],
803 803
                     'description' => $record['description'] ?? '',
804
-                    'url' => isset($record['url']) && ! empty($record['url']) ? $record['url'] : '0',
804
+                    'url' => isset($record['url']) && !empty($record['url']) ? $record['url'] : '0',
805 805
                     'tags' => $tags,
806 806
                     'id_tree' => $record['id_tree'],
807 807
                     'perso' => $record['perso'],
808
-                    'restricted_to' => isset($record['restricted_to']) && ! empty($record['restricted_to']) ? $record['restricted_to'] : '0',
808
+                    'restricted_to' => isset($record['restricted_to']) && !empty($record['restricted_to']) ? $record['restricted_to'] : '0',
809 809
                     'login' => $record['login'] ?? '',
810 810
                     'folder' => implode(' » ', $folder),
811 811
                     'author' => $record['id_user'],
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
     // get new value from db
835 835
     $data = DB::queryFirstRow(
836 836
         'SELECT label, description, id_tree, perso, restricted_to, login, url
837
-        FROM ' . prefixTable('items') . '
837
+        FROM ' . prefixTable('items').'
838 838
         WHERE id=%i',
839 839
         $ident
840 840
     );
@@ -842,12 +842,12 @@  discard block
 block discarded – undo
842 842
     $tags = '';
843 843
     $itemTags = DB::query(
844 844
         'SELECT tag
845
-            FROM ' . prefixTable('tags') . '
845
+            FROM ' . prefixTable('tags').'
846 846
             WHERE item_id = %i AND tag != ""',
847 847
         $ident
848 848
     );
849 849
     foreach ($itemTags as $itemTag) {
850
-        $tags .= $itemTag['tag'] . ' ';
850
+        $tags .= $itemTag['tag'].' ';
851 851
     }
852 852
     // form id_tree to full foldername
853 853
     $folder = [];
@@ -858,7 +858,7 @@  discard block
 block discarded – undo
858 858
             // Is this a User id?
859 859
             $user = DB::queryFirstRow(
860 860
                 'SELECT id, login
861
-                FROM ' . prefixTable('users') . '
861
+                FROM ' . prefixTable('users').'
862 862
                 WHERE id = %i',
863 863
                 $elem->title
864 864
             );
@@ -876,10 +876,10 @@  discard block
 block discarded – undo
876 876
             'label' => $data['label'],
877 877
             'description' => $data['description'],
878 878
             'tags' => $tags,
879
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
879
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
880 880
             'id_tree' => $data['id_tree'],
881 881
             'perso' => $data['perso'],
882
-            'restricted_to' => isset($data['restricted_to']) && ! empty($data['restricted_to']) ? $data['restricted_to'] : '0',
882
+            'restricted_to' => isset($data['restricted_to']) && !empty($data['restricted_to']) ? $data['restricted_to'] : '0',
883 883
             'login' => $data['login'] ?? '',
884 884
             'folder' => implode(' » ', $folder),
885 885
             'author' => $session->get('user-id'),
@@ -909,8 +909,8 @@  discard block
 block discarded – undo
909 909
     // get new value from db
910 910
     $data = DB::queryFirstRow(
911 911
         'SELECT i.label, i.description, i.id_tree as id_tree, i.perso, i.restricted_to, i.id, i.login, i.url, l.date
912
-        FROM ' . prefixTable('items') . ' as i
913
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
912
+        FROM ' . prefixTable('items').' as i
913
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
914 914
         WHERE i.id = %i
915 915
         AND l.action = %s',
916 916
         $ident,
@@ -920,12 +920,12 @@  discard block
 block discarded – undo
920 920
     $tags = '';
921 921
     $itemTags = DB::query(
922 922
         'SELECT tag
923
-            FROM ' . prefixTable('tags') . '
923
+            FROM ' . prefixTable('tags').'
924 924
             WHERE item_id = %i AND tag != ""',
925 925
         $ident
926 926
     );
927 927
     foreach ($itemTags as $itemTag) {
928
-        $tags .= $itemTag['tag'] . ' ';
928
+        $tags .= $itemTag['tag'].' ';
929 929
     }
930 930
     // form id_tree to full foldername
931 931
     $folder = [];
@@ -936,7 +936,7 @@  discard block
 block discarded – undo
936 936
             // Is this a User id?
937 937
             $user = DB::queryFirstRow(
938 938
                 'SELECT id, login
939
-                FROM ' . prefixTable('users') . '
939
+                FROM ' . prefixTable('users').'
940 940
                 WHERE id = %i',
941 941
                 $elem->title
942 942
             );
@@ -955,7 +955,7 @@  discard block
 block discarded – undo
955 955
             'label' => $data['label'],
956 956
             'description' => $data['description'],
957 957
             'tags' => empty($tags) === false ? $tags : 'None',
958
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
958
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
959 959
             'id_tree' => $data['id_tree'],
960 960
             'perso' => isset($data['perso']) && empty($data['perso']) === false && $data['perso'] !== 'None' ? $data['perso'] : '0',
961 961
             'restricted_to' => isset($data['restricted_to']) && empty($data['restricted_to']) === false ? $data['restricted_to'] : '0',
@@ -977,53 +977,53 @@  discard block
 block discarded – undo
977 977
 function getStatisticsData(array $SETTINGS): array
978 978
 {
979 979
     DB::query(
980
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
980
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
981 981
         0
982 982
     );
983 983
     $counter_folders = DB::count();
984 984
     DB::query(
985
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
985
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
986 986
         1
987 987
     );
988 988
     $counter_folders_perso = DB::count();
989 989
     DB::query(
990
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
990
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
991 991
         0
992 992
     );
993 993
     $counter_items = DB::count();
994 994
         DB::query(
995
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
995
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
996 996
         1
997 997
     );
998 998
     $counter_items_perso = DB::count();
999 999
         DB::query(
1000
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE login NOT IN (%s, %s, %s)',
1000
+        'SELECT id FROM '.prefixTable('users').' WHERE login NOT IN (%s, %s, %s)',
1001 1001
         'OTV', 'TP', 'API'
1002 1002
     );
1003 1003
     $counter_users = DB::count();
1004 1004
         DB::query(
1005
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE admin = %i',
1005
+        'SELECT id FROM '.prefixTable('users').' WHERE admin = %i',
1006 1006
         1
1007 1007
     );
1008 1008
     $admins = DB::count();
1009 1009
     DB::query(
1010
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE gestionnaire = %i',
1010
+        'SELECT id FROM '.prefixTable('users').' WHERE gestionnaire = %i',
1011 1011
         1
1012 1012
     );
1013 1013
     $managers = DB::count();
1014 1014
     DB::query(
1015
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE read_only = %i',
1015
+        'SELECT id FROM '.prefixTable('users').' WHERE read_only = %i',
1016 1016
         1
1017 1017
     );
1018 1018
     $readOnly = DB::count();
1019 1019
     // list the languages
1020 1020
     $usedLang = [];
1021 1021
     $tp_languages = DB::query(
1022
-        'SELECT name FROM ' . prefixTable('languages')
1022
+        'SELECT name FROM '.prefixTable('languages')
1023 1023
     );
1024 1024
     foreach ($tp_languages as $tp_language) {
1025 1025
         DB::query(
1026
-            'SELECT * FROM ' . prefixTable('users') . ' WHERE user_language = %s',
1026
+            'SELECT * FROM '.prefixTable('users').' WHERE user_language = %s',
1027 1027
             $tp_language['name']
1028 1028
         );
1029 1029
         $usedLang[$tp_language['name']] = round((DB::count() * 100 / $counter_users), 0);
@@ -1032,12 +1032,12 @@  discard block
 block discarded – undo
1032 1032
     // get list of ips
1033 1033
     $usedIp = [];
1034 1034
     $tp_ips = DB::query(
1035
-        'SELECT user_ip FROM ' . prefixTable('users')
1035
+        'SELECT user_ip FROM '.prefixTable('users')
1036 1036
     );
1037 1037
     foreach ($tp_ips as $ip) {
1038 1038
         if (array_key_exists($ip['user_ip'], $usedIp)) {
1039 1039
             $usedIp[$ip['user_ip']] += $usedIp[$ip['user_ip']];
1040
-        } elseif (! empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1040
+        } elseif (!empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1041 1041
             $usedIp[$ip['user_ip']] = 1;
1042 1042
         }
1043 1043
     }
@@ -1132,7 +1132,7 @@  discard block
 block discarded – undo
1132 1132
         <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;">
1133 1133
         <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;">
1134 1134
         <br><div style="float:right;">' .
1135
-        $textMail .
1135
+        $textMail.
1136 1136
         '<br><br></td></tr></table>
1137 1137
     </td></tr></table>
1138 1138
     <br></body></html>';
@@ -1213,7 +1213,7 @@  discard block
 block discarded – undo
1213 1213
 {
1214 1214
     array_walk_recursive(
1215 1215
         $array,
1216
-        static function (&$item): void {
1216
+        static function(&$item): void {
1217 1217
             if (mb_detect_encoding((string) $item, 'utf-8', true) === false) {
1218 1218
                 $item = mb_convert_encoding($item, 'ISO-8859-1', 'UTF-8');
1219 1219
             }
@@ -1324,7 +1324,7 @@  discard block
 block discarded – undo
1324 1324
  */
1325 1325
 function prefixTable(string $table): string
1326 1326
 {
1327
-    $safeTable = htmlspecialchars(DB_PREFIX . $table);
1327
+    $safeTable = htmlspecialchars(DB_PREFIX.$table);
1328 1328
     return $safeTable;
1329 1329
 }
1330 1330
 
@@ -1441,7 +1441,7 @@  discard block
 block discarded – undo
1441 1441
 function send_syslog($message, $host, $port, $component = 'teampass'): void
1442 1442
 {
1443 1443
     $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
1444
-    $syslog_message = '<123>' . date('M d H:i:s ') . $component . ': ' . $message;
1444
+    $syslog_message = '<123>'.date('M d H:i:s ').$component.': '.$message;
1445 1445
     socket_sendto($sock, (string) $syslog_message, strlen($syslog_message), 0, (string) $host, (int) $port);
1446 1446
     socket_close($sock);
1447 1447
 }
@@ -1488,14 +1488,14 @@  discard block
 block discarded – undo
1488 1488
     if (isset($SETTINGS['syslog_enable']) === true && (int) $SETTINGS['syslog_enable'] === 1) {
1489 1489
         if ($type === 'user_mngt') {
1490 1490
             send_syslog(
1491
-                'action=' . str_replace('at_', '', $label) . ' attribute=user user=' . $who . ' userid="' . $login . '" change="' . $field_1 . '" ',
1491
+                'action='.str_replace('at_', '', $label).' attribute=user user='.$who.' userid="'.$login.'" change="'.$field_1.'" ',
1492 1492
                 $SETTINGS['syslog_host'],
1493 1493
                 $SETTINGS['syslog_port'],
1494 1494
                 'teampass'
1495 1495
             );
1496 1496
         } else {
1497 1497
             send_syslog(
1498
-                'action=' . $type . ' attribute=' . $label . ' user=' . $who . ' userid="' . $login . '" ',
1498
+                'action='.$type.' attribute='.$label.' user='.$who.' userid="'.$login.'" ',
1499 1499
                 $SETTINGS['syslog_host'],
1500 1500
                 $SETTINGS['syslog_port'],
1501 1501
                 'teampass'
@@ -1570,7 +1570,7 @@  discard block
 block discarded – undo
1570 1570
         if (empty($item_label) === true) {
1571 1571
             $dataItem = DB::queryFirstRow(
1572 1572
                 'SELECT id, id_tree, label
1573
-                FROM ' . prefixTable('items') . '
1573
+                FROM ' . prefixTable('items').'
1574 1574
                 WHERE id = %i',
1575 1575
                 $item_id
1576 1576
             );
@@ -1578,11 +1578,11 @@  discard block
 block discarded – undo
1578 1578
         }
1579 1579
 
1580 1580
         send_syslog(
1581
-            'action=' . str_replace('at_', '', $action) .
1582
-                ' attribute=' . str_replace('at_', '', $attribute[0]) .
1583
-                ' itemno=' . $item_id .
1584
-                ' user=' . (is_null($login) === true ? '' : addslashes((string) $login)) .
1585
-                ' itemname="' . addslashes($item_label) . '"',
1581
+            'action='.str_replace('at_', '', $action).
1582
+                ' attribute='.str_replace('at_', '', $attribute[0]).
1583
+                ' itemno='.$item_id.
1584
+                ' user='.(is_null($login) === true ? '' : addslashes((string) $login)).
1585
+                ' itemname="'.addslashes($item_label).'"',
1586 1586
             $SETTINGS['syslog_host'],
1587 1587
             $SETTINGS['syslog_port'],
1588 1588
             'teampass'
@@ -1613,8 +1613,8 @@  discard block
 block discarded – undo
1613 1613
     // send email to user that what to be notified
1614 1614
     $notification = DB::queryFirstField(
1615 1615
         'SELECT email
1616
-        FROM ' . prefixTable('notification') . ' AS n
1617
-        INNER JOIN ' . prefixTable('users') . ' AS u ON (n.user_id = u.id)
1616
+        FROM ' . prefixTable('notification').' AS n
1617
+        INNER JOIN ' . prefixTable('users').' AS u ON (n.user_id = u.id)
1618 1618
         WHERE n.item_id = %i AND n.user_id != %i',
1619 1619
         $item_id,
1620 1620
         $globalsUserId
@@ -1625,7 +1625,7 @@  discard block
 block discarded – undo
1625 1625
         // Get list of changes
1626 1626
         $htmlChanges = '<ul>';
1627 1627
         foreach ($changes as $change) {
1628
-            $htmlChanges .= '<li>' . $change . '</li>';
1628
+            $htmlChanges .= '<li>'.$change.'</li>';
1629 1629
         }
1630 1630
         $htmlChanges .= '</ul>';
1631 1631
         // send email
@@ -1662,15 +1662,15 @@  discard block
 block discarded – undo
1662 1662
     $path = '';
1663 1663
     foreach ($arbo as $elem) {
1664 1664
         if (empty($path) === true) {
1665
-            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' ';
1665
+            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' ';
1666 1666
         } else {
1667
-            $path .= '&#8594; ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1667
+            $path .= '&#8594; '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1668 1668
         }
1669 1669
     }
1670 1670
 
1671 1671
     // Build text to show user
1672 1672
     if (empty($label) === false) {
1673
-        return empty($path) === true ? addslashes($label) : addslashes($label) . ' (' . $path . ')';
1673
+        return empty($path) === true ? addslashes($label) : addslashes($label).' ('.$path.')';
1674 1674
     }
1675 1675
     return empty($path) === true ? '' : $path;
1676 1676
 }
@@ -1726,7 +1726,7 @@  discard block
 block discarded – undo
1726 1726
 {
1727 1727
     // Perform a copy if the file exists
1728 1728
     if (file_exists($configFilePath)) {
1729
-        $backupFilePath = $configFilePath . '.' . date('Y_m_d_His', time());
1729
+        $backupFilePath = $configFilePath.'.'.date('Y_m_d_His', time());
1730 1730
         if (!copy($configFilePath, $backupFilePath)) {
1731 1731
             return "ERROR: Could not copy file '$configFilePath'";
1732 1732
         }
@@ -1734,10 +1734,10 @@  discard block
 block discarded – undo
1734 1734
 
1735 1735
     // Regenerate the config file
1736 1736
     $data = ["<?php\n", "global \$SETTINGS;\n", "\$SETTINGS = array (\n"];
1737
-    $rows = DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s', 'admin');
1737
+    $rows = DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type=%s', 'admin');
1738 1738
     foreach ($rows as $record) {
1739 1739
         $value = getEncryptedValue($record['valeur'], $record['is_encrypted']);
1740
-        $data[] = "    '{$record['intitule']}' => '". htmlspecialchars_decode($value, ENT_COMPAT) . "',\n";
1740
+        $data[] = "    '{$record['intitule']}' => '".htmlspecialchars_decode($value, ENT_COMPAT)."',\n";
1741 1741
     }
1742 1742
     $data[] = ");\n";
1743 1743
     $data = array_unique($data);
@@ -1782,7 +1782,7 @@  discard block
 block discarded – undo
1782 1782
 {
1783 1783
     global $SETTINGS;
1784 1784
     /* LOAD CPASSMAN SETTINGS */
1785
-    if (! isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
1785
+    if (!isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
1786 1786
         $SETTINGS = [];
1787 1787
         $SETTINGS['duplicate_folder'] = 0;
1788 1788
         //by default, this is set to 0;
@@ -1792,7 +1792,7 @@  discard block
 block discarded – undo
1792 1792
         //by default, this value is set to 5;
1793 1793
         $settings = [];
1794 1794
         $rows = DB::query(
1795
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s_type OR type=%s_type2',
1795
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s_type OR type=%s_type2',
1796 1796
             [
1797 1797
                 'type' => 'admin',
1798 1798
                 'type2' => 'settings',
@@ -1824,7 +1824,7 @@  discard block
 block discarded – undo
1824 1824
     $source_cf = [];
1825 1825
     $rows = DB::query(
1826 1826
         'SELECT id_category
1827
-            FROM ' . prefixTable('categories_folders') . '
1827
+            FROM ' . prefixTable('categories_folders').'
1828 1828
             WHERE id_folder = %i',
1829 1829
         $source_id
1830 1830
     );
@@ -1835,7 +1835,7 @@  discard block
 block discarded – undo
1835 1835
     $target_cf = [];
1836 1836
     $rows = DB::query(
1837 1837
         'SELECT id_category
1838
-            FROM ' . prefixTable('categories_folders') . '
1838
+            FROM ' . prefixTable('categories_folders').'
1839 1839
             WHERE id_folder = %i',
1840 1840
         $target_id
1841 1841
     );
@@ -1930,10 +1930,10 @@  discard block
 block discarded – undo
1930 1930
     } catch (CryptoException\WrongKeyOrModifiedCiphertextException $ex) {
1931 1931
         $err = 'wrong_key';
1932 1932
     } catch (CryptoException\EnvironmentIsBrokenException $ex) {
1933
-        error_log('TEAMPASS-Error-Environment: ' . $ex->getMessage());
1933
+        error_log('TEAMPASS-Error-Environment: '.$ex->getMessage());
1934 1934
         $err = 'environment_error';
1935 1935
     } catch (CryptoException\IOException $ex) {
1936
-        error_log('TEAMPASS-Error-General: ' . $ex->getMessage());
1936
+        error_log('TEAMPASS-Error-General: '.$ex->getMessage());
1937 1937
         $err = 'general_error';
1938 1938
     }
1939 1939
 
@@ -1966,10 +1966,10 @@  discard block
 block discarded – undo
1966 1966
     } catch (CryptoException\WrongKeyOrModifiedCiphertextException $ex) {
1967 1967
         $err = 'wrong_key';
1968 1968
     } catch (CryptoException\EnvironmentIsBrokenException $ex) {
1969
-        error_log('TEAMPASS-Error-Environment: ' . $ex->getMessage());
1969
+        error_log('TEAMPASS-Error-Environment: '.$ex->getMessage());
1970 1970
         $err = 'environment_error';
1971 1971
     } catch (CryptoException\IOException $ex) {
1972
-        error_log('TEAMPASS-Error-General: ' . $ex->getMessage());
1972
+        error_log('TEAMPASS-Error-General: '.$ex->getMessage());
1973 1973
         $err = 'general_error';
1974 1974
     }
1975 1975
 
@@ -2055,7 +2055,7 @@  discard block
 block discarded – undo
2055 2055
 ) {
2056 2056
     // Check if the path exists
2057 2057
     $path = basename($path);
2058
-    if (! file_exists($path)) {
2058
+    if (!file_exists($path)) {
2059 2059
         return false;
2060 2060
     }
2061 2061
 
@@ -2108,7 +2108,7 @@  discard block
 block discarded – undo
2108 2108
     // Load item data
2109 2109
     $data = DB::queryFirstRow(
2110 2110
         'SELECT id_tree
2111
-        FROM ' . prefixTable('items') . '
2111
+        FROM ' . prefixTable('items').'
2112 2112
         WHERE id = %i',
2113 2113
         $item_id
2114 2114
     );
@@ -2171,7 +2171,7 @@  discard block
 block discarded – undo
2171 2171
         }
2172 2172
         $host .= substr(explode(".", $email[1])[0], -1, 1);
2173 2173
     }
2174
-    $email = $name . "@" . $host . "." . explode(".", $email[1])[1];
2174
+    $email = $name."@".$host.".".explode(".", $email[1])[1];
2175 2175
     return $email;
2176 2176
 }
2177 2177
 
@@ -2202,11 +2202,11 @@  discard block
 block discarded – undo
2202 2202
 function formatSizeUnits(int $bytes): string
2203 2203
 {
2204 2204
     if ($bytes >= 1073741824) {
2205
-        $bytes = number_format($bytes / 1073741824, 2) . ' GB';
2205
+        $bytes = number_format($bytes / 1073741824, 2).' GB';
2206 2206
     } elseif ($bytes >= 1048576) {
2207
-        $bytes = number_format($bytes / 1048576, 2) . ' MB';
2207
+        $bytes = number_format($bytes / 1048576, 2).' MB';
2208 2208
     } elseif ($bytes >= 1024) {
2209
-        $bytes = number_format($bytes / 1024, 2) . ' KB';
2209
+        $bytes = number_format($bytes / 1024, 2).' KB';
2210 2210
     } elseif ($bytes > 1) {
2211 2211
         $bytes .= ' bytes';
2212 2212
     } elseif ($bytes === 1) {
@@ -2455,7 +2455,7 @@  discard block
 block discarded – undo
2455 2455
     $cipher->enableContinuousBuffer();
2456 2456
 
2457 2457
     // Encrypt the file content
2458
-    $filePath = filter_var($fileInPath . '/' . $fileInName, FILTER_SANITIZE_URL);
2458
+    $filePath = filter_var($fileInPath.'/'.$fileInName, FILTER_SANITIZE_URL);
2459 2459
     $fileContent = file_get_contents($filePath);
2460 2460
     $plaintext = $fileContent;
2461 2461
     $ciphertext = $cipher->encrypt($plaintext);
@@ -2463,9 +2463,9 @@  discard block
 block discarded – undo
2463 2463
     // Save new file
2464 2464
     // deepcode ignore InsecureHash: is simply used to get a unique name
2465 2465
     $hash = uniqid('', true);
2466
-    $fileOut = $fileInPath . '/' . TP_FILE_PREFIX . $hash;
2466
+    $fileOut = $fileInPath.'/'.TP_FILE_PREFIX.$hash;
2467 2467
     file_put_contents($fileOut, $ciphertext);
2468
-    unlink($fileInPath . '/' . $fileInName);
2468
+    unlink($fileInPath.'/'.$fileInName);
2469 2469
     return [
2470 2470
         'fileHash' => base64_encode($hash),
2471 2471
         'objectKey' => base64_encode($objectKey),
@@ -2481,9 +2481,9 @@  discard block
 block discarded – undo
2481 2481
  *
2482 2482
  * @return string|array
2483 2483
  */
2484
-function decryptFile(string $fileName, string $filePath, string $key): string|array
2484
+function decryptFile(string $fileName, string $filePath, string $key): string | array
2485 2485
 {
2486
-    if (! defined('FILE_BUFFER_SIZE')) {
2486
+    if (!defined('FILE_BUFFER_SIZE')) {
2487 2487
         define('FILE_BUFFER_SIZE', 128 * 1024);
2488 2488
     }
2489 2489
     
@@ -2500,7 +2500,7 @@  discard block
 block discarded – undo
2500 2500
     $cipher->enableContinuousBuffer();
2501 2501
     $cipher->disablePadding();
2502 2502
     // Get file content
2503
-    $safeFilePath = realpath($filePath . '/' . TP_FILE_PREFIX . $safeFileName);
2503
+    $safeFilePath = realpath($filePath.'/'.TP_FILE_PREFIX.$safeFileName);
2504 2504
     if ($safeFilePath !== false && file_exists($safeFilePath)) {
2505 2505
         $ciphertext = file_get_contents(filter_var($safeFilePath, FILTER_SANITIZE_URL));
2506 2506
     } else {
@@ -2596,7 +2596,7 @@  discard block
 block discarded – undo
2596 2596
         // Only create the sharekey for a user
2597 2597
         $user = DB::queryFirstRow(
2598 2598
             'SELECT public_key
2599
-            FROM ' . prefixTable('users') . '
2599
+            FROM ' . prefixTable('users').'
2600 2600
             WHERE id = %i
2601 2601
             AND public_key != ""',
2602 2602
             $userId
@@ -2637,7 +2637,7 @@  discard block
 block discarded – undo
2637 2637
         }
2638 2638
         $users = DB::query(
2639 2639
             'SELECT id, public_key
2640
-            FROM ' . prefixTable('users') . '
2640
+            FROM ' . prefixTable('users').'
2641 2641
             WHERE id NOT IN %li
2642 2642
             AND public_key != ""',
2643 2643
             $user_ids
@@ -2646,7 +2646,7 @@  discard block
 block discarded – undo
2646 2646
         foreach ($users as $user) {
2647 2647
             // Insert in DB the new object key for this item by user
2648 2648
             if (count($objectKeyArray) === 0) {
2649
-                if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case1 - ' . $object_name . ' - ' . $post_object_id . ' - ' . $user['id'] . ' - ' . $objectKey);
2649
+                if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case1 - '.$object_name.' - '.$post_object_id.' - '.$user['id'].' - '.$objectKey);
2650 2650
                 DB::insert(
2651 2651
                     $object_name,
2652 2652
                     [
@@ -2660,7 +2660,7 @@  discard block
 block discarded – undo
2660 2660
                 );
2661 2661
             } else {
2662 2662
                 foreach ($objectKeyArray as $object) {
2663
-                    if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case2 - ' . $object_name . ' - ' . $object['objectId'] . ' - ' . $user['id'] . ' - ' . $object['objectKey']);
2663
+                    if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case2 - '.$object_name.' - '.$object['objectId'].' - '.$user['id'].' - '.$object['objectKey']);
2664 2664
                     DB::insert(
2665 2665
                         $object_name,
2666 2666
                         [
@@ -2688,7 +2688,7 @@  discard block
 block discarded – undo
2688 2688
 function isBase64(string $str): bool
2689 2689
 {
2690 2690
     $str = (string) trim($str);
2691
-    if (! isset($str[0])) {
2691
+    if (!isset($str[0])) {
2692 2692
         return false;
2693 2693
     }
2694 2694
 
@@ -2762,7 +2762,7 @@  discard block
 block discarded – undo
2762 2762
     } catch (\LdapRecord\Auth\BindException $e) {
2763 2763
         $error = $e->getDetailedError();
2764 2764
         if ($error && defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) {
2765
-            error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage(). " - ".$error->getDiagnosticMessage());
2765
+            error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage()." - ".$error->getDiagnosticMessage());
2766 2766
         }
2767 2767
         // deepcode ignore ServerLeak: No important data is sent
2768 2768
         echo 'An error occurred.';
@@ -2779,7 +2779,7 @@  discard block
 block discarded – undo
2779 2779
     } catch (\LdapRecord\Auth\BindException $e) {
2780 2780
         $error = $e->getDetailedError();
2781 2781
         if ($error && defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) {
2782
-            error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage(). " - ".$error->getDiagnosticMessage());
2782
+            error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage()." - ".$error->getDiagnosticMessage());
2783 2783
         }
2784 2784
         // deepcode ignore ServerLeak: No important data is sent
2785 2785
         echo 'An error occurred.';
@@ -2806,7 +2806,7 @@  discard block
 block discarded – undo
2806 2806
     // expect if personal item
2807 2807
     DB::delete(
2808 2808
         prefixTable('sharekeys_items'),
2809
-        'user_id = %i AND object_id NOT IN (SELECT i.id FROM ' . prefixTable('items') . ' AS i WHERE i.perso = 1)',
2809
+        'user_id = %i AND object_id NOT IN (SELECT i.id FROM '.prefixTable('items').' AS i WHERE i.perso = 1)',
2810 2810
         $userId
2811 2811
     );
2812 2812
     // Remove all item sharekeys files
@@ -2814,8 +2814,8 @@  discard block
 block discarded – undo
2814 2814
         prefixTable('sharekeys_files'),
2815 2815
         'user_id = %i AND object_id NOT IN (
2816 2816
             SELECT f.id 
2817
-            FROM ' . prefixTable('items') . ' AS i 
2818
-            INNER JOIN ' . prefixTable('files') . ' AS f ON f.id_item = i.id
2817
+            FROM ' . prefixTable('items').' AS i 
2818
+            INNER JOIN ' . prefixTable('files').' AS f ON f.id_item = i.id
2819 2819
             WHERE i.perso = 1
2820 2820
         )',
2821 2821
         $userId
@@ -2825,8 +2825,8 @@  discard block
 block discarded – undo
2825 2825
         prefixTable('sharekeys_fields'),
2826 2826
         'user_id = %i AND object_id NOT IN (
2827 2827
             SELECT c.id 
2828
-            FROM ' . prefixTable('items') . ' AS i 
2829
-            INNER JOIN ' . prefixTable('categories_items') . ' AS c ON c.item_id = i.id
2828
+            FROM ' . prefixTable('items').' AS i 
2829
+            INNER JOIN ' . prefixTable('categories_items').' AS c ON c.item_id = i.id
2830 2830
             WHERE i.perso = 1
2831 2831
         )',
2832 2832
         $userId
@@ -2834,13 +2834,13 @@  discard block
 block discarded – undo
2834 2834
     // Remove all item sharekeys logs
2835 2835
     DB::delete(
2836 2836
         prefixTable('sharekeys_logs'),
2837
-        'user_id = %i AND object_id NOT IN (SELECT i.id FROM ' . prefixTable('items') . ' AS i WHERE i.perso = 1)',
2837
+        'user_id = %i AND object_id NOT IN (SELECT i.id FROM '.prefixTable('items').' AS i WHERE i.perso = 1)',
2838 2838
         $userId
2839 2839
     );
2840 2840
     // Remove all item sharekeys suggestions
2841 2841
     DB::delete(
2842 2842
         prefixTable('sharekeys_suggestions'),
2843
-        'user_id = %i AND object_id NOT IN (SELECT i.id FROM ' . prefixTable('items') . ' AS i WHERE i.perso = 1)',
2843
+        'user_id = %i AND object_id NOT IN (SELECT i.id FROM '.prefixTable('items').' AS i WHERE i.perso = 1)',
2844 2844
         $userId
2845 2845
     );
2846 2846
     return false;
@@ -2861,7 +2861,7 @@  discard block
 block discarded – undo
2861 2861
         foreach (DateTimeZone::listIdentifiers() as $timezone) {
2862 2862
             $now->setTimezone(new DateTimeZone($timezone));
2863 2863
             $offsets[] = $offset = $now->getOffset();
2864
-            $timezones[$timezone] = '(' . format_GMT_offset($offset) . ') ' . format_timezone_name($timezone);
2864
+            $timezones[$timezone] = '('.format_GMT_offset($offset).') '.format_timezone_name($timezone);
2865 2865
         }
2866 2866
 
2867 2867
         array_multisort($offsets, $timezones);
@@ -2881,7 +2881,7 @@  discard block
 block discarded – undo
2881 2881
 {
2882 2882
     $hours = intval($offset / 3600);
2883 2883
     $minutes = abs(intval($offset % 3600 / 60));
2884
-    return 'GMT' . ($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
2884
+    return 'GMT'.($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
2885 2885
 }
2886 2886
 
2887 2887
 /**
@@ -2980,8 +2980,7 @@  discard block
 block discarded – undo
2980 2980
 {
2981 2981
     if (isset($array[$key]) === true
2982 2982
         && (is_int($value) === true ?
2983
-            (int) $array[$key] === $value :
2984
-            (string) $array[$key] === $value)
2983
+            (int) $array[$key] === $value : (string) $array[$key] === $value)
2985 2984
     ) {
2986 2985
         return true;
2987 2986
     }
@@ -3003,8 +3002,7 @@  discard block
 block discarded – undo
3003 3002
 {
3004 3003
     if (isset($var) === false
3005 3004
         || (is_int($value) === true ?
3006
-            (int) $var === $value :
3007
-            (string) $var === $value)
3005
+            (int) $var === $value : (string) $var === $value)
3008 3006
     ) {
3009 3007
         return true;
3010 3008
     }
@@ -3055,7 +3053,7 @@  discard block
 block discarded – undo
3055 3053
  */
3056 3054
 function isSetArrayOfValues(array $arrayOfValues): bool
3057 3055
 {
3058
-    foreach($arrayOfValues as $value) {
3056
+    foreach ($arrayOfValues as $value) {
3059 3057
         if (isset($value) === false) {
3060 3058
             return false;
3061 3059
         }
@@ -3077,7 +3075,7 @@  discard block
 block discarded – undo
3077 3075
     /*PHP8 - integer|string*/$value
3078 3076
 ) : bool
3079 3077
 {
3080
-    foreach($arrayOfVars as $variable) {
3078
+    foreach ($arrayOfVars as $variable) {
3081 3079
         if ($variable !== $value) {
3082 3080
             return false;
3083 3081
         }
@@ -3097,7 +3095,7 @@  discard block
 block discarded – undo
3097 3095
     /*PHP8 - integer|string*/$value
3098 3096
 ) : bool
3099 3097
 {
3100
-    foreach($arrayOfVars as $variable) {
3098
+    foreach ($arrayOfVars as $variable) {
3101 3099
         if ($variable === $value) {
3102 3100
             return true;
3103 3101
         }
@@ -3111,7 +3109,7 @@  discard block
 block discarded – undo
3111 3109
  * @param string|int|null $value
3112 3110
  * @return boolean
3113 3111
  */
3114
-function isValueSetNullEmpty(string|int|null $value) : bool
3112
+function isValueSetNullEmpty(string | int | null $value) : bool
3115 3113
 {
3116 3114
     if (is_null($value) === true || empty($value) === true) {
3117 3115
         return true;
@@ -3166,7 +3164,7 @@  discard block
 block discarded – undo
3166 3164
  * @param array     $filters
3167 3165
  * @return array|string
3168 3166
  */
3169
-function dataSanitizer(array $data, array $filters): array|string
3167
+function dataSanitizer(array $data, array $filters): array | string
3170 3168
 {
3171 3169
     // Load Sanitizer library
3172 3170
     $sanitizer = new Sanitizer($data, $filters);
@@ -3195,7 +3193,7 @@  discard block
 block discarded – undo
3195 3193
     // Exists ?
3196 3194
     $userCacheId = DB::queryFirstRow(
3197 3195
         'SELECT increment_id
3198
-        FROM ' . prefixTable('cache_tree') . '
3196
+        FROM ' . prefixTable('cache_tree').'
3199 3197
         WHERE user_id = %i',
3200 3198
         $user_id
3201 3199
     );
@@ -3246,7 +3244,7 @@  discard block
 block discarded – undo
3246 3244
  */
3247 3245
 function pourcentage(float $nombre, float $total, float $pourcentage): float
3248 3246
 { 
3249
-    $resultat = ($nombre/$total) * $pourcentage;
3247
+    $resultat = ($nombre / $total) * $pourcentage;
3250 3248
     return round($resultat);
3251 3249
 }
3252 3250
 
@@ -3276,7 +3274,7 @@  discard block
 block discarded – undo
3276 3274
 
3277 3275
     // Get last folder update
3278 3276
     $lastFolderChange = DB::queryFirstRow(
3279
-        'SELECT valeur FROM ' . prefixTable('misc') . '
3277
+        'SELECT valeur FROM '.prefixTable('misc').'
3280 3278
         WHERE type = %s AND intitule = %s',
3281 3279
         'timestamp',
3282 3280
         'last_folder_change'
@@ -3307,7 +3305,7 @@  discard block
 block discarded – undo
3307 3305
     // Does this user has a tree cache
3308 3306
     $userCacheTree = DB::queryFirstRow(
3309 3307
         'SELECT '.$fieldName.'
3310
-        FROM ' . prefixTable('cache_tree') . '
3308
+        FROM ' . prefixTable('cache_tree').'
3311 3309
         WHERE user_id = %i',
3312 3310
         $session->get('user-id')
3313 3311
     );
@@ -3350,7 +3348,7 @@  discard block
 block discarded – undo
3350 3348
     if (count($folderIds) === 0) {
3351 3349
         $folderIds = DB::queryFirstColumn(
3352 3350
             'SELECT id
3353
-            FROM ' . prefixTable('nested_tree') . '
3351
+            FROM ' . prefixTable('nested_tree').'
3354 3352
             WHERE personal_folder=%i',
3355 3353
             0
3356 3354
         );
@@ -3367,8 +3365,8 @@  discard block
 block discarded – undo
3367 3365
         $rows_tmp = DB::query(
3368 3366
             'SELECT c.id, c.title, c.level, c.type, c.masked, c.order, c.encrypted_data, c.role_visibility, c.is_mandatory,
3369 3367
             f.id_category AS category_id
3370
-            FROM ' . prefixTable('categories_folders') . ' AS f
3371
-            INNER JOIN ' . prefixTable('categories') . ' AS c ON (f.id_category = c.parent_id)
3368
+            FROM ' . prefixTable('categories_folders').' AS f
3369
+            INNER JOIN ' . prefixTable('categories').' AS c ON (f.id_category = c.parent_id)
3372 3370
             WHERE id_folder=%i',
3373 3371
             $folder
3374 3372
         );
@@ -3394,7 +3392,7 @@  discard block
 block discarded – undo
3394 3392
         $valTemp = '';
3395 3393
         $data = DB::queryFirstRow(
3396 3394
             'SELECT valeur
3397
-            FROM ' . prefixTable('misc') . '
3395
+            FROM ' . prefixTable('misc').'
3398 3396
             WHERE type = %s AND intitule=%i',
3399 3397
             'complex',
3400 3398
             $folder
@@ -3411,14 +3409,14 @@  discard block
 block discarded – undo
3411 3409
         $valTemp = '';
3412 3410
         $rows_tmp = DB::query(
3413 3411
             'SELECT t.title
3414
-            FROM ' . prefixTable('roles_values') . ' as v
3415
-            INNER JOIN ' . prefixTable('roles_title') . ' as t ON (v.role_id = t.id)
3412
+            FROM ' . prefixTable('roles_values').' as v
3413
+            INNER JOIN ' . prefixTable('roles_title').' as t ON (v.role_id = t.id)
3416 3414
             WHERE v.folder_id = %i
3417 3415
             GROUP BY title',
3418 3416
             $folder
3419 3417
         );
3420 3418
         foreach ($rows_tmp as $record) {
3421
-            $valTemp .= (empty($valTemp) === true ? '' : ' - ') . $record['title'];
3419
+            $valTemp .= (empty($valTemp) === true ? '' : ' - ').$record['title'];
3422 3420
         }
3423 3421
         $arr_data['visibilityRoles'] = $valTemp;
3424 3422
 
@@ -3451,7 +3449,7 @@  discard block
 block discarded – undo
3451 3449
         // loop on users and check if user has this role
3452 3450
         $rows = DB::query(
3453 3451
             'SELECT id, fonction_id
3454
-            FROM ' . prefixTable('users') . '
3452
+            FROM ' . prefixTable('users').'
3455 3453
             WHERE id != %i AND admin = 0 AND fonction_id IS NOT NULL AND fonction_id != ""',
3456 3454
             $session->get('user-id')
3457 3455
         );
@@ -3483,7 +3481,7 @@  discard block
 block discarded – undo
3483 3481
 
3484 3482
     $val = DB::queryFirstRow(
3485 3483
         'SELECT *
3486
-        FROM ' . prefixTable('users') . '
3484
+        FROM ' . prefixTable('users').'
3487 3485
         WHERE id = %i',
3488 3486
         $userId
3489 3487
     );
@@ -3499,12 +3497,12 @@  discard block
 block discarded – undo
3499 3497
 function upgradeRequired(): bool
3500 3498
 {
3501 3499
     // Get settings.php
3502
-    include_once __DIR__. '/../includes/config/settings.php';
3500
+    include_once __DIR__.'/../includes/config/settings.php';
3503 3501
 
3504 3502
     // Get timestamp in DB
3505 3503
     $val = DB::queryFirstRow(
3506 3504
         'SELECT valeur
3507
-        FROM ' . prefixTable('misc') . '
3505
+        FROM ' . prefixTable('misc').'
3508 3506
         WHERE type = %s AND intitule = %s',
3509 3507
         'admin',
3510 3508
         'upgrade_timestamp'
@@ -3555,7 +3553,7 @@  discard block
 block discarded – undo
3555 3553
     // prepapre background tasks for item keys generation        
3556 3554
     $userTP = DB::queryFirstRow(
3557 3555
         'SELECT pw, public_key, private_key
3558
-        FROM ' . prefixTable('users') . '
3556
+        FROM ' . prefixTable('users').'
3559 3557
         WHERE id = %i',
3560 3558
         TP_USER_ID
3561 3559
     );
@@ -3616,7 +3614,7 @@  discard block
 block discarded – undo
3616 3614
     }
3617 3615
 
3618 3616
     // Generate new keys
3619
-    if ($user_self_change === true && empty($recovery_public_key) === false && empty($recovery_private_key) === false){
3617
+    if ($user_self_change === true && empty($recovery_public_key) === false && empty($recovery_private_key) === false) {
3620 3618
         $userKeys = [
3621 3619
             'public_key' => $recovery_public_key,
3622 3620
             'private_key_clear' => $recovery_private_key,
@@ -3659,8 +3657,8 @@  discard block
 block discarded – undo
3659 3657
             'process_type' => 'create_user_keys',
3660 3658
             'arguments' => json_encode([
3661 3659
                 'new_user_id' => (int) $userId,
3662
-                'new_user_pwd' => cryption($passwordClear, '','encrypt')['string'],
3663
-                'new_user_code' => cryption(empty($encryptionKey) === true ? uniqidReal(20) : $encryptionKey, '','encrypt')['string'],
3660
+                'new_user_pwd' => cryption($passwordClear, '', 'encrypt')['string'],
3661
+                'new_user_code' => cryption(empty($encryptionKey) === true ? uniqidReal(20) : $encryptionKey, '', 'encrypt')['string'],
3664 3662
                 'owner_id' => (int) TP_USER_ID,
3665 3663
                 'creator_pwd' => $userTP['pw'],
3666 3664
                 'send_email' => $sendEmailToUser === true ? 1 : 0,
@@ -3731,19 +3729,19 @@  discard block
 block discarded – undo
3731 3729
 
3732 3730
     // Prepare the subtask queries
3733 3731
     $queries = [
3734
-        'step20' => 'SELECT * FROM ' . prefixTable('items'),
3732
+        'step20' => 'SELECT * FROM '.prefixTable('items'),
3735 3733
 
3736
-        'step30' => 'SELECT * FROM ' . prefixTable('log_items') . 
3734
+        'step30' => 'SELECT * FROM '.prefixTable('log_items'). 
3737 3735
                     ' WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"',
3738 3736
 
3739
-        'step40' => 'SELECT * FROM ' . prefixTable('categories_items') . 
3737
+        'step40' => 'SELECT * FROM '.prefixTable('categories_items'). 
3740 3738
                     ' WHERE encryption_type = "teampass_aes"',
3741 3739
 
3742
-        'step50' => 'SELECT * FROM ' . prefixTable('suggestion'),
3740
+        'step50' => 'SELECT * FROM '.prefixTable('suggestion'),
3743 3741
 
3744
-        'step60' => 'SELECT * FROM ' . prefixTable('files') . ' AS f
3745
-                        INNER JOIN ' . prefixTable('items') . ' AS i ON i.id = f.id_item
3746
-                        WHERE f.status = "' . TP_ENCRYPTION_NAME . '"'
3742
+        'step60' => 'SELECT * FROM '.prefixTable('files').' AS f
3743
+                        INNER JOIN ' . prefixTable('items').' AS i ON i.id = f.id_item
3744
+                        WHERE f.status = "' . TP_ENCRYPTION_NAME.'"'
3747 3745
     ];
3748 3746
 
3749 3747
     // Perform loop on $queries to create sub-tasks
@@ -3933,7 +3931,7 @@  discard block
 block discarded – undo
3933 3931
  */
3934 3932
 function createTaskForItem(
3935 3933
     string $processType,
3936
-    string|array $taskName,
3934
+    string | array $taskName,
3937 3935
     int $itemId,
3938 3936
     int $userId,
3939 3937
     string $objectKey,
@@ -3957,7 +3955,7 @@  discard block
 block discarded – undo
3957 3955
                 'object_key' => $objectKey,
3958 3956
                 'author' => (int) $userId,
3959 3957
             ]),
3960
-            'item_id' => (int) $parentId !== -1 ?  $parentId : null,
3958
+            'item_id' => (int) $parentId !== -1 ? $parentId : null,
3961 3959
         )
3962 3960
     );
3963 3961
     $processId = DB::insertId();
@@ -3967,7 +3965,7 @@  discard block
 block discarded – undo
3967 3965
     if (is_array($taskName) === false) {
3968 3966
         $taskName = [$taskName];
3969 3967
     }
3970
-    foreach($taskName as $task) {
3968
+    foreach ($taskName as $task) {
3971 3969
         if (WIP === true) error_log('createTaskForItem - task: '.$task);
3972 3970
         switch ($task) {
3973 3971
             case 'item_password':
@@ -4064,7 +4062,7 @@  discard block
 block discarded – undo
4064 4062
  * @param integer $user_id
4065 4063
  * @return void
4066 4064
  */
4067
-function purgeUnnecessaryKeys(bool $allUsers = true, int $user_id=0)
4065
+function purgeUnnecessaryKeys(bool $allUsers = true, int $user_id = 0)
4068 4066
 {
4069 4067
     if ($allUsers === true) {
4070 4068
         // Load class DB
@@ -4074,7 +4072,7 @@  discard block
 block discarded – undo
4074 4072
 
4075 4073
         $users = DB::query(
4076 4074
             'SELECT id
4077
-            FROM ' . prefixTable('users') . '
4075
+            FROM ' . prefixTable('users').'
4078 4076
             WHERE id NOT IN ('.OTV_USER_ID.', '.TP_USER_ID.', '.SSH_USER_ID.', '.API_USER_ID.')
4079 4077
             ORDER BY login ASC'
4080 4078
         );
@@ -4092,7 +4090,7 @@  discard block
 block discarded – undo
4092 4090
  * @param integer $user_id
4093 4091
  * @return void
4094 4092
  */
4095
-function purgeUnnecessaryKeysForUser(int $user_id=0)
4093
+function purgeUnnecessaryKeysForUser(int $user_id = 0)
4096 4094
 {
4097 4095
     if ($user_id === 0) {
4098 4096
         return;
@@ -4103,8 +4101,8 @@  discard block
 block discarded – undo
4103 4101
 
4104 4102
     $personalItems = DB::queryFirstColumn(
4105 4103
         'SELECT id
4106
-        FROM ' . prefixTable('items') . ' AS i
4107
-        INNER JOIN ' . prefixTable('log_items') . ' AS li ON li.id_item = i.id
4104
+        FROM ' . prefixTable('items').' AS i
4105
+        INNER JOIN ' . prefixTable('log_items').' AS li ON li.id_item = i.id
4108 4106
         WHERE i.perso = 1 AND li.action = "at_creation" AND li.id_user IN (%i, '.TP_USER_ID.')',
4109 4107
         $user_id
4110 4108
     );
@@ -4153,7 +4151,7 @@  discard block
 block discarded – undo
4153 4151
     // Check if user exists
4154 4152
     $userInfo = DB::queryFirstRow(
4155 4153
         'SELECT login
4156
-        FROM ' . prefixTable('users') . '
4154
+        FROM ' . prefixTable('users').'
4157 4155
         WHERE id = %i',
4158 4156
         $userId
4159 4157
     );
@@ -4162,7 +4160,7 @@  discard block
 block discarded – undo
4162 4160
         $now = (int) time();
4163 4161
         // Prepare file content
4164 4162
         $export_value = file_get_contents(__DIR__."/../includes/core/teampass_ascii.txt")."\n".
4165
-            "Generation date: ".date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], $now)."\n\n".
4163
+            "Generation date: ".date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], $now)."\n\n".
4166 4164
             "RECOVERY KEYS - Not to be shared - To be store safely\n\n".
4167 4165
             "Public Key:\n".$session->get('user-public_key')."\n\n".
4168 4166
             "Private Key:\n".$session->get('user-private_key')."\n\n";
@@ -4185,7 +4183,7 @@  discard block
 block discarded – undo
4185 4183
         return prepareExchangedData(
4186 4184
             array(
4187 4185
                 'error' => false,
4188
-                'datetime' => date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], $now),
4186
+                'datetime' => date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], $now),
4189 4187
                 'timestamp' => $now,
4190 4188
                 'content' => base64_encode($export_value),
4191 4189
                 'login' => $userInfo['login'],
@@ -4211,8 +4209,8 @@  discard block
 block discarded – undo
4211 4209
  */
4212 4210
 function loadClasses(string $className = ''): void
4213 4211
 {
4214
-    require_once __DIR__. '/../includes/config/include.php';
4215
-    require_once __DIR__. '/../includes/config/settings.php';
4212
+    require_once __DIR__.'/../includes/config/include.php';
4213
+    require_once __DIR__.'/../includes/config/settings.php';
4216 4214
     require_once __DIR__.'/../vendor/autoload.php';
4217 4215
 
4218 4216
     if (defined('DB_PASSWD_CLEAR') === false) {
@@ -4425,7 +4423,7 @@  discard block
 block discarded – undo
4425 4423
 
4426 4424
     // Get current user hash
4427 4425
     $userHash = DB::queryFirstRow(
4428
-        "SELECT pw FROM " . prefixtable('users') . " WHERE id = %d;",
4426
+        "SELECT pw FROM ".prefixtable('users')." WHERE id = %d;",
4429 4427
         $session->get('user-id')
4430 4428
     )['pw'];
4431 4429
 
@@ -4473,11 +4471,11 @@  discard block
 block discarded – undo
4473 4471
         }
4474 4472
         
4475 4473
         // Alternative: serialize ou json selon le contexte
4476
-        return get_class($value) . (method_exists($value, 'getId') ? '#' . $value->getId() : '');
4474
+        return get_class($value).(method_exists($value, 'getId') ? '#'.$value->getId() : '');
4477 4475
     }
4478 4476
     
4479 4477
     if (is_resource($value)) {
4480
-        return 'Resource#' . get_resource_id($value) . ' of type ' . get_resource_type($value);
4478
+        return 'Resource#'.get_resource_id($value).' of type '.get_resource_type($value);
4481 4479
     }
4482 4480
     
4483 4481
     // Cas par défaut
Please login to merge, or discard this patch.
sources/items.queries.php 1 patch
Spacing   +275 added lines, -276 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
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     date_default_timezone_set('UTC');
105 105
 }
106 106
 
107
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $session->get('user-language') . '.php';
107
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$session->get('user-language').'.php';
108 108
 header('Content-type: text/html; charset=utf-8');
109 109
 header('Cache-Control: no-cache, must-revalidate');
110 110
 
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
             // About special settings
366 366
             $dataFolderSettings = DB::queryFirstRow(
367 367
                 'SELECT bloquer_creation, bloquer_modification, personal_folder
368
-                FROM ' . prefixTable('nested_tree') . ' 
368
+                FROM ' . prefixTable('nested_tree').' 
369 369
                 WHERE id = %i',
370 370
                 $inputData['folderId']
371 371
             );
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
             // Get folder complexity
383 383
             $folderComplexity = DB::queryFirstRow(
384 384
                 'SELECT valeur
385
-                FROM ' . prefixTable('misc') . '
385
+                FROM ' . prefixTable('misc').'
386 386
                 WHERE type = %s AND intitule = %i',
387 387
                 'complex',
388 388
                 $inputData['folderId']
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
             $itemExists = 0;
408 408
             $newID = '';
409 409
             $data = DB::queryFirstRow(
410
-                'SELECT * FROM ' . prefixTable('items') . '
410
+                'SELECT * FROM '.prefixTable('items').'
411 411
                 WHERE label = %s AND inactif = %i',
412 412
                 $inputData['label'],
413 413
                 0
@@ -488,8 +488,8 @@  discard block
 block discarded – undo
488 488
                     (int) $post_folder_is_personal,
489 489
                     (int) $newID,
490 490
                     $cryptedStuff['objectKey'],
491
-                    true,   // only for the item creator
492
-                    false,  // no delete all
491
+                    true, // only for the item creator
492
+                    false, // no delete all
493 493
                 );
494 494
 
495 495
                 // update fields
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
                             // should we encrypt the data
503 503
                             $dataTmp = DB::queryFirstRow(
504 504
                                 'SELECT encrypted_data
505
-                                FROM ' . prefixTable('categories') . '
505
+                                FROM ' . prefixTable('categories').'
506 506
                                 WHERE id = %i',
507 507
                                 $field['id']
508 508
                             );
@@ -531,8 +531,8 @@  discard block
 block discarded – undo
531 531
                                     (int) $post_folder_is_personal,
532 532
                                     (int) $newObjectId,
533 533
                                     $cryptedStuff['objectKey'],
534
-                                    true,   // only for the item creator
535
-                                    false,  // no delete all
534
+                                    true, // only for the item creator
535
+                                    false, // no delete all
536 536
                                 );
537 537
 
538 538
                                 array_push(
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
                 ) {
569 569
                     DB::queryFirstRow(
570 570
                         'SELECT *
571
-                        FROM ' . prefixTable('templates') . '
571
+                        FROM ' . prefixTable('templates').'
572 572
                         WHERE item_id = %i',
573 573
                         $newID
574 574
                     );
@@ -637,11 +637,11 @@  discard block
 block discarded – undo
637 637
                 ) {
638 638
                     foreach ($post_restricted_to as $userRest) {
639 639
                         if (empty($userRest) === false) {
640
-                            $dataTmp = DB::queryFirstRow('SELECT login FROM ' . prefixTable('users') . ' WHERE id= %i', $userRest);
640
+                            $dataTmp = DB::queryFirstRow('SELECT login FROM '.prefixTable('users').' WHERE id= %i', $userRest);
641 641
                             if (empty($listOfRestricted)) {
642 642
                                 $listOfRestricted = $dataTmp['login'];
643 643
                             } else {
644
-                                $listOfRestricted .= ';' . $dataTmp['login'];
644
+                                $listOfRestricted .= ';'.$dataTmp['login'];
645 645
                             }
646 646
                         }
647 647
                     }
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
                             if (empty($userRest) === false) {
658 658
                                 $dataTmp = DB::queryFirstRow(
659 659
                                     'SELECT login
660
-                                    FROM ' . prefixTable('users') . '
660
+                                    FROM ' . prefixTable('users').'
661 661
                                     WHERE id= %i',
662 662
                                     $userRest
663 663
                                 );
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
                                 if (empty($oldRestrictionList) === true) {
666 666
                                     $oldRestrictionList = $dataTmp['login'];
667 667
                                 } else {
668
-                                    $oldRestrictionList .= ';' . $dataTmp['login'];
668
+                                    $oldRestrictionList .= ';'.$dataTmp['login'];
669 669
                                 }
670 670
                             }
671 671
                         }
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
                 if (empty($post_uploaded_file_id) === false) {
729 729
                     $rows = DB::query(
730 730
                         'SELECT id
731
-                        FROM ' . prefixTable('files') . '
731
+                        FROM ' . prefixTable('files').'
732 732
                         WHERE id_item = %s',
733 733
                         $post_uploaded_file_id
734 734
                     );
@@ -784,7 +784,7 @@  discard block
 block discarded – undo
784 784
                                     $lang->get('email_subject_item_updated'),
785 785
                                     str_replace(
786 786
                                         array('#label', '#link'),
787
-                                            array($path, $SETTINGS['email_server_url'] . '/index.php?page=items&group=' . $inputData['folderId'] . '&id=' . $newID . $lang['email_body3']),
787
+                                            array($path, $SETTINGS['email_server_url'].'/index.php?page=items&group='.$inputData['folderId'].'&id='.$newID.$lang['email_body3']),
788 788
                                             $lang->get('new_item_email_body')
789 789
                                     ),
790 790
                                     $emailAddress,
@@ -888,11 +888,11 @@  discard block
 block discarded – undo
888 888
         // Prepare variables
889 889
         $itemInfos = array();
890 890
         $inputData['label'] = isset($dataReceived['label']) && is_string($dataReceived['label']) ? filter_var($dataReceived['label'], FILTER_SANITIZE_FULL_SPECIAL_CHARS) : '';
891
-        $post_url = isset($dataReceived['url'])=== true ? filter_var(htmlspecialchars_decode($dataReceived['url']), FILTER_SANITIZE_URL) : '';
891
+        $post_url = isset($dataReceived['url']) === true ? filter_var(htmlspecialchars_decode($dataReceived['url']), FILTER_SANITIZE_URL) : '';
892 892
         $post_password = $original_pw = isset($dataReceived['pw']) && is_string($dataReceived['pw']) ? htmlspecialchars_decode($dataReceived['pw']) : '';
893 893
         $post_login = isset($dataReceived['login']) && is_string($dataReceived['login']) ? filter_var(htmlspecialchars_decode($dataReceived['login']), FILTER_SANITIZE_FULL_SPECIAL_CHARS) : '';
894
-        $post_tags = isset($dataReceived['tags'])=== true ? htmlspecialchars($dataReceived['tags']) : '';
895
-        $post_email = isset($dataReceived['email'])=== true ? filter_var(htmlspecialchars_decode($dataReceived['email']), FILTER_SANITIZE_EMAIL) : '';
894
+        $post_tags = isset($dataReceived['tags']) === true ? htmlspecialchars($dataReceived['tags']) : '';
895
+        $post_email = isset($dataReceived['email']) === true ? filter_var(htmlspecialchars_decode($dataReceived['email']), FILTER_SANITIZE_EMAIL) : '';
896 896
         $post_template_id = (int) filter_var($dataReceived['template_id'], FILTER_SANITIZE_NUMBER_INT);
897 897
         $inputData['itemId'] = (int) filter_var($dataReceived['id'], FILTER_SANITIZE_NUMBER_INT);
898 898
         $post_anyone_can_modify = (int) filter_var($dataReceived['anyone_can_modify'], FILTER_SANITIZE_NUMBER_INT);
@@ -923,8 +923,7 @@  discard block
 block discarded – undo
923 923
         $post_to_be_deleted_after_date = isset($dataReceived['to_be_deleted_after_date']) === true ? filter_var(
924 924
                 $dataReceived['to_be_deleted_after_date'],
925 925
                 FILTER_SANITIZE_FULL_SPECIAL_CHARS
926
-            ) :
927
-            '';
926
+            ) : '';
928 927
         $post_fields = (filter_var_array(
929 928
             $dataReceived['fields'],
930 929
             FILTER_SANITIZE_FULL_SPECIAL_CHARS
@@ -984,7 +983,7 @@  discard block
 block discarded – undo
984 983
         // About special settings
985 984
         $dataFolderSettings = DB::queryFirstRow(
986 985
             'SELECT bloquer_creation, bloquer_modification, personal_folder, title
987
-            FROM ' . prefixTable('nested_tree') . ' 
986
+            FROM ' . prefixTable('nested_tree').' 
988 987
             WHERE id = %i',
989 988
             $inputData['folderId']
990 989
         );
@@ -1000,7 +999,7 @@  discard block
 block discarded – undo
1000 999
         // Get folder complexity
1001 1000
         $folderComplexity = DB::queryFirstRow(
1002 1001
             'SELECT valeur
1003
-            FROM ' . prefixTable('misc') . '
1002
+            FROM ' . prefixTable('misc').'
1004 1003
             WHERE type = %s AND intitule = %i',
1005 1004
             'complex',
1006 1005
             $inputData['folderId']
@@ -1045,8 +1044,8 @@  discard block
 block discarded – undo
1045 1044
         // Get all informations for this item
1046 1045
         $dataItem = DB::queryFirstRow(
1047 1046
             'SELECT *
1048
-            FROM ' . prefixTable('items') . ' as i
1049
-            INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
1047
+            FROM ' . prefixTable('items').' as i
1048
+            INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
1050 1049
             WHERE i.id=%i AND l.action = %s',
1051 1050
             $inputData['itemId'],
1052 1051
             'at_creation'
@@ -1095,7 +1094,7 @@  discard block
 block discarded – undo
1095 1094
         //db::debugmode(true);
1096 1095
         DB::query(
1097 1096
             'SELECT *
1098
-            FROM ' . prefixTable('sharekeys_items') . '
1097
+            FROM ' . prefixTable('sharekeys_items').'
1099 1098
             WHERE object_id = %i AND user_id = %s',
1100 1099
             $inputData['itemId'],
1101 1100
             $session->get('user-id')
@@ -1155,9 +1154,9 @@  discard block
 block discarded – undo
1155 1154
                 'SELECT i.id as id, i.label as label, i.description as description, i.pw as pw, i.url as url, i.id_tree as id_tree, i.perso as perso, i.login as login, 
1156 1155
                 i.inactif as inactif, i.restricted_to as restricted_to, i.anyone_can_modify as anyone_can_modify, i.email as email, i.notification as notification,
1157 1156
                 u.login as user_login, u.email as user_email
1158
-                FROM ' . prefixTable('items') . ' as i
1159
-                INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id=l.id_item)
1160
-                INNER JOIN ' . prefixTable('users') . ' as u ON (u.id=l.id_user)
1157
+                FROM ' . prefixTable('items').' as i
1158
+                INNER JOIN ' . prefixTable('log_items').' as l ON (i.id=l.id_item)
1159
+                INNER JOIN ' . prefixTable('users').' as u ON (u.id=l.id_user)
1161 1160
                 WHERE i.id=%i',
1162 1161
                 $inputData['itemId']
1163 1162
             );
@@ -1165,7 +1164,7 @@  discard block
 block discarded – undo
1165 1164
             // Should we log a password change?
1166 1165
             $userKey = DB::queryFirstRow(
1167 1166
                 'SELECT share_key
1168
-                FROM ' . prefixTable('sharekeys_items') . '
1167
+                FROM ' . prefixTable('sharekeys_items').'
1169 1168
                 WHERE user_id = %i AND object_id = %i',
1170 1169
                 $session->get('user-id'),
1171 1170
                 $inputData['itemId']
@@ -1229,12 +1228,12 @@  discard block
 block discarded – undo
1229 1228
                     (int) $post_folder_is_personal,
1230 1229
                     (int) $inputData['itemId'],
1231 1230
                     $encrypted_password_key,
1232
-                    true,   // only for the item creator
1233
-                    true,   // delete all
1231
+                    true, // only for the item creator
1232
+                    true, // delete all
1234 1233
                 );
1235 1234
 
1236 1235
                 // Create a task to create sharekeys for users
1237
-                if (WIP=== true) error_log('createTaskForItem - new password for this item - '.$post_password ." -- ". $pw);
1236
+                if (WIP === true) error_log('createTaskForItem - new password for this item - '.$post_password." -- ".$pw);
1238 1237
                 $tasksToBePerformed = ['item_password'];
1239 1238
                 $encryptionTaskIsRequested = true;
1240 1239
             } else {
@@ -1245,7 +1244,7 @@  discard block
 block discarded – undo
1245 1244
             // Get list of tags
1246 1245
             $itemTags = DB::queryFirstColumn(
1247 1246
                 'SELECT tag
1248
-                FROM ' . prefixTable('tags') . '
1247
+                FROM ' . prefixTable('tags').'
1249 1248
                 WHERE item_id = %i',
1250 1249
                 $inputData['itemId']
1251 1250
             );
@@ -1291,7 +1290,7 @@  discard block
 block discarded – undo
1291 1290
                     $session->get('user-id'),
1292 1291
                     'at_modification',
1293 1292
                     $session->get('user-login'),
1294
-                    'at_tag : ' . implode(' ', $itemTags) . ' => ' . $post_tags
1293
+                    'at_tag : '.implode(' ', $itemTags).' => '.$post_tags
1295 1294
                 );
1296 1295
             }
1297 1296
 
@@ -1331,8 +1330,8 @@  discard block
 block discarded – undo
1331 1330
                             'SELECT c.id AS id, c.title AS title, i.data AS data, i.data_iv AS data_iv,
1332 1331
                             i.encryption_type AS encryption_type, c.encrypted_data AS encrypted_data,
1333 1332
                             c.masked AS masked, i.id AS field_item_id
1334
-                            FROM ' . prefixTable('categories_items') . ' AS i
1335
-                            INNER JOIN ' . prefixTable('categories') . ' AS c ON (i.field_id=c.id)
1333
+                            FROM ' . prefixTable('categories_items').' AS i
1334
+                            INNER JOIN ' . prefixTable('categories').' AS c ON (i.field_id=c.id)
1336 1335
                             WHERE i.field_id = %i AND i.item_id = %i',
1337 1336
                             $field['id'],
1338 1337
                             $inputData['itemId']
@@ -1348,7 +1347,7 @@  discard block
 block discarded – undo
1348 1347
                             // Perform new query
1349 1348
                             $dataTmpCat = DB::queryFirstRow(
1350 1349
                                 'SELECT id, title, encrypted_data, masked
1351
-                                FROM ' . prefixTable('categories') . '
1350
+                                FROM ' . prefixTable('categories').'
1352 1351
                                 WHERE id = %i',
1353 1352
                                 $field['id']
1354 1353
                             );
@@ -1378,8 +1377,8 @@  discard block
 block discarded – undo
1378 1377
                                     (int) $post_folder_is_personal,
1379 1378
                                     (int) $newId,
1380 1379
                                     $cryptedStuff['objectKey'],
1381
-                                    true,   // only for the item creator
1382
-                                    true,   // delete all
1380
+                                    true, // only for the item creator
1381
+                                    true, // delete all
1383 1382
                                 );
1384 1383
 
1385 1384
                                 // update value
@@ -1429,7 +1428,7 @@  discard block
 block discarded – undo
1429 1428
                                 $session->get('user-id'),
1430 1429
                                 'at_modification',
1431 1430
                                 $session->get('user-login'),
1432
-                                'at_field : ' . $dataTmpCat['title'] . ' : ' . $field['value']
1431
+                                'at_field : '.$dataTmpCat['title'].' : '.$field['value']
1433 1432
                             );
1434 1433
                         } else {
1435 1434
                             // Case where the field already exists
@@ -1438,7 +1437,7 @@  discard block
 block discarded – undo
1438 1437
                                 // Get user sharekey for this field
1439 1438
                                 $userKey = DB::queryFirstRow(
1440 1439
                                     'SELECT share_key
1441
-                                    FROM ' . prefixTable('sharekeys_fields') . '
1440
+                                    FROM ' . prefixTable('sharekeys_fields').'
1442 1441
                                     WHERE user_id = %i AND object_id = %i',
1443 1442
                                     $session->get('user-id'),
1444 1443
                                     $dataTmpCat['field_item_id']
@@ -1477,8 +1476,8 @@  discard block
 block discarded – undo
1477 1476
                                         (int) $post_folder_is_personal,
1478 1477
                                         (int) $dataTmpCat['field_item_id'],
1479 1478
                                         $cryptedStuff['objectKey'],
1480
-                                        true,   // only for the item creator
1481
-                                        true,   // delete all
1479
+                                        true, // only for the item creator
1480
+                                        true, // delete all
1482 1481
                                     );
1483 1482
 
1484 1483
                                     if ($encryptedFieldIsChanged === false) {
@@ -1520,7 +1519,7 @@  discard block
 block discarded – undo
1520 1519
                                     $session->get('user-id'),
1521 1520
                                     'at_modification',
1522 1521
                                     $session->get('user-login'),
1523
-                                    'at_field : ' . $dataTmpCat['title'] . ' => ' . $oldVal
1522
+                                    'at_field : '.$dataTmpCat['title'].' => '.$oldVal
1524 1523
                                 );
1525 1524
                             }
1526 1525
                         }
@@ -1574,7 +1573,7 @@  discard block
 block discarded – undo
1574 1573
             ) {
1575 1574
                 DB::queryFirstRow(
1576 1575
                     'SELECT *
1577
-                    FROM ' . prefixTable('templates') . '
1576
+                    FROM ' . prefixTable('templates').'
1578 1577
                     WHERE item_id = %i',
1579 1578
                     $inputData['itemId']
1580 1579
                 );
@@ -1617,7 +1616,7 @@  discard block
 block discarded – undo
1617 1616
                 // check if elem exists in Table. If not add it or update it.
1618 1617
                 DB::query(
1619 1618
                     'SELECT *
1620
-                    FROM ' . prefixTable('automatic_del') . '
1619
+                    FROM ' . prefixTable('automatic_del').'
1621 1620
                     WHERE item_id = %i',
1622 1621
                     $inputData['itemId']
1623 1622
                 );
@@ -1644,7 +1643,7 @@  discard block
 block discarded – undo
1644 1643
                         // Store updates performed
1645 1644
                         array_push(
1646 1645
                             $arrayOfChanges,
1647
-                            $lang->get('automatic_deletion_engaged') . ': ' . $lang->get('enabled')
1646
+                            $lang->get('automatic_deletion_engaged').': '.$lang->get('enabled')
1648 1647
                         );
1649 1648
 
1650 1649
                         // update LOG
@@ -1687,7 +1686,7 @@  discard block
 block discarded – undo
1687 1686
                         // Store updates performed
1688 1687
                         array_push(
1689 1688
                             $arrayOfChanges,
1690
-                            $lang->get('automatic_deletion_engaged') . ': ' . $lang->get('disabled')
1689
+                            $lang->get('automatic_deletion_engaged').': '.$lang->get('disabled')
1691 1690
                         );
1692 1691
 
1693 1692
                         // update LOG
@@ -1715,7 +1714,7 @@  discard block
 block discarded – undo
1715 1714
                     if (empty($userId) === false) {
1716 1715
                         $dataTmp = DB::queryFirstRow(
1717 1716
                             'SELECT id, name, lastname
1718
-                            FROM ' . prefixTable('users') . '
1717
+                            FROM ' . prefixTable('users').'
1719 1718
                             WHERE id= %i',
1720 1719
                             $userId
1721 1720
                         );
@@ -1723,7 +1722,7 @@  discard block
 block discarded – undo
1723 1722
                         // Add to array
1724 1723
                         array_push(
1725 1724
                             $arrayOfUsersRestriction,
1726
-                            $dataTmp['name'] . ' ' . $dataTmp['lastname']
1725
+                            $dataTmp['name'].' '.$dataTmp['lastname']
1727 1726
                         );
1728 1727
                         array_push(
1729 1728
                             $arrayOfUsersIdRestriction,
@@ -1754,8 +1753,8 @@  discard block
 block discarded – undo
1754 1753
                 // get values before deleting them
1755 1754
                 $rows = DB::query(
1756 1755
                     'SELECT t.title, t.id AS id
1757
-                    FROM ' . prefixTable('roles_title') . ' as t
1758
-                    INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (t.id=r.role_id)
1756
+                    FROM ' . prefixTable('roles_title').' as t
1757
+                    INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (t.id=r.role_id)
1759 1758
                     WHERE r.item_id = %i
1760 1759
                     ORDER BY t.title ASC',
1761 1760
                     $inputData['itemId']
@@ -1789,7 +1788,7 @@  discard block
 block discarded – undo
1789 1788
                         );
1790 1789
                         $dataTmp = DB::queryFirstRow(
1791 1790
                             'SELECT title
1792
-                            FROM ' . prefixTable('roles_title') . '
1791
+                            FROM ' . prefixTable('roles_title').'
1793 1792
                             WHERE id = %i',
1794 1793
                             $role
1795 1794
                         );
@@ -1817,7 +1816,7 @@  discard block
 block discarded – undo
1817 1816
             // Get current status
1818 1817
             $otpStatus = DB::queryFirstRow(
1819 1818
                 'SELECT enabled as otp_is_enabled
1820
-                FROM ' . prefixTable('items_otp') . '
1819
+                FROM ' . prefixTable('items_otp').'
1821 1820
                 WHERE item_id = %i',
1822 1821
                 $inputData['itemId']
1823 1822
             );
@@ -1848,7 +1847,7 @@  discard block
 block discarded – undo
1848 1847
                     $session->get('user-id'),
1849 1848
                     'at_modification',
1850 1849
                     $session->get('user-login'),
1851
-                    'at_otp_status:' . ((int) $post_otp_is_enabled === 0 ? 'disabled' : 'enabled')
1850
+                    'at_otp_status:'.((int) $post_otp_is_enabled === 0 ? 'disabled' : 'enabled')
1852 1851
                 );
1853 1852
             } elseif (DB::count() === 0 && empty($post_otp_secret) === false) {
1854 1853
                 // Create the entry in items_otp table
@@ -1892,8 +1891,8 @@  discard block
 block discarded – undo
1892 1891
                     $session->get('user-id'),
1893 1892
                     'at_modification',
1894 1893
                     $session->get('user-login'),
1895
-                    'at_restriction : ' . (count($diffUsersRestiction) > 0 ?
1896
-                        implode(', ', $arrayOfUsersRestriction) . (count($diffRolesRestiction) > 0 ? ', ' : '') : '') . (count($diffRolesRestiction) > 0 ? implode(', ', $arrayOfRestrictionRoles) : '')
1894
+                    'at_restriction : '.(count($diffUsersRestiction) > 0 ?
1895
+                        implode(', ', $arrayOfUsersRestriction).(count($diffRolesRestiction) > 0 ? ', ' : '') : '').(count($diffRolesRestiction) > 0 ? implode(', ', $arrayOfRestrictionRoles) : '')
1897 1896
                 );
1898 1897
             }
1899 1898
 
@@ -1913,7 +1912,7 @@  discard block
 block discarded – undo
1913 1912
                     $session->get('user-id'),
1914 1913
                     'at_modification',
1915 1914
                     $session->get('user-login'),
1916
-                    'at_label : ' . $data['label'] . ' => ' . $inputData['label']
1915
+                    'at_label : '.$data['label'].' => '.$inputData['label']
1917 1916
                 );
1918 1917
             }
1919 1918
             // LOGIN
@@ -1932,7 +1931,7 @@  discard block
 block discarded – undo
1932 1931
                     $session->get('user-id'),
1933 1932
                     'at_modification',
1934 1933
                     $session->get('user-login'),
1935
-                    'at_login : ' . $data['login'] . ' => ' . $post_login
1934
+                    'at_login : '.$data['login'].' => '.$post_login
1936 1935
                 );
1937 1936
             }
1938 1937
             // EMAIL
@@ -1951,7 +1950,7 @@  discard block
 block discarded – undo
1951 1950
                     $session->get('user-id'),
1952 1951
                     'at_modification',
1953 1952
                     $session->get('user-login'),
1954
-                    'at_email : ' . $data['email'] . ' => ' . $post_email
1953
+                    'at_email : '.$data['email'].' => '.$post_email
1955 1954
                 );
1956 1955
             }
1957 1956
             // URL
@@ -1970,7 +1969,7 @@  discard block
 block discarded – undo
1970 1969
                     $session->get('user-id'),
1971 1970
                     'at_modification',
1972 1971
                     $session->get('user-login'),
1973
-                    'at_url : ' . $data['url'] . ' => ' . $post_url
1972
+                    'at_url : '.$data['url'].' => '.$post_url
1974 1973
                 );
1975 1974
             }
1976 1975
             // DESCRIPTION
@@ -1996,7 +1995,7 @@  discard block
 block discarded – undo
1996 1995
             // FOLDER
1997 1996
             if ((int) $data['id_tree'] !== (int) $inputData['folderId']) {
1998 1997
                 // Get name of folders
1999
-                $dataTmp = DB::query('SELECT title FROM ' . prefixTable('nested_tree') . ' WHERE id IN %li', array($data['id_tree'], $inputData['folderId']));
1998
+                $dataTmp = DB::query('SELECT title FROM '.prefixTable('nested_tree').' WHERE id IN %li', array($data['id_tree'], $inputData['folderId']));
2000 1999
 
2001 2000
                 // Store updates performed
2002 2001
                 array_push(
@@ -2012,7 +2011,7 @@  discard block
 block discarded – undo
2012 2011
                     $session->get('user-id'),
2013 2012
                     'at_modification',
2014 2013
                     $session->get('user-login'),
2015
-                    'at_category : ' . $dataTmp[0]['title'] . ' => ' . $dataTmp[1]['title']
2014
+                    'at_category : '.$dataTmp[0]['title'].' => '.$dataTmp[1]['title']
2016 2015
                 );
2017 2016
             }
2018 2017
             // ANYONE_CAN_MODIFY
@@ -2020,7 +2019,7 @@  discard block
 block discarded – undo
2020 2019
                 // Store updates performed
2021 2020
                 array_push(
2022 2021
                     $arrayOfChanges,
2023
-                    $lang->get('at_anyoneconmodify') . ': ' . ((int) $post_anyone_can_modify === 0 ? $lang->get('disabled') : $lang->get('enabled'))
2022
+                    $lang->get('at_anyoneconmodify').': '.((int) $post_anyone_can_modify === 0 ? $lang->get('disabled') : $lang->get('enabled'))
2024 2023
                 );
2025 2024
 
2026 2025
                 // Log
@@ -2031,15 +2030,15 @@  discard block
 block discarded – undo
2031 2030
                     $session->get('user-id'),
2032 2031
                     'at_modification',
2033 2032
                     $session->get('user-login'),
2034
-                    'at_anyoneconmodify : ' . ((int) $post_anyone_can_modify === 0 ? 'disabled' : 'enabled')
2033
+                    'at_anyoneconmodify : '.((int) $post_anyone_can_modify === 0 ? 'disabled' : 'enabled')
2035 2034
                 );
2036 2035
             }
2037 2036
 
2038 2037
             // Reload new values
2039 2038
             $dataItem = DB::queryFirstRow(
2040 2039
                 'SELECT *
2041
-                FROM ' . prefixTable('items') . ' as i
2042
-                INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
2040
+                FROM ' . prefixTable('items').' as i
2041
+                INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
2043 2042
                 WHERE i.id = %i AND l.action = %s',
2044 2043
                 $inputData['itemId'],
2045 2044
                 'at_creation'
@@ -2048,8 +2047,8 @@  discard block
 block discarded – undo
2048 2047
             $history = '';
2049 2048
             $rows = DB::query(
2050 2049
                 'SELECT l.date as date, l.action as action, l.raison as raison, u.login as login
2051
-                FROM ' . prefixTable('log_items') . ' as l
2052
-                LEFT JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id)
2050
+                FROM ' . prefixTable('log_items').' as l
2051
+                LEFT JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id)
2053 2052
                 WHERE l.action <> %s AND id_item=%s',
2054 2053
                 'at_shown',
2055 2054
                 $inputData['itemId']
@@ -2058,14 +2057,14 @@  discard block
 block discarded – undo
2058 2057
                 if ($record['raison'] === NULL) continue;
2059 2058
                 $reason = explode(':', $record['raison']);
2060 2059
                 if (count($reason) > 0) {
2061
-                    $sentence = date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) . ' - '
2062
-                        . $record['login'] . ' - ' . $lang->get($record['action']) . ' - '
2063
-                        . (empty($record['raison']) === false ? (count($reason) > 1 ? $lang->get(trim($reason[0])) . ' : ' . $reason[1]
2060
+                    $sentence = date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']).' - '
2061
+                        . $record['login'].' - '.$lang->get($record['action']).' - '
2062
+                        . (empty($record['raison']) === false ? (count($reason) > 1 ? $lang->get(trim($reason[0])).' : '.$reason[1]
2064 2063
                             : $lang->get(trim($reason[0]))) : '');
2065 2064
                     if (empty($history)) {
2066 2065
                         $history = $sentence;
2067 2066
                     } else {
2068
-                        $history .= '<br />' . $sentence;
2067
+                        $history .= '<br />'.$sentence;
2069 2068
                     }
2070 2069
                 }
2071 2070
             }
@@ -2203,7 +2202,7 @@  discard block
 block discarded – undo
2203 2202
         ) {
2204 2203
             // load the original record into an array
2205 2204
             $originalRecord = DB::queryFirstRow(
2206
-                'SELECT * FROM ' . prefixTable('items') . '
2205
+                'SELECT * FROM '.prefixTable('items').'
2207 2206
                 WHERE id = %i',
2208 2207
                 $inputData['itemId']
2209 2208
             );
@@ -2222,7 +2221,7 @@  discard block
 block discarded – undo
2222 2221
 
2223 2222
             // Load the destination folder record into an array
2224 2223
             $dataDestination = DB::queryFirstRow(
2225
-                'SELECT personal_folder FROM ' . prefixTable('nested_tree') . '
2224
+                'SELECT personal_folder FROM '.prefixTable('nested_tree').'
2226 2225
                 WHERE id = %i',
2227 2226
                 $post_dest_id
2228 2227
             );
@@ -2230,7 +2229,7 @@  discard block
 block discarded – undo
2230 2229
             // Get the ITEM object key for the user
2231 2230
             $userKey = DB::queryFirstRow(
2232 2231
                 'SELECT share_key
2233
-                FROM ' . prefixTable('sharekeys_items') . '
2232
+                FROM ' . prefixTable('sharekeys_items').'
2234 2233
                 WHERE user_id = %i AND object_id = %i',
2235 2234
                 $session->get('user-id'),
2236 2235
                 $inputData['itemId']
@@ -2307,8 +2306,8 @@  discard block
 block discarded – undo
2307 2306
             // Manage Custom Fields
2308 2307
             $rows = DB::query(
2309 2308
                 'SELECT ci.id AS id, ci.data AS data, ci.field_id AS field_id, c.encrypted_data AS encrypted_data
2310
-                FROM ' . prefixTable('categories_items') . ' AS ci
2311
-                INNER JOIN ' . prefixTable('categories') . ' AS c ON (c.id = ci.field_id)
2309
+                FROM ' . prefixTable('categories_items').' AS ci
2310
+                INNER JOIN ' . prefixTable('categories').' AS c ON (c.id = ci.field_id)
2312 2311
                 WHERE ci.item_id = %i',
2313 2312
                 $inputData['itemId']
2314 2313
             );
@@ -2320,7 +2319,7 @@  discard block
 block discarded – undo
2320 2319
                     // Get user key
2321 2320
                     $userKey = DB::queryFirstRow(
2322 2321
                         'SELECT share_key
2323
-                        FROM ' . prefixTable('sharekeys_fields') . '
2322
+                        FROM ' . prefixTable('sharekeys_fields').'
2324 2323
                         WHERE user_id = %i AND object_id = %i',
2325 2324
                         $session->get('user-id'),
2326 2325
                         $field['id']
@@ -2387,15 +2386,15 @@  discard block
 block discarded – undo
2387 2386
             $rows = DB::query(
2388 2387
                 'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status, f.extension AS extension,
2389 2388
                 f.size AS size, f.type AS type, s.share_key AS share_key
2390
-                FROM ' . prefixTable('files') . ' AS f
2391
-                INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id)
2389
+                FROM ' . prefixTable('files').' AS f
2390
+                INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id)
2392 2391
                 WHERE s.user_id = %i AND f.id_item = %i',
2393 2392
                 $session->get('user-id'),
2394 2393
                 $inputData['itemId']
2395 2394
             );
2396 2395
             foreach ($rows as $record) {
2397 2396
                 // Check if file still exists
2398
-                if (file_exists($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . TP_FILE_PREFIX . base64_decode($record['file'])) === true) {
2397
+                if (file_exists($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.TP_FILE_PREFIX.base64_decode($record['file'])) === true) {
2399 2398
                     // Step1 - decrypt the file
2400 2399
                     // deepcode ignore PT: path is sanitized inside decryptFile()
2401 2400
                     $fileContent = decryptFile(
@@ -2406,8 +2405,8 @@  discard block
 block discarded – undo
2406 2405
 
2407 2406
                     // Step2 - create file
2408 2407
                     // deepcode ignore InsecureHash: md5 is used jonly for file name in order to get a hashed value in database
2409
-                    $newFileName = md5(time() . '_' . $record['id']) . '.' . $record['extension'];
2410
-                    $outstream = fopen($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . $newFileName, 'ab');
2408
+                    $newFileName = md5(time().'_'.$record['id']).'.'.$record['extension'];
2409
+                    $outstream = fopen($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.$newFileName, 'ab');
2411 2410
                     if ($outstream === false) {
2412 2411
                         echo prepareExchangedData(
2413 2412
                             array(
@@ -2480,7 +2479,7 @@  discard block
 block discarded – undo
2480 2479
 
2481 2480
             // -------------------------
2482 2481
             // Add specific restrictions
2483
-            $rows = DB::query('SELECT * FROM ' . prefixTable('restriction_to_roles') . ' WHERE item_id = %i', $inputData['itemId']);
2482
+            $rows = DB::query('SELECT * FROM '.prefixTable('restriction_to_roles').' WHERE item_id = %i', $inputData['itemId']);
2484 2483
             foreach ($rows as $record) {
2485 2484
                 DB::insert(
2486 2485
                     prefixTable('restriction_to_roles'),
@@ -2492,7 +2491,7 @@  discard block
 block discarded – undo
2492 2491
             }
2493 2492
 
2494 2493
             // Add Tags
2495
-            $rows = DB::query('SELECT * FROM ' . prefixTable('tags') . ' WHERE item_id = %i', $inputData['itemId']);
2494
+            $rows = DB::query('SELECT * FROM '.prefixTable('tags').' WHERE item_id = %i', $inputData['itemId']);
2496 2495
             foreach ($rows as $record) {
2497 2496
                 DB::insert(
2498 2497
                     prefixTable('tags'),
@@ -2594,7 +2593,7 @@  discard block
 block discarded – undo
2594 2593
         // then we can show it
2595 2594
         $item_deleted = DB::queryFirstRow(
2596 2595
             'SELECT *
2597
-            FROM ' . prefixTable('log_items') . '
2596
+            FROM ' . prefixTable('log_items').'
2598 2597
             WHERE id_item = %i AND action = %s
2599 2598
             ORDER BY date DESC
2600 2599
             LIMIT 0, 1',
@@ -2605,7 +2604,7 @@  discard block
 block discarded – undo
2605 2604
 
2606 2605
         $item_restored = DB::queryFirstRow(
2607 2606
             'SELECT *
2608
-            FROM ' . prefixTable('log_items') . '
2607
+            FROM ' . prefixTable('log_items').'
2609 2608
             WHERE id_item = %i AND action = %s
2610 2609
             ORDER BY date DESC
2611 2610
             LIMIT 0, 1',
@@ -2629,8 +2628,8 @@  discard block
 block discarded – undo
2629 2628
         // Get all informations for this item
2630 2629
         $dataItem = DB::queryFirstRow(
2631 2630
             'SELECT *
2632
-            FROM ' . prefixTable('items') . ' as i
2633
-            INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
2631
+            FROM ' . prefixTable('items').' as i
2632
+            INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
2634 2633
             WHERE i.id = %i AND l.action = %s',
2635 2634
             $inputData['id'],
2636 2635
             'at_creation'
@@ -2639,7 +2638,7 @@  discard block
 block discarded – undo
2639 2638
         // Notification
2640 2639
         DB::queryFirstRow(
2641 2640
             'SELECT *
2642
-            FROM ' . prefixTable('notification') . '
2641
+            FROM ' . prefixTable('notification').'
2643 2642
             WHERE item_id = %i AND user_id = %i',
2644 2643
             $inputData['id'],
2645 2644
             $session->get('user-id')
@@ -2658,7 +2657,7 @@  discard block
 block discarded – undo
2658 2657
 
2659 2658
         // manage case of API user
2660 2659
         if ($dataItem['id_user'] === API_USER_ID) {
2661
-            $arrData['author'] = 'API [' . $dataItem['description'] . ']';
2660
+            $arrData['author'] = 'API ['.$dataItem['description'].']';
2662 2661
             $arrData['id_user'] = API_USER_ID;
2663 2662
             $arrData['author_email'] = '';
2664 2663
             $arrData['notification_status'] = false;
@@ -2668,7 +2667,7 @@  discard block
 block discarded – undo
2668 2667
         $tags = array();
2669 2668
         $rows = DB::query(
2670 2669
             'SELECT tag
2671
-            FROM ' . prefixTable('tags') . '
2670
+            FROM ' . prefixTable('tags').'
2672 2671
             WHERE item_id = %i',
2673 2672
             $inputData['id']
2674 2673
         );
@@ -2693,7 +2692,7 @@  discard block
 block discarded – undo
2693 2692
         // Check if user has a role that is accepted
2694 2693
         $rows_tmp = DB::query(
2695 2694
             'SELECT role_id
2696
-            FROM ' . prefixTable('restriction_to_roles') . '
2695
+            FROM ' . prefixTable('restriction_to_roles').'
2697 2696
             WHERE item_id=%i',
2698 2697
             $inputData['id']
2699 2698
         );
@@ -2707,7 +2706,7 @@  discard block
 block discarded – undo
2707 2706
         // Get the object key for the user
2708 2707
         $userKey = DB::queryFirstRow(
2709 2708
             'SELECT share_key
2710
-            FROM ' . prefixTable('sharekeys_items') . '
2709
+            FROM ' . prefixTable('sharekeys_items').'
2711 2710
             WHERE user_id = %i AND object_id = %i',
2712 2711
             $session->get('user-id'),
2713 2712
             $inputData['id']
@@ -2804,8 +2803,8 @@  discard block
 block discarded – undo
2804 2803
                 // Add restriction if item is restricted to roles
2805 2804
                 $rows = DB::query(
2806 2805
                     'SELECT t.title, t.id
2807
-                    FROM ' . prefixTable('roles_title') . ' AS t
2808
-                    INNER JOIN ' . prefixTable('restriction_to_roles') . ' AS r ON (t.id=r.role_id)
2806
+                    FROM ' . prefixTable('roles_title').' AS t
2807
+                    INNER JOIN ' . prefixTable('restriction_to_roles').' AS r ON (t.id=r.role_id)
2809 2808
                     WHERE r.item_id = %i
2810 2809
                     ORDER BY t.title ASC',
2811 2810
                     $inputData['id']
@@ -2821,8 +2820,8 @@  discard block
 block discarded – undo
2821 2820
                 $tmp = array();
2822 2821
                 $rows = DB::query(
2823 2822
                     'SELECT k.label, k.id
2824
-                    FROM ' . prefixTable('kb_items') . ' as i
2825
-                    INNER JOIN ' . prefixTable('kb') . ' as k ON (i.kb_id=k.id)
2823
+                    FROM ' . prefixTable('kb_items').' as i
2824
+                    INNER JOIN ' . prefixTable('kb').' as k ON (i.kb_id=k.id)
2826 2825
                     WHERE i.item_id = %i
2827 2826
                     ORDER BY k.label ASC',
2828 2827
                     $inputData['id']
@@ -2905,7 +2904,7 @@  discard block
 block discarded – undo
2905 2904
                 $arrCatList = array();
2906 2905
                 $rows_tmp = DB::query(
2907 2906
                     'SELECT id_category
2908
-                    FROM ' . prefixTable('categories_folders') . '
2907
+                    FROM ' . prefixTable('categories_folders').'
2909 2908
                     WHERE id_folder=%i',
2910 2909
                     $inputData['folderId']
2911 2910
                 );
@@ -2920,8 +2919,8 @@  discard block
 block discarded – undo
2920 2919
                         'SELECT i.id AS id, i.field_id AS field_id, i.data AS data, i.item_id AS item_id,
2921 2920
                         i.encryption_type AS encryption_type, c.encrypted_data AS encrypted_data, c.parent_id AS parent_id,
2922 2921
                         c.type as field_type, c.masked AS field_masked, c.role_visibility AS role_visibility
2923
-                        FROM ' . prefixTable('categories_items') . ' AS i
2924
-                        INNER JOIN ' . prefixTable('categories') . ' AS c ON (i.field_id=c.id)
2922
+                        FROM ' . prefixTable('categories_items').' AS i
2923
+                        INNER JOIN ' . prefixTable('categories').' AS c ON (i.field_id=c.id)
2925 2924
                         WHERE i.item_id=%i AND c.parent_id IN %ls',
2926 2925
                         $inputData['id'],
2927 2926
                         $arrCatList
@@ -2932,7 +2931,7 @@  discard block
 block discarded – undo
2932 2931
                         //db::debugmode(true);
2933 2932
                         $userKey = DB::queryFirstRow(
2934 2933
                             'SELECT share_key
2935
-                            FROM ' . prefixTable('sharekeys_fields') . '
2934
+                            FROM ' . prefixTable('sharekeys_fields').'
2936 2935
                             WHERE user_id = %i AND object_id = %i',
2937 2936
                             $session->get('user-id'),
2938 2937
                             $row['id']
@@ -2950,7 +2949,7 @@  discard block
 block discarded – undo
2950 2949
                         } else if (DB::count() === 0 && (int) $row['encrypted_data'] === 0) {
2951 2950
                             // Data is not encrypted in DB
2952 2951
                             $fieldText = [
2953
-                                'string' => $row['data'],//#3945 - isBase64($row['data']) === true ? base64_decode($row['data']) : 
2952
+                                'string' => $row['data'], //#3945 - isBase64($row['data']) === true ? base64_decode($row['data']) : 
2954 2953
                                 'encrypted' => false,
2955 2954
                                 'error' => false,
2956 2955
                             ];
@@ -2995,7 +2994,7 @@  discard block
 block discarded – undo
2995 2994
             if (isset($SETTINGS['item_creation_templates']) && (int) $SETTINGS['item_creation_templates'] === 1) {
2996 2995
                 $rows_tmp = DB::queryFirstRow(
2997 2996
                     'SELECT category_id
2998
-                    FROM ' . prefixTable('templates') . '
2997
+                    FROM ' . prefixTable('templates').'
2999 2998
                     WHERE item_id = %i',
3000 2999
                     $inputData['id']
3001 3000
                 );
@@ -3012,7 +3011,7 @@  discard block
 block discarded – undo
3012 3011
             // Evaluate if item is ready for all users
3013 3012
             $rows_tmp = DB::queryFirstRow(
3014 3013
                 'SELECT finished_at
3015
-                FROM ' . prefixTable('background_tasks') . '
3014
+                FROM ' . prefixTable('background_tasks').'
3016 3015
                 WHERE item_id = %i',
3017 3016
                 $inputData['id']
3018 3017
             );
@@ -3029,7 +3028,7 @@  discard block
 block discarded – undo
3029 3028
                 // Is the Item to be deleted?
3030 3029
                 $dataDelete = DB::queryFirstRow(
3031 3030
                     'SELECT * 
3032
-                    FROM ' . prefixTable('automatic_del') . '
3031
+                    FROM ' . prefixTable('automatic_del').'
3033 3032
                     WHERE item_id = %i',
3034 3033
                     $inputData['id']
3035 3034
                 );
@@ -3110,14 +3109,14 @@  discard block
 block discarded – undo
3110 3109
                     if (empty($userRest) === false) {
3111 3110
                         $dataTmp = DB::queryFirstRow(
3112 3111
                             'SELECT login
3113
-                            FROM ' . prefixTable('users') . '
3112
+                            FROM ' . prefixTable('users').'
3114 3113
                             WHERE id= %i',
3115 3114
                             $userRest
3116 3115
                         );
3117 3116
                         if (empty($listOfRestricted)) {
3118 3117
                             $listOfRestricted = $dataTmp['login'];
3119 3118
                         } else {
3120
-                            $listOfRestricted .= ';' . $dataTmp['login'];
3119
+                            $listOfRestricted .= ';'.$dataTmp['login'];
3121 3120
                         }
3122 3121
                     }
3123 3122
                 }
@@ -3191,9 +3190,9 @@  discard block
 block discarded – undo
3191 3190
         // Load item data
3192 3191
         $dataItem = DB::queryFirstRow(
3193 3192
             'SELECT i.*, n.title AS folder_title, o.enabled AS otp_for_item_enabled, o.phone_number AS otp_phone_number, o.secret AS otp_secret
3194
-            FROM ' . prefixTable('items') . ' AS i
3195
-            INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (i.id_tree = n.id)
3196
-            LEFT JOIN ' . prefixTable('items_otp') . ' AS o ON (o.item_id = i.id)
3193
+            FROM ' . prefixTable('items').' AS i
3194
+            INNER JOIN ' . prefixTable('nested_tree').' AS n ON (i.id_tree = n.id)
3195
+            LEFT JOIN ' . prefixTable('items_otp').' AS o ON (o.item_id = i.id)
3197 3196
             WHERE i.id = %i',
3198 3197
             $inputData['id']
3199 3198
         );
@@ -3215,7 +3214,7 @@  discard block
 block discarded – undo
3215 3214
         // Check if user has a role that is accepted
3216 3215
         $rows_tmp = DB::query(
3217 3216
             'SELECT role_id
3218
-            FROM ' . prefixTable('restriction_to_roles') . '
3217
+            FROM ' . prefixTable('restriction_to_roles').'
3219 3218
             WHERE item_id=%i',
3220 3219
             $inputData['id']
3221 3220
         );
@@ -3247,12 +3246,12 @@  discard block
 block discarded – undo
3247 3246
             // launch query
3248 3247
             $rows = DB::query(
3249 3248
                 'SELECT id, name, file, extension, size
3250
-                FROM ' . prefixTable('files') . '
3249
+                FROM ' . prefixTable('files').'
3251 3250
                 WHERE id_item = %i AND confirmed = 1',
3252 3251
                 $inputData['id']
3253 3252
             );
3254 3253
             foreach ($rows as $record) {
3255
-                $filename = basename($record['name'], '.' . $record['extension']);
3254
+                $filename = basename($record['name'], '.'.$record['extension']);
3256 3255
                 $filename = isBase64($filename) === true ? base64_decode($filename) : $filename;
3257 3256
 
3258 3257
                 array_push(
@@ -3265,7 +3264,7 @@  discard block
 block discarded – undo
3265 3264
                         'is_image' => in_array(strtolower($record['extension']), TP_IMAGE_FILE_EXT) === true ? 1 : 0,
3266 3265
                         'id' => $record['id'],
3267 3266
                         'key' => $session->get('user-key_tmp'),
3268
-                        'internalFilename' => basename($record['name'], '.' . $record['extension']),
3267
+                        'internalFilename' => basename($record['name'], '.'.$record['extension']),
3269 3268
                     )
3270 3269
                 );
3271 3270
             }
@@ -3303,7 +3302,7 @@  discard block
 block discarded – undo
3303 3302
                     array(
3304 3303
                         'latest_items' => implode(';', $session->get('user-latest_items')),
3305 3304
                     ),
3306
-                    'id=' . $session->get('user-id')
3305
+                    'id='.$session->get('user-id')
3307 3306
                 );
3308 3307
             }
3309 3308
 
@@ -3312,8 +3311,8 @@  discard block
 block discarded – undo
3312 3311
             $listOptionsForRoles = array();
3313 3312
             $rows = DB::query(
3314 3313
                 'SELECT r.role_id AS role_id, t.title AS title
3315
-                FROM ' . prefixTable('roles_values') . ' AS r
3316
-                INNER JOIN ' . prefixTable('roles_title') . ' AS t ON (r.role_id = t.id)
3314
+                FROM ' . prefixTable('roles_values').' AS r
3315
+                INNER JOIN ' . prefixTable('roles_title').' AS t ON (r.role_id = t.id)
3317 3316
                 WHERE r.folder_id = %i',
3318 3317
                 $dataItem['id_tree']
3319 3318
             );
@@ -3327,9 +3326,9 @@  discard block
 block discarded – undo
3327 3326
                 );
3328 3327
                 $rows2 = DB::query(
3329 3328
                     'SELECT id, login, fonction_id, email, name, lastname
3330
-                    FROM ' . prefixTable('users') . '
3329
+                    FROM ' . prefixTable('users').'
3331 3330
                     WHERE fonction_id LIKE %s',
3332
-                    '%' . $record['role_id'] . '%'
3331
+                    '%'.$record['role_id'].'%'
3333 3332
                 );
3334 3333
                 foreach ($rows2 as $record2) {
3335 3334
                     foreach (explode(';', $record2['fonction_id']) as $role) {
@@ -3342,7 +3341,7 @@  discard block
 block discarded – undo
3342 3341
                                 array(
3343 3342
                                     'id' => (int) $record2['id'],
3344 3343
                                     'login' => $record2['login'],
3345
-                                    'name' => $record2['name'] . ' ' . $record2['lastname'],
3344
+                                    'name' => $record2['name'].' '.$record2['lastname'],
3346 3345
                                     'email' => $record2['email'],
3347 3346
                                 )
3348 3347
                             );
@@ -3361,16 +3360,16 @@  discard block
 block discarded – undo
3361 3360
                 $path = '';
3362 3361
                 foreach ($arbo as $elem) {
3363 3362
                     if (empty($path) === true) {
3364
-                        $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' ';
3363
+                        $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' ';
3365 3364
                     } else {
3366
-                        $path .= '&#8594; ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
3365
+                        $path .= '&#8594; '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
3367 3366
                     }
3368 3367
                 }
3369 3368
                 // Build text to show user
3370 3369
                 if (empty($path) === true) {
3371 3370
                     $path = addslashes($dataItem['label']);
3372 3371
                 } else {
3373
-                    $path = addslashes($dataItem['label']) . ' (' . $path . ')';
3372
+                    $path = addslashes($dataItem['label']).' ('.$path.')';
3374 3373
                 }
3375 3374
 
3376 3375
                 // Add Admins to notification list if expected
@@ -3393,7 +3392,7 @@  discard block
 block discarded – undo
3393 3392
                         array(
3394 3393
                             addslashes($session->get('user-login')),
3395 3394
                             $path,
3396
-                            $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $dataItem['id'],
3395
+                            $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$dataItem['id'],
3397 3396
                         ),
3398 3397
                         $lang->get('email_on_open_notification_mail')
3399 3398
                     ),
@@ -3403,7 +3402,7 @@  discard block
 block discarded – undo
3403 3402
             }
3404 3403
 
3405 3404
             // has this item a change proposal
3406
-            DB::query('SELECT * FROM ' . prefixTable('items_change') . ' WHERE item_id = %i', $inputData['id']);
3405
+            DB::query('SELECT * FROM '.prefixTable('items_change').' WHERE item_id = %i', $inputData['id']);
3407 3406
             $returnArray['has_change_proposal'] = DB::count();
3408 3407
 
3409 3408
             // Setting
@@ -3414,7 +3413,7 @@  discard block
 block discarded – undo
3414 3413
             if (isset($SETTINGS['otv_is_enabled']) === true && (int) $SETTINGS['otv_is_enabled'] === 1) {
3415 3414
                 DB::query(
3416 3415
                     'SELECT *
3417
-                    FROM ' . prefixTable('otv') . '
3416
+                    FROM ' . prefixTable('otv').'
3418 3417
                     WHERE item_id = %i
3419 3418
                     AND time_limit > %i',
3420 3419
                     $inputData['id'],
@@ -3513,7 +3512,7 @@  discard block
 block discarded – undo
3513 3512
         // Load item data
3514 3513
         $data = DB::queryFirstRow(
3515 3514
             'SELECT id_tree, id, label
3516
-            FROM ' . prefixTable('items') . '
3515
+            FROM ' . prefixTable('items').'
3517 3516
             WHERE id = %i OR item_key = %s',
3518 3517
             $inputData['itemId'],
3519 3518
             $inputData['itemKey']
@@ -3604,7 +3603,7 @@  discard block
 block discarded – undo
3604 3603
         // Load item data
3605 3604
         $dataItem = DB::queryFirstRow(
3606 3605
             'SELECT secret, enabled
3607
-            FROM ' . prefixTable('items_otp') . '
3606
+            FROM ' . prefixTable('items_otp').'
3608 3607
             WHERE item_id = %i',
3609 3608
             $inputData['id']
3610 3609
         );
@@ -3686,13 +3685,13 @@  discard block
 block discarded – undo
3686 3685
 
3687 3686
         // Check if user is allowed to access this folder
3688 3687
         if (!in_array($inputData['folderId'], $session->get('user-accessible_folders'))) {
3689
-            echo '[{"error" : "' . $lang->get('error_not_allowed_to') . '"}]';
3688
+            echo '[{"error" : "'.$lang->get('error_not_allowed_to').'"}]';
3690 3689
             break;
3691 3690
         }
3692 3691
 
3693 3692
         // Check if title doesn't contains html codes
3694 3693
         if (preg_match_all('|<[^>]+>(.*)</[^>]+>|U', $title, $out)) {
3695
-            echo '[ { "error" : "' . $lang->get('error_html_codes') . '" } ]';
3694
+            echo '[ { "error" : "'.$lang->get('error_html_codes').'" } ]';
3696 3695
             break;
3697 3696
         }
3698 3697
         // check that title is not numeric
@@ -3703,9 +3702,9 @@  discard block
 block discarded – undo
3703 3702
 
3704 3703
         // Check if duplicate folders name are allowed
3705 3704
         if (isset($SETTINGS['duplicate_folder']) && $SETTINGS['duplicate_folder'] === '0') {
3706
-            $data = DB::queryFirstRow('SELECT id, title FROM ' . prefixTable('nested_tree') . ' WHERE title = %s', $title);
3705
+            $data = DB::queryFirstRow('SELECT id, title FROM '.prefixTable('nested_tree').' WHERE title = %s', $title);
3707 3706
             if (empty($data['id']) === false && $dataReceived['folder'] !== $data['id']) {
3708
-                echo '[ { "error" : "' . $lang->get('error_group_exist') . '" } ]';
3707
+                echo '[ { "error" : "'.$lang->get('error_group_exist').'" } ]';
3709 3708
                 break;
3710 3709
             }
3711 3710
         }
@@ -3713,7 +3712,7 @@  discard block
 block discarded – undo
3713 3712
         // query on folder
3714 3713
         $data = DB::queryFirstRow(
3715 3714
             'SELECT parent_id, personal_folder
3716
-            FROM ' . prefixTable('nested_tree') . '
3715
+            FROM ' . prefixTable('nested_tree').'
3717 3716
             WHERE id = %i',
3718 3717
             $inputData['folderId']
3719 3718
         );
@@ -3723,20 +3722,20 @@  discard block
 block discarded – undo
3723 3722
         if ($session->get('user-admin') !== 1 && $session->get('user-manager') !== 1 && $data['personal_folder'] === '0') {
3724 3723
             $data = DB::queryFirstRow(
3725 3724
                 'SELECT valeur
3726
-                FROM ' . prefixTable('misc') . '
3725
+                FROM ' . prefixTable('misc').'
3727 3726
                 WHERE intitule = %i AND type = %s',
3728 3727
                 $data['parent_id'],
3729 3728
                 'complex'
3730 3729
             );
3731 3730
             if (intval($dataReceived['complexity']) < intval($data['valeur'])) {
3732
-                echo '[ { "error" : "' . $lang->get('error_folder_complexity_lower_than_top_folder') . ' [<b>' . TP_PW_COMPLEXITY[$data['valeur']][1] . '</b>]"} ]';
3731
+                echo '[ { "error" : "'.$lang->get('error_folder_complexity_lower_than_top_folder').' [<b>'.TP_PW_COMPLEXITY[$data['valeur']][1].'</b>]"} ]';
3733 3732
                 break;
3734 3733
             }
3735 3734
         }
3736 3735
 
3737 3736
         // update Folders table
3738 3737
         $tmp = DB::queryFirstRow(
3739
-            'SELECT title, parent_id, personal_folder FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
3738
+            'SELECT title, parent_id, personal_folder FROM '.prefixTable('nested_tree').' WHERE id = %i',
3740 3739
             $dataReceived['folder']
3741 3740
         );
3742 3741
         if ($tmp['parent_id'] !== 0 || $tmp['title'] !== $session->get('user-id') || $tmp['personal_folder'] !== 1) {
@@ -3850,7 +3849,7 @@  discard block
 block discarded – undo
3850 3849
             $uniqueLoadData['path'] = $arr_arbo;
3851 3850
 
3852 3851
             // store last folder accessed in cookie
3853
-            $arr_cookie_options = array (
3852
+            $arr_cookie_options = array(
3854 3853
                 'expires' => time() + TP_ONE_DAY_SECONDS * 5,
3855 3854
                 'path' => '/', 
3856 3855
                 'secure' => true,
@@ -3865,7 +3864,7 @@  discard block
 block discarded – undo
3865 3864
             foreach ($session->get('user-roles_array') as $role) {
3866 3865
                 $roleQ = DB::queryFirstRow(
3867 3866
                     'SELECT allow_pw_change
3868
-                    FROM ' . prefixTable('roles_title') . '
3867
+                    FROM ' . prefixTable('roles_title').'
3869 3868
                     WHERE id = %i',
3870 3869
                     $role
3871 3870
                 );
@@ -3896,11 +3895,11 @@  discard block
 block discarded – undo
3896 3895
                 
3897 3896
                 foreach ($session->get('user-roles_array') as $role) {
3898 3897
                     $access = DB::queryFirstRow(
3899
-                        'SELECT type FROM ' . prefixTable('roles_values') . ' WHERE role_id = %i AND folder_id = %i',
3898
+                        'SELECT type FROM '.prefixTable('roles_values').' WHERE role_id = %i AND folder_id = %i',
3900 3899
                         $role,
3901 3900
                         $inputData['id']
3902 3901
                     );
3903
-                    if (DB::count()>0) {
3902
+                    if (DB::count() > 0) {
3904 3903
                         if ($access['type'] === 'R') {
3905 3904
                             array_push($arrTmp, 10);
3906 3905
                         } elseif ($access['type'] === 'W') {
@@ -3965,7 +3964,7 @@  discard block
 block discarded – undo
3965 3964
             } else {
3966 3965
                 DB::query(
3967 3966
                     'SELECT *
3968
-                    FROM ' . prefixTable('items') . '
3967
+                    FROM ' . prefixTable('items').'
3969 3968
                     WHERE inactif = %i',
3970 3969
                     0
3971 3970
                 );
@@ -3975,7 +3974,7 @@  discard block
 block discarded – undo
3975 3974
 
3976 3975
             // Get folder complexity
3977 3976
             $folderComplexity = DB::queryFirstRow(
3978
-                'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %i',
3977
+                'SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %i',
3979 3978
                 'complex',
3980 3979
                 $inputData['id']
3981 3980
             );
@@ -3987,7 +3986,7 @@  discard block
 block discarded – undo
3987 3986
             if (isset($SETTINGS['item_extra_fields']) && (int) $SETTINGS['item_extra_fields'] === 1) {
3988 3987
                 $folderRow = DB::query(
3989 3988
                     'SELECT id_category
3990
-                    FROM ' . prefixTable('categories_folders') . '
3989
+                    FROM ' . prefixTable('categories_folders').'
3991 3990
                     WHERE id_folder = %i',
3992 3991
                     $inputData['id']
3993 3992
                 );
@@ -4102,15 +4101,15 @@  discard block
 block discarded – undo
4102 4101
             // List all ITEMS
4103 4102
             if ($folderIsPf === false) {
4104 4103
                 $where->add('i.inactif=%i', 0);
4105
-                $sql_e='(SELECT date FROM ' . prefixTable('log_items') 
4104
+                $sql_e = '(SELECT date FROM '.prefixTable('log_items') 
4106 4105
                     . " WHERE action = 'at_creation' AND id_item=i.id " 
4107
-                    . 'union all SELECT date FROM '. prefixTable('log_items') 
4106
+                    . 'union all SELECT date FROM '.prefixTable('log_items') 
4108 4107
                     . " WHERE action = 'at_modification' AND raison = 'at_pw'
4109 4108
                     AND id_item=i.id ORDER BY date DESC LIMIT 1)";
4110 4109
                 $where->add('l.date=%l', $sql_e);
4111 4110
 
4112
-                $query_limit = ' LIMIT ' .
4113
-                    $start . ',' .
4111
+                $query_limit = ' LIMIT '.
4112
+                    $start.','.
4114 4113
                     $post_nb_items_to_display_once;
4115 4114
                 //db::debugmode(true);
4116 4115
                 $rows = DB::query(
@@ -4122,9 +4121,9 @@  discard block
 block discarded – undo
4122 4121
                     l.id_user AS log_user,
4123 4122
                     i.url AS link,
4124 4123
                     i.email AS email
4125
-                    FROM ' . prefixTable('items') . ' AS i
4126
-                    INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (i.id_tree = n.id)
4127
-                    INNER JOIN ' . prefixTable('log_items') . ' AS l ON (i.id = l.id_item)
4124
+                    FROM ' . prefixTable('items').' AS i
4125
+                    INNER JOIN ' . prefixTable('nested_tree').' AS n ON (i.id_tree = n.id)
4126
+                    INNER JOIN ' . prefixTable('log_items').' AS l ON (i.id = l.id_item)
4128 4127
                     WHERE %l
4129 4128
                     GROUP BY i.id, l.date, l.id_user, l.action
4130 4129
                     ORDER BY i.label ASC, l.date DESC' . $query_limit,
@@ -4144,9 +4143,9 @@  discard block
 block discarded – undo
4144 4143
                     l.id_user AS log_user,
4145 4144
                     i.url AS link,
4146 4145
                     i.email AS email
4147
-                    FROM ' . prefixTable('items') . ' AS i
4148
-                    INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (i.id_tree = n.id)
4149
-                    INNER JOIN ' . prefixTable('log_items') . ' AS l ON (i.id = l.id_item)
4146
+                    FROM ' . prefixTable('items').' AS i
4147
+                    INNER JOIN ' . prefixTable('nested_tree').' AS n ON (i.id_tree = n.id)
4148
+                    INNER JOIN ' . prefixTable('log_items').' AS l ON (i.id = l.id_item)
4150 4149
                     WHERE %l
4151 4150
                     GROUP BY i.id, l.date, l.id_user, l.action
4152 4151
                     ORDER BY i.label ASC, l.date DESC',
@@ -4177,7 +4176,7 @@  discard block
 block discarded – undo
4177 4176
                     $item_is_restricted_to_role = false;
4178 4177
                     DB::queryFirstRow(
4179 4178
                         'SELECT role_id
4180
-                        FROM ' . prefixTable('restriction_to_roles') . '
4179
+                        FROM ' . prefixTable('restriction_to_roles').'
4181 4180
                         WHERE item_id = %i',
4182 4181
                         $record['id']
4183 4182
                     );
@@ -4189,7 +4188,7 @@  discard block
 block discarded – undo
4189 4188
                     $user_is_included_in_role = false;
4190 4189
                     DB::query(
4191 4190
                         'SELECT role_id
4192
-                        FROM ' . prefixTable('restriction_to_roles') . '
4191
+                        FROM ' . prefixTable('restriction_to_roles').'
4193 4192
                         WHERE item_id = %i AND role_id IN %ls',
4194 4193
                         $record['id'],
4195 4194
                         $session->get('user-roles_array')
@@ -4399,9 +4398,9 @@  discard block
 block discarded – undo
4399 4398
         if ((int) $start === 0) {
4400 4399
             DB::query(
4401 4400
                 'SELECT i.id
4402
-                FROM ' . prefixTable('items') . ' as i
4403
-                INNER JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree = n.id)
4404
-                INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id = l.id_item)
4401
+                FROM ' . prefixTable('items').' as i
4402
+                INNER JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree = n.id)
4403
+                INNER JOIN ' . prefixTable('log_items').' as l ON (i.id = l.id_item)
4405 4404
                 WHERE %l
4406 4405
                 ORDER BY i.label ASC, l.date DESC',
4407 4406
                 $where
@@ -4466,8 +4465,8 @@  discard block
 block discarded – undo
4466 4465
         $dataItem = DB::queryFirstRow(
4467 4466
             'SELECT i.pw AS pw, s.share_key AS share_key, i.id AS id,
4468 4467
                     i.label AS label, i.id_tree AS id_tree
4469
-            FROM ' . prefixTable('items') . ' AS i
4470
-            INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (s.object_id = i.id)
4468
+            FROM ' . prefixTable('items').' AS i
4469
+            INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (s.object_id = i.id)
4471 4470
             WHERE user_id = %i AND (i.item_key = %s OR i.id = %i)',
4472 4471
             $session->get('user-id'),
4473 4472
             $inputData['itemKey'] ?? '',
@@ -4576,7 +4575,7 @@  discard block
 block discarded – undo
4576 4575
         // do query on this folder
4577 4576
         $data_this_folder = DB::queryFirstRow(
4578 4577
             'SELECT id, personal_folder, title
4579
-            FROM ' . prefixTable('nested_tree') . '
4578
+            FROM ' . prefixTable('nested_tree').'
4580 4579
             WHERE id = %s',
4581 4580
             $inputData['folderId']
4582 4581
         );
@@ -4616,8 +4615,8 @@  discard block
 block discarded – undo
4616 4615
         $visibilite = '';
4617 4616
         $data = DB::queryFirstRow(
4618 4617
             'SELECT m.valeur, n.personal_folder
4619
-            FROM ' . prefixTable('misc') . ' AS m
4620
-            INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (m.intitule = n.id)
4618
+            FROM ' . prefixTable('misc').' AS m
4619
+            INNER JOIN ' . prefixTable('nested_tree').' AS n ON (m.intitule = n.id)
4621 4620
             WHERE type=%s AND intitule = %s',
4622 4621
             'complex',
4623 4622
             $inputData['folderId']
@@ -4630,8 +4629,8 @@  discard block
 block discarded – undo
4630 4629
             // Prepare Item actual visibility (what Users/Roles can see it)
4631 4630
             $rows = DB::query(
4632 4631
                 'SELECT t.title
4633
-                FROM ' . prefixTable('roles_values') . ' as v
4634
-                INNER JOIN ' . prefixTable('roles_title') . ' as t ON (v.role_id = t.id)
4632
+                FROM ' . prefixTable('roles_values').' as v
4633
+                INNER JOIN ' . prefixTable('roles_title').' as t ON (v.role_id = t.id)
4635 4634
                 WHERE v.folder_id = %i
4636 4635
                 GROUP BY title',
4637 4636
                 $inputData['folderId']
@@ -4640,7 +4639,7 @@  discard block
 block discarded – undo
4640 4639
                 if (empty($visibilite)) {
4641 4640
                     $visibilite = $record['title'];
4642 4641
                 } else {
4643
-                    $visibilite .= ' - ' . $record['title'];
4642
+                    $visibilite .= ' - '.$record['title'];
4644 4643
                 }
4645 4644
             }
4646 4645
         } else {
@@ -4650,14 +4649,14 @@  discard block
 block discarded – undo
4650 4649
             // do new query to know if current folder is pf
4651 4650
             $data_pf = DB::queryFirstRow(
4652 4651
                 'SELECT personal_folder
4653
-                FROM ' . prefixTable('nested_tree') . '
4652
+                FROM ' . prefixTable('nested_tree').'
4654 4653
                 WHERE id = %s',
4655 4654
                 $inputData['folderId']
4656 4655
             );
4657 4656
             
4658 4657
             $folder_is_personal = $data_pf !== null ? (int) $data_pf['personal_folder'] : 0;
4659 4658
             
4660
-            $visibilite = $session->get('user-name') . ' ' . $session->get('user-lastname') . ' (' . $session->get('user-login') . ')';
4659
+            $visibilite = $session->get('user-name').' '.$session->get('user-lastname').' ('.$session->get('user-login').')';
4661 4660
         }
4662 4661
 
4663 4662
         recupDroitCreationSansComplexite($inputData['folderId']);
@@ -4667,8 +4666,8 @@  discard block
 block discarded – undo
4667 4666
         $listOptionsForRoles = array();
4668 4667
         $rows = DB::query(
4669 4668
             'SELECT r.role_id AS role_id, t.title AS title
4670
-            FROM ' . prefixTable('roles_values') . ' AS r
4671
-            INNER JOIN ' . prefixTable('roles_title') . ' AS t ON (r.role_id = t.id)
4669
+            FROM ' . prefixTable('roles_values').' AS r
4670
+            INNER JOIN ' . prefixTable('roles_title').' AS t ON (r.role_id = t.id)
4672 4671
             WHERE r.folder_id = %i',
4673 4672
             $inputData['folderId']
4674 4673
         );
@@ -4682,7 +4681,7 @@  discard block
 block discarded – undo
4682 4681
             );
4683 4682
             $rows2 = DB::query(
4684 4683
                 'SELECT id, login, fonction_id, email, name, lastname
4685
-                FROM ' . prefixTable('users') . '
4684
+                FROM ' . prefixTable('users').'
4686 4685
                 WHERE admin = 0 AND fonction_id is not null'
4687 4686
             );
4688 4687
             foreach ($rows2 as $record2) {
@@ -4696,7 +4695,7 @@  discard block
 block discarded – undo
4696 4695
                             array(
4697 4696
                                 'id' => $record2['id'],
4698 4697
                                 'login' => $record2['login'],
4699
-                                'name' => $record2['name'] . ' ' . $record2['lastname'],
4698
+                                'name' => $record2['name'].' '.$record2['lastname'],
4700 4699
                                 'email' => $record2['email'],
4701 4700
                             )
4702 4701
                         );
@@ -4713,13 +4712,13 @@  discard block
 block discarded – undo
4713 4712
                 //db::debugmode(true);
4714 4713
                 $access = DB::queryFirstRow(
4715 4714
                     'SELECT type
4716
-                    FROM ' . prefixTable('roles_values') . '
4715
+                    FROM ' . prefixTable('roles_values').'
4717 4716
                     WHERE role_id = %i AND folder_id = %i',
4718 4717
                     $role,
4719 4718
                     $inputData['folderId']
4720 4719
                 );
4721 4720
                 //db::debugmode(false);
4722
-                if (DB::count()>0) {
4721
+                if (DB::count() > 0) {
4723 4722
                     if ($access['type'] === 'R') {
4724 4723
                         array_push($arrTmp, 10);
4725 4724
                     } elseif ($access['type'] === 'W') {
@@ -4747,7 +4746,7 @@  discard block
 block discarded – undo
4747 4746
             // Check if personal folder is owned by user
4748 4747
             $folder = DB::queryFirstRow(
4749 4748
                 'SELECT id
4750
-                FROM ' . prefixTable('nested_tree') . '
4749
+                FROM ' . prefixTable('nested_tree').'
4751 4750
                 WHERE title = %s',
4752 4751
                 $session->get('user-id'),
4753 4752
             );
@@ -4852,7 +4851,7 @@  discard block
 block discarded – undo
4852 4851
         // Get some info before deleting
4853 4852
         $data = DB::queryFirstRow(
4854 4853
             'SELECT name, id_item, file
4855
-            FROM ' . prefixTable('files') . '
4854
+            FROM ' . prefixTable('files').'
4856 4855
             WHERE id = %i',
4857 4856
             $fileId
4858 4857
         );
@@ -4860,7 +4859,7 @@  discard block
 block discarded – undo
4860 4859
         // Load item data
4861 4860
         $data_item = DB::queryFirstRow(
4862 4861
             'SELECT id_tree
4863
-            FROM ' . prefixTable('items') . '
4862
+            FROM ' . prefixTable('items').'
4864 4863
             WHERE id = %i',
4865 4864
             $data['id_item']
4866 4865
         );
@@ -4890,7 +4889,7 @@  discard block
 block discarded – undo
4890 4889
                 $session->get('user-id'),
4891 4890
                 'at_modification',
4892 4891
                 $session->get('user-login'),
4893
-                'at_del_file : ' . $data['name']
4892
+                'at_del_file : '.$data['name']
4894 4893
             );
4895 4894
 
4896 4895
             // DElete sharekeys
@@ -4901,7 +4900,7 @@  discard block
 block discarded – undo
4901 4900
             );
4902 4901
 
4903 4902
             // Delete file from server
4904
-            $fileToDelete = $SETTINGS['path_to_upload_folder'] . '/' . TP_FILE_PREFIX . base64_decode($data['file']);
4903
+            $fileToDelete = $SETTINGS['path_to_upload_folder'].'/'.TP_FILE_PREFIX.base64_decode($data['file']);
4905 4904
             $fileToDelete = realpath($fileToDelete);
4906 4905
             if ($fileToDelete && strpos($fileToDelete, $SETTINGS['path_to_upload_folder']) === 0) {
4907 4906
                 fileDelete($fileToDelete, $SETTINGS);
@@ -4955,7 +4954,7 @@  discard block
 block discarded – undo
4955 4954
             // Update SESSION with this new favourite
4956 4955
             $data = DB::queryFirstRow(
4957 4956
                 'SELECT label,id_tree
4958
-                FROM ' . prefixTable('items') . '
4957
+                FROM ' . prefixTable('items').'
4959 4958
                 WHERE id = %i',
4960 4959
                 $inputData['itemId']
4961 4960
             );
@@ -4964,7 +4963,7 @@  discard block
 block discarded – undo
4964 4963
                 [
4965 4964
                     $inputData['itemId'] => [
4966 4965
                         'label' => $data['label'],
4967
-                        'url' => 'index.php?page=items&amp;group=' . $data['id_tree'] . '&amp;id=' . $inputData['itemId'],
4966
+                        'url' => 'index.php?page=items&amp;group='.$data['id_tree'].'&amp;id='.$inputData['itemId'],
4968 4967
                     ],
4969 4968
                 ],
4970 4969
                 'add'
@@ -5033,8 +5032,8 @@  discard block
 block discarded – undo
5033 5032
         // get data about item
5034 5033
         $dataSource = DB::queryFirstRow(
5035 5034
             'SELECT i.pw, f.personal_folder,i.id_tree, f.title,i.label
5036
-            FROM ' . prefixTable('items') . ' as i
5037
-            INNER JOIN ' . prefixTable('nested_tree') . ' as f ON (i.id_tree=f.id)
5035
+            FROM ' . prefixTable('items').' as i
5036
+            INNER JOIN ' . prefixTable('nested_tree').' as f ON (i.id_tree=f.id)
5038 5037
             WHERE i.id=%i',
5039 5038
             $inputData['itemId']
5040 5039
         );
@@ -5078,7 +5077,7 @@  discard block
 block discarded – undo
5078 5077
         // get data about new folder
5079 5078
         $dataDestination = DB::queryFirstRow(
5080 5079
             'SELECT personal_folder, title
5081
-            FROM ' . prefixTable('nested_tree') . '
5080
+            FROM ' . prefixTable('nested_tree').'
5082 5081
             WHERE id = %i',
5083 5082
             $inputData['folderId']
5084 5083
         );
@@ -5131,7 +5130,7 @@  discard block
 block discarded – undo
5131 5130
             // Get fields for this Item
5132 5131
             $rows = DB::query(
5133 5132
                 'SELECT id
5134
-                FROM ' . prefixTable('categories_items') . '
5133
+                FROM ' . prefixTable('categories_items').'
5135 5134
                 WHERE item_id = %i',
5136 5135
                 $inputData['itemId']
5137 5136
             );
@@ -5148,7 +5147,7 @@  discard block
 block discarded – undo
5148 5147
             // Get FILES for this Item
5149 5148
             $rows = DB::query(
5150 5149
                 'SELECT id
5151
-                FROM ' . prefixTable('files') . '
5150
+                FROM ' . prefixTable('files').'
5152 5151
                 WHERE id_item = %i',
5153 5152
                 $inputData['itemId']
5154 5153
             );
@@ -5195,7 +5194,7 @@  discard block
 block discarded – undo
5195 5194
             // Get the ITEM object key for the user
5196 5195
             $userKey = DB::queryFirstRow(
5197 5196
                 'SELECT share_key
5198
-                FROM ' . prefixTable('sharekeys_items') . '
5197
+                FROM ' . prefixTable('sharekeys_items').'
5199 5198
                 WHERE user_id = %i AND object_id = %i',
5200 5199
                 $session->get('user-id'),
5201 5200
                 $inputData['itemId']
@@ -5206,7 +5205,7 @@  discard block
 block discarded – undo
5206 5205
                 // This is a public object
5207 5206
                 $users = DB::query(
5208 5207
                     'SELECT id, public_key
5209
-                    FROM ' . prefixTable('users') . '
5208
+                    FROM ' . prefixTable('users').'
5210 5209
                     WHERE id NOT IN %li
5211 5210
                     AND public_key != ""',
5212 5211
                     $tpUsersIDs
@@ -5229,14 +5228,14 @@  discard block
 block discarded – undo
5229 5228
             // Get fields for this Item
5230 5229
             $rows = DB::query(
5231 5230
                 'SELECT id
5232
-                FROM ' . prefixTable('categories_items') . '
5231
+                FROM ' . prefixTable('categories_items').'
5233 5232
                 WHERE item_id = %i',
5234 5233
                 $inputData['itemId']
5235 5234
             );
5236 5235
             foreach ($rows as $field) {
5237 5236
                 $userKey = DB::queryFirstRow(
5238 5237
                     'SELECT share_key
5239
-                    FROM ' . prefixTable('sharekeys_fields') . '
5238
+                    FROM ' . prefixTable('sharekeys_fields').'
5240 5239
                     WHERE user_id = %i AND object_id = %i',
5241 5240
                     $session->get('user-id'),
5242 5241
                     $field['id']
@@ -5247,7 +5246,7 @@  discard block
 block discarded – undo
5247 5246
                     // This is a public object
5248 5247
                     $users = DB::query(
5249 5248
                         'SELECT id, public_key
5250
-                        FROM ' . prefixTable('users') . '
5249
+                        FROM ' . prefixTable('users').'
5251 5250
                         WHERE id NOT IN %li
5252 5251
                         AND public_key != ""',
5253 5252
                         $tpUsersIDs
@@ -5270,14 +5269,14 @@  discard block
 block discarded – undo
5270 5269
             // Get FILES for this Item
5271 5270
             $rows = DB::query(
5272 5271
                 'SELECT id
5273
-                FROM ' . prefixTable('files') . '
5272
+                FROM ' . prefixTable('files').'
5274 5273
                 WHERE id_item = %i',
5275 5274
                 $inputData['itemId']
5276 5275
             );
5277 5276
             foreach ($rows as $attachment) {
5278 5277
                 $userKey = DB::queryFirstRow(
5279 5278
                     'SELECT share_key
5280
-                    FROM ' . prefixTable('sharekeys_files') . '
5279
+                    FROM ' . prefixTable('sharekeys_files').'
5281 5280
                     WHERE user_id = %i AND object_id = %i',
5282 5281
                     $session->get('user-id'),
5283 5282
                     $attachment['id']
@@ -5288,7 +5287,7 @@  discard block
 block discarded – undo
5288 5287
                     // This is a public object
5289 5288
                     $users = DB::query(
5290 5289
                         'SELECT id, public_key
5291
-                        FROM ' . prefixTable('users') . '
5290
+                        FROM ' . prefixTable('users').'
5292 5291
                         WHERE id NOT IN %li
5293 5292
                         AND public_key != ""',
5294 5293
                         $tpUsersIDs
@@ -5329,7 +5328,7 @@  discard block
 block discarded – undo
5329 5328
             $session->get('user-id'),
5330 5329
             'at_modification',
5331 5330
             $session->get('user-login'),
5332
-            'at_moved : ' . $dataSource['title'] . ' -> ' . $dataDestination['title']
5331
+            'at_moved : '.$dataSource['title'].' -> '.$dataDestination['title']
5333 5332
         );
5334 5333
 
5335 5334
         // Update cache table
@@ -5388,8 +5387,8 @@  discard block
 block discarded – undo
5388 5387
                 // get data about item
5389 5388
                 $dataSource = DB::queryFirstRow(
5390 5389
                     'SELECT i.pw, f.personal_folder,i.id_tree, f.title,i.label
5391
-                    FROM ' . prefixTable('items') . ' as i
5392
-                    INNER JOIN ' . prefixTable('nested_tree') . ' as f ON (i.id_tree=f.id)
5390
+                    FROM ' . prefixTable('items').' as i
5391
+                    INNER JOIN ' . prefixTable('nested_tree').' as f ON (i.id_tree=f.id)
5393 5392
                     WHERE i.id=%i',
5394 5393
                     $item_id
5395 5394
                 );
@@ -5411,7 +5410,7 @@  discard block
 block discarded – undo
5411 5410
 
5412 5411
                 // get data about new folder
5413 5412
                 $dataDestination = DB::queryFirstRow(
5414
-                    'SELECT personal_folder, title FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
5413
+                    'SELECT personal_folder, title FROM '.prefixTable('nested_tree').' WHERE id = %i',
5415 5414
                     $inputData['folderId']
5416 5415
                 );
5417 5416
 
@@ -5453,7 +5452,7 @@  discard block
 block discarded – undo
5453 5452
                     // Get fields for this Item
5454 5453
                     $rows = DB::query(
5455 5454
                         'SELECT id
5456
-                        FROM ' . prefixTable('categories_items') . '
5455
+                        FROM ' . prefixTable('categories_items').'
5457 5456
                         WHERE item_id = %i',
5458 5457
                         $item_id
5459 5458
                     );
@@ -5470,7 +5469,7 @@  discard block
 block discarded – undo
5470 5469
                     // Get FILES for this Item
5471 5470
                     $rows = DB::query(
5472 5471
                         'SELECT id
5473
-                        FROM ' . prefixTable('files') . '
5472
+                        FROM ' . prefixTable('files').'
5474 5473
                         WHERE id_item = %i',
5475 5474
                         $item_id
5476 5475
                     );
@@ -5525,7 +5524,7 @@  discard block
 block discarded – undo
5525 5524
                     // Get the ITEM object key for the user
5526 5525
                     $userKey = DB::queryFirstRow(
5527 5526
                         'SELECT share_key
5528
-                        FROM ' . prefixTable('sharekeys_items') . '
5527
+                        FROM ' . prefixTable('sharekeys_items').'
5529 5528
                         WHERE user_id = %i AND object_id = %i',
5530 5529
                         $session->get('user-id'),
5531 5530
                         $item_id
@@ -5536,7 +5535,7 @@  discard block
 block discarded – undo
5536 5535
                         // This is a public object
5537 5536
                         $users = DB::query(
5538 5537
                             'SELECT id, public_key
5539
-                            FROM ' . prefixTable('users') . '
5538
+                            FROM ' . prefixTable('users').'
5540 5539
                             WHERE id NOT IN %li
5541 5540
                             AND public_key != ""',
5542 5541
                             $tpUsersIDs
@@ -5559,14 +5558,14 @@  discard block
 block discarded – undo
5559 5558
                     // Get fields for this Item
5560 5559
                     $rows = DB::query(
5561 5560
                         'SELECT id
5562
-                        FROM ' . prefixTable('categories_items') . '
5561
+                        FROM ' . prefixTable('categories_items').'
5563 5562
                         WHERE item_id = %i',
5564 5563
                         $item_id
5565 5564
                     );
5566 5565
                     foreach ($rows as $field) {
5567 5566
                         $userKey = DB::queryFirstRow(
5568 5567
                             'SELECT share_key
5569
-                            FROM ' . prefixTable('sharekeys_fields') . '
5568
+                            FROM ' . prefixTable('sharekeys_fields').'
5570 5569
                             WHERE user_id = %i AND object_id = %i',
5571 5570
                             $session->get('user-id'),
5572 5571
                             $field['id']
@@ -5577,7 +5576,7 @@  discard block
 block discarded – undo
5577 5576
                             // This is a public object
5578 5577
                             $users = DB::query(
5579 5578
                                 'SELECT id, public_key
5580
-                                FROM ' . prefixTable('users') . '
5579
+                                FROM ' . prefixTable('users').'
5581 5580
                                 WHERE id NOT IN %li
5582 5581
                                 AND public_key != ""',
5583 5582
                                 $tpUsersIDs
@@ -5601,14 +5600,14 @@  discard block
 block discarded – undo
5601 5600
                     // Get FILES for this Item
5602 5601
                     $rows = DB::query(
5603 5602
                         'SELECT id
5604
-                        FROM ' . prefixTable('files') . '
5603
+                        FROM ' . prefixTable('files').'
5605 5604
                         WHERE id_item = %i',
5606 5605
                         $item_id
5607 5606
                     );
5608 5607
                     foreach ($rows as $attachment) {
5609 5608
                         $userKey = DB::queryFirstRow(
5610 5609
                             'SELECT share_key
5611
-                            FROM ' . prefixTable('sharekeys_files') . '
5610
+                            FROM ' . prefixTable('sharekeys_files').'
5612 5611
                             WHERE user_id = %i AND object_id = %i',
5613 5612
                             $session->get('user-id'),
5614 5613
                             $attachment['id']
@@ -5619,7 +5618,7 @@  discard block
 block discarded – undo
5619 5618
                             // This is a public object
5620 5619
                             $users = DB::query(
5621 5620
                                 'SELECT id, public_key
5622
-                                FROM ' . prefixTable('users') . '
5621
+                                FROM ' . prefixTable('users').'
5623 5622
                                 WHERE id NOT IN %li
5624 5623
                                 AND public_key != ""',
5625 5624
                                 $tpUsersIDs
@@ -5659,13 +5658,13 @@  discard block
 block discarded – undo
5659 5658
                     $session->get('user-id'),
5660 5659
                     'at_modification',
5661 5660
                     $session->get('user-login'),
5662
-                    'at_moved : ' . $dataSource['title'] . ' -> ' . $dataDestination['title']
5661
+                    'at_moved : '.$dataSource['title'].' -> '.$dataDestination['title']
5663 5662
                 );
5664 5663
             }
5665 5664
         }
5666 5665
 
5667 5666
         // reload cache table
5668
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
5667
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
5669 5668
         updateCacheTable('reload', null);
5670 5669
 
5671 5670
         echo (string) prepareExchangedData(
@@ -5729,7 +5728,7 @@  discard block
 block discarded – undo
5729 5728
                 // get info
5730 5729
                 $dataSource = DB::queryFirstRow(
5731 5730
                     'SELECT label, id_tree
5732
-                    FROM ' . prefixTable('items') . '
5731
+                    FROM ' . prefixTable('items').'
5733 5732
                     WHERE id=%i',
5734 5733
                     $item_id
5735 5734
                 );
@@ -5830,14 +5829,14 @@  discard block
 block discarded – undo
5830 5829
             // Variables
5831 5830
             $dataAuthor = DB::queryFirstRow(
5832 5831
                 'SELECT email,login
5833
-                FROM ' . prefixTable('users') . '
5832
+                FROM ' . prefixTable('users').'
5834 5833
                 WHERE id = %i',
5835 5834
                 $post_content[1]
5836 5835
             );
5837 5836
 
5838 5837
             $dataItem = DB::queryFirstRow(
5839 5838
                 'SELECT label, id_tree
5840
-                FROM ' . prefixTable('items') . '
5839
+                FROM ' . prefixTable('items').'
5841 5840
                 WHERE id = %i',
5842 5841
                 $post_content[0]
5843 5842
             );
@@ -5854,7 +5853,7 @@  discard block
 block discarded – undo
5854 5853
                 $lang->get('email_request_access_subject'),
5855 5854
                 str_replace(
5856 5855
                     array('#tp_item_author#', '#tp_user#', '#tp_item#'),
5857
-                    array(' ' . addslashes($dataAuthor['login']), addslashes($session->get('user-login')), $path),
5856
+                    array(' '.addslashes($dataAuthor['login']), addslashes($session->get('user-login')), $path),
5858 5857
                     $lang->get('email_request_access_mail')
5859 5858
                 ),
5860 5859
                 $dataAuthor['email'],
@@ -5863,7 +5862,7 @@  discard block
 block discarded – undo
5863 5862
         } elseif ($inputData['cat'] === 'share_this_item') {
5864 5863
             $dataItem = DB::queryFirstRow(
5865 5864
                 'SELECT label,id_tree
5866
-                FROM ' . prefixTable('items') . '
5865
+                FROM ' . prefixTable('items').'
5867 5866
                 WHERE id= %i',
5868 5867
                 $inputData['id']
5869 5868
             );
@@ -5886,7 +5885,7 @@  discard block
 block discarded – undo
5886 5885
                     ),
5887 5886
                     array(
5888 5887
                         empty($SETTINGS['email_server_url']) === false ?
5889
-                            $SETTINGS['email_server_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $inputData['id'] : $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $inputData['id'],
5888
+                            $SETTINGS['email_server_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$inputData['id'] : $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$inputData['id'],
5890 5889
                         addslashes($session->get('user-login')),
5891 5890
                         addslashes($path),
5892 5891
                     ),
@@ -5935,8 +5934,8 @@  discard block
 block discarded – undo
5935 5934
         // Get all informations for this item
5936 5935
         $dataItem = DB::queryFirstRow(
5937 5936
             'SELECT *
5938
-            FROM ' . prefixTable('items') . ' as i
5939
-            INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
5937
+            FROM ' . prefixTable('items').' as i
5938
+            INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
5940 5939
             WHERE i.id=%i AND l.action = %s',
5941 5940
             $item_id,
5942 5941
             'at_creation'
@@ -5965,18 +5964,18 @@  discard block
 block discarded – undo
5965 5964
                 $session->get('user-login'),
5966 5965
                 htmlspecialchars_decode($label, ENT_QUOTES),
5967 5966
                 null,
5968
-                (string) dateToStamp($date.' '.$time, $SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'])
5967
+                (string) dateToStamp($date.' '.$time, $SETTINGS['date_format'].' '.$SETTINGS['time_format'])
5969 5968
             );
5970 5969
             // Prepare new line
5971 5970
             $data = DB::queryFirstRow(
5972
-                'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i ORDER BY date DESC',
5971
+                'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i ORDER BY date DESC',
5973 5972
                 $item_id
5974 5973
             );
5975
-            $historic = date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $data['date']) . ' - ' . $session->get('user-login') . ' - ' . $lang->get($data['action']) . ' - ' . $data['raison'];
5974
+            $historic = date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $data['date']).' - '.$session->get('user-login').' - '.$lang->get($data['action']).' - '.$data['raison'];
5976 5975
             // send back
5977 5976
             $data = array(
5978 5977
                 'error' => '',
5979
-                'new_line' => '<br>' . addslashes($historic),
5978
+                'new_line' => '<br>'.addslashes($historic),
5980 5979
             );
5981 5980
             echo (string) prepareExchangedData(
5982 5981
                 $data,
@@ -6051,8 +6050,8 @@  discard block
 block discarded – undo
6051 6050
         // Should we log a password change?
6052 6051
         $itemQ = DB::queryFirstRow(
6053 6052
             'SELECT s.share_key, i.pw
6054
-            FROM ' . prefixTable('items') . ' AS i
6055
-            INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (i.id = s.object_id)
6053
+            FROM ' . prefixTable('items').' AS i
6054
+            INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (i.id = s.object_id)
6056 6055
             WHERE s.user_id = %i AND s.object_id = %i',
6057 6056
             $session->get('user-id'),
6058 6057
             $dataReceived['id']
@@ -6107,7 +6106,7 @@  discard block
 block discarded – undo
6107 6106
         if (isset($SETTINGS['otv_expiration_period']) === false) {
6108 6107
             $SETTINGS['otv_expiration_period'] = 7;
6109 6108
         }
6110
-        $url = $SETTINGS['cpassman_url'] . '/index.php?' . http_build_query($otv_session);
6109
+        $url = $SETTINGS['cpassman_url'].'/index.php?'.http_build_query($otv_session);
6111 6110
 
6112 6111
         echo json_encode(
6113 6112
             array(
@@ -6138,7 +6137,7 @@  discard block
 block discarded – undo
6138 6137
         // get parameters from original link
6139 6138
         $url = $dataReceived['original_link'];
6140 6139
         $parts = parse_url($url);
6141
-        if(isset($parts['query'])){
6140
+        if (isset($parts['query'])) {
6142 6141
             parse_str($parts['query'], $orignal_link_parameters);
6143 6142
         } else {
6144 6143
             $orignal_link_parameters = array();
@@ -6169,13 +6168,13 @@  discard block
 block discarded – undo
6169 6168
             $domain_scheme = parse_url($SETTINGS['cpassman_url'], PHP_URL_SCHEME);
6170 6169
             $domain_host = parse_url($SETTINGS['cpassman_url'], PHP_URL_HOST);
6171 6170
             if (str_contains($domain_host, 'www.') === true) {
6172
-                $domain_host = (string) $SETTINGS['otv_subdomain'] . '.' . substr($domain_host, 4);
6171
+                $domain_host = (string) $SETTINGS['otv_subdomain'].'.'.substr($domain_host, 4);
6173 6172
             } else {
6174
-                $domain_host = (string) $SETTINGS['otv_subdomain'] . '.' . $domain_host;
6173
+                $domain_host = (string) $SETTINGS['otv_subdomain'].'.'.$domain_host;
6175 6174
             }
6176
-            $url = $domain_scheme.'://'.$domain_host . '/index.php?'.http_build_query($otv_session);
6175
+            $url = $domain_scheme.'://'.$domain_host.'/index.php?'.http_build_query($otv_session);
6177 6176
         } else {
6178
-            $url = $SETTINGS['cpassman_url'] . '/index.php?'.http_build_query($otv_session);
6177
+            $url = $SETTINGS['cpassman_url'].'/index.php?'.http_build_query($otv_session);
6179 6178
         }
6180 6179
 
6181 6180
         echo (string) prepareExchangedData(
@@ -6210,8 +6209,8 @@  discard block
 block discarded – undo
6210 6209
             'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status,
6211 6210
             f.extension AS extension, f.type AS type,
6212 6211
             s.share_key AS share_key
6213
-            FROM ' . prefixTable('files') . ' AS f
6214
-            INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id)
6212
+            FROM ' . prefixTable('files').' AS f
6213
+            INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id)
6215 6214
             WHERE s.user_id = %i AND s.object_id = %i',
6216 6215
             $session->get('user-id'),
6217 6216
             $inputData['id']
@@ -6232,7 +6231,7 @@  discard block
 block discarded – undo
6232 6231
         //$fileName = basename($file_info['name'], '.'.$file_info['extension']);
6233 6232
 
6234 6233
         // prepare image info
6235
-        $post_title = basename($file_info['name'], '.' . $file_info['extension']);
6234
+        $post_title = basename($file_info['name'], '.'.$file_info['extension']);
6236 6235
         $post_title = isBase64($post_title) === true ? base64_decode($post_title) : $post_title;
6237 6236
         
6238 6237
         // Get image content
@@ -6259,7 +6258,7 @@  discard block
 block discarded – undo
6259 6258
         echo (string) prepareExchangedData(
6260 6259
             array(
6261 6260
                 'error' => false,
6262
-                'filename' => $post_title . '.' . $file_info['extension'],
6261
+                'filename' => $post_title.'.'.$file_info['extension'],
6263 6262
                 'file_type' => $file_info['type'],
6264 6263
                 'file_content' => $fileContent,
6265 6264
             ),
@@ -6373,7 +6372,7 @@  discard block
 block discarded – undo
6373 6372
                     $arbo = $tree->getPath($folder->id, false);
6374 6373
                     $path = '';
6375 6374
                     foreach ($arbo as $elem) {
6376
-                        $path = (empty($path) ? '' : $path . ' / ') . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
6375
+                        $path = (empty($path) ? '' : $path.' / ').htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
6377 6376
                     }
6378 6377
 
6379 6378
                     // Build array
@@ -6442,7 +6441,7 @@  discard block
 block discarded – undo
6442 6441
         if (is_array($foldersArray) === true && $inputData['data'] !== '[null]') {
6443 6442
             $rows = DB::query(
6444 6443
                 'SELECT id, categories
6445
-                FROM ' . prefixTable('nested_tree') . '
6444
+                FROM ' . prefixTable('nested_tree').'
6446 6445
                 WHERE id IN (%l)',
6447 6446
                 implode(',', $foldersArray)
6448 6447
             );
@@ -6484,7 +6483,7 @@  discard block
 block discarded – undo
6484 6483
         // get item info
6485 6484
         $dataItem = DB::queryFirstRow(
6486 6485
             'SELECT *
6487
-            FROM ' . prefixTable('items') . '
6486
+            FROM ' . prefixTable('items').'
6488 6487
             WHERE id=%i',
6489 6488
             $inputData['itemId']
6490 6489
         );
@@ -6496,8 +6495,8 @@  discard block
 block discarded – undo
6496 6495
             'SELECT l.date as date, l.action as action, l.raison as raison,
6497 6496
                 u.login as login, u.avatar_thumb as avatar_thumb, u.name as name, u.lastname as lastname,
6498 6497
                 l.old_value as old_value
6499
-            FROM ' . prefixTable('log_items') . ' as l
6500
-            INNER JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id)
6498
+            FROM ' . prefixTable('log_items').' as l
6499
+            INNER JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id)
6501 6500
             WHERE id_item=%i AND l.action NOT IN (%l)
6502 6501
             ORDER BY date DESC',
6503 6502
             $inputData['itemId'],
@@ -6512,18 +6511,18 @@  discard block
 block discarded – undo
6512 6511
             
6513 6512
             // imported via API
6514 6513
             if (empty($record['login']) === true) {
6515
-                $record['login'] = $lang->get('imported_via_api') . ' [' . $record['raison'] . ']';
6514
+                $record['login'] = $lang->get('imported_via_api').' ['.$record['raison'].']';
6516 6515
             }
6517 6516
             
6518 6517
             // Prepare avatar
6519 6518
             if (isset($record['avatar_thumb']) && empty($record['avatar_thumb']) === false) {
6520
-                if (file_exists($SETTINGS['cpassman_dir'] . '/includes/avatars/' . $record['avatar_thumb'])) {
6521
-                    $avatar = $SETTINGS['cpassman_url'] . '/includes/avatars/' . $record['avatar_thumb'];
6519
+                if (file_exists($SETTINGS['cpassman_dir'].'/includes/avatars/'.$record['avatar_thumb'])) {
6520
+                    $avatar = $SETTINGS['cpassman_url'].'/includes/avatars/'.$record['avatar_thumb'];
6522 6521
                 } else {
6523
-                    $avatar = $SETTINGS['cpassman_url'] . '/includes/images/photo.jpg';
6522
+                    $avatar = $SETTINGS['cpassman_url'].'/includes/images/photo.jpg';
6524 6523
                 }
6525 6524
             } else {
6526
-                $avatar = $SETTINGS['cpassman_url'] . '/includes/images/photo.jpg';
6525
+                $avatar = $SETTINGS['cpassman_url'].'/includes/images/photo.jpg';
6527 6526
             }
6528 6527
 
6529 6528
             // Prepare action
@@ -6543,7 +6542,7 @@  discard block
 block discarded – undo
6543 6542
                         $previous_passwords, 
6544 6543
                         [
6545 6544
                             'password' => htmlentities($previous_pwd['string']),
6546
-                            'date' => date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']),
6545
+                            'date' => date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']),
6547 6546
                         ]
6548 6547
                     );
6549 6548
                 }
@@ -6556,19 +6555,19 @@  discard block
 block discarded – undo
6556 6555
                 $action = $lang->get($reason[0]);
6557 6556
                 if ($reason[0] === 'at_moved') {
6558 6557
                     $tmp = explode(' -> ', $reason[1]);
6559
-                    $detail = $lang->get('from') . ' <span class="font-weight-light">' . $tmp[0] . '</span> ' . $lang->get('to') . ' <span class="font-weight-light">' . $tmp[1] . ' </span>';
6558
+                    $detail = $lang->get('from').' <span class="font-weight-light">'.$tmp[0].'</span> '.$lang->get('to').' <span class="font-weight-light">'.$tmp[1].' </span>';
6560 6559
                 } elseif ($reason[0] === 'at_field') {
6561 6560
                     $tmp = explode(' => ', $reason[1]);
6562 6561
                     if (count($tmp) > 1) {
6563
-                        $detail = '<b>' . trim($tmp[0]) . '</b> | ' . $lang->get('previous_value') .
6564
-                            ': <span class="font-weight-light">' . trim($tmp[1]) . '</span>';
6562
+                        $detail = '<b>'.trim($tmp[0]).'</b> | '.$lang->get('previous_value').
6563
+                            ': <span class="font-weight-light">'.trim($tmp[1]).'</span>';
6565 6564
                     } else {
6566 6565
                         $detail = trim($reason[1]);
6567 6566
                     }
6568 6567
                 } elseif (in_array($reason[0], array('at_restriction', 'at_email', 'at_login', 'at_label', 'at_url', 'at_tag')) === true) {
6569 6568
                     $tmp = explode(' => ', $reason[1]);
6570 6569
                     $detail = empty(trim($tmp[0])) === true ?
6571
-                        $lang->get('no_previous_value') : $lang->get('previous_value') . ': <span class="font-weight-light">' . $tmp[0] . ' </span>';
6570
+                        $lang->get('no_previous_value') : $lang->get('previous_value').': <span class="font-weight-light">'.$tmp[0].' </span>';
6572 6571
                 } elseif ($reason[0] === 'at_automatic_del') {
6573 6572
                     $detail = $lang->get($reason[1]);
6574 6573
                 } elseif ($reason[0] === 'at_anyoneconmodify' || $reason[0] === 'at_otp_status') {
@@ -6577,7 +6576,7 @@  discard block
 block discarded – undo
6577 6576
                     $tmp = explode(':', $reason[1]);
6578 6577
                     $tmp = explode('.', $tmp[0]);
6579 6578
                     $detail = isBase64($tmp[0]) === true ?
6580
-                        base64_decode($tmp[0]) . '.' . $tmp[1] : $tmp[0];
6579
+                        base64_decode($tmp[0]).'.'.$tmp[1] : $tmp[0];
6581 6580
                 } elseif ($reason[0] === 'at_import') {
6582 6581
                     $detail = '';
6583 6582
                 } elseif (in_array($reason[0], array('csv', 'pdf')) === true) {
@@ -6596,8 +6595,8 @@  discard block
 block discarded – undo
6596 6595
                 array(
6597 6596
                     'avatar' => $avatar,
6598 6597
                     'login' => $record['login'],
6599
-                    'name' => $record['name'] . ' ' . $record['lastname'],
6600
-                    'date' => date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']),
6598
+                    'name' => $record['name'].' '.$record['lastname'],
6599
+                    'date' => date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']),
6601 6600
                     'action' => $action,
6602 6601
                     'detail' => $detail,
6603 6602
                 )
@@ -6685,11 +6684,11 @@  discard block
 block discarded – undo
6685 6684
 
6686 6685
         // get some info to add to the notification email
6687 6686
         $resp_user = DB::queryFirstRow(
6688
-            'SELECT login FROM ' . prefixTable('users') . ' WHERE id = %i',
6687
+            'SELECT login FROM '.prefixTable('users').' WHERE id = %i',
6689 6688
             $session->get('user-id')
6690 6689
         );
6691 6690
         $resp_folder = DB::queryFirstRow(
6692
-            'SELECT title FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
6691
+            'SELECT title FROM '.prefixTable('nested_tree').' WHERE id = %i',
6693 6692
             $folder
6694 6693
         );
6695 6694
 
@@ -6698,7 +6697,7 @@  discard block
 block discarded – undo
6698 6697
         $emailService = new EmailService();
6699 6698
         $rows = DB::query(
6700 6699
             'SELECT email
6701
-            FROM ' . prefixTable('users') . '
6700
+            FROM ' . prefixTable('users').'
6702 6701
             WHERE `gestionnaire` = %i AND `email` IS NOT NULL',
6703 6702
             1
6704 6703
         );
@@ -6744,7 +6743,7 @@  discard block
 block discarded – undo
6744 6743
         // Send email
6745 6744
         $dataItem = DB::queryFirstRow(
6746 6745
             'SELECT label, id_tree
6747
-            FROM ' . prefixTable('items') . '
6746
+            FROM ' . prefixTable('items').'
6748 6747
             WHERE id = %i',
6749 6748
             $inputData['itemId']
6750 6749
         );
@@ -6798,7 +6797,7 @@  discard block
 block discarded – undo
6798 6797
 
6799 6798
         DB::query(
6800 6799
             'SELECT *
6801
-            FROM ' . prefixTable('notification') . '
6800
+            FROM ' . prefixTable('notification').'
6802 6801
             WHERE item_id = %i AND user_id = %i',
6803 6802
             $inputData['itemId'],
6804 6803
             $session->get('user-id')
@@ -6870,7 +6869,7 @@  discard block
 block discarded – undo
6870 6869
         // And related logs
6871 6870
         $rows = DB::query(
6872 6871
             'SELECT id, file AS filename
6873
-            FROM ' . prefixTable('files') . '
6872
+            FROM ' . prefixTable('files').'
6874 6873
             WHERE id_item = %i AND confirmed = %i',
6875 6874
             $inputData['itemId'],
6876 6875
             0
@@ -6884,12 +6883,12 @@  discard block
 block discarded – undo
6884 6883
             );
6885 6884
 
6886 6885
             // Delete file on server
6887
-            unlink($SETTINGS['path_to_upload_folder'] . '/' . TP_FILE_PREFIX . base64_decode($file['filename']));
6886
+            unlink($SETTINGS['path_to_upload_folder'].'/'.TP_FILE_PREFIX.base64_decode($file['filename']));
6888 6887
 
6889 6888
             // Delete related logs
6890 6889
             $logFile = DB::query(
6891 6890
                 'SELECT increment_id, raison
6892
-                FROM ' . prefixTable('log_items') . '
6891
+                FROM ' . prefixTable('log_items').'
6893 6892
                 WHERE id_item = %i AND id_user = %i AND action = %s AND raison LIKE "at_add_file :%"',
6894 6893
                 $inputData['itemId'],
6895 6894
                 $session->get('user-id'),
@@ -6948,7 +6947,7 @@  discard block
 block discarded – undo
6948 6947
         // Confirm attachments
6949 6948
         $rows = DB::query(
6950 6949
             'SELECT id, file AS filename
6951
-            FROM ' . prefixTable('files') . '
6950
+            FROM ' . prefixTable('files').'
6952 6951
             WHERE id_item = %i AND confirmed = %i',
6953 6952
             $inputData['itemId'],
6954 6953
             0
@@ -7034,15 +7033,15 @@  discard block
 block discarded – undo
7034 7033
         case 'autocomplete_tags':
7035 7034
             // Get a list off all existing TAGS
7036 7035
             $listOfTags = '';
7037
-            $rows = DB::query('SELECT tag FROM ' . prefixTable('tags') . ' WHERE tag LIKE %ss GROUP BY tag', $inputData['getTerm']);
7036
+            $rows = DB::query('SELECT tag FROM '.prefixTable('tags').' WHERE tag LIKE %ss GROUP BY tag', $inputData['getTerm']);
7038 7037
             foreach ($rows as $record) {
7039 7038
                 if (empty($listOfTags)) {
7040
-                    $listOfTags = '"' . $record['tag'] . '"';
7039
+                    $listOfTags = '"'.$record['tag'].'"';
7041 7040
                 } else {
7042
-                    $listOfTags .= ', "' . $record['tag'] . '"';
7041
+                    $listOfTags .= ', "'.$record['tag'].'"';
7043 7042
                 }
7044 7043
             }
7045
-            echo '[' . $listOfTags . ']';
7044
+            echo '['.$listOfTags.']';
7046 7045
             break;
7047 7046
     }
7048 7047
 }
@@ -7058,7 +7057,7 @@  discard block
 block discarded – undo
7058 7057
 {
7059 7058
     $data = DB::queryFirstRow(
7060 7059
         'SELECT bloquer_creation, bloquer_modification, personal_folder
7061
-        FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
7060
+        FROM ' . prefixTable('nested_tree').' WHERE id = %i',
7062 7061
         $groupe
7063 7062
     );
7064 7063
     // Check if it's in a personal folder. If yes, then force complexity overhead.
@@ -7169,7 +7168,7 @@  discard block
 block discarded – undo
7169 7168
     $now = time();
7170 7169
     $editionLocks = DB::query(
7171 7170
         'SELECT timestamp, user_id, increment_id
7172
-         FROM ' . prefixTable('items_edition') . '
7171
+         FROM ' . prefixTable('items_edition').'
7173 7172
          WHERE item_id = %i 
7174 7173
          ORDER BY increment_id DESC',
7175 7174
         $itemId
@@ -7211,7 +7210,7 @@  discard block
 block discarded – undo
7211 7210
 
7212 7211
         // Delete related background tasks if any
7213 7212
         $task = DB::queryFirstRow(
7214
-            'SELECT increment_id FROM ' . prefixTable('background_tasks') . '
7213
+            'SELECT increment_id FROM '.prefixTable('background_tasks').'
7215 7214
              WHERE item_id = %i AND finished_at = ""',
7216 7215
             $itemId
7217 7216
         );
@@ -7224,7 +7223,7 @@  discard block
 block discarded – undo
7224 7223
         // Check if encryption process is still running
7225 7224
         DB::queryFirstRow(
7226 7225
             'SELECT JSON_EXTRACT(arguments, "$.all_users_except_id") AS all_users_except_id
7227
-             FROM ' . prefixTable('background_tasks') . '
7226
+             FROM ' . prefixTable('background_tasks').'
7228 7227
              WHERE item_id = %i AND finished_at = ""
7229 7228
              ORDER BY increment_id DESC',
7230 7229
             $itemId
@@ -7282,7 +7281,7 @@  discard block
 block discarded – undo
7282 7281
 {
7283 7282
     // Check if there's an ongoing background encryption process for the item
7284 7283
     $ongoingProcess = DB::queryFirstRow(
7285
-        'SELECT 1 FROM ' . prefixTable('background_tasks') . ' WHERE item_id = %i AND finished_at = "" LIMIT 1', 
7284
+        'SELECT 1 FROM '.prefixTable('background_tasks').' WHERE item_id = %i AND finished_at = "" LIMIT 1', 
7286 7285
         $itemId
7287 7286
     );
7288 7287
 
@@ -7300,7 +7299,7 @@  discard block
 block discarded – undo
7300 7299
 function getUserVisibleFolders(int $userId): array
7301 7300
 {
7302 7301
     // Query to retrieve visible folders for the user
7303
-    $data = DB::queryFirstRow('SELECT visible_folders FROM ' . prefixTable('cache_tree') . ' WHERE user_id = %i', $userId);
7302
+    $data = DB::queryFirstRow('SELECT visible_folders FROM '.prefixTable('cache_tree').' WHERE user_id = %i', $userId);
7304 7303
     
7305 7304
     // Decode JSON data into an array; return an empty array if the data is invalid
7306 7305
     return json_decode($data['visible_folders'], true) ?? [];
@@ -7324,7 +7323,7 @@  discard block
 block discarded – undo
7324 7323
 
7325 7324
     // Query the access rights for the given roles and folder
7326 7325
     $accessTypes = DB::queryFirstColumn(
7327
-        'SELECT DISTINCT type FROM ' . prefixTable('roles_values') . ' WHERE role_id IN %ls AND folder_id = %i', 
7326
+        'SELECT DISTINCT type FROM '.prefixTable('roles_values').' WHERE role_id IN %ls AND folder_id = %i', 
7328 7327
         $roles, 
7329 7328
         $treeId
7330 7329
     );
Please login to merge, or discard this patch.