Passed
Pull Request — master (#4682)
by Nils
06:11
created
sources/items.queries.php 2 patches
Spacing   +275 added lines, -276 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 ) {
80 80
     // Not allowed page
81 81
     $session->set('system-error_code', ERR_NOT_ALLOWED);
82
-    include $SETTINGS['cpassman_dir'] . '/error.php';
82
+    include $SETTINGS['cpassman_dir'].'/error.php';
83 83
     exit;
84 84
 }
85 85
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     date_default_timezone_set('UTC');
105 105
 }
106 106
 
107
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $session->get('user-language') . '.php';
107
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$session->get('user-language').'.php';
108 108
 header('Content-type: text/html; charset=utf-8');
109 109
 header('Cache-Control: no-cache, must-revalidate');
110 110
 
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
             // About special settings
366 366
             $dataFolderSettings = DB::queryFirstRow(
367 367
                 'SELECT bloquer_creation, bloquer_modification, personal_folder
368
-                FROM ' . prefixTable('nested_tree') . ' 
368
+                FROM ' . prefixTable('nested_tree').' 
369 369
                 WHERE id = %i',
370 370
                 $inputData['folderId']
371 371
             );
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
             // Get folder complexity
383 383
             $folderComplexity = DB::queryFirstRow(
384 384
                 'SELECT valeur
385
-                FROM ' . prefixTable('misc') . '
385
+                FROM ' . prefixTable('misc').'
386 386
                 WHERE type = %s AND intitule = %i',
387 387
                 'complex',
388 388
                 $inputData['folderId']
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
             $itemExists = 0;
408 408
             $newID = '';
409 409
             $data = DB::queryFirstRow(
410
-                'SELECT * FROM ' . prefixTable('items') . '
410
+                'SELECT * FROM '.prefixTable('items').'
411 411
                 WHERE label = %s AND inactif = %i',
412 412
                 $inputData['label'],
413 413
                 0
@@ -488,8 +488,8 @@  discard block
 block discarded – undo
488 488
                     (int) $post_folder_is_personal,
489 489
                     (int) $newID,
490 490
                     $cryptedStuff['objectKey'],
491
-                    true,   // only for the item creator
492
-                    false,  // no delete all
491
+                    true, // only for the item creator
492
+                    false, // no delete all
493 493
                 );
494 494
 
495 495
                 // update fields
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
                             // should we encrypt the data
503 503
                             $dataTmp = DB::queryFirstRow(
504 504
                                 'SELECT encrypted_data
505
-                                FROM ' . prefixTable('categories') . '
505
+                                FROM ' . prefixTable('categories').'
506 506
                                 WHERE id = %i',
507 507
                                 $field['id']
508 508
                             );
@@ -531,8 +531,8 @@  discard block
 block discarded – undo
531 531
                                     (int) $post_folder_is_personal,
532 532
                                     (int) $newObjectId,
533 533
                                     $cryptedStuff['objectKey'],
534
-                                    true,   // only for the item creator
535
-                                    false,  // no delete all
534
+                                    true, // only for the item creator
535
+                                    false, // no delete all
536 536
                                 );
537 537
 
538 538
                                 array_push(
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
                 ) {
569 569
                     DB::queryFirstRow(
570 570
                         'SELECT *
571
-                        FROM ' . prefixTable('templates') . '
571
+                        FROM ' . prefixTable('templates').'
572 572
                         WHERE item_id = %i',
573 573
                         $newID
574 574
                     );
@@ -637,11 +637,11 @@  discard block
 block discarded – undo
637 637
                 ) {
638 638
                     foreach ($post_restricted_to as $userRest) {
639 639
                         if (empty($userRest) === false) {
640
-                            $dataTmp = DB::queryFirstRow('SELECT login FROM ' . prefixTable('users') . ' WHERE id= %i', $userRest);
640
+                            $dataTmp = DB::queryFirstRow('SELECT login FROM '.prefixTable('users').' WHERE id= %i', $userRest);
641 641
                             if (empty($listOfRestricted)) {
642 642
                                 $listOfRestricted = $dataTmp['login'];
643 643
                             } else {
644
-                                $listOfRestricted .= ';' . $dataTmp['login'];
644
+                                $listOfRestricted .= ';'.$dataTmp['login'];
645 645
                             }
646 646
                         }
647 647
                     }
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
                             if (empty($userRest) === false) {
658 658
                                 $dataTmp = DB::queryFirstRow(
659 659
                                     'SELECT login
660
-                                    FROM ' . prefixTable('users') . '
660
+                                    FROM ' . prefixTable('users').'
661 661
                                     WHERE id= %i',
662 662
                                     $userRest
663 663
                                 );
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
                                 if (empty($oldRestrictionList) === true) {
666 666
                                     $oldRestrictionList = $dataTmp['login'];
667 667
                                 } else {
668
-                                    $oldRestrictionList .= ';' . $dataTmp['login'];
668
+                                    $oldRestrictionList .= ';'.$dataTmp['login'];
669 669
                                 }
670 670
                             }
671 671
                         }
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
                 if (empty($post_uploaded_file_id) === false) {
729 729
                     $rows = DB::query(
730 730
                         'SELECT id
731
-                        FROM ' . prefixTable('files') . '
731
+                        FROM ' . prefixTable('files').'
732 732
                         WHERE id_item = %s',
733 733
                         $post_uploaded_file_id
734 734
                     );
@@ -784,7 +784,7 @@  discard block
 block discarded – undo
784 784
                                     $lang->get('email_subject_item_updated'),
785 785
                                     str_replace(
786 786
                                         array('#label', '#link'),
787
-                                            array($path, $SETTINGS['email_server_url'] . '/index.php?page=items&group=' . $inputData['folderId'] . '&id=' . $newID . $lang['email_body3']),
787
+                                            array($path, $SETTINGS['email_server_url'].'/index.php?page=items&group='.$inputData['folderId'].'&id='.$newID.$lang['email_body3']),
788 788
                                             $lang->get('new_item_email_body')
789 789
                                     ),
790 790
                                     $emailAddress,
@@ -888,11 +888,11 @@  discard block
 block discarded – undo
888 888
         // Prepare variables
889 889
         $itemInfos = array();
890 890
         $inputData['label'] = isset($dataReceived['label']) && is_string($dataReceived['label']) ? filter_var($dataReceived['label'], FILTER_SANITIZE_FULL_SPECIAL_CHARS) : '';
891
-        $post_url = isset($dataReceived['url'])=== true ? filter_var(htmlspecialchars_decode($dataReceived['url']), FILTER_SANITIZE_URL) : '';
891
+        $post_url = isset($dataReceived['url']) === true ? filter_var(htmlspecialchars_decode($dataReceived['url']), FILTER_SANITIZE_URL) : '';
892 892
         $post_password = $original_pw = isset($dataReceived['pw']) && is_string($dataReceived['pw']) ? htmlspecialchars_decode($dataReceived['pw']) : '';
893 893
         $post_login = isset($dataReceived['login']) && is_string($dataReceived['login']) ? filter_var(htmlspecialchars_decode($dataReceived['login']), FILTER_SANITIZE_FULL_SPECIAL_CHARS) : '';
894
-        $post_tags = isset($dataReceived['tags'])=== true ? htmlspecialchars($dataReceived['tags']) : '';
895
-        $post_email = isset($dataReceived['email'])=== true ? filter_var(htmlspecialchars_decode($dataReceived['email']), FILTER_SANITIZE_EMAIL) : '';
894
+        $post_tags = isset($dataReceived['tags']) === true ? htmlspecialchars($dataReceived['tags']) : '';
895
+        $post_email = isset($dataReceived['email']) === true ? filter_var(htmlspecialchars_decode($dataReceived['email']), FILTER_SANITIZE_EMAIL) : '';
896 896
         $post_template_id = (int) filter_var($dataReceived['template_id'], FILTER_SANITIZE_NUMBER_INT);
897 897
         $inputData['itemId'] = (int) filter_var($dataReceived['id'], FILTER_SANITIZE_NUMBER_INT);
898 898
         $post_anyone_can_modify = (int) filter_var($dataReceived['anyone_can_modify'], FILTER_SANITIZE_NUMBER_INT);
@@ -923,8 +923,7 @@  discard block
 block discarded – undo
923 923
         $post_to_be_deleted_after_date = isset($dataReceived['to_be_deleted_after_date']) === true ? filter_var(
924 924
                 $dataReceived['to_be_deleted_after_date'],
925 925
                 FILTER_SANITIZE_FULL_SPECIAL_CHARS
926
-            ) :
927
-            '';
926
+            ) : '';
928 927
         $post_fields = (filter_var_array(
929 928
             $dataReceived['fields'],
930 929
             FILTER_SANITIZE_FULL_SPECIAL_CHARS
@@ -984,7 +983,7 @@  discard block
 block discarded – undo
984 983
         // About special settings
985 984
         $dataFolderSettings = DB::queryFirstRow(
986 985
             'SELECT bloquer_creation, bloquer_modification, personal_folder, title
987
-            FROM ' . prefixTable('nested_tree') . ' 
986
+            FROM ' . prefixTable('nested_tree').' 
988 987
             WHERE id = %i',
989 988
             $inputData['folderId']
990 989
         );
@@ -1000,7 +999,7 @@  discard block
 block discarded – undo
1000 999
         // Get folder complexity
1001 1000
         $folderComplexity = DB::queryFirstRow(
1002 1001
             'SELECT valeur
1003
-            FROM ' . prefixTable('misc') . '
1002
+            FROM ' . prefixTable('misc').'
1004 1003
             WHERE type = %s AND intitule = %i',
1005 1004
             'complex',
1006 1005
             $inputData['folderId']
@@ -1045,8 +1044,8 @@  discard block
 block discarded – undo
1045 1044
         // Get all informations for this item
1046 1045
         $dataItem = DB::queryFirstRow(
1047 1046
             'SELECT *
1048
-            FROM ' . prefixTable('items') . ' as i
1049
-            INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
1047
+            FROM ' . prefixTable('items').' as i
1048
+            INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
1050 1049
             WHERE i.id=%i AND l.action = %s',
1051 1050
             $inputData['itemId'],
1052 1051
             'at_creation'
@@ -1095,7 +1094,7 @@  discard block
 block discarded – undo
1095 1094
         //db::debugmode(true);
1096 1095
         DB::query(
1097 1096
             'SELECT *
1098
-            FROM ' . prefixTable('sharekeys_items') . '
1097
+            FROM ' . prefixTable('sharekeys_items').'
1099 1098
             WHERE object_id = %i AND user_id = %s',
1100 1099
             $inputData['itemId'],
1101 1100
             $session->get('user-id')
@@ -1155,9 +1154,9 @@  discard block
 block discarded – undo
1155 1154
                 'SELECT i.id as id, i.label as label, i.description as description, i.pw as pw, i.url as url, i.id_tree as id_tree, i.perso as perso, i.login as login, 
1156 1155
                 i.inactif as inactif, i.restricted_to as restricted_to, i.anyone_can_modify as anyone_can_modify, i.email as email, i.notification as notification,
1157 1156
                 u.login as user_login, u.email as user_email
1158
-                FROM ' . prefixTable('items') . ' as i
1159
-                INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id=l.id_item)
1160
-                INNER JOIN ' . prefixTable('users') . ' as u ON (u.id=l.id_user)
1157
+                FROM ' . prefixTable('items').' as i
1158
+                INNER JOIN ' . prefixTable('log_items').' as l ON (i.id=l.id_item)
1159
+                INNER JOIN ' . prefixTable('users').' as u ON (u.id=l.id_user)
1161 1160
                 WHERE i.id=%i',
1162 1161
                 $inputData['itemId']
1163 1162
             );
@@ -1165,7 +1164,7 @@  discard block
 block discarded – undo
1165 1164
             // Should we log a password change?
1166 1165
             $userKey = DB::queryFirstRow(
1167 1166
                 'SELECT share_key
1168
-                FROM ' . prefixTable('sharekeys_items') . '
1167
+                FROM ' . prefixTable('sharekeys_items').'
1169 1168
                 WHERE user_id = %i AND object_id = %i',
1170 1169
                 $session->get('user-id'),
1171 1170
                 $inputData['itemId']
@@ -1229,12 +1228,12 @@  discard block
 block discarded – undo
1229 1228
                     (int) $post_folder_is_personal,
1230 1229
                     (int) $inputData['itemId'],
1231 1230
                     $encrypted_password_key,
1232
-                    true,   // only for the item creator
1233
-                    true,   // delete all
1231
+                    true, // only for the item creator
1232
+                    true, // delete all
1234 1233
                 );
1235 1234
 
1236 1235
                 // Create a task to create sharekeys for users
1237
-                if (WIP=== true) error_log('createTaskForItem - new password for this item - '.$post_password ." -- ". $pw);
1236
+                if (WIP === true) error_log('createTaskForItem - new password for this item - '.$post_password." -- ".$pw);
1238 1237
                 $tasksToBePerformed = ['item_password'];
1239 1238
                 $encryptionTaskIsRequested = true;
1240 1239
             } else {
@@ -1245,7 +1244,7 @@  discard block
 block discarded – undo
1245 1244
             // Get list of tags
1246 1245
             $itemTags = DB::queryFirstColumn(
1247 1246
                 'SELECT tag
1248
-                FROM ' . prefixTable('tags') . '
1247
+                FROM ' . prefixTable('tags').'
1249 1248
                 WHERE item_id = %i',
1250 1249
                 $inputData['itemId']
1251 1250
             );
@@ -1291,7 +1290,7 @@  discard block
 block discarded – undo
1291 1290
                     $session->get('user-id'),
1292 1291
                     'at_modification',
1293 1292
                     $session->get('user-login'),
1294
-                    'at_tag : ' . implode(' ', $itemTags) . ' => ' . $post_tags
1293
+                    'at_tag : '.implode(' ', $itemTags).' => '.$post_tags
1295 1294
                 );
1296 1295
             }
1297 1296
 
@@ -1331,8 +1330,8 @@  discard block
 block discarded – undo
1331 1330
                             'SELECT c.id AS id, c.title AS title, i.data AS data, i.data_iv AS data_iv,
1332 1331
                             i.encryption_type AS encryption_type, c.encrypted_data AS encrypted_data,
1333 1332
                             c.masked AS masked, i.id AS field_item_id
1334
-                            FROM ' . prefixTable('categories_items') . ' AS i
1335
-                            INNER JOIN ' . prefixTable('categories') . ' AS c ON (i.field_id=c.id)
1333
+                            FROM ' . prefixTable('categories_items').' AS i
1334
+                            INNER JOIN ' . prefixTable('categories').' AS c ON (i.field_id=c.id)
1336 1335
                             WHERE i.field_id = %i AND i.item_id = %i',
1337 1336
                             $field['id'],
1338 1337
                             $inputData['itemId']
@@ -1348,7 +1347,7 @@  discard block
 block discarded – undo
1348 1347
                             // Perform new query
1349 1348
                             $dataTmpCat = DB::queryFirstRow(
1350 1349
                                 'SELECT id, title, encrypted_data, masked
1351
-                                FROM ' . prefixTable('categories') . '
1350
+                                FROM ' . prefixTable('categories').'
1352 1351
                                 WHERE id = %i',
1353 1352
                                 $field['id']
1354 1353
                             );
@@ -1378,8 +1377,8 @@  discard block
 block discarded – undo
1378 1377
                                     (int) $post_folder_is_personal,
1379 1378
                                     (int) $newId,
1380 1379
                                     $cryptedStuff['objectKey'],
1381
-                                    true,   // only for the item creator
1382
-                                    true,   // delete all
1380
+                                    true, // only for the item creator
1381
+                                    true, // delete all
1383 1382
                                 );
1384 1383
 
1385 1384
                                 // update value
@@ -1427,7 +1426,7 @@  discard block
 block discarded – undo
1427 1426
                                 $session->get('user-id'),
1428 1427
                                 'at_modification',
1429 1428
                                 $session->get('user-login'),
1430
-                                'at_field : ' . $dataTmpCat['title'] . ' : ' . $field['value']
1429
+                                'at_field : '.$dataTmpCat['title'].' : '.$field['value']
1431 1430
                             );
1432 1431
                         } else {
1433 1432
                             // Case where the field already exists
@@ -1436,7 +1435,7 @@  discard block
 block discarded – undo
1436 1435
                                 // Get user sharekey for this field
1437 1436
                                 $userKey = DB::queryFirstRow(
1438 1437
                                     'SELECT share_key
1439
-                                    FROM ' . prefixTable('sharekeys_fields') . '
1438
+                                    FROM ' . prefixTable('sharekeys_fields').'
1440 1439
                                     WHERE user_id = %i AND object_id = %i',
1441 1440
                                     $session->get('user-id'),
1442 1441
                                     $dataTmpCat['field_item_id']
@@ -1475,8 +1474,8 @@  discard block
 block discarded – undo
1475 1474
                                         (int) $post_folder_is_personal,
1476 1475
                                         (int) $dataTmpCat['field_item_id'],
1477 1476
                                         $cryptedStuff['objectKey'],
1478
-                                        true,   // only for the item creator
1479
-                                        true,   // delete all
1477
+                                        true, // only for the item creator
1478
+                                        true, // delete all
1480 1479
                                     );
1481 1480
 
1482 1481
                                     array_push(
@@ -1516,7 +1515,7 @@  discard block
 block discarded – undo
1516 1515
                                     $session->get('user-id'),
1517 1516
                                     'at_modification',
1518 1517
                                     $session->get('user-login'),
1519
-                                    'at_field : ' . $dataTmpCat['title'] . ' => ' . $oldVal
1518
+                                    'at_field : '.$dataTmpCat['title'].' => '.$oldVal
1520 1519
                                 );
1521 1520
                             }
1522 1521
                         }
@@ -1570,7 +1569,7 @@  discard block
 block discarded – undo
1570 1569
             ) {
1571 1570
                 DB::queryFirstRow(
1572 1571
                     'SELECT *
1573
-                    FROM ' . prefixTable('templates') . '
1572
+                    FROM ' . prefixTable('templates').'
1574 1573
                     WHERE item_id = %i',
1575 1574
                     $inputData['itemId']
1576 1575
                 );
@@ -1613,7 +1612,7 @@  discard block
 block discarded – undo
1613 1612
                 // check if elem exists in Table. If not add it or update it.
1614 1613
                 DB::query(
1615 1614
                     'SELECT *
1616
-                    FROM ' . prefixTable('automatic_del') . '
1615
+                    FROM ' . prefixTable('automatic_del').'
1617 1616
                     WHERE item_id = %i',
1618 1617
                     $inputData['itemId']
1619 1618
                 );
@@ -1640,7 +1639,7 @@  discard block
 block discarded – undo
1640 1639
                         // Store updates performed
1641 1640
                         array_push(
1642 1641
                             $arrayOfChanges,
1643
-                            $lang->get('automatic_deletion_engaged') . ': ' . $lang->get('enabled')
1642
+                            $lang->get('automatic_deletion_engaged').': '.$lang->get('enabled')
1644 1643
                         );
1645 1644
 
1646 1645
                         // update LOG
@@ -1683,7 +1682,7 @@  discard block
 block discarded – undo
1683 1682
                         // Store updates performed
1684 1683
                         array_push(
1685 1684
                             $arrayOfChanges,
1686
-                            $lang->get('automatic_deletion_engaged') . ': ' . $lang->get('disabled')
1685
+                            $lang->get('automatic_deletion_engaged').': '.$lang->get('disabled')
1687 1686
                         );
1688 1687
 
1689 1688
                         // update LOG
@@ -1711,7 +1710,7 @@  discard block
 block discarded – undo
1711 1710
                     if (empty($userId) === false) {
1712 1711
                         $dataTmp = DB::queryFirstRow(
1713 1712
                             'SELECT id, name, lastname
1714
-                            FROM ' . prefixTable('users') . '
1713
+                            FROM ' . prefixTable('users').'
1715 1714
                             WHERE id= %i',
1716 1715
                             $userId
1717 1716
                         );
@@ -1719,7 +1718,7 @@  discard block
 block discarded – undo
1719 1718
                         // Add to array
1720 1719
                         array_push(
1721 1720
                             $arrayOfUsersRestriction,
1722
-                            $dataTmp['name'] . ' ' . $dataTmp['lastname']
1721
+                            $dataTmp['name'].' '.$dataTmp['lastname']
1723 1722
                         );
1724 1723
                         array_push(
1725 1724
                             $arrayOfUsersIdRestriction,
@@ -1750,8 +1749,8 @@  discard block
 block discarded – undo
1750 1749
                 // get values before deleting them
1751 1750
                 $rows = DB::query(
1752 1751
                     'SELECT t.title, t.id AS id
1753
-                    FROM ' . prefixTable('roles_title') . ' as t
1754
-                    INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (t.id=r.role_id)
1752
+                    FROM ' . prefixTable('roles_title').' as t
1753
+                    INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (t.id=r.role_id)
1755 1754
                     WHERE r.item_id = %i
1756 1755
                     ORDER BY t.title ASC',
1757 1756
                     $inputData['itemId']
@@ -1785,7 +1784,7 @@  discard block
 block discarded – undo
1785 1784
                         );
1786 1785
                         $dataTmp = DB::queryFirstRow(
1787 1786
                             'SELECT title
1788
-                            FROM ' . prefixTable('roles_title') . '
1787
+                            FROM ' . prefixTable('roles_title').'
1789 1788
                             WHERE id = %i',
1790 1789
                             $role
1791 1790
                         );
@@ -1813,7 +1812,7 @@  discard block
 block discarded – undo
1813 1812
             // Get current status
1814 1813
             $otpStatus = DB::queryFirstRow(
1815 1814
                 'SELECT enabled as otp_is_enabled
1816
-                FROM ' . prefixTable('items_otp') . '
1815
+                FROM ' . prefixTable('items_otp').'
1817 1816
                 WHERE item_id = %i',
1818 1817
                 $inputData['itemId']
1819 1818
             );
@@ -1844,7 +1843,7 @@  discard block
 block discarded – undo
1844 1843
                     $session->get('user-id'),
1845 1844
                     'at_modification',
1846 1845
                     $session->get('user-login'),
1847
-                    'at_otp_status:' . ((int) $post_otp_is_enabled === 0 ? 'disabled' : 'enabled')
1846
+                    'at_otp_status:'.((int) $post_otp_is_enabled === 0 ? 'disabled' : 'enabled')
1848 1847
                 );
1849 1848
             } elseif (DB::count() === 0 && empty($post_otp_secret) === false) {
1850 1849
                 // Create the entry in items_otp table
@@ -1888,8 +1887,8 @@  discard block
 block discarded – undo
1888 1887
                     $session->get('user-id'),
1889 1888
                     'at_modification',
1890 1889
                     $session->get('user-login'),
1891
-                    'at_restriction : ' . (count($diffUsersRestiction) > 0 ?
1892
-                        implode(', ', $arrayOfUsersRestriction) . (count($diffRolesRestiction) > 0 ? ', ' : '') : '') . (count($diffRolesRestiction) > 0 ? implode(', ', $arrayOfRestrictionRoles) : '')
1890
+                    'at_restriction : '.(count($diffUsersRestiction) > 0 ?
1891
+                        implode(', ', $arrayOfUsersRestriction).(count($diffRolesRestiction) > 0 ? ', ' : '') : '').(count($diffRolesRestiction) > 0 ? implode(', ', $arrayOfRestrictionRoles) : '')
1893 1892
                 );
1894 1893
             }
1895 1894
 
@@ -1909,7 +1908,7 @@  discard block
 block discarded – undo
1909 1908
                     $session->get('user-id'),
1910 1909
                     'at_modification',
1911 1910
                     $session->get('user-login'),
1912
-                    'at_label : ' . $data['label'] . ' => ' . $inputData['label']
1911
+                    'at_label : '.$data['label'].' => '.$inputData['label']
1913 1912
                 );
1914 1913
             }
1915 1914
             // LOGIN
@@ -1928,7 +1927,7 @@  discard block
 block discarded – undo
1928 1927
                     $session->get('user-id'),
1929 1928
                     'at_modification',
1930 1929
                     $session->get('user-login'),
1931
-                    'at_login : ' . $data['login'] . ' => ' . $post_login
1930
+                    'at_login : '.$data['login'].' => '.$post_login
1932 1931
                 );
1933 1932
             }
1934 1933
             // EMAIL
@@ -1947,7 +1946,7 @@  discard block
 block discarded – undo
1947 1946
                     $session->get('user-id'),
1948 1947
                     'at_modification',
1949 1948
                     $session->get('user-login'),
1950
-                    'at_email : ' . $data['email'] . ' => ' . $post_email
1949
+                    'at_email : '.$data['email'].' => '.$post_email
1951 1950
                 );
1952 1951
             }
1953 1952
             // URL
@@ -1966,7 +1965,7 @@  discard block
 block discarded – undo
1966 1965
                     $session->get('user-id'),
1967 1966
                     'at_modification',
1968 1967
                     $session->get('user-login'),
1969
-                    'at_url : ' . $data['url'] . ' => ' . $post_url
1968
+                    'at_url : '.$data['url'].' => '.$post_url
1970 1969
                 );
1971 1970
             }
1972 1971
             // DESCRIPTION
@@ -1992,7 +1991,7 @@  discard block
 block discarded – undo
1992 1991
             // FOLDER
1993 1992
             if ((int) $data['id_tree'] !== (int) $inputData['folderId']) {
1994 1993
                 // Get name of folders
1995
-                $dataTmp = DB::query('SELECT title FROM ' . prefixTable('nested_tree') . ' WHERE id IN %li', array($data['id_tree'], $inputData['folderId']));
1994
+                $dataTmp = DB::query('SELECT title FROM '.prefixTable('nested_tree').' WHERE id IN %li', array($data['id_tree'], $inputData['folderId']));
1996 1995
 
1997 1996
                 // Store updates performed
1998 1997
                 array_push(
@@ -2008,7 +2007,7 @@  discard block
 block discarded – undo
2008 2007
                     $session->get('user-id'),
2009 2008
                     'at_modification',
2010 2009
                     $session->get('user-login'),
2011
-                    'at_category : ' . $dataTmp[0]['title'] . ' => ' . $dataTmp[1]['title']
2010
+                    'at_category : '.$dataTmp[0]['title'].' => '.$dataTmp[1]['title']
2012 2011
                 );
2013 2012
             }
2014 2013
             // ANYONE_CAN_MODIFY
@@ -2016,7 +2015,7 @@  discard block
 block discarded – undo
2016 2015
                 // Store updates performed
2017 2016
                 array_push(
2018 2017
                     $arrayOfChanges,
2019
-                    $lang->get('at_anyoneconmodify') . ': ' . ((int) $post_anyone_can_modify === 0 ? $lang->get('disabled') : $lang->get('enabled'))
2018
+                    $lang->get('at_anyoneconmodify').': '.((int) $post_anyone_can_modify === 0 ? $lang->get('disabled') : $lang->get('enabled'))
2020 2019
                 );
2021 2020
 
2022 2021
                 // Log
@@ -2027,15 +2026,15 @@  discard block
 block discarded – undo
2027 2026
                     $session->get('user-id'),
2028 2027
                     'at_modification',
2029 2028
                     $session->get('user-login'),
2030
-                    'at_anyoneconmodify : ' . ((int) $post_anyone_can_modify === 0 ? 'disabled' : 'enabled')
2029
+                    'at_anyoneconmodify : '.((int) $post_anyone_can_modify === 0 ? 'disabled' : 'enabled')
2031 2030
                 );
2032 2031
             }
2033 2032
 
2034 2033
             // Reload new values
2035 2034
             $dataItem = DB::queryFirstRow(
2036 2035
                 'SELECT *
2037
-                FROM ' . prefixTable('items') . ' as i
2038
-                INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
2036
+                FROM ' . prefixTable('items').' as i
2037
+                INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
2039 2038
                 WHERE i.id = %i AND l.action = %s',
2040 2039
                 $inputData['itemId'],
2041 2040
                 'at_creation'
@@ -2044,8 +2043,8 @@  discard block
 block discarded – undo
2044 2043
             $history = '';
2045 2044
             $rows = DB::query(
2046 2045
                 'SELECT l.date as date, l.action as action, l.raison as raison, u.login as login
2047
-                FROM ' . prefixTable('log_items') . ' as l
2048
-                LEFT JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id)
2046
+                FROM ' . prefixTable('log_items').' as l
2047
+                LEFT JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id)
2049 2048
                 WHERE l.action <> %s AND id_item=%s',
2050 2049
                 'at_shown',
2051 2050
                 $inputData['itemId']
@@ -2054,14 +2053,14 @@  discard block
 block discarded – undo
2054 2053
                 if ($record['raison'] === NULL) continue;
2055 2054
                 $reason = explode(':', $record['raison']);
2056 2055
                 if (count($reason) > 0) {
2057
-                    $sentence = date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) . ' - '
2058
-                        . $record['login'] . ' - ' . $lang->get($record['action']) . ' - '
2059
-                        . (empty($record['raison']) === false ? (count($reason) > 1 ? $lang->get(trim($reason[0])) . ' : ' . $reason[1]
2056
+                    $sentence = date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']).' - '
2057
+                        . $record['login'].' - '.$lang->get($record['action']).' - '
2058
+                        . (empty($record['raison']) === false ? (count($reason) > 1 ? $lang->get(trim($reason[0])).' : '.$reason[1]
2060 2059
                             : $lang->get(trim($reason[0]))) : '');
2061 2060
                     if (empty($history)) {
2062 2061
                         $history = $sentence;
2063 2062
                     } else {
2064
-                        $history .= '<br />' . $sentence;
2063
+                        $history .= '<br />'.$sentence;
2065 2064
                     }
2066 2065
                 }
2067 2066
             }
@@ -2199,7 +2198,7 @@  discard block
 block discarded – undo
2199 2198
         ) {
2200 2199
             // load the original record into an array
2201 2200
             $originalRecord = DB::queryFirstRow(
2202
-                'SELECT * FROM ' . prefixTable('items') . '
2201
+                'SELECT * FROM '.prefixTable('items').'
2203 2202
                 WHERE id = %i',
2204 2203
                 $inputData['itemId']
2205 2204
             );
@@ -2218,7 +2217,7 @@  discard block
 block discarded – undo
2218 2217
 
2219 2218
             // Load the destination folder record into an array
2220 2219
             $dataDestination = DB::queryFirstRow(
2221
-                'SELECT personal_folder FROM ' . prefixTable('nested_tree') . '
2220
+                'SELECT personal_folder FROM '.prefixTable('nested_tree').'
2222 2221
                 WHERE id = %i',
2223 2222
                 $post_dest_id
2224 2223
             );
@@ -2226,7 +2225,7 @@  discard block
 block discarded – undo
2226 2225
             // Get the ITEM object key for the user
2227 2226
             $userKey = DB::queryFirstRow(
2228 2227
                 'SELECT share_key
2229
-                FROM ' . prefixTable('sharekeys_items') . '
2228
+                FROM ' . prefixTable('sharekeys_items').'
2230 2229
                 WHERE user_id = %i AND object_id = %i',
2231 2230
                 $session->get('user-id'),
2232 2231
                 $inputData['itemId']
@@ -2303,8 +2302,8 @@  discard block
 block discarded – undo
2303 2302
             // Manage Custom Fields
2304 2303
             $rows = DB::query(
2305 2304
                 'SELECT ci.id AS id, ci.data AS data, ci.field_id AS field_id, c.encrypted_data AS encrypted_data
2306
-                FROM ' . prefixTable('categories_items') . ' AS ci
2307
-                INNER JOIN ' . prefixTable('categories') . ' AS c ON (c.id = ci.field_id)
2305
+                FROM ' . prefixTable('categories_items').' AS ci
2306
+                INNER JOIN ' . prefixTable('categories').' AS c ON (c.id = ci.field_id)
2308 2307
                 WHERE ci.item_id = %i',
2309 2308
                 $inputData['itemId']
2310 2309
             );
@@ -2316,7 +2315,7 @@  discard block
 block discarded – undo
2316 2315
                     // Get user key
2317 2316
                     $userKey = DB::queryFirstRow(
2318 2317
                         'SELECT share_key
2319
-                        FROM ' . prefixTable('sharekeys_fields') . '
2318
+                        FROM ' . prefixTable('sharekeys_fields').'
2320 2319
                         WHERE user_id = %i AND object_id = %i',
2321 2320
                         $session->get('user-id'),
2322 2321
                         $field['id']
@@ -2383,15 +2382,15 @@  discard block
 block discarded – undo
2383 2382
             $rows = DB::query(
2384 2383
                 'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status, f.extension AS extension,
2385 2384
                 f.size AS size, f.type AS type, s.share_key AS share_key
2386
-                FROM ' . prefixTable('files') . ' AS f
2387
-                INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id)
2385
+                FROM ' . prefixTable('files').' AS f
2386
+                INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id)
2388 2387
                 WHERE s.user_id = %i AND f.id_item = %i',
2389 2388
                 $session->get('user-id'),
2390 2389
                 $inputData['itemId']
2391 2390
             );
2392 2391
             foreach ($rows as $record) {
2393 2392
                 // Check if file still exists
2394
-                if (file_exists($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . TP_FILE_PREFIX . base64_decode($record['file'])) === true) {
2393
+                if (file_exists($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.TP_FILE_PREFIX.base64_decode($record['file'])) === true) {
2395 2394
                     // Step1 - decrypt the file
2396 2395
                     // deepcode ignore PT: path is sanitized inside decryptFile()
2397 2396
                     $fileContent = decryptFile(
@@ -2402,8 +2401,8 @@  discard block
 block discarded – undo
2402 2401
 
2403 2402
                     // Step2 - create file
2404 2403
                     // deepcode ignore InsecureHash: md5 is used jonly for file name in order to get a hashed value in database
2405
-                    $newFileName = md5(time() . '_' . $record['id']) . '.' . $record['extension'];
2406
-                    $outstream = fopen($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . $newFileName, 'ab');
2404
+                    $newFileName = md5(time().'_'.$record['id']).'.'.$record['extension'];
2405
+                    $outstream = fopen($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.$newFileName, 'ab');
2407 2406
                     if ($outstream === false) {
2408 2407
                         echo prepareExchangedData(
2409 2408
                             array(
@@ -2476,7 +2475,7 @@  discard block
 block discarded – undo
2476 2475
 
2477 2476
             // -------------------------
2478 2477
             // Add specific restrictions
2479
-            $rows = DB::query('SELECT * FROM ' . prefixTable('restriction_to_roles') . ' WHERE item_id = %i', $inputData['itemId']);
2478
+            $rows = DB::query('SELECT * FROM '.prefixTable('restriction_to_roles').' WHERE item_id = %i', $inputData['itemId']);
2480 2479
             foreach ($rows as $record) {
2481 2480
                 DB::insert(
2482 2481
                     prefixTable('restriction_to_roles'),
@@ -2488,7 +2487,7 @@  discard block
 block discarded – undo
2488 2487
             }
2489 2488
 
2490 2489
             // Add Tags
2491
-            $rows = DB::query('SELECT * FROM ' . prefixTable('tags') . ' WHERE item_id = %i', $inputData['itemId']);
2490
+            $rows = DB::query('SELECT * FROM '.prefixTable('tags').' WHERE item_id = %i', $inputData['itemId']);
2492 2491
             foreach ($rows as $record) {
2493 2492
                 DB::insert(
2494 2493
                     prefixTable('tags'),
@@ -2590,7 +2589,7 @@  discard block
 block discarded – undo
2590 2589
         // then we can show it
2591 2590
         $item_deleted = DB::queryFirstRow(
2592 2591
             'SELECT *
2593
-            FROM ' . prefixTable('log_items') . '
2592
+            FROM ' . prefixTable('log_items').'
2594 2593
             WHERE id_item = %i AND action = %s
2595 2594
             ORDER BY date DESC
2596 2595
             LIMIT 0, 1',
@@ -2601,7 +2600,7 @@  discard block
 block discarded – undo
2601 2600
 
2602 2601
         $item_restored = DB::queryFirstRow(
2603 2602
             'SELECT *
2604
-            FROM ' . prefixTable('log_items') . '
2603
+            FROM ' . prefixTable('log_items').'
2605 2604
             WHERE id_item = %i AND action = %s
2606 2605
             ORDER BY date DESC
2607 2606
             LIMIT 0, 1',
@@ -2625,8 +2624,8 @@  discard block
 block discarded – undo
2625 2624
         // Get all informations for this item
2626 2625
         $dataItem = DB::queryFirstRow(
2627 2626
             'SELECT *
2628
-            FROM ' . prefixTable('items') . ' as i
2629
-            INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
2627
+            FROM ' . prefixTable('items').' as i
2628
+            INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
2630 2629
             WHERE i.id = %i AND l.action = %s',
2631 2630
             $inputData['id'],
2632 2631
             'at_creation'
@@ -2635,7 +2634,7 @@  discard block
 block discarded – undo
2635 2634
         // Notification
2636 2635
         DB::queryFirstRow(
2637 2636
             'SELECT *
2638
-            FROM ' . prefixTable('notification') . '
2637
+            FROM ' . prefixTable('notification').'
2639 2638
             WHERE item_id = %i AND user_id = %i',
2640 2639
             $inputData['id'],
2641 2640
             $session->get('user-id')
@@ -2654,7 +2653,7 @@  discard block
 block discarded – undo
2654 2653
 
2655 2654
         // manage case of API user
2656 2655
         if ($dataItem['id_user'] === API_USER_ID) {
2657
-            $arrData['author'] = 'API [' . $dataItem['description'] . ']';
2656
+            $arrData['author'] = 'API ['.$dataItem['description'].']';
2658 2657
             $arrData['id_user'] = API_USER_ID;
2659 2658
             $arrData['author_email'] = '';
2660 2659
             $arrData['notification_status'] = false;
@@ -2664,7 +2663,7 @@  discard block
 block discarded – undo
2664 2663
         $tags = array();
2665 2664
         $rows = DB::query(
2666 2665
             'SELECT tag
2667
-            FROM ' . prefixTable('tags') . '
2666
+            FROM ' . prefixTable('tags').'
2668 2667
             WHERE item_id = %i',
2669 2668
             $inputData['id']
2670 2669
         );
@@ -2689,7 +2688,7 @@  discard block
 block discarded – undo
2689 2688
         // Check if user has a role that is accepted
2690 2689
         $rows_tmp = DB::query(
2691 2690
             'SELECT role_id
2692
-            FROM ' . prefixTable('restriction_to_roles') . '
2691
+            FROM ' . prefixTable('restriction_to_roles').'
2693 2692
             WHERE item_id=%i',
2694 2693
             $inputData['id']
2695 2694
         );
@@ -2703,7 +2702,7 @@  discard block
 block discarded – undo
2703 2702
         // Get the object key for the user
2704 2703
         $userKey = DB::queryFirstRow(
2705 2704
             'SELECT share_key
2706
-            FROM ' . prefixTable('sharekeys_items') . '
2705
+            FROM ' . prefixTable('sharekeys_items').'
2707 2706
             WHERE user_id = %i AND object_id = %i',
2708 2707
             $session->get('user-id'),
2709 2708
             $inputData['id']
@@ -2800,8 +2799,8 @@  discard block
 block discarded – undo
2800 2799
                 // Add restriction if item is restricted to roles
2801 2800
                 $rows = DB::query(
2802 2801
                     'SELECT t.title, t.id
2803
-                    FROM ' . prefixTable('roles_title') . ' AS t
2804
-                    INNER JOIN ' . prefixTable('restriction_to_roles') . ' AS r ON (t.id=r.role_id)
2802
+                    FROM ' . prefixTable('roles_title').' AS t
2803
+                    INNER JOIN ' . prefixTable('restriction_to_roles').' AS r ON (t.id=r.role_id)
2805 2804
                     WHERE r.item_id = %i
2806 2805
                     ORDER BY t.title ASC',
2807 2806
                     $inputData['id']
@@ -2817,8 +2816,8 @@  discard block
 block discarded – undo
2817 2816
                 $tmp = array();
2818 2817
                 $rows = DB::query(
2819 2818
                     'SELECT k.label, k.id
2820
-                    FROM ' . prefixTable('kb_items') . ' as i
2821
-                    INNER JOIN ' . prefixTable('kb') . ' as k ON (i.kb_id=k.id)
2819
+                    FROM ' . prefixTable('kb_items').' as i
2820
+                    INNER JOIN ' . prefixTable('kb').' as k ON (i.kb_id=k.id)
2822 2821
                     WHERE i.item_id = %i
2823 2822
                     ORDER BY k.label ASC',
2824 2823
                     $inputData['id']
@@ -2901,7 +2900,7 @@  discard block
 block discarded – undo
2901 2900
                 $arrCatList = array();
2902 2901
                 $rows_tmp = DB::query(
2903 2902
                     'SELECT id_category
2904
-                    FROM ' . prefixTable('categories_folders') . '
2903
+                    FROM ' . prefixTable('categories_folders').'
2905 2904
                     WHERE id_folder=%i',
2906 2905
                     $inputData['folderId']
2907 2906
                 );
@@ -2916,8 +2915,8 @@  discard block
 block discarded – undo
2916 2915
                         'SELECT i.id AS id, i.field_id AS field_id, i.data AS data, i.item_id AS item_id,
2917 2916
                         i.encryption_type AS encryption_type, c.encrypted_data AS encrypted_data, c.parent_id AS parent_id,
2918 2917
                         c.type as field_type, c.masked AS field_masked, c.role_visibility AS role_visibility
2919
-                        FROM ' . prefixTable('categories_items') . ' AS i
2920
-                        INNER JOIN ' . prefixTable('categories') . ' AS c ON (i.field_id=c.id)
2918
+                        FROM ' . prefixTable('categories_items').' AS i
2919
+                        INNER JOIN ' . prefixTable('categories').' AS c ON (i.field_id=c.id)
2921 2920
                         WHERE i.item_id=%i AND c.parent_id IN %ls',
2922 2921
                         $inputData['id'],
2923 2922
                         $arrCatList
@@ -2928,7 +2927,7 @@  discard block
 block discarded – undo
2928 2927
                         //db::debugmode(true);
2929 2928
                         $userKey = DB::queryFirstRow(
2930 2929
                             'SELECT share_key
2931
-                            FROM ' . prefixTable('sharekeys_fields') . '
2930
+                            FROM ' . prefixTable('sharekeys_fields').'
2932 2931
                             WHERE user_id = %i AND object_id = %i',
2933 2932
                             $session->get('user-id'),
2934 2933
                             $row['id']
@@ -2946,7 +2945,7 @@  discard block
 block discarded – undo
2946 2945
                         } else if (DB::count() === 0 && (int) $row['encrypted_data'] === 0) {
2947 2946
                             // Data is not encrypted in DB
2948 2947
                             $fieldText = [
2949
-                                'string' => $row['data'],//#3945 - isBase64($row['data']) === true ? base64_decode($row['data']) : 
2948
+                                'string' => $row['data'], //#3945 - isBase64($row['data']) === true ? base64_decode($row['data']) : 
2950 2949
                                 'encrypted' => false,
2951 2950
                                 'error' => false,
2952 2951
                             ];
@@ -2991,7 +2990,7 @@  discard block
 block discarded – undo
2991 2990
             if (isset($SETTINGS['item_creation_templates']) && (int) $SETTINGS['item_creation_templates'] === 1) {
2992 2991
                 $rows_tmp = DB::queryFirstRow(
2993 2992
                     'SELECT category_id
2994
-                    FROM ' . prefixTable('templates') . '
2993
+                    FROM ' . prefixTable('templates').'
2995 2994
                     WHERE item_id = %i',
2996 2995
                     $inputData['id']
2997 2996
                 );
@@ -3008,7 +3007,7 @@  discard block
 block discarded – undo
3008 3007
             // Evaluate if item is ready for all users
3009 3008
             $rows_tmp = DB::queryFirstRow(
3010 3009
                 'SELECT finished_at
3011
-                FROM ' . prefixTable('background_tasks') . '
3010
+                FROM ' . prefixTable('background_tasks').'
3012 3011
                 WHERE item_id = %i',
3013 3012
                 $inputData['id']
3014 3013
             );
@@ -3025,7 +3024,7 @@  discard block
 block discarded – undo
3025 3024
                 // Is the Item to be deleted?
3026 3025
                 $dataDelete = DB::queryFirstRow(
3027 3026
                     'SELECT * 
3028
-                    FROM ' . prefixTable('automatic_del') . '
3027
+                    FROM ' . prefixTable('automatic_del').'
3029 3028
                     WHERE item_id = %i',
3030 3029
                     $inputData['id']
3031 3030
                 );
@@ -3106,14 +3105,14 @@  discard block
 block discarded – undo
3106 3105
                     if (empty($userRest) === false) {
3107 3106
                         $dataTmp = DB::queryFirstRow(
3108 3107
                             'SELECT login
3109
-                            FROM ' . prefixTable('users') . '
3108
+                            FROM ' . prefixTable('users').'
3110 3109
                             WHERE id= %i',
3111 3110
                             $userRest
3112 3111
                         );
3113 3112
                         if (empty($listOfRestricted)) {
3114 3113
                             $listOfRestricted = $dataTmp['login'];
3115 3114
                         } else {
3116
-                            $listOfRestricted .= ';' . $dataTmp['login'];
3115
+                            $listOfRestricted .= ';'.$dataTmp['login'];
3117 3116
                         }
3118 3117
                     }
3119 3118
                 }
@@ -3187,9 +3186,9 @@  discard block
 block discarded – undo
3187 3186
         // Load item data
3188 3187
         $dataItem = DB::queryFirstRow(
3189 3188
             '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
3190
-            FROM ' . prefixTable('items') . ' AS i
3191
-            INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (i.id_tree = n.id)
3192
-            LEFT JOIN ' . prefixTable('items_otp') . ' AS o ON (o.item_id = i.id)
3189
+            FROM ' . prefixTable('items').' AS i
3190
+            INNER JOIN ' . prefixTable('nested_tree').' AS n ON (i.id_tree = n.id)
3191
+            LEFT JOIN ' . prefixTable('items_otp').' AS o ON (o.item_id = i.id)
3193 3192
             WHERE i.id = %i',
3194 3193
             $inputData['id']
3195 3194
         );
@@ -3211,7 +3210,7 @@  discard block
 block discarded – undo
3211 3210
         // Check if user has a role that is accepted
3212 3211
         $rows_tmp = DB::query(
3213 3212
             'SELECT role_id
3214
-            FROM ' . prefixTable('restriction_to_roles') . '
3213
+            FROM ' . prefixTable('restriction_to_roles').'
3215 3214
             WHERE item_id=%i',
3216 3215
             $inputData['id']
3217 3216
         );
@@ -3243,12 +3242,12 @@  discard block
 block discarded – undo
3243 3242
             // launch query
3244 3243
             $rows = DB::query(
3245 3244
                 'SELECT id, name, file, extension, size
3246
-                FROM ' . prefixTable('files') . '
3245
+                FROM ' . prefixTable('files').'
3247 3246
                 WHERE id_item = %i AND confirmed = 1',
3248 3247
                 $inputData['id']
3249 3248
             );
3250 3249
             foreach ($rows as $record) {
3251
-                $filename = basename($record['name'], '.' . $record['extension']);
3250
+                $filename = basename($record['name'], '.'.$record['extension']);
3252 3251
                 $filename = isBase64($filename) === true ? base64_decode($filename) : $filename;
3253 3252
 
3254 3253
                 array_push(
@@ -3261,7 +3260,7 @@  discard block
 block discarded – undo
3261 3260
                         'is_image' => in_array(strtolower($record['extension']), TP_IMAGE_FILE_EXT) === true ? 1 : 0,
3262 3261
                         'id' => $record['id'],
3263 3262
                         'key' => $session->get('user-key_tmp'),
3264
-                        'internalFilename' => basename($record['name'], '.' . $record['extension']),
3263
+                        'internalFilename' => basename($record['name'], '.'.$record['extension']),
3265 3264
                     )
3266 3265
                 );
3267 3266
             }
@@ -3299,7 +3298,7 @@  discard block
 block discarded – undo
3299 3298
                     array(
3300 3299
                         'latest_items' => implode(';', $session->get('user-latest_items')),
3301 3300
                     ),
3302
-                    'id=' . $session->get('user-id')
3301
+                    'id='.$session->get('user-id')
3303 3302
                 );
3304 3303
             }
3305 3304
 
@@ -3308,8 +3307,8 @@  discard block
 block discarded – undo
3308 3307
             $listOptionsForRoles = array();
3309 3308
             $rows = DB::query(
3310 3309
                 'SELECT r.role_id AS role_id, t.title AS title
3311
-                FROM ' . prefixTable('roles_values') . ' AS r
3312
-                INNER JOIN ' . prefixTable('roles_title') . ' AS t ON (r.role_id = t.id)
3310
+                FROM ' . prefixTable('roles_values').' AS r
3311
+                INNER JOIN ' . prefixTable('roles_title').' AS t ON (r.role_id = t.id)
3313 3312
                 WHERE r.folder_id = %i',
3314 3313
                 $dataItem['id_tree']
3315 3314
             );
@@ -3323,9 +3322,9 @@  discard block
 block discarded – undo
3323 3322
                 );
3324 3323
                 $rows2 = DB::query(
3325 3324
                     'SELECT id, login, fonction_id, email, name, lastname
3326
-                    FROM ' . prefixTable('users') . '
3325
+                    FROM ' . prefixTable('users').'
3327 3326
                     WHERE fonction_id LIKE %s',
3328
-                    '%' . $record['role_id'] . '%'
3327
+                    '%'.$record['role_id'].'%'
3329 3328
                 );
3330 3329
                 foreach ($rows2 as $record2) {
3331 3330
                     foreach (explode(';', $record2['fonction_id']) as $role) {
@@ -3338,7 +3337,7 @@  discard block
 block discarded – undo
3338 3337
                                 array(
3339 3338
                                     'id' => (int) $record2['id'],
3340 3339
                                     'login' => $record2['login'],
3341
-                                    'name' => $record2['name'] . ' ' . $record2['lastname'],
3340
+                                    'name' => $record2['name'].' '.$record2['lastname'],
3342 3341
                                     'email' => $record2['email'],
3343 3342
                                 )
3344 3343
                             );
@@ -3357,16 +3356,16 @@  discard block
 block discarded – undo
3357 3356
                 $path = '';
3358 3357
                 foreach ($arbo as $elem) {
3359 3358
                     if (empty($path) === true) {
3360
-                        $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' ';
3359
+                        $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' ';
3361 3360
                     } else {
3362
-                        $path .= '&#8594; ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
3361
+                        $path .= '&#8594; '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
3363 3362
                     }
3364 3363
                 }
3365 3364
                 // Build text to show user
3366 3365
                 if (empty($path) === true) {
3367 3366
                     $path = addslashes($dataItem['label']);
3368 3367
                 } else {
3369
-                    $path = addslashes($dataItem['label']) . ' (' . $path . ')';
3368
+                    $path = addslashes($dataItem['label']).' ('.$path.')';
3370 3369
                 }
3371 3370
 
3372 3371
                 // Add Admins to notification list if expected
@@ -3389,7 +3388,7 @@  discard block
 block discarded – undo
3389 3388
                         array(
3390 3389
                             addslashes($session->get('user-login')),
3391 3390
                             $path,
3392
-                            $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $dataItem['id'],
3391
+                            $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$dataItem['id'],
3393 3392
                         ),
3394 3393
                         $lang->get('email_on_open_notification_mail')
3395 3394
                     ),
@@ -3399,7 +3398,7 @@  discard block
 block discarded – undo
3399 3398
             }
3400 3399
 
3401 3400
             // has this item a change proposal
3402
-            DB::query('SELECT * FROM ' . prefixTable('items_change') . ' WHERE item_id = %i', $inputData['id']);
3401
+            DB::query('SELECT * FROM '.prefixTable('items_change').' WHERE item_id = %i', $inputData['id']);
3403 3402
             $returnArray['has_change_proposal'] = DB::count();
3404 3403
 
3405 3404
             // Setting
@@ -3410,7 +3409,7 @@  discard block
 block discarded – undo
3410 3409
             if (isset($SETTINGS['otv_is_enabled']) === true && (int) $SETTINGS['otv_is_enabled'] === 1) {
3411 3410
                 DB::query(
3412 3411
                     'SELECT *
3413
-                    FROM ' . prefixTable('otv') . '
3412
+                    FROM ' . prefixTable('otv').'
3414 3413
                     WHERE item_id = %i
3415 3414
                     AND time_limit > %i',
3416 3415
                     $inputData['id'],
@@ -3509,7 +3508,7 @@  discard block
 block discarded – undo
3509 3508
         // Load item data
3510 3509
         $data = DB::queryFirstRow(
3511 3510
             'SELECT id_tree, id, label
3512
-            FROM ' . prefixTable('items') . '
3511
+            FROM ' . prefixTable('items').'
3513 3512
             WHERE id = %i OR item_key = %s',
3514 3513
             $inputData['itemId'],
3515 3514
             $inputData['itemKey']
@@ -3600,7 +3599,7 @@  discard block
 block discarded – undo
3600 3599
         // Load item data
3601 3600
         $dataItem = DB::queryFirstRow(
3602 3601
             'SELECT secret, enabled
3603
-            FROM ' . prefixTable('items_otp') . '
3602
+            FROM ' . prefixTable('items_otp').'
3604 3603
             WHERE item_id = %i',
3605 3604
             $inputData['id']
3606 3605
         );
@@ -3682,13 +3681,13 @@  discard block
 block discarded – undo
3682 3681
 
3683 3682
         // Check if user is allowed to access this folder
3684 3683
         if (!in_array($inputData['folderId'], $session->get('user-accessible_folders'))) {
3685
-            echo '[{"error" : "' . $lang->get('error_not_allowed_to') . '"}]';
3684
+            echo '[{"error" : "'.$lang->get('error_not_allowed_to').'"}]';
3686 3685
             break;
3687 3686
         }
3688 3687
 
3689 3688
         // Check if title doesn't contains html codes
3690 3689
         if (preg_match_all('|<[^>]+>(.*)</[^>]+>|U', $title, $out)) {
3691
-            echo '[ { "error" : "' . $lang->get('error_html_codes') . '" } ]';
3690
+            echo '[ { "error" : "'.$lang->get('error_html_codes').'" } ]';
3692 3691
             break;
3693 3692
         }
3694 3693
         // check that title is not numeric
@@ -3699,9 +3698,9 @@  discard block
 block discarded – undo
3699 3698
 
3700 3699
         // Check if duplicate folders name are allowed
3701 3700
         if (isset($SETTINGS['duplicate_folder']) && $SETTINGS['duplicate_folder'] === '0') {
3702
-            $data = DB::queryFirstRow('SELECT id, title FROM ' . prefixTable('nested_tree') . ' WHERE title = %s', $title);
3701
+            $data = DB::queryFirstRow('SELECT id, title FROM '.prefixTable('nested_tree').' WHERE title = %s', $title);
3703 3702
             if (empty($data['id']) === false && $dataReceived['folder'] !== $data['id']) {
3704
-                echo '[ { "error" : "' . $lang->get('error_group_exist') . '" } ]';
3703
+                echo '[ { "error" : "'.$lang->get('error_group_exist').'" } ]';
3705 3704
                 break;
3706 3705
             }
3707 3706
         }
@@ -3709,7 +3708,7 @@  discard block
 block discarded – undo
3709 3708
         // query on folder
3710 3709
         $data = DB::queryFirstRow(
3711 3710
             'SELECT parent_id, personal_folder
3712
-            FROM ' . prefixTable('nested_tree') . '
3711
+            FROM ' . prefixTable('nested_tree').'
3713 3712
             WHERE id = %i',
3714 3713
             $inputData['folderId']
3715 3714
         );
@@ -3719,20 +3718,20 @@  discard block
 block discarded – undo
3719 3718
         if ($session->get('user-admin') !== 1 && $session->get('user-manager') !== 1 && $data['personal_folder'] === '0') {
3720 3719
             $data = DB::queryFirstRow(
3721 3720
                 'SELECT valeur
3722
-                FROM ' . prefixTable('misc') . '
3721
+                FROM ' . prefixTable('misc').'
3723 3722
                 WHERE intitule = %i AND type = %s',
3724 3723
                 $data['parent_id'],
3725 3724
                 'complex'
3726 3725
             );
3727 3726
             if (intval($dataReceived['complexity']) < intval($data['valeur'])) {
3728
-                echo '[ { "error" : "' . $lang->get('error_folder_complexity_lower_than_top_folder') . ' [<b>' . TP_PW_COMPLEXITY[$data['valeur']][1] . '</b>]"} ]';
3727
+                echo '[ { "error" : "'.$lang->get('error_folder_complexity_lower_than_top_folder').' [<b>'.TP_PW_COMPLEXITY[$data['valeur']][1].'</b>]"} ]';
3729 3728
                 break;
3730 3729
             }
3731 3730
         }
3732 3731
 
3733 3732
         // update Folders table
3734 3733
         $tmp = DB::queryFirstRow(
3735
-            'SELECT title, parent_id, personal_folder FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
3734
+            'SELECT title, parent_id, personal_folder FROM '.prefixTable('nested_tree').' WHERE id = %i',
3736 3735
             $dataReceived['folder']
3737 3736
         );
3738 3737
         if ($tmp['parent_id'] !== 0 || $tmp['title'] !== $session->get('user-id') || $tmp['personal_folder'] !== 1) {
@@ -3846,7 +3845,7 @@  discard block
 block discarded – undo
3846 3845
             $uniqueLoadData['path'] = $arr_arbo;
3847 3846
 
3848 3847
             // store last folder accessed in cookie
3849
-            $arr_cookie_options = array (
3848
+            $arr_cookie_options = array(
3850 3849
                 'expires' => time() + TP_ONE_DAY_SECONDS * 5,
3851 3850
                 'path' => '/', 
3852 3851
                 'secure' => true,
@@ -3861,7 +3860,7 @@  discard block
 block discarded – undo
3861 3860
             foreach ($session->get('user-roles_array') as $role) {
3862 3861
                 $roleQ = DB::queryFirstRow(
3863 3862
                     'SELECT allow_pw_change
3864
-                    FROM ' . prefixTable('roles_title') . '
3863
+                    FROM ' . prefixTable('roles_title').'
3865 3864
                     WHERE id = %i',
3866 3865
                     $role
3867 3866
                 );
@@ -3892,11 +3891,11 @@  discard block
 block discarded – undo
3892 3891
                 
3893 3892
                 foreach ($session->get('user-roles_array') as $role) {
3894 3893
                     $access = DB::queryFirstRow(
3895
-                        'SELECT type FROM ' . prefixTable('roles_values') . ' WHERE role_id = %i AND folder_id = %i',
3894
+                        'SELECT type FROM '.prefixTable('roles_values').' WHERE role_id = %i AND folder_id = %i',
3896 3895
                         $role,
3897 3896
                         $inputData['id']
3898 3897
                     );
3899
-                    if (DB::count()>0) {
3898
+                    if (DB::count() > 0) {
3900 3899
                         if ($access['type'] === 'R') {
3901 3900
                             array_push($arrTmp, 10);
3902 3901
                         } elseif ($access['type'] === 'W') {
@@ -3961,7 +3960,7 @@  discard block
 block discarded – undo
3961 3960
             } else {
3962 3961
                 DB::query(
3963 3962
                     'SELECT *
3964
-                    FROM ' . prefixTable('items') . '
3963
+                    FROM ' . prefixTable('items').'
3965 3964
                     WHERE inactif = %i',
3966 3965
                     0
3967 3966
                 );
@@ -3971,7 +3970,7 @@  discard block
 block discarded – undo
3971 3970
 
3972 3971
             // Get folder complexity
3973 3972
             $folderComplexity = DB::queryFirstRow(
3974
-                'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %i',
3973
+                'SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %i',
3975 3974
                 'complex',
3976 3975
                 $inputData['id']
3977 3976
             );
@@ -3983,7 +3982,7 @@  discard block
 block discarded – undo
3983 3982
             if (isset($SETTINGS['item_extra_fields']) && (int) $SETTINGS['item_extra_fields'] === 1) {
3984 3983
                 $folderRow = DB::query(
3985 3984
                     'SELECT id_category
3986
-                    FROM ' . prefixTable('categories_folders') . '
3985
+                    FROM ' . prefixTable('categories_folders').'
3987 3986
                     WHERE id_folder = %i',
3988 3987
                     $inputData['id']
3989 3988
                 );
@@ -4098,15 +4097,15 @@  discard block
 block discarded – undo
4098 4097
             // List all ITEMS
4099 4098
             if ($folderIsPf === false) {
4100 4099
                 $where->add('i.inactif=%i', 0);
4101
-                $sql_e='(SELECT date FROM ' . prefixTable('log_items') 
4100
+                $sql_e = '(SELECT date FROM '.prefixTable('log_items') 
4102 4101
                     . " WHERE action = 'at_creation' AND id_item=i.id " 
4103
-                    . 'union all SELECT date FROM '. prefixTable('log_items') 
4102
+                    . 'union all SELECT date FROM '.prefixTable('log_items') 
4104 4103
                     . " WHERE action = 'at_modification' AND raison = 'at_pw'
4105 4104
                     AND id_item=i.id ORDER BY date DESC LIMIT 1)";
4106 4105
                 $where->add('l.date=%l', $sql_e);
4107 4106
 
4108
-                $query_limit = ' LIMIT ' .
4109
-                    $start . ',' .
4107
+                $query_limit = ' LIMIT '.
4108
+                    $start.','.
4110 4109
                     $post_nb_items_to_display_once;
4111 4110
                 //db::debugmode(true);
4112 4111
                 $rows = DB::query(
@@ -4118,9 +4117,9 @@  discard block
 block discarded – undo
4118 4117
                     l.id_user AS log_user,
4119 4118
                     i.url AS link,
4120 4119
                     i.email AS email
4121
-                    FROM ' . prefixTable('items') . ' AS i
4122
-                    INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (i.id_tree = n.id)
4123
-                    INNER JOIN ' . prefixTable('log_items') . ' AS l ON (i.id = l.id_item)
4120
+                    FROM ' . prefixTable('items').' AS i
4121
+                    INNER JOIN ' . prefixTable('nested_tree').' AS n ON (i.id_tree = n.id)
4122
+                    INNER JOIN ' . prefixTable('log_items').' AS l ON (i.id = l.id_item)
4124 4123
                     WHERE %l
4125 4124
                     GROUP BY i.id, l.date, l.id_user, l.action
4126 4125
                     ORDER BY i.label ASC, l.date DESC' . $query_limit,
@@ -4140,9 +4139,9 @@  discard block
 block discarded – undo
4140 4139
                     l.id_user AS log_user,
4141 4140
                     i.url AS link,
4142 4141
                     i.email AS email
4143
-                    FROM ' . prefixTable('items') . ' AS i
4144
-                    INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (i.id_tree = n.id)
4145
-                    INNER JOIN ' . prefixTable('log_items') . ' AS l ON (i.id = l.id_item)
4142
+                    FROM ' . prefixTable('items').' AS i
4143
+                    INNER JOIN ' . prefixTable('nested_tree').' AS n ON (i.id_tree = n.id)
4144
+                    INNER JOIN ' . prefixTable('log_items').' AS l ON (i.id = l.id_item)
4146 4145
                     WHERE %l
4147 4146
                     GROUP BY i.id, l.date, l.id_user, l.action
4148 4147
                     ORDER BY i.label ASC, l.date DESC',
@@ -4173,7 +4172,7 @@  discard block
 block discarded – undo
4173 4172
                     $item_is_restricted_to_role = false;
4174 4173
                     DB::queryFirstRow(
4175 4174
                         'SELECT role_id
4176
-                        FROM ' . prefixTable('restriction_to_roles') . '
4175
+                        FROM ' . prefixTable('restriction_to_roles').'
4177 4176
                         WHERE item_id = %i',
4178 4177
                         $record['id']
4179 4178
                     );
@@ -4185,7 +4184,7 @@  discard block
 block discarded – undo
4185 4184
                     $user_is_included_in_role = false;
4186 4185
                     DB::query(
4187 4186
                         'SELECT role_id
4188
-                        FROM ' . prefixTable('restriction_to_roles') . '
4187
+                        FROM ' . prefixTable('restriction_to_roles').'
4189 4188
                         WHERE item_id = %i AND role_id IN %ls',
4190 4189
                         $record['id'],
4191 4190
                         $session->get('user-roles_array')
@@ -4395,9 +4394,9 @@  discard block
 block discarded – undo
4395 4394
         if ((int) $start === 0) {
4396 4395
             DB::query(
4397 4396
                 'SELECT i.id
4398
-                FROM ' . prefixTable('items') . ' as i
4399
-                INNER JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree = n.id)
4400
-                INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id = l.id_item)
4397
+                FROM ' . prefixTable('items').' as i
4398
+                INNER JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree = n.id)
4399
+                INNER JOIN ' . prefixTable('log_items').' as l ON (i.id = l.id_item)
4401 4400
                 WHERE %l
4402 4401
                 ORDER BY i.label ASC, l.date DESC',
4403 4402
                 $where
@@ -4462,8 +4461,8 @@  discard block
 block discarded – undo
4462 4461
         $dataItem = DB::queryFirstRow(
4463 4462
             'SELECT i.pw AS pw, s.share_key AS share_key, i.id AS id,
4464 4463
                     i.label AS label, i.id_tree AS id_tree
4465
-            FROM ' . prefixTable('items') . ' AS i
4466
-            INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (s.object_id = i.id)
4464
+            FROM ' . prefixTable('items').' AS i
4465
+            INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (s.object_id = i.id)
4467 4466
             WHERE user_id = %i AND (i.item_key = %s OR i.id = %i)',
4468 4467
             $session->get('user-id'),
4469 4468
             $inputData['itemKey'] ?? '',
@@ -4572,7 +4571,7 @@  discard block
 block discarded – undo
4572 4571
         // do query on this folder
4573 4572
         $data_this_folder = DB::queryFirstRow(
4574 4573
             'SELECT id, personal_folder, title
4575
-            FROM ' . prefixTable('nested_tree') . '
4574
+            FROM ' . prefixTable('nested_tree').'
4576 4575
             WHERE id = %s',
4577 4576
             $inputData['folderId']
4578 4577
         );
@@ -4612,8 +4611,8 @@  discard block
 block discarded – undo
4612 4611
         $visibilite = '';
4613 4612
         $data = DB::queryFirstRow(
4614 4613
             'SELECT m.valeur, n.personal_folder
4615
-            FROM ' . prefixTable('misc') . ' AS m
4616
-            INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (m.intitule = n.id)
4614
+            FROM ' . prefixTable('misc').' AS m
4615
+            INNER JOIN ' . prefixTable('nested_tree').' AS n ON (m.intitule = n.id)
4617 4616
             WHERE type=%s AND intitule = %s',
4618 4617
             'complex',
4619 4618
             $inputData['folderId']
@@ -4626,8 +4625,8 @@  discard block
 block discarded – undo
4626 4625
             // Prepare Item actual visibility (what Users/Roles can see it)
4627 4626
             $rows = DB::query(
4628 4627
                 'SELECT t.title
4629
-                FROM ' . prefixTable('roles_values') . ' as v
4630
-                INNER JOIN ' . prefixTable('roles_title') . ' as t ON (v.role_id = t.id)
4628
+                FROM ' . prefixTable('roles_values').' as v
4629
+                INNER JOIN ' . prefixTable('roles_title').' as t ON (v.role_id = t.id)
4631 4630
                 WHERE v.folder_id = %i
4632 4631
                 GROUP BY title',
4633 4632
                 $inputData['folderId']
@@ -4636,7 +4635,7 @@  discard block
 block discarded – undo
4636 4635
                 if (empty($visibilite)) {
4637 4636
                     $visibilite = $record['title'];
4638 4637
                 } else {
4639
-                    $visibilite .= ' - ' . $record['title'];
4638
+                    $visibilite .= ' - '.$record['title'];
4640 4639
                 }
4641 4640
             }
4642 4641
         } else {
@@ -4646,14 +4645,14 @@  discard block
 block discarded – undo
4646 4645
             // do new query to know if current folder is pf
4647 4646
             $data_pf = DB::queryFirstRow(
4648 4647
                 'SELECT personal_folder
4649
-                FROM ' . prefixTable('nested_tree') . '
4648
+                FROM ' . prefixTable('nested_tree').'
4650 4649
                 WHERE id = %s',
4651 4650
                 $inputData['folderId']
4652 4651
             );
4653 4652
             
4654 4653
             $folder_is_personal = $data_pf !== null ? (int) $data_pf['personal_folder'] : 0;
4655 4654
             
4656
-            $visibilite = $session->get('user-name') . ' ' . $session->get('user-lastname') . ' (' . $session->get('user-login') . ')';
4655
+            $visibilite = $session->get('user-name').' '.$session->get('user-lastname').' ('.$session->get('user-login').')';
4657 4656
         }
4658 4657
 
4659 4658
         recupDroitCreationSansComplexite($inputData['folderId']);
@@ -4663,8 +4662,8 @@  discard block
 block discarded – undo
4663 4662
         $listOptionsForRoles = array();
4664 4663
         $rows = DB::query(
4665 4664
             'SELECT r.role_id AS role_id, t.title AS title
4666
-            FROM ' . prefixTable('roles_values') . ' AS r
4667
-            INNER JOIN ' . prefixTable('roles_title') . ' AS t ON (r.role_id = t.id)
4665
+            FROM ' . prefixTable('roles_values').' AS r
4666
+            INNER JOIN ' . prefixTable('roles_title').' AS t ON (r.role_id = t.id)
4668 4667
             WHERE r.folder_id = %i',
4669 4668
             $inputData['folderId']
4670 4669
         );
@@ -4678,7 +4677,7 @@  discard block
 block discarded – undo
4678 4677
             );
4679 4678
             $rows2 = DB::query(
4680 4679
                 'SELECT id, login, fonction_id, email, name, lastname
4681
-                FROM ' . prefixTable('users') . '
4680
+                FROM ' . prefixTable('users').'
4682 4681
                 WHERE admin = 0 AND fonction_id is not null'
4683 4682
             );
4684 4683
             foreach ($rows2 as $record2) {
@@ -4692,7 +4691,7 @@  discard block
 block discarded – undo
4692 4691
                             array(
4693 4692
                                 'id' => $record2['id'],
4694 4693
                                 'login' => $record2['login'],
4695
-                                'name' => $record2['name'] . ' ' . $record2['lastname'],
4694
+                                'name' => $record2['name'].' '.$record2['lastname'],
4696 4695
                                 'email' => $record2['email'],
4697 4696
                             )
4698 4697
                         );
@@ -4709,13 +4708,13 @@  discard block
 block discarded – undo
4709 4708
                 //db::debugmode(true);
4710 4709
                 $access = DB::queryFirstRow(
4711 4710
                     'SELECT type
4712
-                    FROM ' . prefixTable('roles_values') . '
4711
+                    FROM ' . prefixTable('roles_values').'
4713 4712
                     WHERE role_id = %i AND folder_id = %i',
4714 4713
                     $role,
4715 4714
                     $inputData['folderId']
4716 4715
                 );
4717 4716
                 //db::debugmode(false);
4718
-                if (DB::count()>0) {
4717
+                if (DB::count() > 0) {
4719 4718
                     if ($access['type'] === 'R') {
4720 4719
                         array_push($arrTmp, 10);
4721 4720
                     } elseif ($access['type'] === 'W') {
@@ -4743,7 +4742,7 @@  discard block
 block discarded – undo
4743 4742
             // Check if personal folder is owned by user
4744 4743
             $folder = DB::queryFirstRow(
4745 4744
                 'SELECT id
4746
-                FROM ' . prefixTable('nested_tree') . '
4745
+                FROM ' . prefixTable('nested_tree').'
4747 4746
                 WHERE title = %s',
4748 4747
                 $session->get('user-id'),
4749 4748
             );
@@ -4848,7 +4847,7 @@  discard block
 block discarded – undo
4848 4847
         // Get some info before deleting
4849 4848
         $data = DB::queryFirstRow(
4850 4849
             'SELECT name, id_item, file
4851
-            FROM ' . prefixTable('files') . '
4850
+            FROM ' . prefixTable('files').'
4852 4851
             WHERE id = %i',
4853 4852
             $fileId
4854 4853
         );
@@ -4856,7 +4855,7 @@  discard block
 block discarded – undo
4856 4855
         // Load item data
4857 4856
         $data_item = DB::queryFirstRow(
4858 4857
             'SELECT id_tree
4859
-            FROM ' . prefixTable('items') . '
4858
+            FROM ' . prefixTable('items').'
4860 4859
             WHERE id = %i',
4861 4860
             $data['id_item']
4862 4861
         );
@@ -4886,7 +4885,7 @@  discard block
 block discarded – undo
4886 4885
                 $session->get('user-id'),
4887 4886
                 'at_modification',
4888 4887
                 $session->get('user-login'),
4889
-                'at_del_file : ' . $data['name']
4888
+                'at_del_file : '.$data['name']
4890 4889
             );
4891 4890
 
4892 4891
             // DElete sharekeys
@@ -4897,7 +4896,7 @@  discard block
 block discarded – undo
4897 4896
             );
4898 4897
 
4899 4898
             // Delete file from server
4900
-            $fileToDelete = $SETTINGS['path_to_upload_folder'] . '/' . TP_FILE_PREFIX . base64_decode($data['file']);
4899
+            $fileToDelete = $SETTINGS['path_to_upload_folder'].'/'.TP_FILE_PREFIX.base64_decode($data['file']);
4901 4900
             $fileToDelete = realpath($fileToDelete);
4902 4901
             if ($fileToDelete && strpos($fileToDelete, $SETTINGS['path_to_upload_folder']) === 0) {
4903 4902
                 fileDelete($fileToDelete, $SETTINGS);
@@ -4951,7 +4950,7 @@  discard block
 block discarded – undo
4951 4950
             // Update SESSION with this new favourite
4952 4951
             $data = DB::queryFirstRow(
4953 4952
                 'SELECT label,id_tree
4954
-                FROM ' . prefixTable('items') . '
4953
+                FROM ' . prefixTable('items').'
4955 4954
                 WHERE id = %i',
4956 4955
                 $inputData['itemId']
4957 4956
             );
@@ -4960,7 +4959,7 @@  discard block
 block discarded – undo
4960 4959
                 [
4961 4960
                     $inputData['itemId'] => [
4962 4961
                         'label' => $data['label'],
4963
-                        'url' => 'index.php?page=items&amp;group=' . $data['id_tree'] . '&amp;id=' . $inputData['itemId'],
4962
+                        'url' => 'index.php?page=items&amp;group='.$data['id_tree'].'&amp;id='.$inputData['itemId'],
4964 4963
                     ],
4965 4964
                 ],
4966 4965
                 'add'
@@ -5029,8 +5028,8 @@  discard block
 block discarded – undo
5029 5028
         // get data about item
5030 5029
         $dataSource = DB::queryFirstRow(
5031 5030
             'SELECT i.pw, f.personal_folder,i.id_tree, f.title,i.label
5032
-            FROM ' . prefixTable('items') . ' as i
5033
-            INNER JOIN ' . prefixTable('nested_tree') . ' as f ON (i.id_tree=f.id)
5031
+            FROM ' . prefixTable('items').' as i
5032
+            INNER JOIN ' . prefixTable('nested_tree').' as f ON (i.id_tree=f.id)
5034 5033
             WHERE i.id=%i',
5035 5034
             $inputData['itemId']
5036 5035
         );
@@ -5074,7 +5073,7 @@  discard block
 block discarded – undo
5074 5073
         // get data about new folder
5075 5074
         $dataDestination = DB::queryFirstRow(
5076 5075
             'SELECT personal_folder, title
5077
-            FROM ' . prefixTable('nested_tree') . '
5076
+            FROM ' . prefixTable('nested_tree').'
5078 5077
             WHERE id = %i',
5079 5078
             $inputData['folderId']
5080 5079
         );
@@ -5127,7 +5126,7 @@  discard block
 block discarded – undo
5127 5126
             // Get fields for this Item
5128 5127
             $rows = DB::query(
5129 5128
                 'SELECT id
5130
-                FROM ' . prefixTable('categories_items') . '
5129
+                FROM ' . prefixTable('categories_items').'
5131 5130
                 WHERE item_id = %i',
5132 5131
                 $inputData['itemId']
5133 5132
             );
@@ -5144,7 +5143,7 @@  discard block
 block discarded – undo
5144 5143
             // Get FILES for this Item
5145 5144
             $rows = DB::query(
5146 5145
                 'SELECT id
5147
-                FROM ' . prefixTable('files') . '
5146
+                FROM ' . prefixTable('files').'
5148 5147
                 WHERE id_item = %i',
5149 5148
                 $inputData['itemId']
5150 5149
             );
@@ -5191,7 +5190,7 @@  discard block
 block discarded – undo
5191 5190
             // Get the ITEM object key for the user
5192 5191
             $userKey = DB::queryFirstRow(
5193 5192
                 'SELECT share_key
5194
-                FROM ' . prefixTable('sharekeys_items') . '
5193
+                FROM ' . prefixTable('sharekeys_items').'
5195 5194
                 WHERE user_id = %i AND object_id = %i',
5196 5195
                 $session->get('user-id'),
5197 5196
                 $inputData['itemId']
@@ -5202,7 +5201,7 @@  discard block
 block discarded – undo
5202 5201
                 // This is a public object
5203 5202
                 $users = DB::query(
5204 5203
                     'SELECT id, public_key
5205
-                    FROM ' . prefixTable('users') . '
5204
+                    FROM ' . prefixTable('users').'
5206 5205
                     WHERE id NOT IN %li
5207 5206
                     AND public_key != ""',
5208 5207
                     $tpUsersIDs
@@ -5225,14 +5224,14 @@  discard block
 block discarded – undo
5225 5224
             // Get fields for this Item
5226 5225
             $rows = DB::query(
5227 5226
                 'SELECT id
5228
-                FROM ' . prefixTable('categories_items') . '
5227
+                FROM ' . prefixTable('categories_items').'
5229 5228
                 WHERE item_id = %i',
5230 5229
                 $inputData['itemId']
5231 5230
             );
5232 5231
             foreach ($rows as $field) {
5233 5232
                 $userKey = DB::queryFirstRow(
5234 5233
                     'SELECT share_key
5235
-                    FROM ' . prefixTable('sharekeys_fields') . '
5234
+                    FROM ' . prefixTable('sharekeys_fields').'
5236 5235
                     WHERE user_id = %i AND object_id = %i',
5237 5236
                     $session->get('user-id'),
5238 5237
                     $field['id']
@@ -5243,7 +5242,7 @@  discard block
 block discarded – undo
5243 5242
                     // This is a public object
5244 5243
                     $users = DB::query(
5245 5244
                         'SELECT id, public_key
5246
-                        FROM ' . prefixTable('users') . '
5245
+                        FROM ' . prefixTable('users').'
5247 5246
                         WHERE id NOT IN %li
5248 5247
                         AND public_key != ""',
5249 5248
                         $tpUsersIDs
@@ -5266,14 +5265,14 @@  discard block
 block discarded – undo
5266 5265
             // Get FILES for this Item
5267 5266
             $rows = DB::query(
5268 5267
                 'SELECT id
5269
-                FROM ' . prefixTable('files') . '
5268
+                FROM ' . prefixTable('files').'
5270 5269
                 WHERE id_item = %i',
5271 5270
                 $inputData['itemId']
5272 5271
             );
5273 5272
             foreach ($rows as $attachment) {
5274 5273
                 $userKey = DB::queryFirstRow(
5275 5274
                     'SELECT share_key
5276
-                    FROM ' . prefixTable('sharekeys_files') . '
5275
+                    FROM ' . prefixTable('sharekeys_files').'
5277 5276
                     WHERE user_id = %i AND object_id = %i',
5278 5277
                     $session->get('user-id'),
5279 5278
                     $attachment['id']
@@ -5284,7 +5283,7 @@  discard block
 block discarded – undo
5284 5283
                     // This is a public object
5285 5284
                     $users = DB::query(
5286 5285
                         'SELECT id, public_key
5287
-                        FROM ' . prefixTable('users') . '
5286
+                        FROM ' . prefixTable('users').'
5288 5287
                         WHERE id NOT IN %li
5289 5288
                         AND public_key != ""',
5290 5289
                         $tpUsersIDs
@@ -5325,7 +5324,7 @@  discard block
 block discarded – undo
5325 5324
             $session->get('user-id'),
5326 5325
             'at_modification',
5327 5326
             $session->get('user-login'),
5328
-            'at_moved : ' . $dataSource['title'] . ' -> ' . $dataDestination['title']
5327
+            'at_moved : '.$dataSource['title'].' -> '.$dataDestination['title']
5329 5328
         );
5330 5329
 
5331 5330
         // Update cache table
@@ -5384,8 +5383,8 @@  discard block
 block discarded – undo
5384 5383
                 // get data about item
5385 5384
                 $dataSource = DB::queryFirstRow(
5386 5385
                     'SELECT i.pw, f.personal_folder,i.id_tree, f.title,i.label
5387
-                    FROM ' . prefixTable('items') . ' as i
5388
-                    INNER JOIN ' . prefixTable('nested_tree') . ' as f ON (i.id_tree=f.id)
5386
+                    FROM ' . prefixTable('items').' as i
5387
+                    INNER JOIN ' . prefixTable('nested_tree').' as f ON (i.id_tree=f.id)
5389 5388
                     WHERE i.id=%i',
5390 5389
                     $item_id
5391 5390
                 );
@@ -5407,7 +5406,7 @@  discard block
 block discarded – undo
5407 5406
 
5408 5407
                 // get data about new folder
5409 5408
                 $dataDestination = DB::queryFirstRow(
5410
-                    'SELECT personal_folder, title FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
5409
+                    'SELECT personal_folder, title FROM '.prefixTable('nested_tree').' WHERE id = %i',
5411 5410
                     $inputData['folderId']
5412 5411
                 );
5413 5412
 
@@ -5449,7 +5448,7 @@  discard block
 block discarded – undo
5449 5448
                     // Get fields for this Item
5450 5449
                     $rows = DB::query(
5451 5450
                         'SELECT id
5452
-                        FROM ' . prefixTable('categories_items') . '
5451
+                        FROM ' . prefixTable('categories_items').'
5453 5452
                         WHERE item_id = %i',
5454 5453
                         $item_id
5455 5454
                     );
@@ -5466,7 +5465,7 @@  discard block
 block discarded – undo
5466 5465
                     // Get FILES for this Item
5467 5466
                     $rows = DB::query(
5468 5467
                         'SELECT id
5469
-                        FROM ' . prefixTable('files') . '
5468
+                        FROM ' . prefixTable('files').'
5470 5469
                         WHERE id_item = %i',
5471 5470
                         $item_id
5472 5471
                     );
@@ -5521,7 +5520,7 @@  discard block
 block discarded – undo
5521 5520
                     // Get the ITEM object key for the user
5522 5521
                     $userKey = DB::queryFirstRow(
5523 5522
                         'SELECT share_key
5524
-                        FROM ' . prefixTable('sharekeys_items') . '
5523
+                        FROM ' . prefixTable('sharekeys_items').'
5525 5524
                         WHERE user_id = %i AND object_id = %i',
5526 5525
                         $session->get('user-id'),
5527 5526
                         $item_id
@@ -5532,7 +5531,7 @@  discard block
 block discarded – undo
5532 5531
                         // This is a public object
5533 5532
                         $users = DB::query(
5534 5533
                             'SELECT id, public_key
5535
-                            FROM ' . prefixTable('users') . '
5534
+                            FROM ' . prefixTable('users').'
5536 5535
                             WHERE id NOT IN %li
5537 5536
                             AND public_key != ""',
5538 5537
                             $tpUsersIDs
@@ -5555,14 +5554,14 @@  discard block
 block discarded – undo
5555 5554
                     // Get fields for this Item
5556 5555
                     $rows = DB::query(
5557 5556
                         'SELECT id
5558
-                        FROM ' . prefixTable('categories_items') . '
5557
+                        FROM ' . prefixTable('categories_items').'
5559 5558
                         WHERE item_id = %i',
5560 5559
                         $item_id
5561 5560
                     );
5562 5561
                     foreach ($rows as $field) {
5563 5562
                         $userKey = DB::queryFirstRow(
5564 5563
                             'SELECT share_key
5565
-                            FROM ' . prefixTable('sharekeys_fields') . '
5564
+                            FROM ' . prefixTable('sharekeys_fields').'
5566 5565
                             WHERE user_id = %i AND object_id = %i',
5567 5566
                             $session->get('user-id'),
5568 5567
                             $field['id']
@@ -5573,7 +5572,7 @@  discard block
 block discarded – undo
5573 5572
                             // This is a public object
5574 5573
                             $users = DB::query(
5575 5574
                                 'SELECT id, public_key
5576
-                                FROM ' . prefixTable('users') . '
5575
+                                FROM ' . prefixTable('users').'
5577 5576
                                 WHERE id NOT IN %li
5578 5577
                                 AND public_key != ""',
5579 5578
                                 $tpUsersIDs
@@ -5597,14 +5596,14 @@  discard block
 block discarded – undo
5597 5596
                     // Get FILES for this Item
5598 5597
                     $rows = DB::query(
5599 5598
                         'SELECT id
5600
-                        FROM ' . prefixTable('files') . '
5599
+                        FROM ' . prefixTable('files').'
5601 5600
                         WHERE id_item = %i',
5602 5601
                         $item_id
5603 5602
                     );
5604 5603
                     foreach ($rows as $attachment) {
5605 5604
                         $userKey = DB::queryFirstRow(
5606 5605
                             'SELECT share_key
5607
-                            FROM ' . prefixTable('sharekeys_files') . '
5606
+                            FROM ' . prefixTable('sharekeys_files').'
5608 5607
                             WHERE user_id = %i AND object_id = %i',
5609 5608
                             $session->get('user-id'),
5610 5609
                             $attachment['id']
@@ -5615,7 +5614,7 @@  discard block
 block discarded – undo
5615 5614
                             // This is a public object
5616 5615
                             $users = DB::query(
5617 5616
                                 'SELECT id, public_key
5618
-                                FROM ' . prefixTable('users') . '
5617
+                                FROM ' . prefixTable('users').'
5619 5618
                                 WHERE id NOT IN %li
5620 5619
                                 AND public_key != ""',
5621 5620
                                 $tpUsersIDs
@@ -5655,13 +5654,13 @@  discard block
 block discarded – undo
5655 5654
                     $session->get('user-id'),
5656 5655
                     'at_modification',
5657 5656
                     $session->get('user-login'),
5658
-                    'at_moved : ' . $dataSource['title'] . ' -> ' . $dataDestination['title']
5657
+                    'at_moved : '.$dataSource['title'].' -> '.$dataDestination['title']
5659 5658
                 );
5660 5659
             }
5661 5660
         }
5662 5661
 
5663 5662
         // reload cache table
5664
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
5663
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
5665 5664
         updateCacheTable('reload', null);
5666 5665
 
5667 5666
         echo (string) prepareExchangedData(
@@ -5725,7 +5724,7 @@  discard block
 block discarded – undo
5725 5724
                 // get info
5726 5725
                 $dataSource = DB::queryFirstRow(
5727 5726
                     'SELECT label, id_tree
5728
-                    FROM ' . prefixTable('items') . '
5727
+                    FROM ' . prefixTable('items').'
5729 5728
                     WHERE id=%i',
5730 5729
                     $item_id
5731 5730
                 );
@@ -5826,14 +5825,14 @@  discard block
 block discarded – undo
5826 5825
             // Variables
5827 5826
             $dataAuthor = DB::queryFirstRow(
5828 5827
                 'SELECT email,login
5829
-                FROM ' . prefixTable('users') . '
5828
+                FROM ' . prefixTable('users').'
5830 5829
                 WHERE id = %i',
5831 5830
                 $post_content[1]
5832 5831
             );
5833 5832
 
5834 5833
             $dataItem = DB::queryFirstRow(
5835 5834
                 'SELECT label, id_tree
5836
-                FROM ' . prefixTable('items') . '
5835
+                FROM ' . prefixTable('items').'
5837 5836
                 WHERE id = %i',
5838 5837
                 $post_content[0]
5839 5838
             );
@@ -5850,7 +5849,7 @@  discard block
 block discarded – undo
5850 5849
                 $lang->get('email_request_access_subject'),
5851 5850
                 str_replace(
5852 5851
                     array('#tp_item_author#', '#tp_user#', '#tp_item#'),
5853
-                    array(' ' . addslashes($dataAuthor['login']), addslashes($session->get('user-login')), $path),
5852
+                    array(' '.addslashes($dataAuthor['login']), addslashes($session->get('user-login')), $path),
5854 5853
                     $lang->get('email_request_access_mail')
5855 5854
                 ),
5856 5855
                 $dataAuthor['email'],
@@ -5859,7 +5858,7 @@  discard block
 block discarded – undo
5859 5858
         } elseif ($inputData['cat'] === 'share_this_item') {
5860 5859
             $dataItem = DB::queryFirstRow(
5861 5860
                 'SELECT label,id_tree
5862
-                FROM ' . prefixTable('items') . '
5861
+                FROM ' . prefixTable('items').'
5863 5862
                 WHERE id= %i',
5864 5863
                 $inputData['id']
5865 5864
             );
@@ -5882,7 +5881,7 @@  discard block
 block discarded – undo
5882 5881
                     ),
5883 5882
                     array(
5884 5883
                         empty($SETTINGS['email_server_url']) === false ?
5885
-                            $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'],
5884
+                            $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'],
5886 5885
                         addslashes($session->get('user-login')),
5887 5886
                         addslashes($path),
5888 5887
                     ),
@@ -5931,8 +5930,8 @@  discard block
 block discarded – undo
5931 5930
         // Get all informations for this item
5932 5931
         $dataItem = DB::queryFirstRow(
5933 5932
             'SELECT *
5934
-            FROM ' . prefixTable('items') . ' as i
5935
-            INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
5933
+            FROM ' . prefixTable('items').' as i
5934
+            INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
5936 5935
             WHERE i.id=%i AND l.action = %s',
5937 5936
             $item_id,
5938 5937
             'at_creation'
@@ -5961,18 +5960,18 @@  discard block
 block discarded – undo
5961 5960
                 $session->get('user-login'),
5962 5961
                 htmlspecialchars_decode($label, ENT_QUOTES),
5963 5962
                 null,
5964
-                (string) dateToStamp($date.' '.$time, $SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'])
5963
+                (string) dateToStamp($date.' '.$time, $SETTINGS['date_format'].' '.$SETTINGS['time_format'])
5965 5964
             );
5966 5965
             // Prepare new line
5967 5966
             $data = DB::queryFirstRow(
5968
-                'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i ORDER BY date DESC',
5967
+                'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i ORDER BY date DESC',
5969 5968
                 $item_id
5970 5969
             );
5971
-            $historic = date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $data['date']) . ' - ' . $session->get('user-login') . ' - ' . $lang->get($data['action']) . ' - ' . $data['raison'];
5970
+            $historic = date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $data['date']).' - '.$session->get('user-login').' - '.$lang->get($data['action']).' - '.$data['raison'];
5972 5971
             // send back
5973 5972
             $data = array(
5974 5973
                 'error' => '',
5975
-                'new_line' => '<br>' . addslashes($historic),
5974
+                'new_line' => '<br>'.addslashes($historic),
5976 5975
             );
5977 5976
             echo (string) prepareExchangedData(
5978 5977
                 $data,
@@ -6047,8 +6046,8 @@  discard block
 block discarded – undo
6047 6046
         // Should we log a password change?
6048 6047
         $itemQ = DB::queryFirstRow(
6049 6048
             'SELECT s.share_key, i.pw
6050
-            FROM ' . prefixTable('items') . ' AS i
6051
-            INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (i.id = s.object_id)
6049
+            FROM ' . prefixTable('items').' AS i
6050
+            INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (i.id = s.object_id)
6052 6051
             WHERE s.user_id = %i AND s.object_id = %i',
6053 6052
             $session->get('user-id'),
6054 6053
             $dataReceived['id']
@@ -6103,7 +6102,7 @@  discard block
 block discarded – undo
6103 6102
         if (isset($SETTINGS['otv_expiration_period']) === false) {
6104 6103
             $SETTINGS['otv_expiration_period'] = 7;
6105 6104
         }
6106
-        $url = $SETTINGS['cpassman_url'] . '/index.php?' . http_build_query($otv_session);
6105
+        $url = $SETTINGS['cpassman_url'].'/index.php?'.http_build_query($otv_session);
6107 6106
 
6108 6107
         echo json_encode(
6109 6108
             array(
@@ -6134,7 +6133,7 @@  discard block
 block discarded – undo
6134 6133
         // get parameters from original link
6135 6134
         $url = $dataReceived['original_link'];
6136 6135
         $parts = parse_url($url);
6137
-        if(isset($parts['query'])){
6136
+        if (isset($parts['query'])) {
6138 6137
             parse_str($parts['query'], $orignal_link_parameters);
6139 6138
         } else {
6140 6139
             $orignal_link_parameters = array();
@@ -6165,13 +6164,13 @@  discard block
 block discarded – undo
6165 6164
             $domain_scheme = parse_url($SETTINGS['cpassman_url'], PHP_URL_SCHEME);
6166 6165
             $domain_host = parse_url($SETTINGS['cpassman_url'], PHP_URL_HOST);
6167 6166
             if (str_contains($domain_host, 'www.') === true) {
6168
-                $domain_host = (string) $SETTINGS['otv_subdomain'] . '.' . substr($domain_host, 4);
6167
+                $domain_host = (string) $SETTINGS['otv_subdomain'].'.'.substr($domain_host, 4);
6169 6168
             } else {
6170
-                $domain_host = (string) $SETTINGS['otv_subdomain'] . '.' . $domain_host;
6169
+                $domain_host = (string) $SETTINGS['otv_subdomain'].'.'.$domain_host;
6171 6170
             }
6172
-            $url = $domain_scheme.'://'.$domain_host . '/index.php?'.http_build_query($otv_session);
6171
+            $url = $domain_scheme.'://'.$domain_host.'/index.php?'.http_build_query($otv_session);
6173 6172
         } else {
6174
-            $url = $SETTINGS['cpassman_url'] . '/index.php?'.http_build_query($otv_session);
6173
+            $url = $SETTINGS['cpassman_url'].'/index.php?'.http_build_query($otv_session);
6175 6174
         }
6176 6175
 
6177 6176
         echo (string) prepareExchangedData(
@@ -6206,8 +6205,8 @@  discard block
 block discarded – undo
6206 6205
             'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status,
6207 6206
             f.extension AS extension, f.type AS type,
6208 6207
             s.share_key AS share_key
6209
-            FROM ' . prefixTable('files') . ' AS f
6210
-            INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id)
6208
+            FROM ' . prefixTable('files').' AS f
6209
+            INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id)
6211 6210
             WHERE s.user_id = %i AND s.object_id = %i',
6212 6211
             $session->get('user-id'),
6213 6212
             $inputData['id']
@@ -6228,7 +6227,7 @@  discard block
 block discarded – undo
6228 6227
         //$fileName = basename($file_info['name'], '.'.$file_info['extension']);
6229 6228
 
6230 6229
         // prepare image info
6231
-        $post_title = basename($file_info['name'], '.' . $file_info['extension']);
6230
+        $post_title = basename($file_info['name'], '.'.$file_info['extension']);
6232 6231
         $post_title = isBase64($post_title) === true ? base64_decode($post_title) : $post_title;
6233 6232
         
6234 6233
         // Get image content
@@ -6255,7 +6254,7 @@  discard block
 block discarded – undo
6255 6254
         echo (string) prepareExchangedData(
6256 6255
             array(
6257 6256
                 'error' => false,
6258
-                'filename' => $post_title . '.' . $file_info['extension'],
6257
+                'filename' => $post_title.'.'.$file_info['extension'],
6259 6258
                 'file_type' => $file_info['type'],
6260 6259
                 'file_content' => $fileContent,
6261 6260
             ),
@@ -6369,7 +6368,7 @@  discard block
 block discarded – undo
6369 6368
                     $arbo = $tree->getPath($folder->id, false);
6370 6369
                     $path = '';
6371 6370
                     foreach ($arbo as $elem) {
6372
-                        $path = (empty($path) ? '' : $path . ' / ') . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
6371
+                        $path = (empty($path) ? '' : $path.' / ').htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
6373 6372
                     }
6374 6373
 
6375 6374
                     // Build array
@@ -6438,7 +6437,7 @@  discard block
 block discarded – undo
6438 6437
         if (is_array($foldersArray) === true && $inputData['data'] !== '[null]') {
6439 6438
             $rows = DB::query(
6440 6439
                 'SELECT id, categories
6441
-                FROM ' . prefixTable('nested_tree') . '
6440
+                FROM ' . prefixTable('nested_tree').'
6442 6441
                 WHERE id IN (%l)',
6443 6442
                 implode(',', $foldersArray)
6444 6443
             );
@@ -6480,7 +6479,7 @@  discard block
 block discarded – undo
6480 6479
         // get item info
6481 6480
         $dataItem = DB::queryFirstRow(
6482 6481
             'SELECT *
6483
-            FROM ' . prefixTable('items') . '
6482
+            FROM ' . prefixTable('items').'
6484 6483
             WHERE id=%i',
6485 6484
             $inputData['itemId']
6486 6485
         );
@@ -6492,8 +6491,8 @@  discard block
 block discarded – undo
6492 6491
             'SELECT l.date as date, l.action as action, l.raison as raison,
6493 6492
                 u.login as login, u.avatar_thumb as avatar_thumb, u.name as name, u.lastname as lastname,
6494 6493
                 l.old_value as old_value
6495
-            FROM ' . prefixTable('log_items') . ' as l
6496
-            INNER JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id)
6494
+            FROM ' . prefixTable('log_items').' as l
6495
+            INNER JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id)
6497 6496
             WHERE id_item=%i AND l.action NOT IN (%l)
6498 6497
             ORDER BY date DESC',
6499 6498
             $inputData['itemId'],
@@ -6508,18 +6507,18 @@  discard block
 block discarded – undo
6508 6507
             
6509 6508
             // imported via API
6510 6509
             if (empty($record['login']) === true) {
6511
-                $record['login'] = $lang->get('imported_via_api') . ' [' . $record['raison'] . ']';
6510
+                $record['login'] = $lang->get('imported_via_api').' ['.$record['raison'].']';
6512 6511
             }
6513 6512
             
6514 6513
             // Prepare avatar
6515 6514
             if (isset($record['avatar_thumb']) && empty($record['avatar_thumb']) === false) {
6516
-                if (file_exists($SETTINGS['cpassman_dir'] . '/includes/avatars/' . $record['avatar_thumb'])) {
6517
-                    $avatar = $SETTINGS['cpassman_url'] . '/includes/avatars/' . $record['avatar_thumb'];
6515
+                if (file_exists($SETTINGS['cpassman_dir'].'/includes/avatars/'.$record['avatar_thumb'])) {
6516
+                    $avatar = $SETTINGS['cpassman_url'].'/includes/avatars/'.$record['avatar_thumb'];
6518 6517
                 } else {
6519
-                    $avatar = $SETTINGS['cpassman_url'] . '/includes/images/photo.jpg';
6518
+                    $avatar = $SETTINGS['cpassman_url'].'/includes/images/photo.jpg';
6520 6519
                 }
6521 6520
             } else {
6522
-                $avatar = $SETTINGS['cpassman_url'] . '/includes/images/photo.jpg';
6521
+                $avatar = $SETTINGS['cpassman_url'].'/includes/images/photo.jpg';
6523 6522
             }
6524 6523
 
6525 6524
             // Prepare action
@@ -6539,7 +6538,7 @@  discard block
 block discarded – undo
6539 6538
                         $previous_passwords, 
6540 6539
                         [
6541 6540
                             'password' => htmlentities($previous_pwd['string']),
6542
-                            'date' => date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']),
6541
+                            'date' => date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']),
6543 6542
                         ]
6544 6543
                     );
6545 6544
                 }
@@ -6552,19 +6551,19 @@  discard block
 block discarded – undo
6552 6551
                 $action = $lang->get($reason[0]);
6553 6552
                 if ($reason[0] === 'at_moved') {
6554 6553
                     $tmp = explode(' -> ', $reason[1]);
6555
-                    $detail = $lang->get('from') . ' <span class="font-weight-light">' . $tmp[0] . '</span> ' . $lang->get('to') . ' <span class="font-weight-light">' . $tmp[1] . ' </span>';
6554
+                    $detail = $lang->get('from').' <span class="font-weight-light">'.$tmp[0].'</span> '.$lang->get('to').' <span class="font-weight-light">'.$tmp[1].' </span>';
6556 6555
                 } elseif ($reason[0] === 'at_field') {
6557 6556
                     $tmp = explode(' => ', $reason[1]);
6558 6557
                     if (count($tmp) > 1) {
6559
-                        $detail = '<b>' . trim($tmp[0]) . '</b> | ' . $lang->get('previous_value') .
6560
-                            ': <span class="font-weight-light">' . trim($tmp[1]) . '</span>';
6558
+                        $detail = '<b>'.trim($tmp[0]).'</b> | '.$lang->get('previous_value').
6559
+                            ': <span class="font-weight-light">'.trim($tmp[1]).'</span>';
6561 6560
                     } else {
6562 6561
                         $detail = trim($reason[1]);
6563 6562
                     }
6564 6563
                 } elseif (in_array($reason[0], array('at_restriction', 'at_email', 'at_login', 'at_label', 'at_url', 'at_tag')) === true) {
6565 6564
                     $tmp = explode(' => ', $reason[1]);
6566 6565
                     $detail = empty(trim($tmp[0])) === true ?
6567
-                        $lang->get('no_previous_value') : $lang->get('previous_value') . ': <span class="font-weight-light">' . $tmp[0] . ' </span>';
6566
+                        $lang->get('no_previous_value') : $lang->get('previous_value').': <span class="font-weight-light">'.$tmp[0].' </span>';
6568 6567
                 } elseif ($reason[0] === 'at_automatic_del') {
6569 6568
                     $detail = $lang->get($reason[1]);
6570 6569
                 } elseif ($reason[0] === 'at_anyoneconmodify' || $reason[0] === 'at_otp_status') {
@@ -6573,7 +6572,7 @@  discard block
 block discarded – undo
6573 6572
                     $tmp = explode(':', $reason[1]);
6574 6573
                     $tmp = explode('.', $tmp[0]);
6575 6574
                     $detail = isBase64($tmp[0]) === true ?
6576
-                        base64_decode($tmp[0]) . '.' . $tmp[1] : $tmp[0];
6575
+                        base64_decode($tmp[0]).'.'.$tmp[1] : $tmp[0];
6577 6576
                 } elseif ($reason[0] === 'at_import') {
6578 6577
                     $detail = '';
6579 6578
                 } elseif (in_array($reason[0], array('csv', 'pdf')) === true) {
@@ -6592,8 +6591,8 @@  discard block
 block discarded – undo
6592 6591
                 array(
6593 6592
                     'avatar' => $avatar,
6594 6593
                     'login' => $record['login'],
6595
-                    'name' => $record['name'] . ' ' . $record['lastname'],
6596
-                    'date' => date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']),
6594
+                    'name' => $record['name'].' '.$record['lastname'],
6595
+                    'date' => date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']),
6597 6596
                     'action' => $action,
6598 6597
                     'detail' => $detail,
6599 6598
                 )
@@ -6681,11 +6680,11 @@  discard block
 block discarded – undo
6681 6680
 
6682 6681
         // get some info to add to the notification email
6683 6682
         $resp_user = DB::queryFirstRow(
6684
-            'SELECT login FROM ' . prefixTable('users') . ' WHERE id = %i',
6683
+            'SELECT login FROM '.prefixTable('users').' WHERE id = %i',
6685 6684
             $session->get('user-id')
6686 6685
         );
6687 6686
         $resp_folder = DB::queryFirstRow(
6688
-            'SELECT title FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
6687
+            'SELECT title FROM '.prefixTable('nested_tree').' WHERE id = %i',
6689 6688
             $folder
6690 6689
         );
6691 6690
 
@@ -6694,7 +6693,7 @@  discard block
 block discarded – undo
6694 6693
         $emailService = new EmailService();
6695 6694
         $rows = DB::query(
6696 6695
             'SELECT email
6697
-            FROM ' . prefixTable('users') . '
6696
+            FROM ' . prefixTable('users').'
6698 6697
             WHERE `gestionnaire` = %i AND `email` IS NOT NULL',
6699 6698
             1
6700 6699
         );
@@ -6740,7 +6739,7 @@  discard block
 block discarded – undo
6740 6739
         // Send email
6741 6740
         $dataItem = DB::queryFirstRow(
6742 6741
             'SELECT label, id_tree
6743
-            FROM ' . prefixTable('items') . '
6742
+            FROM ' . prefixTable('items').'
6744 6743
             WHERE id = %i',
6745 6744
             $inputData['itemId']
6746 6745
         );
@@ -6794,7 +6793,7 @@  discard block
 block discarded – undo
6794 6793
 
6795 6794
         DB::query(
6796 6795
             'SELECT *
6797
-            FROM ' . prefixTable('notification') . '
6796
+            FROM ' . prefixTable('notification').'
6798 6797
             WHERE item_id = %i AND user_id = %i',
6799 6798
             $inputData['itemId'],
6800 6799
             $session->get('user-id')
@@ -6866,7 +6865,7 @@  discard block
 block discarded – undo
6866 6865
         // And related logs
6867 6866
         $rows = DB::query(
6868 6867
             'SELECT id, file AS filename
6869
-            FROM ' . prefixTable('files') . '
6868
+            FROM ' . prefixTable('files').'
6870 6869
             WHERE id_item = %i AND confirmed = %i',
6871 6870
             $inputData['itemId'],
6872 6871
             0
@@ -6880,12 +6879,12 @@  discard block
 block discarded – undo
6880 6879
             );
6881 6880
 
6882 6881
             // Delete file on server
6883
-            unlink($SETTINGS['path_to_upload_folder'] . '/' . TP_FILE_PREFIX . base64_decode($file['filename']));
6882
+            unlink($SETTINGS['path_to_upload_folder'].'/'.TP_FILE_PREFIX.base64_decode($file['filename']));
6884 6883
 
6885 6884
             // Delete related logs
6886 6885
             $logFile = DB::query(
6887 6886
                 'SELECT increment_id, raison
6888
-                FROM ' . prefixTable('log_items') . '
6887
+                FROM ' . prefixTable('log_items').'
6889 6888
                 WHERE id_item = %i AND id_user = %i AND action = %s AND raison LIKE "at_add_file :%"',
6890 6889
                 $inputData['itemId'],
6891 6890
                 $session->get('user-id'),
@@ -6944,7 +6943,7 @@  discard block
 block discarded – undo
6944 6943
         // Confirm attachments
6945 6944
         $rows = DB::query(
6946 6945
             'SELECT id, file AS filename
6947
-            FROM ' . prefixTable('files') . '
6946
+            FROM ' . prefixTable('files').'
6948 6947
             WHERE id_item = %i AND confirmed = %i',
6949 6948
             $inputData['itemId'],
6950 6949
             0
@@ -7030,15 +7029,15 @@  discard block
 block discarded – undo
7030 7029
         case 'autocomplete_tags':
7031 7030
             // Get a list off all existing TAGS
7032 7031
             $listOfTags = '';
7033
-            $rows = DB::query('SELECT tag FROM ' . prefixTable('tags') . ' WHERE tag LIKE %ss GROUP BY tag', $inputData['getTerm']);
7032
+            $rows = DB::query('SELECT tag FROM '.prefixTable('tags').' WHERE tag LIKE %ss GROUP BY tag', $inputData['getTerm']);
7034 7033
             foreach ($rows as $record) {
7035 7034
                 if (empty($listOfTags)) {
7036
-                    $listOfTags = '"' . $record['tag'] . '"';
7035
+                    $listOfTags = '"'.$record['tag'].'"';
7037 7036
                 } else {
7038
-                    $listOfTags .= ', "' . $record['tag'] . '"';
7037
+                    $listOfTags .= ', "'.$record['tag'].'"';
7039 7038
                 }
7040 7039
             }
7041
-            echo '[' . $listOfTags . ']';
7040
+            echo '['.$listOfTags.']';
7042 7041
             break;
7043 7042
     }
7044 7043
 }
@@ -7054,7 +7053,7 @@  discard block
 block discarded – undo
7054 7053
 {
7055 7054
     $data = DB::queryFirstRow(
7056 7055
         'SELECT bloquer_creation, bloquer_modification, personal_folder
7057
-        FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
7056
+        FROM ' . prefixTable('nested_tree').' WHERE id = %i',
7058 7057
         $groupe
7059 7058
     );
7060 7059
     // Check if it's in a personal folder. If yes, then force complexity overhead.
@@ -7165,7 +7164,7 @@  discard block
 block discarded – undo
7165 7164
     $now = time();
7166 7165
     $editionLocks = DB::query(
7167 7166
         'SELECT timestamp, user_id, increment_id
7168
-         FROM ' . prefixTable('items_edition') . '
7167
+         FROM ' . prefixTable('items_edition').'
7169 7168
          WHERE item_id = %i 
7170 7169
          ORDER BY increment_id DESC',
7171 7170
         $itemId
@@ -7207,7 +7206,7 @@  discard block
 block discarded – undo
7207 7206
 
7208 7207
         // Delete related background tasks if any
7209 7208
         $task = DB::queryFirstRow(
7210
-            'SELECT increment_id FROM ' . prefixTable('background_tasks') . '
7209
+            'SELECT increment_id FROM '.prefixTable('background_tasks').'
7211 7210
              WHERE item_id = %i AND finished_at = ""',
7212 7211
             $itemId
7213 7212
         );
@@ -7220,7 +7219,7 @@  discard block
 block discarded – undo
7220 7219
         // Check if encryption process is still running
7221 7220
         DB::queryFirstRow(
7222 7221
             'SELECT JSON_EXTRACT(arguments, "$.all_users_except_id") AS all_users_except_id
7223
-             FROM ' . prefixTable('background_tasks') . '
7222
+             FROM ' . prefixTable('background_tasks').'
7224 7223
              WHERE item_id = %i AND finished_at = ""
7225 7224
              ORDER BY increment_id DESC',
7226 7225
             $itemId
@@ -7278,7 +7277,7 @@  discard block
 block discarded – undo
7278 7277
 {
7279 7278
     // Check if there's an ongoing background encryption process for the item
7280 7279
     $ongoingProcess = DB::queryFirstRow(
7281
-        'SELECT 1 FROM ' . prefixTable('background_tasks') . ' WHERE item_id = %i AND finished_at = "" LIMIT 1', 
7280
+        'SELECT 1 FROM '.prefixTable('background_tasks').' WHERE item_id = %i AND finished_at = "" LIMIT 1', 
7282 7281
         $itemId
7283 7282
     );
7284 7283
 
@@ -7296,7 +7295,7 @@  discard block
 block discarded – undo
7296 7295
 function getUserVisibleFolders(int $userId): array
7297 7296
 {
7298 7297
     // Query to retrieve visible folders for the user
7299
-    $data = DB::queryFirstRow('SELECT visible_folders FROM ' . prefixTable('cache_tree') . ' WHERE user_id = %i', $userId);
7298
+    $data = DB::queryFirstRow('SELECT visible_folders FROM '.prefixTable('cache_tree').' WHERE user_id = %i', $userId);
7300 7299
     
7301 7300
     // Decode JSON data into an array; return an empty array if the data is invalid
7302 7301
     return json_decode($data['visible_folders'], true) ?? [];
@@ -7320,7 +7319,7 @@  discard block
 block discarded – undo
7320 7319
 
7321 7320
     // Query the access rights for the given roles and folder
7322 7321
     $accessTypes = DB::queryFirstColumn(
7323
-        'SELECT type FROM ' . prefixTable('roles_values') . ' WHERE role_id IN %ls AND folder_id = %i', 
7322
+        'SELECT type FROM '.prefixTable('roles_values').' WHERE role_id IN %ls AND folder_id = %i', 
7324 7323
         $roles, 
7325 7324
         $treeId
7326 7325
     );
Please login to merge, or discard this patch.
Braces   +12 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1234,7 +1234,9 @@  discard block
 block discarded – undo
1234 1234
                 );
1235 1235
 
1236 1236
                 // Create a task to create sharekeys for users
1237
-                if (WIP=== true) error_log('createTaskForItem - new password for this item - '.$post_password ." -- ". $pw);
1237
+                if (WIP=== true) {
1238
+                    error_log('createTaskForItem - new password for this item - '.$post_password ." -- ". $pw);
1239
+                }
1238 1240
                 $tasksToBePerformed = ['item_password'];
1239 1241
                 $encryptionTaskIsRequested = true;
1240 1242
             } else {
@@ -1550,7 +1552,9 @@  discard block
 block discarded – undo
1550 1552
 
1551 1553
             // create a task for all fields updated
1552 1554
             if ($encryptionTaskIsRequested === true) {
1553
-                if (WIP === true) error_log('createTaskForItem - '.print_r($tasksToBePerformed, true));
1555
+                if (WIP === true) {
1556
+                    error_log('createTaskForItem - '.print_r($tasksToBePerformed, true));
1557
+                }
1554 1558
                 createTaskForItem(
1555 1559
                     'item_update_create_keys',
1556 1560
                     $tasksToBePerformed,
@@ -2051,7 +2055,9 @@  discard block
 block discarded – undo
2051 2055
                 $inputData['itemId']
2052 2056
             );
2053 2057
             foreach ($rows as $record) {
2054
-                if ($record['raison'] === NULL) continue;
2058
+                if ($record['raison'] === NULL) {
2059
+                    continue;
2060
+                }
2055 2061
                 $reason = explode(':', $record['raison']);
2056 2062
                 if (count($reason) > 0) {
2057 2063
                     $sentence = date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) . ' - '
@@ -4753,8 +4759,9 @@  discard block
 block discarded – undo
4753 4759
                 $ids = $tree->getDescendants($folder['id'], true, false, true);
4754 4760
 
4755 4761
                 // This folder is owned by user
4756
-                if (in_array($inputData['folderId'], $ids))
4757
-                    $accessLevel = 30;
4762
+                if (in_array($inputData['folderId'], $ids)) {
4763
+                                    $accessLevel = 30;
4764
+                }
4758 4765
             }
4759 4766
         }
4760 4767
 
Please login to merge, or discard this patch.
sources/folders.queries.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -137,14 +137,14 @@  discard block
 block discarded – undo
137 137
                     && $t->personal_folder == 0
138 138
                 ) {
139 139
                     // get $t->parent_id
140
-                    $data = DB::queryFirstRow('SELECT title FROM ' . prefixTable('nested_tree') . ' WHERE id = %i', $t->parent_id);
140
+                    $data = DB::queryFirstRow('SELECT title FROM '.prefixTable('nested_tree').' WHERE id = %i', $t->parent_id);
141 141
                     if ($t->nlevel == 1) {
142 142
                         $data['title'] = $lang->get('root');
143 143
                     }
144 144
 
145 145
                     // get rights on this folder
146 146
                     $arrayRights = array();
147
-                    $rows = DB::query('SELECT fonction_id  FROM ' . prefixTable('rights') . ' WHERE authorized=%i AND tree_id = %i', 1, $t->id);
147
+                    $rows = DB::query('SELECT fonction_id  FROM '.prefixTable('rights').' WHERE authorized=%i AND tree_id = %i', 1, $t->id);
148 148
                     foreach ($rows as $record) {
149 149
                         array_push($arrayRights, $record['fonction_id']);
150 150
                     }
@@ -162,8 +162,8 @@  discard block
 block discarded – undo
162 162
                         'SELECT m.valeur AS valeur, n.renewal_period AS renewal_period,
163 163
                         n.bloquer_creation AS bloquer_creation, n.bloquer_modification AS bloquer_modification,
164 164
                         n.fa_icon, n.fa_icon_selected
165
-                        FROM ' . prefixTable('misc') . ' AS m,
166
-                        ' . prefixTable('nested_tree') . ' AS n
165
+                        FROM ' . prefixTable('misc').' AS m,
166
+                        ' . prefixTable('nested_tree').' AS n
167 167
                         WHERE m.type=%s AND m.intitule = n.id AND m.intitule = %i',
168 168
                         'complex',
169 169
                         $t->id
@@ -191,16 +191,16 @@  discard block
 block discarded – undo
191 191
                         $arrayColumns['folderComplexity'] = '';
192 192
                     }
193 193
 
194
-                    if (is_null($node_data)=== false) {
194
+                    if (is_null($node_data) === false) {
195 195
                         $arrayColumns['renewalPeriod'] = (int) $node_data['renewal_period'];
196 196
                     } else {
197
-                        $arrayColumns['renewalPeriod']=0;
197
+                        $arrayColumns['renewalPeriod'] = 0;
198 198
                     }
199 199
 
200 200
                     //col7
201 201
                     $data7 = DB::queryFirstRow(
202 202
                         'SELECT bloquer_creation,bloquer_modification
203
-                        FROM ' . prefixTable('nested_tree') . '
203
+                        FROM ' . prefixTable('nested_tree').'
204 204
                         WHERE id = %i',
205 205
                         intval($t->id)
206 206
                     );
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
             // Get info about this folder
359 359
             $dataFolder = DB::queryFirstRow(
360 360
                 'SELECT *
361
-                FROM ' . prefixTable('nested_tree') . '
361
+                FROM ' . prefixTable('nested_tree').'
362 362
                 WHERE id = %i',
363 363
                 $inputData['id']
364 364
             );
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
             //check if parent folder is personal
395 395
             $dataParent = DB::queryFirstRow(
396 396
                 'SELECT personal_folder, bloquer_creation, bloquer_modification
397
-                FROM ' . prefixTable('nested_tree') . '
397
+                FROM ' . prefixTable('nested_tree').'
398 398
                 WHERE id = %i',
399 399
                 $inputData['parentId']
400 400
             );
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
                     // get complexity level for this folder
424 424
                     $data = DB::queryFirstRow(
425 425
                         'SELECT valeur
426
-                        FROM ' . prefixTable('misc') . '
426
+                        FROM ' . prefixTable('misc').'
427 427
                         WHERE intitule = %i AND type = %s',
428 428
                         $inputData['parentId'],
429 429
                         'complex'
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
                             array(
435 435
                                 'error' => true,
436 436
                                 'message' => $lang->get('error_folder_complexity_lower_than_top_folder')
437
-                                    . ' [<b>' . TP_PW_COMPLEXITY[$data['valeur']][1] . '</b>]',
437
+                                    . ' [<b>'.TP_PW_COMPLEXITY[$data['valeur']][1].'</b>]',
438 438
                             ),
439 439
                             'encode'
440 440
                         );
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
             // Check if parent folder is personal
595 595
             $dataParent = DB::queryFirstRow(
596 596
                 'SELECT personal_folder
597
-                FROM ' . prefixTable('nested_tree') . '
597
+                FROM ' . prefixTable('nested_tree').'
598 598
                 WHERE id = %i',
599 599
                 $inputData['parentId']
600 600
             );
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
             echo prepareExchangedData(
635 635
                 array(
636 636
                     'error' => $creationStatus['error'],
637
-                    'message' => $creationStatus['error'] === true ? $lang->get('error_not_allowed_to') : $lang->get('folder_created') ,
637
+                    'message' => $creationStatus['error'] === true ? $lang->get('error_not_allowed_to') : $lang->get('folder_created'),
638 638
                     'newId' => $creationStatus['newId'],
639 639
                 ),
640 640
                 'encode'
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
                 echo prepareExchangedData(
683 683
                     array(
684 684
                         'error' => true,
685
-                        'message' => $lang->get('error_not_allowed_to'). " (You can't delete the root folder)",
685
+                        'message' => $lang->get('error_not_allowed_to')." (You can't delete the root folder)",
686 686
                     ),
687 687
                     'encode'
688 688
                 );
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
             // Ensure that user has access to all folders
693 693
             $foldersAccessible = DB::query(
694 694
                 'SELECT id
695
-                FROM ' . prefixTable('nested_tree') . '
695
+                FROM ' . prefixTable('nested_tree').'
696 696
                 WHERE id IN %li AND id IN %li',
697 697
                 $post_folders,
698 698
                 $session->get('user-accessible_folders')
@@ -706,7 +706,7 @@  discard block
 block discarded – undo
706 706
                 echo prepareExchangedData(
707 707
                     array(
708 708
                         'error' => true,
709
-                        'message' => $lang->get('error_not_allowed_to') . ' (The following folders are not accessible or do not exist: ' . implode(', ', $missingFolders) . ')',
709
+                        'message' => $lang->get('error_not_allowed_to').' (The following folders are not accessible or do not exist: '.implode(', ', $missingFolders).')',
710 710
                     ),
711 711
                     'encode'
712 712
                 );
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
                 // Check if parent folder is personal
724 724
                 $dataParent = DB::queryFirstRow(
725 725
                     'SELECT personal_folder
726
-                    FROM ' . prefixTable('nested_tree') . '
726
+                    FROM ' . prefixTable('nested_tree').'
727 727
                     WHERE id = %i',
728 728
                     $folderId
729 729
                 );
@@ -769,10 +769,10 @@  discard block
 block discarded – undo
769 769
                                 prefixTable('misc'),
770 770
                                 array(
771 771
                                     'type' => 'folder_deleted',
772
-                                    'intitule' => 'f' . $thisSubFolders->id,
773
-                                    'valeur' => $thisSubFolders->id . ', ' . $thisSubFolders->parent_id . ', ' .
774
-                                        $thisSubFolders->title . ', ' . $thisSubFolders->nleft . ', ' . $thisSubFolders->nright . ', ' .
775
-                                        $thisSubFolders->nlevel . ', 0, 0, 0, 0',
772
+                                    'intitule' => 'f'.$thisSubFolders->id,
773
+                                    'valeur' => $thisSubFolders->id.', '.$thisSubFolders->parent_id.', '.
774
+                                        $thisSubFolders->title.', '.$thisSubFolders->nleft.', '.$thisSubFolders->nright.', '.
775
+                                        $thisSubFolders->nlevel.', 0, 0, 0, 0',
776 776
                                     'created_at' => time(),
777 777
                                 )
778 778
                             );
@@ -781,7 +781,7 @@  discard block
 block discarded – undo
781 781
 
782 782
                             //delete items & logs
783 783
                             $itemsInSubFolder = DB::query(
784
-                                'SELECT id FROM ' . prefixTable('items') . ' 
784
+                                'SELECT id FROM '.prefixTable('items').' 
785 785
                                 WHERE id_tree=%i', 
786 786
                                 $thisSubFolders->id
787 787
                             );
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
                                 }
812 812
 
813 813
                                 //Update CACHE table
814
-                                updateCacheTable('delete_value',(int) $item['id']);
814
+                                updateCacheTable('delete_value', (int) $item['id']);
815 815
                             }
816 816
 
817 817
                             //Actualize the variable
@@ -921,7 +921,7 @@  discard block
 block discarded – undo
921 921
             // Check if target parent folder is personal
922 922
             $dataParent = DB::queryFirstRow(
923 923
                 'SELECT personal_folder
924
-                FROM ' . prefixTable('nested_tree') . '
924
+                FROM ' . prefixTable('nested_tree').'
925 925
                 WHERE id = %i',
926 926
                 $post_target_folder_id
927 927
             );
@@ -975,7 +975,7 @@  discard block
 block discarded – undo
975 975
                 // get complexity of current node
976 976
                 $nodeComplexity = DB::queryFirstRow(
977 977
                     'SELECT valeur
978
-                    FROM ' . prefixTable('misc') . '
978
+                    FROM ' . prefixTable('misc').'
979 979
                     WHERE intitule = %i AND type= %s',
980 980
                     $nodeInfo->id,
981 981
                     'complex'
@@ -1052,7 +1052,7 @@  discard block
 block discarded – undo
1052 1052
                 // If it is a subfolder, then give access to it for all roles that allows the parent folder
1053 1053
                 $rows = DB::query(
1054 1054
                     'SELECT role_id, type
1055
-                    FROM ' . prefixTable('roles_values') . '
1055
+                    FROM ' . prefixTable('roles_values').'
1056 1056
                     WHERE folder_id = %i',
1057 1057
                     $parentId
1058 1058
                 );
@@ -1071,7 +1071,7 @@  discard block
 block discarded – undo
1071 1071
                 // if parent folder has Custom Fields Categories then add to this child one too
1072 1072
                 $rows = DB::query(
1073 1073
                     'SELECT id_category
1074
-                    FROM ' . prefixTable('categories_folders') . '
1074
+                    FROM ' . prefixTable('categories_folders').'
1075 1075
                     WHERE id_folder = %i',
1076 1076
                     $nodeInfo->id
1077 1077
                 );
@@ -1090,7 +1090,7 @@  discard block
 block discarded – undo
1090 1090
 
1091 1091
                 $rows = DB::query(
1092 1092
                     'SELECT *
1093
-                    FROM ' . prefixTable('items') . '
1093
+                    FROM ' . prefixTable('items').'
1094 1094
                     WHERE id_tree = %i',
1095 1095
                     $nodeInfo->id
1096 1096
                 );
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 1099
                     // if it is then don't copy it
1100 1100
                     $item_deleted = DB::queryFirstRow(
1101 1101
                         'SELECT *
1102
-                        FROM ' . prefixTable('log_items') . '
1102
+                        FROM ' . prefixTable('log_items').'
1103 1103
                         WHERE id_item = %i AND action = %s
1104 1104
                         ORDER BY date DESC
1105 1105
                         LIMIT 0, 1',
@@ -1110,7 +1110,7 @@  discard block
 block discarded – undo
1110 1110
 
1111 1111
                     $item_restored = DB::queryFirstRow(
1112 1112
                         'SELECT *
1113
-                        FROM ' . prefixTable('log_items') . '
1113
+                        FROM ' . prefixTable('log_items').'
1114 1114
                         WHERE id_item = %i AND action = %s
1115 1115
                         ORDER BY date DESC
1116 1116
                         LIMIT 0, 1',
@@ -1125,7 +1125,7 @@  discard block
 block discarded – undo
1125 1125
                         // Get the ITEM object key for the user
1126 1126
                         $userKey = DB::queryFirstRow(
1127 1127
                             'SELECT share_key
1128
-                            FROM ' . prefixTable('sharekeys_items') . '
1128
+                            FROM ' . prefixTable('sharekeys_items').'
1129 1129
                             WHERE user_id = %i AND object_id = %i',
1130 1130
                             $session->get('user-id'),
1131 1131
                             $record['id']
@@ -1197,7 +1197,7 @@  discard block
 block discarded – undo
1197 1197
                         // Manage Custom Fields
1198 1198
                         $categories = DB::query(
1199 1199
                             'SELECT *
1200
-                            FROM ' . prefixTable('categories_items') . '
1200
+                            FROM ' . prefixTable('categories_items').'
1201 1201
                             WHERE item_id = %i',
1202 1202
                             $record['id']
1203 1203
                         );
@@ -1243,15 +1243,15 @@  discard block
 block discarded – undo
1243 1243
                         $files = DB::query(
1244 1244
                             'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status, f.extension AS extension,
1245 1245
                             f.size AS size, f.type AS type, s.share_key AS share_key
1246
-                            FROM ' . prefixTable('files') . ' AS f
1247
-                            INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id)
1246
+                            FROM ' . prefixTable('files').' AS f
1247
+                            INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id)
1248 1248
                             WHERE s.user_id = %i AND f.id_item = %i',
1249 1249
                             $session->get('user-id'),
1250 1250
                             $record['id']
1251 1251
                         );
1252 1252
                         foreach ($files as $file) {
1253 1253
                             // Check if file still exists
1254
-                            if (file_exists($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . TP_FILE_PREFIX . base64_decode($file['file'])) === true) {
1254
+                            if (file_exists($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.TP_FILE_PREFIX.base64_decode($file['file'])) === true) {
1255 1255
                                 // Step1 - decrypt the file
1256 1256
                                 $fileContent = decryptFile(
1257 1257
                                     $file['file'],
@@ -1272,9 +1272,9 @@  discard block
 block discarded – undo
1272 1272
 
1273 1273
                                 // Step2 - create file
1274 1274
                                 // deepcode ignore InsecureHash: Is not a password, just a random string for a file name
1275
-                                $newFileName = md5(time() . '_' . $file['id']) . '.' . $file['extension'];
1275
+                                $newFileName = md5(time().'_'.$file['id']).'.'.$file['extension'];
1276 1276
 
1277
-                                $outstream = fopen($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . $newFileName, 'ab');
1277
+                                $outstream = fopen($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.$newFileName, 'ab');
1278 1278
                                 if ($outstream === false) {
1279 1279
                                     echo prepareExchangedData(
1280 1280
                                         array(
@@ -1422,7 +1422,7 @@  discard block
 block discarded – undo
1422 1422
                     // Get path
1423 1423
                     $text = '';
1424 1424
                     foreach ($tree->getPath($folder->id, false) as $fld) {
1425
-                        $text .= empty($text) === true ? '     [<i>' . $fld->title : ' > ' . $fld->title;
1425
+                        $text .= empty($text) === true ? '     [<i>'.$fld->title : ' > '.$fld->title;
1426 1426
                     }
1427 1427
 
1428 1428
                     // Save array
@@ -1432,7 +1432,7 @@  discard block
 block discarded – undo
1432 1432
                             'id' => (int) $folder->id,
1433 1433
                             'label' => $folder->title,
1434 1434
                             'level' => $folder->nlevel,
1435
-                            'path' => empty($text) === true ? '' : $text . '</i>]'
1435
+                            'path' => empty($text) === true ? '' : $text.'</i>]'
1436 1436
                         )
1437 1437
                     );
1438 1438
                 }
Please login to merge, or discard this patch.
sources/main.functions.php 1 patch
Spacing   +153 added lines, -155 removed lines patch added patch discarded remove patch
@@ -134,19 +134,19 @@  discard block
 block discarded – undo
134 134
             $text = Crypto::decrypt($message, $key);
135 135
         }
136 136
     } catch (CryptoException\WrongKeyOrModifiedCiphertextException $ex) {
137
-        error_log('TEAMPASS-Error-Wrong key or modified ciphertext: ' . $ex->getMessage());
137
+        error_log('TEAMPASS-Error-Wrong key or modified ciphertext: '.$ex->getMessage());
138 138
         $err = 'wrong_key_or_modified_ciphertext';
139 139
     } catch (CryptoException\BadFormatException $ex) {
140
-        error_log('TEAMPASS-Error-Bad format exception: ' . $ex->getMessage());
140
+        error_log('TEAMPASS-Error-Bad format exception: '.$ex->getMessage());
141 141
         $err = 'bad_format';
142 142
     } catch (CryptoException\EnvironmentIsBrokenException $ex) {
143
-        error_log('TEAMPASS-Error-Environment: ' . $ex->getMessage());
143
+        error_log('TEAMPASS-Error-Environment: '.$ex->getMessage());
144 144
         $err = 'environment_error';
145 145
     } catch (CryptoException\IOException $ex) {
146
-        error_log('TEAMPASS-Error-IO: ' . $ex->getMessage());
146
+        error_log('TEAMPASS-Error-IO: '.$ex->getMessage());
147 147
         $err = 'io_error';
148 148
     } catch (Exception $ex) {
149
-        error_log('TEAMPASS-Error-Unexpected exception: ' . $ex->getMessage());
149
+        error_log('TEAMPASS-Error-Unexpected exception: '.$ex->getMessage());
150 150
         $err = 'unexpected_error';
151 151
     }
152 152
 
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
  */
232 232
 function trimElement($chaine, string $element): string
233 233
 {
234
-    if (! empty($chaine)) {
234
+    if (!empty($chaine)) {
235 235
         if (is_array($chaine) === true) {
236 236
             $chaine = implode(';', $chaine);
237 237
         }
@@ -279,8 +279,8 @@  discard block
 block discarded – undo
279 279
  */
280 280
 function db_error_handler(array $params): void
281 281
 {
282
-    echo 'Error: ' . $params['error'] . "<br>\n";
283
-    echo 'Query: ' . $params['query'] . "<br>\n";
282
+    echo 'Error: '.$params['error']."<br>\n";
283
+    echo 'Query: '.$params['query']."<br>\n";
284 284
     throw new Exception('Error - Query', 1);
285 285
 }
286 286
 
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
     $session->set('user-forbiden_personal_folders', []);
359 359
     
360 360
     // Get list of Folders
361
-    $rows = DB::query('SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', 0);
361
+    $rows = DB::query('SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', 0);
362 362
     foreach ($rows as $record) {
363 363
         array_push($groupesVisibles, $record['id']);
364 364
     }
@@ -368,20 +368,20 @@  discard block
 block discarded – undo
368 368
     // get complete list of ROLES
369 369
     $tmp = explode(';', $idFonctions);
370 370
     $rows = DB::query(
371
-        'SELECT * FROM ' . prefixTable('roles_title') . '
371
+        'SELECT * FROM '.prefixTable('roles_title').'
372 372
         ORDER BY title ASC'
373 373
     );
374 374
     foreach ($rows as $record) {
375
-        if (! empty($record['id']) && ! in_array($record['id'], $tmp)) {
375
+        if (!empty($record['id']) && !in_array($record['id'], $tmp)) {
376 376
             array_push($tmp, $record['id']);
377 377
         }
378 378
     }
379 379
     $session->set('user-roles', implode(';', $tmp));
380 380
     $session->set('user-admin', 1);
381 381
     // Check if admin has created Folders and Roles
382
-    DB::query('SELECT * FROM ' . prefixTable('nested_tree') . '');
382
+    DB::query('SELECT * FROM '.prefixTable('nested_tree').'');
383 383
     $session->set('user-nb_folders', DB::count());
384
-    DB::query('SELECT * FROM ' . prefixTable('roles_title'));
384
+    DB::query('SELECT * FROM '.prefixTable('roles_title'));
385 385
     $session->set('user-nb_roles', DB::count());
386 386
 
387 387
     return true;
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
     // Does this user is allowed to see other items
465 465
     $inc = 0;
466 466
     $rows = DB::query(
467
-        'SELECT id, id_tree FROM ' . prefixTable('items') . '
467
+        'SELECT id, id_tree FROM '.prefixTable('items').'
468 468
             WHERE restricted_to LIKE %ss AND inactif = %s'.
469 469
             (count($allowedFolders) > 0 ? ' AND id_tree NOT IN ('.implode(',', $allowedFolders).')' : ''),
470 470
         $globalsUserId,
@@ -481,8 +481,8 @@  discard block
 block discarded – undo
481 481
     // Check for the users roles if some specific rights exist on items
482 482
     $rows = DB::query(
483 483
         'SELECT i.id_tree, r.item_id
484
-        FROM ' . prefixTable('items') . ' as i
485
-        INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (r.item_id=i.id)
484
+        FROM ' . prefixTable('items').' as i
485
+        INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (r.item_id=i.id)
486 486
         WHERE i.id_tree <> "" '.
487 487
         (count($userRoles) > 0 ? 'AND r.role_id IN %li ' : '').
488 488
         'ORDER BY i.id_tree ASC',
@@ -536,16 +536,16 @@  discard block
 block discarded – undo
536 536
         ), SORT_NUMERIC)
537 537
     );
538 538
     // Folders and Roles numbers
539
-    DB::queryFirstRow('SELECT id FROM ' . prefixTable('nested_tree') . '');
539
+    DB::queryFirstRow('SELECT id FROM '.prefixTable('nested_tree').'');
540 540
     $session->set('user-nb_folders', DB::count());
541
-    DB::queryFirstRow('SELECT id FROM ' . prefixTable('roles_title'));
541
+    DB::queryFirstRow('SELECT id FROM '.prefixTable('roles_title'));
542 542
     $session->set('user-nb_roles', DB::count());
543 543
     // check if change proposals on User's items
544 544
     if (isset($SETTINGS['enable_suggestion']) === true && (int) $SETTINGS['enable_suggestion'] === 1) {
545 545
         $countNewItems = DB::query(
546 546
             'SELECT COUNT(*)
547
-            FROM ' . prefixTable('items_change') . ' AS c
548
-            LEFT JOIN ' . prefixTable('log_items') . ' AS i ON (c.item_id = i.id_item)
547
+            FROM ' . prefixTable('items_change').' AS c
548
+            LEFT JOIN ' . prefixTable('log_items').' AS i ON (c.item_id = i.id_item)
549 549
             WHERE i.action = %s AND i.id_user = %i',
550 550
             'at_creation',
551 551
             $globalsUserId
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
 {
573 573
     $rows = DB::query(
574 574
         'SELECT *
575
-        FROM ' . prefixTable('roles_values') . '
575
+        FROM ' . prefixTable('roles_values').'
576 576
         WHERE type IN %ls'.(count($userRoles) > 0 ? ' AND role_id IN %li' : ''),
577 577
         ['W', 'ND', 'NE', 'NDNE', 'R'],
578 578
         $userRoles,
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
     ) {
640 640
         $persoFld = DB::queryFirstRow(
641 641
             'SELECT id
642
-            FROM ' . prefixTable('nested_tree') . '
642
+            FROM ' . prefixTable('nested_tree').'
643 643
             WHERE title = %s AND personal_folder = %i'.
644 644
             (count($allowedFolders) > 0 ? ' AND id NOT IN ('.implode(',', $allowedFolders).')' : ''),
645 645
             $globalsUserId,
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
     }
673 673
     $persoFlds = DB::query(
674 674
         'SELECT id
675
-        FROM ' . prefixTable('nested_tree') . '
675
+        FROM ' . prefixTable('nested_tree').'
676 676
         WHERE %l',
677 677
         $where
678 678
     );
@@ -740,12 +740,12 @@  discard block
 block discarded – undo
740 740
     //Load Tree
741 741
     $tree = new NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
742 742
     // truncate table
743
-    DB::query('TRUNCATE TABLE ' . prefixTable('cache'));
743
+    DB::query('TRUNCATE TABLE '.prefixTable('cache'));
744 744
     // reload date
745 745
     $rows = DB::query(
746 746
         'SELECT *
747
-        FROM ' . prefixTable('items') . ' as i
748
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
747
+        FROM ' . prefixTable('items').' as i
748
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
749 749
         AND l.action = %s
750 750
         AND i.inactif = %i',
751 751
         'at_creation',
@@ -757,18 +757,18 @@  discard block
 block discarded – undo
757 757
             $tags = '';
758 758
             $itemTags = DB::query(
759 759
                 'SELECT tag
760
-                FROM ' . prefixTable('tags') . '
760
+                FROM ' . prefixTable('tags').'
761 761
                 WHERE item_id = %i AND tag != ""',
762 762
                 $record['id']
763 763
             );
764 764
             foreach ($itemTags as $itemTag) {
765
-                $tags .= $itemTag['tag'] . ' ';
765
+                $tags .= $itemTag['tag'].' ';
766 766
             }
767 767
 
768 768
             // Get renewal period
769 769
             $resNT = DB::queryFirstRow(
770 770
                 'SELECT renewal_period
771
-                FROM ' . prefixTable('nested_tree') . '
771
+                FROM ' . prefixTable('nested_tree').'
772 772
                 WHERE id = %i',
773 773
                 $record['id_tree']
774 774
             );
@@ -781,7 +781,7 @@  discard block
 block discarded – undo
781 781
                     // Is this a User id?
782 782
                     $user = DB::queryFirstRow(
783 783
                         'SELECT id, login
784
-                        FROM ' . prefixTable('users') . '
784
+                        FROM ' . prefixTable('users').'
785 785
                         WHERE id = %i',
786 786
                         $elem->title
787 787
                     );
@@ -799,11 +799,11 @@  discard block
 block discarded – undo
799 799
                     'id' => $record['id'],
800 800
                     'label' => $record['label'],
801 801
                     'description' => $record['description'] ?? '',
802
-                    'url' => isset($record['url']) && ! empty($record['url']) ? $record['url'] : '0',
802
+                    'url' => isset($record['url']) && !empty($record['url']) ? $record['url'] : '0',
803 803
                     'tags' => $tags,
804 804
                     'id_tree' => $record['id_tree'],
805 805
                     'perso' => $record['perso'],
806
-                    'restricted_to' => isset($record['restricted_to']) && ! empty($record['restricted_to']) ? $record['restricted_to'] : '0',
806
+                    'restricted_to' => isset($record['restricted_to']) && !empty($record['restricted_to']) ? $record['restricted_to'] : '0',
807 807
                     'login' => $record['login'] ?? '',
808 808
                     'folder' => implode(' > ', $folder),
809 809
                     'author' => $record['id_user'],
@@ -832,7 +832,7 @@  discard block
 block discarded – undo
832 832
     // get new value from db
833 833
     $data = DB::queryFirstRow(
834 834
         'SELECT label, description, id_tree, perso, restricted_to, login, url
835
-        FROM ' . prefixTable('items') . '
835
+        FROM ' . prefixTable('items').'
836 836
         WHERE id=%i',
837 837
         $ident
838 838
     );
@@ -840,12 +840,12 @@  discard block
 block discarded – undo
840 840
     $tags = '';
841 841
     $itemTags = DB::query(
842 842
         'SELECT tag
843
-            FROM ' . prefixTable('tags') . '
843
+            FROM ' . prefixTable('tags').'
844 844
             WHERE item_id = %i AND tag != ""',
845 845
         $ident
846 846
     );
847 847
     foreach ($itemTags as $itemTag) {
848
-        $tags .= $itemTag['tag'] . ' ';
848
+        $tags .= $itemTag['tag'].' ';
849 849
     }
850 850
     // form id_tree to full foldername
851 851
     $folder = [];
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
             // Is this a User id?
857 857
             $user = DB::queryFirstRow(
858 858
                 'SELECT id, login
859
-                FROM ' . prefixTable('users') . '
859
+                FROM ' . prefixTable('users').'
860 860
                 WHERE id = %i',
861 861
                 $elem->title
862 862
             );
@@ -874,10 +874,10 @@  discard block
 block discarded – undo
874 874
             'label' => $data['label'],
875 875
             'description' => $data['description'],
876 876
             'tags' => $tags,
877
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
877
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
878 878
             'id_tree' => $data['id_tree'],
879 879
             'perso' => $data['perso'],
880
-            'restricted_to' => isset($data['restricted_to']) && ! empty($data['restricted_to']) ? $data['restricted_to'] : '0',
880
+            'restricted_to' => isset($data['restricted_to']) && !empty($data['restricted_to']) ? $data['restricted_to'] : '0',
881 881
             'login' => $data['login'] ?? '',
882 882
             'folder' => implode(' » ', $folder),
883 883
             'author' => $session->get('user-id'),
@@ -907,8 +907,8 @@  discard block
 block discarded – undo
907 907
     // get new value from db
908 908
     $data = DB::queryFirstRow(
909 909
         'SELECT i.label, i.description, i.id_tree as id_tree, i.perso, i.restricted_to, i.id, i.login, i.url, l.date
910
-        FROM ' . prefixTable('items') . ' as i
911
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
910
+        FROM ' . prefixTable('items').' as i
911
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
912 912
         WHERE i.id = %i
913 913
         AND l.action = %s',
914 914
         $ident,
@@ -918,12 +918,12 @@  discard block
 block discarded – undo
918 918
     $tags = '';
919 919
     $itemTags = DB::query(
920 920
         'SELECT tag
921
-            FROM ' . prefixTable('tags') . '
921
+            FROM ' . prefixTable('tags').'
922 922
             WHERE item_id = %i AND tag != ""',
923 923
         $ident
924 924
     );
925 925
     foreach ($itemTags as $itemTag) {
926
-        $tags .= $itemTag['tag'] . ' ';
926
+        $tags .= $itemTag['tag'].' ';
927 927
     }
928 928
     // form id_tree to full foldername
929 929
     $folder = [];
@@ -934,7 +934,7 @@  discard block
 block discarded – undo
934 934
             // Is this a User id?
935 935
             $user = DB::queryFirstRow(
936 936
                 'SELECT id, login
937
-                FROM ' . prefixTable('users') . '
937
+                FROM ' . prefixTable('users').'
938 938
                 WHERE id = %i',
939 939
                 $elem->title
940 940
             );
@@ -953,7 +953,7 @@  discard block
 block discarded – undo
953 953
             'label' => $data['label'],
954 954
             'description' => $data['description'],
955 955
             'tags' => empty($tags) === false ? $tags : 'None',
956
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
956
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
957 957
             'id_tree' => $data['id_tree'],
958 958
             'perso' => isset($data['perso']) && empty($data['perso']) === false && $data['perso'] !== 'None' ? $data['perso'] : '0',
959 959
             'restricted_to' => isset($data['restricted_to']) && empty($data['restricted_to']) === false ? $data['restricted_to'] : '0',
@@ -975,53 +975,53 @@  discard block
 block discarded – undo
975 975
 function getStatisticsData(array $SETTINGS): array
976 976
 {
977 977
     DB::query(
978
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
978
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
979 979
         0
980 980
     );
981 981
     $counter_folders = DB::count();
982 982
     DB::query(
983
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
983
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
984 984
         1
985 985
     );
986 986
     $counter_folders_perso = DB::count();
987 987
     DB::query(
988
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
988
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
989 989
         0
990 990
     );
991 991
     $counter_items = DB::count();
992 992
         DB::query(
993
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
993
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
994 994
         1
995 995
     );
996 996
     $counter_items_perso = DB::count();
997 997
         DB::query(
998
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE login NOT IN (%s, %s, %s)',
998
+        'SELECT id FROM '.prefixTable('users').' WHERE login NOT IN (%s, %s, %s)',
999 999
         'OTV', 'TP', 'API'
1000 1000
     );
1001 1001
     $counter_users = DB::count();
1002 1002
         DB::query(
1003
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE admin = %i',
1003
+        'SELECT id FROM '.prefixTable('users').' WHERE admin = %i',
1004 1004
         1
1005 1005
     );
1006 1006
     $admins = DB::count();
1007 1007
     DB::query(
1008
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE gestionnaire = %i',
1008
+        'SELECT id FROM '.prefixTable('users').' WHERE gestionnaire = %i',
1009 1009
         1
1010 1010
     );
1011 1011
     $managers = DB::count();
1012 1012
     DB::query(
1013
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE read_only = %i',
1013
+        'SELECT id FROM '.prefixTable('users').' WHERE read_only = %i',
1014 1014
         1
1015 1015
     );
1016 1016
     $readOnly = DB::count();
1017 1017
     // list the languages
1018 1018
     $usedLang = [];
1019 1019
     $tp_languages = DB::query(
1020
-        'SELECT name FROM ' . prefixTable('languages')
1020
+        'SELECT name FROM '.prefixTable('languages')
1021 1021
     );
1022 1022
     foreach ($tp_languages as $tp_language) {
1023 1023
         DB::query(
1024
-            'SELECT * FROM ' . prefixTable('users') . ' WHERE user_language = %s',
1024
+            'SELECT * FROM '.prefixTable('users').' WHERE user_language = %s',
1025 1025
             $tp_language['name']
1026 1026
         );
1027 1027
         $usedLang[$tp_language['name']] = round((DB::count() * 100 / $counter_users), 0);
@@ -1030,12 +1030,12 @@  discard block
 block discarded – undo
1030 1030
     // get list of ips
1031 1031
     $usedIp = [];
1032 1032
     $tp_ips = DB::query(
1033
-        'SELECT user_ip FROM ' . prefixTable('users')
1033
+        'SELECT user_ip FROM '.prefixTable('users')
1034 1034
     );
1035 1035
     foreach ($tp_ips as $ip) {
1036 1036
         if (array_key_exists($ip['user_ip'], $usedIp)) {
1037 1037
             $usedIp[$ip['user_ip']] += $usedIp[$ip['user_ip']];
1038
-        } elseif (! empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1038
+        } elseif (!empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1039 1039
             $usedIp[$ip['user_ip']] = 1;
1040 1040
         }
1041 1041
     }
@@ -1130,7 +1130,7 @@  discard block
 block discarded – undo
1130 1130
         <table width="600" cellpadding="0" cellspacing="0" border="0" class="container" bgcolor="#ffffff" style="border-spacing: 0; border-bottom: 1px solid #e0e0e0; box-shadow: 0 0 3px #ddd; color: #434343; font-family: Helvetica, Verdana, sans-serif;">
1131 1131
         <tr><td class="container-padding" bgcolor="#ffffff" style="border-collapse: collapse; border-left: 1px solid #e0e0e0; background-color: #ffffff; padding-left: 30px; padding-right: 30px;">
1132 1132
         <br><div style="float:right;">' .
1133
-        $textMail .
1133
+        $textMail.
1134 1134
         '<br><br></td></tr></table>
1135 1135
     </td></tr></table>
1136 1136
     <br></body></html>';
@@ -1211,7 +1211,7 @@  discard block
 block discarded – undo
1211 1211
 {
1212 1212
     array_walk_recursive(
1213 1213
         $array,
1214
-        static function (&$item): void {
1214
+        static function(&$item): void {
1215 1215
             if (mb_detect_encoding((string) $item, 'utf-8', true) === false) {
1216 1216
                 $item = mb_convert_encoding($item, 'ISO-8859-1', 'UTF-8');
1217 1217
             }
@@ -1322,7 +1322,7 @@  discard block
 block discarded – undo
1322 1322
  */
1323 1323
 function prefixTable(string $table): string
1324 1324
 {
1325
-    $safeTable = htmlspecialchars(DB_PREFIX . $table);
1325
+    $safeTable = htmlspecialchars(DB_PREFIX.$table);
1326 1326
     return $safeTable;
1327 1327
 }
1328 1328
 
@@ -1439,7 +1439,7 @@  discard block
 block discarded – undo
1439 1439
 function send_syslog($message, $host, $port, $component = 'teampass'): void
1440 1440
 {
1441 1441
     $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
1442
-    $syslog_message = '<123>' . date('M d H:i:s ') . $component . ': ' . $message;
1442
+    $syslog_message = '<123>'.date('M d H:i:s ').$component.': '.$message;
1443 1443
     socket_sendto($sock, (string) $syslog_message, strlen($syslog_message), 0, (string) $host, (int) $port);
1444 1444
     socket_close($sock);
1445 1445
 }
@@ -1486,14 +1486,14 @@  discard block
 block discarded – undo
1486 1486
     if (isset($SETTINGS['syslog_enable']) === true && (int) $SETTINGS['syslog_enable'] === 1) {
1487 1487
         if ($type === 'user_mngt') {
1488 1488
             send_syslog(
1489
-                'action=' . str_replace('at_', '', $label) . ' attribute=user user=' . $who . ' userid="' . $login . '" change="' . $field_1 . '" ',
1489
+                'action='.str_replace('at_', '', $label).' attribute=user user='.$who.' userid="'.$login.'" change="'.$field_1.'" ',
1490 1490
                 $SETTINGS['syslog_host'],
1491 1491
                 $SETTINGS['syslog_port'],
1492 1492
                 'teampass'
1493 1493
             );
1494 1494
         } else {
1495 1495
             send_syslog(
1496
-                'action=' . $type . ' attribute=' . $label . ' user=' . $who . ' userid="' . $login . '" ',
1496
+                'action='.$type.' attribute='.$label.' user='.$who.' userid="'.$login.'" ',
1497 1497
                 $SETTINGS['syslog_host'],
1498 1498
                 $SETTINGS['syslog_port'],
1499 1499
                 'teampass'
@@ -1568,7 +1568,7 @@  discard block
 block discarded – undo
1568 1568
         if (empty($item_label) === true) {
1569 1569
             $dataItem = DB::queryFirstRow(
1570 1570
                 'SELECT id, id_tree, label
1571
-                FROM ' . prefixTable('items') . '
1571
+                FROM ' . prefixTable('items').'
1572 1572
                 WHERE id = %i',
1573 1573
                 $item_id
1574 1574
             );
@@ -1576,11 +1576,11 @@  discard block
 block discarded – undo
1576 1576
         }
1577 1577
 
1578 1578
         send_syslog(
1579
-            'action=' . str_replace('at_', '', $action) .
1580
-                ' attribute=' . str_replace('at_', '', $attribute[0]) .
1581
-                ' itemno=' . $item_id .
1582
-                ' user=' . (is_null($login) === true ? '' : addslashes((string) $login)) .
1583
-                ' itemname="' . addslashes($item_label) . '"',
1579
+            'action='.str_replace('at_', '', $action).
1580
+                ' attribute='.str_replace('at_', '', $attribute[0]).
1581
+                ' itemno='.$item_id.
1582
+                ' user='.(is_null($login) === true ? '' : addslashes((string) $login)).
1583
+                ' itemname="'.addslashes($item_label).'"',
1584 1584
             $SETTINGS['syslog_host'],
1585 1585
             $SETTINGS['syslog_port'],
1586 1586
             'teampass'
@@ -1611,8 +1611,8 @@  discard block
 block discarded – undo
1611 1611
     // send email to user that what to be notified
1612 1612
     $notification = DB::queryFirstField(
1613 1613
         'SELECT email
1614
-        FROM ' . prefixTable('notification') . ' AS n
1615
-        INNER JOIN ' . prefixTable('users') . ' AS u ON (n.user_id = u.id)
1614
+        FROM ' . prefixTable('notification').' AS n
1615
+        INNER JOIN ' . prefixTable('users').' AS u ON (n.user_id = u.id)
1616 1616
         WHERE n.item_id = %i AND n.user_id != %i',
1617 1617
         $item_id,
1618 1618
         $globalsUserId
@@ -1623,7 +1623,7 @@  discard block
 block discarded – undo
1623 1623
         // Get list of changes
1624 1624
         $htmlChanges = '<ul>';
1625 1625
         foreach ($changes as $change) {
1626
-            $htmlChanges .= '<li>' . $change . '</li>';
1626
+            $htmlChanges .= '<li>'.$change.'</li>';
1627 1627
         }
1628 1628
         $htmlChanges .= '</ul>';
1629 1629
         // send email
@@ -1660,15 +1660,15 @@  discard block
 block discarded – undo
1660 1660
     $path = '';
1661 1661
     foreach ($arbo as $elem) {
1662 1662
         if (empty($path) === true) {
1663
-            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' ';
1663
+            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' ';
1664 1664
         } else {
1665
-            $path .= '&#8594; ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1665
+            $path .= '&#8594; '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1666 1666
         }
1667 1667
     }
1668 1668
 
1669 1669
     // Build text to show user
1670 1670
     if (empty($label) === false) {
1671
-        return empty($path) === true ? addslashes($label) : addslashes($label) . ' (' . $path . ')';
1671
+        return empty($path) === true ? addslashes($label) : addslashes($label).' ('.$path.')';
1672 1672
     }
1673 1673
     return empty($path) === true ? '' : $path;
1674 1674
 }
@@ -1724,7 +1724,7 @@  discard block
 block discarded – undo
1724 1724
 {
1725 1725
     // Perform a copy if the file exists
1726 1726
     if (file_exists($configFilePath)) {
1727
-        $backupFilePath = $configFilePath . '.' . date('Y_m_d_His', time());
1727
+        $backupFilePath = $configFilePath.'.'.date('Y_m_d_His', time());
1728 1728
         if (!copy($configFilePath, $backupFilePath)) {
1729 1729
             return "ERROR: Could not copy file '$configFilePath'";
1730 1730
         }
@@ -1732,10 +1732,10 @@  discard block
 block discarded – undo
1732 1732
 
1733 1733
     // Regenerate the config file
1734 1734
     $data = ["<?php\n", "global \$SETTINGS;\n", "\$SETTINGS = array (\n"];
1735
-    $rows = DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s', 'admin');
1735
+    $rows = DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type=%s', 'admin');
1736 1736
     foreach ($rows as $record) {
1737 1737
         $value = getEncryptedValue($record['valeur'], $record['is_encrypted']);
1738
-        $data[] = "    '{$record['intitule']}' => '". htmlspecialchars_decode($value, ENT_COMPAT) . "',\n";
1738
+        $data[] = "    '{$record['intitule']}' => '".htmlspecialchars_decode($value, ENT_COMPAT)."',\n";
1739 1739
     }
1740 1740
     $data[] = ");\n";
1741 1741
     $data = array_unique($data);
@@ -1780,7 +1780,7 @@  discard block
 block discarded – undo
1780 1780
 {
1781 1781
     global $SETTINGS;
1782 1782
     /* LOAD CPASSMAN SETTINGS */
1783
-    if (! isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
1783
+    if (!isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
1784 1784
         $SETTINGS = [];
1785 1785
         $SETTINGS['duplicate_folder'] = 0;
1786 1786
         //by default, this is set to 0;
@@ -1790,7 +1790,7 @@  discard block
 block discarded – undo
1790 1790
         //by default, this value is set to 5;
1791 1791
         $settings = [];
1792 1792
         $rows = DB::query(
1793
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s_type OR type=%s_type2',
1793
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s_type OR type=%s_type2',
1794 1794
             [
1795 1795
                 'type' => 'admin',
1796 1796
                 'type2' => 'settings',
@@ -1822,7 +1822,7 @@  discard block
 block discarded – undo
1822 1822
     $source_cf = [];
1823 1823
     $rows = DB::query(
1824 1824
         'SELECT id_category
1825
-            FROM ' . prefixTable('categories_folders') . '
1825
+            FROM ' . prefixTable('categories_folders').'
1826 1826
             WHERE id_folder = %i',
1827 1827
         $source_id
1828 1828
     );
@@ -1833,7 +1833,7 @@  discard block
 block discarded – undo
1833 1833
     $target_cf = [];
1834 1834
     $rows = DB::query(
1835 1835
         'SELECT id_category
1836
-            FROM ' . prefixTable('categories_folders') . '
1836
+            FROM ' . prefixTable('categories_folders').'
1837 1837
             WHERE id_folder = %i',
1838 1838
         $target_id
1839 1839
     );
@@ -1928,10 +1928,10 @@  discard block
 block discarded – undo
1928 1928
     } catch (CryptoException\WrongKeyOrModifiedCiphertextException $ex) {
1929 1929
         $err = 'wrong_key';
1930 1930
     } catch (CryptoException\EnvironmentIsBrokenException $ex) {
1931
-        error_log('TEAMPASS-Error-Environment: ' . $ex->getMessage());
1931
+        error_log('TEAMPASS-Error-Environment: '.$ex->getMessage());
1932 1932
         $err = 'environment_error';
1933 1933
     } catch (CryptoException\IOException $ex) {
1934
-        error_log('TEAMPASS-Error-General: ' . $ex->getMessage());
1934
+        error_log('TEAMPASS-Error-General: '.$ex->getMessage());
1935 1935
         $err = 'general_error';
1936 1936
     }
1937 1937
 
@@ -1964,10 +1964,10 @@  discard block
 block discarded – undo
1964 1964
     } catch (CryptoException\WrongKeyOrModifiedCiphertextException $ex) {
1965 1965
         $err = 'wrong_key';
1966 1966
     } catch (CryptoException\EnvironmentIsBrokenException $ex) {
1967
-        error_log('TEAMPASS-Error-Environment: ' . $ex->getMessage());
1967
+        error_log('TEAMPASS-Error-Environment: '.$ex->getMessage());
1968 1968
         $err = 'environment_error';
1969 1969
     } catch (CryptoException\IOException $ex) {
1970
-        error_log('TEAMPASS-Error-General: ' . $ex->getMessage());
1970
+        error_log('TEAMPASS-Error-General: '.$ex->getMessage());
1971 1971
         $err = 'general_error';
1972 1972
     }
1973 1973
 
@@ -2053,7 +2053,7 @@  discard block
 block discarded – undo
2053 2053
 ) {
2054 2054
     // Check if the path exists
2055 2055
     $path = basename($path);
2056
-    if (! file_exists($path)) {
2056
+    if (!file_exists($path)) {
2057 2057
         return false;
2058 2058
     }
2059 2059
 
@@ -2106,7 +2106,7 @@  discard block
 block discarded – undo
2106 2106
     // Load item data
2107 2107
     $data = DB::queryFirstRow(
2108 2108
         'SELECT id_tree
2109
-        FROM ' . prefixTable('items') . '
2109
+        FROM ' . prefixTable('items').'
2110 2110
         WHERE id = %i',
2111 2111
         $item_id
2112 2112
     );
@@ -2169,7 +2169,7 @@  discard block
 block discarded – undo
2169 2169
         }
2170 2170
         $host .= substr(explode(".", $email[1])[0], -1, 1);
2171 2171
     }
2172
-    $email = $name . "@" . $host . "." . explode(".", $email[1])[1];
2172
+    $email = $name."@".$host.".".explode(".", $email[1])[1];
2173 2173
     return $email;
2174 2174
 }
2175 2175
 
@@ -2200,11 +2200,11 @@  discard block
 block discarded – undo
2200 2200
 function formatSizeUnits(int $bytes): string
2201 2201
 {
2202 2202
     if ($bytes >= 1073741824) {
2203
-        $bytes = number_format($bytes / 1073741824, 2) . ' GB';
2203
+        $bytes = number_format($bytes / 1073741824, 2).' GB';
2204 2204
     } elseif ($bytes >= 1048576) {
2205
-        $bytes = number_format($bytes / 1048576, 2) . ' MB';
2205
+        $bytes = number_format($bytes / 1048576, 2).' MB';
2206 2206
     } elseif ($bytes >= 1024) {
2207
-        $bytes = number_format($bytes / 1024, 2) . ' KB';
2207
+        $bytes = number_format($bytes / 1024, 2).' KB';
2208 2208
     } elseif ($bytes > 1) {
2209 2209
         $bytes .= ' bytes';
2210 2210
     } elseif ($bytes === 1) {
@@ -2453,7 +2453,7 @@  discard block
 block discarded – undo
2453 2453
     $cipher->enableContinuousBuffer();
2454 2454
 
2455 2455
     // Encrypt the file content
2456
-    $filePath = filter_var($fileInPath . '/' . $fileInName, FILTER_SANITIZE_URL);
2456
+    $filePath = filter_var($fileInPath.'/'.$fileInName, FILTER_SANITIZE_URL);
2457 2457
     $fileContent = file_get_contents($filePath);
2458 2458
     $plaintext = $fileContent;
2459 2459
     $ciphertext = $cipher->encrypt($plaintext);
@@ -2461,9 +2461,9 @@  discard block
 block discarded – undo
2461 2461
     // Save new file
2462 2462
     // deepcode ignore InsecureHash: is simply used to get a unique name
2463 2463
     $hash = uniqid('', true);
2464
-    $fileOut = $fileInPath . '/' . TP_FILE_PREFIX . $hash;
2464
+    $fileOut = $fileInPath.'/'.TP_FILE_PREFIX.$hash;
2465 2465
     file_put_contents($fileOut, $ciphertext);
2466
-    unlink($fileInPath . '/' . $fileInName);
2466
+    unlink($fileInPath.'/'.$fileInName);
2467 2467
     return [
2468 2468
         'fileHash' => base64_encode($hash),
2469 2469
         'objectKey' => base64_encode($objectKey),
@@ -2479,9 +2479,9 @@  discard block
 block discarded – undo
2479 2479
  *
2480 2480
  * @return string|array
2481 2481
  */
2482
-function decryptFile(string $fileName, string $filePath, string $key): string|array
2482
+function decryptFile(string $fileName, string $filePath, string $key): string | array
2483 2483
 {
2484
-    if (! defined('FILE_BUFFER_SIZE')) {
2484
+    if (!defined('FILE_BUFFER_SIZE')) {
2485 2485
         define('FILE_BUFFER_SIZE', 128 * 1024);
2486 2486
     }
2487 2487
     
@@ -2498,7 +2498,7 @@  discard block
 block discarded – undo
2498 2498
     $cipher->enableContinuousBuffer();
2499 2499
     $cipher->disablePadding();
2500 2500
     // Get file content
2501
-    $safeFilePath = realpath($filePath . '/' . TP_FILE_PREFIX . $safeFileName);
2501
+    $safeFilePath = realpath($filePath.'/'.TP_FILE_PREFIX.$safeFileName);
2502 2502
     if ($safeFilePath !== false && file_exists($safeFilePath)) {
2503 2503
         $ciphertext = file_get_contents(filter_var($safeFilePath, FILTER_SANITIZE_URL));
2504 2504
     } else {
@@ -2594,7 +2594,7 @@  discard block
 block discarded – undo
2594 2594
         // Only create the sharekey for a user
2595 2595
         $user = DB::queryFirstRow(
2596 2596
             'SELECT public_key
2597
-            FROM ' . prefixTable('users') . '
2597
+            FROM ' . prefixTable('users').'
2598 2598
             WHERE id = %i
2599 2599
             AND public_key != ""',
2600 2600
             $userId
@@ -2635,7 +2635,7 @@  discard block
 block discarded – undo
2635 2635
         }
2636 2636
         $users = DB::query(
2637 2637
             'SELECT id, public_key
2638
-            FROM ' . prefixTable('users') . '
2638
+            FROM ' . prefixTable('users').'
2639 2639
             WHERE id NOT IN %li
2640 2640
             AND public_key != ""',
2641 2641
             $user_ids
@@ -2644,7 +2644,7 @@  discard block
 block discarded – undo
2644 2644
         foreach ($users as $user) {
2645 2645
             // Insert in DB the new object key for this item by user
2646 2646
             if (count($objectKeyArray) === 0) {
2647
-                if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case1 - ' . $object_name . ' - ' . $post_object_id . ' - ' . $user['id'] . ' - ' . $objectKey);
2647
+                if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case1 - '.$object_name.' - '.$post_object_id.' - '.$user['id'].' - '.$objectKey);
2648 2648
                 DB::insert(
2649 2649
                     $object_name,
2650 2650
                     [
@@ -2658,7 +2658,7 @@  discard block
 block discarded – undo
2658 2658
                 );
2659 2659
             } else {
2660 2660
                 foreach ($objectKeyArray as $object) {
2661
-                    if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case2 - ' . $object_name . ' - ' . $object['objectId'] . ' - ' . $user['id'] . ' - ' . $object['objectKey']);
2661
+                    if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case2 - '.$object_name.' - '.$object['objectId'].' - '.$user['id'].' - '.$object['objectKey']);
2662 2662
                     DB::insert(
2663 2663
                         $object_name,
2664 2664
                         [
@@ -2686,7 +2686,7 @@  discard block
 block discarded – undo
2686 2686
 function isBase64(string $str): bool
2687 2687
 {
2688 2688
     $str = (string) trim($str);
2689
-    if (! isset($str[0])) {
2689
+    if (!isset($str[0])) {
2690 2690
         return false;
2691 2691
     }
2692 2692
 
@@ -2760,7 +2760,7 @@  discard block
 block discarded – undo
2760 2760
     } catch (\LdapRecord\Auth\BindException $e) {
2761 2761
         $error = $e->getDetailedError();
2762 2762
         if ($error && defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) {
2763
-            error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage(). " - ".$error->getDiagnosticMessage());
2763
+            error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage()." - ".$error->getDiagnosticMessage());
2764 2764
         }
2765 2765
         // deepcode ignore ServerLeak: No important data is sent
2766 2766
         echo 'An error occurred.';
@@ -2777,7 +2777,7 @@  discard block
 block discarded – undo
2777 2777
     } catch (\LdapRecord\Auth\BindException $e) {
2778 2778
         $error = $e->getDetailedError();
2779 2779
         if ($error && defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) {
2780
-            error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage(). " - ".$error->getDiagnosticMessage());
2780
+            error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage()." - ".$error->getDiagnosticMessage());
2781 2781
         }
2782 2782
         // deepcode ignore ServerLeak: No important data is sent
2783 2783
         echo 'An error occurred.';
@@ -2804,7 +2804,7 @@  discard block
 block discarded – undo
2804 2804
     // expect if personal item
2805 2805
     DB::delete(
2806 2806
         prefixTable('sharekeys_items'),
2807
-        'user_id = %i AND object_id NOT IN (SELECT i.id FROM ' . prefixTable('items') . ' AS i WHERE i.perso = 1)',
2807
+        'user_id = %i AND object_id NOT IN (SELECT i.id FROM '.prefixTable('items').' AS i WHERE i.perso = 1)',
2808 2808
         $userId
2809 2809
     );
2810 2810
     // Remove all item sharekeys files
@@ -2812,8 +2812,8 @@  discard block
 block discarded – undo
2812 2812
         prefixTable('sharekeys_files'),
2813 2813
         'user_id = %i AND object_id NOT IN (
2814 2814
             SELECT f.id 
2815
-            FROM ' . prefixTable('items') . ' AS i 
2816
-            INNER JOIN ' . prefixTable('files') . ' AS f ON f.id_item = i.id
2815
+            FROM ' . prefixTable('items').' AS i 
2816
+            INNER JOIN ' . prefixTable('files').' AS f ON f.id_item = i.id
2817 2817
             WHERE i.perso = 1
2818 2818
         )',
2819 2819
         $userId
@@ -2823,8 +2823,8 @@  discard block
 block discarded – undo
2823 2823
         prefixTable('sharekeys_fields'),
2824 2824
         'user_id = %i AND object_id NOT IN (
2825 2825
             SELECT c.id 
2826
-            FROM ' . prefixTable('items') . ' AS i 
2827
-            INNER JOIN ' . prefixTable('categories_items') . ' AS c ON c.item_id = i.id
2826
+            FROM ' . prefixTable('items').' AS i 
2827
+            INNER JOIN ' . prefixTable('categories_items').' AS c ON c.item_id = i.id
2828 2828
             WHERE i.perso = 1
2829 2829
         )',
2830 2830
         $userId
@@ -2832,13 +2832,13 @@  discard block
 block discarded – undo
2832 2832
     // Remove all item sharekeys logs
2833 2833
     DB::delete(
2834 2834
         prefixTable('sharekeys_logs'),
2835
-        'user_id = %i AND object_id NOT IN (SELECT i.id FROM ' . prefixTable('items') . ' AS i WHERE i.perso = 1)',
2835
+        'user_id = %i AND object_id NOT IN (SELECT i.id FROM '.prefixTable('items').' AS i WHERE i.perso = 1)',
2836 2836
         $userId
2837 2837
     );
2838 2838
     // Remove all item sharekeys suggestions
2839 2839
     DB::delete(
2840 2840
         prefixTable('sharekeys_suggestions'),
2841
-        'user_id = %i AND object_id NOT IN (SELECT i.id FROM ' . prefixTable('items') . ' AS i WHERE i.perso = 1)',
2841
+        'user_id = %i AND object_id NOT IN (SELECT i.id FROM '.prefixTable('items').' AS i WHERE i.perso = 1)',
2842 2842
         $userId
2843 2843
     );
2844 2844
     return false;
@@ -2859,7 +2859,7 @@  discard block
 block discarded – undo
2859 2859
         foreach (DateTimeZone::listIdentifiers() as $timezone) {
2860 2860
             $now->setTimezone(new DateTimeZone($timezone));
2861 2861
             $offsets[] = $offset = $now->getOffset();
2862
-            $timezones[$timezone] = '(' . format_GMT_offset($offset) . ') ' . format_timezone_name($timezone);
2862
+            $timezones[$timezone] = '('.format_GMT_offset($offset).') '.format_timezone_name($timezone);
2863 2863
         }
2864 2864
 
2865 2865
         array_multisort($offsets, $timezones);
@@ -2879,7 +2879,7 @@  discard block
 block discarded – undo
2879 2879
 {
2880 2880
     $hours = intval($offset / 3600);
2881 2881
     $minutes = abs(intval($offset % 3600 / 60));
2882
-    return 'GMT' . ($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
2882
+    return 'GMT'.($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
2883 2883
 }
2884 2884
 
2885 2885
 /**
@@ -2978,8 +2978,7 @@  discard block
 block discarded – undo
2978 2978
 {
2979 2979
     if (isset($array[$key]) === true
2980 2980
         && (is_int($value) === true ?
2981
-            (int) $array[$key] === $value :
2982
-            (string) $array[$key] === $value)
2981
+            (int) $array[$key] === $value : (string) $array[$key] === $value)
2983 2982
     ) {
2984 2983
         return true;
2985 2984
     }
@@ -3001,8 +3000,7 @@  discard block
 block discarded – undo
3001 3000
 {
3002 3001
     if (isset($var) === false
3003 3002
         || (is_int($value) === true ?
3004
-            (int) $var === $value :
3005
-            (string) $var === $value)
3003
+            (int) $var === $value : (string) $var === $value)
3006 3004
     ) {
3007 3005
         return true;
3008 3006
     }
@@ -3053,7 +3051,7 @@  discard block
 block discarded – undo
3053 3051
  */
3054 3052
 function isSetArrayOfValues(array $arrayOfValues): bool
3055 3053
 {
3056
-    foreach($arrayOfValues as $value) {
3054
+    foreach ($arrayOfValues as $value) {
3057 3055
         if (isset($value) === false) {
3058 3056
             return false;
3059 3057
         }
@@ -3075,7 +3073,7 @@  discard block
 block discarded – undo
3075 3073
     /*PHP8 - integer|string*/$value
3076 3074
 ) : bool
3077 3075
 {
3078
-    foreach($arrayOfVars as $variable) {
3076
+    foreach ($arrayOfVars as $variable) {
3079 3077
         if ($variable !== $value) {
3080 3078
             return false;
3081 3079
         }
@@ -3095,7 +3093,7 @@  discard block
 block discarded – undo
3095 3093
     /*PHP8 - integer|string*/$value
3096 3094
 ) : bool
3097 3095
 {
3098
-    foreach($arrayOfVars as $variable) {
3096
+    foreach ($arrayOfVars as $variable) {
3099 3097
         if ($variable === $value) {
3100 3098
             return true;
3101 3099
         }
@@ -3109,7 +3107,7 @@  discard block
 block discarded – undo
3109 3107
  * @param string|int|null $value
3110 3108
  * @return boolean
3111 3109
  */
3112
-function isValueSetNullEmpty(string|int|null $value) : bool
3110
+function isValueSetNullEmpty(string | int | null $value) : bool
3113 3111
 {
3114 3112
     if (is_null($value) === true || empty($value) === true) {
3115 3113
         return true;
@@ -3164,7 +3162,7 @@  discard block
 block discarded – undo
3164 3162
  * @param array     $filters
3165 3163
  * @return array|string
3166 3164
  */
3167
-function dataSanitizer(array $data, array $filters): array|string
3165
+function dataSanitizer(array $data, array $filters): array | string
3168 3166
 {
3169 3167
     // Load Sanitizer library
3170 3168
     $sanitizer = new Sanitizer($data, $filters);
@@ -3193,7 +3191,7 @@  discard block
 block discarded – undo
3193 3191
     // Exists ?
3194 3192
     $userCacheId = DB::queryFirstRow(
3195 3193
         'SELECT increment_id
3196
-        FROM ' . prefixTable('cache_tree') . '
3194
+        FROM ' . prefixTable('cache_tree').'
3197 3195
         WHERE user_id = %i',
3198 3196
         $user_id
3199 3197
     );
@@ -3244,7 +3242,7 @@  discard block
 block discarded – undo
3244 3242
  */
3245 3243
 function pourcentage(float $nombre, float $total, float $pourcentage): float
3246 3244
 { 
3247
-    $resultat = ($nombre/$total) * $pourcentage;
3245
+    $resultat = ($nombre / $total) * $pourcentage;
3248 3246
     return round($resultat);
3249 3247
 }
3250 3248
 
@@ -3274,7 +3272,7 @@  discard block
 block discarded – undo
3274 3272
 
3275 3273
     // Get last folder update
3276 3274
     $lastFolderChange = DB::queryFirstRow(
3277
-        'SELECT valeur FROM ' . prefixTable('misc') . '
3275
+        'SELECT valeur FROM '.prefixTable('misc').'
3278 3276
         WHERE type = %s AND intitule = %s',
3279 3277
         'timestamp',
3280 3278
         'last_folder_change'
@@ -3305,7 +3303,7 @@  discard block
 block discarded – undo
3305 3303
     // Does this user has a tree cache
3306 3304
     $userCacheTree = DB::queryFirstRow(
3307 3305
         'SELECT '.$fieldName.'
3308
-        FROM ' . prefixTable('cache_tree') . '
3306
+        FROM ' . prefixTable('cache_tree').'
3309 3307
         WHERE user_id = %i',
3310 3308
         $session->get('user-id')
3311 3309
     );
@@ -3348,7 +3346,7 @@  discard block
 block discarded – undo
3348 3346
     if (count($folderIds) === 0) {
3349 3347
         $folderIds = DB::queryFirstColumn(
3350 3348
             'SELECT id
3351
-            FROM ' . prefixTable('nested_tree') . '
3349
+            FROM ' . prefixTable('nested_tree').'
3352 3350
             WHERE personal_folder=%i',
3353 3351
             0
3354 3352
         );
@@ -3365,8 +3363,8 @@  discard block
 block discarded – undo
3365 3363
         $rows_tmp = DB::query(
3366 3364
             'SELECT c.id, c.title, c.level, c.type, c.masked, c.order, c.encrypted_data, c.role_visibility, c.is_mandatory,
3367 3365
             f.id_category AS category_id
3368
-            FROM ' . prefixTable('categories_folders') . ' AS f
3369
-            INNER JOIN ' . prefixTable('categories') . ' AS c ON (f.id_category = c.parent_id)
3366
+            FROM ' . prefixTable('categories_folders').' AS f
3367
+            INNER JOIN ' . prefixTable('categories').' AS c ON (f.id_category = c.parent_id)
3370 3368
             WHERE id_folder=%i',
3371 3369
             $folder
3372 3370
         );
@@ -3392,7 +3390,7 @@  discard block
 block discarded – undo
3392 3390
         $valTemp = '';
3393 3391
         $data = DB::queryFirstRow(
3394 3392
             'SELECT valeur
3395
-            FROM ' . prefixTable('misc') . '
3393
+            FROM ' . prefixTable('misc').'
3396 3394
             WHERE type = %s AND intitule=%i',
3397 3395
             'complex',
3398 3396
             $folder
@@ -3409,14 +3407,14 @@  discard block
 block discarded – undo
3409 3407
         $valTemp = '';
3410 3408
         $rows_tmp = DB::query(
3411 3409
             'SELECT t.title
3412
-            FROM ' . prefixTable('roles_values') . ' as v
3413
-            INNER JOIN ' . prefixTable('roles_title') . ' as t ON (v.role_id = t.id)
3410
+            FROM ' . prefixTable('roles_values').' as v
3411
+            INNER JOIN ' . prefixTable('roles_title').' as t ON (v.role_id = t.id)
3414 3412
             WHERE v.folder_id = %i
3415 3413
             GROUP BY title',
3416 3414
             $folder
3417 3415
         );
3418 3416
         foreach ($rows_tmp as $record) {
3419
-            $valTemp .= (empty($valTemp) === true ? '' : ' - ') . $record['title'];
3417
+            $valTemp .= (empty($valTemp) === true ? '' : ' - ').$record['title'];
3420 3418
         }
3421 3419
         $arr_data['visibilityRoles'] = $valTemp;
3422 3420
 
@@ -3449,7 +3447,7 @@  discard block
 block discarded – undo
3449 3447
         // loop on users and check if user has this role
3450 3448
         $rows = DB::query(
3451 3449
             'SELECT id, fonction_id
3452
-            FROM ' . prefixTable('users') . '
3450
+            FROM ' . prefixTable('users').'
3453 3451
             WHERE id != %i AND admin = 0 AND fonction_id IS NOT NULL AND fonction_id != ""',
3454 3452
             $session->get('user-id')
3455 3453
         );
@@ -3481,7 +3479,7 @@  discard block
 block discarded – undo
3481 3479
 
3482 3480
     $val = DB::queryFirstRow(
3483 3481
         'SELECT *
3484
-        FROM ' . prefixTable('users') . '
3482
+        FROM ' . prefixTable('users').'
3485 3483
         WHERE id = %i',
3486 3484
         $userId
3487 3485
     );
@@ -3497,12 +3495,12 @@  discard block
 block discarded – undo
3497 3495
 function upgradeRequired(): bool
3498 3496
 {
3499 3497
     // Get settings.php
3500
-    include_once __DIR__. '/../includes/config/settings.php';
3498
+    include_once __DIR__.'/../includes/config/settings.php';
3501 3499
 
3502 3500
     // Get timestamp in DB
3503 3501
     $val = DB::queryFirstRow(
3504 3502
         'SELECT valeur
3505
-        FROM ' . prefixTable('misc') . '
3503
+        FROM ' . prefixTable('misc').'
3506 3504
         WHERE type = %s AND intitule = %s',
3507 3505
         'admin',
3508 3506
         'upgrade_timestamp'
@@ -3553,7 +3551,7 @@  discard block
 block discarded – undo
3553 3551
     // prepapre background tasks for item keys generation        
3554 3552
     $userTP = DB::queryFirstRow(
3555 3553
         'SELECT pw, public_key, private_key
3556
-        FROM ' . prefixTable('users') . '
3554
+        FROM ' . prefixTable('users').'
3557 3555
         WHERE id = %i',
3558 3556
         TP_USER_ID
3559 3557
     );
@@ -3614,7 +3612,7 @@  discard block
 block discarded – undo
3614 3612
     }
3615 3613
 
3616 3614
     // Generate new keys
3617
-    if ($user_self_change === true && empty($recovery_public_key) === false && empty($recovery_private_key) === false){
3615
+    if ($user_self_change === true && empty($recovery_public_key) === false && empty($recovery_private_key) === false) {
3618 3616
         $userKeys = [
3619 3617
             'public_key' => $recovery_public_key,
3620 3618
             'private_key_clear' => $recovery_private_key,
@@ -3657,8 +3655,8 @@  discard block
 block discarded – undo
3657 3655
             'process_type' => 'create_user_keys',
3658 3656
             'arguments' => json_encode([
3659 3657
                 'new_user_id' => (int) $userId,
3660
-                'new_user_pwd' => cryption($passwordClear, '','encrypt')['string'],
3661
-                'new_user_code' => cryption(empty($encryptionKey) === true ? uniqidReal(20) : $encryptionKey, '','encrypt')['string'],
3658
+                'new_user_pwd' => cryption($passwordClear, '', 'encrypt')['string'],
3659
+                'new_user_code' => cryption(empty($encryptionKey) === true ? uniqidReal(20) : $encryptionKey, '', 'encrypt')['string'],
3662 3660
                 'owner_id' => (int) TP_USER_ID,
3663 3661
                 'creator_pwd' => $userTP['pw'],
3664 3662
                 'send_email' => $sendEmailToUser === true ? 1 : 0,
@@ -3948,7 +3946,7 @@  discard block
 block discarded – undo
3948 3946
  */
3949 3947
 function createTaskForItem(
3950 3948
     string $processType,
3951
-    string|array $taskName,
3949
+    string | array $taskName,
3952 3950
     int $itemId,
3953 3951
     int $userId,
3954 3952
     string $objectKey,
@@ -3972,7 +3970,7 @@  discard block
 block discarded – undo
3972 3970
                 'object_key' => $objectKey,
3973 3971
                 'author' => (int) $userId,
3974 3972
             ]),
3975
-            'item_id' => (int) $parentId !== -1 ?  $parentId : null,
3973
+            'item_id' => (int) $parentId !== -1 ? $parentId : null,
3976 3974
         )
3977 3975
     );
3978 3976
     $processId = DB::insertId();
@@ -3982,7 +3980,7 @@  discard block
 block discarded – undo
3982 3980
     if (is_array($taskName) === false) {
3983 3981
         $taskName = [$taskName];
3984 3982
     }
3985
-    foreach($taskName as $task) {
3983
+    foreach ($taskName as $task) {
3986 3984
         if (WIP === true) error_log('createTaskForItem - task: '.$task);
3987 3985
         switch ($task) {
3988 3986
             case 'item_password':
@@ -4079,7 +4077,7 @@  discard block
 block discarded – undo
4079 4077
  * @param integer $user_id
4080 4078
  * @return void
4081 4079
  */
4082
-function purgeUnnecessaryKeys(bool $allUsers = true, int $user_id=0)
4080
+function purgeUnnecessaryKeys(bool $allUsers = true, int $user_id = 0)
4083 4081
 {
4084 4082
     if ($allUsers === true) {
4085 4083
         // Load class DB
@@ -4089,7 +4087,7 @@  discard block
 block discarded – undo
4089 4087
 
4090 4088
         $users = DB::query(
4091 4089
             'SELECT id
4092
-            FROM ' . prefixTable('users') . '
4090
+            FROM ' . prefixTable('users').'
4093 4091
             WHERE id NOT IN ('.OTV_USER_ID.', '.TP_USER_ID.', '.SSH_USER_ID.', '.API_USER_ID.')
4094 4092
             ORDER BY login ASC'
4095 4093
         );
@@ -4107,7 +4105,7 @@  discard block
 block discarded – undo
4107 4105
  * @param integer $user_id
4108 4106
  * @return void
4109 4107
  */
4110
-function purgeUnnecessaryKeysForUser(int $user_id=0)
4108
+function purgeUnnecessaryKeysForUser(int $user_id = 0)
4111 4109
 {
4112 4110
     if ($user_id === 0) {
4113 4111
         return;
@@ -4118,8 +4116,8 @@  discard block
 block discarded – undo
4118 4116
 
4119 4117
     $personalItems = DB::queryFirstColumn(
4120 4118
         'SELECT id
4121
-        FROM ' . prefixTable('items') . ' AS i
4122
-        INNER JOIN ' . prefixTable('log_items') . ' AS li ON li.id_item = i.id
4119
+        FROM ' . prefixTable('items').' AS i
4120
+        INNER JOIN ' . prefixTable('log_items').' AS li ON li.id_item = i.id
4123 4121
         WHERE i.perso = 1 AND li.action = "at_creation" AND li.id_user IN (%i, '.TP_USER_ID.')',
4124 4122
         $user_id
4125 4123
     );
@@ -4168,7 +4166,7 @@  discard block
 block discarded – undo
4168 4166
     // Check if user exists
4169 4167
     $userInfo = DB::queryFirstRow(
4170 4168
         'SELECT login
4171
-        FROM ' . prefixTable('users') . '
4169
+        FROM ' . prefixTable('users').'
4172 4170
         WHERE id = %i',
4173 4171
         $userId
4174 4172
     );
@@ -4177,7 +4175,7 @@  discard block
 block discarded – undo
4177 4175
         $now = (int) time();
4178 4176
         // Prepare file content
4179 4177
         $export_value = file_get_contents(__DIR__."/../includes/core/teampass_ascii.txt")."\n".
4180
-            "Generation date: ".date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], $now)."\n\n".
4178
+            "Generation date: ".date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], $now)."\n\n".
4181 4179
             "RECOVERY KEYS - Not to be shared - To be store safely\n\n".
4182 4180
             "Public Key:\n".$session->get('user-public_key')."\n\n".
4183 4181
             "Private Key:\n".$session->get('user-private_key')."\n\n";
@@ -4200,7 +4198,7 @@  discard block
 block discarded – undo
4200 4198
         return prepareExchangedData(
4201 4199
             array(
4202 4200
                 'error' => false,
4203
-                'datetime' => date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], $now),
4201
+                'datetime' => date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], $now),
4204 4202
                 'timestamp' => $now,
4205 4203
                 'content' => base64_encode($export_value),
4206 4204
                 'login' => $userInfo['login'],
@@ -4226,8 +4224,8 @@  discard block
 block discarded – undo
4226 4224
  */
4227 4225
 function loadClasses(string $className = ''): void
4228 4226
 {
4229
-    require_once __DIR__. '/../includes/config/include.php';
4230
-    require_once __DIR__. '/../includes/config/settings.php';
4227
+    require_once __DIR__.'/../includes/config/include.php';
4228
+    require_once __DIR__.'/../includes/config/settings.php';
4231 4229
     require_once __DIR__.'/../vendor/autoload.php';
4232 4230
 
4233 4231
     if (defined('DB_PASSWD_CLEAR') === false) {
@@ -4437,7 +4435,7 @@  discard block
 block discarded – undo
4437 4435
 
4438 4436
     // Get current user hash
4439 4437
     $userHash = DB::queryFirstRow(
4440
-        "SELECT pw FROM " . prefixtable('users') . " WHERE id = %d;",
4438
+        "SELECT pw FROM ".prefixtable('users')." WHERE id = %d;",
4441 4439
         $session->get('user-id')
4442 4440
     )['pw'];
4443 4441
 
Please login to merge, or discard this patch.
sources/main.queries.php 1 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
 
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
  * @param string $post_key
325 325
  * @return string
326 326
  */
327
-function userHandler(string $post_type, array|null|string $dataReceived, array $SETTINGS, string $post_key): string
327
+function userHandler(string $post_type, array | null | string $dataReceived, array $SETTINGS, string $post_key): string
328 328
 {
329 329
     $session = SessionManager::getSession();
330 330
 
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
     if (isset($dataReceived['user_id'])) {
360 360
         // Get info about user to modify
361 361
         $targetUserInfos = DB::queryFirstRow(
362
-            'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM ' . prefixTable('users') . '
362
+            'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM '.prefixTable('users').'
363 363
             WHERE id = %i',
364 364
             $dataReceived['user_id']
365 365
         );
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
         case 'mail_me'://action_mail
509 509
             // Get info about user to send email
510 510
             $data_user = DB::queryFirstRow(
511
-                'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM ' . prefixTable('users') . '
511
+                'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM '.prefixTable('users').'
512 512
                 WHERE email = %s',
513 513
                 filter_var($dataReceived['receipt'], FILTER_SANITIZE_FULL_SPECIAL_CHARS)
514 514
             );
@@ -621,7 +621,7 @@  discard block
 block discarded – undo
621 621
     if (isset($dataReceived['user_id'])) {
622 622
         // Get info about user to modify
623 623
         $targetUserInfos = DB::queryFirstRow(
624
-            'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM ' . prefixTable('users') . '
624
+            'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM '.prefixTable('users').'
625 625
             WHERE id = %i',
626 626
             $dataReceived['user_id']
627 627
         );
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
 
701 701
             // Get current user hash
702 702
             $userHash = DB::queryFirstRow(
703
-                "SELECT pw FROM " . prefixtable('users') . " WHERE id = %d;",
703
+                "SELECT pw FROM ".prefixtable('users')." WHERE id = %d;",
704 704
                 $session->get('user-id')
705 705
             )['pw'];
706 706
 
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
 
739 739
                 // Get current user hash
740 740
                 $userHash = DB::queryFirstRow(
741
-                    "SELECT pw FROM " . prefixtable('users') . " WHERE id = %d;",
741
+                    "SELECT pw FROM ".prefixtable('users')." WHERE id = %d;",
742 742
                     $session->get('user-id')
743 743
                 )['pw'];
744 744
 
@@ -782,7 +782,7 @@  discard block
 block discarded – undo
782 782
 
783 783
                 // Get current user hash
784 784
                 $userHash = DB::queryFirstRow(
785
-                    "SELECT pw FROM " . prefixtable('users') . " WHERE id = %i;",
785
+                    "SELECT pw FROM ".prefixtable('users')." WHERE id = %i;",
786 786
                     $session->get('user-id')
787 787
                 )['pw'];
788 788
 
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
  * @param array $SETTINGS
827 827
  * @return string
828 828
  */
829
-function systemHandler(string $post_type, array|null|string $dataReceived, array $SETTINGS): string
829
+function systemHandler(string $post_type, array | null | string $dataReceived, array $SETTINGS): string
830 830
 {
831 831
     $session = SessionManager::getSession();
832 832
     switch ($post_type) {
@@ -927,7 +927,7 @@  discard block
 block discarded – undo
927 927
                 )
928 928
             );
929 929
 
930
-            return '[{"token" : "' . $token . '"}]';
930
+            return '[{"token" : "'.$token.'"}]';
931 931
 
932 932
         /*
933 933
         * Default case
@@ -943,7 +943,7 @@  discard block
 block discarded – undo
943 943
 }
944 944
 
945 945
 
946
-function utilsHandler(string $post_type, array|null|string $dataReceived, array $SETTINGS): string
946
+function utilsHandler(string $post_type, array | null | string $dataReceived, array $SETTINGS): string
947 947
 {
948 948
     switch ($post_type) {
949 949
         /*
@@ -1012,7 +1012,7 @@  discard block
 block discarded – undo
1012 1012
         array(
1013 1013
             'error' => false,
1014 1014
             'timestamp' => $session->get('user-session_duration'),
1015
-            'max_time_to_add' => intdiv((($maximum_session_expiration_time*60) - ((int) $session->get('user-session_duration') - time())), 60),
1015
+            'max_time_to_add' => intdiv((($maximum_session_expiration_time * 60) - ((int) $session->get('user-session_duration') - time())), 60),
1016 1016
             'max_session_duration' => $maximum_session_expiration_time,
1017 1017
         ),
1018 1018
         'encode'
@@ -1064,7 +1064,7 @@  discard block
 block discarded – undo
1064 1064
     // get number of items
1065 1065
     DB::queryFirstRow(
1066 1066
         'SELECT increment_id
1067
-        FROM ' . prefixTable('sharekeys_items') .
1067
+        FROM ' . prefixTable('sharekeys_items').
1068 1068
         ' WHERE user_id = %i',
1069 1069
         $userId
1070 1070
     );
@@ -1119,7 +1119,7 @@  discard block
 block discarded – undo
1119 1119
         // check if expected security level is reached
1120 1120
         $dataUser = DB::queryFirstRow(
1121 1121
             'SELECT *
1122
-            FROM ' . prefixTable('users') . ' WHERE id = %i',
1122
+            FROM ' . prefixTable('users').' WHERE id = %i',
1123 1123
             $post_user_id
1124 1124
         );
1125 1125
 
@@ -1140,8 +1140,8 @@  discard block
 block discarded – undo
1140 1140
         if (empty($dataUser['fonction_id']) === false) {
1141 1141
             $data = DB::queryFirstRow(
1142 1142
                 'SELECT complexity
1143
-                FROM ' . prefixTable('roles_title') . '
1144
-                WHERE id IN (' . $dataUser['fonction_id'] . ')
1143
+                FROM ' . prefixTable('roles_title').'
1144
+                WHERE id IN (' . $dataUser['fonction_id'].')
1145 1145
                 ORDER BY complexity DESC'
1146 1146
             );
1147 1147
         } else {
@@ -1154,8 +1154,8 @@  discard block
 block discarded – undo
1154 1154
             return prepareExchangedData(
1155 1155
                 array(
1156 1156
                     'error' => true,
1157
-                    'message' => '<div style="margin:10px 0 10px 15px;">' . $lang->get('complexity_level_not_reached') . '.<br>' .
1158
-                        $lang->get('expected_complexity_level') . ': <b>' . TP_PW_COMPLEXITY[$data['complexity']][1] . '</b></div>',
1157
+                    'message' => '<div style="margin:10px 0 10px 15px;">'.$lang->get('complexity_level_not_reached').'.<br>'.
1158
+                        $lang->get('expected_complexity_level').': <b>'.TP_PW_COMPLEXITY[$data['complexity']][1].'</b></div>',
1159 1159
                 ),
1160 1160
                 'encode'
1161 1161
             );
@@ -1259,14 +1259,14 @@  discard block
 block discarded – undo
1259 1259
         // Get data about user
1260 1260
         $dataUser = DB::queryFirstRow(
1261 1261
             'SELECT id, email, pw
1262
-            FROM ' . prefixTable('users') . '
1262
+            FROM ' . prefixTable('users').'
1263 1263
             WHERE login = %s',
1264 1264
             $post_login
1265 1265
         );
1266 1266
     } else {
1267 1267
         $dataUser = DB::queryFirstRow(
1268 1268
             'SELECT id, login, email, pw
1269
-            FROM ' . prefixTable('users') . '
1269
+            FROM ' . prefixTable('users').'
1270 1270
             WHERE id = %i',
1271 1271
             $post_id
1272 1272
         );
@@ -1320,7 +1320,7 @@  discard block
 block discarded – undo
1320 1320
     // Check if token already used
1321 1321
     $dataToken = DB::queryFirstRow(
1322 1322
         'SELECT end_timestamp, reason
1323
-        FROM ' . prefixTable('tokens') . '
1323
+        FROM ' . prefixTable('tokens').'
1324 1324
         WHERE token = %s AND user_id = %i',
1325 1325
         $post_token,
1326 1326
         $dataUser['id']
@@ -1331,11 +1331,11 @@  discard block
 block discarded – undo
1331 1331
         return prepareExchangedData(
1332 1332
             array(
1333 1333
                 'error' => true,
1334
-                'message' => 'TOKEN already used',//$lang->get('no_email_set'),
1334
+                'message' => 'TOKEN already used', //$lang->get('no_email_set'),
1335 1335
             ),
1336 1336
             'encode'
1337 1337
         );
1338
-    } elseif(DB::count() === 0) {
1338
+    } elseif (DB::count() === 0) {
1339 1339
         // Store token for this action
1340 1340
         DB::insert(
1341 1341
             prefixTable('tokens'),
@@ -1397,7 +1397,7 @@  discard block
 block discarded – undo
1397 1397
                 'email' => $dataUser['email'],
1398 1398
                 'email_result' => str_replace(
1399 1399
                     '#email#',
1400
-                    '<b>' . obfuscateEmail($dataUser['email']) . '</b>',
1400
+                    '<b>'.obfuscateEmail($dataUser['email']).'</b>',
1401 1401
                     addslashes($lang->get('admin_email_result_ok'))
1402 1402
                 ),
1403 1403
             ),
@@ -1413,7 +1413,7 @@  discard block
 block discarded – undo
1413 1413
             'email' => $dataUser['email'],
1414 1414
             'email_result' => str_replace(
1415 1415
                 '#email#',
1416
-                '<b>' . obfuscateEmail($dataUser['email']) . '</b>',
1416
+                '<b>'.obfuscateEmail($dataUser['email']).'</b>',
1417 1417
                 addslashes($lang->get('admin_email_result_ok'))
1418 1418
             ),
1419 1419
         ),
@@ -1430,7 +1430,7 @@  discard block
 block discarded – undo
1430 1430
 
1431 1431
     if (isKeyExistingAndEqual('enable_send_email_on_user_login', 1, $SETTINGS) === true) {
1432 1432
         $row = DB::queryFirstRow(
1433
-            'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s',
1433
+            'SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s',
1434 1434
             'cron',
1435 1435
             'sending_emails'
1436 1436
         );
@@ -1438,7 +1438,7 @@  discard block
 block discarded – undo
1438 1438
         if ((int) (time() - $row['valeur']) >= 300 || (int) $row['valeur'] === 0) {
1439 1439
             $rows = DB::query(
1440 1440
                 'SELECT *
1441
-                FROM ' . prefixTable('emails') .
1441
+                FROM ' . prefixTable('emails').
1442 1442
                 ' WHERE status != %s',
1443 1443
                 'sent'
1444 1444
             );
@@ -1490,8 +1490,8 @@  discard block
 block discarded – undo
1490 1490
     $arr_html = array();
1491 1491
     $rows = DB::query(
1492 1492
         '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
1493
-        FROM ' . prefixTable('log_items') . ' AS l
1494
-        RIGHT JOIN ' . prefixTable('items') . ' AS i ON (l.id_item = i.id)
1493
+        FROM ' . prefixTable('log_items').' AS l
1494
+        RIGHT JOIN ' . prefixTable('items').' AS i ON (l.id_item = i.id)
1495 1495
         WHERE l.action = %s AND l.id_user = %i
1496 1496
         ORDER BY l.date DESC
1497 1497
         LIMIT 0, 100',
@@ -1523,7 +1523,7 @@  discard block
 block discarded – undo
1523 1523
     if (isKeyExistingAndEqual('enable_suggestion', 1, $SETTINGS) === true
1524 1524
         && ((int) $session->get('user-admin') === 1 || (int) $session->get('user-manager') === 1)
1525 1525
     ) {
1526
-        DB::query('SELECT * FROM ' . prefixTable('suggestion'));
1526
+        DB::query('SELECT * FROM '.prefixTable('suggestion'));
1527 1527
         $nb_suggestions_waiting = DB::count();
1528 1528
     }
1529 1529
 
@@ -1558,13 +1558,13 @@  discard block
 block discarded – undo
1558 1558
             if ($data === 'stat_languages') {
1559 1559
                 $tmp = '';
1560 1560
                 foreach ($stats_data[$data] as $key => $value) {
1561
-                    $tmp .= $tmp === '' ? $key . '-' . $value : ',' . $key . '-' . $value;
1561
+                    $tmp .= $tmp === '' ? $key.'-'.$value : ','.$key.'-'.$value;
1562 1562
                 }
1563 1563
                 $statsToSend[$data] = $tmp;
1564 1564
             } elseif ($data === 'stat_country') {
1565 1565
                 $tmp = '';
1566 1566
                 foreach ($stats_data[$data] as $key => $value) {
1567
-                    $tmp .= $tmp === '' ? $key . '-' . $value : ',' . $key . '-' . $value;
1567
+                    $tmp .= $tmp === '' ? $key.'-'.$value : ','.$key.'-'.$value;
1568 1568
                 }
1569 1569
                 $statsToSend[$data] = $tmp;
1570 1570
             } else {
@@ -1651,7 +1651,7 @@  discard block
 block discarded – undo
1651 1651
             $url_found = $value;
1652 1652
             if (empty($url_found) === false) {
1653 1653
                 $tmp = parse_url($url_found);
1654
-                $anonym_url = $tmp['scheme'] . '://<anonym_url>' . (isset($tmp['path']) === true ? $tmp['path'] : '');
1654
+                $anonym_url = $tmp['scheme'].'://<anonym_url>'.(isset($tmp['path']) === true ? $tmp['path'] : '');
1655 1655
                 $value = $anonym_url;
1656 1656
             } else {
1657 1657
                 $value = '';
@@ -1681,7 +1681,7 @@  discard block
 block discarded – undo
1681 1681
     $teampass_errors = '';
1682 1682
     $rows = DB::query(
1683 1683
         'SELECT label, date AS error_date
1684
-        FROM ' . prefixTable('log_system') . "
1684
+        FROM ' . prefixTable('log_system')."
1685 1685
         WHERE `type` LIKE 'error'
1686 1686
         ORDER BY `date` DESC
1687 1687
         LIMIT 0, 10"
@@ -1689,9 +1689,9 @@  discard block
 block discarded – undo
1689 1689
     if (DB::count() > 0) {
1690 1690
         foreach ($rows as $record) {
1691 1691
             if (empty($teampass_errors) === true) {
1692
-                $teampass_errors = ' * ' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['error_date']) . ' - ' . $record['label'];
1692
+                $teampass_errors = ' * '.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['error_date']).' - '.$record['label'];
1693 1693
             } else {
1694
-                $teampass_errors .= ' * ' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['error_date']) . ' - ' . $record['label'];
1694
+                $teampass_errors .= ' * '.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['error_date']).' - '.$record['label'];
1695 1695
             }
1696 1696
         }
1697 1697
     }
@@ -1703,7 +1703,7 @@  discard block
 block discarded – undo
1703 1703
 
1704 1704
     // Now prepare text
1705 1705
     $txt = '### Page on which it happened
1706
-' . $data['current_page'] . '
1706
+' . $data['current_page'].'
1707 1707
 
1708 1708
 ### Steps to reproduce
1709 1709
 1.
@@ -1718,39 +1718,39 @@  discard block
 block discarded – undo
1718 1718
 Tell us what happens instead
1719 1719
 
1720 1720
 ### Server configuration
1721
-**Operating system**: ' . php_uname() . '
1721
+**Operating system**: ' . php_uname().'
1722 1722
 
1723
-**Web server:** ' . $_SERVER['SERVER_SOFTWARE'] . '
1723
+**Web server:** ' . $_SERVER['SERVER_SOFTWARE'].'
1724 1724
 
1725
-**Database:** ' . ($link === false ? $lang->get('undefined') : mysqli_get_server_info($link)) . '
1725
+**Database:** ' . ($link === false ? $lang->get('undefined') : mysqli_get_server_info($link)).'
1726 1726
 
1727
-**PHP version:** ' . PHP_VERSION . '
1727
+**PHP version:** ' . PHP_VERSION.'
1728 1728
 
1729
-**Teampass version:** ' . TP_VERSION . '.' . TP_VERSION_MINOR . '
1729
+**Teampass version:** ' . TP_VERSION.'.'.TP_VERSION_MINOR.'
1730 1730
 
1731 1731
 **Teampass configuration variables:**
1732 1732
 ```
1733
-' . $list_of_options . '
1733
+' . $list_of_options.'
1734 1734
 ```
1735 1735
 
1736 1736
 **Updated from an older Teampass or fresh install:**
1737 1737
 
1738 1738
 ### Client configuration
1739 1739
 
1740
-**Browser:** ' . $data['browser_name'] . ' - ' . $data['browser_version'] . '
1740
+**Browser:** ' . $data['browser_name'].' - '.$data['browser_version'].'
1741 1741
 
1742
-**Operating system:** ' . $data['os'] . ' - ' . $data['os_archi'] . 'bits
1742
+**Operating system:** ' . $data['os'].' - '.$data['os_archi'].'bits
1743 1743
 
1744 1744
 ### Logs
1745 1745
 
1746 1746
 #### Web server error log
1747 1747
 ```
1748
-' . $err['message'] . ' - ' . $err['file'] . ' (' . $err['line'] . ')
1748
+' . $err['message'].' - '.$err['file'].' ('.$err['line'].')
1749 1749
 ```
1750 1750
 
1751 1751
 #### Teampass 10 last system errors
1752 1752
 ```
1753
-' . $teampass_errors . '
1753
+' . $teampass_errors.'
1754 1754
 ```
1755 1755
 
1756 1756
 #### Log from the web-browser developer console (CTRL + SHIFT + i)
@@ -1790,7 +1790,7 @@  discard block
 block discarded – undo
1790 1790
         // Check if user exists
1791 1791
         $userInfo = DB::queryFirstRow(
1792 1792
             'SELECT public_key, private_key, pw, auth_type
1793
-            FROM ' . prefixTable('users') . '
1793
+            FROM ' . prefixTable('users').'
1794 1794
             WHERE id = %i',
1795 1795
             $post_user_id
1796 1796
         );
@@ -1799,9 +1799,9 @@  discard block
 block discarded – undo
1799 1799
             // Get one item
1800 1800
             $currentUserKey = DB::queryFirstRow(
1801 1801
                 'SELECT object_id, share_key, increment_id
1802
-                FROM ' . prefixTable('sharekeys_items') . ' AS si
1803
-                INNER JOIN ' . prefixTable('items') . ' AS i ON  (i.id = si.object_id)
1804
-                INNER JOIN ' . prefixTable('nested_tree') . ' AS nt ON  (i.id_tree = nt.id)
1802
+                FROM ' . prefixTable('sharekeys_items').' AS si
1803
+                INNER JOIN ' . prefixTable('items').' AS i ON  (i.id = si.object_id)
1804
+                INNER JOIN ' . prefixTable('nested_tree').' AS nt ON  (i.id_tree = nt.id)
1805 1805
                 WHERE user_id = %i AND nt.personal_folder = %i',
1806 1806
                 $post_user_id,
1807 1807
                 0
@@ -1895,7 +1895,7 @@  discard block
 block discarded – undo
1895 1895
         // Get user info
1896 1896
         $userData = DB::queryFirstRow(
1897 1897
             'SELECT private_key
1898
-            FROM ' . prefixTable('users') . '
1898
+            FROM ' . prefixTable('users').'
1899 1899
             WHERE id = %i',
1900 1900
             $post_user_id
1901 1901
         );
@@ -1976,7 +1976,7 @@  discard block
 block discarded – undo
1976 1976
         // Get user info
1977 1977
         $userData = DB::queryFirstRow(
1978 1978
             'SELECT email, auth_type, login
1979
-            FROM ' . prefixTable('users') . '
1979
+            FROM ' . prefixTable('users').'
1980 1980
             WHERE id = %i',
1981 1981
             $post_user_id
1982 1982
         );
@@ -2074,7 +2074,7 @@  discard block
 block discarded – undo
2074 2074
         // Get user info
2075 2075
         $userData = DB::queryFirstRow(
2076 2076
             'SELECT email, auth_type, login
2077
-            FROM ' . prefixTable('users') . '
2077
+            FROM ' . prefixTable('users').'
2078 2078
             WHERE id = %i',
2079 2079
             $post_user_id
2080 2080
         );
@@ -2140,7 +2140,7 @@  discard block
 block discarded – undo
2140 2140
         // Check if user exists
2141 2141
         DB::queryFirstRow(
2142 2142
             'SELECT *
2143
-            FROM ' . prefixTable('users') . '
2143
+            FROM ' . prefixTable('users').'
2144 2144
             WHERE id = %i',
2145 2145
             $post_user_id
2146 2146
         );
@@ -2210,7 +2210,7 @@  discard block
 block discarded – undo
2210 2210
         // Check if user exists
2211 2211
         $userInfo = DB::queryFirstRow(
2212 2212
             'SELECT public_key
2213
-            FROM ' . prefixTable('users') . '
2213
+            FROM ' . prefixTable('users').'
2214 2214
             WHERE id = %i',
2215 2215
             $post_user_id
2216 2216
         );
@@ -2358,15 +2358,15 @@  discard block
 block discarded – undo
2358 2358
     // Loop on items
2359 2359
     $rows = DB::query(
2360 2360
         'SELECT id, pw
2361
-        FROM ' . prefixTable('items') . '
2361
+        FROM ' . prefixTable('items').'
2362 2362
         WHERE perso = 0
2363
-        LIMIT ' . $post_start . ', ' . $post_length
2363
+        LIMIT ' . $post_start.', '.$post_length
2364 2364
     );
2365 2365
     foreach ($rows as $record) {
2366 2366
         // Get itemKey from current user
2367 2367
         $currentUserKey = DB::queryFirstRow(
2368 2368
             'SELECT share_key, increment_id
2369
-            FROM ' . prefixTable('sharekeys_items') . '
2369
+            FROM ' . prefixTable('sharekeys_items').'
2370 2370
             WHERE object_id = %i AND user_id = %i',
2371 2371
             $record['id'],
2372 2372
             $session->get('user-id')
@@ -2398,7 +2398,7 @@  discard block
 block discarded – undo
2398 2398
             if ((int) $post_user_id !== (int) $session->get('user-id')) {
2399 2399
                 $currentUserKey = DB::queryFirstRow(
2400 2400
                     'SELECT increment_id
2401
-                    FROM ' . prefixTable('sharekeys_items') . '
2401
+                    FROM ' . prefixTable('sharekeys_items').'
2402 2402
                     WHERE object_id = %i AND user_id = %i',
2403 2403
                     $record['id'],
2404 2404
                     $post_user_id
@@ -2431,7 +2431,7 @@  discard block
 block discarded – undo
2431 2431
     // SHould we change step?
2432 2432
     DB::query(
2433 2433
         'SELECT *
2434
-        FROM ' . prefixTable('items') . '
2434
+        FROM ' . prefixTable('items').'
2435 2435
         WHERE perso = 0'
2436 2436
     );
2437 2437
 
@@ -2456,15 +2456,15 @@  discard block
 block discarded – undo
2456 2456
     // Loop on logs
2457 2457
     $rows = DB::query(
2458 2458
         'SELECT increment_id
2459
-        FROM ' . prefixTable('log_items') . '
2459
+        FROM ' . prefixTable('log_items').'
2460 2460
         WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"
2461
-        LIMIT ' . $post_start . ', ' . $post_length
2461
+        LIMIT ' . $post_start.', '.$post_length
2462 2462
     );
2463 2463
     foreach ($rows as $record) {
2464 2464
         // Get itemKey from current user
2465 2465
         $currentUserKey = DB::queryFirstRow(
2466 2466
             'SELECT share_key
2467
-            FROM ' . prefixTable('sharekeys_logs') . '
2467
+            FROM ' . prefixTable('sharekeys_logs').'
2468 2468
             WHERE object_id = %i AND user_id = %i',
2469 2469
             $record['increment_id'],
2470 2470
             $session->get('user-id')
@@ -2496,7 +2496,7 @@  discard block
 block discarded – undo
2496 2496
             if ((int) $post_user_id !== (int) $session->get('user-id')) {
2497 2497
                 $currentUserKey = DB::queryFirstRow(
2498 2498
                     'SELECT increment_id
2499
-                    FROM ' . prefixTable('sharekeys_items') . '
2499
+                    FROM ' . prefixTable('sharekeys_items').'
2500 2500
                     WHERE object_id = %i AND user_id = %i',
2501 2501
                     $record['id'],
2502 2502
                     $post_user_id
@@ -2518,7 +2518,7 @@  discard block
 block discarded – undo
2518 2518
     // SHould we change step?
2519 2519
     DB::query(
2520 2520
         'SELECT increment_id
2521
-        FROM ' . prefixTable('log_items') . '
2521
+        FROM ' . prefixTable('log_items').'
2522 2522
         WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"'
2523 2523
     );
2524 2524
 
@@ -2543,15 +2543,15 @@  discard block
 block discarded – undo
2543 2543
     // Loop on fields
2544 2544
     $rows = DB::query(
2545 2545
         'SELECT id
2546
-        FROM ' . prefixTable('categories_items') . '
2546
+        FROM ' . prefixTable('categories_items').'
2547 2547
         WHERE encryption_type = "teampass_aes"
2548
-        LIMIT ' . $post_start . ', ' . $post_length
2548
+        LIMIT ' . $post_start.', '.$post_length
2549 2549
     );
2550 2550
     foreach ($rows as $record) {
2551 2551
         // Get itemKey from current user
2552 2552
         $currentUserKey = DB::queryFirstRow(
2553 2553
             'SELECT share_key
2554
-            FROM ' . prefixTable('sharekeys_fields') . '
2554
+            FROM ' . prefixTable('sharekeys_fields').'
2555 2555
             WHERE object_id = %i AND user_id = %i',
2556 2556
             $record['id'],
2557 2557
             $session->get('user-id')
@@ -2583,7 +2583,7 @@  discard block
 block discarded – undo
2583 2583
             if ((int) $post_user_id !== (int) $session->get('user-id')) {
2584 2584
                 $currentUserKey = DB::queryFirstRow(
2585 2585
                     'SELECT increment_id
2586
-                    FROM ' . prefixTable('sharekeys_items') . '
2586
+                    FROM ' . prefixTable('sharekeys_items').'
2587 2587
                     WHERE object_id = %i AND user_id = %i',
2588 2588
                     $record['id'],
2589 2589
                     $post_user_id
@@ -2605,7 +2605,7 @@  discard block
 block discarded – undo
2605 2605
     // SHould we change step?
2606 2606
     DB::query(
2607 2607
         'SELECT *
2608
-        FROM ' . prefixTable('categories_items') . '
2608
+        FROM ' . prefixTable('categories_items').'
2609 2609
         WHERE encryption_type = "teampass_aes"'
2610 2610
     );
2611 2611
 
@@ -2630,14 +2630,14 @@  discard block
 block discarded – undo
2630 2630
     // Loop on suggestions
2631 2631
     $rows = DB::query(
2632 2632
         'SELECT id
2633
-        FROM ' . prefixTable('suggestion') . '
2634
-        LIMIT ' . $post_start . ', ' . $post_length
2633
+        FROM ' . prefixTable('suggestion').'
2634
+        LIMIT ' . $post_start.', '.$post_length
2635 2635
     );
2636 2636
     foreach ($rows as $record) {
2637 2637
         // Get itemKey from current user
2638 2638
         $currentUserKey = DB::queryFirstRow(
2639 2639
             'SELECT share_key
2640
-            FROM ' . prefixTable('sharekeys_suggestions') . '
2640
+            FROM ' . prefixTable('sharekeys_suggestions').'
2641 2641
             WHERE object_id = %i AND user_id = %i',
2642 2642
             $record['id'],
2643 2643
             $session->get('user-id')
@@ -2669,7 +2669,7 @@  discard block
 block discarded – undo
2669 2669
             if ((int) $post_user_id !== (int) $session->get('user-id')) {
2670 2670
                 $currentUserKey = DB::queryFirstRow(
2671 2671
                     'SELECT increment_id
2672
-                    FROM ' . prefixTable('sharekeys_items') . '
2672
+                    FROM ' . prefixTable('sharekeys_items').'
2673 2673
                     WHERE object_id = %i AND user_id = %i',
2674 2674
                     $record['id'],
2675 2675
                     $post_user_id
@@ -2715,15 +2715,15 @@  discard block
 block discarded – undo
2715 2715
     // Loop on files
2716 2716
     $rows = DB::query(
2717 2717
         'SELECT id
2718
-        FROM ' . prefixTable('files') . '
2719
-        WHERE status = "' . TP_ENCRYPTION_NAME . '"
2720
-        LIMIT ' . $post_start . ', ' . $post_length
2718
+        FROM ' . prefixTable('files').'
2719
+        WHERE status = "' . TP_ENCRYPTION_NAME.'"
2720
+        LIMIT ' . $post_start.', '.$post_length
2721 2721
     ); //aes_encryption
2722 2722
     foreach ($rows as $record) {
2723 2723
         // Get itemKey from current user
2724 2724
         $currentUserKey = DB::queryFirstRow(
2725 2725
             'SELECT share_key
2726
-            FROM ' . prefixTable('sharekeys_files') . '
2726
+            FROM ' . prefixTable('sharekeys_files').'
2727 2727
             WHERE object_id = %i AND user_id = %i',
2728 2728
             $record['id'],
2729 2729
             $session->get('user-id')
@@ -2755,7 +2755,7 @@  discard block
 block discarded – undo
2755 2755
             if ((int) $post_user_id !== (int) $session->get('user-id')) {
2756 2756
                 $currentUserKey = DB::queryFirstRow(
2757 2757
                     'SELECT increment_id
2758
-                    FROM ' . prefixTable('sharekeys_items') . '
2758
+                    FROM ' . prefixTable('sharekeys_items').'
2759 2759
                     WHERE object_id = %i AND user_id = %i',
2760 2760
                     $record['id'],
2761 2761
                     $post_user_id
@@ -2777,8 +2777,8 @@  discard block
 block discarded – undo
2777 2777
     // SHould we change step?
2778 2778
     DB::query(
2779 2779
         'SELECT *
2780
-        FROM ' . prefixTable('files') . '
2781
-        WHERE status = "' . TP_ENCRYPTION_NAME . '"'
2780
+        FROM ' . prefixTable('files').'
2781
+        WHERE status = "' . TP_ENCRYPTION_NAME.'"'
2782 2782
     );
2783 2783
 
2784 2784
     $next_start = (int) $post_start + (int) $post_length;
@@ -2811,9 +2811,9 @@  discard block
 block discarded – undo
2811 2811
     if (count($session->get('user-personal_folders')) > 0) {
2812 2812
         $rows = DB::query(
2813 2813
             'SELECT id, pw
2814
-            FROM ' . prefixTable('items') . '
2814
+            FROM ' . prefixTable('items').'
2815 2815
             WHERE perso = 1 AND id_tree IN %ls AND encryption_type = %s
2816
-            LIMIT ' . $post_start . ', ' . $post_length,
2816
+            LIMIT ' . $post_start.', '.$post_length,
2817 2817
             $session->get('user-personal_folders'),
2818 2818
             "defuse"
2819 2819
         );
@@ -2821,7 +2821,7 @@  discard block
 block discarded – undo
2821 2821
             // Get itemKey from current user
2822 2822
             $currentUserKey = DB::queryFirstRow(
2823 2823
                 'SELECT share_key, increment_id
2824
-                FROM ' . prefixTable('sharekeys_items') . '
2824
+                FROM ' . prefixTable('sharekeys_items').'
2825 2825
                 WHERE object_id = %i AND user_id = %i',
2826 2826
                 $record['id'],
2827 2827
                 $session->get('user-id')
@@ -2848,7 +2848,7 @@  discard block
 block discarded – undo
2848 2848
                 if ((int) $post_user_id !== (int) $session->get('user-id')) {
2849 2849
                     $currentUserKey = DB::queryFirstRow(
2850 2850
                         'SELECT increment_id
2851
-                        FROM ' . prefixTable('sharekeys_items') . '
2851
+                        FROM ' . prefixTable('sharekeys_items').'
2852 2852
                         WHERE object_id = %i AND user_id = %i',
2853 2853
                         $record['id'],
2854 2854
                         $post_user_id
@@ -2871,7 +2871,7 @@  discard block
 block discarded – undo
2871 2871
     // SHould we change step?
2872 2872
     DB::query(
2873 2873
         'SELECT *
2874
-        FROM ' . prefixTable('items') . '
2874
+        FROM ' . prefixTable('items').'
2875 2875
         WHERE perso = 0'
2876 2876
     );
2877 2877
 
@@ -2899,7 +2899,7 @@  discard block
 block discarded – undo
2899 2899
         // Check if user exists
2900 2900
         $userInfo = DB::queryFirstRow(
2901 2901
             'SELECT public_key, encrypted_psk
2902
-            FROM ' . prefixTable('users') . '
2902
+            FROM ' . prefixTable('users').'
2903 2903
             WHERE id = %i',
2904 2904
             $post_user_id
2905 2905
         );
@@ -2925,7 +2925,7 @@  discard block
 block discarded – undo
2925 2925
                 if ($post_counterItemsToTreat === -1) {
2926 2926
                     DB::query(
2927 2927
                         'SELECT id
2928
-                        FROM ' . prefixTable('items') . '
2928
+                        FROM ' . prefixTable('items').'
2929 2929
                         WHERE perso = 1 AND id_tree IN %ls AND encryption_type != %s',
2930 2930
                         $session->get('user-personal_folders'),
2931 2931
                         'teampass_aes'
@@ -2938,7 +2938,7 @@  discard block
 block discarded – undo
2938 2938
                 // Loop on persoanl items
2939 2939
                 $rows = DB::query(
2940 2940
                     'SELECT id, pw
2941
-                    FROM ' . prefixTable('items') . '
2941
+                    FROM ' . prefixTable('items').'
2942 2942
                     WHERE perso = 1 AND id_tree IN %ls AND encryption_type != %s
2943 2943
                     LIMIT ' . $post_length,
2944 2944
                     $session->get('user-personal_folders'),
@@ -2982,7 +2982,7 @@  discard block
 block discarded – undo
2982 2982
                     // Loop on files
2983 2983
                     $rows = DB::query(
2984 2984
                         'SELECT id, file
2985
-                        FROM ' . prefixTable('files') . '
2985
+                        FROM ' . prefixTable('files').'
2986 2986
                         WHERE status != %s
2987 2987
                         AND id_item = %i',
2988 2988
                         TP_ENCRYPTION_NAME,
@@ -2993,13 +2993,13 @@  discard block
 block discarded – undo
2993 2993
                         // Now decrypt the file
2994 2994
                         prepareFileWithDefuse(
2995 2995
                             'decrypt',
2996
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record2['file'],
2997
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record2['file'] . '.delete',
2996
+                            $SETTINGS['path_to_upload_folder'].'/'.$record2['file'],
2997
+                            $SETTINGS['path_to_upload_folder'].'/'.$record2['file'].'.delete',
2998 2998
                             $post_user_psk
2999 2999
                         );
3000 3000
 
3001 3001
                         // Encrypt the file
3002
-                        $encryptedFile = encryptFile($record2['file'] . '.delete', $SETTINGS['path_to_upload_folder']);
3002
+                        $encryptedFile = encryptFile($record2['file'].'.delete', $SETTINGS['path_to_upload_folder']);
3003 3003
 
3004 3004
                         DB::update(
3005 3005
                             prefixTable('files'),
@@ -3022,7 +3022,7 @@  discard block
 block discarded – undo
3022 3022
                         );
3023 3023
 
3024 3024
                         // Unlink original file
3025
-                        unlink($SETTINGS['path_to_upload_folder'] . '/' . $record2['file']);
3025
+                        unlink($SETTINGS['path_to_upload_folder'].'/'.$record2['file']);
3026 3026
                     }
3027 3027
                 }
3028 3028
 
@@ -3030,7 +3030,7 @@  discard block
 block discarded – undo
3030 3030
                 $next_start = (int) $post_start + (int) $post_length;
3031 3031
                 DB::query(
3032 3032
                     'SELECT id
3033
-                    FROM ' . prefixTable('items') . '
3033
+                    FROM ' . prefixTable('items').'
3034 3034
                     WHERE perso = 1 AND id_tree IN %ls AND encryption_type != %s',
3035 3035
                     $session->get('user-personal_folders'),
3036 3036
                     'teampass_aes'
@@ -3100,7 +3100,7 @@  discard block
 block discarded – undo
3100 3100
         // Get user info
3101 3101
         $userData = DB::queryFirstRow(
3102 3102
             'SELECT special, auth_type, is_ready_for_usage, ongoing_process_id, otp_provided, keys_recovery_time
3103
-            FROM ' . prefixTable('users') . '
3103
+            FROM ' . prefixTable('users').'
3104 3104
             WHERE id = %i',
3105 3105
             $post_user_id
3106 3106
         );
@@ -3147,7 +3147,7 @@  discard block
 block discarded – undo
3147 3147
         // Get user info
3148 3148
         $userData = DB::queryFirstRow(
3149 3149
             'SELECT auth_type, login, private_key
3150
-            FROM ' . prefixTable('users') . '
3150
+            FROM ' . prefixTable('users').'
3151 3151
             WHERE id = %i',
3152 3152
             $post_user_id
3153 3153
         );
@@ -3197,7 +3197,7 @@  discard block
 block discarded – undo
3197 3197
                 return prepareExchangedData(
3198 3198
                     array(
3199 3199
                         'error' => false,
3200
-                        'message' => $lang->get('done'),'',
3200
+                        'message' => $lang->get('done'), '',
3201 3201
                     ),
3202 3202
                     'encode'
3203 3203
                 );
@@ -3245,7 +3245,7 @@  discard block
 block discarded – undo
3245 3245
         // Get user info
3246 3246
         $userData = DB::queryFirstRow(
3247 3247
             'SELECT auth_type, login, private_key, special
3248
-            FROM ' . prefixTable('users') . '
3248
+            FROM ' . prefixTable('users').'
3249 3249
             WHERE id = %i',
3250 3250
             $post_user_id
3251 3251
         );
@@ -3279,7 +3279,7 @@  discard block
 block discarded – undo
3279 3279
                 return prepareExchangedData(
3280 3280
                     array(
3281 3281
                         'error' => false,
3282
-                        'message' => $lang->get('done'),'',
3282
+                        'message' => $lang->get('done'), '',
3283 3283
                     ),
3284 3284
                     'encode'
3285 3285
                 );
@@ -3301,8 +3301,8 @@  discard block
 block discarded – undo
3301 3301
             // Get one itemKey from current user
3302 3302
             $currentUserKey = DB::queryFirstRow(
3303 3303
                 'SELECT ski.share_key, ski.increment_id, l.id_user
3304
-                FROM ' . prefixTable('sharekeys_items') . ' AS ski
3305
-                INNER JOIN ' . prefixTable('log_items') . ' AS l ON ski.object_id = l.id_item
3304
+                FROM ' . prefixTable('sharekeys_items').' AS ski
3305
+                INNER JOIN ' . prefixTable('log_items').' AS l ON ski.object_id = l.id_item
3306 3306
                 WHERE ski.user_id = %i
3307 3307
                 ORDER BY RAND()
3308 3308
                 LIMIT 1',
@@ -3392,7 +3392,7 @@  discard block
 block discarded – undo
3392 3392
             $session->get('user-id')
3393 3393
         );
3394 3394
         // Return data
3395
-        return '[{"new_value":"' . $session->get('user-session_duration') . '"}]';
3395
+        return '[{"new_value":"'.$session->get('user-session_duration').'"}]';
3396 3396
     }
3397 3397
     
3398 3398
     return '[{"new_value":"expired"}]';
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_' . DB_NAME];
143
+            $tables[] = $row['Tables_in_'.DB_NAME];
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::query('SELECT * FROM ' . $table);
150
+                $result = DB::query('SELECT * FROM '.$table);
151 151
                 DB::query(
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);
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
                 echo prepareExchangedData(
649 649
                     array(
650 650
                         'error' => true,
651
-                        'message' => 'Input `' . $objects[0] . '` is not allowed',
651
+                        'message' => 'Input `'.$objects[0].'` is not allowed',
652 652
                         'nbOfItems' => '',
653 653
                         'nextAction' => '',
654 654
                     ),
@@ -661,9 +661,9 @@  discard block
 block discarded – undo
661 661
                 //change all encrypted data in Items (passwords)
662 662
                 $rows = DB::query(
663 663
                     'SELECT id, pw, pw_iv
664
-                    FROM ' . prefixTable('items') . '
664
+                    FROM ' . prefixTable('items').'
665 665
                     WHERE perso = %s
666
-                    LIMIT ' . $post_start . ', ' . $post_length,
666
+                    LIMIT ' . $post_start.', '.$post_length,
667 667
                     '0'
668 668
                 );
669 669
                 foreach ($rows as $record) {
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
                             'current_field' => 'pw',
676 676
                             'value_id' => $record['id'],
677 677
                             'value' => $record['pw'],
678
-                            'current_sql' => 'UPDATE ' . prefixTable('items') . " SET pw = '" . $record['pw'] . "' WHERE id = '" . $record['id'] . "';",
678
+                            'current_sql' => 'UPDATE '.prefixTable('items')." SET pw = '".$record['pw']."' WHERE id = '".$record['id']."';",
679 679
                             'value2' => 'none',
680 680
                             'result' => 'none',
681 681
                         )
@@ -724,9 +724,9 @@  discard block
 block discarded – undo
724 724
                 //change all encrypted data in Logs (passwords)
725 725
                 $rows = DB::query(
726 726
                     'SELECT raison, increment_id
727
-                    FROM ' . prefixTable('log_items') . "
727
+                    FROM ' . prefixTable('log_items')."
728 728
                     WHERE action = %s AND raison LIKE 'at_pw :%'
729
-                    LIMIT " . $post_start . ', ' . $post_length,
729
+                    LIMIT " . $post_start.', '.$post_length,
730 730
                     'at_modification'
731 731
                 );
732 732
                 foreach ($rows as $record) {
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
                             'current_field' => 'raison',
739 739
                             'value_id' => $record['increment_id'],
740 740
                             'value' => $record['raison'],
741
-                            'current_sql' => 'UPDATE ' . prefixTable('log_items') . " SET raison = '" . $record['raison'] . "' WHERE increment_id = '" . $record['increment_id'] . "';",
741
+                            'current_sql' => 'UPDATE '.prefixTable('log_items')." SET raison = '".$record['raison']."' WHERE increment_id = '".$record['increment_id']."';",
742 742
                             'value2' => 'none',
743 743
                             'result' => 'none',
744 744
                         )
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
                         DB::update(
767 767
                             prefixTable('log_items'),
768 768
                             array(
769
-                                'raison' => 'at_pw :' . $encrypt['string'],
769
+                                'raison' => 'at_pw :'.$encrypt['string'],
770 770
                                 'encryption_type' => 'defuse',
771 771
                             ),
772 772
                             'increment_id = %i',
@@ -791,8 +791,8 @@  discard block
 block discarded – undo
791 791
                 //change all encrypted data in CATEGORIES (passwords)
792 792
                 $rows = DB::query(
793 793
                     'SELECT id, data
794
-                    FROM ' . prefixTable('categories_items') . '
795
-                    LIMIT ' . $post_start . ', ' . $post_length
794
+                    FROM ' . prefixTable('categories_items').'
795
+                    LIMIT ' . $post_start.', '.$post_length
796 796
                 );
797 797
                 foreach ($rows as $record) {
798 798
                     // backup data
@@ -803,7 +803,7 @@  discard block
 block discarded – undo
803 803
                             'current_field' => 'data',
804 804
                             'value_id' => $record['id'],
805 805
                             'value' => $record['data'],
806
-                            'current_sql' => 'UPDATE ' . prefixTable('categories_items') . " SET data = '" . $record['data'] . "' WHERE id = '" . $record['id'] . "';",
806
+                            'current_sql' => 'UPDATE '.prefixTable('categories_items')." SET data = '".$record['data']."' WHERE id = '".$record['id']."';",
807 807
                             'value2' => 'none',
808 808
                             'result' => 'none',
809 809
                         )
@@ -851,9 +851,9 @@  discard block
 block discarded – undo
851 851
                 // Change all encrypted data in FILES (passwords)
852 852
                 $rows = DB::query(
853 853
                     'SELECT id, file, status
854
-                    FROM ' . prefixTable('files') . "
854
+                    FROM ' . prefixTable('files')."
855 855
                     WHERE status = 'encrypted'
856
-                    LIMIT " . $post_start . ', ' . $post_length
856
+                    LIMIT " . $post_start.', '.$post_length
857 857
                 );
858 858
                 foreach ($rows as $record) {
859 859
                     // backup data
@@ -871,20 +871,20 @@  discard block
 block discarded – undo
871 871
                     );
872 872
                     $newID = DB::insertId();
873 873
 
874
-                    if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['file'])) {
874
+                    if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['file'])) {
875 875
                         // make a copy of file
876 876
                         if (!copy(
877
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
878
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '.copy'
877
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
878
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'.copy'
879 879
                         )) {
880 880
                             $error = 'Copy not possible';
881 881
                             exit;
882 882
                         } else {
883 883
                             // prepare a bck of file (that will not be deleted)
884
-                            $backup_filename = $record['file'] . '.bck-change-sk.' . time();
884
+                            $backup_filename = $record['file'].'.bck-change-sk.'.time();
885 885
                             copy(
886
-                                $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
887
-                                $SETTINGS['path_to_upload_folder'] . '/' . $backup_filename
886
+                                $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
887
+                                $SETTINGS['path_to_upload_folder'].'/'.$backup_filename
888 888
                             );
889 889
                         }
890 890
 
@@ -892,22 +892,22 @@  discard block
 block discarded – undo
892 892
                         // STEP1 - Do decryption
893 893
                         prepareFileWithDefuse(
894 894
                             'decrypt',
895
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
896
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted'
895
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
896
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted'
897 897
                         );
898 898
 
899 899
                         // Do cleanup of files
900
-                        unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['file']);
900
+                        unlink($SETTINGS['path_to_upload_folder'].'/'.$record['file']);
901 901
 
902 902
                         // STEP2 - Do encryption
903 903
                         prepareFileWithDefuse(
904 904
                             'encryp',
905
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted',
906
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file']
905
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted',
906
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file']
907 907
                         );
908 908
 
909 909
                         // Do cleanup of files
910
-                        unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted');
910
+                        unlink($SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted');
911 911
 
912 912
                         // Update backup table
913 913
                         DB::update(
@@ -933,13 +933,13 @@  discard block
 block discarded – undo
933 933
                 // do some things for new object
934 934
                 if (isset($objects[0])) {
935 935
                     if ($objects[0] === 'logs') {
936
-                        DB::query('SELECT increment_id FROM ' . prefixTable('log_items') . " WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
936
+                        DB::query('SELECT increment_id FROM '.prefixTable('log_items')." WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
937 937
                     } elseif ($objects[0] === 'files') {
938
-                        DB::query('SELECT id FROM ' . prefixTable('files'));
938
+                        DB::query('SELECT id FROM '.prefixTable('files'));
939 939
                     } elseif ($objects[0] === 'categories') {
940
-                        DB::query('SELECT id FROM ' . prefixTable('categories_items'));
940
+                        DB::query('SELECT id FROM '.prefixTable('categories_items'));
941 941
                     } elseif ($objects[0] === 'custfields') {
942
-                        DB::query('SELECT raison FROM ' . prefixTable('log_items') . " WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
942
+                        DB::query('SELECT raison FROM '.prefixTable('log_items')." WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
943 943
                     }
944 944
                     $nb_of_items = DB::count();
945 945
                 } else {
@@ -1059,12 +1059,12 @@  discard block
 block discarded – undo
1059 1059
                 );
1060 1060
             } elseif ($record['current_table'] === 'files') {
1061 1061
                 // restore backup file
1062
-                if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value'])) {
1063
-                    unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['value']);
1064
-                    if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value2'])) {
1062
+                if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value'])) {
1063
+                    unlink($SETTINGS['path_to_upload_folder'].'/'.$record['value']);
1064
+                    if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value2'])) {
1065 1065
                         rename(
1066
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['value2'],
1067
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['value']
1066
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['value2'],
1067
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['value']
1068 1068
                         );
1069 1069
                     }
1070 1070
                 }
@@ -1083,7 +1083,7 @@  discard block
 block discarded – undo
1083 1083
         }
1084 1084
 
1085 1085
         // drop table
1086
-        DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
1086
+        DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup'));
1087 1087
 
1088 1088
         // Send back
1089 1089
         echo prepareExchangedData(
@@ -1126,17 +1126,17 @@  discard block
 block discarded – undo
1126 1126
         // delete files
1127 1127
         $rows = DB::query(
1128 1128
             'SELECT value, value2
1129
-            FROM ' . prefixTable('sk_reencrypt_backup') . "
1129
+            FROM ' . prefixTable('sk_reencrypt_backup')."
1130 1130
             WHERE current_table = 'files'"
1131 1131
         );
1132 1132
         foreach ($rows as $record) {
1133
-            if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value2'])) {
1134
-                unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['value2']);
1133
+            if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value2'])) {
1134
+                unlink($SETTINGS['path_to_upload_folder'].'/'.$record['value2']);
1135 1135
             }
1136 1136
         }
1137 1137
 
1138 1138
         // drop table
1139
-        DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
1139
+        DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup'));
1140 1140
 
1141 1141
         echo '[{"status":"done"}]';
1142 1142
         break;
@@ -1167,7 +1167,7 @@  discard block
 block discarded – undo
1167 1167
                 'encode'
1168 1168
             );
1169 1169
         } else {
1170
-            require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1170
+            require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1171 1171
 
1172 1172
             //send email
1173 1173
             $emailSettings = new EmailSettings($SETTINGS);
@@ -1205,13 +1205,13 @@  discard block
 block discarded – undo
1205 1205
             break;
1206 1206
         }
1207 1207
 
1208
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1208
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1209 1209
         $emailSettings = new EmailSettings($SETTINGS);
1210 1210
         $emailService = new EmailService();
1211 1211
 
1212 1212
         $rows = DB::query(
1213 1213
             'SELECT *
1214
-            FROM ' . prefixTable('emails') . '
1214
+            FROM ' . prefixTable('emails').'
1215 1215
             WHERE status = %s OR status = %s',
1216 1216
             'not_sent',
1217 1217
             ''
@@ -1297,13 +1297,13 @@  discard block
 block discarded – undo
1297 1297
             break;
1298 1298
         }
1299 1299
 
1300
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1300
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1301 1301
 
1302 1302
         // Instatiate email settings and service
1303 1303
         $emailSettings = new EmailSettings($SETTINGS);
1304 1304
         $emailService = new EmailService();
1305 1305
 
1306
-        $rows = DB::query('SELECT * FROM ' . prefixTable('emails') . ' WHERE status = %s OR status = %s', 'not_sent', '');
1306
+        $rows = DB::query('SELECT * FROM '.prefixTable('emails').' WHERE status = %s OR status = %s', 'not_sent', '');
1307 1307
         foreach ($rows as $record) {
1308 1308
             //send email
1309 1309
             $email = $emailService->sendMail(
@@ -1372,7 +1372,7 @@  discard block
 block discarded – undo
1372 1372
             break;
1373 1373
         }
1374 1374
 
1375
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1375
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1376 1376
 
1377 1377
         // init
1378 1378
         $filesList = array();
@@ -1385,7 +1385,7 @@  discard block
 block discarded – undo
1385 1385
                 FROM ' . prefixTable('files')
1386 1386
             );
1387 1387
             foreach ($rows as $record) {
1388
-                if (is_file($SETTINGS['path_to_upload_folder'] . '/' . $record['file'])) {
1388
+                if (is_file($SETTINGS['path_to_upload_folder'].'/'.$record['file'])) {
1389 1389
                     $addFile = false;
1390 1390
                     if (($post_option === 'attachments-decrypt' && $record['status'] === 'encrypted')
1391 1391
                         || ($post_option === 'attachments-encrypt' && $record['status'] === 'clear')
@@ -1450,8 +1450,8 @@  discard block
 block discarded – undo
1450 1450
         $post_list = filter_var_array($post_list, FILTER_SANITIZE_FULL_SPECIAL_CHARS);
1451 1451
         $post_counter = filter_var($post_counter, FILTER_SANITIZE_NUMBER_INT);
1452 1452
 
1453
-        include $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
1454
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1453
+        include $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
1454
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1455 1455
 
1456 1456
         $cpt = 0;
1457 1457
         $continu = true;
@@ -1464,33 +1464,33 @@  discard block
 block discarded – undo
1464 1464
                 // Get file name
1465 1465
                 $file_info = DB::queryFirstRow(
1466 1466
                     'SELECT file
1467
-                    FROM ' . prefixTable('files') . '
1467
+                    FROM ' . prefixTable('files').'
1468 1468
                     WHERE id = %i',
1469 1469
                     $file
1470 1470
                 );
1471 1471
 
1472 1472
                 // skip file is Coherancey not respected
1473
-                if (is_file($SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'])) {
1473
+                if (is_file($SETTINGS['path_to_upload_folder'].'/'.$file_info['file'])) {
1474 1474
                     // Case where we want to decrypt
1475 1475
                     if ($post_option === 'decrypt') {
1476 1476
                         prepareFileWithDefuse(
1477 1477
                             'decrypt',
1478
-                            $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'],
1479
-                            $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
1478
+                            $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'],
1479
+                            $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
1480 1480
                         );
1481 1481
                         // Case where we want to encrypt
1482 1482
                     } elseif ($post_option === 'encrypt') {
1483 1483
                         prepareFileWithDefuse(
1484 1484
                             'encrypt',
1485
-                            $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'],
1486
-                            $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
1485
+                            $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'],
1486
+                            $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
1487 1487
                         );
1488 1488
                     }
1489 1489
                     // Do file cleanup
1490
-                    fileDelete($SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'], $SETTINGS);
1490
+                    fileDelete($SETTINGS['path_to_upload_folder'].'/'.$file_info['file'], $SETTINGS);
1491 1491
                     rename(
1492
-                        $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
1493
-                        $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file']
1492
+                        $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
1493
+                        $SETTINGS['path_to_upload_folder'].'/'.$file_info['file']
1494 1494
                     );
1495 1495
 
1496 1496
                     // store in DB
@@ -1525,8 +1525,8 @@  discard block
 block discarded – undo
1525 1525
                 $post_option === 'attachments-decrypt' ? 'clear' : 'encrypted'
1526 1526
             );
1527 1527
 
1528
-            $message = $lang->get('last_execution') . ' ' .
1529
-                date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
1528
+            $message = $lang->get('last_execution').' '.
1529
+                date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
1530 1530
                 '<i class="fas fa-check text-success ml-2 mr-3"></i>';
1531 1531
         }
1532 1532
 
@@ -1620,7 +1620,7 @@  discard block
 block discarded – undo
1620 1620
             $post_id = filter_var($dataReceived['id'], FILTER_SANITIZE_NUMBER_INT);
1621 1621
 
1622 1622
             DB::query(
1623
-                'DELETE FROM ' . prefixTable('api') . ' WHERE increment_id = %i',
1623
+                'DELETE FROM '.prefixTable('api').' WHERE increment_id = %i',
1624 1624
                 $post_id
1625 1625
             );
1626 1626
         }
@@ -1715,7 +1715,7 @@  discard block
 block discarded – undo
1715 1715
             // Delete existing key
1716 1716
         } elseif (null !== $post_action && $post_action === 'delete') {
1717 1717
             $post_id = filter_var($dataReceived['id'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
1718
-            DB::query('DELETE FROM ' . prefixTable('api') . ' WHERE increment_id=%i', $post_id);
1718
+            DB::query('DELETE FROM '.prefixTable('api').' WHERE increment_id=%i', $post_id);
1719 1719
         }
1720 1720
 
1721 1721
         echo prepareExchangedData(
@@ -1730,7 +1730,7 @@  discard block
 block discarded – undo
1730 1730
 
1731 1731
     case 'save_api_status':
1732 1732
         // Do query
1733
-        DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'api');
1733
+        DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'api');
1734 1734
         $counter = DB::count();
1735 1735
         if ($counter === 0) {
1736 1736
             DB::insert(
@@ -1759,7 +1759,7 @@  discard block
 block discarded – undo
1759 1759
 
1760 1760
     case 'run_duo_config_check':
1761 1761
         //Libraries call
1762
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1762
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1763 1763
         // Check KEY
1764 1764
         if ($post_key !== $session->get('key')) {
1765 1765
             echo prepareExchangedData(
@@ -1865,7 +1865,7 @@  discard block
 block discarded – undo
1865 1865
         } else {
1866 1866
             $tmp = 1;
1867 1867
         }
1868
-        DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'google_authentication');
1868
+        DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'google_authentication');
1869 1869
         $counter = DB::count();
1870 1870
         if ($counter === 0) {
1871 1871
             DB::insert(
@@ -1893,7 +1893,7 @@  discard block
 block discarded – undo
1893 1893
 
1894 1894
         // ga_website_name
1895 1895
         if (is_null($dataReceived['ga_website_name']) === false) {
1896
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'ga_website_name');
1896
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'ga_website_name');
1897 1897
             $counter = DB::count();
1898 1898
             if ($counter === 0) {
1899 1899
                 DB::insert(
@@ -1923,7 +1923,7 @@  discard block
 block discarded – undo
1923 1923
         }
1924 1924
 
1925 1925
         // send data
1926
-        echo '[{"result" : "' . addslashes($lang['done']) . '" , "error" : ""}]';
1926
+        echo '[{"result" : "'.addslashes($lang['done']).'" , "error" : ""}]';
1927 1927
         break;
1928 1928
 
1929 1929
     case 'save_agses_options':
@@ -1946,7 +1946,7 @@  discard block
 block discarded – undo
1946 1946
 
1947 1947
         // agses_hosted_url
1948 1948
         if (!is_null($dataReceived['agses_hosted_url'])) {
1949
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_url');
1949
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_url');
1950 1950
             $counter = DB::count();
1951 1951
             if ($counter === 0) {
1952 1952
                 DB::insert(
@@ -1977,7 +1977,7 @@  discard block
 block discarded – undo
1977 1977
 
1978 1978
         // agses_hosted_id
1979 1979
         if (!is_null($dataReceived['agses_hosted_id'])) {
1980
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_id');
1980
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_id');
1981 1981
             $counter = DB::count();
1982 1982
             if ($counter === 0) {
1983 1983
                 DB::insert(
@@ -2008,7 +2008,7 @@  discard block
 block discarded – undo
2008 2008
 
2009 2009
         // agses_hosted_apikey
2010 2010
         if (!is_null($dataReceived['agses_hosted_apikey'])) {
2011
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_apikey');
2011
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_apikey');
2012 2012
             $counter = DB::count();
2013 2013
             if ($counter === 0) {
2014 2014
                 DB::insert(
@@ -2038,7 +2038,7 @@  discard block
 block discarded – undo
2038 2038
         }
2039 2039
 
2040 2040
         // send data
2041
-        echo '[{"result" : "' . addslashes($lang['done']) . '" , "error" : ""}]';
2041
+        echo '[{"result" : "'.addslashes($lang['done']).'" , "error" : ""}]';
2042 2042
         break;
2043 2043
 
2044 2044
     case 'save_option_change':
@@ -2078,7 +2078,7 @@  discard block
 block discarded – undo
2078 2078
 
2079 2079
         // Check if setting is already in DB. If NO then insert, if YES then update.
2080 2080
         $data = DB::query(
2081
-            'SELECT * FROM ' . prefixTable('misc') . '
2081
+            'SELECT * FROM '.prefixTable('misc').'
2082 2082
             WHERE type = %s AND intitule = %s',
2083 2083
             'admin',
2084 2084
             $post_field
@@ -2101,7 +2101,7 @@  discard block
 block discarded – undo
2101 2101
                     array(
2102 2102
                         'valeur' => time(),
2103 2103
                         'type' => 'admin',
2104
-                        'intitule' => $post_field . '_time',
2104
+                        'intitule' => $post_field.'_time',
2105 2105
                         'updated_at' => time(),
2106 2106
                     )
2107 2107
                 );
@@ -2123,10 +2123,10 @@  discard block
 block discarded – undo
2123 2123
             if ($post_field === 'send_stats') {
2124 2124
                 // Check if previous time exists, if not them insert this value in DB
2125 2125
                 DB::query(
2126
-                    'SELECT * FROM ' . prefixTable('misc') . '
2126
+                    'SELECT * FROM '.prefixTable('misc').'
2127 2127
                     WHERE type = %s AND intitule = %s',
2128 2128
                     'admin',
2129
-                    $post_field . '_time'
2129
+                    $post_field.'_time'
2130 2130
                 );
2131 2131
                 $counter = DB::count();
2132 2132
                 if ($counter === 0) {
@@ -2135,7 +2135,7 @@  discard block
 block discarded – undo
2135 2135
                         array(
2136 2136
                             'valeur' => 0,
2137 2137
                             'type' => 'admin',
2138
-                            'intitule' => $post_field . '_time',
2138
+                            'intitule' => $post_field.'_time',
2139 2139
                             'created_at' => time(),
2140 2140
                         )
2141 2141
                     );
@@ -2157,13 +2157,13 @@  discard block
 block discarded – undo
2157 2157
         // special Cases
2158 2158
         if ($post_field === 'cpassman_url') {
2159 2159
             // update also jsUrl for CSFP protection
2160
-            $jsUrl = $post_value . '/includes/libraries/csrfp/js/csrfprotector.js';
2160
+            $jsUrl = $post_value.'/includes/libraries/csrfp/js/csrfprotector.js';
2161 2161
             $csrfp_file = '../includes/libraries/csrfp/libs/csrfp.config.php';
2162 2162
             $data = file_get_contents($csrfp_file);
2163 2163
             $posJsUrl = strpos($data, '"jsUrl" => "');
2164 2164
             $posEndLine = strpos($data, '",', $posJsUrl);
2165 2165
             $line = substr($data, $posJsUrl, ($posEndLine - $posJsUrl + 2));
2166
-            $newdata = str_replace($line, '"jsUrl" => "' . filter_var($jsUrl, FILTER_SANITIZE_FULL_SPECIAL_CHARS) . '",', $data);
2166
+            $newdata = str_replace($line, '"jsUrl" => "'.filter_var($jsUrl, FILTER_SANITIZE_FULL_SPECIAL_CHARS).'",', $data);
2167 2167
             file_put_contents($csrfp_file, $newdata);
2168 2168
         } elseif ($post_field === 'restricted_to_input' && (int) $post_value === 0) {
2169 2169
             DB::update(
@@ -2188,7 +2188,7 @@  discard block
 block discarded – undo
2188 2188
         echo prepareExchangedData(
2189 2189
             array(
2190 2190
                 'error' => false,
2191
-                'misc' => $counter . ' ; ' . $SETTINGS[$post_field],
2191
+                'misc' => $counter.' ; '.$SETTINGS[$post_field],
2192 2192
                 'message' => empty($post_translate) === false ? $lang->get($post_translate) : '',
2193 2193
             ),
2194 2194
             'encode'
@@ -2231,7 +2231,7 @@  discard block
 block discarded – undo
2231 2231
 
2232 2232
         // send statistics
2233 2233
         if (null !== $post_status) {
2234
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'send_stats');
2234
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'send_stats');
2235 2235
             $counter = DB::count();
2236 2236
             if ($counter === 0) {
2237 2237
                 DB::insert(
@@ -2262,7 +2262,7 @@  discard block
 block discarded – undo
2262 2262
 
2263 2263
         // send statistics items
2264 2264
         if (null !== $post_list) {
2265
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'send_statistics_items');
2265
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'send_statistics_items');
2266 2266
             $counter = DB::count();
2267 2267
             if ($counter === 0) {
2268 2268
                 DB::insert(
@@ -2308,7 +2308,7 @@  discard block
 block discarded – undo
2308 2308
             break;
2309 2309
         }
2310 2310
 
2311
-        if (DB::query("SHOW TABLES LIKE '" . prefixTable('sk_reencrypt_backup') . "'")) {
2311
+        if (DB::query("SHOW TABLES LIKE '".prefixTable('sk_reencrypt_backup')."'")) {
2312 2312
             if (DB::count() === 1) {
2313 2313
                 echo 1;
2314 2314
             } else {
@@ -2346,7 +2346,7 @@  discard block
 block discarded – undo
2346 2346
 
2347 2347
         $rows = DB::query(
2348 2348
             'SELECT id, title
2349
-                FROM ' . prefixTable('roles_title') . '
2349
+                FROM ' . prefixTable('roles_title').'
2350 2350
                 ORDER BY title ASC'
2351 2351
         );
2352 2352
         foreach ($rows as $record) {
@@ -2462,7 +2462,7 @@  discard block
 block discarded – undo
2462 2462
 function tablesIntegrityCheck(): array
2463 2463
 {
2464 2464
     // Get integrity tables file
2465
-    $integrityTablesFile = TEAMPASS_ROOT_PATH . '/includes/tables_integrity.json';
2465
+    $integrityTablesFile = TEAMPASS_ROOT_PATH.'/includes/tables_integrity.json';
2466 2466
     if (file_exists($integrityTablesFile) === false) {
2467 2467
         return [
2468 2468
             'error' => true,
@@ -2480,7 +2480,7 @@  discard block
 block discarded – undo
2480 2480
     // Get all tables
2481 2481
     $tables = [];
2482 2482
     foreach (DB::queryFirstColumn("SHOW TABLES") as $table) {
2483
-        $tables[] = str_replace(DB_PREFIX, "", $table);;
2483
+        $tables[] = str_replace(DB_PREFIX, "", $table); ;
2484 2484
     }
2485 2485
     // Prepare the integrity check
2486 2486
     $tablesInError = [];
Please login to merge, or discard this patch.