Passed
Push — master ( ceb3ad...8da2eb )
by Nils
07:27 queued 01:00
created
sources/main.queries.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -830,7 +830,7 @@
 block discarded – undo
830 830
                 'encode'
831 831
             );
832 832
 
833
-         /*
833
+            /*
834 834
          * Generate BUG report
835 835
          */
836 836
         case 'generate_bug_report'://action_system
Please login to merge, or discard this patch.
Spacing   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 ) {
82 82
     // Not allowed page
83 83
     $session->set('system-error_code', ERR_NOT_ALLOWED);
84
-    include $SETTINGS['cpassman_dir'] . '/error.php';
84
+    include $SETTINGS['cpassman_dir'].'/error.php';
85 85
     exit;
86 86
 }
87 87
 
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 
270 270
             // Get current user hash
271 271
             $userHash = DB::queryFirstRow(
272
-                "SELECT pw FROM " . prefixtable('users') . " WHERE id = %d;",
272
+                "SELECT pw FROM ".prefixtable('users')." WHERE id = %d;",
273 273
                 $session->get('user-id')
274 274
             )['pw'];
275 275
 
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
  * @param string $post_key
326 326
  * @return string
327 327
  */
328
-function userHandler(string $post_type, array|null|string $dataReceived, array $SETTINGS, string $post_key): string
328
+function userHandler(string $post_type, array | null | string $dataReceived, array $SETTINGS, string $post_key): string
329 329
 {
330 330
     $session = SessionManager::getSession();
331 331
 
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
     if (isset($dataReceived['user_id'])) {
361 361
         // Get info about user to modify
362 362
         $targetUserInfos = DB::queryfirstrow(
363
-            'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM ' . prefixTable('users') . '
363
+            'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM '.prefixTable('users').'
364 364
             WHERE id = %i',
365 365
             $dataReceived['user_id']
366 366
         );
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
         case 'mail_me'://action_mail
510 510
             // Get info about user to send email
511 511
             $data_user = DB::queryfirstrow(
512
-                'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM ' . prefixTable('users') . '
512
+                'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM '.prefixTable('users').'
513 513
                 WHERE email = %s',
514 514
                 filter_var($dataReceived['receipt'], FILTER_SANITIZE_FULL_SPECIAL_CHARS)
515 515
             );
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
     if (isset($dataReceived['user_id'])) {
623 623
         // Get info about user to modify
624 624
         $targetUserInfos = DB::queryfirstrow(
625
-            'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM ' . prefixTable('users') . '
625
+            'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM '.prefixTable('users').'
626 626
             WHERE id = %i',
627 627
             $dataReceived['user_id']
628 628
         );
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
 
702 702
             // Get current user hash
703 703
             $userHash = DB::queryFirstRow(
704
-                "SELECT pw FROM " . prefixtable('users') . " WHERE id = %d;",
704
+                "SELECT pw FROM ".prefixtable('users')." WHERE id = %d;",
705 705
                 $session->get('user-id')
706 706
             )['pw'];
707 707
 
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
 
740 740
                 // Get current user hash
741 741
                 $userHash = DB::queryFirstRow(
742
-                    "SELECT pw FROM " . prefixtable('users') . " WHERE id = %d;",
742
+                    "SELECT pw FROM ".prefixtable('users')." WHERE id = %d;",
743 743
                     $session->get('user-id')
744 744
                 )['pw'];
745 745
 
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
 
784 784
                 // Get current user hash
785 785
                 $userHash = DB::queryFirstRow(
786
-                    "SELECT pw FROM " . prefixtable('users') . " WHERE id = %i;",
786
+                    "SELECT pw FROM ".prefixtable('users')." WHERE id = %i;",
787 787
                     $session->get('user-id')
788 788
                 )['pw'];
789 789
 
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
  * @param array $SETTINGS
828 828
  * @return string
829 829
  */
830
-function systemHandler(string $post_type, array|null|string $dataReceived, array $SETTINGS): string
830
+function systemHandler(string $post_type, array | null | string $dataReceived, array $SETTINGS): string
831 831
 {
832 832
     $session = SessionManager::getSession();
833 833
     switch ($post_type) {
@@ -928,7 +928,7 @@  discard block
 block discarded – undo
928 928
                 )
929 929
             );
930 930
 
931
-            return '[{"token" : "' . $token . '"}]';
931
+            return '[{"token" : "'.$token.'"}]';
932 932
 
933 933
         /*
934 934
         * Default case
@@ -944,7 +944,7 @@  discard block
 block discarded – undo
944 944
 }
945 945
 
946 946
 
947
-function utilsHandler(string $post_type, array|null|string $dataReceived, array $SETTINGS): string
947
+function utilsHandler(string $post_type, array | null | string $dataReceived, array $SETTINGS): string
948 948
 {
949 949
     switch ($post_type) {
950 950
         /*
@@ -1013,7 +1013,7 @@  discard block
 block discarded – undo
1013 1013
         array(
1014 1014
             'error' => false,
1015 1015
             'timestamp' => $session->get('user-session_duration'),
1016
-            'max_time_to_add' => intdiv((($maximum_session_expiration_time*60) - ((int) $session->get('user-session_duration') - time())), 60),
1016
+            'max_time_to_add' => intdiv((($maximum_session_expiration_time * 60) - ((int) $session->get('user-session_duration') - time())), 60),
1017 1017
             'max_session_duration' => $maximum_session_expiration_time,
1018 1018
         ),
1019 1019
         'encode'
@@ -1065,7 +1065,7 @@  discard block
 block discarded – undo
1065 1065
     // get number of items
1066 1066
     DB::queryFirstRow(
1067 1067
         'SELECT increment_id
1068
-        FROM ' . prefixTable('sharekeys_items') .
1068
+        FROM ' . prefixTable('sharekeys_items').
1069 1069
         ' WHERE user_id = %i',
1070 1070
         $userId
1071 1071
     );
@@ -1120,7 +1120,7 @@  discard block
 block discarded – undo
1120 1120
         // check if expected security level is reached
1121 1121
         $dataUser = DB::queryfirstrow(
1122 1122
             'SELECT *
1123
-            FROM ' . prefixTable('users') . ' WHERE id = %i',
1123
+            FROM ' . prefixTable('users').' WHERE id = %i',
1124 1124
             $post_user_id
1125 1125
         );
1126 1126
 
@@ -1141,8 +1141,8 @@  discard block
 block discarded – undo
1141 1141
         if (empty($dataUser['fonction_id']) === false) {
1142 1142
             $data = DB::queryFirstRow(
1143 1143
                 'SELECT complexity
1144
-                FROM ' . prefixTable('roles_title') . '
1145
-                WHERE id IN (' . $dataUser['fonction_id'] . ')
1144
+                FROM ' . prefixTable('roles_title').'
1145
+                WHERE id IN (' . $dataUser['fonction_id'].')
1146 1146
                 ORDER BY complexity DESC'
1147 1147
             );
1148 1148
         } else {
@@ -1155,8 +1155,8 @@  discard block
 block discarded – undo
1155 1155
             return prepareExchangedData(
1156 1156
                 array(
1157 1157
                     'error' => true,
1158
-                    'message' => '<div style="margin:10px 0 10px 15px;">' . $lang->get('complexity_level_not_reached') . '.<br>' .
1159
-                        $lang->get('expected_complexity_level') . ': <b>' . TP_PW_COMPLEXITY[$data['complexity']][1] . '</b></div>',
1158
+                    'message' => '<div style="margin:10px 0 10px 15px;">'.$lang->get('complexity_level_not_reached').'.<br>'.
1159
+                        $lang->get('expected_complexity_level').': <b>'.TP_PW_COMPLEXITY[$data['complexity']][1].'</b></div>',
1160 1160
                 ),
1161 1161
                 'encode'
1162 1162
             );
@@ -1260,14 +1260,14 @@  discard block
 block discarded – undo
1260 1260
         // Get data about user
1261 1261
         $dataUser = DB::queryfirstrow(
1262 1262
             'SELECT id, email, pw
1263
-            FROM ' . prefixTable('users') . '
1263
+            FROM ' . prefixTable('users').'
1264 1264
             WHERE login = %s',
1265 1265
             $post_login
1266 1266
         );
1267 1267
     } else {
1268 1268
         $dataUser = DB::queryfirstrow(
1269 1269
             'SELECT id, login, email, pw
1270
-            FROM ' . prefixTable('users') . '
1270
+            FROM ' . prefixTable('users').'
1271 1271
             WHERE id = %i',
1272 1272
             $post_id
1273 1273
         );
@@ -1321,7 +1321,7 @@  discard block
 block discarded – undo
1321 1321
     // Check if token already used
1322 1322
     $dataToken = DB::queryfirstrow(
1323 1323
         'SELECT end_timestamp, reason
1324
-        FROM ' . prefixTable('tokens') . '
1324
+        FROM ' . prefixTable('tokens').'
1325 1325
         WHERE token = %s AND user_id = %i',
1326 1326
         $post_token,
1327 1327
         $dataUser['id']
@@ -1332,11 +1332,11 @@  discard block
 block discarded – undo
1332 1332
         return prepareExchangedData(
1333 1333
             array(
1334 1334
                 'error' => true,
1335
-                'message' => 'TOKEN already used',//$lang->get('no_email_set'),
1335
+                'message' => 'TOKEN already used', //$lang->get('no_email_set'),
1336 1336
             ),
1337 1337
             'encode'
1338 1338
         );
1339
-    } elseif(DB::count() === 0) {
1339
+    } elseif (DB::count() === 0) {
1340 1340
         // Store token for this action
1341 1341
         DB::insert(
1342 1342
             prefixTable('tokens'),
@@ -1398,7 +1398,7 @@  discard block
 block discarded – undo
1398 1398
                 'email' => $dataUser['email'],
1399 1399
                 'email_result' => str_replace(
1400 1400
                     '#email#',
1401
-                    '<b>' . obfuscateEmail($dataUser['email']) . '</b>',
1401
+                    '<b>'.obfuscateEmail($dataUser['email']).'</b>',
1402 1402
                     addslashes($lang->get('admin_email_result_ok'))
1403 1403
                 ),
1404 1404
             ),
@@ -1414,7 +1414,7 @@  discard block
 block discarded – undo
1414 1414
             'email' => $dataUser['email'],
1415 1415
             'email_result' => str_replace(
1416 1416
                 '#email#',
1417
-                '<b>' . obfuscateEmail($dataUser['email']) . '</b>',
1417
+                '<b>'.obfuscateEmail($dataUser['email']).'</b>',
1418 1418
                 addslashes($lang->get('admin_email_result_ok'))
1419 1419
             ),
1420 1420
         ),
@@ -1431,7 +1431,7 @@  discard block
 block discarded – undo
1431 1431
 
1432 1432
     if (isKeyExistingAndEqual('enable_send_email_on_user_login', 1, $SETTINGS) === true) {
1433 1433
         $row = DB::queryFirstRow(
1434
-            'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s',
1434
+            'SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s',
1435 1435
             'cron',
1436 1436
             'sending_emails'
1437 1437
         );
@@ -1439,7 +1439,7 @@  discard block
 block discarded – undo
1439 1439
         if ((int) (time() - $row['valeur']) >= 300 || (int) $row['valeur'] === 0) {
1440 1440
             $rows = DB::query(
1441 1441
                 'SELECT *
1442
-                FROM ' . prefixTable('emails') .
1442
+                FROM ' . prefixTable('emails').
1443 1443
                 ' WHERE status != %s',
1444 1444
                 'sent'
1445 1445
             );
@@ -1491,8 +1491,8 @@  discard block
 block discarded – undo
1491 1491
     $arr_html = array();
1492 1492
     $rows = DB::query(
1493 1493
         'SELECT i.id AS id, i.label AS label, i.id_tree AS id_tree, l.date, i.perso AS perso, i.restricted_to AS restricted
1494
-        FROM ' . prefixTable('log_items') . ' AS l
1495
-        RIGHT JOIN ' . prefixTable('items') . ' AS i ON (l.id_item = i.id)
1494
+        FROM ' . prefixTable('log_items').' AS l
1495
+        RIGHT JOIN ' . prefixTable('items').' AS i ON (l.id_item = i.id)
1496 1496
         WHERE l.action = %s AND l.id_user = %i
1497 1497
         ORDER BY l.date DESC
1498 1498
         LIMIT 0, 100',
@@ -1524,7 +1524,7 @@  discard block
 block discarded – undo
1524 1524
     if (isKeyExistingAndEqual('enable_suggestion', 1, $SETTINGS) === true
1525 1525
         && ((int) $session->get('user-admin') === 1 || (int) $session->get('user-manager') === 1)
1526 1526
     ) {
1527
-        DB::query('SELECT * FROM ' . prefixTable('suggestion'));
1527
+        DB::query('SELECT * FROM '.prefixTable('suggestion'));
1528 1528
         $nb_suggestions_waiting = DB::count();
1529 1529
     }
1530 1530
 
@@ -1559,13 +1559,13 @@  discard block
 block discarded – undo
1559 1559
             if ($data === 'stat_languages') {
1560 1560
                 $tmp = '';
1561 1561
                 foreach ($stats_data[$data] as $key => $value) {
1562
-                    $tmp .= $tmp === '' ? $key . '-' . $value : ',' . $key . '-' . $value;
1562
+                    $tmp .= $tmp === '' ? $key.'-'.$value : ','.$key.'-'.$value;
1563 1563
                 }
1564 1564
                 $statsToSend[$data] = $tmp;
1565 1565
             } elseif ($data === 'stat_country') {
1566 1566
                 $tmp = '';
1567 1567
                 foreach ($stats_data[$data] as $key => $value) {
1568
-                    $tmp .= $tmp === '' ? $key . '-' . $value : ',' . $key . '-' . $value;
1568
+                    $tmp .= $tmp === '' ? $key.'-'.$value : ','.$key.'-'.$value;
1569 1569
                 }
1570 1570
                 $statsToSend[$data] = $tmp;
1571 1571
             } else {
@@ -1652,7 +1652,7 @@  discard block
 block discarded – undo
1652 1652
             $url_found = $value;
1653 1653
             if (empty($url_found) === false) {
1654 1654
                 $tmp = parse_url($url_found);
1655
-                $anonym_url = $tmp['scheme'] . '://<anonym_url>' . (isset($tmp['path']) === true ? $tmp['path'] : '');
1655
+                $anonym_url = $tmp['scheme'].'://<anonym_url>'.(isset($tmp['path']) === true ? $tmp['path'] : '');
1656 1656
                 $value = $anonym_url;
1657 1657
             } else {
1658 1658
                 $value = '';
@@ -1682,7 +1682,7 @@  discard block
 block discarded – undo
1682 1682
     $teampass_errors = '';
1683 1683
     $rows = DB::query(
1684 1684
         'SELECT label, date AS error_date
1685
-        FROM ' . prefixTable('log_system') . "
1685
+        FROM ' . prefixTable('log_system')."
1686 1686
         WHERE `type` LIKE 'error'
1687 1687
         ORDER BY `date` DESC
1688 1688
         LIMIT 0, 10"
@@ -1690,9 +1690,9 @@  discard block
 block discarded – undo
1690 1690
     if (DB::count() > 0) {
1691 1691
         foreach ($rows as $record) {
1692 1692
             if (empty($teampass_errors) === true) {
1693
-                $teampass_errors = ' * ' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['error_date']) . ' - ' . $record['label'];
1693
+                $teampass_errors = ' * '.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['error_date']).' - '.$record['label'];
1694 1694
             } else {
1695
-                $teampass_errors .= ' * ' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['error_date']) . ' - ' . $record['label'];
1695
+                $teampass_errors .= ' * '.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['error_date']).' - '.$record['label'];
1696 1696
             }
1697 1697
         }
1698 1698
     }
@@ -1701,7 +1701,7 @@  discard block
 block discarded – undo
1701 1701
 
1702 1702
     // Now prepare text
1703 1703
     $txt = '### Page on which it happened
1704
-' . $data['current_page'] . '
1704
+' . $data['current_page'].'
1705 1705
 
1706 1706
 ### Steps to reproduce
1707 1707
 1.
@@ -1716,39 +1716,39 @@  discard block
 block discarded – undo
1716 1716
 Tell us what happens instead
1717 1717
 
1718 1718
 ### Server configuration
1719
-**Operating system**: ' . php_uname() . '
1719
+**Operating system**: ' . php_uname().'
1720 1720
 
1721
-**Web server:** ' . $_SERVER['SERVER_SOFTWARE'] . '
1721
+**Web server:** ' . $_SERVER['SERVER_SOFTWARE'].'
1722 1722
 
1723
-**Database:** ' . ($link === false ? $lang->get('undefined') : mysqli_get_server_info($link)) . '
1723
+**Database:** ' . ($link === false ? $lang->get('undefined') : mysqli_get_server_info($link)).'
1724 1724
 
1725
-**PHP version:** ' . PHP_VERSION . '
1725
+**PHP version:** ' . PHP_VERSION.'
1726 1726
 
1727
-**Teampass version:** ' . TP_VERSION . '.' . TP_VERSION_MINOR . '
1727
+**Teampass version:** ' . TP_VERSION.'.'.TP_VERSION_MINOR.'
1728 1728
 
1729 1729
 **Teampass configuration variables:**
1730 1730
 ```
1731
-' . $list_of_options . '
1731
+' . $list_of_options.'
1732 1732
 ```
1733 1733
 
1734 1734
 **Updated from an older Teampass or fresh install:**
1735 1735
 
1736 1736
 ### Client configuration
1737 1737
 
1738
-**Browser:** ' . $data['browser_name'] . ' - ' . $data['browser_version'] . '
1738
+**Browser:** ' . $data['browser_name'].' - '.$data['browser_version'].'
1739 1739
 
1740
-**Operating system:** ' . $data['os'] . ' - ' . $data['os_archi'] . 'bits
1740
+**Operating system:** ' . $data['os'].' - '.$data['os_archi'].'bits
1741 1741
 
1742 1742
 ### Logs
1743 1743
 
1744 1744
 #### Web server error log
1745 1745
 ```
1746
-' . $err['message'] . ' - ' . $err['file'] . ' (' . $err['line'] . ')
1746
+' . $err['message'].' - '.$err['file'].' ('.$err['line'].')
1747 1747
 ```
1748 1748
 
1749 1749
 #### Teampass 10 last system errors
1750 1750
 ```
1751
-' . $teampass_errors . '
1751
+' . $teampass_errors.'
1752 1752
 ```
1753 1753
 
1754 1754
 #### Log from the web-browser developer console (CTRL + SHIFT + i)
@@ -1788,7 +1788,7 @@  discard block
 block discarded – undo
1788 1788
         // Check if user exists
1789 1789
         $userInfo = DB::queryFirstRow(
1790 1790
             'SELECT public_key, private_key, pw, auth_type
1791
-            FROM ' . prefixTable('users') . '
1791
+            FROM ' . prefixTable('users').'
1792 1792
             WHERE id = %i',
1793 1793
             $post_user_id
1794 1794
         );
@@ -1797,9 +1797,9 @@  discard block
 block discarded – undo
1797 1797
             // Get one item
1798 1798
             $currentUserKey = DB::queryFirstRow(
1799 1799
                 'SELECT object_id, share_key, increment_id
1800
-                FROM ' . prefixTable('sharekeys_items') . ' AS si
1801
-                INNER JOIN ' . prefixTable('items') . ' AS i ON  (i.id = si.object_id)
1802
-                INNER JOIN ' . prefixTable('nested_tree') . ' AS nt ON  (i.id_tree = nt.id)
1800
+                FROM ' . prefixTable('sharekeys_items').' AS si
1801
+                INNER JOIN ' . prefixTable('items').' AS i ON  (i.id = si.object_id)
1802
+                INNER JOIN ' . prefixTable('nested_tree').' AS nt ON  (i.id_tree = nt.id)
1803 1803
                 WHERE user_id = %i AND nt.personal_folder = %i',
1804 1804
                 $post_user_id,
1805 1805
                 0
@@ -1893,7 +1893,7 @@  discard block
 block discarded – undo
1893 1893
         // Get user info
1894 1894
         $userData = DB::queryFirstRow(
1895 1895
             'SELECT private_key
1896
-            FROM ' . prefixTable('users') . '
1896
+            FROM ' . prefixTable('users').'
1897 1897
             WHERE id = %i',
1898 1898
             $post_user_id
1899 1899
         );
@@ -1974,7 +1974,7 @@  discard block
 block discarded – undo
1974 1974
         // Get user info
1975 1975
         $userData = DB::queryFirstRow(
1976 1976
             'SELECT email, auth_type, login
1977
-            FROM ' . prefixTable('users') . '
1977
+            FROM ' . prefixTable('users').'
1978 1978
             WHERE id = %i',
1979 1979
             $post_user_id
1980 1980
         );
@@ -2072,7 +2072,7 @@  discard block
 block discarded – undo
2072 2072
         // Get user info
2073 2073
         $userData = DB::queryFirstRow(
2074 2074
             'SELECT email, auth_type, login
2075
-            FROM ' . prefixTable('users') . '
2075
+            FROM ' . prefixTable('users').'
2076 2076
             WHERE id = %i',
2077 2077
             $post_user_id
2078 2078
         );
@@ -2138,7 +2138,7 @@  discard block
 block discarded – undo
2138 2138
         // Check if user exists
2139 2139
         DB::queryFirstRow(
2140 2140
             'SELECT *
2141
-            FROM ' . prefixTable('users') . '
2141
+            FROM ' . prefixTable('users').'
2142 2142
             WHERE id = %i',
2143 2143
             $post_user_id
2144 2144
         );
@@ -2208,7 +2208,7 @@  discard block
 block discarded – undo
2208 2208
         // Check if user exists
2209 2209
         $userInfo = DB::queryFirstRow(
2210 2210
             'SELECT public_key
2211
-            FROM ' . prefixTable('users') . '
2211
+            FROM ' . prefixTable('users').'
2212 2212
             WHERE id = %i',
2213 2213
             $post_user_id
2214 2214
         );
@@ -2356,15 +2356,15 @@  discard block
 block discarded – undo
2356 2356
     // Loop on items
2357 2357
     $rows = DB::query(
2358 2358
         'SELECT id, pw
2359
-        FROM ' . prefixTable('items') . '
2359
+        FROM ' . prefixTable('items').'
2360 2360
         WHERE perso = 0
2361
-        LIMIT ' . $post_start . ', ' . $post_length
2361
+        LIMIT ' . $post_start.', '.$post_length
2362 2362
     );
2363 2363
     foreach ($rows as $record) {
2364 2364
         // Get itemKey from current user
2365 2365
         $currentUserKey = DB::queryFirstRow(
2366 2366
             'SELECT share_key, increment_id
2367
-            FROM ' . prefixTable('sharekeys_items') . '
2367
+            FROM ' . prefixTable('sharekeys_items').'
2368 2368
             WHERE object_id = %i AND user_id = %i',
2369 2369
             $record['id'],
2370 2370
             $session->get('user-id')
@@ -2396,7 +2396,7 @@  discard block
 block discarded – undo
2396 2396
             if ((int) $post_user_id !== (int) $session->get('user-id')) {
2397 2397
                 $currentUserKey = DB::queryFirstRow(
2398 2398
                     'SELECT increment_id
2399
-                    FROM ' . prefixTable('sharekeys_items') . '
2399
+                    FROM ' . prefixTable('sharekeys_items').'
2400 2400
                     WHERE object_id = %i AND user_id = %i',
2401 2401
                     $record['id'],
2402 2402
                     $post_user_id
@@ -2429,7 +2429,7 @@  discard block
 block discarded – undo
2429 2429
     // SHould we change step?
2430 2430
     DB::query(
2431 2431
         'SELECT *
2432
-        FROM ' . prefixTable('items') . '
2432
+        FROM ' . prefixTable('items').'
2433 2433
         WHERE perso = 0'
2434 2434
     );
2435 2435
 
@@ -2454,15 +2454,15 @@  discard block
 block discarded – undo
2454 2454
     // Loop on logs
2455 2455
     $rows = DB::query(
2456 2456
         'SELECT increment_id
2457
-        FROM ' . prefixTable('log_items') . '
2457
+        FROM ' . prefixTable('log_items').'
2458 2458
         WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"
2459
-        LIMIT ' . $post_start . ', ' . $post_length
2459
+        LIMIT ' . $post_start.', '.$post_length
2460 2460
     );
2461 2461
     foreach ($rows as $record) {
2462 2462
         // Get itemKey from current user
2463 2463
         $currentUserKey = DB::queryFirstRow(
2464 2464
             'SELECT share_key
2465
-            FROM ' . prefixTable('sharekeys_logs') . '
2465
+            FROM ' . prefixTable('sharekeys_logs').'
2466 2466
             WHERE object_id = %i AND user_id = %i',
2467 2467
             $record['increment_id'],
2468 2468
             $session->get('user-id')
@@ -2494,7 +2494,7 @@  discard block
 block discarded – undo
2494 2494
             if ((int) $post_user_id !== (int) $session->get('user-id')) {
2495 2495
                 $currentUserKey = DB::queryFirstRow(
2496 2496
                     'SELECT increment_id
2497
-                    FROM ' . prefixTable('sharekeys_items') . '
2497
+                    FROM ' . prefixTable('sharekeys_items').'
2498 2498
                     WHERE object_id = %i AND user_id = %i',
2499 2499
                     $record['id'],
2500 2500
                     $post_user_id
@@ -2516,7 +2516,7 @@  discard block
 block discarded – undo
2516 2516
     // SHould we change step?
2517 2517
     DB::query(
2518 2518
         'SELECT increment_id
2519
-        FROM ' . prefixTable('log_items') . '
2519
+        FROM ' . prefixTable('log_items').'
2520 2520
         WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"'
2521 2521
     );
2522 2522
 
@@ -2541,15 +2541,15 @@  discard block
 block discarded – undo
2541 2541
     // Loop on fields
2542 2542
     $rows = DB::query(
2543 2543
         'SELECT id
2544
-        FROM ' . prefixTable('categories_items') . '
2544
+        FROM ' . prefixTable('categories_items').'
2545 2545
         WHERE encryption_type = "teampass_aes"
2546
-        LIMIT ' . $post_start . ', ' . $post_length
2546
+        LIMIT ' . $post_start.', '.$post_length
2547 2547
     );
2548 2548
     foreach ($rows as $record) {
2549 2549
         // Get itemKey from current user
2550 2550
         $currentUserKey = DB::queryFirstRow(
2551 2551
             'SELECT share_key
2552
-            FROM ' . prefixTable('sharekeys_fields') . '
2552
+            FROM ' . prefixTable('sharekeys_fields').'
2553 2553
             WHERE object_id = %i AND user_id = %i',
2554 2554
             $record['id'],
2555 2555
             $session->get('user-id')
@@ -2581,7 +2581,7 @@  discard block
 block discarded – undo
2581 2581
             if ((int) $post_user_id !== (int) $session->get('user-id')) {
2582 2582
                 $currentUserKey = DB::queryFirstRow(
2583 2583
                     'SELECT increment_id
2584
-                    FROM ' . prefixTable('sharekeys_items') . '
2584
+                    FROM ' . prefixTable('sharekeys_items').'
2585 2585
                     WHERE object_id = %i AND user_id = %i',
2586 2586
                     $record['id'],
2587 2587
                     $post_user_id
@@ -2603,7 +2603,7 @@  discard block
 block discarded – undo
2603 2603
     // SHould we change step?
2604 2604
     DB::query(
2605 2605
         'SELECT *
2606
-        FROM ' . prefixTable('categories_items') . '
2606
+        FROM ' . prefixTable('categories_items').'
2607 2607
         WHERE encryption_type = "teampass_aes"'
2608 2608
     );
2609 2609
 
@@ -2628,14 +2628,14 @@  discard block
 block discarded – undo
2628 2628
     // Loop on suggestions
2629 2629
     $rows = DB::query(
2630 2630
         'SELECT id
2631
-        FROM ' . prefixTable('suggestion') . '
2632
-        LIMIT ' . $post_start . ', ' . $post_length
2631
+        FROM ' . prefixTable('suggestion').'
2632
+        LIMIT ' . $post_start.', '.$post_length
2633 2633
     );
2634 2634
     foreach ($rows as $record) {
2635 2635
         // Get itemKey from current user
2636 2636
         $currentUserKey = DB::queryFirstRow(
2637 2637
             'SELECT share_key
2638
-            FROM ' . prefixTable('sharekeys_suggestions') . '
2638
+            FROM ' . prefixTable('sharekeys_suggestions').'
2639 2639
             WHERE object_id = %i AND user_id = %i',
2640 2640
             $record['id'],
2641 2641
             $session->get('user-id')
@@ -2667,7 +2667,7 @@  discard block
 block discarded – undo
2667 2667
             if ((int) $post_user_id !== (int) $session->get('user-id')) {
2668 2668
                 $currentUserKey = DB::queryFirstRow(
2669 2669
                     'SELECT increment_id
2670
-                    FROM ' . prefixTable('sharekeys_items') . '
2670
+                    FROM ' . prefixTable('sharekeys_items').'
2671 2671
                     WHERE object_id = %i AND user_id = %i',
2672 2672
                     $record['id'],
2673 2673
                     $post_user_id
@@ -2713,15 +2713,15 @@  discard block
 block discarded – undo
2713 2713
     // Loop on files
2714 2714
     $rows = DB::query(
2715 2715
         'SELECT id
2716
-        FROM ' . prefixTable('files') . '
2717
-        WHERE status = "' . TP_ENCRYPTION_NAME . '"
2718
-        LIMIT ' . $post_start . ', ' . $post_length
2716
+        FROM ' . prefixTable('files').'
2717
+        WHERE status = "' . TP_ENCRYPTION_NAME.'"
2718
+        LIMIT ' . $post_start.', '.$post_length
2719 2719
     ); //aes_encryption
2720 2720
     foreach ($rows as $record) {
2721 2721
         // Get itemKey from current user
2722 2722
         $currentUserKey = DB::queryFirstRow(
2723 2723
             'SELECT share_key
2724
-            FROM ' . prefixTable('sharekeys_files') . '
2724
+            FROM ' . prefixTable('sharekeys_files').'
2725 2725
             WHERE object_id = %i AND user_id = %i',
2726 2726
             $record['id'],
2727 2727
             $session->get('user-id')
@@ -2753,7 +2753,7 @@  discard block
 block discarded – undo
2753 2753
             if ((int) $post_user_id !== (int) $session->get('user-id')) {
2754 2754
                 $currentUserKey = DB::queryFirstRow(
2755 2755
                     'SELECT increment_id
2756
-                    FROM ' . prefixTable('sharekeys_items') . '
2756
+                    FROM ' . prefixTable('sharekeys_items').'
2757 2757
                     WHERE object_id = %i AND user_id = %i',
2758 2758
                     $record['id'],
2759 2759
                     $post_user_id
@@ -2775,8 +2775,8 @@  discard block
 block discarded – undo
2775 2775
     // SHould we change step?
2776 2776
     DB::query(
2777 2777
         'SELECT *
2778
-        FROM ' . prefixTable('files') . '
2779
-        WHERE status = "' . TP_ENCRYPTION_NAME . '"'
2778
+        FROM ' . prefixTable('files').'
2779
+        WHERE status = "' . TP_ENCRYPTION_NAME.'"'
2780 2780
     );
2781 2781
 
2782 2782
     $next_start = (int) $post_start + (int) $post_length;
@@ -2809,9 +2809,9 @@  discard block
 block discarded – undo
2809 2809
     if (count($session->get('user-personal_folders')) > 0) {
2810 2810
         $rows = DB::query(
2811 2811
             'SELECT id, pw
2812
-            FROM ' . prefixTable('items') . '
2812
+            FROM ' . prefixTable('items').'
2813 2813
             WHERE perso = 1 AND id_tree IN %ls AND encryption_type = %s
2814
-            LIMIT ' . $post_start . ', ' . $post_length,
2814
+            LIMIT ' . $post_start.', '.$post_length,
2815 2815
             $session->get('user-personal_folders'),
2816 2816
             "defuse"
2817 2817
         );
@@ -2819,7 +2819,7 @@  discard block
 block discarded – undo
2819 2819
             // Get itemKey from current user
2820 2820
             $currentUserKey = DB::queryFirstRow(
2821 2821
                 'SELECT share_key, increment_id
2822
-                FROM ' . prefixTable('sharekeys_items') . '
2822
+                FROM ' . prefixTable('sharekeys_items').'
2823 2823
                 WHERE object_id = %i AND user_id = %i',
2824 2824
                 $record['id'],
2825 2825
                 $session->get('user-id')
@@ -2846,7 +2846,7 @@  discard block
 block discarded – undo
2846 2846
                 if ((int) $post_user_id !== (int) $session->get('user-id')) {
2847 2847
                     $currentUserKey = DB::queryFirstRow(
2848 2848
                         'SELECT increment_id
2849
-                        FROM ' . prefixTable('sharekeys_items') . '
2849
+                        FROM ' . prefixTable('sharekeys_items').'
2850 2850
                         WHERE object_id = %i AND user_id = %i',
2851 2851
                         $record['id'],
2852 2852
                         $post_user_id
@@ -2869,7 +2869,7 @@  discard block
 block discarded – undo
2869 2869
     // SHould we change step?
2870 2870
     DB::query(
2871 2871
         'SELECT *
2872
-        FROM ' . prefixTable('items') . '
2872
+        FROM ' . prefixTable('items').'
2873 2873
         WHERE perso = 0'
2874 2874
     );
2875 2875
 
@@ -2897,7 +2897,7 @@  discard block
 block discarded – undo
2897 2897
         // Check if user exists
2898 2898
         $userInfo = DB::queryFirstRow(
2899 2899
             'SELECT public_key, encrypted_psk
2900
-            FROM ' . prefixTable('users') . '
2900
+            FROM ' . prefixTable('users').'
2901 2901
             WHERE id = %i',
2902 2902
             $post_user_id
2903 2903
         );
@@ -2923,7 +2923,7 @@  discard block
 block discarded – undo
2923 2923
                 if ($post_counterItemsToTreat === -1) {
2924 2924
                     DB::query(
2925 2925
                         'SELECT id
2926
-                        FROM ' . prefixTable('items') . '
2926
+                        FROM ' . prefixTable('items').'
2927 2927
                         WHERE perso = 1 AND id_tree IN %ls AND encryption_type != %s',
2928 2928
                         $session->get('user-personal_folders'),
2929 2929
                         'teampass_aes'
@@ -2936,7 +2936,7 @@  discard block
 block discarded – undo
2936 2936
                 // Loop on persoanl items
2937 2937
                 $rows = DB::query(
2938 2938
                     'SELECT id, pw
2939
-                    FROM ' . prefixTable('items') . '
2939
+                    FROM ' . prefixTable('items').'
2940 2940
                     WHERE perso = 1 AND id_tree IN %ls AND encryption_type != %s
2941 2941
                     LIMIT ' . $post_length,
2942 2942
                     $session->get('user-personal_folders'),
@@ -2980,7 +2980,7 @@  discard block
 block discarded – undo
2980 2980
                     // Loop on files
2981 2981
                     $rows = DB::query(
2982 2982
                         'SELECT id, file
2983
-                        FROM ' . prefixTable('files') . '
2983
+                        FROM ' . prefixTable('files').'
2984 2984
                         WHERE status != %s
2985 2985
                         AND id_item = %i',
2986 2986
                         TP_ENCRYPTION_NAME,
@@ -2991,13 +2991,13 @@  discard block
 block discarded – undo
2991 2991
                         // Now decrypt the file
2992 2992
                         prepareFileWithDefuse(
2993 2993
                             'decrypt',
2994
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record2['file'],
2995
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record2['file'] . '.delete',
2994
+                            $SETTINGS['path_to_upload_folder'].'/'.$record2['file'],
2995
+                            $SETTINGS['path_to_upload_folder'].'/'.$record2['file'].'.delete',
2996 2996
                             $post_user_psk
2997 2997
                         );
2998 2998
 
2999 2999
                         // Encrypt the file
3000
-                        $encryptedFile = encryptFile($record2['file'] . '.delete', $SETTINGS['path_to_upload_folder']);
3000
+                        $encryptedFile = encryptFile($record2['file'].'.delete', $SETTINGS['path_to_upload_folder']);
3001 3001
 
3002 3002
                         DB::update(
3003 3003
                             prefixTable('files'),
@@ -3020,7 +3020,7 @@  discard block
 block discarded – undo
3020 3020
                         );
3021 3021
 
3022 3022
                         // Unlink original file
3023
-                        unlink($SETTINGS['path_to_upload_folder'] . '/' . $record2['file']);
3023
+                        unlink($SETTINGS['path_to_upload_folder'].'/'.$record2['file']);
3024 3024
                     }
3025 3025
                 }
3026 3026
 
@@ -3028,7 +3028,7 @@  discard block
 block discarded – undo
3028 3028
                 $next_start = (int) $post_start + (int) $post_length;
3029 3029
                 DB::query(
3030 3030
                     'SELECT id
3031
-                    FROM ' . prefixTable('items') . '
3031
+                    FROM ' . prefixTable('items').'
3032 3032
                     WHERE perso = 1 AND id_tree IN %ls AND encryption_type != %s',
3033 3033
                     $session->get('user-personal_folders'),
3034 3034
                     'teampass_aes'
@@ -3098,7 +3098,7 @@  discard block
 block discarded – undo
3098 3098
         // Get user info
3099 3099
         $userData = DB::queryFirstRow(
3100 3100
             'SELECT special, auth_type, is_ready_for_usage, ongoing_process_id, otp_provided, keys_recovery_time
3101
-            FROM ' . prefixTable('users') . '
3101
+            FROM ' . prefixTable('users').'
3102 3102
             WHERE id = %i',
3103 3103
             $post_user_id
3104 3104
         );
@@ -3145,7 +3145,7 @@  discard block
 block discarded – undo
3145 3145
         // Get user info
3146 3146
         $userData = DB::queryFirstRow(
3147 3147
             'SELECT auth_type, login, private_key
3148
-            FROM ' . prefixTable('users') . '
3148
+            FROM ' . prefixTable('users').'
3149 3149
             WHERE id = %i',
3150 3150
             $post_user_id
3151 3151
         );
@@ -3195,7 +3195,7 @@  discard block
 block discarded – undo
3195 3195
                 return prepareExchangedData(
3196 3196
                     array(
3197 3197
                         'error' => false,
3198
-                        'message' => $lang->get('done'),'',
3198
+                        'message' => $lang->get('done'), '',
3199 3199
                     ),
3200 3200
                     'encode'
3201 3201
                 );
@@ -3243,7 +3243,7 @@  discard block
 block discarded – undo
3243 3243
         // Get user info
3244 3244
         $userData = DB::queryFirstRow(
3245 3245
             'SELECT auth_type, login, private_key, special
3246
-            FROM ' . prefixTable('users') . '
3246
+            FROM ' . prefixTable('users').'
3247 3247
             WHERE id = %i',
3248 3248
             $post_user_id
3249 3249
         );
@@ -3277,7 +3277,7 @@  discard block
 block discarded – undo
3277 3277
                 return prepareExchangedData(
3278 3278
                     array(
3279 3279
                         'error' => false,
3280
-                        'message' => $lang->get('done'),'',
3280
+                        'message' => $lang->get('done'), '',
3281 3281
                     ),
3282 3282
                     'encode'
3283 3283
                 );
@@ -3299,8 +3299,8 @@  discard block
 block discarded – undo
3299 3299
             // Get one itemKey from current user
3300 3300
             $currentUserKey = DB::queryFirstRow(
3301 3301
                 'SELECT ski.share_key, ski.increment_id, l.id_user
3302
-                FROM ' . prefixTable('sharekeys_items') . ' AS ski
3303
-                INNER JOIN ' . prefixTable('log_items') . ' AS l ON ski.object_id = l.id_item
3302
+                FROM ' . prefixTable('sharekeys_items').' AS ski
3303
+                INNER JOIN ' . prefixTable('log_items').' AS l ON ski.object_id = l.id_item
3304 3304
                 WHERE ski.user_id = %i
3305 3305
                 ORDER BY RAND()
3306 3306
                 LIMIT 1',
@@ -3390,7 +3390,7 @@  discard block
 block discarded – undo
3390 3390
             $session->get('user-id')
3391 3391
         );
3392 3392
         // Return data
3393
-        return '[{"new_value":"' . $session->get('user-session_duration') . '"}]';
3393
+        return '[{"new_value":"'.$session->get('user-session_duration').'"}]';
3394 3394
     }
3395 3395
     
3396 3396
     return '[{"new_value":"expired"}]';
Please login to merge, or discard this patch.
pages/2fa.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('mfa') === false) {
70 70
     // Not allowed page
71 71
     $session->set('system-error_code', ERR_NOT_ALLOWED);
72
-    include $SETTINGS['cpassman_dir'] . '/error.php';
72
+    include $SETTINGS['cpassman_dir'].'/error.php';
73 73
     exit;
74 74
 }
75 75
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
                                     $roles = getRolesTitles();
142 142
                                     foreach ($roles as $role) {
143 143
                                         echo '
144
-                                    <option value="' . $role['id'] . '"', in_array($role['id'], $arrRolesMFA) === true ? ' selected' : '', '>' . addslashes($role['title']) . '</option>';
144
+                                    <option value="' . $role['id'].'"', in_array($role['id'], $arrRolesMFA) === true ? ' selected' : '', '>'.addslashes($role['title']).'</option>';
145 145
                                     }
146 146
                                     ?>
147 147
                                 </select>
Please login to merge, or discard this patch.
pages/options.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('options') === false) {
70 70
     // Not allowed page
71 71
     $session->set('system-error_code', ERR_NOT_ALLOWED);
72
-    include $SETTINGS['cpassman_dir'] . '/error.php';
72
+    include $SETTINGS['cpassman_dir'].'/error.php';
73 73
     exit;
74 74
 }
75 75
 
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
                                     // get list of all timezones
323 323
                                     foreach ($zones as $key => $zone) {
324 324
                                         echo '
325
-                                <option value="' . $key . '"', isset($SETTINGS['timezone']) === true && $SETTINGS['timezone'] === $key ? ' selected' : '', '>' . $zone . '</option>';
325
+                                <option value="' . $key.'"', isset($SETTINGS['timezone']) === true && $SETTINGS['timezone'] === $key ? ' selected' : '', '>'.$zone.'</option>';
326 326
                                     }
327 327
                                     ?>
328 328
                                 </select>
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
                                     <?php
374 374
                                     foreach ($languagesList as $teampassLang) {
375 375
                                         echo '
376
-                                <option value="' . $teampassLang . '"', isset($SETTINGS['default_language']) === true && $SETTINGS['default_language'] === $teampassLang ? ' selected' : '', '>' . $teampassLang . '</option>';
376
+                                <option value="' . $teampassLang.'"', isset($SETTINGS['default_language']) === true && $SETTINGS['default_language'] === $teampassLang ? ' selected' : '', '>'.$teampassLang.'</option>';
377 377
                                     }
378 378
                                     ?>
379 379
                                 </select>
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
                                 <?php
471 471
                                 foreach (TP_PW_COMPLEXITY as $complex) {
472 472
                                     echo '
473
-                                <option value="' . $complex[0] . '"', isset($SETTINGS['personal_saltkey_security_level']) === true && $SETTINGS['personal_saltkey_security_level'] === $complex[0] ? ' selected' : '', '>' . $complex[1] . '</option>';
473
+                                <option value="' . $complex[0].'"', isset($SETTINGS['personal_saltkey_security_level']) === true && $SETTINGS['personal_saltkey_security_level'] === $complex[0] ? ' selected' : '', '>'.$complex[1].'</option>';
474 474
                                 }
475 475
                                 ?>
476 476
                             </select>
@@ -802,7 +802,7 @@  discard block
 block discarded – undo
802 802
                                         $roles = getRolesTitles();
803 803
                                         foreach ($roles as $role) {
804 804
                                             echo '
805
-                                    <option value="' . htmlspecialchars($role['id']) . '"', in_array($role['id'], $arrRolesToPrint) === true ? ' selected' : '', '>' . htmlspecialchars(addslashes($role['title'])) . '</option>';
805
+                                    <option value="' . htmlspecialchars($role['id']).'"', in_array($role['id'], $arrRolesToPrint) === true ? ' selected' : '', '>'.htmlspecialchars(addslashes($role['title'])).'</option>';
806 806
                                         }
807 807
                                     }
808 808
                                     ?>
@@ -1029,7 +1029,7 @@  discard block
 block discarded – undo
1029 1029
                                     <?php
1030 1030
                                     foreach (TP_PW_COMPLEXITY as $complex) {
1031 1031
                                         echo '
1032
-                                <option value="' . $complex[0] . '"', isset($SETTINGS['offline_key_level']) === true && $SETTINGS['offline_key_level'] === $complex[0] ? ' selected' : '', '>' . $complex[1] . '</option>';
1032
+                                <option value="' . $complex[0].'"', isset($SETTINGS['offline_key_level']) === true && $SETTINGS['offline_key_level'] === $complex[0] ? ' selected' : '', '>'.$complex[1].'</option>';
1033 1033
                                     }
1034 1034
                                     ?>
1035 1035
                                 </select>
Please login to merge, or discard this patch.
sources/backups.queries.php 2 patches
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 ) {
78 78
     // Not allowed page
79 79
     $session->set('system-error_code', ERR_NOT_ALLOWED);
80
-    include $SETTINGS['cpassman_dir'] . '/error.php';
80
+    include $SETTINGS['cpassman_dir'].'/error.php';
81 81
     exit;
82 82
 }
83 83
 
@@ -138,21 +138,21 @@  discard block
 block discarded – undo
138 138
             // Prepare variables
139 139
             $post_key = filter_var($dataReceived['encryptionKey'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
140 140
 
141
-            require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
141
+            require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
142 142
             $return = '';
143 143
 
144 144
             //Get all tables
145 145
             $tables = array();
146 146
             $result = DB::query('SHOW TABLES');
147 147
             foreach ($result as $row) {
148
-                $tables[] = $row['Tables_in_' . DB_NAME];
148
+                $tables[] = $row['Tables_in_'.DB_NAME];
149 149
             }
150 150
 
151 151
             //cycle through
152 152
             foreach ($tables as $table) {
153 153
                 if (empty($pre) || substr_count($table, $pre) > 0) {
154 154
                     // Do query
155
-                    $result = DB::queryRaw('SELECT * FROM ' . $table);
155
+                    $result = DB::queryRaw('SELECT * FROM '.$table);
156 156
                     DB::queryRaw(
157 157
                         'SELECT *
158 158
                         FROM INFORMATION_SCHEMA.COLUMNS
@@ -164,17 +164,17 @@  discard block
 block discarded – undo
164 164
                     $numFields = DB::count();
165 165
 
166 166
                     // prepare a drop table
167
-                    $return .= 'DROP TABLE ' . $table . ';';
168
-                    $row2 = DB::queryfirstrow('SHOW CREATE TABLE ' . $table);
169
-                    $return .= "\n\n" . $row2['Create Table'] . ";\n\n";
167
+                    $return .= 'DROP TABLE '.$table.';';
168
+                    $row2 = DB::queryfirstrow('SHOW CREATE TABLE '.$table);
169
+                    $return .= "\n\n".$row2['Create Table'].";\n\n";
170 170
 
171 171
                     //prepare all fields and datas
172 172
                     for ($i = 0; $i < $numFields; ++$i) {
173 173
                         while ($row = $result->fetch_row()) {
174
-                            $return .= 'INSERT INTO ' . $table . ' VALUES(';
174
+                            $return .= 'INSERT INTO '.$table.' VALUES(';
175 175
                             for ($j = 0; $j < $numFields; ++$j) {
176 176
                                 // Manage NULL values
177
-                                $value = $row[$j] === null ? 'NULL' : '"' . addslashes(preg_replace("/\n/", '\\n', $row[$j])) . '"';                    
177
+                                $value = $row[$j] === null ? 'NULL' : '"'.addslashes(preg_replace("/\n/", '\\n', $row[$j])).'"';                    
178 178
                                 $return .= $value;
179 179
                                 if ($j < ($numFields - 1)) {
180 180
                                     $return .= ',';
@@ -192,8 +192,8 @@  discard block
 block discarded – undo
192 192
                 $token = GenerateCryptKey(20, false, true, true, false, true);
193 193
 
194 194
                 //save file
195
-                $filename = time() . '-' . $token . '.sql';
196
-                $handle = fopen($SETTINGS['path_to_files_folder'] . '/' . $filename, 'w+');
195
+                $filename = time().'-'.$token.'.sql';
196
+                $handle = fopen($SETTINGS['path_to_files_folder'].'/'.$filename, 'w+');
197 197
                 if ($handle !== false) {
198 198
                     //write file
199 199
                     fwrite($handle, $return);
@@ -205,16 +205,16 @@  discard block
 block discarded – undo
205 205
                     // Encrypt the file
206 206
                     prepareFileWithDefuse(
207 207
                         'encrypt',
208
-                        $SETTINGS['path_to_files_folder'] . '/' . $filename,
209
-                        $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
208
+                        $SETTINGS['path_to_files_folder'].'/'.$filename,
209
+                        $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
210 210
                         $post_key
211 211
                     );
212 212
 
213 213
                     // Do clean
214
-                    unlink($SETTINGS['path_to_files_folder'] . '/' . $filename);
214
+                    unlink($SETTINGS['path_to_files_folder'].'/'.$filename);
215 215
                     rename(
216
-                        $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
217
-                        $SETTINGS['path_to_files_folder'] . '/' . $filename
216
+                        $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
217
+                        $SETTINGS['path_to_files_folder'].'/'.$filename
218 218
                     );
219 219
                 }
220 220
 
@@ -234,9 +234,9 @@  discard block
 block discarded – undo
234 234
                     array(
235 235
                         'error' => false,
236 236
                         'message' => '',
237
-                        'download' => 'sources/downloadFile.php?name=' . urlencode($filename) .
238
-                            '&sub=files&file=' . $filename . '&type=sql&key=' . $session->get('key') . '&key_tmp=' .
239
-                            $session->get('user-key_tmp') . '&pathIsFiles=1',
237
+                        'download' => 'sources/downloadFile.php?name='.urlencode($filename).
238
+                            '&sub=files&file='.$filename.'&type=sql&key='.$session->get('key').'&key_tmp='.
239
+                            $session->get('user-key_tmp').'&pathIsFiles=1',
240 240
                     ),
241 241
                     'encode'
242 242
                 );
@@ -303,13 +303,13 @@  discard block
 block discarded – undo
303 303
             
304 304
             if (WIP === true) error_log('DEBUG: Offset -> '.$post_offset.'/'.$post_totalSize.' | File -> '.$post_clearFilename.' | key -> '.$post_key);
305 305
 
306
-            include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
306
+            include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
307 307
 
308 308
             if (empty($post_clearFilename) === true) {
309 309
                 // Get filename from database
310 310
                 $data = DB::queryFirstRow(
311 311
                     'SELECT valeur
312
-                    FROM ' . prefixTable('misc') . '
312
+                    FROM ' . prefixTable('misc').'
313 313
                     WHERE increment_id = %i',
314 314
                     $post_backupFile
315 315
                 );
@@ -329,8 +329,8 @@  discard block
 block discarded – undo
329 329
                     
330 330
                     $ret = prepareFileWithDefuse(
331 331
                         'decrypt',
332
-                        $SETTINGS['path_to_files_folder'] . '/' . $post_backupFile,
333
-                        $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $post_backupFile,
332
+                        $SETTINGS['path_to_files_folder'].'/'.$post_backupFile,
333
+                        $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$post_backupFile,
334 334
                         $post_key
335 335
                     );
336 336
                     
@@ -346,8 +346,8 @@  discard block
 block discarded – undo
346 346
                     }
347 347
 
348 348
                     // Do clean
349
-                    fileDelete($SETTINGS['path_to_files_folder'] . '/' . $post_backupFile, $SETTINGS);
350
-                    $post_backupFile = $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $post_backupFile;
349
+                    fileDelete($SETTINGS['path_to_files_folder'].'/'.$post_backupFile, $SETTINGS);
350
+                    $post_backupFile = $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$post_backupFile;
351 351
                 } else {
352 352
                     echo prepareExchangedData(
353 353
                         array(
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -301,7 +301,9 @@
 block discarded – undo
301 301
                 break;
302 302
             }
303 303
             
304
-            if (WIP === true) error_log('DEBUG: Offset -> '.$post_offset.'/'.$post_totalSize.' | File -> '.$post_clearFilename.' | key -> '.$post_key);
304
+            if (WIP === true) {
305
+                error_log('DEBUG: Offset -> '.$post_offset.'/'.$post_totalSize.' | File -> '.$post_clearFilename.' | key -> '.$post_key);
306
+            }
305 307
 
306 308
             include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
307 309
 
Please login to merge, or discard this patch.
sources/admin.queries.php 1 patch
Spacing   +124 added lines, -124 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('admin') === false) {
73 73
     // Not allowed page
74 74
     $session->set('system-error_code', ERR_NOT_ALLOWED);
75
-    include $SETTINGS['cpassman_dir'] . '/error.php';
75
+    include $SETTINGS['cpassman_dir'].'/error.php';
76 76
     exit;
77 77
 }
78 78
 
@@ -133,21 +133,21 @@  discard block
 block discarded – undo
133 133
             break;
134 134
         }
135 135
 
136
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
136
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
137 137
         $return = '';
138 138
 
139 139
         //Get all tables
140 140
         $tables = array();
141 141
         $result = DB::query('SHOW TABLES');
142 142
         foreach ($result as $row) {
143
-            $tables[] = $row['Tables_in_' . $database];
143
+            $tables[] = $row['Tables_in_'.$database];
144 144
         }
145 145
 
146 146
         //cycle through
147 147
         foreach ($tables as $table) {
148 148
             if (defined('DB_PREFIX') || substr_count($table, DB_PREFIX) > 0) {
149 149
                 // Do query
150
-                $result = DB::queryRaw('SELECT * FROM ' . $table);
150
+                $result = DB::queryRaw('SELECT * FROM '.$table);
151 151
                 DB::queryRaw(
152 152
                     'SELECT *
153 153
                     FROM INFORMATION_SCHEMA.COLUMNS
@@ -159,19 +159,19 @@  discard block
 block discarded – undo
159 159
                 $numFields = DB::count();
160 160
 
161 161
                 // prepare a drop table
162
-                $return .= 'DROP TABLE ' . $table . ';';
163
-                $row2 = DB::queryfirstrow('SHOW CREATE TABLE ' . $table);
164
-                $return .= "\n\n" . $row2['Create Table'] . ";\n\n";
162
+                $return .= 'DROP TABLE '.$table.';';
163
+                $row2 = DB::queryfirstrow('SHOW CREATE TABLE '.$table);
164
+                $return .= "\n\n".$row2['Create Table'].";\n\n";
165 165
 
166 166
                 //prepare all fields and datas
167 167
                 for ($i = 0; $i < $numFields; ++$i) {
168 168
                     while ($row = $result->fetch_row()) {
169
-                        $return .= 'INSERT INTO ' . $table . ' VALUES(';
169
+                        $return .= 'INSERT INTO '.$table.' VALUES(';
170 170
                         for ($j = 0; $j < $numFields; ++$j) {
171 171
                             $row[$j] = addslashes($row[$j]);
172 172
                             $row[$j] = preg_replace("/\n/", '\\n', $row[$j]);
173 173
                             if (isset($row[$j])) {
174
-                                $return .= '"' . $row[$j] . '"';
174
+                                $return .= '"'.$row[$j].'"';
175 175
                             } else {
176 176
                                 $return .= 'NULL';
177 177
                             }
@@ -191,8 +191,8 @@  discard block
 block discarded – undo
191 191
             $token = GenerateCryptKey(20, false, true, true, false, true);
192 192
 
193 193
             //save file
194
-            $filename = time() . '-' . $token . '.sql';
195
-            $handle = fopen($SETTINGS['path_to_files_folder'] . '/' . $filename, 'w+');
194
+            $filename = time().'-'.$token.'.sql';
195
+            $handle = fopen($SETTINGS['path_to_files_folder'].'/'.$filename, 'w+');
196 196
             if ($handle !== false) {
197 197
                 //write file
198 198
                 fwrite($handle, $return);
@@ -204,16 +204,16 @@  discard block
 block discarded – undo
204 204
                 // Encrypt the file
205 205
                 prepareFileWithDefuse(
206 206
                     'encrypt',
207
-                    $SETTINGS['path_to_files_folder'] . '/' . $filename,
208
-                    $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
207
+                    $SETTINGS['path_to_files_folder'].'/'.$filename,
208
+                    $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
209 209
                     $post_option
210 210
                 );
211 211
 
212 212
                 // Do clean
213
-                unlink($SETTINGS['path_to_files_folder'] . '/' . $filename);
213
+                unlink($SETTINGS['path_to_files_folder'].'/'.$filename);
214 214
                 rename(
215
-                    $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
216
-                    $SETTINGS['path_to_files_folder'] . '/' . $filename
215
+                    $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
216
+                    $SETTINGS['path_to_files_folder'].'/'.$filename
217 217
                 );
218 218
             }
219 219
 
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
             //update LOG
224 224
             logEvents($SETTINGS, 'admin_action', 'dataBase backup', (string) $session->get('user-id'), $session->get('user-login'));
225 225
 
226
-            echo '[{"result":"db_backup" , "href":"sources/downloadFile.php?name=' . urlencode($filename) . '&sub=files&file=' . $filename . '&type=sql&key=' . $session->get('key') . '&key_tmp=' . $session->get('user-key_tmp') . '&pathIsFiles=1"}]';
226
+            echo '[{"result":"db_backup" , "href":"sources/downloadFile.php?name='.urlencode($filename).'&sub=files&file='.$filename.'&type=sql&key='.$session->get('key').'&key_tmp='.$session->get('user-key_tmp').'&pathIsFiles=1"}]';
227 227
         }
228 228
         break;
229 229
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
             );
253 253
             break;
254 254
         }
255
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
255
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
256 256
 
257 257
         $dataPost = explode('&', $post_option);
258 258
         $file = htmlspecialchars($dataPost[0]);
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
         // Get filename from database
262 262
         $data = DB::queryFirstRow(
263 263
             'SELECT valeur
264
-            FROM ' . prefixTable('misc') . '
264
+            FROM ' . prefixTable('misc').'
265 265
             WHERE increment_id = %i',
266 266
             $file
267 267
         );
@@ -280,8 +280,8 @@  discard block
 block discarded – undo
280 280
             // Decrypt the file
281 281
             $ret = prepareFileWithDefuse(
282 282
                 'decrypt',
283
-                $SETTINGS['path_to_files_folder'] . '/' . $file,
284
-                $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $file,
283
+                $SETTINGS['path_to_files_folder'].'/'.$file,
284
+                $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$file,
285 285
                 $key
286 286
             );
287 287
 
@@ -292,10 +292,10 @@  discard block
 block discarded – undo
292 292
             }
293 293
 
294 294
             // Do clean
295
-            fileDelete($SETTINGS['path_to_files_folder'] . '/' . $file, $SETTINGS);
296
-            $file = $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $file;
295
+            fileDelete($SETTINGS['path_to_files_folder'].'/'.$file, $SETTINGS);
296
+            $file = $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$file;
297 297
         } else {
298
-            $file = $SETTINGS['path_to_files_folder'] . '/' . $file;
298
+            $file = $SETTINGS['path_to_files_folder'].'/'.$file;
299 299
         }
300 300
 
301 301
         //read sql file
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
         fclose($handle);
313 313
 
314 314
         //delete file
315
-        unlink($SETTINGS['path_to_files_folder'] . '/' . $file);
315
+        unlink($SETTINGS['path_to_files_folder'].'/'.$file);
316 316
 
317 317
         //Show done
318 318
         echo '[{"result":"db_restore" , "message":""}]';
@@ -350,8 +350,8 @@  discard block
 block discarded – undo
350 350
             foreach ($table as $i => $tablename) {
351 351
                 if (substr_count($tablename, DB_PREFIX) > 0) {
352 352
                     // launch optimization quieries
353
-                    DB::query('ANALYZE TABLE `' . $tablename . '`');
354
-                    DB::query('OPTIMIZE TABLE `' . $tablename . '`');
353
+                    DB::query('ANALYZE TABLE `'.$tablename.'`');
354
+                    DB::query('OPTIMIZE TABLE `'.$tablename.'`');
355 355
                 }
356 356
             }
357 357
         }
@@ -359,12 +359,12 @@  discard block
 block discarded – undo
359 359
         //Clean up LOG_ITEMS table
360 360
         $rows = DB::query(
361 361
             'SELECT id
362
-            FROM ' . prefixTable('items') . '
362
+            FROM ' . prefixTable('items').'
363 363
             ORDER BY id ASC'
364 364
         );
365 365
         foreach ($rows as $item) {
366 366
             DB::query(
367
-                'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i AND action = %s',
367
+                'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i AND action = %s',
368 368
                 $item['id'],
369 369
                 'at_creation'
370 370
             );
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
             if ($counter === 0) {
373 373
                 //Create new at_creation entry
374 374
                 $rowTmp = DB::queryFirstRow(
375
-                    'SELECT date, id_user FROM ' . prefixTable('log_items') . ' WHERE id_item=%i ORDER BY date ASC',
375
+                    'SELECT date, id_user FROM '.prefixTable('log_items').' WHERE id_item=%i ORDER BY date ASC',
376 376
                     $item['id']
377 377
                 );
378 378
                 DB::insert(
@@ -402,8 +402,8 @@  discard block
 block discarded – undo
402 402
         echo prepareExchangedData(
403 403
             array(
404 404
                 'error' => false,
405
-                'message' => $lang->get('last_execution') . ' ' .
406
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
405
+                'message' => $lang->get('last_execution').' '.
406
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
407 407
                     '<i class="fas fa-check text-success ml-2"></i>',
408 408
             ),
409 409
             'encode'
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
             break;
440 440
         }
441 441
 
442
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
442
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
443 443
         updateCacheTable('reload', NULL);
444 444
 
445 445
         // Log
@@ -455,8 +455,8 @@  discard block
 block discarded – undo
455 455
         echo prepareExchangedData(
456 456
             [
457 457
                 'error' => false,
458
-                'message' => $lang->get('last_execution') . ' ' .
459
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
458
+                'message' => $lang->get('last_execution').' '.
459
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
460 460
                     '<i class="fas fa-check text-success mr-2"></i>',
461 461
             ],
462 462
             'encode'
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
         $session->set('user-reencrypt_old_salt', file_get_contents(SECUREPATH.'/'.SECUREFILE));
499 499
 
500 500
         // generate new saltkey
501
-        $old_sk_filename = SECUREPATH.'/'.SECUREFILE . date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))) . '.' . time();
501
+        $old_sk_filename = SECUREPATH.'/'.SECUREFILE.date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))).'.'.time();
502 502
         copy(
503 503
             SECUREPATH.'/'.SECUREFILE,
504 504
             $old_sk_filename
@@ -527,13 +527,13 @@  discard block
 block discarded – undo
527 527
         logEvents($SETTINGS, 'system', 'change_salt_key', (string) $session->get('user-id'), $session->get('user-login'));
528 528
 
529 529
         // get number of items to change
530
-        DB::query('SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i', 0);
530
+        DB::query('SELECT id FROM '.prefixTable('items').' WHERE perso = %i', 0);
531 531
         $nb_of_items = DB::count();
532 532
 
533 533
         // create backup table
534
-        DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
534
+        DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup'));
535 535
         DB::query(
536
-            'CREATE TABLE `' . prefixTable('sk_reencrypt_backup') . '` (
536
+            'CREATE TABLE `'.prefixTable('sk_reencrypt_backup').'` (
537 537
             `id` int(12) NOT null AUTO_INCREMENT,
538 538
             `current_table` varchar(100) NOT NULL,
539 539
             `current_field` varchar(500) NOT NULL,
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
         );
562 562
 
563 563
         // delete previous backup files
564
-        $files = glob($SETTINGS['path_to_upload_folder'] . '/*'); // get all file names
564
+        $files = glob($SETTINGS['path_to_upload_folder'].'/*'); // get all file names
565 565
         foreach ($files as $file) { // iterate files
566 566
             if (is_file($file)) {
567 567
                 $file_parts = pathinfo($file);
@@ -643,7 +643,7 @@  discard block
 block discarded – undo
643 643
                 echo prepareExchangedData(
644 644
                     array(
645 645
                         'error' => true,
646
-                        'message' => 'Input `' . $objects[0] . '` is not allowed',
646
+                        'message' => 'Input `'.$objects[0].'` is not allowed',
647 647
                         'nbOfItems' => '',
648 648
                         'nextAction' => '',
649 649
                     ),
@@ -656,9 +656,9 @@  discard block
 block discarded – undo
656 656
                 //change all encrypted data in Items (passwords)
657 657
                 $rows = DB::query(
658 658
                     'SELECT id, pw, pw_iv
659
-                    FROM ' . prefixTable('items') . '
659
+                    FROM ' . prefixTable('items').'
660 660
                     WHERE perso = %s
661
-                    LIMIT ' . $post_start . ', ' . $post_length,
661
+                    LIMIT ' . $post_start.', '.$post_length,
662 662
                     '0'
663 663
                 );
664 664
                 foreach ($rows as $record) {
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
                             'current_field' => 'pw',
671 671
                             'value_id' => $record['id'],
672 672
                             'value' => $record['pw'],
673
-                            'current_sql' => 'UPDATE ' . prefixTable('items') . " SET pw = '" . $record['pw'] . "' WHERE id = '" . $record['id'] . "';",
673
+                            'current_sql' => 'UPDATE '.prefixTable('items')." SET pw = '".$record['pw']."' WHERE id = '".$record['id']."';",
674 674
                             'value2' => 'none',
675 675
                             'result' => 'none',
676 676
                         )
@@ -719,9 +719,9 @@  discard block
 block discarded – undo
719 719
                 //change all encrypted data in Logs (passwords)
720 720
                 $rows = DB::query(
721 721
                     'SELECT raison, increment_id
722
-                    FROM ' . prefixTable('log_items') . "
722
+                    FROM ' . prefixTable('log_items')."
723 723
                     WHERE action = %s AND raison LIKE 'at_pw :%'
724
-                    LIMIT " . $post_start . ', ' . $post_length,
724
+                    LIMIT " . $post_start.', '.$post_length,
725 725
                     'at_modification'
726 726
                 );
727 727
                 foreach ($rows as $record) {
@@ -733,7 +733,7 @@  discard block
 block discarded – undo
733 733
                             'current_field' => 'raison',
734 734
                             'value_id' => $record['increment_id'],
735 735
                             'value' => $record['raison'],
736
-                            'current_sql' => 'UPDATE ' . prefixTable('log_items') . " SET raison = '" . $record['raison'] . "' WHERE increment_id = '" . $record['increment_id'] . "';",
736
+                            'current_sql' => 'UPDATE '.prefixTable('log_items')." SET raison = '".$record['raison']."' WHERE increment_id = '".$record['increment_id']."';",
737 737
                             'value2' => 'none',
738 738
                             'result' => 'none',
739 739
                         )
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
                         DB::update(
762 762
                             prefixTable('log_items'),
763 763
                             array(
764
-                                'raison' => 'at_pw :' . $encrypt['string'],
764
+                                'raison' => 'at_pw :'.$encrypt['string'],
765 765
                                 'encryption_type' => 'defuse',
766 766
                             ),
767 767
                             'increment_id = %i',
@@ -786,8 +786,8 @@  discard block
 block discarded – undo
786 786
                 //change all encrypted data in CATEGORIES (passwords)
787 787
                 $rows = DB::query(
788 788
                     'SELECT id, data
789
-                    FROM ' . prefixTable('categories_items') . '
790
-                    LIMIT ' . $post_start . ', ' . $post_length
789
+                    FROM ' . prefixTable('categories_items').'
790
+                    LIMIT ' . $post_start.', '.$post_length
791 791
                 );
792 792
                 foreach ($rows as $record) {
793 793
                     // backup data
@@ -798,7 +798,7 @@  discard block
 block discarded – undo
798 798
                             'current_field' => 'data',
799 799
                             'value_id' => $record['id'],
800 800
                             'value' => $record['data'],
801
-                            'current_sql' => 'UPDATE ' . prefixTable('categories_items') . " SET data = '" . $record['data'] . "' WHERE id = '" . $record['id'] . "';",
801
+                            'current_sql' => 'UPDATE '.prefixTable('categories_items')." SET data = '".$record['data']."' WHERE id = '".$record['id']."';",
802 802
                             'value2' => 'none',
803 803
                             'result' => 'none',
804 804
                         )
@@ -846,9 +846,9 @@  discard block
 block discarded – undo
846 846
                 // Change all encrypted data in FILES (passwords)
847 847
                 $rows = DB::query(
848 848
                     'SELECT id, file, status
849
-                    FROM ' . prefixTable('files') . "
849
+                    FROM ' . prefixTable('files')."
850 850
                     WHERE status = 'encrypted'
851
-                    LIMIT " . $post_start . ', ' . $post_length
851
+                    LIMIT " . $post_start.', '.$post_length
852 852
                 );
853 853
                 foreach ($rows as $record) {
854 854
                     // backup data
@@ -866,20 +866,20 @@  discard block
 block discarded – undo
866 866
                     );
867 867
                     $newID = DB::insertId();
868 868
 
869
-                    if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['file'])) {
869
+                    if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['file'])) {
870 870
                         // make a copy of file
871 871
                         if (!copy(
872
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
873
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '.copy'
872
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
873
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'.copy'
874 874
                         )) {
875 875
                             $error = 'Copy not possible';
876 876
                             exit;
877 877
                         } else {
878 878
                             // prepare a bck of file (that will not be deleted)
879
-                            $backup_filename = $record['file'] . '.bck-change-sk.' . time();
879
+                            $backup_filename = $record['file'].'.bck-change-sk.'.time();
880 880
                             copy(
881
-                                $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
882
-                                $SETTINGS['path_to_upload_folder'] . '/' . $backup_filename
881
+                                $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
882
+                                $SETTINGS['path_to_upload_folder'].'/'.$backup_filename
883 883
                             );
884 884
                         }
885 885
 
@@ -887,22 +887,22 @@  discard block
 block discarded – undo
887 887
                         // STEP1 - Do decryption
888 888
                         prepareFileWithDefuse(
889 889
                             'decrypt',
890
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
891
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted'
890
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
891
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted'
892 892
                         );
893 893
 
894 894
                         // Do cleanup of files
895
-                        unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['file']);
895
+                        unlink($SETTINGS['path_to_upload_folder'].'/'.$record['file']);
896 896
 
897 897
                         // STEP2 - Do encryption
898 898
                         prepareFileWithDefuse(
899 899
                             'encryp',
900
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted',
901
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file']
900
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted',
901
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file']
902 902
                         );
903 903
 
904 904
                         // Do cleanup of files
905
-                        unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted');
905
+                        unlink($SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted');
906 906
 
907 907
                         // Update backup table
908 908
                         DB::update(
@@ -928,13 +928,13 @@  discard block
 block discarded – undo
928 928
                 // do some things for new object
929 929
                 if (isset($objects[0])) {
930 930
                     if ($objects[0] === 'logs') {
931
-                        DB::query('SELECT increment_id FROM ' . prefixTable('log_items') . " WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
931
+                        DB::query('SELECT increment_id FROM '.prefixTable('log_items')." WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
932 932
                     } elseif ($objects[0] === 'files') {
933
-                        DB::query('SELECT id FROM ' . prefixTable('files'));
933
+                        DB::query('SELECT id FROM '.prefixTable('files'));
934 934
                     } elseif ($objects[0] === 'categories') {
935
-                        DB::query('SELECT id FROM ' . prefixTable('categories_items'));
935
+                        DB::query('SELECT id FROM '.prefixTable('categories_items'));
936 936
                     } elseif ($objects[0] === 'custfields') {
937
-                        DB::query('SELECT raison FROM ' . prefixTable('log_items') . " WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
937
+                        DB::query('SELECT raison FROM '.prefixTable('log_items')." WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
938 938
                     }
939 939
                     $nb_of_items = DB::count();
940 940
                 } else {
@@ -1054,12 +1054,12 @@  discard block
 block discarded – undo
1054 1054
                 );
1055 1055
             } elseif ($record['current_table'] === 'files') {
1056 1056
                 // restore backup file
1057
-                if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value'])) {
1058
-                    unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['value']);
1059
-                    if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value2'])) {
1057
+                if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value'])) {
1058
+                    unlink($SETTINGS['path_to_upload_folder'].'/'.$record['value']);
1059
+                    if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value2'])) {
1060 1060
                         rename(
1061
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['value2'],
1062
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['value']
1061
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['value2'],
1062
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['value']
1063 1063
                         );
1064 1064
                     }
1065 1065
                 }
@@ -1078,7 +1078,7 @@  discard block
 block discarded – undo
1078 1078
         }
1079 1079
 
1080 1080
         // drop table
1081
-        DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
1081
+        DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup'));
1082 1082
 
1083 1083
         // Send back
1084 1084
         echo prepareExchangedData(
@@ -1121,17 +1121,17 @@  discard block
 block discarded – undo
1121 1121
         // delete files
1122 1122
         $rows = DB::query(
1123 1123
             'SELECT value, value2
1124
-            FROM ' . prefixTable('sk_reencrypt_backup') . "
1124
+            FROM ' . prefixTable('sk_reencrypt_backup')."
1125 1125
             WHERE current_table = 'files'"
1126 1126
         );
1127 1127
         foreach ($rows as $record) {
1128
-            if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value2'])) {
1129
-                unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['value2']);
1128
+            if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value2'])) {
1129
+                unlink($SETTINGS['path_to_upload_folder'].'/'.$record['value2']);
1130 1130
             }
1131 1131
         }
1132 1132
 
1133 1133
         // drop table
1134
-        DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
1134
+        DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup'));
1135 1135
 
1136 1136
         echo '[{"status":"done"}]';
1137 1137
         break;
@@ -1162,7 +1162,7 @@  discard block
 block discarded – undo
1162 1162
                 'encode'
1163 1163
             );
1164 1164
         } else {
1165
-            require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1165
+            require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1166 1166
 
1167 1167
             //send email
1168 1168
             $emailSettings = new EmailSettings($SETTINGS);
@@ -1200,13 +1200,13 @@  discard block
 block discarded – undo
1200 1200
             break;
1201 1201
         }
1202 1202
 
1203
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1203
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1204 1204
         $emailSettings = new EmailSettings($SETTINGS);
1205 1205
         $emailService = new EmailService();
1206 1206
 
1207 1207
         $rows = DB::query(
1208 1208
             'SELECT *
1209
-            FROM ' . prefixTable('emails') . '
1209
+            FROM ' . prefixTable('emails').'
1210 1210
             WHERE status = %s OR status = %s',
1211 1211
             'not_sent',
1212 1212
             ''
@@ -1292,13 +1292,13 @@  discard block
 block discarded – undo
1292 1292
             break;
1293 1293
         }
1294 1294
 
1295
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1295
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1296 1296
 
1297 1297
         // Instatiate email settings and service
1298 1298
         $emailSettings = new EmailSettings($SETTINGS);
1299 1299
         $emailService = new EmailService();
1300 1300
 
1301
-        $rows = DB::query('SELECT * FROM ' . prefixTable('emails') . ' WHERE status = %s OR status = %s', 'not_sent', '');
1301
+        $rows = DB::query('SELECT * FROM '.prefixTable('emails').' WHERE status = %s OR status = %s', 'not_sent', '');
1302 1302
         foreach ($rows as $record) {
1303 1303
             //send email
1304 1304
             $email = $emailService->sendMail(
@@ -1367,7 +1367,7 @@  discard block
 block discarded – undo
1367 1367
             break;
1368 1368
         }
1369 1369
 
1370
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1370
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1371 1371
 
1372 1372
         // init
1373 1373
         $filesList = array();
@@ -1380,7 +1380,7 @@  discard block
 block discarded – undo
1380 1380
                 FROM ' . prefixTable('files')
1381 1381
             );
1382 1382
             foreach ($rows as $record) {
1383
-                if (is_file($SETTINGS['path_to_upload_folder'] . '/' . $record['file'])) {
1383
+                if (is_file($SETTINGS['path_to_upload_folder'].'/'.$record['file'])) {
1384 1384
                     $addFile = false;
1385 1385
                     if (($post_option === 'attachments-decrypt' && $record['status'] === 'encrypted')
1386 1386
                         || ($post_option === 'attachments-encrypt' && $record['status'] === 'clear')
@@ -1445,8 +1445,8 @@  discard block
 block discarded – undo
1445 1445
         $post_list = filter_var_array($post_list, FILTER_SANITIZE_FULL_SPECIAL_CHARS);
1446 1446
         $post_counter = filter_var($post_counter, FILTER_SANITIZE_NUMBER_INT);
1447 1447
 
1448
-        include $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
1449
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1448
+        include $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
1449
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1450 1450
 
1451 1451
         $cpt = 0;
1452 1452
         $continu = true;
@@ -1459,33 +1459,33 @@  discard block
 block discarded – undo
1459 1459
                 // Get file name
1460 1460
                 $file_info = DB::queryfirstrow(
1461 1461
                     'SELECT file
1462
-                    FROM ' . prefixTable('files') . '
1462
+                    FROM ' . prefixTable('files').'
1463 1463
                     WHERE id = %i',
1464 1464
                     $file
1465 1465
                 );
1466 1466
 
1467 1467
                 // skip file is Coherancey not respected
1468
-                if (is_file($SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'])) {
1468
+                if (is_file($SETTINGS['path_to_upload_folder'].'/'.$file_info['file'])) {
1469 1469
                     // Case where we want to decrypt
1470 1470
                     if ($post_option === 'decrypt') {
1471 1471
                         prepareFileWithDefuse(
1472 1472
                             'decrypt',
1473
-                            $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'],
1474
-                            $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
1473
+                            $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'],
1474
+                            $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
1475 1475
                         );
1476 1476
                         // Case where we want to encrypt
1477 1477
                     } elseif ($post_option === 'encrypt') {
1478 1478
                         prepareFileWithDefuse(
1479 1479
                             'encrypt',
1480
-                            $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'],
1481
-                            $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
1480
+                            $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'],
1481
+                            $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
1482 1482
                         );
1483 1483
                     }
1484 1484
                     // Do file cleanup
1485
-                    fileDelete($SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'], $SETTINGS);
1485
+                    fileDelete($SETTINGS['path_to_upload_folder'].'/'.$file_info['file'], $SETTINGS);
1486 1486
                     rename(
1487
-                        $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
1488
-                        $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file']
1487
+                        $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
1488
+                        $SETTINGS['path_to_upload_folder'].'/'.$file_info['file']
1489 1489
                     );
1490 1490
 
1491 1491
                     // store in DB
@@ -1520,8 +1520,8 @@  discard block
 block discarded – undo
1520 1520
                 $post_option === 'attachments-decrypt' ? 'clear' : 'encrypted'
1521 1521
             );
1522 1522
 
1523
-            $message = $lang->get('last_execution') . ' ' .
1524
-                date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
1523
+            $message = $lang->get('last_execution').' '.
1524
+                date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
1525 1525
                 '<i class="fas fa-check text-success ml-2 mr-3"></i>';
1526 1526
         }
1527 1527
 
@@ -1615,7 +1615,7 @@  discard block
 block discarded – undo
1615 1615
             $post_id = filter_var($dataReceived['id'], FILTER_SANITIZE_NUMBER_INT);
1616 1616
 
1617 1617
             DB::query(
1618
-                'DELETE FROM ' . prefixTable('api') . ' WHERE increment_id = %i',
1618
+                'DELETE FROM '.prefixTable('api').' WHERE increment_id = %i',
1619 1619
                 $post_id
1620 1620
             );
1621 1621
         }
@@ -1710,7 +1710,7 @@  discard block
 block discarded – undo
1710 1710
             // Delete existing key
1711 1711
         } elseif (null !== $post_action && $post_action === 'delete') {
1712 1712
             $post_id = filter_var($dataReceived['id'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
1713
-            DB::query('DELETE FROM ' . prefixTable('api') . ' WHERE increment_id=%i', $post_id);
1713
+            DB::query('DELETE FROM '.prefixTable('api').' WHERE increment_id=%i', $post_id);
1714 1714
         }
1715 1715
 
1716 1716
         echo prepareExchangedData(
@@ -1725,7 +1725,7 @@  discard block
 block discarded – undo
1725 1725
 
1726 1726
     case 'save_api_status':
1727 1727
         // Do query
1728
-        DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'api');
1728
+        DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'api');
1729 1729
         $counter = DB::count();
1730 1730
         if ($counter === 0) {
1731 1731
             DB::insert(
@@ -1754,7 +1754,7 @@  discard block
 block discarded – undo
1754 1754
 
1755 1755
     case 'run_duo_config_check':
1756 1756
         //Libraries call
1757
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1757
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1758 1758
         // Check KEY
1759 1759
         if ($post_key !== $session->get('key')) {
1760 1760
             echo prepareExchangedData(
@@ -1860,7 +1860,7 @@  discard block
 block discarded – undo
1860 1860
         } else {
1861 1861
             $tmp = 1;
1862 1862
         }
1863
-        DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'google_authentication');
1863
+        DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'google_authentication');
1864 1864
         $counter = DB::count();
1865 1865
         if ($counter === 0) {
1866 1866
             DB::insert(
@@ -1888,7 +1888,7 @@  discard block
 block discarded – undo
1888 1888
 
1889 1889
         // ga_website_name
1890 1890
         if (is_null($dataReceived['ga_website_name']) === false) {
1891
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'ga_website_name');
1891
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'ga_website_name');
1892 1892
             $counter = DB::count();
1893 1893
             if ($counter === 0) {
1894 1894
                 DB::insert(
@@ -1918,7 +1918,7 @@  discard block
 block discarded – undo
1918 1918
         }
1919 1919
 
1920 1920
         // send data
1921
-        echo '[{"result" : "' . addslashes($LANG['done']) . '" , "error" : ""}]';
1921
+        echo '[{"result" : "'.addslashes($LANG['done']).'" , "error" : ""}]';
1922 1922
         break;
1923 1923
 
1924 1924
     case 'save_agses_options':
@@ -1941,7 +1941,7 @@  discard block
 block discarded – undo
1941 1941
 
1942 1942
         // agses_hosted_url
1943 1943
         if (!is_null($dataReceived['agses_hosted_url'])) {
1944
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_url');
1944
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_url');
1945 1945
             $counter = DB::count();
1946 1946
             if ($counter === 0) {
1947 1947
                 DB::insert(
@@ -1972,7 +1972,7 @@  discard block
 block discarded – undo
1972 1972
 
1973 1973
         // agses_hosted_id
1974 1974
         if (!is_null($dataReceived['agses_hosted_id'])) {
1975
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_id');
1975
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_id');
1976 1976
             $counter = DB::count();
1977 1977
             if ($counter === 0) {
1978 1978
                 DB::insert(
@@ -2003,7 +2003,7 @@  discard block
 block discarded – undo
2003 2003
 
2004 2004
         // agses_hosted_apikey
2005 2005
         if (!is_null($dataReceived['agses_hosted_apikey'])) {
2006
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_apikey');
2006
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_apikey');
2007 2007
             $counter = DB::count();
2008 2008
             if ($counter === 0) {
2009 2009
                 DB::insert(
@@ -2033,7 +2033,7 @@  discard block
 block discarded – undo
2033 2033
         }
2034 2034
 
2035 2035
         // send data
2036
-        echo '[{"result" : "' . addslashes($LANG['done']) . '" , "error" : ""}]';
2036
+        echo '[{"result" : "'.addslashes($LANG['done']).'" , "error" : ""}]';
2037 2037
         break;
2038 2038
 
2039 2039
     case 'save_option_change':
@@ -2073,7 +2073,7 @@  discard block
 block discarded – undo
2073 2073
 
2074 2074
         // Check if setting is already in DB. If NO then insert, if YES then update.
2075 2075
         $data = DB::query(
2076
-            'SELECT * FROM ' . prefixTable('misc') . '
2076
+            'SELECT * FROM '.prefixTable('misc').'
2077 2077
             WHERE type = %s AND intitule = %s',
2078 2078
             'admin',
2079 2079
             $post_field
@@ -2096,7 +2096,7 @@  discard block
 block discarded – undo
2096 2096
                     array(
2097 2097
                         'valeur' => time(),
2098 2098
                         'type' => 'admin',
2099
-                        'intitule' => $post_field . '_time',
2099
+                        'intitule' => $post_field.'_time',
2100 2100
                         'updated_at' => time(),
2101 2101
                     )
2102 2102
                 );
@@ -2118,10 +2118,10 @@  discard block
 block discarded – undo
2118 2118
             if ($post_field === 'send_stats') {
2119 2119
                 // Check if previous time exists, if not them insert this value in DB
2120 2120
                 DB::query(
2121
-                    'SELECT * FROM ' . prefixTable('misc') . '
2121
+                    'SELECT * FROM '.prefixTable('misc').'
2122 2122
                     WHERE type = %s AND intitule = %s',
2123 2123
                     'admin',
2124
-                    $post_field . '_time'
2124
+                    $post_field.'_time'
2125 2125
                 );
2126 2126
                 $counter = DB::count();
2127 2127
                 if ($counter === 0) {
@@ -2130,7 +2130,7 @@  discard block
 block discarded – undo
2130 2130
                         array(
2131 2131
                             'valeur' => 0,
2132 2132
                             'type' => 'admin',
2133
-                            'intitule' => $post_field . '_time',
2133
+                            'intitule' => $post_field.'_time',
2134 2134
                             'created_at' => time(),
2135 2135
                         )
2136 2136
                     );
@@ -2152,13 +2152,13 @@  discard block
 block discarded – undo
2152 2152
         // special Cases
2153 2153
         if ($post_field === 'cpassman_url') {
2154 2154
             // update also jsUrl for CSFP protection
2155
-            $jsUrl = $post_value . '/includes/libraries/csrfp/js/csrfprotector.js';
2155
+            $jsUrl = $post_value.'/includes/libraries/csrfp/js/csrfprotector.js';
2156 2156
             $csrfp_file = '../includes/libraries/csrfp/libs/csrfp.config.php';
2157 2157
             $data = file_get_contents($csrfp_file);
2158 2158
             $posJsUrl = strpos($data, '"jsUrl" => "');
2159 2159
             $posEndLine = strpos($data, '",', $posJsUrl);
2160 2160
             $line = substr($data, $posJsUrl, ($posEndLine - $posJsUrl + 2));
2161
-            $newdata = str_replace($line, '"jsUrl" => "' . filter_var($jsUrl, FILTER_SANITIZE_FULL_SPECIAL_CHARS) . '",', $data);
2161
+            $newdata = str_replace($line, '"jsUrl" => "'.filter_var($jsUrl, FILTER_SANITIZE_FULL_SPECIAL_CHARS).'",', $data);
2162 2162
             file_put_contents($csrfp_file, $newdata);
2163 2163
         } elseif ($post_field === 'restricted_to_input' && (int) $post_value === 0) {
2164 2164
             DB::update(
@@ -2183,7 +2183,7 @@  discard block
 block discarded – undo
2183 2183
         echo prepareExchangedData(
2184 2184
             array(
2185 2185
                 'error' => false,
2186
-                'misc' => $counter . ' ; ' . $SETTINGS[$post_field],
2186
+                'misc' => $counter.' ; '.$SETTINGS[$post_field],
2187 2187
                 'message' => empty($post_translate) === false ? $lang->get($post_translate) : '',
2188 2188
             ),
2189 2189
             'encode'
@@ -2226,7 +2226,7 @@  discard block
 block discarded – undo
2226 2226
 
2227 2227
         // send statistics
2228 2228
         if (null !== $post_status) {
2229
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'send_stats');
2229
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'send_stats');
2230 2230
             $counter = DB::count();
2231 2231
             if ($counter === 0) {
2232 2232
                 DB::insert(
@@ -2257,7 +2257,7 @@  discard block
 block discarded – undo
2257 2257
 
2258 2258
         // send statistics items
2259 2259
         if (null !== $post_list) {
2260
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'send_statistics_items');
2260
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'send_statistics_items');
2261 2261
             $counter = DB::count();
2262 2262
             if ($counter === 0) {
2263 2263
                 DB::insert(
@@ -2303,7 +2303,7 @@  discard block
 block discarded – undo
2303 2303
             break;
2304 2304
         }
2305 2305
 
2306
-        if (DB::query("SHOW TABLES LIKE '" . prefixTable('sk_reencrypt_backup') . "'")) {
2306
+        if (DB::query("SHOW TABLES LIKE '".prefixTable('sk_reencrypt_backup')."'")) {
2307 2307
             if (DB::count() === 1) {
2308 2308
                 echo 1;
2309 2309
             } else {
@@ -2341,7 +2341,7 @@  discard block
 block discarded – undo
2341 2341
 
2342 2342
         $rows = DB::query(
2343 2343
             'SELECT id, title
2344
-                FROM ' . prefixTable('roles_title') . '
2344
+                FROM ' . prefixTable('roles_title').'
2345 2345
                 ORDER BY title ASC'
2346 2346
         );
2347 2347
         foreach ($rows as $record) {
@@ -2457,7 +2457,7 @@  discard block
 block discarded – undo
2457 2457
 function tablesIntegrityCheck(): array
2458 2458
 {
2459 2459
     // Get integrity tables file
2460
-    $integrityTablesFile = TEAMPASS_ROOT_PATH . '/includes/tables_integrity.json';
2460
+    $integrityTablesFile = TEAMPASS_ROOT_PATH.'/includes/tables_integrity.json';
2461 2461
     if (file_exists($integrityTablesFile) === false) {
2462 2462
         return [
2463 2463
             'error' => true,
@@ -2475,7 +2475,7 @@  discard block
 block discarded – undo
2475 2475
     // Get all tables
2476 2476
     $tables = [];
2477 2477
     foreach (DB::queryFirstColumn("SHOW TABLES") as $table) {
2478
-        $tables[] = str_replace(DB_PREFIX, "", $table);;
2478
+        $tables[] = str_replace(DB_PREFIX, "", $table); ;
2479 2479
     }
2480 2480
     // Prepare the integrity check
2481 2481
     $tablesInError = [];
Please login to merge, or discard this patch.
sources/upload.attachments.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 ) {
75 75
     // Not allowed page
76 76
     $session->set('system-error_code', ERR_NOT_ALLOWED);
77
-    include $SETTINGS['cpassman_dir'] . '/error.php';
77
+    include $SETTINGS['cpassman_dir'].'/error.php';
78 78
     exit;
79 79
 }
80 80
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 $post_isNewItem = $request->request->filter('isNewItem', null, FILTER_SANITIZE_NUMBER_INT);
108 108
 $post_randomId = $request->request->filter('randomId', null, FILTER_SANITIZE_NUMBER_INT);
109 109
 $post_isPersonal = $request->request->filter('isPersonal', null, FILTER_SANITIZE_NUMBER_INT);
110
-$post_fileSize= $request->request->filter('file_size', null, FILTER_SANITIZE_NUMBER_INT);
110
+$post_fileSize = $request->request->filter('file_size', null, FILTER_SANITIZE_NUMBER_INT);
111 111
 $chunk = $request->request->filter('chunk', 0, FILTER_SANITIZE_NUMBER_INT);
112 112
 $chunks = $request->request->filter('chunks', 0, FILTER_SANITIZE_NUMBER_INT);
113 113
 $fileName = $request->request->filter('name', '', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
@@ -122,10 +122,10 @@  discard block
 block discarded – undo
122 122
     $unit = strtoupper(substr(trim($POST_MAX_SIZE), -1)); // Assurez-vous de bien gérer les espaces éventuels
123 123
     $units = ['G' => 1073741824, 'M' => 1048576, 'K' => 1024];
124 124
     $multiplier = $units[$unit] ?? 1; // Vérifie si l'unité est dans le tableau, sinon 1
125
-    $maxSize = (int)$POST_MAX_SIZE * $multiplier;
125
+    $maxSize = (int) $POST_MAX_SIZE * $multiplier;
126 126
     
127 127
     // CHeck if the POST is too big
128
-    if (!empty($_SERVER['CONTENT_LENGTH']) && (int)$_SERVER['CONTENT_LENGTH'] > $maxSize && $maxSize > 0) {
128
+    if (!empty($_SERVER['CONTENT_LENGTH']) && (int) $_SERVER['CONTENT_LENGTH'] > $maxSize && $maxSize > 0) {
129 129
         handleAttachmentError('POST exceeded maximum allowed size.', 111, 413);
130 130
     }
131 131
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
         handleAttachmentError('File exceeds the maximum allowed size', 120, 413);
135 135
         die();
136 136
     }
137
-    error_log('POST_MAX_SIZE: ' . $POST_MAX_SIZE." - CONTENT_LENGTH: ".$_SERVER['CONTENT_LENGTH']." - UNIT: ".$unit." - MAX: ".$maxSize." - MULTIPLIER: ".$multiplier." - FILE_SIZE: ".$post_fileSize);
137
+    error_log('POST_MAX_SIZE: '.$POST_MAX_SIZE." - CONTENT_LENGTH: ".$_SERVER['CONTENT_LENGTH']." - UNIT: ".$unit." - MAX: ".$maxSize." - MULTIPLIER: ".$multiplier." - FILE_SIZE: ".$post_fileSize);
138 138
     
139 139
     // delete expired tokens
140 140
     DB::delete(prefixTable('tokens'), 'end_timestamp < %i', time());
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
         // check if token is expired
186 186
         $data = DB::queryFirstRow(
187 187
             'SELECT end_timestamp
188
-            FROM ' . prefixTable('tokens') . '
188
+            FROM ' . prefixTable('tokens').'
189 189
             WHERE user_id = %i AND token = %s',
190 190
             $session->get('user-id'),
191 191
             $post_user_token
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 
219 219
 // HTTP headers for no cache etc
220 220
 header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
221
-header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
221
+header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
222 222
 header('Cache-Control: no-store, no-cache, must-revalidate');
223 223
 header('Cache-Control: post-check=0, pre-check=0', false);
224 224
 
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 // Validate file name (for our purposes we'll just remove invalid characters)
257 257
 $file_name = preg_replace('[^A-Za-z0-9]', '', strtolower(basename($_FILES['file']['name'])));
258 258
 if (strlen($file_name) == 0 || strlen($file_name) > $MAX_FILENAME_LENGTH) {
259
-    handleAttachmentError('Invalid file name: ' . $file_name . '.', 114);
259
+    handleAttachmentError('Invalid file name: '.$file_name.'.', 114);
260 260
 }
261 261
 
262 262
 // Validate file extension
@@ -266,8 +266,8 @@  discard block
 block discarded – undo
266 266
         $ext,
267 267
         explode(
268 268
             ',',
269
-            $SETTINGS['upload_docext'] . ',' . $SETTINGS['upload_imagesext'] .
270
-                ',' . $SETTINGS['upload_pkgext'] . ',' . $SETTINGS['upload_otherext']
269
+            $SETTINGS['upload_docext'].','.$SETTINGS['upload_imagesext'].
270
+                ','.$SETTINGS['upload_pkgext'].','.$SETTINGS['upload_otherext']
271 271
         )
272 272
     ) === false
273 273
 ) {
@@ -279,24 +279,24 @@  discard block
 block discarded – undo
279 279
 
280 280
 // Clean the fileName for security reasons
281 281
 $fileInfo = pathinfo($fileName);
282
-$fileName = base64_encode($fileInfo['filename']) . '.' . $fileInfo['extension'];
282
+$fileName = base64_encode($fileInfo['filename']).'.'.$fileInfo['extension'];
283 283
 $fileFullSize = 0;
284 284
 
285 285
 // Make sure the fileName is unique but only if chunking is disabled
286
-if ($chunks < 2 && file_exists($targetDir . DIRECTORY_SEPARATOR . $fileName)) {
286
+if ($chunks < 2 && file_exists($targetDir.DIRECTORY_SEPARATOR.$fileName)) {
287 287
     $ext = strrpos($fileName, '.');
288 288
     $fileNameA = substr($fileName, 0, $ext);
289 289
     $fileNameB = substr($fileName, $ext);
290 290
 
291 291
     $count = 1;
292
-    while (file_exists($targetDir . DIRECTORY_SEPARATOR . $fileNameA . '_' . $count . $fileNameB)) {
292
+    while (file_exists($targetDir.DIRECTORY_SEPARATOR.$fileNameA.'_'.$count.$fileNameB)) {
293 293
         ++$count;
294 294
     }
295 295
 
296
-    $fileName = $fileNameA . '_' . $count . $fileNameB;
296
+    $fileName = $fileNameA.'_'.$count.$fileNameB;
297 297
 }
298 298
 
299
-$filePath = $targetDir . DIRECTORY_SEPARATOR . $fileName;
299
+$filePath = $targetDir.DIRECTORY_SEPARATOR.$fileName;
300 300
 
301 301
 // Create target dir
302 302
 if (file_exists($targetDir) === false) {
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 // Remove old temp files
311 311
 if ($cleanupTargetDir && is_dir($targetDir) && ($dir = opendir($targetDir))) {
312 312
     while (($file = readdir($dir)) !== false) {
313
-        $tmpfilePath = $targetDir . DIRECTORY_SEPARATOR . $file;
313
+        $tmpfilePath = $targetDir.DIRECTORY_SEPARATOR.$file;
314 314
 
315 315
         // Remove temp file if it is older than the max age and is not the current file
316 316
         if (
@@ -432,8 +432,8 @@  discard block
 block discarded – undo
432 432
         // This is a public object
433 433
         $users = DB::query(
434 434
             'SELECT id, public_key
435
-            FROM ' . prefixTable('users') . '
436
-            WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '")
435
+            FROM ' . prefixTable('users').'
436
+            WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'")
437 437
             AND public_key != ""'
438 438
         );
439 439
         foreach ($users as $user) {
@@ -471,14 +471,14 @@  discard block
 block discarded – undo
471 471
                 'date' => time(),
472 472
                 'id_user' => $session->get('user-id'),
473 473
                 'action' => 'at_modification',
474
-                'raison' => 'at_add_file : ' . $fileName . ':' . $newID,
474
+                'raison' => 'at_add_file : '.$fileName.':'.$newID,
475 475
             )
476 476
         );
477 477
     }
478 478
 }
479 479
 
480 480
 // Return JSON-RPC response
481
-die('{"jsonrpc" : "2.0", "result" : null, "id" : "' . $newID . '"}');
481
+die('{"jsonrpc" : "2.0", "result" : null, "id" : "'.$newID.'"}');
482 482
 
483 483
 /**
484 484
  * Handle errors and kill script.
Please login to merge, or discard this patch.
sources/items.queries.php 2 patches
Spacing   +280 added lines, -281 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
 
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
             // About special settings
365 365
             $dataFolderSettings = DB::queryFirstRow(
366 366
                 'SELECT bloquer_creation, bloquer_modification, personal_folder
367
-                FROM ' . prefixTable('nested_tree') . ' 
367
+                FROM ' . prefixTable('nested_tree').' 
368 368
                 WHERE id = %i',
369 369
                 $inputData['folderId']
370 370
             );
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
             // Get folder complexity
382 382
             $folderComplexity = DB::queryfirstrow(
383 383
                 'SELECT valeur
384
-                FROM ' . prefixTable('misc') . '
384
+                FROM ' . prefixTable('misc').'
385 385
                 WHERE type = %s AND intitule = %i',
386 386
                 'complex',
387 387
                 $inputData['folderId']
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
             $itemExists = 0;
407 407
             $newID = '';
408 408
             $data = DB::queryfirstrow(
409
-                'SELECT * FROM ' . prefixTable('items') . '
409
+                'SELECT * FROM '.prefixTable('items').'
410 410
                 WHERE label = %s AND inactif = %i',
411 411
                 $inputData['label'],
412 412
                 0
@@ -489,8 +489,8 @@  discard block
 block discarded – undo
489 489
                     (int) $post_folder_is_personal,
490 490
                     (int) $newID,
491 491
                     $cryptedStuff['objectKey'],
492
-                    true,   // only for the item creator
493
-                    false,  // no delete all
492
+                    true, // only for the item creator
493
+                    false, // no delete all
494 494
                 );
495 495
 
496 496
                 // update fields
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
                             // should we encrypt the data
504 504
                             $dataTmp = DB::queryFirstRow(
505 505
                                 'SELECT encrypted_data
506
-                                FROM ' . prefixTable('categories') . '
506
+                                FROM ' . prefixTable('categories').'
507 507
                                 WHERE id = %i',
508 508
                                 $field['id']
509 509
                             );
@@ -532,8 +532,8 @@  discard block
 block discarded – undo
532 532
                                     (int) $post_folder_is_personal,
533 533
                                     (int) $newObjectId,
534 534
                                     $cryptedStuff['objectKey'],
535
-                                    true,   // only for the item creator
536
-                                    false,  // no delete all
535
+                                    true, // only for the item creator
536
+                                    false, // no delete all
537 537
                                 );
538 538
 
539 539
                                 array_push(
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
                 ) {
571 571
                     DB::queryFirstRow(
572 572
                         'SELECT *
573
-                        FROM ' . prefixTable('templates') . '
573
+                        FROM ' . prefixTable('templates').'
574 574
                         WHERE item_id = %i',
575 575
                         $newID
576 576
                     );
@@ -639,11 +639,11 @@  discard block
 block discarded – undo
639 639
                 ) {
640 640
                     foreach ($post_restricted_to as $userRest) {
641 641
                         if (empty($userRest) === false) {
642
-                            $dataTmp = DB::queryfirstrow('SELECT login FROM ' . prefixTable('users') . ' WHERE id= %i', $userRest);
642
+                            $dataTmp = DB::queryfirstrow('SELECT login FROM '.prefixTable('users').' WHERE id= %i', $userRest);
643 643
                             if (empty($listOfRestricted)) {
644 644
                                 $listOfRestricted = $dataTmp['login'];
645 645
                             } else {
646
-                                $listOfRestricted .= ';' . $dataTmp['login'];
646
+                                $listOfRestricted .= ';'.$dataTmp['login'];
647 647
                             }
648 648
                         }
649 649
                     }
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
                             if (empty($userRest) === false) {
660 660
                                 $dataTmp = DB::queryfirstrow(
661 661
                                     'SELECT login
662
-                                    FROM ' . prefixTable('users') . '
662
+                                    FROM ' . prefixTable('users').'
663 663
                                     WHERE id= %i',
664 664
                                     $userRest
665 665
                                 );
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
                                 if (empty($oldRestrictionList) === true) {
668 668
                                     $oldRestrictionList = $dataTmp['login'];
669 669
                                 } else {
670
-                                    $oldRestrictionList .= ';' . $dataTmp['login'];
670
+                                    $oldRestrictionList .= ';'.$dataTmp['login'];
671 671
                                 }
672 672
                             }
673 673
                         }
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
                 if (empty($post_uploaded_file_id) === false) {
731 731
                     $rows = DB::query(
732 732
                         'SELECT id
733
-                        FROM ' . prefixTable('files') . '
733
+                        FROM ' . prefixTable('files').'
734 734
                         WHERE id_item = %s',
735 735
                         $post_uploaded_file_id
736 736
                     );
@@ -786,7 +786,7 @@  discard block
 block discarded – undo
786 786
                                     $lang->get('email_subject_item_updated'),
787 787
                                     str_replace(
788 788
                                         array('#label', '#link'),
789
-                                            array($path, $SETTINGS['email_server_url'] . '/index.php?page=items&group=' . $inputData['folderId'] . '&id=' . $newID . $txt['email_body3']),
789
+                                            array($path, $SETTINGS['email_server_url'].'/index.php?page=items&group='.$inputData['folderId'].'&id='.$newID.$txt['email_body3']),
790 790
                                             $lang->get('new_item_email_body')
791 791
                                     ),
792 792
                                     $emailAddress,
@@ -890,11 +890,11 @@  discard block
 block discarded – undo
890 890
         // Prepare variables
891 891
         $itemInfos = array();
892 892
         $inputData['label'] = isset($dataReceived['label']) && is_string($dataReceived['label']) ? filter_var($dataReceived['label'], FILTER_SANITIZE_FULL_SPECIAL_CHARS) : '';
893
-        $post_url = isset($dataReceived['url'])=== true ? filter_var(htmlspecialchars_decode($dataReceived['url']), FILTER_SANITIZE_URL) : '';
893
+        $post_url = isset($dataReceived['url']) === true ? filter_var(htmlspecialchars_decode($dataReceived['url']), FILTER_SANITIZE_URL) : '';
894 894
         $post_password = $original_pw = isset($dataReceived['pw']) && is_string($dataReceived['pw']) ? htmlspecialchars_decode($dataReceived['pw']) : '';
895 895
         $post_login = isset($dataReceived['login']) && is_string($dataReceived['login']) ? filter_var(htmlspecialchars_decode($dataReceived['login']), FILTER_SANITIZE_FULL_SPECIAL_CHARS) : '';
896
-        $post_tags = isset($dataReceived['tags'])=== true ? htmlspecialchars($dataReceived['tags']) : '';
897
-        $post_email = isset($dataReceived['email'])=== true ? filter_var(htmlspecialchars_decode($dataReceived['email']), FILTER_SANITIZE_EMAIL) : '';
896
+        $post_tags = isset($dataReceived['tags']) === true ? htmlspecialchars($dataReceived['tags']) : '';
897
+        $post_email = isset($dataReceived['email']) === true ? filter_var(htmlspecialchars_decode($dataReceived['email']), FILTER_SANITIZE_EMAIL) : '';
898 898
         $post_template_id = (int) filter_var($dataReceived['template_id'], FILTER_SANITIZE_NUMBER_INT);
899 899
         $inputData['itemId'] = (int) filter_var($dataReceived['id'], FILTER_SANITIZE_NUMBER_INT);
900 900
         $post_anyone_can_modify = (int) filter_var($dataReceived['anyone_can_modify'], FILTER_SANITIZE_NUMBER_INT);
@@ -925,8 +925,7 @@  discard block
 block discarded – undo
925 925
         $post_to_be_deleted_after_date = isset($dataReceived['to_be_deleted_after_date']) === true ? filter_var(
926 926
                 $dataReceived['to_be_deleted_after_date'],
927 927
                 FILTER_SANITIZE_FULL_SPECIAL_CHARS
928
-            ) :
929
-            '';
928
+            ) : '';
930 929
         $post_fields = (filter_var_array(
931 930
             $dataReceived['fields'],
932 931
             FILTER_SANITIZE_FULL_SPECIAL_CHARS
@@ -986,7 +985,7 @@  discard block
 block discarded – undo
986 985
         // About special settings
987 986
         $dataFolderSettings = DB::queryFirstRow(
988 987
             'SELECT bloquer_creation, bloquer_modification, personal_folder, title
989
-            FROM ' . prefixTable('nested_tree') . ' 
988
+            FROM ' . prefixTable('nested_tree').' 
990 989
             WHERE id = %i',
991 990
             $inputData['folderId']
992 991
         );
@@ -1002,7 +1001,7 @@  discard block
 block discarded – undo
1002 1001
         // Get folder complexity
1003 1002
         $folderComplexity = DB::queryfirstrow(
1004 1003
             'SELECT valeur
1005
-            FROM ' . prefixTable('misc') . '
1004
+            FROM ' . prefixTable('misc').'
1006 1005
             WHERE type = %s AND intitule = %i',
1007 1006
             'complex',
1008 1007
             $inputData['folderId']
@@ -1047,8 +1046,8 @@  discard block
 block discarded – undo
1047 1046
         // Get all informations for this item
1048 1047
         $dataItem = DB::queryfirstrow(
1049 1048
             'SELECT *
1050
-            FROM ' . prefixTable('items') . ' as i
1051
-            INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
1049
+            FROM ' . prefixTable('items').' as i
1050
+            INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
1052 1051
             WHERE i.id=%i AND l.action = %s',
1053 1052
             $inputData['itemId'],
1054 1053
             'at_creation'
@@ -1097,7 +1096,7 @@  discard block
 block discarded – undo
1097 1096
         //db::debugmode(true);
1098 1097
         DB::query(
1099 1098
             'SELECT *
1100
-            FROM ' . prefixTable('sharekeys_items') . '
1099
+            FROM ' . prefixTable('sharekeys_items').'
1101 1100
             WHERE object_id = %i AND user_id = %s',
1102 1101
             $inputData['itemId'],
1103 1102
             $session->get('user-id')
@@ -1149,9 +1148,9 @@  discard block
 block discarded – undo
1149 1148
                 '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, 
1150 1149
                 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,
1151 1150
                 u.login as user_login, u.email as user_email
1152
-                FROM ' . prefixTable('items') . ' as i
1153
-                INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id=l.id_item)
1154
-                INNER JOIN ' . prefixTable('users') . ' as u ON (u.id=l.id_user)
1151
+                FROM ' . prefixTable('items').' as i
1152
+                INNER JOIN ' . prefixTable('log_items').' as l ON (i.id=l.id_item)
1153
+                INNER JOIN ' . prefixTable('users').' as u ON (u.id=l.id_user)
1155 1154
                 WHERE i.id=%i',
1156 1155
                 $inputData['itemId']
1157 1156
             );
@@ -1159,7 +1158,7 @@  discard block
 block discarded – undo
1159 1158
             // Should we log a password change?
1160 1159
             $userKey = DB::queryFirstRow(
1161 1160
                 'SELECT share_key
1162
-                FROM ' . prefixTable('sharekeys_items') . '
1161
+                FROM ' . prefixTable('sharekeys_items').'
1163 1162
                 WHERE user_id = %i AND object_id = %i',
1164 1163
                 $session->get('user-id'),
1165 1164
                 $inputData['itemId']
@@ -1218,12 +1217,12 @@  discard block
 block discarded – undo
1218 1217
                     (int) $post_folder_is_personal,
1219 1218
                     (int) $inputData['itemId'],
1220 1219
                     $encrypted_password_key,
1221
-                    true,   // only for the item creator
1222
-                    true,   // delete all
1220
+                    true, // only for the item creator
1221
+                    true, // delete all
1223 1222
                 );
1224 1223
 
1225 1224
                 // Create a task to create sharekeys for users
1226
-                if (WIP=== true) error_log('createTaskForItem - new password for this item - '.$post_password ." -- ". $pw);
1225
+                if (WIP === true) error_log('createTaskForItem - new password for this item - '.$post_password." -- ".$pw);
1227 1226
                 $tasksToBePerformed = ['item_password'];
1228 1227
                 $encryptionTaskIsRequested = true;
1229 1228
             } else {
@@ -1234,7 +1233,7 @@  discard block
 block discarded – undo
1234 1233
             // Get list of tags
1235 1234
             $itemTags = DB::queryFirstColumn(
1236 1235
                 'SELECT tag
1237
-                FROM ' . prefixTable('tags') . '
1236
+                FROM ' . prefixTable('tags').'
1238 1237
                 WHERE item_id = %i',
1239 1238
                 $inputData['itemId']
1240 1239
             );
@@ -1280,7 +1279,7 @@  discard block
 block discarded – undo
1280 1279
                     $session->get('user-id'),
1281 1280
                     'at_modification',
1282 1281
                     $session->get('user-login'),
1283
-                    'at_tag : ' . implode(' ', $itemTags) . ' => ' . $post_tags
1282
+                    'at_tag : '.implode(' ', $itemTags).' => '.$post_tags
1284 1283
                 );
1285 1284
             }
1286 1285
 
@@ -1320,8 +1319,8 @@  discard block
 block discarded – undo
1320 1319
                             'SELECT c.id AS id, c.title AS title, i.data AS data, i.data_iv AS data_iv,
1321 1320
                             i.encryption_type AS encryption_type, c.encrypted_data AS encrypted_data,
1322 1321
                             c.masked AS masked, i.id AS field_item_id
1323
-                            FROM ' . prefixTable('categories_items') . ' AS i
1324
-                            INNER JOIN ' . prefixTable('categories') . ' AS c ON (i.field_id=c.id)
1322
+                            FROM ' . prefixTable('categories_items').' AS i
1323
+                            INNER JOIN ' . prefixTable('categories').' AS c ON (i.field_id=c.id)
1325 1324
                             WHERE i.field_id = %i AND i.item_id = %i',
1326 1325
                             $field['id'],
1327 1326
                             $inputData['itemId']
@@ -1337,7 +1336,7 @@  discard block
 block discarded – undo
1337 1336
                             // Perform new query
1338 1337
                             $dataTmpCat = DB::queryFirstRow(
1339 1338
                                 'SELECT id, title, encrypted_data, masked
1340
-                                FROM ' . prefixTable('categories') . '
1339
+                                FROM ' . prefixTable('categories').'
1341 1340
                                 WHERE id = %i',
1342 1341
                                 $field['id']
1343 1342
                             );
@@ -1367,8 +1366,8 @@  discard block
 block discarded – undo
1367 1366
                                     (int) $post_folder_is_personal,
1368 1367
                                     (int) $newId,
1369 1368
                                     $cryptedStuff['objectKey'],
1370
-                                    true,   // only for the item creator
1371
-                                    true,   // delete all
1369
+                                    true, // only for the item creator
1370
+                                    true, // delete all
1372 1371
                                 );
1373 1372
 
1374 1373
                                 // update value
@@ -1416,7 +1415,7 @@  discard block
 block discarded – undo
1416 1415
                                 $session->get('user-id'),
1417 1416
                                 'at_modification',
1418 1417
                                 $session->get('user-login'),
1419
-                                'at_field : ' . $dataTmpCat['title'] . ' : ' . $field['value']
1418
+                                'at_field : '.$dataTmpCat['title'].' : '.$field['value']
1420 1419
                             );
1421 1420
                         } else {
1422 1421
                             // Case where the field already exists
@@ -1425,7 +1424,7 @@  discard block
 block discarded – undo
1425 1424
                                 // Get user sharekey for this field
1426 1425
                                 $userKey = DB::queryFirstRow(
1427 1426
                                     'SELECT share_key
1428
-                                    FROM ' . prefixTable('sharekeys_fields') . '
1427
+                                    FROM ' . prefixTable('sharekeys_fields').'
1429 1428
                                     WHERE user_id = %i AND object_id = %i',
1430 1429
                                     $session->get('user-id'),
1431 1430
                                     $dataTmpCat['field_item_id']
@@ -1464,8 +1463,8 @@  discard block
 block discarded – undo
1464 1463
                                         (int) $post_folder_is_personal,
1465 1464
                                         (int) $dataTmpCat['field_item_id'],
1466 1465
                                         $cryptedStuff['objectKey'],
1467
-                                        true,   // only for the item creator
1468
-                                        true,   // delete all
1466
+                                        true, // only for the item creator
1467
+                                        true, // delete all
1469 1468
                                     );
1470 1469
 
1471 1470
                                     array_push(
@@ -1505,7 +1504,7 @@  discard block
 block discarded – undo
1505 1504
                                     $session->get('user-id'),
1506 1505
                                     'at_modification',
1507 1506
                                     $session->get('user-login'),
1508
-                                    'at_field : ' . $dataTmpCat['title'] . ' => ' . $oldVal
1507
+                                    'at_field : '.$dataTmpCat['title'].' => '.$oldVal
1509 1508
                                 );
1510 1509
                             }
1511 1510
                         }
@@ -1560,7 +1559,7 @@  discard block
 block discarded – undo
1560 1559
             ) {
1561 1560
                 DB::queryFirstRow(
1562 1561
                     'SELECT *
1563
-                    FROM ' . prefixTable('templates') . '
1562
+                    FROM ' . prefixTable('templates').'
1564 1563
                     WHERE item_id = %i',
1565 1564
                     $inputData['itemId']
1566 1565
                 );
@@ -1603,7 +1602,7 @@  discard block
 block discarded – undo
1603 1602
                 // check if elem exists in Table. If not add it or update it.
1604 1603
                 DB::query(
1605 1604
                     'SELECT *
1606
-                    FROM ' . prefixTable('automatic_del') . '
1605
+                    FROM ' . prefixTable('automatic_del').'
1607 1606
                     WHERE item_id = %i',
1608 1607
                     $inputData['itemId']
1609 1608
                 );
@@ -1630,7 +1629,7 @@  discard block
 block discarded – undo
1630 1629
                         // Store updates performed
1631 1630
                         array_push(
1632 1631
                             $arrayOfChanges,
1633
-                            $lang->get('automatic_deletion_engaged') . ': ' . $lang->get('enabled')
1632
+                            $lang->get('automatic_deletion_engaged').': '.$lang->get('enabled')
1634 1633
                         );
1635 1634
 
1636 1635
                         // update LOG
@@ -1673,7 +1672,7 @@  discard block
 block discarded – undo
1673 1672
                         // Store updates performed
1674 1673
                         array_push(
1675 1674
                             $arrayOfChanges,
1676
-                            $lang->get('automatic_deletion_engaged') . ': ' . $lang->get('disabled')
1675
+                            $lang->get('automatic_deletion_engaged').': '.$lang->get('disabled')
1677 1676
                         );
1678 1677
 
1679 1678
                         // update LOG
@@ -1706,7 +1705,7 @@  discard block
 block discarded – undo
1706 1705
                     if (empty($userId) === false) {
1707 1706
                         $dataTmp = DB::queryfirstrow(
1708 1707
                             'SELECT id, name, lastname
1709
-                            FROM ' . prefixTable('users') . '
1708
+                            FROM ' . prefixTable('users').'
1710 1709
                             WHERE id= %i',
1711 1710
                             $userId
1712 1711
                         );
@@ -1714,7 +1713,7 @@  discard block
 block discarded – undo
1714 1713
                         // Add to array
1715 1714
                         array_push(
1716 1715
                             $arrayOfUsersRestriction,
1717
-                            $dataTmp['name'] . ' ' . $dataTmp['lastname']
1716
+                            $dataTmp['name'].' '.$dataTmp['lastname']
1718 1717
                         );
1719 1718
                         array_push(
1720 1719
                             $arrayOfUsersIdRestriction,
@@ -1745,8 +1744,8 @@  discard block
 block discarded – undo
1745 1744
                 // get values before deleting them
1746 1745
                 $rows = DB::query(
1747 1746
                     'SELECT t.title, t.id AS id
1748
-                    FROM ' . prefixTable('roles_title') . ' as t
1749
-                    INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (t.id=r.role_id)
1747
+                    FROM ' . prefixTable('roles_title').' as t
1748
+                    INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (t.id=r.role_id)
1750 1749
                     WHERE r.item_id = %i
1751 1750
                     ORDER BY t.title ASC',
1752 1751
                     $inputData['itemId']
@@ -1780,7 +1779,7 @@  discard block
 block discarded – undo
1780 1779
                         );
1781 1780
                         $dataTmp = DB::queryfirstrow(
1782 1781
                             'SELECT title
1783
-                            FROM ' . prefixTable('roles_title') . '
1782
+                            FROM ' . prefixTable('roles_title').'
1784 1783
                             WHERE id = %i',
1785 1784
                             $role
1786 1785
                         );
@@ -1808,7 +1807,7 @@  discard block
 block discarded – undo
1808 1807
             // Get current status
1809 1808
             $otpStatus = DB::queryFirstRow(
1810 1809
                 'SELECT enabled as otp_is_enabled
1811
-                FROM ' . prefixTable('items_otp') . '
1810
+                FROM ' . prefixTable('items_otp').'
1812 1811
                 WHERE item_id = %i',
1813 1812
                 $inputData['itemId']
1814 1813
             );
@@ -1839,7 +1838,7 @@  discard block
 block discarded – undo
1839 1838
                     $session->get('user-id'),
1840 1839
                     'at_modification',
1841 1840
                     $session->get('user-login'),
1842
-                    'at_otp_status:' . ((int) $post_otp_is_enabled === 0 ? 'disabled' : 'enabled')
1841
+                    'at_otp_status:'.((int) $post_otp_is_enabled === 0 ? 'disabled' : 'enabled')
1843 1842
                 );
1844 1843
             } elseif (DB::count() === 0 && empty($post_otp_secret) === false) {
1845 1844
                 // Create the entry in items_otp table
@@ -1883,8 +1882,8 @@  discard block
 block discarded – undo
1883 1882
                     $session->get('user-id'),
1884 1883
                     'at_modification',
1885 1884
                     $session->get('user-login'),
1886
-                    'at_restriction : ' . (count($diffUsersRestiction) > 0 ?
1887
-                        implode(', ', $arrayOfUsersRestriction) . (count($diffRolesRestiction) > 0 ? ', ' : '') : '') . (count($diffRolesRestiction) > 0 ? implode(', ', $arrayOfRestrictionRoles) : '')
1885
+                    'at_restriction : '.(count($diffUsersRestiction) > 0 ?
1886
+                        implode(', ', $arrayOfUsersRestriction).(count($diffRolesRestiction) > 0 ? ', ' : '') : '').(count($diffRolesRestiction) > 0 ? implode(', ', $arrayOfRestrictionRoles) : '')
1888 1887
                 );
1889 1888
             }
1890 1889
 
@@ -1904,7 +1903,7 @@  discard block
 block discarded – undo
1904 1903
                     $session->get('user-id'),
1905 1904
                     'at_modification',
1906 1905
                     $session->get('user-login'),
1907
-                    'at_label : ' . $data['label'] . ' => ' . $inputData['label']
1906
+                    'at_label : '.$data['label'].' => '.$inputData['label']
1908 1907
                 );
1909 1908
             }
1910 1909
             // LOGIN
@@ -1923,7 +1922,7 @@  discard block
 block discarded – undo
1923 1922
                     $session->get('user-id'),
1924 1923
                     'at_modification',
1925 1924
                     $session->get('user-login'),
1926
-                    'at_login : ' . $data['login'] . ' => ' . $post_login
1925
+                    'at_login : '.$data['login'].' => '.$post_login
1927 1926
                 );
1928 1927
             }
1929 1928
             // EMAIL
@@ -1942,7 +1941,7 @@  discard block
 block discarded – undo
1942 1941
                     $session->get('user-id'),
1943 1942
                     'at_modification',
1944 1943
                     $session->get('user-login'),
1945
-                    'at_email : ' . $data['email'] . ' => ' . $post_email
1944
+                    'at_email : '.$data['email'].' => '.$post_email
1946 1945
                 );
1947 1946
             }
1948 1947
             // URL
@@ -1961,7 +1960,7 @@  discard block
 block discarded – undo
1961 1960
                     $session->get('user-id'),
1962 1961
                     'at_modification',
1963 1962
                     $session->get('user-login'),
1964
-                    'at_url : ' . $data['url'] . ' => ' . $post_url
1963
+                    'at_url : '.$data['url'].' => '.$post_url
1965 1964
                 );
1966 1965
             }
1967 1966
             // DESCRIPTION
@@ -1987,7 +1986,7 @@  discard block
 block discarded – undo
1987 1986
             // FOLDER
1988 1987
             if ((int) $data['id_tree'] !== (int) $inputData['folderId']) {
1989 1988
                 // Get name of folders
1990
-                $dataTmp = DB::query('SELECT title FROM ' . prefixTable('nested_tree') . ' WHERE id IN %li', array($data['id_tree'], $inputData['folderId']));
1989
+                $dataTmp = DB::query('SELECT title FROM '.prefixTable('nested_tree').' WHERE id IN %li', array($data['id_tree'], $inputData['folderId']));
1991 1990
 
1992 1991
                 // Store updates performed
1993 1992
                 array_push(
@@ -2003,7 +2002,7 @@  discard block
 block discarded – undo
2003 2002
                     $session->get('user-id'),
2004 2003
                     'at_modification',
2005 2004
                     $session->get('user-login'),
2006
-                    'at_category : ' . $dataTmp[0]['title'] . ' => ' . $dataTmp[1]['title']
2005
+                    'at_category : '.$dataTmp[0]['title'].' => '.$dataTmp[1]['title']
2007 2006
                 );
2008 2007
             }
2009 2008
             // ANYONE_CAN_MODIFY
@@ -2011,7 +2010,7 @@  discard block
 block discarded – undo
2011 2010
                 // Store updates performed
2012 2011
                 array_push(
2013 2012
                     $arrayOfChanges,
2014
-                    $lang->get('at_anyoneconmodify') . ': ' . ((int) $post_anyone_can_modify === 0 ? $lang->get('disabled') : $lang->get('enabled'))
2013
+                    $lang->get('at_anyoneconmodify').': '.((int) $post_anyone_can_modify === 0 ? $lang->get('disabled') : $lang->get('enabled'))
2015 2014
                 );
2016 2015
 
2017 2016
                 // Log
@@ -2022,15 +2021,15 @@  discard block
 block discarded – undo
2022 2021
                     $session->get('user-id'),
2023 2022
                     'at_modification',
2024 2023
                     $session->get('user-login'),
2025
-                    'at_anyoneconmodify : ' . ((int) $post_anyone_can_modify === 0 ? 'disabled' : 'enabled')
2024
+                    'at_anyoneconmodify : '.((int) $post_anyone_can_modify === 0 ? 'disabled' : 'enabled')
2026 2025
                 );
2027 2026
             }
2028 2027
 
2029 2028
             // Reload new values
2030 2029
             $dataItem = DB::queryfirstrow(
2031 2030
                 'SELECT *
2032
-                FROM ' . prefixTable('items') . ' as i
2033
-                INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
2031
+                FROM ' . prefixTable('items').' as i
2032
+                INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
2034 2033
                 WHERE i.id = %i AND l.action = %s',
2035 2034
                 $inputData['itemId'],
2036 2035
                 'at_creation'
@@ -2039,8 +2038,8 @@  discard block
 block discarded – undo
2039 2038
             $history = '';
2040 2039
             $rows = DB::query(
2041 2040
                 'SELECT l.date as date, l.action as action, l.raison as raison, u.login as login
2042
-                FROM ' . prefixTable('log_items') . ' as l
2043
-                LEFT JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id)
2041
+                FROM ' . prefixTable('log_items').' as l
2042
+                LEFT JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id)
2044 2043
                 WHERE l.action <> %s AND id_item=%s',
2045 2044
                 'at_shown',
2046 2045
                 $inputData['itemId']
@@ -2049,14 +2048,14 @@  discard block
 block discarded – undo
2049 2048
                 if ($record['raison'] === NULL) continue;
2050 2049
                 $reason = explode(':', $record['raison']);
2051 2050
                 if (count($reason) > 0) {
2052
-                    $sentence = date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) . ' - '
2053
-                        . $record['login'] . ' - ' . $lang->get($record['action']) . ' - '
2054
-                        . (empty($record['raison']) === false ? (count($reason) > 1 ? $lang->get(trim($reason[0])) . ' : ' . $reason[1]
2051
+                    $sentence = date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']).' - '
2052
+                        . $record['login'].' - '.$lang->get($record['action']).' - '
2053
+                        . (empty($record['raison']) === false ? (count($reason) > 1 ? $lang->get(trim($reason[0])).' : '.$reason[1]
2055 2054
                             : $lang->get(trim($reason[0]))) : '');
2056 2055
                     if (empty($history)) {
2057 2056
                         $history = $sentence;
2058 2057
                     } else {
2059
-                        $history .= '<br />' . $sentence;
2058
+                        $history .= '<br />'.$sentence;
2060 2059
                     }
2061 2060
                 }
2062 2061
             }
@@ -2194,7 +2193,7 @@  discard block
 block discarded – undo
2194 2193
         ) {
2195 2194
             // load the original record into an array
2196 2195
             $originalRecord = DB::queryfirstrow(
2197
-                'SELECT * FROM ' . prefixTable('items') . '
2196
+                'SELECT * FROM '.prefixTable('items').'
2198 2197
                 WHERE id = %i',
2199 2198
                 $inputData['itemId']
2200 2199
             );
@@ -2213,7 +2212,7 @@  discard block
 block discarded – undo
2213 2212
 
2214 2213
             // Load the destination folder record into an array
2215 2214
             $dataDestination = DB::queryfirstrow(
2216
-                'SELECT personal_folder FROM ' . prefixTable('nested_tree') . '
2215
+                'SELECT personal_folder FROM '.prefixTable('nested_tree').'
2217 2216
                 WHERE id = %i',
2218 2217
                 $post_dest_id
2219 2218
             );
@@ -2221,7 +2220,7 @@  discard block
 block discarded – undo
2221 2220
             // Get the ITEM object key for the user
2222 2221
             $userKey = DB::queryFirstRow(
2223 2222
                 'SELECT share_key
2224
-                FROM ' . prefixTable('sharekeys_items') . '
2223
+                FROM ' . prefixTable('sharekeys_items').'
2225 2224
                 WHERE user_id = %i AND object_id = %i',
2226 2225
                 $session->get('user-id'),
2227 2226
                 $inputData['itemId']
@@ -2298,8 +2297,8 @@  discard block
 block discarded – undo
2298 2297
             // Manage Custom Fields
2299 2298
             $rows = DB::query(
2300 2299
                 'SELECT ci.id AS id, ci.data AS data, ci.field_id AS field_id, c.encrypted_data AS encrypted_data
2301
-                FROM ' . prefixTable('categories_items') . ' AS ci
2302
-                INNER JOIN ' . prefixTable('categories') . ' AS c ON (c.id = ci.field_id)
2300
+                FROM ' . prefixTable('categories_items').' AS ci
2301
+                INNER JOIN ' . prefixTable('categories').' AS c ON (c.id = ci.field_id)
2303 2302
                 WHERE ci.item_id = %i',
2304 2303
                 $inputData['itemId']
2305 2304
             );
@@ -2311,7 +2310,7 @@  discard block
 block discarded – undo
2311 2310
                     // Get user key
2312 2311
                     $userKey = DB::queryFirstRow(
2313 2312
                         'SELECT share_key
2314
-                        FROM ' . prefixTable('sharekeys_fields') . '
2313
+                        FROM ' . prefixTable('sharekeys_fields').'
2315 2314
                         WHERE user_id = %i AND object_id = %i',
2316 2315
                         $session->get('user-id'),
2317 2316
                         $field['id']
@@ -2378,15 +2377,15 @@  discard block
 block discarded – undo
2378 2377
             $rows = DB::query(
2379 2378
                 'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status, f.extension AS extension,
2380 2379
                 f.size AS size, f.type AS type, s.share_key AS share_key
2381
-                FROM ' . prefixTable('files') . ' AS f
2382
-                INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id)
2380
+                FROM ' . prefixTable('files').' AS f
2381
+                INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id)
2383 2382
                 WHERE s.user_id = %i AND f.id_item = %i',
2384 2383
                 $session->get('user-id'),
2385 2384
                 $inputData['itemId']
2386 2385
             );
2387 2386
             foreach ($rows as $record) {
2388 2387
                 // Check if file still exists
2389
-                if (file_exists($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . TP_FILE_PREFIX . base64_decode($record['file'])) === true) {
2388
+                if (file_exists($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.TP_FILE_PREFIX.base64_decode($record['file'])) === true) {
2390 2389
                     // Step1 - decrypt the file
2391 2390
                     // deepcode ignore PT: path is sanitized inside decryptFile()
2392 2391
                     $fileContent = decryptFile(
@@ -2397,8 +2396,8 @@  discard block
 block discarded – undo
2397 2396
 
2398 2397
                     // Step2 - create file
2399 2398
                     // deepcode ignore InsecureHash: md5 is used jonly for file name in order to get a hashed value in database
2400
-                    $newFileName = md5(time() . '_' . $record['id']) . '.' . $record['extension'];
2401
-                    $outstream = fopen($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . $newFileName, 'ab');
2399
+                    $newFileName = md5(time().'_'.$record['id']).'.'.$record['extension'];
2400
+                    $outstream = fopen($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.$newFileName, 'ab');
2402 2401
                     if ($outstream === false) {
2403 2402
                         echo prepareExchangedData(
2404 2403
                             array(
@@ -2471,7 +2470,7 @@  discard block
 block discarded – undo
2471 2470
 
2472 2471
             // -------------------------
2473 2472
             // Add specific restrictions
2474
-            $rows = DB::query('SELECT * FROM ' . prefixTable('restriction_to_roles') . ' WHERE item_id = %i', $inputData['itemId']);
2473
+            $rows = DB::query('SELECT * FROM '.prefixTable('restriction_to_roles').' WHERE item_id = %i', $inputData['itemId']);
2475 2474
             foreach ($rows as $record) {
2476 2475
                 DB::insert(
2477 2476
                     prefixTable('restriction_to_roles'),
@@ -2483,7 +2482,7 @@  discard block
 block discarded – undo
2483 2482
             }
2484 2483
 
2485 2484
             // Add Tags
2486
-            $rows = DB::query('SELECT * FROM ' . prefixTable('tags') . ' WHERE item_id = %i', $inputData['itemId']);
2485
+            $rows = DB::query('SELECT * FROM '.prefixTable('tags').' WHERE item_id = %i', $inputData['itemId']);
2487 2486
             foreach ($rows as $record) {
2488 2487
                 DB::insert(
2489 2488
                     prefixTable('tags'),
@@ -2584,7 +2583,7 @@  discard block
 block discarded – undo
2584 2583
         // then we can show it
2585 2584
         $item_deleted = DB::queryFirstRow(
2586 2585
             'SELECT *
2587
-            FROM ' . prefixTable('log_items') . '
2586
+            FROM ' . prefixTable('log_items').'
2588 2587
             WHERE id_item = %i AND action = %s
2589 2588
             ORDER BY date DESC
2590 2589
             LIMIT 0, 1',
@@ -2595,7 +2594,7 @@  discard block
 block discarded – undo
2595 2594
 
2596 2595
         $item_restored = DB::queryFirstRow(
2597 2596
             'SELECT *
2598
-            FROM ' . prefixTable('log_items') . '
2597
+            FROM ' . prefixTable('log_items').'
2599 2598
             WHERE id_item = %i AND action = %s
2600 2599
             ORDER BY date DESC
2601 2600
             LIMIT 0, 1',
@@ -2619,8 +2618,8 @@  discard block
 block discarded – undo
2619 2618
         // Get all informations for this item
2620 2619
         $dataItem = DB::queryfirstrow(
2621 2620
             'SELECT *
2622
-            FROM ' . prefixTable('items') . ' as i
2623
-            INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
2621
+            FROM ' . prefixTable('items').' as i
2622
+            INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
2624 2623
             WHERE i.id = %i AND l.action = %s',
2625 2624
             $inputData['id'],
2626 2625
             'at_creation'
@@ -2629,7 +2628,7 @@  discard block
 block discarded – undo
2629 2628
         // Notification
2630 2629
         DB::queryfirstrow(
2631 2630
             'SELECT *
2632
-            FROM ' . prefixTable('notification') . '
2631
+            FROM ' . prefixTable('notification').'
2633 2632
             WHERE item_id = %i AND user_id = %i',
2634 2633
             $inputData['id'],
2635 2634
             $session->get('user-id')
@@ -2648,7 +2647,7 @@  discard block
 block discarded – undo
2648 2647
 
2649 2648
         // manage case of API user
2650 2649
         if ($dataItem['id_user'] === API_USER_ID) {
2651
-            $arrData['author'] = 'API [' . $dataItem['description'] . ']';
2650
+            $arrData['author'] = 'API ['.$dataItem['description'].']';
2652 2651
             $arrData['id_user'] = API_USER_ID;
2653 2652
             $arrData['author_email'] = '';
2654 2653
             $arrData['notification_status'] = false;
@@ -2658,7 +2657,7 @@  discard block
 block discarded – undo
2658 2657
         $tags = array();
2659 2658
         $rows = DB::query(
2660 2659
             'SELECT tag
2661
-            FROM ' . prefixTable('tags') . '
2660
+            FROM ' . prefixTable('tags').'
2662 2661
             WHERE item_id = %i',
2663 2662
             $inputData['id']
2664 2663
         );
@@ -2683,7 +2682,7 @@  discard block
 block discarded – undo
2683 2682
         // Check if user has a role that is accepted
2684 2683
         $rows_tmp = DB::query(
2685 2684
             'SELECT role_id
2686
-            FROM ' . prefixTable('restriction_to_roles') . '
2685
+            FROM ' . prefixTable('restriction_to_roles').'
2687 2686
             WHERE item_id=%i',
2688 2687
             $inputData['id']
2689 2688
         );
@@ -2697,7 +2696,7 @@  discard block
 block discarded – undo
2697 2696
         // Get the object key for the user
2698 2697
         $userKey = DB::queryFirstRow(
2699 2698
             'SELECT share_key
2700
-            FROM ' . prefixTable('sharekeys_items') . '
2699
+            FROM ' . prefixTable('sharekeys_items').'
2701 2700
             WHERE user_id = %i AND object_id = %i',
2702 2701
             $session->get('user-id'),
2703 2702
             $inputData['id']
@@ -2794,8 +2793,8 @@  discard block
 block discarded – undo
2794 2793
                 // Add restriction if item is restricted to roles
2795 2794
                 $rows = DB::query(
2796 2795
                     'SELECT t.title, t.id
2797
-                    FROM ' . prefixTable('roles_title') . ' AS t
2798
-                    INNER JOIN ' . prefixTable('restriction_to_roles') . ' AS r ON (t.id=r.role_id)
2796
+                    FROM ' . prefixTable('roles_title').' AS t
2797
+                    INNER JOIN ' . prefixTable('restriction_to_roles').' AS r ON (t.id=r.role_id)
2799 2798
                     WHERE r.item_id = %i
2800 2799
                     ORDER BY t.title ASC',
2801 2800
                     $inputData['id']
@@ -2811,8 +2810,8 @@  discard block
 block discarded – undo
2811 2810
                 $tmp = array();
2812 2811
                 $rows = DB::query(
2813 2812
                     'SELECT k.label, k.id
2814
-                    FROM ' . prefixTable('kb_items') . ' as i
2815
-                    INNER JOIN ' . prefixTable('kb') . ' as k ON (i.kb_id=k.id)
2813
+                    FROM ' . prefixTable('kb_items').' as i
2814
+                    INNER JOIN ' . prefixTable('kb').' as k ON (i.kb_id=k.id)
2816 2815
                     WHERE i.item_id = %i
2817 2816
                     ORDER BY k.label ASC',
2818 2817
                     $inputData['id']
@@ -2895,7 +2894,7 @@  discard block
 block discarded – undo
2895 2894
                 $arrCatList = array();
2896 2895
                 $rows_tmp = DB::query(
2897 2896
                     'SELECT id_category
2898
-                    FROM ' . prefixTable('categories_folders') . '
2897
+                    FROM ' . prefixTable('categories_folders').'
2899 2898
                     WHERE id_folder=%i',
2900 2899
                     $inputData['folderId']
2901 2900
                 );
@@ -2910,8 +2909,8 @@  discard block
 block discarded – undo
2910 2909
                         'SELECT i.id AS id, i.field_id AS field_id, i.data AS data, i.item_id AS item_id,
2911 2910
                         i.encryption_type AS encryption_type, c.encrypted_data AS encrypted_data, c.parent_id AS parent_id,
2912 2911
                         c.type as field_type, c.masked AS field_masked, c.role_visibility AS role_visibility
2913
-                        FROM ' . prefixTable('categories_items') . ' AS i
2914
-                        INNER JOIN ' . prefixTable('categories') . ' AS c ON (i.field_id=c.id)
2912
+                        FROM ' . prefixTable('categories_items').' AS i
2913
+                        INNER JOIN ' . prefixTable('categories').' AS c ON (i.field_id=c.id)
2915 2914
                         WHERE i.item_id=%i AND c.parent_id IN %ls',
2916 2915
                         $inputData['id'],
2917 2916
                         $arrCatList
@@ -2922,7 +2921,7 @@  discard block
 block discarded – undo
2922 2921
                         //db::debugmode(true);
2923 2922
                         $userKey = DB::queryFirstRow(
2924 2923
                             'SELECT share_key
2925
-                            FROM ' . prefixTable('sharekeys_fields') . '
2924
+                            FROM ' . prefixTable('sharekeys_fields').'
2926 2925
                             WHERE user_id = %i AND object_id = %i',
2927 2926
                             $session->get('user-id'),
2928 2927
                             $row['id']
@@ -2940,7 +2939,7 @@  discard block
 block discarded – undo
2940 2939
                         } else if (DB::count() === 0 && (int) $row['encrypted_data'] === 0) {
2941 2940
                             // Data is not encrypted in DB
2942 2941
                             $fieldText = [
2943
-                                'string' => $row['data'],//#3945 - isBase64($row['data']) === true ? base64_decode($row['data']) : 
2942
+                                'string' => $row['data'], //#3945 - isBase64($row['data']) === true ? base64_decode($row['data']) : 
2944 2943
                                 'encrypted' => false,
2945 2944
                                 'error' => false,
2946 2945
                             ];
@@ -2985,7 +2984,7 @@  discard block
 block discarded – undo
2985 2984
             if (isset($SETTINGS['item_creation_templates']) && (int) $SETTINGS['item_creation_templates'] === 1) {
2986 2985
                 $rows_tmp = DB::queryfirstrow(
2987 2986
                     'SELECT category_id
2988
-                    FROM ' . prefixTable('templates') . '
2987
+                    FROM ' . prefixTable('templates').'
2989 2988
                     WHERE item_id = %i',
2990 2989
                     $inputData['id']
2991 2990
                 );
@@ -3002,7 +3001,7 @@  discard block
 block discarded – undo
3002 3001
             // Evaluate if item is ready for all users
3003 3002
             $rows_tmp = DB::queryfirstrow(
3004 3003
                 'SELECT finished_at
3005
-                FROM ' . prefixTable('background_tasks') . '
3004
+                FROM ' . prefixTable('background_tasks').'
3006 3005
                 WHERE item_id = %i',
3007 3006
                 $inputData['id']
3008 3007
             );
@@ -3019,7 +3018,7 @@  discard block
 block discarded – undo
3019 3018
                 // Is the Item to be deleted?
3020 3019
                 $dataDelete = DB::queryfirstrow(
3021 3020
                     'SELECT * 
3022
-                    FROM ' . prefixTable('automatic_del') . '
3021
+                    FROM ' . prefixTable('automatic_del').'
3023 3022
                     WHERE item_id = %i',
3024 3023
                     $inputData['id']
3025 3024
                 );
@@ -3100,14 +3099,14 @@  discard block
 block discarded – undo
3100 3099
                     if (empty($userRest) === false) {
3101 3100
                         $dataTmp = DB::queryfirstrow(
3102 3101
                             'SELECT login
3103
-                            FROM ' . prefixTable('users') . '
3102
+                            FROM ' . prefixTable('users').'
3104 3103
                             WHERE id= %i',
3105 3104
                             $userRest
3106 3105
                         );
3107 3106
                         if (empty($listOfRestricted)) {
3108 3107
                             $listOfRestricted = $dataTmp['login'];
3109 3108
                         } else {
3110
-                            $listOfRestricted .= ';' . $dataTmp['login'];
3109
+                            $listOfRestricted .= ';'.$dataTmp['login'];
3111 3110
                         }
3112 3111
                     }
3113 3112
                 }
@@ -3181,9 +3180,9 @@  discard block
 block discarded – undo
3181 3180
         // Load item data
3182 3181
         $dataItem = DB::queryFirstRow(
3183 3182
             '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
3184
-            FROM ' . prefixTable('items') . ' AS i
3185
-            INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (i.id_tree = n.id)
3186
-            LEFT JOIN ' . prefixTable('items_otp') . ' AS o ON (o.item_id = i.id)
3183
+            FROM ' . prefixTable('items').' AS i
3184
+            INNER JOIN ' . prefixTable('nested_tree').' AS n ON (i.id_tree = n.id)
3185
+            LEFT JOIN ' . prefixTable('items_otp').' AS o ON (o.item_id = i.id)
3187 3186
             WHERE i.id = %i',
3188 3187
             $inputData['id']
3189 3188
         );
@@ -3205,7 +3204,7 @@  discard block
 block discarded – undo
3205 3204
         // Check if user has a role that is accepted
3206 3205
         $rows_tmp = DB::query(
3207 3206
             'SELECT role_id
3208
-            FROM ' . prefixTable('restriction_to_roles') . '
3207
+            FROM ' . prefixTable('restriction_to_roles').'
3209 3208
             WHERE item_id=%i',
3210 3209
             $inputData['id']
3211 3210
         );
@@ -3237,12 +3236,12 @@  discard block
 block discarded – undo
3237 3236
             // launch query
3238 3237
             $rows = DB::query(
3239 3238
                 'SELECT id, name, file, extension, size
3240
-                FROM ' . prefixTable('files') . '
3239
+                FROM ' . prefixTable('files').'
3241 3240
                 WHERE id_item = %i AND confirmed = 1',
3242 3241
                 $inputData['id']
3243 3242
             );
3244 3243
             foreach ($rows as $record) {
3245
-                $filename = basename($record['name'], '.' . $record['extension']);
3244
+                $filename = basename($record['name'], '.'.$record['extension']);
3246 3245
                 $filename = isBase64($filename) === true ? base64_decode($filename) : $filename;
3247 3246
 
3248 3247
                 array_push(
@@ -3255,7 +3254,7 @@  discard block
 block discarded – undo
3255 3254
                         'is_image' => in_array(strtolower($record['extension']), TP_IMAGE_FILE_EXT) === true ? 1 : 0,
3256 3255
                         'id' => $record['id'],
3257 3256
                         'key' => $session->get('user-key_tmp'),
3258
-                        'internalFilename' => basename($record['name'], '.' . $record['extension']),
3257
+                        'internalFilename' => basename($record['name'], '.'.$record['extension']),
3259 3258
                     )
3260 3259
                 );
3261 3260
             }
@@ -3293,7 +3292,7 @@  discard block
 block discarded – undo
3293 3292
                     array(
3294 3293
                         'latest_items' => implode(';', $session->get('user-latest_items')),
3295 3294
                     ),
3296
-                    'id=' . $session->get('user-id')
3295
+                    'id='.$session->get('user-id')
3297 3296
                 );
3298 3297
             }
3299 3298
 
@@ -3302,8 +3301,8 @@  discard block
 block discarded – undo
3302 3301
             $listOptionsForRoles = array();
3303 3302
             $rows = DB::query(
3304 3303
                 'SELECT r.role_id AS role_id, t.title AS title
3305
-                FROM ' . prefixTable('roles_values') . ' AS r
3306
-                INNER JOIN ' . prefixTable('roles_title') . ' AS t ON (r.role_id = t.id)
3304
+                FROM ' . prefixTable('roles_values').' AS r
3305
+                INNER JOIN ' . prefixTable('roles_title').' AS t ON (r.role_id = t.id)
3307 3306
                 WHERE r.folder_id = %i',
3308 3307
                 $dataItem['id_tree']
3309 3308
             );
@@ -3317,9 +3316,9 @@  discard block
 block discarded – undo
3317 3316
                 );
3318 3317
                 $rows2 = DB::query(
3319 3318
                     'SELECT id, login, fonction_id, email, name, lastname
3320
-                    FROM ' . prefixTable('users') . '
3319
+                    FROM ' . prefixTable('users').'
3321 3320
                     WHERE fonction_id LIKE %s',
3322
-                    '%' . $record['role_id'] . '%'
3321
+                    '%'.$record['role_id'].'%'
3323 3322
                 );
3324 3323
                 foreach ($rows2 as $record2) {
3325 3324
                     foreach (explode(';', $record2['fonction_id']) as $role) {
@@ -3332,7 +3331,7 @@  discard block
 block discarded – undo
3332 3331
                                 array(
3333 3332
                                     'id' => (int) $record2['id'],
3334 3333
                                     'login' => $record2['login'],
3335
-                                    'name' => $record2['name'] . ' ' . $record2['lastname'],
3334
+                                    'name' => $record2['name'].' '.$record2['lastname'],
3336 3335
                                     'email' => $record2['email'],
3337 3336
                                 )
3338 3337
                             );
@@ -3351,16 +3350,16 @@  discard block
 block discarded – undo
3351 3350
                 $path = '';
3352 3351
                 foreach ($arbo as $elem) {
3353 3352
                     if (empty($path) === true) {
3354
-                        $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' ';
3353
+                        $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' ';
3355 3354
                     } else {
3356
-                        $path .= '&#8594; ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
3355
+                        $path .= '&#8594; '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
3357 3356
                     }
3358 3357
                 }
3359 3358
                 // Build text to show user
3360 3359
                 if (empty($path) === true) {
3361 3360
                     $path = addslashes($dataItem['label']);
3362 3361
                 } else {
3363
-                    $path = addslashes($dataItem['label']) . ' (' . $path . ')';
3362
+                    $path = addslashes($dataItem['label']).' ('.$path.')';
3364 3363
                 }
3365 3364
 
3366 3365
                 // Add Admins to notification list if expected
@@ -3383,7 +3382,7 @@  discard block
 block discarded – undo
3383 3382
                         array(
3384 3383
                             addslashes($session->get('user-login')),
3385 3384
                             $path,
3386
-                            $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $dataItem['id'],
3385
+                            $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$dataItem['id'],
3387 3386
                         ),
3388 3387
                         $lang->get('email_on_open_notification_mail')
3389 3388
                     ),
@@ -3393,7 +3392,7 @@  discard block
 block discarded – undo
3393 3392
             }
3394 3393
 
3395 3394
             // has this item a change proposal
3396
-            DB::query('SELECT * FROM ' . prefixTable('items_change') . ' WHERE item_id = %i', $inputData['id']);
3395
+            DB::query('SELECT * FROM '.prefixTable('items_change').' WHERE item_id = %i', $inputData['id']);
3397 3396
             $returnArray['has_change_proposal'] = DB::count();
3398 3397
 
3399 3398
             // Setting
@@ -3404,7 +3403,7 @@  discard block
 block discarded – undo
3404 3403
             if (isset($SETTINGS['otv_is_enabled']) === true && (int) $SETTINGS['otv_is_enabled'] === 1) {
3405 3404
                 DB::query(
3406 3405
                     'SELECT *
3407
-                    FROM ' . prefixTable('otv') . '
3406
+                    FROM ' . prefixTable('otv').'
3408 3407
                     WHERE item_id = %i
3409 3408
                     AND time_limit > %i',
3410 3409
                     $inputData['id'],
@@ -3504,7 +3503,7 @@  discard block
 block discarded – undo
3504 3503
         // Load item data
3505 3504
         $data = DB::queryFirstRow(
3506 3505
             'SELECT id_tree, id, label
3507
-            FROM ' . prefixTable('items') . '
3506
+            FROM ' . prefixTable('items').'
3508 3507
             WHERE id = %i OR item_key = %s',
3509 3508
             $inputData['itemId'],
3510 3509
             $inputData['itemKey']
@@ -3595,7 +3594,7 @@  discard block
 block discarded – undo
3595 3594
         // Load item data
3596 3595
         $dataItem = DB::queryFirstRow(
3597 3596
             'SELECT secret, enabled
3598
-            FROM ' . prefixTable('items_otp') . '
3597
+            FROM ' . prefixTable('items_otp').'
3599 3598
             WHERE item_id = %i',
3600 3599
             $inputData['id']
3601 3600
         );
@@ -3677,13 +3676,13 @@  discard block
 block discarded – undo
3677 3676
 
3678 3677
         // Check if user is allowed to access this folder
3679 3678
         if (!in_array($inputData['folderId'], $session->get('user-accessible_folders'))) {
3680
-            echo '[{"error" : "' . $lang->get('error_not_allowed_to') . '"}]';
3679
+            echo '[{"error" : "'.$lang->get('error_not_allowed_to').'"}]';
3681 3680
             break;
3682 3681
         }
3683 3682
 
3684 3683
         // Check if title doesn't contains html codes
3685 3684
         if (preg_match_all('|<[^>]+>(.*)</[^>]+>|U', $title, $out)) {
3686
-            echo '[ { "error" : "' . $lang->get('error_html_codes') . '" } ]';
3685
+            echo '[ { "error" : "'.$lang->get('error_html_codes').'" } ]';
3687 3686
             break;
3688 3687
         }
3689 3688
         // check that title is not numeric
@@ -3694,9 +3693,9 @@  discard block
 block discarded – undo
3694 3693
 
3695 3694
         // Check if duplicate folders name are allowed
3696 3695
         if (isset($SETTINGS['duplicate_folder']) && $SETTINGS['duplicate_folder'] === '0') {
3697
-            $data = DB::queryFirstRow('SELECT id, title FROM ' . prefixTable('nested_tree') . ' WHERE title = %s', $title);
3696
+            $data = DB::queryFirstRow('SELECT id, title FROM '.prefixTable('nested_tree').' WHERE title = %s', $title);
3698 3697
             if (empty($data['id']) === false && $dataReceived['folder'] !== $data['id']) {
3699
-                echo '[ { "error" : "' . $lang->get('error_group_exist') . '" } ]';
3698
+                echo '[ { "error" : "'.$lang->get('error_group_exist').'" } ]';
3700 3699
                 break;
3701 3700
             }
3702 3701
         }
@@ -3704,7 +3703,7 @@  discard block
 block discarded – undo
3704 3703
         // query on folder
3705 3704
         $data = DB::queryfirstrow(
3706 3705
             'SELECT parent_id, personal_folder
3707
-            FROM ' . prefixTable('nested_tree') . '
3706
+            FROM ' . prefixTable('nested_tree').'
3708 3707
             WHERE id = %i',
3709 3708
             $inputData['folderId']
3710 3709
         );
@@ -3714,20 +3713,20 @@  discard block
 block discarded – undo
3714 3713
         if ($session->get('user-admin') !== 1 && $session->get('user-manager') !== 1 && $data['personal_folder'] === '0') {
3715 3714
             $data = DB::queryfirstrow(
3716 3715
                 'SELECT valeur
3717
-                FROM ' . prefixTable('misc') . '
3716
+                FROM ' . prefixTable('misc').'
3718 3717
                 WHERE intitule = %i AND type = %s',
3719 3718
                 $data['parent_id'],
3720 3719
                 'complex'
3721 3720
             );
3722 3721
             if (intval($dataReceived['complexity']) < intval($data['valeur'])) {
3723
-                echo '[ { "error" : "' . $lang->get('error_folder_complexity_lower_than_top_folder') . ' [<b>' . TP_PW_COMPLEXITY[$data['valeur']][1] . '</b>]"} ]';
3722
+                echo '[ { "error" : "'.$lang->get('error_folder_complexity_lower_than_top_folder').' [<b>'.TP_PW_COMPLEXITY[$data['valeur']][1].'</b>]"} ]';
3724 3723
                 break;
3725 3724
             }
3726 3725
         }
3727 3726
 
3728 3727
         // update Folders table
3729 3728
         $tmp = DB::queryFirstRow(
3730
-            'SELECT title, parent_id, personal_folder FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
3729
+            'SELECT title, parent_id, personal_folder FROM '.prefixTable('nested_tree').' WHERE id = %i',
3731 3730
             $dataReceived['folder']
3732 3731
         );
3733 3732
         if ($tmp['parent_id'] !== 0 || $tmp['title'] !== $session->get('user-id') || $tmp['personal_folder'] !== 1) {
@@ -3841,7 +3840,7 @@  discard block
 block discarded – undo
3841 3840
             $uniqueLoadData['path'] = $arr_arbo;
3842 3841
 
3843 3842
             // store last folder accessed in cookie
3844
-            $arr_cookie_options = array (
3843
+            $arr_cookie_options = array(
3845 3844
                 'expires' => time() + TP_ONE_DAY_SECONDS * 5,
3846 3845
                 'path' => '/', 
3847 3846
                 'secure' => true,
@@ -3856,7 +3855,7 @@  discard block
 block discarded – undo
3856 3855
             foreach ($session->get('user-roles_array') as $role) {
3857 3856
                 $roleQ = DB::queryfirstrow(
3858 3857
                     'SELECT allow_pw_change
3859
-                    FROM ' . prefixTable('roles_title') . '
3858
+                    FROM ' . prefixTable('roles_title').'
3860 3859
                     WHERE id = %i',
3861 3860
                     $role
3862 3861
                 );
@@ -3887,11 +3886,11 @@  discard block
 block discarded – undo
3887 3886
                 
3888 3887
                 foreach ($session->get('user-roles_array') as $role) {
3889 3888
                     $access = DB::queryFirstRow(
3890
-                        'SELECT type FROM ' . prefixTable('roles_values') . ' WHERE role_id = %i AND folder_id = %i',
3889
+                        'SELECT type FROM '.prefixTable('roles_values').' WHERE role_id = %i AND folder_id = %i',
3891 3890
                         $role,
3892 3891
                         $inputData['id']
3893 3892
                     );
3894
-                    if (DB::count()>0) {
3893
+                    if (DB::count() > 0) {
3895 3894
                         if ($access['type'] === 'R') {
3896 3895
                             array_push($arrTmp, 10);
3897 3896
                         } elseif ($access['type'] === 'W') {
@@ -3956,7 +3955,7 @@  discard block
 block discarded – undo
3956 3955
             } else {
3957 3956
                 DB::query(
3958 3957
                     'SELECT *
3959
-                    FROM ' . prefixTable('items') . '
3958
+                    FROM ' . prefixTable('items').'
3960 3959
                     WHERE inactif = %i',
3961 3960
                     0
3962 3961
                 );
@@ -3966,7 +3965,7 @@  discard block
 block discarded – undo
3966 3965
 
3967 3966
             // Get folder complexity
3968 3967
             $folderComplexity = DB::queryFirstRow(
3969
-                'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %i',
3968
+                'SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %i',
3970 3969
                 'complex',
3971 3970
                 $inputData['id']
3972 3971
             );
@@ -3978,7 +3977,7 @@  discard block
 block discarded – undo
3978 3977
             if (isset($SETTINGS['item_extra_fields']) && (int) $SETTINGS['item_extra_fields'] === 1) {
3979 3978
                 $folderRow = DB::query(
3980 3979
                     'SELECT id_category
3981
-                    FROM ' . prefixTable('categories_folders') . '
3980
+                    FROM ' . prefixTable('categories_folders').'
3982 3981
                     WHERE id_folder = %i',
3983 3982
                     $inputData['id']
3984 3983
                 );
@@ -4093,9 +4092,9 @@  discard block
 block discarded – undo
4093 4092
             // List all ITEMS
4094 4093
             if ($folderIsPf === false) {
4095 4094
                 $where->add('i.inactif=%i', 0);
4096
-                $sql_e='(SELECT date FROM ' . prefixTable('log_items') 
4095
+                $sql_e = '(SELECT date FROM '.prefixTable('log_items') 
4097 4096
                     . " WHERE action = 'at_creation' AND id_item=i.id " 
4098
-                    . 'union all SELECT date FROM '. prefixTable('log_items') 
4097
+                    . 'union all SELECT date FROM '.prefixTable('log_items') 
4099 4098
                     . " WHERE action = 'at_modification' AND raison = 'at_pw'
4100 4099
                     AND id_item=i.id ORDER BY date DESC LIMIT 1)";
4101 4100
                 $where->add('l.date=%l', $sql_e);
@@ -4103,8 +4102,8 @@  discard block
 block discarded – undo
4103 4102
                     $where->add('i.id IN %ls', explode(',', $limited_to_items));
4104 4103
                 }
4105 4104
 
4106
-                $query_limit = ' LIMIT ' .
4107
-                    $start . ',' .
4105
+                $query_limit = ' LIMIT '.
4106
+                    $start.','.
4108 4107
                     $post_nb_items_to_display_once;
4109 4108
                 //db::debugmode(true);
4110 4109
                 $rows = DB::query(
@@ -4116,9 +4115,9 @@  discard block
 block discarded – undo
4116 4115
                     l.id_user AS log_user,
4117 4116
                     i.url AS link,
4118 4117
                     i.email AS email
4119
-                    FROM ' . prefixTable('items') . ' AS i
4120
-                    INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (i.id_tree = n.id)
4121
-                    INNER JOIN ' . prefixTable('log_items') . ' AS l ON (i.id = l.id_item)
4118
+                    FROM ' . prefixTable('items').' AS i
4119
+                    INNER JOIN ' . prefixTable('nested_tree').' AS n ON (i.id_tree = n.id)
4120
+                    INNER JOIN ' . prefixTable('log_items').' AS l ON (i.id = l.id_item)
4122 4121
                     WHERE %l
4123 4122
                     GROUP BY i.id, l.date, l.id_user, l.action
4124 4123
                     ORDER BY i.label ASC, l.date DESC' . $query_limit,
@@ -4138,9 +4137,9 @@  discard block
 block discarded – undo
4138 4137
                     l.id_user AS log_user,
4139 4138
                     i.url AS link,
4140 4139
                     i.email AS email
4141
-                    FROM ' . prefixTable('items') . ' AS i
4142
-                    INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (i.id_tree = n.id)
4143
-                    INNER JOIN ' . prefixTable('log_items') . ' AS l ON (i.id = l.id_item)
4140
+                    FROM ' . prefixTable('items').' AS i
4141
+                    INNER JOIN ' . prefixTable('nested_tree').' AS n ON (i.id_tree = n.id)
4142
+                    INNER JOIN ' . prefixTable('log_items').' AS l ON (i.id = l.id_item)
4144 4143
                     WHERE %l
4145 4144
                     GROUP BY i.id, l.date, l.id_user, l.action
4146 4145
                     ORDER BY i.label ASC, l.date DESC',
@@ -4171,7 +4170,7 @@  discard block
 block discarded – undo
4171 4170
                     $item_is_restricted_to_role = false;
4172 4171
                     DB::queryfirstrow(
4173 4172
                         'SELECT role_id
4174
-                        FROM ' . prefixTable('restriction_to_roles') . '
4173
+                        FROM ' . prefixTable('restriction_to_roles').'
4175 4174
                         WHERE item_id = %i',
4176 4175
                         $record['id']
4177 4176
                     );
@@ -4183,7 +4182,7 @@  discard block
 block discarded – undo
4183 4182
                     $user_is_included_in_role = false;
4184 4183
                     DB::query(
4185 4184
                         'SELECT role_id
4186
-                        FROM ' . prefixTable('restriction_to_roles') . '
4185
+                        FROM ' . prefixTable('restriction_to_roles').'
4187 4186
                         WHERE item_id = %i AND role_id IN %ls',
4188 4187
                         $record['id'],
4189 4188
                         $session->get('user-roles_array')
@@ -4390,9 +4389,9 @@  discard block
 block discarded – undo
4390 4389
         if ((int) $start === 0) {
4391 4390
             DB::query(
4392 4391
                 'SELECT i.id
4393
-                FROM ' . prefixTable('items') . ' as i
4394
-                INNER JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree = n.id)
4395
-                INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id = l.id_item)
4392
+                FROM ' . prefixTable('items').' as i
4393
+                INNER JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree = n.id)
4394
+                INNER JOIN ' . prefixTable('log_items').' as l ON (i.id = l.id_item)
4396 4395
                 WHERE %l
4397 4396
                 ORDER BY i.label ASC, l.date DESC',
4398 4397
                 $where
@@ -4457,8 +4456,8 @@  discard block
 block discarded – undo
4457 4456
         $dataItem = DB::queryfirstrow(
4458 4457
             'SELECT i.pw AS pw, s.share_key AS share_key, i.id AS id,
4459 4458
                     i.label AS label, i.id_tree AS id_tree
4460
-            FROM ' . prefixTable('items') . ' AS i
4461
-            INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (s.object_id = i.id)
4459
+            FROM ' . prefixTable('items').' AS i
4460
+            INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (s.object_id = i.id)
4462 4461
             WHERE user_id = %i AND (i.item_key = %s OR i.id = %i)',
4463 4462
             $session->get('user-id'),
4464 4463
             $inputData['itemKey'] ?? '',
@@ -4553,7 +4552,7 @@  discard block
 block discarded – undo
4553 4552
             // get if existing edition lock
4554 4553
             $dataItemEditionLocks = DB::query(
4555 4554
                 'SELECT timestamp, user_id
4556
-                FROM ' . prefixTable('items_edition') . '
4555
+                FROM ' . prefixTable('items_edition').'
4557 4556
                 WHERE item_id = %i 
4558 4557
                 ORDER BY increment_id DESC',
4559 4558
                 $inputData['itemId']
@@ -4562,7 +4561,7 @@  discard block
 block discarded – undo
4562 4561
             if (WIP === true) error_log('Existing edition locks: '.DB::count());
4563 4562
 
4564 4563
             // Check if item has no edition lock
4565
-            if ((int) DB::count() > 0 ) {
4564
+            if ((int) DB::count() > 0) {
4566 4565
                 // get last edition lock
4567 4566
                 $dataLastItemEditionLock = $dataItemEditionLocks[0];
4568 4567
 
@@ -4572,10 +4571,10 @@  discard block
 block discarded – undo
4572 4571
                 } else {
4573 4572
                     $delay = EDITION_LOCK_PERIOD; // One day delay
4574 4573
                 }
4575
-                if (WIP === true) error_log('delay: ' . $delay);
4574
+                if (WIP === true) error_log('delay: '.$delay);
4576 4575
 
4577 4576
                 // We remove old edition locks if delay is expired meaning more than 1 day long
4578
-                if (round(abs(time() - $dataTmp['timestamp']),0) > $delay) {
4577
+                if (round(abs(time() - $dataTmp['timestamp']), 0) > $delay) {
4579 4578
                     // Case where time is expired
4580 4579
                     // In this case, delete edition lock and possible ongoing processes
4581 4580
                     // and continue editing this time
@@ -4592,7 +4591,7 @@  discard block
 block discarded – undo
4592 4591
                         // Get process Id
4593 4592
                         $processDetail = DB::queryFirstRow(
4594 4593
                             'SELECT increment_id
4595
-                            FROM ' . prefixTable('background_tasks') . '
4594
+                            FROM ' . prefixTable('background_tasks').'
4596 4595
                             WHERE item_id = %i AND finished_at = ""',
4597 4596
                             $inputData['itemId']
4598 4597
                         );
@@ -4610,7 +4609,7 @@  discard block
 block discarded – undo
4610 4609
                     // get if existing process ongoing for this item
4611 4610
                     $dataItemProcessOngoing = DB::queryFirstRow(
4612 4611
                         'SELECT JSON_EXTRACT(arguments, "$.all_users_except_id") AS all_users_except_id
4613
-                        FROM ' . prefixTable('background_tasks') . '
4612
+                        FROM ' . prefixTable('background_tasks').'
4614 4613
                         WHERE item_id = %i AND finished_at = ""
4615 4614
                         ORDER BY increment_id DESC',
4616 4615
                         $inputData['itemId']
@@ -4637,7 +4636,7 @@  discard block
 block discarded – undo
4637 4636
                         );
4638 4637
                         break;
4639 4638
                     }
4640
-                } elseif (round(abs(time() - $dataTmp['timestamp']),0) <= $delay) {
4639
+                } elseif (round(abs(time() - $dataTmp['timestamp']), 0) <= $delay) {
4641 4640
                     // Case where edition lock is already taken by another user
4642 4641
                     // Then no edition is possible
4643 4642
                     $returnValues = array(
@@ -4666,7 +4665,7 @@  discard block
 block discarded – undo
4666 4665
         // do query on this folder
4667 4666
         $data_this_folder = DB::queryFirstRow(
4668 4667
             'SELECT id, personal_folder, title
4669
-            FROM ' . prefixTable('nested_tree') . '
4668
+            FROM ' . prefixTable('nested_tree').'
4670 4669
             WHERE id = %s',
4671 4670
             $inputData['folderId']
4672 4671
         );
@@ -4706,8 +4705,8 @@  discard block
 block discarded – undo
4706 4705
         $visibilite = '';
4707 4706
         $data = DB::queryFirstRow(
4708 4707
             'SELECT m.valeur, n.personal_folder
4709
-            FROM ' . prefixTable('misc') . ' AS m
4710
-            INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (m.intitule = n.id)
4708
+            FROM ' . prefixTable('misc').' AS m
4709
+            INNER JOIN ' . prefixTable('nested_tree').' AS n ON (m.intitule = n.id)
4711 4710
             WHERE type=%s AND intitule = %s',
4712 4711
             'complex',
4713 4712
             $inputData['folderId']
@@ -4720,8 +4719,8 @@  discard block
 block discarded – undo
4720 4719
             // Prepare Item actual visibility (what Users/Roles can see it)
4721 4720
             $rows = DB::query(
4722 4721
                 'SELECT t.title
4723
-                FROM ' . prefixTable('roles_values') . ' as v
4724
-                INNER JOIN ' . prefixTable('roles_title') . ' as t ON (v.role_id = t.id)
4722
+                FROM ' . prefixTable('roles_values').' as v
4723
+                INNER JOIN ' . prefixTable('roles_title').' as t ON (v.role_id = t.id)
4725 4724
                 WHERE v.folder_id = %i
4726 4725
                 GROUP BY title',
4727 4726
                 $inputData['folderId']
@@ -4730,7 +4729,7 @@  discard block
 block discarded – undo
4730 4729
                 if (empty($visibilite)) {
4731 4730
                     $visibilite = $record['title'];
4732 4731
                 } else {
4733
-                    $visibilite .= ' - ' . $record['title'];
4732
+                    $visibilite .= ' - '.$record['title'];
4734 4733
                 }
4735 4734
             }
4736 4735
         } else {
@@ -4740,14 +4739,14 @@  discard block
 block discarded – undo
4740 4739
             // do new query to know if current folder is pf
4741 4740
             $data_pf = DB::queryFirstRow(
4742 4741
                 'SELECT personal_folder
4743
-                FROM ' . prefixTable('nested_tree') . '
4742
+                FROM ' . prefixTable('nested_tree').'
4744 4743
                 WHERE id = %s',
4745 4744
                 $inputData['folderId']
4746 4745
             );
4747 4746
             
4748 4747
             $folder_is_personal = $data_pf !== null ? (int) $data_pf['personal_folder'] : 0;
4749 4748
             
4750
-            $visibilite = $session->get('user-name') . ' ' . $session->get('user-lastname') . ' (' . $session->get('user-login') . ')';
4749
+            $visibilite = $session->get('user-name').' '.$session->get('user-lastname').' ('.$session->get('user-login').')';
4751 4750
         }
4752 4751
 
4753 4752
         recupDroitCreationSansComplexite($inputData['folderId']);
@@ -4757,8 +4756,8 @@  discard block
 block discarded – undo
4757 4756
         $listOptionsForRoles = array();
4758 4757
         $rows = DB::query(
4759 4758
             'SELECT r.role_id AS role_id, t.title AS title
4760
-            FROM ' . prefixTable('roles_values') . ' AS r
4761
-            INNER JOIN ' . prefixTable('roles_title') . ' AS t ON (r.role_id = t.id)
4759
+            FROM ' . prefixTable('roles_values').' AS r
4760
+            INNER JOIN ' . prefixTable('roles_title').' AS t ON (r.role_id = t.id)
4762 4761
             WHERE r.folder_id = %i',
4763 4762
             $inputData['folderId']
4764 4763
         );
@@ -4772,7 +4771,7 @@  discard block
 block discarded – undo
4772 4771
             );
4773 4772
             $rows2 = DB::query(
4774 4773
                 'SELECT id, login, fonction_id, email, name, lastname
4775
-                FROM ' . prefixTable('users') . '
4774
+                FROM ' . prefixTable('users').'
4776 4775
                 WHERE admin = 0 AND fonction_id is not null'
4777 4776
             );
4778 4777
             foreach ($rows2 as $record2) {
@@ -4786,7 +4785,7 @@  discard block
 block discarded – undo
4786 4785
                             array(
4787 4786
                                 'id' => $record2['id'],
4788 4787
                                 'login' => $record2['login'],
4789
-                                'name' => $record2['name'] . ' ' . $record2['lastname'],
4788
+                                'name' => $record2['name'].' '.$record2['lastname'],
4790 4789
                                 'email' => $record2['email'],
4791 4790
                             )
4792 4791
                         );
@@ -4803,13 +4802,13 @@  discard block
 block discarded – undo
4803 4802
                 //db::debugmode(true);
4804 4803
                 $access = DB::queryFirstRow(
4805 4804
                     'SELECT type
4806
-                    FROM ' . prefixTable('roles_values') . '
4805
+                    FROM ' . prefixTable('roles_values').'
4807 4806
                     WHERE role_id = %i AND folder_id = %i',
4808 4807
                     $role,
4809 4808
                     $inputData['folderId']
4810 4809
                 );
4811 4810
                 //db::debugmode(false);
4812
-                if (DB::count()>0) {
4811
+                if (DB::count() > 0) {
4813 4812
                     if ($access['type'] === 'R') {
4814 4813
                         array_push($arrTmp, 10);
4815 4814
                     } elseif ($access['type'] === 'W') {
@@ -4837,7 +4836,7 @@  discard block
 block discarded – undo
4837 4836
             // Check if personal folder is owned by user
4838 4837
             $folder = DB::queryFirstRow(
4839 4838
                 'SELECT id
4840
-                FROM ' . prefixTable('nested_tree') . '
4839
+                FROM ' . prefixTable('nested_tree').'
4841 4840
                 WHERE title = %s',
4842 4841
                 $session->get('user-id'),
4843 4842
             );
@@ -4942,7 +4941,7 @@  discard block
 block discarded – undo
4942 4941
         // Get some info before deleting
4943 4942
         $data = DB::queryFirstRow(
4944 4943
             'SELECT name, id_item, file
4945
-            FROM ' . prefixTable('files') . '
4944
+            FROM ' . prefixTable('files').'
4946 4945
             WHERE id = %i',
4947 4946
             $fileId
4948 4947
         );
@@ -4950,7 +4949,7 @@  discard block
 block discarded – undo
4950 4949
         // Load item data
4951 4950
         $data_item = DB::queryFirstRow(
4952 4951
             'SELECT id_tree
4953
-            FROM ' . prefixTable('items') . '
4952
+            FROM ' . prefixTable('items').'
4954 4953
             WHERE id = %i',
4955 4954
             $data['id_item']
4956 4955
         );
@@ -4980,7 +4979,7 @@  discard block
 block discarded – undo
4980 4979
                 $session->get('user-id'),
4981 4980
                 'at_modification',
4982 4981
                 $session->get('user-login'),
4983
-                'at_del_file : ' . $data['name']
4982
+                'at_del_file : '.$data['name']
4984 4983
             );
4985 4984
 
4986 4985
             // DElete sharekeys
@@ -4991,7 +4990,7 @@  discard block
 block discarded – undo
4991 4990
             );
4992 4991
 
4993 4992
             // Delete file from server
4994
-            $fileToDelete = $SETTINGS['path_to_upload_folder'] . '/' . TP_FILE_PREFIX . base64_decode($data['file']);
4993
+            $fileToDelete = $SETTINGS['path_to_upload_folder'].'/'.TP_FILE_PREFIX.base64_decode($data['file']);
4995 4994
             $fileToDelete = realpath($fileToDelete);
4996 4995
             if ($fileToDelete && strpos($fileToDelete, $SETTINGS['path_to_upload_folder']) === 0) {
4997 4996
                 fileDelete($fileToDelete, $SETTINGS);
@@ -5045,7 +5044,7 @@  discard block
 block discarded – undo
5045 5044
             // Update SESSION with this new favourite
5046 5045
             $data = DB::queryfirstrow(
5047 5046
                 'SELECT label,id_tree
5048
-                FROM ' . prefixTable('items') . '
5047
+                FROM ' . prefixTable('items').'
5049 5048
                 WHERE id = %i',
5050 5049
                 $inputData['itemId']
5051 5050
             );
@@ -5054,7 +5053,7 @@  discard block
 block discarded – undo
5054 5053
                 [
5055 5054
                     $inputData['itemId'] => [
5056 5055
                         'label' => $data['label'],
5057
-                        'url' => 'index.php?page=items&amp;group=' . $data['id_tree'] . '&amp;id=' . $inputData['itemId'],
5056
+                        'url' => 'index.php?page=items&amp;group='.$data['id_tree'].'&amp;id='.$inputData['itemId'],
5058 5057
                     ],
5059 5058
                 ],
5060 5059
                 'add'
@@ -5123,8 +5122,8 @@  discard block
 block discarded – undo
5123 5122
         // get data about item
5124 5123
         $dataSource = DB::queryfirstrow(
5125 5124
             'SELECT i.pw, f.personal_folder,i.id_tree, f.title,i.label
5126
-            FROM ' . prefixTable('items') . ' as i
5127
-            INNER JOIN ' . prefixTable('nested_tree') . ' as f ON (i.id_tree=f.id)
5125
+            FROM ' . prefixTable('items').' as i
5126
+            INNER JOIN ' . prefixTable('nested_tree').' as f ON (i.id_tree=f.id)
5128 5127
             WHERE i.id=%i',
5129 5128
             $inputData['itemId']
5130 5129
         );
@@ -5168,7 +5167,7 @@  discard block
 block discarded – undo
5168 5167
         // get data about new folder
5169 5168
         $dataDestination = DB::queryfirstrow(
5170 5169
             'SELECT personal_folder, title
5171
-            FROM ' . prefixTable('nested_tree') . '
5170
+            FROM ' . prefixTable('nested_tree').'
5172 5171
             WHERE id = %i',
5173 5172
             $inputData['folderId']
5174 5173
         );
@@ -5221,7 +5220,7 @@  discard block
 block discarded – undo
5221 5220
             // Get fields for this Item
5222 5221
             $rows = DB::query(
5223 5222
                 'SELECT id
5224
-                FROM ' . prefixTable('categories_items') . '
5223
+                FROM ' . prefixTable('categories_items').'
5225 5224
                 WHERE item_id = %i',
5226 5225
                 $inputData['itemId']
5227 5226
             );
@@ -5238,7 +5237,7 @@  discard block
 block discarded – undo
5238 5237
             // Get FILES for this Item
5239 5238
             $rows = DB::query(
5240 5239
                 'SELECT id
5241
-                FROM ' . prefixTable('files') . '
5240
+                FROM ' . prefixTable('files').'
5242 5241
                 WHERE id_item = %i',
5243 5242
                 $inputData['itemId']
5244 5243
             );
@@ -5285,7 +5284,7 @@  discard block
 block discarded – undo
5285 5284
             // Get the ITEM object key for the user
5286 5285
             $userKey = DB::queryFirstRow(
5287 5286
                 'SELECT share_key
5288
-                FROM ' . prefixTable('sharekeys_items') . '
5287
+                FROM ' . prefixTable('sharekeys_items').'
5289 5288
                 WHERE user_id = %i AND object_id = %i',
5290 5289
                 $session->get('user-id'),
5291 5290
                 $inputData['itemId']
@@ -5296,7 +5295,7 @@  discard block
 block discarded – undo
5296 5295
                 // This is a public object
5297 5296
                 $users = DB::query(
5298 5297
                     'SELECT id, public_key
5299
-                    FROM ' . prefixTable('users') . '
5298
+                    FROM ' . prefixTable('users').'
5300 5299
                     WHERE id NOT IN %li
5301 5300
                     AND public_key != ""',
5302 5301
                     $tpUsersIDs
@@ -5319,14 +5318,14 @@  discard block
 block discarded – undo
5319 5318
             // Get fields for this Item
5320 5319
             $rows = DB::query(
5321 5320
                 'SELECT id
5322
-                FROM ' . prefixTable('categories_items') . '
5321
+                FROM ' . prefixTable('categories_items').'
5323 5322
                 WHERE item_id = %i',
5324 5323
                 $inputData['itemId']
5325 5324
             );
5326 5325
             foreach ($rows as $field) {
5327 5326
                 $userKey = DB::queryFirstRow(
5328 5327
                     'SELECT share_key
5329
-                    FROM ' . prefixTable('sharekeys_fields') . '
5328
+                    FROM ' . prefixTable('sharekeys_fields').'
5330 5329
                     WHERE user_id = %i AND object_id = %i',
5331 5330
                     $session->get('user-id'),
5332 5331
                     $field['id']
@@ -5337,7 +5336,7 @@  discard block
 block discarded – undo
5337 5336
                     // This is a public object
5338 5337
                     $users = DB::query(
5339 5338
                         'SELECT id, public_key
5340
-                        FROM ' . prefixTable('users') . '
5339
+                        FROM ' . prefixTable('users').'
5341 5340
                         WHERE id NOT IN %li
5342 5341
                         AND public_key != ""',
5343 5342
                         $tpUsersIDs
@@ -5360,14 +5359,14 @@  discard block
 block discarded – undo
5360 5359
             // Get FILES for this Item
5361 5360
             $rows = DB::query(
5362 5361
                 'SELECT id
5363
-                FROM ' . prefixTable('files') . '
5362
+                FROM ' . prefixTable('files').'
5364 5363
                 WHERE id_item = %i',
5365 5364
                 $inputData['itemId']
5366 5365
             );
5367 5366
             foreach ($rows as $attachment) {
5368 5367
                 $userKey = DB::queryFirstRow(
5369 5368
                     'SELECT share_key
5370
-                    FROM ' . prefixTable('sharekeys_files') . '
5369
+                    FROM ' . prefixTable('sharekeys_files').'
5371 5370
                     WHERE user_id = %i AND object_id = %i',
5372 5371
                     $session->get('user-id'),
5373 5372
                     $attachment['id']
@@ -5378,7 +5377,7 @@  discard block
 block discarded – undo
5378 5377
                     // This is a public object
5379 5378
                     $users = DB::query(
5380 5379
                         'SELECT id, public_key
5381
-                        FROM ' . prefixTable('users') . '
5380
+                        FROM ' . prefixTable('users').'
5382 5381
                         WHERE id NOT IN %li
5383 5382
                         AND public_key != ""',
5384 5383
                         $tpUsersIDs
@@ -5419,7 +5418,7 @@  discard block
 block discarded – undo
5419 5418
             $session->get('user-id'),
5420 5419
             'at_modification',
5421 5420
             $session->get('user-login'),
5422
-            'at_moved : ' . $dataSource['title'] . ' -> ' . $dataDestination['title']
5421
+            'at_moved : '.$dataSource['title'].' -> '.$dataDestination['title']
5423 5422
         );
5424 5423
 
5425 5424
         // Update cache table
@@ -5478,8 +5477,8 @@  discard block
 block discarded – undo
5478 5477
                 // get data about item
5479 5478
                 $dataSource = DB::queryfirstrow(
5480 5479
                     'SELECT i.pw, f.personal_folder,i.id_tree, f.title,i.label
5481
-                    FROM ' . prefixTable('items') . ' as i
5482
-                    INNER JOIN ' . prefixTable('nested_tree') . ' as f ON (i.id_tree=f.id)
5480
+                    FROM ' . prefixTable('items').' as i
5481
+                    INNER JOIN ' . prefixTable('nested_tree').' as f ON (i.id_tree=f.id)
5483 5482
                     WHERE i.id=%i',
5484 5483
                     $item_id
5485 5484
                 );
@@ -5501,7 +5500,7 @@  discard block
 block discarded – undo
5501 5500
 
5502 5501
                 // get data about new folder
5503 5502
                 $dataDestination = DB::queryfirstrow(
5504
-                    'SELECT personal_folder, title FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
5503
+                    'SELECT personal_folder, title FROM '.prefixTable('nested_tree').' WHERE id = %i',
5505 5504
                     $inputData['folderId']
5506 5505
                 );
5507 5506
 
@@ -5543,7 +5542,7 @@  discard block
 block discarded – undo
5543 5542
                     // Get fields for this Item
5544 5543
                     $rows = DB::query(
5545 5544
                         'SELECT id
5546
-                        FROM ' . prefixTable('categories_items') . '
5545
+                        FROM ' . prefixTable('categories_items').'
5547 5546
                         WHERE item_id = %i',
5548 5547
                         $item_id
5549 5548
                     );
@@ -5560,7 +5559,7 @@  discard block
 block discarded – undo
5560 5559
                     // Get FILES for this Item
5561 5560
                     $rows = DB::query(
5562 5561
                         'SELECT id
5563
-                        FROM ' . prefixTable('files') . '
5562
+                        FROM ' . prefixTable('files').'
5564 5563
                         WHERE id_item = %i',
5565 5564
                         $item_id
5566 5565
                     );
@@ -5615,7 +5614,7 @@  discard block
 block discarded – undo
5615 5614
                     // Get the ITEM object key for the user
5616 5615
                     $userKey = DB::queryFirstRow(
5617 5616
                         'SELECT share_key
5618
-                        FROM ' . prefixTable('sharekeys_items') . '
5617
+                        FROM ' . prefixTable('sharekeys_items').'
5619 5618
                         WHERE user_id = %i AND object_id = %i',
5620 5619
                         $session->get('user-id'),
5621 5620
                         $item_id
@@ -5626,7 +5625,7 @@  discard block
 block discarded – undo
5626 5625
                         // This is a public object
5627 5626
                         $users = DB::query(
5628 5627
                             'SELECT id, public_key
5629
-                            FROM ' . prefixTable('users') . '
5628
+                            FROM ' . prefixTable('users').'
5630 5629
                             WHERE id NOT IN %li
5631 5630
                             AND public_key != ""',
5632 5631
                             $tpUsersIDs
@@ -5649,14 +5648,14 @@  discard block
 block discarded – undo
5649 5648
                     // Get fields for this Item
5650 5649
                     $rows = DB::query(
5651 5650
                         'SELECT id
5652
-                        FROM ' . prefixTable('categories_items') . '
5651
+                        FROM ' . prefixTable('categories_items').'
5653 5652
                         WHERE item_id = %i',
5654 5653
                         $item_id
5655 5654
                     );
5656 5655
                     foreach ($rows as $field) {
5657 5656
                         $userKey = DB::queryFirstRow(
5658 5657
                             'SELECT share_key
5659
-                            FROM ' . prefixTable('sharekeys_fields') . '
5658
+                            FROM ' . prefixTable('sharekeys_fields').'
5660 5659
                             WHERE user_id = %i AND object_id = %i',
5661 5660
                             $session->get('user-id'),
5662 5661
                             $field['id']
@@ -5667,7 +5666,7 @@  discard block
 block discarded – undo
5667 5666
                             // This is a public object
5668 5667
                             $users = DB::query(
5669 5668
                                 'SELECT id, public_key
5670
-                                FROM ' . prefixTable('users') . '
5669
+                                FROM ' . prefixTable('users').'
5671 5670
                                 WHERE id NOT IN %li
5672 5671
                                 AND public_key != ""',
5673 5672
                                 $tpUsersIDs
@@ -5691,14 +5690,14 @@  discard block
 block discarded – undo
5691 5690
                     // Get FILES for this Item
5692 5691
                     $rows = DB::query(
5693 5692
                         'SELECT id
5694
-                        FROM ' . prefixTable('files') . '
5693
+                        FROM ' . prefixTable('files').'
5695 5694
                         WHERE id_item = %i',
5696 5695
                         $item_id
5697 5696
                     );
5698 5697
                     foreach ($rows as $attachment) {
5699 5698
                         $userKey = DB::queryFirstRow(
5700 5699
                             'SELECT share_key
5701
-                            FROM ' . prefixTable('sharekeys_files') . '
5700
+                            FROM ' . prefixTable('sharekeys_files').'
5702 5701
                             WHERE user_id = %i AND object_id = %i',
5703 5702
                             $session->get('user-id'),
5704 5703
                             $attachment['id']
@@ -5709,7 +5708,7 @@  discard block
 block discarded – undo
5709 5708
                             // This is a public object
5710 5709
                             $users = DB::query(
5711 5710
                                 'SELECT id, public_key
5712
-                                FROM ' . prefixTable('users') . '
5711
+                                FROM ' . prefixTable('users').'
5713 5712
                                 WHERE id NOT IN %li
5714 5713
                                 AND public_key != ""',
5715 5714
                                 $tpUsersIDs
@@ -5749,13 +5748,13 @@  discard block
 block discarded – undo
5749 5748
                     $session->get('user-id'),
5750 5749
                     'at_modification',
5751 5750
                     $session->get('user-login'),
5752
-                    'at_moved : ' . $dataSource['title'] . ' -> ' . $dataDestination['title']
5751
+                    'at_moved : '.$dataSource['title'].' -> '.$dataDestination['title']
5753 5752
                 );
5754 5753
             }
5755 5754
         }
5756 5755
 
5757 5756
         // reload cache table
5758
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
5757
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
5759 5758
         updateCacheTable('reload', null);
5760 5759
 
5761 5760
         echo (string) prepareExchangedData(
@@ -5819,7 +5818,7 @@  discard block
 block discarded – undo
5819 5818
                 // get info
5820 5819
                 $dataSource = DB::queryfirstrow(
5821 5820
                     'SELECT label, id_tree
5822
-                    FROM ' . prefixTable('items') . '
5821
+                    FROM ' . prefixTable('items').'
5823 5822
                     WHERE id=%i',
5824 5823
                     $item_id
5825 5824
                 );
@@ -5920,14 +5919,14 @@  discard block
 block discarded – undo
5920 5919
             // Variables
5921 5920
             $dataAuthor = DB::queryfirstrow(
5922 5921
                 'SELECT email,login
5923
-                FROM ' . prefixTable('users') . '
5922
+                FROM ' . prefixTable('users').'
5924 5923
                 WHERE id = %i',
5925 5924
                 $post_content[1]
5926 5925
             );
5927 5926
 
5928 5927
             $dataItem = DB::queryfirstrow(
5929 5928
                 'SELECT label, id_tree
5930
-                FROM ' . prefixTable('items') . '
5929
+                FROM ' . prefixTable('items').'
5931 5930
                 WHERE id = %i',
5932 5931
                 $post_content[0]
5933 5932
             );
@@ -5944,7 +5943,7 @@  discard block
 block discarded – undo
5944 5943
                 $lang->get('email_request_access_subject'),
5945 5944
                 str_replace(
5946 5945
                     array('#tp_item_author#', '#tp_user#', '#tp_item#'),
5947
-                    array(' ' . addslashes($dataAuthor['login']), addslashes($session->get('user-login')), $path),
5946
+                    array(' '.addslashes($dataAuthor['login']), addslashes($session->get('user-login')), $path),
5948 5947
                     $lang->get('email_request_access_mail')
5949 5948
                 ),
5950 5949
                 $dataAuthor['email'],
@@ -5953,7 +5952,7 @@  discard block
 block discarded – undo
5953 5952
         } elseif ($inputData['cat'] === 'share_this_item') {
5954 5953
             $dataItem = DB::queryfirstrow(
5955 5954
                 'SELECT label,id_tree
5956
-                FROM ' . prefixTable('items') . '
5955
+                FROM ' . prefixTable('items').'
5957 5956
                 WHERE id= %i',
5958 5957
                 $inputData['id']
5959 5958
             );
@@ -5976,7 +5975,7 @@  discard block
 block discarded – undo
5976 5975
                     ),
5977 5976
                     array(
5978 5977
                         empty($SETTINGS['email_server_url']) === false ?
5979
-                            $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'],
5978
+                            $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'],
5980 5979
                         addslashes($session->get('user-login')),
5981 5980
                         addslashes($path),
5982 5981
                     ),
@@ -6025,8 +6024,8 @@  discard block
 block discarded – undo
6025 6024
         // Get all informations for this item
6026 6025
         $dataItem = DB::queryfirstrow(
6027 6026
             'SELECT *
6028
-            FROM ' . prefixTable('items') . ' as i
6029
-            INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
6027
+            FROM ' . prefixTable('items').' as i
6028
+            INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
6030 6029
             WHERE i.id=%i AND l.action = %s',
6031 6030
             $item_id,
6032 6031
             'at_creation'
@@ -6055,18 +6054,18 @@  discard block
 block discarded – undo
6055 6054
                 $session->get('user-login'),
6056 6055
                 htmlspecialchars_decode($label, ENT_QUOTES),
6057 6056
                 null,
6058
-                (string) dateToStamp($date.' '.$time, $SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'])
6057
+                (string) dateToStamp($date.' '.$time, $SETTINGS['date_format'].' '.$SETTINGS['time_format'])
6059 6058
             );
6060 6059
             // Prepare new line
6061 6060
             $data = DB::queryfirstrow(
6062
-                'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i ORDER BY date DESC',
6061
+                'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i ORDER BY date DESC',
6063 6062
                 $item_id
6064 6063
             );
6065
-            $historic = date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $data['date']) . ' - ' . $session->get('user-login') . ' - ' . $lang->get($data['action']) . ' - ' . $data['raison'];
6064
+            $historic = date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $data['date']).' - '.$session->get('user-login').' - '.$lang->get($data['action']).' - '.$data['raison'];
6066 6065
             // send back
6067 6066
             $data = array(
6068 6067
                 'error' => '',
6069
-                'new_line' => '<br>' . addslashes($historic),
6068
+                'new_line' => '<br>'.addslashes($historic),
6070 6069
             );
6071 6070
             echo (string) prepareExchangedData(
6072 6071
                 $data,
@@ -6141,8 +6140,8 @@  discard block
 block discarded – undo
6141 6140
         // Should we log a password change?
6142 6141
         $itemQ = DB::queryFirstRow(
6143 6142
             'SELECT s.share_key, i.pw
6144
-            FROM ' . prefixTable('items') . ' AS i
6145
-            INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (i.id = s.object_id)
6143
+            FROM ' . prefixTable('items').' AS i
6144
+            INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (i.id = s.object_id)
6146 6145
             WHERE s.user_id = %i AND s.object_id = %i',
6147 6146
             $session->get('user-id'),
6148 6147
             $dataReceived['id']
@@ -6197,7 +6196,7 @@  discard block
 block discarded – undo
6197 6196
         if (isset($SETTINGS['otv_expiration_period']) === false) {
6198 6197
             $SETTINGS['otv_expiration_period'] = 7;
6199 6198
         }
6200
-        $url = $SETTINGS['cpassman_url'] . '/index.php?' . http_build_query($otv_session);
6199
+        $url = $SETTINGS['cpassman_url'].'/index.php?'.http_build_query($otv_session);
6201 6200
 
6202 6201
         echo json_encode(
6203 6202
             array(
@@ -6228,7 +6227,7 @@  discard block
 block discarded – undo
6228 6227
         // get parameters from original link
6229 6228
         $url = $dataReceived['original_link'];
6230 6229
         $parts = parse_url($url);
6231
-        if(isset($parts['query'])){
6230
+        if (isset($parts['query'])) {
6232 6231
             parse_str($parts['query'], $orignal_link_parameters);
6233 6232
         } else {
6234 6233
             $orignal_link_parameters = array();
@@ -6259,13 +6258,13 @@  discard block
 block discarded – undo
6259 6258
             $domain_scheme = parse_url($SETTINGS['cpassman_url'], PHP_URL_SCHEME);
6260 6259
             $domain_host = parse_url($SETTINGS['cpassman_url'], PHP_URL_HOST);
6261 6260
             if (str_contains($domain_host, 'www.') === true) {
6262
-                $domain_host = (string) $SETTINGS['otv_subdomain'] . '.' . substr($domain_host, 4);
6261
+                $domain_host = (string) $SETTINGS['otv_subdomain'].'.'.substr($domain_host, 4);
6263 6262
             } else {
6264
-                $domain_host = (string) $SETTINGS['otv_subdomain'] . '.' . $domain_host;
6263
+                $domain_host = (string) $SETTINGS['otv_subdomain'].'.'.$domain_host;
6265 6264
             }
6266
-            $url = $domain_scheme.'://'.$domain_host . '/index.php?'.http_build_query($otv_session);
6265
+            $url = $domain_scheme.'://'.$domain_host.'/index.php?'.http_build_query($otv_session);
6267 6266
         } else {
6268
-            $url = $SETTINGS['cpassman_url'] . '/index.php?'.http_build_query($otv_session);
6267
+            $url = $SETTINGS['cpassman_url'].'/index.php?'.http_build_query($otv_session);
6269 6268
         }
6270 6269
 
6271 6270
         echo (string) prepareExchangedData(
@@ -6300,8 +6299,8 @@  discard block
 block discarded – undo
6300 6299
             'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status,
6301 6300
             f.extension AS extension, f.type AS type,
6302 6301
             s.share_key AS share_key
6303
-            FROM ' . prefixTable('files') . ' AS f
6304
-            INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id)
6302
+            FROM ' . prefixTable('files').' AS f
6303
+            INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id)
6305 6304
             WHERE s.user_id = %i AND s.object_id = %i',
6306 6305
             $session->get('user-id'),
6307 6306
             $inputData['id']
@@ -6322,7 +6321,7 @@  discard block
 block discarded – undo
6322 6321
         //$fileName = basename($file_info['name'], '.'.$file_info['extension']);
6323 6322
 
6324 6323
         // prepare image info
6325
-        $post_title = basename($file_info['name'], '.' . $file_info['extension']);
6324
+        $post_title = basename($file_info['name'], '.'.$file_info['extension']);
6326 6325
         $post_title = isBase64($post_title) === true ? base64_decode($post_title) : $post_title;
6327 6326
         
6328 6327
         // Get image content
@@ -6349,7 +6348,7 @@  discard block
 block discarded – undo
6349 6348
         echo (string) prepareExchangedData(
6350 6349
             array(
6351 6350
                 'error' => false,
6352
-                'filename' => $post_title . '.' . $file_info['extension'],
6351
+                'filename' => $post_title.'.'.$file_info['extension'],
6353 6352
                 'file_type' => $file_info['type'],
6354 6353
                 'file_content' => $fileContent,
6355 6354
             ),
@@ -6463,7 +6462,7 @@  discard block
 block discarded – undo
6463 6462
                     $arbo = $tree->getPath($folder->id, false);
6464 6463
                     $path = '';
6465 6464
                     foreach ($arbo as $elem) {
6466
-                        $path = (empty($path) ? '' : $path . ' / ') . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
6465
+                        $path = (empty($path) ? '' : $path.' / ').htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
6467 6466
                     }
6468 6467
 
6469 6468
                     // Build array
@@ -6532,7 +6531,7 @@  discard block
 block discarded – undo
6532 6531
         if (is_array($foldersArray) === true && $inputData['data'] !== '[null]') {
6533 6532
             $rows = DB::query(
6534 6533
                 'SELECT id, categories
6535
-                FROM ' . prefixTable('nested_tree') . '
6534
+                FROM ' . prefixTable('nested_tree').'
6536 6535
                 WHERE id IN (%l)',
6537 6536
                 implode(',', $foldersArray)
6538 6537
             );
@@ -6574,7 +6573,7 @@  discard block
 block discarded – undo
6574 6573
         // get item info
6575 6574
         $dataItem = DB::queryFirstRow(
6576 6575
             'SELECT *
6577
-            FROM ' . prefixTable('items') . '
6576
+            FROM ' . prefixTable('items').'
6578 6577
             WHERE id=%i',
6579 6578
             $inputData['itemId']
6580 6579
         );
@@ -6586,8 +6585,8 @@  discard block
 block discarded – undo
6586 6585
             'SELECT l.date as date, l.action as action, l.raison as raison,
6587 6586
                 u.login as login, u.avatar_thumb as avatar_thumb, u.name as name, u.lastname as lastname,
6588 6587
                 l.old_value as old_value
6589
-            FROM ' . prefixTable('log_items') . ' as l
6590
-            INNER JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id)
6588
+            FROM ' . prefixTable('log_items').' as l
6589
+            INNER JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id)
6591 6590
             WHERE id_item=%i AND l.action NOT IN (%l)
6592 6591
             ORDER BY date DESC',
6593 6592
             $inputData['itemId'],
@@ -6602,18 +6601,18 @@  discard block
 block discarded – undo
6602 6601
             
6603 6602
             // imported via API
6604 6603
             if (empty($record['login']) === true) {
6605
-                $record['login'] = $lang->get('imported_via_api') . ' [' . $record['raison'] . ']';
6604
+                $record['login'] = $lang->get('imported_via_api').' ['.$record['raison'].']';
6606 6605
             }
6607 6606
             
6608 6607
             // Prepare avatar
6609 6608
             if (isset($record['avatar_thumb']) && empty($record['avatar_thumb']) === false) {
6610
-                if (file_exists($SETTINGS['cpassman_dir'] . '/includes/avatars/' . $record['avatar_thumb'])) {
6611
-                    $avatar = $SETTINGS['cpassman_url'] . '/includes/avatars/' . $record['avatar_thumb'];
6609
+                if (file_exists($SETTINGS['cpassman_dir'].'/includes/avatars/'.$record['avatar_thumb'])) {
6610
+                    $avatar = $SETTINGS['cpassman_url'].'/includes/avatars/'.$record['avatar_thumb'];
6612 6611
                 } else {
6613
-                    $avatar = $SETTINGS['cpassman_url'] . '/includes/images/photo.jpg';
6612
+                    $avatar = $SETTINGS['cpassman_url'].'/includes/images/photo.jpg';
6614 6613
                 }
6615 6614
             } else {
6616
-                $avatar = $SETTINGS['cpassman_url'] . '/includes/images/photo.jpg';
6615
+                $avatar = $SETTINGS['cpassman_url'].'/includes/images/photo.jpg';
6617 6616
             }
6618 6617
 
6619 6618
             // Prepare action
@@ -6633,7 +6632,7 @@  discard block
 block discarded – undo
6633 6632
                         $previous_passwords, 
6634 6633
                         [
6635 6634
                             'password' => htmlentities($previous_pwd['string']),
6636
-                            'date' => date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']),
6635
+                            'date' => date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']),
6637 6636
                         ]
6638 6637
                     );
6639 6638
                 }
@@ -6646,19 +6645,19 @@  discard block
 block discarded – undo
6646 6645
                 $action = $lang->get($reason[0]);
6647 6646
                 if ($reason[0] === 'at_moved') {
6648 6647
                     $tmp = explode(' -> ', $reason[1]);
6649
-                    $detail = $lang->get('from') . ' <span class="font-weight-light">' . $tmp[0] . '</span> ' . $lang->get('to') . ' <span class="font-weight-light">' . $tmp[1] . ' </span>';
6648
+                    $detail = $lang->get('from').' <span class="font-weight-light">'.$tmp[0].'</span> '.$lang->get('to').' <span class="font-weight-light">'.$tmp[1].' </span>';
6650 6649
                 } elseif ($reason[0] === 'at_field') {
6651 6650
                     $tmp = explode(' => ', $reason[1]);
6652 6651
                     if (count($tmp) > 1) {
6653
-                        $detail = '<b>' . trim($tmp[0]) . '</b> | ' . $lang->get('previous_value') .
6654
-                            ': <span class="font-weight-light">' . trim($tmp[1]) . '</span>';
6652
+                        $detail = '<b>'.trim($tmp[0]).'</b> | '.$lang->get('previous_value').
6653
+                            ': <span class="font-weight-light">'.trim($tmp[1]).'</span>';
6655 6654
                     } else {
6656 6655
                         $detail = trim($reason[1]);
6657 6656
                     }
6658 6657
                 } elseif (in_array($reason[0], array('at_restriction', 'at_email', 'at_login', 'at_label', 'at_url', 'at_tag')) === true) {
6659 6658
                     $tmp = explode(' => ', $reason[1]);
6660 6659
                     $detail = empty(trim($tmp[0])) === true ?
6661
-                        $lang->get('no_previous_value') : $lang->get('previous_value') . ': <span class="font-weight-light">' . $tmp[0] . ' </span>';
6660
+                        $lang->get('no_previous_value') : $lang->get('previous_value').': <span class="font-weight-light">'.$tmp[0].' </span>';
6662 6661
                 } elseif ($reason[0] === 'at_automatic_del') {
6663 6662
                     $detail = $lang->get($reason[1]);
6664 6663
                 } elseif ($reason[0] === 'at_anyoneconmodify' || $reason[0] === 'at_otp_status') {
@@ -6667,7 +6666,7 @@  discard block
 block discarded – undo
6667 6666
                     $tmp = explode(':', $reason[1]);
6668 6667
                     $tmp = explode('.', $tmp[0]);
6669 6668
                     $detail = isBase64($tmp[0]) === true ?
6670
-                        base64_decode($tmp[0]) . '.' . $tmp[1] : $tmp[0];
6669
+                        base64_decode($tmp[0]).'.'.$tmp[1] : $tmp[0];
6671 6670
                 } elseif ($reason[0] === 'at_import') {
6672 6671
                     $detail = '';
6673 6672
                 } elseif (in_array($reason[0], array('csv', 'pdf')) === true) {
@@ -6686,8 +6685,8 @@  discard block
 block discarded – undo
6686 6685
                 array(
6687 6686
                     'avatar' => $avatar,
6688 6687
                     'login' => $record['login'],
6689
-                    'name' => $record['name'] . ' ' . $record['lastname'],
6690
-                    'date' => date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']),
6688
+                    'name' => $record['name'].' '.$record['lastname'],
6689
+                    'date' => date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']),
6691 6690
                     'action' => $action,
6692 6691
                     'detail' => $detail,
6693 6692
                 )
@@ -6775,11 +6774,11 @@  discard block
 block discarded – undo
6775 6774
 
6776 6775
         // get some info to add to the notification email
6777 6776
         $resp_user = DB::queryfirstrow(
6778
-            'SELECT login FROM ' . prefixTable('users') . ' WHERE id = %i',
6777
+            'SELECT login FROM '.prefixTable('users').' WHERE id = %i',
6779 6778
             $session->get('user-id')
6780 6779
         );
6781 6780
         $resp_folder = DB::queryfirstrow(
6782
-            'SELECT title FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
6781
+            'SELECT title FROM '.prefixTable('nested_tree').' WHERE id = %i',
6783 6782
             $folder
6784 6783
         );
6785 6784
 
@@ -6788,7 +6787,7 @@  discard block
 block discarded – undo
6788 6787
         $emailService = new EmailService();
6789 6788
         $rows = DB::query(
6790 6789
             'SELECT email
6791
-            FROM ' . prefixTable('users') . '
6790
+            FROM ' . prefixTable('users').'
6792 6791
             WHERE `gestionnaire` = %i AND `email` IS NOT NULL',
6793 6792
             1
6794 6793
         );
@@ -6834,7 +6833,7 @@  discard block
 block discarded – undo
6834 6833
         // Send email
6835 6834
         $dataItem = DB::queryfirstrow(
6836 6835
             'SELECT label, id_tree
6837
-            FROM ' . prefixTable('items') . '
6836
+            FROM ' . prefixTable('items').'
6838 6837
             WHERE id = %i',
6839 6838
             $inputData['itemId']
6840 6839
         );
@@ -6888,7 +6887,7 @@  discard block
 block discarded – undo
6888 6887
 
6889 6888
         DB::query(
6890 6889
             'SELECT *
6891
-            FROM ' . prefixTable('notification') . '
6890
+            FROM ' . prefixTable('notification').'
6892 6891
             WHERE item_id = %i AND user_id = %i',
6893 6892
             $inputData['itemId'],
6894 6893
             $session->get('user-id')
@@ -6960,7 +6959,7 @@  discard block
 block discarded – undo
6960 6959
         // And related logs
6961 6960
         $rows = DB::query(
6962 6961
             'SELECT id, file AS filename
6963
-            FROM ' . prefixTable('files') . '
6962
+            FROM ' . prefixTable('files').'
6964 6963
             WHERE id_item = %i AND confirmed = %i',
6965 6964
             $inputData['itemId'],
6966 6965
             0
@@ -6974,12 +6973,12 @@  discard block
 block discarded – undo
6974 6973
             );
6975 6974
 
6976 6975
             // Delete file on server
6977
-            unlink($SETTINGS['path_to_upload_folder'] . '/' . TP_FILE_PREFIX . base64_decode($file['filename']));
6976
+            unlink($SETTINGS['path_to_upload_folder'].'/'.TP_FILE_PREFIX.base64_decode($file['filename']));
6978 6977
 
6979 6978
             // Delete related logs
6980 6979
             $logFile = DB::query(
6981 6980
                 'SELECT increment_id, raison
6982
-                FROM ' . prefixTable('log_items') . '
6981
+                FROM ' . prefixTable('log_items').'
6983 6982
                 WHERE id_item = %i AND id_user = %i AND action = %s AND raison LIKE "at_add_file :%"',
6984 6983
                 $inputData['itemId'],
6985 6984
                 $session->get('user-id'),
@@ -7038,7 +7037,7 @@  discard block
 block discarded – undo
7038 7037
         // Confirm attachments
7039 7038
         $rows = DB::query(
7040 7039
             'SELECT id, file AS filename
7041
-            FROM ' . prefixTable('files') . '
7040
+            FROM ' . prefixTable('files').'
7042 7041
             WHERE id_item = %i AND confirmed = %i',
7043 7042
             $inputData['itemId'],
7044 7043
             0
@@ -7124,15 +7123,15 @@  discard block
 block discarded – undo
7124 7123
         case 'autocomplete_tags':
7125 7124
             // Get a list off all existing TAGS
7126 7125
             $listOfTags = '';
7127
-            $rows = DB::query('SELECT tag FROM ' . prefixTable('tags') . ' WHERE tag LIKE %ss GROUP BY tag', $inputData['getTerm']);
7126
+            $rows = DB::query('SELECT tag FROM '.prefixTable('tags').' WHERE tag LIKE %ss GROUP BY tag', $inputData['getTerm']);
7128 7127
             foreach ($rows as $record) {
7129 7128
                 if (empty($listOfTags)) {
7130
-                    $listOfTags = '"' . $record['tag'] . '"';
7129
+                    $listOfTags = '"'.$record['tag'].'"';
7131 7130
                 } else {
7132
-                    $listOfTags .= ', "' . $record['tag'] . '"';
7131
+                    $listOfTags .= ', "'.$record['tag'].'"';
7133 7132
                 }
7134 7133
             }
7135
-            echo '[' . $listOfTags . ']';
7134
+            echo '['.$listOfTags.']';
7136 7135
             break;
7137 7136
     }
7138 7137
 }
@@ -7148,7 +7147,7 @@  discard block
 block discarded – undo
7148 7147
 {
7149 7148
     $data = DB::queryFirstRow(
7150 7149
         'SELECT bloquer_creation, bloquer_modification, personal_folder
7151
-        FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
7150
+        FROM ' . prefixTable('nested_tree').' WHERE id = %i',
7152 7151
         $groupe
7153 7152
     );
7154 7153
     // Check if it's in a personal folder. If yes, then force complexity overhead.
@@ -7252,7 +7251,7 @@  discard block
 block discarded – undo
7252 7251
     global $SETTINGS;
7253 7252
 
7254 7253
     // Retrieve the current lock information for the item
7255
-    $itemLockInfo = DB::queryFirstRow('SELECT timestamp, user_id FROM ' . prefixTable('items_edition') . ' WHERE item_id = %i', $itemId);
7254
+    $itemLockInfo = DB::queryFirstRow('SELECT timestamp, user_id FROM '.prefixTable('items_edition').' WHERE item_id = %i', $itemId);
7256 7255
 
7257 7256
     // Check if the item is locked by another user
7258 7257
     if ($itemLockInfo && $itemLockInfo['user_id'] !== $userId) {
@@ -7271,7 +7270,7 @@  discard block
 block discarded – undo
7271 7270
     
7272 7271
     // Check if there's an ongoing background encryption process for the item
7273 7272
     $ongoingProcess = DB::queryFirstRow(
7274
-        'SELECT 1 FROM ' . prefixTable('background_tasks') . ' WHERE item_id = %i AND finished_at = "" LIMIT 1', 
7273
+        'SELECT 1 FROM '.prefixTable('background_tasks').' WHERE item_id = %i AND finished_at = "" LIMIT 1', 
7275 7274
         $itemId
7276 7275
     );
7277 7276
 
@@ -7289,7 +7288,7 @@  discard block
 block discarded – undo
7289 7288
 function getUserVisibleFolders(int $userId): array
7290 7289
 {
7291 7290
     // Query to retrieve visible folders for the user
7292
-    $data = DB::queryFirstRow('SELECT visible_folders FROM ' . prefixTable('cache_tree') . ' WHERE user_id = %i', $userId);
7291
+    $data = DB::queryFirstRow('SELECT visible_folders FROM '.prefixTable('cache_tree').' WHERE user_id = %i', $userId);
7293 7292
     
7294 7293
     // Decode JSON data into an array; return an empty array if the data is invalid
7295 7294
     return json_decode($data['visible_folders'], true) ?? [];
@@ -7313,7 +7312,7 @@  discard block
 block discarded – undo
7313 7312
 
7314 7313
     // Query the access rights for the given roles and folder
7315 7314
     $accessTypes = DB::queryFirstColumn(
7316
-        'SELECT type FROM ' . prefixTable('roles_values') . ' WHERE role_id IN %ls AND folder_id = %i', 
7315
+        'SELECT type FROM '.prefixTable('roles_values').' WHERE role_id IN %ls AND folder_id = %i', 
7317 7316
         $roles, 
7318 7317
         $treeId
7319 7318
     );
Please login to merge, or discard this patch.
Braces   +21 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1223,7 +1223,9 @@  discard block
 block discarded – undo
1223 1223
                 );
1224 1224
 
1225 1225
                 // Create a task to create sharekeys for users
1226
-                if (WIP=== true) error_log('createTaskForItem - new password for this item - '.$post_password ." -- ". $pw);
1226
+                if (WIP=== true) {
1227
+                    error_log('createTaskForItem - new password for this item - '.$post_password ." -- ". $pw);
1228
+                }
1227 1229
                 $tasksToBePerformed = ['item_password'];
1228 1230
                 $encryptionTaskIsRequested = true;
1229 1231
             } else {
@@ -1539,7 +1541,9 @@  discard block
 block discarded – undo
1539 1541
 
1540 1542
             // create a task for all fields updated
1541 1543
             if ($encryptionTaskIsRequested === true) {
1542
-                if (WIP === true) error_log('createTaskForItem - '.print_r($tasksToBePerformed, true));
1544
+                if (WIP === true) {
1545
+                    error_log('createTaskForItem - '.print_r($tasksToBePerformed, true));
1546
+                }
1543 1547
                 createTaskForItem(
1544 1548
                     'item_update_create_keys',
1545 1549
                     $tasksToBePerformed,
@@ -2046,7 +2050,9 @@  discard block
 block discarded – undo
2046 2050
                 $inputData['itemId']
2047 2051
             );
2048 2052
             foreach ($rows as $record) {
2049
-                if ($record['raison'] === NULL) continue;
2053
+                if ($record['raison'] === NULL) {
2054
+                    continue;
2055
+                }
2050 2056
                 $reason = explode(':', $record['raison']);
2051 2057
                 if (count($reason) > 0) {
2052 2058
                     $sentence = date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) . ' - '
@@ -4559,7 +4565,9 @@  discard block
 block discarded – undo
4559 4565
                 $inputData['itemId']
4560 4566
             );
4561 4567
             
4562
-            if (WIP === true) error_log('Existing edition locks: '.DB::count());
4568
+            if (WIP === true) {
4569
+                error_log('Existing edition locks: '.DB::count());
4570
+            }
4563 4571
 
4564 4572
             // Check if item has no edition lock
4565 4573
             if ((int) DB::count() > 0 ) {
@@ -4572,7 +4580,9 @@  discard block
 block discarded – undo
4572 4580
                 } else {
4573 4581
                     $delay = EDITION_LOCK_PERIOD; // One day delay
4574 4582
                 }
4575
-                if (WIP === true) error_log('delay: ' . $delay);
4583
+                if (WIP === true) {
4584
+                    error_log('delay: ' . $delay);
4585
+                }
4576 4586
 
4577 4587
                 // We remove old edition locks if delay is expired meaning more than 1 day long
4578 4588
                 if (round(abs(time() - $dataTmp['timestamp']),0) > $delay) {
@@ -4580,7 +4590,9 @@  discard block
 block discarded – undo
4580 4590
                     // In this case, delete edition lock and possible ongoing processes
4581 4591
                     // and continue editing this time
4582 4592
                     // We coonsidere if the most recent item is still locked then all other locks can be removed
4583
-                    if (WIP === true)  error_log('Delay is expired, removing old locks');
4593
+                    if (WIP === true) {
4594
+                        error_log('Delay is expired, removing old locks');
4595
+                    }
4584 4596
                     foreach ($dataItemEditionLocks as $itemEditionLock) {
4585 4597
                         // delete lock
4586 4598
                         DB::delete(
@@ -4847,8 +4859,9 @@  discard block
 block discarded – undo
4847 4859
                 $ids = $tree->getDescendants($folder['id'], true, false, true);
4848 4860
 
4849 4861
                 // This folder is owned by user
4850
-                if (in_array($inputData['folderId'], $ids))
4851
-                    $accessLevel = 30;
4862
+                if (in_array($inputData['folderId'], $ids)) {
4863
+                                    $accessLevel = 30;
4864
+                }
4852 4865
             }
4853 4866
         }
4854 4867
 
Please login to merge, or discard this patch.
self-unlock.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 use Symfony\Component\HttpFoundation\Request as SymfonyRequest;
34 34
 
35 35
 // Load functions
36
-require_once __DIR__. '/includes/config/include.php';
36
+require_once __DIR__.'/includes/config/include.php';
37 37
 require_once __DIR__.'/sources/main.functions.php';
38 38
 
39 39
 // init
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
 // Check for existing lock
54 54
 $result = DB::queryFirstField(
55 55
     'SELECT 1
56
-     FROM ' . prefixTable('auth_failures') . '
56
+     FROM ' . prefixTable('auth_failures').'
57 57
      WHERE unlock_at = (
58 58
         SELECT MAX(unlock_at)
59
-        FROM ' . prefixTable('auth_failures') . '
59
+        FROM ' . prefixTable('auth_failures').'
60 60
         WHERE unlock_at > %s
61 61
         AND source = %s AND value = %s)
62 62
      AND unlock_code = %s',
Please login to merge, or discard this patch.
sources/identify.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2663,7 +2663,7 @@
 block discarded – undo
2663 2663
             'SELECT email, name
2664 2664
              FROM '.prefixTable('users').'
2665 2665
              WHERE login = %s',
2666
-             $value
2666
+                $value
2667 2667
         );
2668 2668
 
2669 2669
         // No valid email address for user
Please login to merge, or discard this patch.
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2401,7 +2401,9 @@  discard block
 block discarded – undo
2401 2401
         // Complete $userInfo
2402 2402
         $userInfo['has_been_created'] = 1;
2403 2403
 
2404
-        if (WIP === true) error_log("--- USER CREATED ---");
2404
+        if (WIP === true) {
2405
+            error_log("--- USER CREATED ---");
2406
+        }
2405 2407
 
2406 2408
         return [
2407 2409
             'error' => false,
@@ -2437,7 +2439,9 @@  discard block
 block discarded – undo
2437 2439
         }
2438 2440
 
2439 2441
         // Oauth2 user already exists and authenticated
2440
-        if (WIP === true) error_log("--- USER AUTHENTICATED ---");
2442
+        if (WIP === true) {
2443
+            error_log("--- USER AUTHENTICATED ---");
2444
+        }
2441 2445
         $userInfo['has_been_created'] = 0;
2442 2446
 
2443 2447
         $passwordManager = new PasswordManager();
@@ -2667,8 +2671,9 @@  discard block
 block discarded – undo
2667 2671
         );
2668 2672
 
2669 2673
         // No valid email address for user
2670
-        if (!$userInfos || !filter_var($userInfos['email'], FILTER_VALIDATE_EMAIL))
2671
-            return;
2674
+        if (!$userInfos || !filter_var($userInfos['email'], FILTER_VALIDATE_EMAIL)) {
2675
+                    return;
2676
+        }
2672 2677
 
2673 2678
         $unlock_url = $SETTINGS['cpassman_url'].'/self-unlock.php?login='.$value.'&otp='.$unlock_code;
2674 2679
 
Please login to merge, or discard this patch.
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
     $sessionPwdAttempts = $session->get('pwd_attempts');
148 148
     $sessionUrl = $session->get('user-initial_url');
149 149
     $server = [];
150
-    $server['PHP_AUTH_USER'] =  $request->getUser();
150
+    $server['PHP_AUTH_USER'] = $request->getUser();
151 151
     $server['PHP_AUTH_PW'] = $request->getPassword();
152 152
     
153 153
     // decrypt and retreive data in JSON format
@@ -162,18 +162,18 @@  discard block
 block discarded – undo
162 162
     }
163 163
 
164 164
     // Check if Duo auth is in progress and pass the pw and login back to the standard login process
165
-    if(
165
+    if (
166 166
         isKeyExistingAndEqual('duo', 1, $SETTINGS) === true
167 167
         && $dataReceived['user_2fa_selection'] === 'duo'
168 168
         && $session->get('user-duo_status') === 'IN_PROGRESS'
169 169
         && !empty($dataReceived['duo_state'])
170
-    ){
170
+    ) {
171 171
         $key = hash('sha256', $dataReceived['duo_state']);
172 172
         $iv = substr(hash('sha256', $dataReceived['duo_state']), 0, 16);
173 173
         $duo_data_dec = openssl_decrypt(base64_decode($session->get('user-duo_data')), 'AES-256-CBC', $key, 0, $iv);
174 174
         // Clear the data from the Duo process to continue clean with the standard login process
175
-        $session->set('user-duo_data','');
176
-        if($duo_data_dec === false) {
175
+        $session->set('user-duo_data', '');
176
+        if ($duo_data_dec === false) {
177 177
             // Add failed authentication log
178 178
             addFailedAuthentication(filter_var($dataReceived['login'], FILTER_SANITIZE_FULL_SPECIAL_CHARS), getClientIpServer());
179 179
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
         $dataReceived['login'] = $duo_data['duo_login'];
192 192
     }
193 193
 
194
-    if(isset($dataReceived['pw']) === false || isset($dataReceived['login']) === false) {
194
+    if (isset($dataReceived['pw']) === false || isset($dataReceived['login']) === false) {
195 195
         echo json_encode([
196 196
             'data' => prepareExchangedData(
197 197
                 [
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
         }
537 537
         // Append with roles from AD groups
538 538
         if (is_null($userInfo['roles_from_ad_groups']) === false) {
539
-            $userInfo['fonction_id'] = empty($userInfo['fonction_id'])  === true ? $userInfo['roles_from_ad_groups'] : $userInfo['fonction_id']. ';' . $userInfo['roles_from_ad_groups'];
539
+            $userInfo['fonction_id'] = empty($userInfo['fonction_id']) === true ? $userInfo['roles_from_ad_groups'] : $userInfo['fonction_id'].';'.$userInfo['roles_from_ad_groups'];
540 540
         }
541 541
         // store
542 542
         $session->set('user-roles', $userInfo['fonction_id']);
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
         if (count($session->get('user-roles_array')) > 0) {
549 549
             $rolesList = DB::query(
550 550
                 'SELECT id, title, complexity
551
-                FROM ' . prefixTable('roles_title') . '
551
+                FROM ' . prefixTable('roles_title').'
552 552
                 WHERE id IN %li',
553 553
                 $session->get('user-roles_array')
554 554
             );
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
             if ($adjustPermissions) {
595 595
                 $session->set('user-admin', (int) $userInfo['admin']);
596 596
                 $session->set('user-manager', (int) $userInfo['gestionnaire']);
597
-                $session->set('user-can_manage_all_users',(int)  $userInfo['can_manage_all_users']);
597
+                $session->set('user-can_manage_all_users', (int) $userInfo['can_manage_all_users']);
598 598
                 $session->set('user-read_only', (int) $userInfo['read_only']);
599 599
                 DB::update(
600 600
                     prefixTable('users'),
@@ -665,10 +665,10 @@  discard block
 block discarded – undo
665 665
         $session->set('user-latest_items_tab', []);
666 666
         $session->set('user-nb_roles', 0);
667 667
         foreach ($session->get('user-latest_items') as $item) {
668
-            if (! empty($item)) {
668
+            if (!empty($item)) {
669 669
                 $dataLastItems = DB::queryFirstRow(
670 670
                     'SELECT id,label,id_tree
671
-                    FROM ' . prefixTable('items') . '
671
+                    FROM ' . prefixTable('items').'
672 672
                     WHERE id=%i',
673 673
                     $item
674 674
                 );
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
                     [
678 678
                         'id' => $item,
679 679
                         'label' => $dataLastItems['label'],
680
-                        'url' => 'index.php?page=items&amp;group=' . $dataLastItems['id_tree'] . '&amp;id=' . $item,
680
+                        'url' => 'index.php?page=items&amp;group='.$dataLastItems['id_tree'].'&amp;id='.$item,
681 681
                     ],
682 682
                     'add'
683 683
                 );
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
         // Get cahce tree info
688 688
         $cacheTreeData = DB::queryFirstRow(
689 689
             'SELECT visible_folders
690
-            FROM ' . prefixTable('cache_tree') . '
690
+            FROM ' . prefixTable('cache_tree').'
691 691
             WHERE user_id=%i',
692 692
             (int) $session->get('user-id')
693 693
         );
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
             && (int) $sessionAdmin !== 1
720 720
         ) {
721 721
             // get all Admin users
722
-            $val = DB::queryfirstrow('SELECT email FROM ' . prefixTable('users') . " WHERE admin = %i and email != ''", 1);
722
+            $val = DB::queryfirstrow('SELECT email FROM '.prefixTable('users')." WHERE admin = %i and email != ''", 1);
723 723
             if (DB::count() > 0) {
724 724
                 // Add email to table
725 725
                 prepareSendingEmail(
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
                             '#tp_time#',
732 732
                         ],
733 733
                         [
734
-                            ' ' . $session->get('user-login') . ' (IP: ' . getClientIpServer() . ')',
734
+                            ' '.$session->get('user-login').' (IP: '.getClientIpServer().')',
735 735
                             date($SETTINGS['date_format'], (int) $session->get('user-last_connection')),
736 736
                             date($SETTINGS['time_format'], (int) $session->get('user-last_connection')),
737 737
                         ],
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
 {
843 843
     $rows = DB::query(
844 844
         'SELECT date
845
-        FROM ' . prefixTable('log_system') . "
845
+        FROM ' . prefixTable('log_system')."
846 846
         WHERE field_1 = %s
847 847
         AND type = 'failed_auth'
848 848
         AND label = 'password_is_not_correct'
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
         foreach ($rows as $record) {
857 857
             array_push(
858 858
                 $arrAttempts,
859
-                date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date'])
859
+                date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date'])
860 860
             );
861 861
         }
862 862
     }
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
     $ldapConnection
892 892
 ) : bool
893 893
 {
894
-    include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
894
+    include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
895 895
 
896 896
     if ((int) $userInfoDisabled === 1) {
897 897
         return false;
@@ -1086,7 +1086,7 @@  discard block
 block discarded – undo
1086 1086
     } catch (Exception $e) {
1087 1087
         return [
1088 1088
             'error' => true,
1089
-            'message' => "Error: " . $e->getMessage(),
1089
+            'message' => "Error: ".$e->getMessage(),
1090 1090
         ];
1091 1091
     }
1092 1092
 }
@@ -1117,7 +1117,7 @@  discard block
 block discarded – undo
1117 1117
                 'type' => 'OpenLDAP'
1118 1118
             ];
1119 1119
         default:
1120
-            throw new Exception("Unsupported LDAP type: " . $SETTINGS['ldap_type']);
1120
+            throw new Exception("Unsupported LDAP type: ".$SETTINGS['ldap_type']);
1121 1121
     }
1122 1122
 }
1123 1123
 
@@ -1254,7 +1254,7 @@  discard block
 block discarded – undo
1254 1254
         );
1255 1255
     }
1256 1256
     
1257
-    throw new Exception("Unsupported LDAP type: " . $ldapHandler['type']);
1257
+    throw new Exception("Unsupported LDAP type: ".$ldapHandler['type']);
1258 1258
 }
1259 1259
 
1260 1260
 /**
@@ -1271,12 +1271,12 @@  discard block
 block discarded – undo
1271 1271
     if (isset($SETTINGS['enable_ad_users_with_ad_groups']) === true && (int) $SETTINGS['enable_ad_users_with_ad_groups'] === 1) {
1272 1272
         // Get user groups from AD
1273 1273
         $user_ad_groups = [];
1274
-        foreach($groups as $group) {
1274
+        foreach ($groups as $group) {
1275 1275
             //print_r($group);
1276 1276
             // get relation role id for AD group
1277 1277
             $role = DB::queryFirstRow(
1278 1278
                 'SELECT lgr.role_id
1279
-                FROM ' . prefixTable('ldap_groups_roles') . ' AS lgr
1279
+                FROM ' . prefixTable('ldap_groups_roles').' AS lgr
1280 1280
                 WHERE lgr.ldap_group_id = %s',
1281 1281
                 $group
1282 1282
             );
@@ -1421,7 +1421,7 @@  discard block
 block discarded – undo
1421 1421
     }
1422 1422
 
1423 1423
     // Now check yubico validity
1424
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/Yubico/Yubico.php';
1424
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/Yubico/Yubico.php';
1425 1425
     $yubi = new Auth_Yubico($yubico_user_id, $yubico_user_key);
1426 1426
     $auth = $yubi->verify($yubico_key);
1427 1427
     //, null, null, null, 60
@@ -1480,7 +1480,7 @@  discard block
 block discarded – undo
1480 1480
             // Check if exists in DB
1481 1481
             $groupData = DB::queryFirstRow(
1482 1482
                 'SELECT id
1483
-                FROM ' . prefixTable('roles_title') . '
1483
+                FROM ' . prefixTable('roles_title').'
1484 1484
                 WHERE title = %s',
1485 1485
                 $group["displayName"]
1486 1486
             );
@@ -1610,7 +1610,7 @@  discard block
 block discarded – undo
1610 1610
             
1611 1611
             // generate new QR
1612 1612
             $new_2fa_qr = $tfa->getQRCodeImageAsDataUri(
1613
-                'Teampass - ' . $username,
1613
+                'Teampass - '.$username,
1614 1614
                 $userInfo['ga']
1615 1615
             );
1616 1616
             // clear temporary code from DB
@@ -1623,7 +1623,7 @@  discard block
 block discarded – undo
1623 1623
                 $userInfo['id']
1624 1624
             );
1625 1625
             $firstTime = [
1626
-                'value' => '<img src="' . $new_2fa_qr . '">',
1626
+                'value' => '<img src="'.$new_2fa_qr.'">',
1627 1627
                 'user_admin' => isset($sessionAdmin) ? (int) $sessionAdmin : '',
1628 1628
                 'initial_url' => isset($sessionUrl) === true ? $sessionUrl : '',
1629 1629
                 'pwd_attempts' => (int) $sessionPwdAttempts,
@@ -1779,7 +1779,7 @@  discard block
 block discarded – undo
1779 1779
         }*/
1780 1780
         return [
1781 1781
             'error' => true,
1782
-            'message' => $duo_error . $lang->get('duo_error_check_config'),
1782
+            'message' => $duo_error.$lang->get('duo_error_check_config'),
1783 1783
             'pwd_attempts' => (int) $sessionPwdAttempts,
1784 1784
             'debug_message' => $e->getMessage(),
1785 1785
             'proceedIdentification' => false,
@@ -1795,7 +1795,7 @@  discard block
 block discarded – undo
1795 1795
         } catch (DuoException $e) {
1796 1796
             return [
1797 1797
                 'error' => true,
1798
-                'message' => $duo_error . $lang->get('duo_error_url'),
1798
+                'message' => $duo_error.$lang->get('duo_error_url'),
1799 1799
                 'pwd_attempts' => (int) $sessionPwdAttempts,
1800 1800
                 'debug_message' => $e->getMessage(),
1801 1801
                 'proceedIdentification' => false,
@@ -1803,7 +1803,7 @@  discard block
 block discarded – undo
1803 1803
         }
1804 1804
         
1805 1805
         // Somethimes Duo return success but fail to return a URL, double check if the URL has been created
1806
-        if (!empty($duo_redirect_url) && isset($duo_redirect_url) && filter_var($duo_redirect_url,FILTER_SANITIZE_URL)) {
1806
+        if (!empty($duo_redirect_url) && isset($duo_redirect_url) && filter_var($duo_redirect_url, FILTER_SANITIZE_URL)) {
1807 1807
             // Since Duo Universal requires a redirect, let's store some info when the user get's back after completing the Duo prompt
1808 1808
             $key = hash('sha256', $duo_state);
1809 1809
             $iv = substr(hash('sha256', $duo_state), 0, 16);
@@ -1831,7 +1831,7 @@  discard block
 block discarded – undo
1831 1831
         } else {
1832 1832
             return [
1833 1833
                 'error' => true,
1834
-                'message' => $duo_error . $lang->get('duo_error_url'),
1834
+                'message' => $duo_error.$lang->get('duo_error_url'),
1835 1835
                 'pwd_attempts' => (int) $sessionPwdAttempts,
1836 1836
                 'proceedIdentification' => false,
1837 1837
             ];
@@ -1852,8 +1852,8 @@  discard block
 block discarded – undo
1852 1852
         // return the response (which should be the user name)
1853 1853
         if ($decoded_token['preferred_username'] === $username) {
1854 1854
             $session->set('user-duo_status', 'COMPLET');
1855
-            $session->set('user-duo_state','');
1856
-            $session->set('user-duo_data','');
1855
+            $session->set('user-duo_state', '');
1856
+            $session->set('user-duo_data', '');
1857 1857
             $session->set('user-login', $username);
1858 1858
 
1859 1859
             return [
@@ -1864,9 +1864,9 @@  discard block
 block discarded – undo
1864 1864
             ];
1865 1865
         } else {
1866 1866
             // Something wrong, username from the original Duo request is different than the one received now
1867
-            $session->set('user-duo_status','');
1868
-            $session->set('user-duo_state','');
1869
-            $session->set('user-duo_data','');
1867
+            $session->set('user-duo_status', '');
1868
+            $session->set('user-duo_state', '');
1869
+            $session->set('user-duo_data', '');
1870 1870
 
1871 1871
             return [
1872 1872
                 'error' => true,
@@ -1877,9 +1877,9 @@  discard block
 block discarded – undo
1877 1877
         }
1878 1878
     }
1879 1879
     // If we are here something wrong
1880
-    $session->set('user-duo_status','');
1881
-    $session->set('user-duo_state','');
1882
-    $session->set('user-duo_data','');
1880
+    $session->set('user-duo_status', '');
1881
+    $session->set('user-duo_state', '');
1882
+    $session->set('user-duo_data', '');
1883 1883
     return [
1884 1884
         'error' => true,
1885 1885
         'message' => $lang->get('duo_login_mismatch'),
@@ -1991,7 +1991,7 @@  discard block
 block discarded – undo
1991 1991
         // Check for existing lock
1992 1992
         $unlock_at = DB::queryFirstField(
1993 1993
             'SELECT MAX(unlock_at)
1994
-             FROM ' . prefixTable('auth_failures') . '
1994
+             FROM ' . prefixTable('auth_failures').'
1995 1995
              WHERE unlock_at > %s
1996 1996
              AND ((source = %s AND value = %s) OR (source = %s AND value = %s))',
1997 1997
             date('Y-m-d H:i:s', time()),
@@ -2013,8 +2013,8 @@  discard block
 block discarded – undo
2013 2013
         // Get user info from DB
2014 2014
         $data = DB::queryFirstRow(
2015 2015
             'SELECT u.*, a.value AS api_key
2016
-            FROM ' . prefixTable('users') . ' AS u
2017
-            LEFT JOIN ' . prefixTable('api') . ' AS a ON (u.id = a.user_id)
2016
+            FROM ' . prefixTable('users').' AS u
2017
+            LEFT JOIN ' . prefixTable('api').' AS a ON (u.id = a.user_id)
2018 2018
             WHERE login = %s AND deleted_at IS NULL',
2019 2019
             $login
2020 2020
         );
@@ -2134,7 +2134,7 @@  discard block
 block discarded – undo
2134 2134
             'array' => [
2135 2135
                 'value' => 'bruteforce_wait',
2136 2136
                 'error' => true,
2137
-                'message' => $lang->get('bruteforce_wait') . (string) $e->getMessage(),
2137
+                'message' => $lang->get('bruteforce_wait').(string) $e->getMessage(),
2138 2138
             ]
2139 2139
         ];
2140 2140
     }
@@ -2566,15 +2566,15 @@  discard block
 block discarded – undo
2566 2566
 
2567 2567
             if ($ret['error'] !== false) {
2568 2568
                 logEvents($SETTINGS, 'failed_auth', 'bad_duo_mfa', '', stripslashes($username), stripslashes($username));
2569
-                $session->set('user-duo_status','');
2570
-                $session->set('user-duo_state','');
2571
-                $session->set('user-duo_data','');
2569
+                $session->set('user-duo_status', '');
2570
+                $session->set('user-duo_state', '');
2571
+                $session->set('user-duo_data', '');
2572 2572
                 return [
2573 2573
                     'error' => true,
2574 2574
                     'mfaData' => $ret,
2575 2575
                     'mfaQRCodeInfos' => false,
2576 2576
                 ];
2577
-            } else if ($ret['duo_url_ready'] === true){
2577
+            } else if ($ret['duo_url_ready'] === true) {
2578 2578
                 return [
2579 2579
                     'error' => false,
2580 2580
                     'mfaData' => $ret,
@@ -2638,7 +2638,7 @@  discard block
 block discarded – undo
2638 2638
     // Count failed attempts from this source
2639 2639
     $count = DB::queryFirstField(
2640 2640
         'SELECT COUNT(*)
2641
-        FROM ' . prefixTable('auth_failures') . '
2641
+        FROM ' . prefixTable('auth_failures').'
2642 2642
         WHERE source = %s AND value = %s',
2643 2643
         $source,
2644 2644
         $value
Please login to merge, or discard this patch.