Passed
Pull Request — master (#4638)
by Nils
05:48
created
sources/items.queries.php 2 patches
Spacing   +280 added lines, -281 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 ) {
80 80
     // Not allowed page
81 81
     $session->set('system-error_code', ERR_NOT_ALLOWED);
82
-    include $SETTINGS['cpassman_dir'] . '/error.php';
82
+    include $SETTINGS['cpassman_dir'].'/error.php';
83 83
     exit;
84 84
 }
85 85
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     date_default_timezone_set('UTC');
105 105
 }
106 106
 
107
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $session->get('user-language') . '.php';
107
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$session->get('user-language').'.php';
108 108
 header('Content-type: text/html; charset=utf-8');
109 109
 header('Cache-Control: no-cache, must-revalidate');
110 110
 
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
             // About special settings
365 365
             $dataFolderSettings = DB::queryFirstRow(
366 366
                 'SELECT bloquer_creation, bloquer_modification, personal_folder
367
-                FROM ' . prefixTable('nested_tree') . ' 
367
+                FROM ' . prefixTable('nested_tree').' 
368 368
                 WHERE id = %i',
369 369
                 $inputData['folderId']
370 370
             );
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
             // Get folder complexity
382 382
             $folderComplexity = DB::queryfirstrow(
383 383
                 'SELECT valeur
384
-                FROM ' . prefixTable('misc') . '
384
+                FROM ' . prefixTable('misc').'
385 385
                 WHERE type = %s AND intitule = %i',
386 386
                 'complex',
387 387
                 $inputData['folderId']
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
             $itemExists = 0;
407 407
             $newID = '';
408 408
             $data = DB::queryfirstrow(
409
-                'SELECT * FROM ' . prefixTable('items') . '
409
+                'SELECT * FROM '.prefixTable('items').'
410 410
                 WHERE label = %s AND inactif = %i',
411 411
                 $inputData['label'],
412 412
                 0
@@ -489,8 +489,8 @@  discard block
 block discarded – undo
489 489
                     (int) $post_folder_is_personal,
490 490
                     (int) $newID,
491 491
                     $cryptedStuff['objectKey'],
492
-                    true,   // only for the item creator
493
-                    false,  // no delete all
492
+                    true, // only for the item creator
493
+                    false, // no delete all
494 494
                 );
495 495
 
496 496
                 // update fields
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
                             // should we encrypt the data
504 504
                             $dataTmp = DB::queryFirstRow(
505 505
                                 'SELECT encrypted_data
506
-                                FROM ' . prefixTable('categories') . '
506
+                                FROM ' . prefixTable('categories').'
507 507
                                 WHERE id = %i',
508 508
                                 $field['id']
509 509
                             );
@@ -532,8 +532,8 @@  discard block
 block discarded – undo
532 532
                                     (int) $post_folder_is_personal,
533 533
                                     (int) $newObjectId,
534 534
                                     $cryptedStuff['objectKey'],
535
-                                    true,   // only for the item creator
536
-                                    false,  // no delete all
535
+                                    true, // only for the item creator
536
+                                    false, // no delete all
537 537
                                 );
538 538
 
539 539
                                 array_push(
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
                 ) {
571 571
                     DB::queryFirstRow(
572 572
                         'SELECT *
573
-                        FROM ' . prefixTable('templates') . '
573
+                        FROM ' . prefixTable('templates').'
574 574
                         WHERE item_id = %i',
575 575
                         $newID
576 576
                     );
@@ -639,11 +639,11 @@  discard block
 block discarded – undo
639 639
                 ) {
640 640
                     foreach ($post_restricted_to as $userRest) {
641 641
                         if (empty($userRest) === false) {
642
-                            $dataTmp = DB::queryfirstrow('SELECT login FROM ' . prefixTable('users') . ' WHERE id= %i', $userRest);
642
+                            $dataTmp = DB::queryfirstrow('SELECT login FROM '.prefixTable('users').' WHERE id= %i', $userRest);
643 643
                             if (empty($listOfRestricted)) {
644 644
                                 $listOfRestricted = $dataTmp['login'];
645 645
                             } else {
646
-                                $listOfRestricted .= ';' . $dataTmp['login'];
646
+                                $listOfRestricted .= ';'.$dataTmp['login'];
647 647
                             }
648 648
                         }
649 649
                     }
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
                             if (empty($userRest) === false) {
660 660
                                 $dataTmp = DB::queryfirstrow(
661 661
                                     'SELECT login
662
-                                    FROM ' . prefixTable('users') . '
662
+                                    FROM ' . prefixTable('users').'
663 663
                                     WHERE id= %i',
664 664
                                     $userRest
665 665
                                 );
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
                                 if (empty($oldRestrictionList) === true) {
668 668
                                     $oldRestrictionList = $dataTmp['login'];
669 669
                                 } else {
670
-                                    $oldRestrictionList .= ';' . $dataTmp['login'];
670
+                                    $oldRestrictionList .= ';'.$dataTmp['login'];
671 671
                                 }
672 672
                             }
673 673
                         }
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
                 if (empty($post_uploaded_file_id) === false) {
731 731
                     $rows = DB::query(
732 732
                         'SELECT id
733
-                        FROM ' . prefixTable('files') . '
733
+                        FROM ' . prefixTable('files').'
734 734
                         WHERE id_item = %s',
735 735
                         $post_uploaded_file_id
736 736
                     );
@@ -786,7 +786,7 @@  discard block
 block discarded – undo
786 786
                                     $lang->get('email_subject_item_updated'),
787 787
                                     str_replace(
788 788
                                         array('#label', '#link'),
789
-                                            array($path, $SETTINGS['email_server_url'] . '/index.php?page=items&group=' . $inputData['folderId'] . '&id=' . $newID . $txt['email_body3']),
789
+                                            array($path, $SETTINGS['email_server_url'].'/index.php?page=items&group='.$inputData['folderId'].'&id='.$newID.$txt['email_body3']),
790 790
                                             $lang->get('new_item_email_body')
791 791
                                     ),
792 792
                                     $emailAddress,
@@ -890,11 +890,11 @@  discard block
 block discarded – undo
890 890
         // Prepare variables
891 891
         $itemInfos = array();
892 892
         $inputData['label'] = isset($dataReceived['label']) && is_string($dataReceived['label']) ? filter_var($dataReceived['label'], FILTER_SANITIZE_FULL_SPECIAL_CHARS) : '';
893
-        $post_url = isset($dataReceived['url'])=== true ? filter_var(htmlspecialchars_decode($dataReceived['url']), FILTER_SANITIZE_URL) : '';
893
+        $post_url = isset($dataReceived['url']) === true ? filter_var(htmlspecialchars_decode($dataReceived['url']), FILTER_SANITIZE_URL) : '';
894 894
         $post_password = $original_pw = isset($dataReceived['pw']) && is_string($dataReceived['pw']) ? htmlspecialchars_decode($dataReceived['pw']) : '';
895 895
         $post_login = isset($dataReceived['login']) && is_string($dataReceived['login']) ? filter_var(htmlspecialchars_decode($dataReceived['login']), FILTER_SANITIZE_FULL_SPECIAL_CHARS) : '';
896
-        $post_tags = isset($dataReceived['tags'])=== true ? htmlspecialchars($dataReceived['tags']) : '';
897
-        $post_email = isset($dataReceived['email'])=== true ? filter_var(htmlspecialchars_decode($dataReceived['email']), FILTER_SANITIZE_EMAIL) : '';
896
+        $post_tags = isset($dataReceived['tags']) === true ? htmlspecialchars($dataReceived['tags']) : '';
897
+        $post_email = isset($dataReceived['email']) === true ? filter_var(htmlspecialchars_decode($dataReceived['email']), FILTER_SANITIZE_EMAIL) : '';
898 898
         $post_template_id = (int) filter_var($dataReceived['template_id'], FILTER_SANITIZE_NUMBER_INT);
899 899
         $inputData['itemId'] = (int) filter_var($dataReceived['id'], FILTER_SANITIZE_NUMBER_INT);
900 900
         $post_anyone_can_modify = (int) filter_var($dataReceived['anyone_can_modify'], FILTER_SANITIZE_NUMBER_INT);
@@ -925,8 +925,7 @@  discard block
 block discarded – undo
925 925
         $post_to_be_deleted_after_date = isset($dataReceived['to_be_deleted_after_date']) === true ? filter_var(
926 926
                 $dataReceived['to_be_deleted_after_date'],
927 927
                 FILTER_SANITIZE_FULL_SPECIAL_CHARS
928
-            ) :
929
-            '';
928
+            ) : '';
930 929
         $post_fields = (filter_var_array(
931 930
             $dataReceived['fields'],
932 931
             FILTER_SANITIZE_FULL_SPECIAL_CHARS
@@ -986,7 +985,7 @@  discard block
 block discarded – undo
986 985
         // About special settings
987 986
         $dataFolderSettings = DB::queryFirstRow(
988 987
             'SELECT bloquer_creation, bloquer_modification, personal_folder, title
989
-            FROM ' . prefixTable('nested_tree') . ' 
988
+            FROM ' . prefixTable('nested_tree').' 
990 989
             WHERE id = %i',
991 990
             $inputData['folderId']
992 991
         );
@@ -1002,7 +1001,7 @@  discard block
 block discarded – undo
1002 1001
         // Get folder complexity
1003 1002
         $folderComplexity = DB::queryfirstrow(
1004 1003
             'SELECT valeur
1005
-            FROM ' . prefixTable('misc') . '
1004
+            FROM ' . prefixTable('misc').'
1006 1005
             WHERE type = %s AND intitule = %i',
1007 1006
             'complex',
1008 1007
             $inputData['folderId']
@@ -1047,8 +1046,8 @@  discard block
 block discarded – undo
1047 1046
         // Get all informations for this item
1048 1047
         $dataItem = DB::queryfirstrow(
1049 1048
             'SELECT *
1050
-            FROM ' . prefixTable('items') . ' as i
1051
-            INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
1049
+            FROM ' . prefixTable('items').' as i
1050
+            INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
1052 1051
             WHERE i.id=%i AND l.action = %s',
1053 1052
             $inputData['itemId'],
1054 1053
             'at_creation'
@@ -1097,7 +1096,7 @@  discard block
 block discarded – undo
1097 1096
         //db::debugmode(true);
1098 1097
         DB::query(
1099 1098
             'SELECT *
1100
-            FROM ' . prefixTable('sharekeys_items') . '
1099
+            FROM ' . prefixTable('sharekeys_items').'
1101 1100
             WHERE object_id = %i AND user_id = %s',
1102 1101
             $inputData['itemId'],
1103 1102
             $session->get('user-id')
@@ -1149,9 +1148,9 @@  discard block
 block discarded – undo
1149 1148
                 'SELECT i.id as id, i.label as label, i.description as description, i.pw as pw, i.url as url, i.id_tree as id_tree, i.perso as perso, i.login as login, 
1150 1149
                 i.inactif as inactif, i.restricted_to as restricted_to, i.anyone_can_modify as anyone_can_modify, i.email as email, i.notification as notification,
1151 1150
                 u.login as user_login, u.email as user_email
1152
-                FROM ' . prefixTable('items') . ' as i
1153
-                INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id=l.id_item)
1154
-                INNER JOIN ' . prefixTable('users') . ' as u ON (u.id=l.id_user)
1151
+                FROM ' . prefixTable('items').' as i
1152
+                INNER JOIN ' . prefixTable('log_items').' as l ON (i.id=l.id_item)
1153
+                INNER JOIN ' . prefixTable('users').' as u ON (u.id=l.id_user)
1155 1154
                 WHERE i.id=%i',
1156 1155
                 $inputData['itemId']
1157 1156
             );
@@ -1159,7 +1158,7 @@  discard block
 block discarded – undo
1159 1158
             // Should we log a password change?
1160 1159
             $userKey = DB::queryFirstRow(
1161 1160
                 'SELECT share_key
1162
-                FROM ' . prefixTable('sharekeys_items') . '
1161
+                FROM ' . prefixTable('sharekeys_items').'
1163 1162
                 WHERE user_id = %i AND object_id = %i',
1164 1163
                 $session->get('user-id'),
1165 1164
                 $inputData['itemId']
@@ -1218,12 +1217,12 @@  discard block
 block discarded – undo
1218 1217
                     (int) $post_folder_is_personal,
1219 1218
                     (int) $inputData['itemId'],
1220 1219
                     $encrypted_password_key,
1221
-                    true,   // only for the item creator
1222
-                    true,   // delete all
1220
+                    true, // only for the item creator
1221
+                    true, // delete all
1223 1222
                 );
1224 1223
 
1225 1224
                 // Create a task to create sharekeys for users
1226
-                if (WIP=== true) error_log('createTaskForItem - new password for this item - '.$post_password ." -- ". $pw);
1225
+                if (WIP === true) error_log('createTaskForItem - new password for this item - '.$post_password." -- ".$pw);
1227 1226
                 $tasksToBePerformed = ['item_password'];
1228 1227
                 $encryptionTaskIsRequested = true;
1229 1228
             } else {
@@ -1234,7 +1233,7 @@  discard block
 block discarded – undo
1234 1233
             // Get list of tags
1235 1234
             $itemTags = DB::queryFirstColumn(
1236 1235
                 'SELECT tag
1237
-                FROM ' . prefixTable('tags') . '
1236
+                FROM ' . prefixTable('tags').'
1238 1237
                 WHERE item_id = %i',
1239 1238
                 $inputData['itemId']
1240 1239
             );
@@ -1280,7 +1279,7 @@  discard block
 block discarded – undo
1280 1279
                     $session->get('user-id'),
1281 1280
                     'at_modification',
1282 1281
                     $session->get('user-login'),
1283
-                    'at_tag : ' . implode(' ', $itemTags) . ' => ' . $post_tags
1282
+                    'at_tag : '.implode(' ', $itemTags).' => '.$post_tags
1284 1283
                 );
1285 1284
             }
1286 1285
 
@@ -1320,8 +1319,8 @@  discard block
 block discarded – undo
1320 1319
                             'SELECT c.id AS id, c.title AS title, i.data AS data, i.data_iv AS data_iv,
1321 1320
                             i.encryption_type AS encryption_type, c.encrypted_data AS encrypted_data,
1322 1321
                             c.masked AS masked, i.id AS field_item_id
1323
-                            FROM ' . prefixTable('categories_items') . ' AS i
1324
-                            INNER JOIN ' . prefixTable('categories') . ' AS c ON (i.field_id=c.id)
1322
+                            FROM ' . prefixTable('categories_items').' AS i
1323
+                            INNER JOIN ' . prefixTable('categories').' AS c ON (i.field_id=c.id)
1325 1324
                             WHERE i.field_id = %i AND i.item_id = %i',
1326 1325
                             $field['id'],
1327 1326
                             $inputData['itemId']
@@ -1337,7 +1336,7 @@  discard block
 block discarded – undo
1337 1336
                             // Perform new query
1338 1337
                             $dataTmpCat = DB::queryFirstRow(
1339 1338
                                 'SELECT id, title, encrypted_data, masked
1340
-                                FROM ' . prefixTable('categories') . '
1339
+                                FROM ' . prefixTable('categories').'
1341 1340
                                 WHERE id = %i',
1342 1341
                                 $field['id']
1343 1342
                             );
@@ -1367,8 +1366,8 @@  discard block
 block discarded – undo
1367 1366
                                     (int) $post_folder_is_personal,
1368 1367
                                     (int) $newId,
1369 1368
                                     $cryptedStuff['objectKey'],
1370
-                                    true,   // only for the item creator
1371
-                                    true,   // delete all
1369
+                                    true, // only for the item creator
1370
+                                    true, // delete all
1372 1371
                                 );
1373 1372
 
1374 1373
                                 // update value
@@ -1416,7 +1415,7 @@  discard block
 block discarded – undo
1416 1415
                                 $session->get('user-id'),
1417 1416
                                 'at_modification',
1418 1417
                                 $session->get('user-login'),
1419
-                                'at_field : ' . $dataTmpCat['title'] . ' : ' . $field['value']
1418
+                                'at_field : '.$dataTmpCat['title'].' : '.$field['value']
1420 1419
                             );
1421 1420
                         } else {
1422 1421
                             // Case where the field already exists
@@ -1425,7 +1424,7 @@  discard block
 block discarded – undo
1425 1424
                                 // Get user sharekey for this field
1426 1425
                                 $userKey = DB::queryFirstRow(
1427 1426
                                     'SELECT share_key
1428
-                                    FROM ' . prefixTable('sharekeys_fields') . '
1427
+                                    FROM ' . prefixTable('sharekeys_fields').'
1429 1428
                                     WHERE user_id = %i AND object_id = %i',
1430 1429
                                     $session->get('user-id'),
1431 1430
                                     $dataTmpCat['field_item_id']
@@ -1464,8 +1463,8 @@  discard block
 block discarded – undo
1464 1463
                                         (int) $post_folder_is_personal,
1465 1464
                                         (int) $dataTmpCat['field_item_id'],
1466 1465
                                         $cryptedStuff['objectKey'],
1467
-                                        true,   // only for the item creator
1468
-                                        true,   // delete all
1466
+                                        true, // only for the item creator
1467
+                                        true, // delete all
1469 1468
                                     );
1470 1469
 
1471 1470
                                     array_push(
@@ -1505,7 +1504,7 @@  discard block
 block discarded – undo
1505 1504
                                     $session->get('user-id'),
1506 1505
                                     'at_modification',
1507 1506
                                     $session->get('user-login'),
1508
-                                    'at_field : ' . $dataTmpCat['title'] . ' => ' . $oldVal
1507
+                                    'at_field : '.$dataTmpCat['title'].' => '.$oldVal
1509 1508
                                 );
1510 1509
                             }
1511 1510
                         }
@@ -1560,7 +1559,7 @@  discard block
 block discarded – undo
1560 1559
             ) {
1561 1560
                 DB::queryFirstRow(
1562 1561
                     'SELECT *
1563
-                    FROM ' . prefixTable('templates') . '
1562
+                    FROM ' . prefixTable('templates').'
1564 1563
                     WHERE item_id = %i',
1565 1564
                     $inputData['itemId']
1566 1565
                 );
@@ -1603,7 +1602,7 @@  discard block
 block discarded – undo
1603 1602
                 // check if elem exists in Table. If not add it or update it.
1604 1603
                 DB::query(
1605 1604
                     'SELECT *
1606
-                    FROM ' . prefixTable('automatic_del') . '
1605
+                    FROM ' . prefixTable('automatic_del').'
1607 1606
                     WHERE item_id = %i',
1608 1607
                     $inputData['itemId']
1609 1608
                 );
@@ -1630,7 +1629,7 @@  discard block
 block discarded – undo
1630 1629
                         // Store updates performed
1631 1630
                         array_push(
1632 1631
                             $arrayOfChanges,
1633
-                            $lang->get('automatic_deletion_engaged') . ': ' . $lang->get('enabled')
1632
+                            $lang->get('automatic_deletion_engaged').': '.$lang->get('enabled')
1634 1633
                         );
1635 1634
 
1636 1635
                         // update LOG
@@ -1673,7 +1672,7 @@  discard block
 block discarded – undo
1673 1672
                         // Store updates performed
1674 1673
                         array_push(
1675 1674
                             $arrayOfChanges,
1676
-                            $lang->get('automatic_deletion_engaged') . ': ' . $lang->get('disabled')
1675
+                            $lang->get('automatic_deletion_engaged').': '.$lang->get('disabled')
1677 1676
                         );
1678 1677
 
1679 1678
                         // update LOG
@@ -1706,7 +1705,7 @@  discard block
 block discarded – undo
1706 1705
                     if (empty($userId) === false) {
1707 1706
                         $dataTmp = DB::queryfirstrow(
1708 1707
                             'SELECT id, name, lastname
1709
-                            FROM ' . prefixTable('users') . '
1708
+                            FROM ' . prefixTable('users').'
1710 1709
                             WHERE id= %i',
1711 1710
                             $userId
1712 1711
                         );
@@ -1714,7 +1713,7 @@  discard block
 block discarded – undo
1714 1713
                         // Add to array
1715 1714
                         array_push(
1716 1715
                             $arrayOfUsersRestriction,
1717
-                            $dataTmp['name'] . ' ' . $dataTmp['lastname']
1716
+                            $dataTmp['name'].' '.$dataTmp['lastname']
1718 1717
                         );
1719 1718
                         array_push(
1720 1719
                             $arrayOfUsersIdRestriction,
@@ -1745,8 +1744,8 @@  discard block
 block discarded – undo
1745 1744
                 // get values before deleting them
1746 1745
                 $rows = DB::query(
1747 1746
                     'SELECT t.title, t.id AS id
1748
-                    FROM ' . prefixTable('roles_title') . ' as t
1749
-                    INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (t.id=r.role_id)
1747
+                    FROM ' . prefixTable('roles_title').' as t
1748
+                    INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (t.id=r.role_id)
1750 1749
                     WHERE r.item_id = %i
1751 1750
                     ORDER BY t.title ASC',
1752 1751
                     $inputData['itemId']
@@ -1780,7 +1779,7 @@  discard block
 block discarded – undo
1780 1779
                         );
1781 1780
                         $dataTmp = DB::queryfirstrow(
1782 1781
                             'SELECT title
1783
-                            FROM ' . prefixTable('roles_title') . '
1782
+                            FROM ' . prefixTable('roles_title').'
1784 1783
                             WHERE id = %i',
1785 1784
                             $role
1786 1785
                         );
@@ -1808,7 +1807,7 @@  discard block
 block discarded – undo
1808 1807
             // Get current status
1809 1808
             $otpStatus = DB::queryFirstRow(
1810 1809
                 'SELECT enabled as otp_is_enabled
1811
-                FROM ' . prefixTable('items_otp') . '
1810
+                FROM ' . prefixTable('items_otp').'
1812 1811
                 WHERE item_id = %i',
1813 1812
                 $inputData['itemId']
1814 1813
             );
@@ -1839,7 +1838,7 @@  discard block
 block discarded – undo
1839 1838
                     $session->get('user-id'),
1840 1839
                     'at_modification',
1841 1840
                     $session->get('user-login'),
1842
-                    'at_otp_status:' . ((int) $post_otp_is_enabled === 0 ? 'disabled' : 'enabled')
1841
+                    'at_otp_status:'.((int) $post_otp_is_enabled === 0 ? 'disabled' : 'enabled')
1843 1842
                 );
1844 1843
             } elseif (DB::count() === 0 && empty($post_otp_secret) === false) {
1845 1844
                 // Create the entry in items_otp table
@@ -1883,8 +1882,8 @@  discard block
 block discarded – undo
1883 1882
                     $session->get('user-id'),
1884 1883
                     'at_modification',
1885 1884
                     $session->get('user-login'),
1886
-                    'at_restriction : ' . (count($diffUsersRestiction) > 0 ?
1887
-                        implode(', ', $arrayOfUsersRestriction) . (count($diffRolesRestiction) > 0 ? ', ' : '') : '') . (count($diffRolesRestiction) > 0 ? implode(', ', $arrayOfRestrictionRoles) : '')
1885
+                    'at_restriction : '.(count($diffUsersRestiction) > 0 ?
1886
+                        implode(', ', $arrayOfUsersRestriction).(count($diffRolesRestiction) > 0 ? ', ' : '') : '').(count($diffRolesRestiction) > 0 ? implode(', ', $arrayOfRestrictionRoles) : '')
1888 1887
                 );
1889 1888
             }
1890 1889
 
@@ -1904,7 +1903,7 @@  discard block
 block discarded – undo
1904 1903
                     $session->get('user-id'),
1905 1904
                     'at_modification',
1906 1905
                     $session->get('user-login'),
1907
-                    'at_label : ' . $data['label'] . ' => ' . $inputData['label']
1906
+                    'at_label : '.$data['label'].' => '.$inputData['label']
1908 1907
                 );
1909 1908
             }
1910 1909
             // LOGIN
@@ -1923,7 +1922,7 @@  discard block
 block discarded – undo
1923 1922
                     $session->get('user-id'),
1924 1923
                     'at_modification',
1925 1924
                     $session->get('user-login'),
1926
-                    'at_login : ' . $data['login'] . ' => ' . $post_login
1925
+                    'at_login : '.$data['login'].' => '.$post_login
1927 1926
                 );
1928 1927
             }
1929 1928
             // EMAIL
@@ -1942,7 +1941,7 @@  discard block
 block discarded – undo
1942 1941
                     $session->get('user-id'),
1943 1942
                     'at_modification',
1944 1943
                     $session->get('user-login'),
1945
-                    'at_email : ' . $data['email'] . ' => ' . $post_email
1944
+                    'at_email : '.$data['email'].' => '.$post_email
1946 1945
                 );
1947 1946
             }
1948 1947
             // URL
@@ -1961,7 +1960,7 @@  discard block
 block discarded – undo
1961 1960
                     $session->get('user-id'),
1962 1961
                     'at_modification',
1963 1962
                     $session->get('user-login'),
1964
-                    'at_url : ' . $data['url'] . ' => ' . $post_url
1963
+                    'at_url : '.$data['url'].' => '.$post_url
1965 1964
                 );
1966 1965
             }
1967 1966
             // DESCRIPTION
@@ -1987,7 +1986,7 @@  discard block
 block discarded – undo
1987 1986
             // FOLDER
1988 1987
             if ((int) $data['id_tree'] !== (int) $inputData['folderId']) {
1989 1988
                 // Get name of folders
1990
-                $dataTmp = DB::query('SELECT title FROM ' . prefixTable('nested_tree') . ' WHERE id IN %li', array($data['id_tree'], $inputData['folderId']));
1989
+                $dataTmp = DB::query('SELECT title FROM '.prefixTable('nested_tree').' WHERE id IN %li', array($data['id_tree'], $inputData['folderId']));
1991 1990
 
1992 1991
                 // Store updates performed
1993 1992
                 array_push(
@@ -2003,7 +2002,7 @@  discard block
 block discarded – undo
2003 2002
                     $session->get('user-id'),
2004 2003
                     'at_modification',
2005 2004
                     $session->get('user-login'),
2006
-                    'at_category : ' . $dataTmp[0]['title'] . ' => ' . $dataTmp[1]['title']
2005
+                    'at_category : '.$dataTmp[0]['title'].' => '.$dataTmp[1]['title']
2007 2006
                 );
2008 2007
             }
2009 2008
             // ANYONE_CAN_MODIFY
@@ -2011,7 +2010,7 @@  discard block
 block discarded – undo
2011 2010
                 // Store updates performed
2012 2011
                 array_push(
2013 2012
                     $arrayOfChanges,
2014
-                    $lang->get('at_anyoneconmodify') . ': ' . ((int) $post_anyone_can_modify === 0 ? $lang->get('disabled') : $lang->get('enabled'))
2013
+                    $lang->get('at_anyoneconmodify').': '.((int) $post_anyone_can_modify === 0 ? $lang->get('disabled') : $lang->get('enabled'))
2015 2014
                 );
2016 2015
 
2017 2016
                 // Log
@@ -2022,15 +2021,15 @@  discard block
 block discarded – undo
2022 2021
                     $session->get('user-id'),
2023 2022
                     'at_modification',
2024 2023
                     $session->get('user-login'),
2025
-                    'at_anyoneconmodify : ' . ((int) $post_anyone_can_modify === 0 ? 'disabled' : 'enabled')
2024
+                    'at_anyoneconmodify : '.((int) $post_anyone_can_modify === 0 ? 'disabled' : 'enabled')
2026 2025
                 );
2027 2026
             }
2028 2027
 
2029 2028
             // Reload new values
2030 2029
             $dataItem = DB::queryfirstrow(
2031 2030
                 'SELECT *
2032
-                FROM ' . prefixTable('items') . ' as i
2033
-                INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
2031
+                FROM ' . prefixTable('items').' as i
2032
+                INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
2034 2033
                 WHERE i.id = %i AND l.action = %s',
2035 2034
                 $inputData['itemId'],
2036 2035
                 'at_creation'
@@ -2039,8 +2038,8 @@  discard block
 block discarded – undo
2039 2038
             $history = '';
2040 2039
             $rows = DB::query(
2041 2040
                 'SELECT l.date as date, l.action as action, l.raison as raison, u.login as login
2042
-                FROM ' . prefixTable('log_items') . ' as l
2043
-                LEFT JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id)
2041
+                FROM ' . prefixTable('log_items').' as l
2042
+                LEFT JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id)
2044 2043
                 WHERE l.action <> %s AND id_item=%s',
2045 2044
                 'at_shown',
2046 2045
                 $inputData['itemId']
@@ -2049,14 +2048,14 @@  discard block
 block discarded – undo
2049 2048
                 if ($record['raison'] === NULL) continue;
2050 2049
                 $reason = explode(':', $record['raison']);
2051 2050
                 if (count($reason) > 0) {
2052
-                    $sentence = date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) . ' - '
2053
-                        . $record['login'] . ' - ' . $lang->get($record['action']) . ' - '
2054
-                        . (empty($record['raison']) === false ? (count($reason) > 1 ? $lang->get(trim($reason[0])) . ' : ' . $reason[1]
2051
+                    $sentence = date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']).' - '
2052
+                        . $record['login'].' - '.$lang->get($record['action']).' - '
2053
+                        . (empty($record['raison']) === false ? (count($reason) > 1 ? $lang->get(trim($reason[0])).' : '.$reason[1]
2055 2054
                             : $lang->get(trim($reason[0]))) : '');
2056 2055
                     if (empty($history)) {
2057 2056
                         $history = $sentence;
2058 2057
                     } else {
2059
-                        $history .= '<br />' . $sentence;
2058
+                        $history .= '<br />'.$sentence;
2060 2059
                     }
2061 2060
                 }
2062 2061
             }
@@ -2194,7 +2193,7 @@  discard block
 block discarded – undo
2194 2193
         ) {
2195 2194
             // load the original record into an array
2196 2195
             $originalRecord = DB::queryfirstrow(
2197
-                'SELECT * FROM ' . prefixTable('items') . '
2196
+                'SELECT * FROM '.prefixTable('items').'
2198 2197
                 WHERE id = %i',
2199 2198
                 $inputData['itemId']
2200 2199
             );
@@ -2213,7 +2212,7 @@  discard block
 block discarded – undo
2213 2212
 
2214 2213
             // Load the destination folder record into an array
2215 2214
             $dataDestination = DB::queryfirstrow(
2216
-                'SELECT personal_folder FROM ' . prefixTable('nested_tree') . '
2215
+                'SELECT personal_folder FROM '.prefixTable('nested_tree').'
2217 2216
                 WHERE id = %i',
2218 2217
                 $post_dest_id
2219 2218
             );
@@ -2221,7 +2220,7 @@  discard block
 block discarded – undo
2221 2220
             // Get the ITEM object key for the user
2222 2221
             $userKey = DB::queryFirstRow(
2223 2222
                 'SELECT share_key
2224
-                FROM ' . prefixTable('sharekeys_items') . '
2223
+                FROM ' . prefixTable('sharekeys_items').'
2225 2224
                 WHERE user_id = %i AND object_id = %i',
2226 2225
                 $session->get('user-id'),
2227 2226
                 $inputData['itemId']
@@ -2298,8 +2297,8 @@  discard block
 block discarded – undo
2298 2297
             // Manage Custom Fields
2299 2298
             $rows = DB::query(
2300 2299
                 'SELECT ci.id AS id, ci.data AS data, ci.field_id AS field_id, c.encrypted_data AS encrypted_data
2301
-                FROM ' . prefixTable('categories_items') . ' AS ci
2302
-                INNER JOIN ' . prefixTable('categories') . ' AS c ON (c.id = ci.field_id)
2300
+                FROM ' . prefixTable('categories_items').' AS ci
2301
+                INNER JOIN ' . prefixTable('categories').' AS c ON (c.id = ci.field_id)
2303 2302
                 WHERE ci.item_id = %i',
2304 2303
                 $inputData['itemId']
2305 2304
             );
@@ -2311,7 +2310,7 @@  discard block
 block discarded – undo
2311 2310
                     // Get user key
2312 2311
                     $userKey = DB::queryFirstRow(
2313 2312
                         'SELECT share_key
2314
-                        FROM ' . prefixTable('sharekeys_fields') . '
2313
+                        FROM ' . prefixTable('sharekeys_fields').'
2315 2314
                         WHERE user_id = %i AND object_id = %i',
2316 2315
                         $session->get('user-id'),
2317 2316
                         $field['id']
@@ -2378,15 +2377,15 @@  discard block
 block discarded – undo
2378 2377
             $rows = DB::query(
2379 2378
                 'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status, f.extension AS extension,
2380 2379
                 f.size AS size, f.type AS type, s.share_key AS share_key
2381
-                FROM ' . prefixTable('files') . ' AS f
2382
-                INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id)
2380
+                FROM ' . prefixTable('files').' AS f
2381
+                INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id)
2383 2382
                 WHERE s.user_id = %i AND f.id_item = %i',
2384 2383
                 $session->get('user-id'),
2385 2384
                 $inputData['itemId']
2386 2385
             );
2387 2386
             foreach ($rows as $record) {
2388 2387
                 // Check if file still exists
2389
-                if (file_exists($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . TP_FILE_PREFIX . base64_decode($record['file'])) === true) {
2388
+                if (file_exists($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.TP_FILE_PREFIX.base64_decode($record['file'])) === true) {
2390 2389
                     // Step1 - decrypt the file
2391 2390
                     // deepcode ignore PT: path is sanitized inside decryptFile()
2392 2391
                     $fileContent = decryptFile(
@@ -2397,8 +2396,8 @@  discard block
 block discarded – undo
2397 2396
 
2398 2397
                     // Step2 - create file
2399 2398
                     // deepcode ignore InsecureHash: md5 is used jonly for file name in order to get a hashed value in database
2400
-                    $newFileName = md5(time() . '_' . $record['id']) . '.' . $record['extension'];
2401
-                    $outstream = fopen($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . $newFileName, 'ab');
2399
+                    $newFileName = md5(time().'_'.$record['id']).'.'.$record['extension'];
2400
+                    $outstream = fopen($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.$newFileName, 'ab');
2402 2401
                     if ($outstream === false) {
2403 2402
                         echo prepareExchangedData(
2404 2403
                             array(
@@ -2471,7 +2470,7 @@  discard block
 block discarded – undo
2471 2470
 
2472 2471
             // -------------------------
2473 2472
             // Add specific restrictions
2474
-            $rows = DB::query('SELECT * FROM ' . prefixTable('restriction_to_roles') . ' WHERE item_id = %i', $inputData['itemId']);
2473
+            $rows = DB::query('SELECT * FROM '.prefixTable('restriction_to_roles').' WHERE item_id = %i', $inputData['itemId']);
2475 2474
             foreach ($rows as $record) {
2476 2475
                 DB::insert(
2477 2476
                     prefixTable('restriction_to_roles'),
@@ -2483,7 +2482,7 @@  discard block
 block discarded – undo
2483 2482
             }
2484 2483
 
2485 2484
             // Add Tags
2486
-            $rows = DB::query('SELECT * FROM ' . prefixTable('tags') . ' WHERE item_id = %i', $inputData['itemId']);
2485
+            $rows = DB::query('SELECT * FROM '.prefixTable('tags').' WHERE item_id = %i', $inputData['itemId']);
2487 2486
             foreach ($rows as $record) {
2488 2487
                 DB::insert(
2489 2488
                     prefixTable('tags'),
@@ -2584,7 +2583,7 @@  discard block
 block discarded – undo
2584 2583
         // then we can show it
2585 2584
         $item_deleted = DB::queryFirstRow(
2586 2585
             'SELECT *
2587
-            FROM ' . prefixTable('log_items') . '
2586
+            FROM ' . prefixTable('log_items').'
2588 2587
             WHERE id_item = %i AND action = %s
2589 2588
             ORDER BY date DESC
2590 2589
             LIMIT 0, 1',
@@ -2595,7 +2594,7 @@  discard block
 block discarded – undo
2595 2594
 
2596 2595
         $item_restored = DB::queryFirstRow(
2597 2596
             'SELECT *
2598
-            FROM ' . prefixTable('log_items') . '
2597
+            FROM ' . prefixTable('log_items').'
2599 2598
             WHERE id_item = %i AND action = %s
2600 2599
             ORDER BY date DESC
2601 2600
             LIMIT 0, 1',
@@ -2619,8 +2618,8 @@  discard block
 block discarded – undo
2619 2618
         // Get all informations for this item
2620 2619
         $dataItem = DB::queryfirstrow(
2621 2620
             'SELECT *
2622
-            FROM ' . prefixTable('items') . ' as i
2623
-            INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
2621
+            FROM ' . prefixTable('items').' as i
2622
+            INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
2624 2623
             WHERE i.id = %i AND l.action = %s',
2625 2624
             $inputData['id'],
2626 2625
             'at_creation'
@@ -2629,7 +2628,7 @@  discard block
 block discarded – undo
2629 2628
         // Notification
2630 2629
         DB::queryfirstrow(
2631 2630
             'SELECT *
2632
-            FROM ' . prefixTable('notification') . '
2631
+            FROM ' . prefixTable('notification').'
2633 2632
             WHERE item_id = %i AND user_id = %i',
2634 2633
             $inputData['id'],
2635 2634
             $session->get('user-id')
@@ -2648,7 +2647,7 @@  discard block
 block discarded – undo
2648 2647
 
2649 2648
         // manage case of API user
2650 2649
         if ($dataItem['id_user'] === API_USER_ID) {
2651
-            $arrData['author'] = 'API [' . $dataItem['description'] . ']';
2650
+            $arrData['author'] = 'API ['.$dataItem['description'].']';
2652 2651
             $arrData['id_user'] = API_USER_ID;
2653 2652
             $arrData['author_email'] = '';
2654 2653
             $arrData['notification_status'] = false;
@@ -2658,7 +2657,7 @@  discard block
 block discarded – undo
2658 2657
         $tags = array();
2659 2658
         $rows = DB::query(
2660 2659
             'SELECT tag
2661
-            FROM ' . prefixTable('tags') . '
2660
+            FROM ' . prefixTable('tags').'
2662 2661
             WHERE item_id = %i',
2663 2662
             $inputData['id']
2664 2663
         );
@@ -2683,7 +2682,7 @@  discard block
 block discarded – undo
2683 2682
         // Check if user has a role that is accepted
2684 2683
         $rows_tmp = DB::query(
2685 2684
             'SELECT role_id
2686
-            FROM ' . prefixTable('restriction_to_roles') . '
2685
+            FROM ' . prefixTable('restriction_to_roles').'
2687 2686
             WHERE item_id=%i',
2688 2687
             $inputData['id']
2689 2688
         );
@@ -2697,7 +2696,7 @@  discard block
 block discarded – undo
2697 2696
         // Get the object key for the user
2698 2697
         $userKey = DB::queryFirstRow(
2699 2698
             'SELECT share_key
2700
-            FROM ' . prefixTable('sharekeys_items') . '
2699
+            FROM ' . prefixTable('sharekeys_items').'
2701 2700
             WHERE user_id = %i AND object_id = %i',
2702 2701
             $session->get('user-id'),
2703 2702
             $inputData['id']
@@ -2794,8 +2793,8 @@  discard block
 block discarded – undo
2794 2793
                 // Add restriction if item is restricted to roles
2795 2794
                 $rows = DB::query(
2796 2795
                     'SELECT t.title, t.id
2797
-                    FROM ' . prefixTable('roles_title') . ' AS t
2798
-                    INNER JOIN ' . prefixTable('restriction_to_roles') . ' AS r ON (t.id=r.role_id)
2796
+                    FROM ' . prefixTable('roles_title').' AS t
2797
+                    INNER JOIN ' . prefixTable('restriction_to_roles').' AS r ON (t.id=r.role_id)
2799 2798
                     WHERE r.item_id = %i
2800 2799
                     ORDER BY t.title ASC',
2801 2800
                     $inputData['id']
@@ -2811,8 +2810,8 @@  discard block
 block discarded – undo
2811 2810
                 $tmp = array();
2812 2811
                 $rows = DB::query(
2813 2812
                     'SELECT k.label, k.id
2814
-                    FROM ' . prefixTable('kb_items') . ' as i
2815
-                    INNER JOIN ' . prefixTable('kb') . ' as k ON (i.kb_id=k.id)
2813
+                    FROM ' . prefixTable('kb_items').' as i
2814
+                    INNER JOIN ' . prefixTable('kb').' as k ON (i.kb_id=k.id)
2816 2815
                     WHERE i.item_id = %i
2817 2816
                     ORDER BY k.label ASC',
2818 2817
                     $inputData['id']
@@ -2895,7 +2894,7 @@  discard block
 block discarded – undo
2895 2894
                 $arrCatList = array();
2896 2895
                 $rows_tmp = DB::query(
2897 2896
                     'SELECT id_category
2898
-                    FROM ' . prefixTable('categories_folders') . '
2897
+                    FROM ' . prefixTable('categories_folders').'
2899 2898
                     WHERE id_folder=%i',
2900 2899
                     $inputData['folderId']
2901 2900
                 );
@@ -2910,8 +2909,8 @@  discard block
 block discarded – undo
2910 2909
                         'SELECT i.id AS id, i.field_id AS field_id, i.data AS data, i.item_id AS item_id,
2911 2910
                         i.encryption_type AS encryption_type, c.encrypted_data AS encrypted_data, c.parent_id AS parent_id,
2912 2911
                         c.type as field_type, c.masked AS field_masked, c.role_visibility AS role_visibility
2913
-                        FROM ' . prefixTable('categories_items') . ' AS i
2914
-                        INNER JOIN ' . prefixTable('categories') . ' AS c ON (i.field_id=c.id)
2912
+                        FROM ' . prefixTable('categories_items').' AS i
2913
+                        INNER JOIN ' . prefixTable('categories').' AS c ON (i.field_id=c.id)
2915 2914
                         WHERE i.item_id=%i AND c.parent_id IN %ls',
2916 2915
                         $inputData['id'],
2917 2916
                         $arrCatList
@@ -2922,7 +2921,7 @@  discard block
 block discarded – undo
2922 2921
                         //db::debugmode(true);
2923 2922
                         $userKey = DB::queryFirstRow(
2924 2923
                             'SELECT share_key
2925
-                            FROM ' . prefixTable('sharekeys_fields') . '
2924
+                            FROM ' . prefixTable('sharekeys_fields').'
2926 2925
                             WHERE user_id = %i AND object_id = %i',
2927 2926
                             $session->get('user-id'),
2928 2927
                             $row['id']
@@ -2940,7 +2939,7 @@  discard block
 block discarded – undo
2940 2939
                         } else if (DB::count() === 0 && (int) $row['encrypted_data'] === 0) {
2941 2940
                             // Data is not encrypted in DB
2942 2941
                             $fieldText = [
2943
-                                'string' => $row['data'],//#3945 - isBase64($row['data']) === true ? base64_decode($row['data']) : 
2942
+                                'string' => $row['data'], //#3945 - isBase64($row['data']) === true ? base64_decode($row['data']) : 
2944 2943
                                 'encrypted' => false,
2945 2944
                                 'error' => false,
2946 2945
                             ];
@@ -2985,7 +2984,7 @@  discard block
 block discarded – undo
2985 2984
             if (isset($SETTINGS['item_creation_templates']) && (int) $SETTINGS['item_creation_templates'] === 1) {
2986 2985
                 $rows_tmp = DB::queryfirstrow(
2987 2986
                     'SELECT category_id
2988
-                    FROM ' . prefixTable('templates') . '
2987
+                    FROM ' . prefixTable('templates').'
2989 2988
                     WHERE item_id = %i',
2990 2989
                     $inputData['id']
2991 2990
                 );
@@ -3002,7 +3001,7 @@  discard block
 block discarded – undo
3002 3001
             // Evaluate if item is ready for all users
3003 3002
             $rows_tmp = DB::queryfirstrow(
3004 3003
                 'SELECT finished_at
3005
-                FROM ' . prefixTable('background_tasks') . '
3004
+                FROM ' . prefixTable('background_tasks').'
3006 3005
                 WHERE item_id = %i',
3007 3006
                 $inputData['id']
3008 3007
             );
@@ -3019,7 +3018,7 @@  discard block
 block discarded – undo
3019 3018
                 // Is the Item to be deleted?
3020 3019
                 $dataDelete = DB::queryfirstrow(
3021 3020
                     'SELECT * 
3022
-                    FROM ' . prefixTable('automatic_del') . '
3021
+                    FROM ' . prefixTable('automatic_del').'
3023 3022
                     WHERE item_id = %i',
3024 3023
                     $inputData['id']
3025 3024
                 );
@@ -3100,14 +3099,14 @@  discard block
 block discarded – undo
3100 3099
                     if (empty($userRest) === false) {
3101 3100
                         $dataTmp = DB::queryfirstrow(
3102 3101
                             'SELECT login
3103
-                            FROM ' . prefixTable('users') . '
3102
+                            FROM ' . prefixTable('users').'
3104 3103
                             WHERE id= %i',
3105 3104
                             $userRest
3106 3105
                         );
3107 3106
                         if (empty($listOfRestricted)) {
3108 3107
                             $listOfRestricted = $dataTmp['login'];
3109 3108
                         } else {
3110
-                            $listOfRestricted .= ';' . $dataTmp['login'];
3109
+                            $listOfRestricted .= ';'.$dataTmp['login'];
3111 3110
                         }
3112 3111
                     }
3113 3112
                 }
@@ -3181,9 +3180,9 @@  discard block
 block discarded – undo
3181 3180
         // Load item data
3182 3181
         $dataItem = DB::queryFirstRow(
3183 3182
             'SELECT i.*, n.title AS folder_title, o.enabled AS otp_for_item_enabled, o.phone_number AS otp_phone_number, o.secret AS otp_secret
3184
-            FROM ' . prefixTable('items') . ' AS i
3185
-            INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (i.id_tree = n.id)
3186
-            LEFT JOIN ' . prefixTable('items_otp') . ' AS o ON (o.item_id = i.id)
3183
+            FROM ' . prefixTable('items').' AS i
3184
+            INNER JOIN ' . prefixTable('nested_tree').' AS n ON (i.id_tree = n.id)
3185
+            LEFT JOIN ' . prefixTable('items_otp').' AS o ON (o.item_id = i.id)
3187 3186
             WHERE i.id = %i',
3188 3187
             $inputData['id']
3189 3188
         );
@@ -3205,7 +3204,7 @@  discard block
 block discarded – undo
3205 3204
         // Check if user has a role that is accepted
3206 3205
         $rows_tmp = DB::query(
3207 3206
             'SELECT role_id
3208
-            FROM ' . prefixTable('restriction_to_roles') . '
3207
+            FROM ' . prefixTable('restriction_to_roles').'
3209 3208
             WHERE item_id=%i',
3210 3209
             $inputData['id']
3211 3210
         );
@@ -3237,12 +3236,12 @@  discard block
 block discarded – undo
3237 3236
             // launch query
3238 3237
             $rows = DB::query(
3239 3238
                 'SELECT id, name, file, extension, size
3240
-                FROM ' . prefixTable('files') . '
3239
+                FROM ' . prefixTable('files').'
3241 3240
                 WHERE id_item = %i AND confirmed = 1',
3242 3241
                 $inputData['id']
3243 3242
             );
3244 3243
             foreach ($rows as $record) {
3245
-                $filename = basename($record['name'], '.' . $record['extension']);
3244
+                $filename = basename($record['name'], '.'.$record['extension']);
3246 3245
                 $filename = isBase64($filename) === true ? base64_decode($filename) : $filename;
3247 3246
 
3248 3247
                 array_push(
@@ -3255,7 +3254,7 @@  discard block
 block discarded – undo
3255 3254
                         'is_image' => in_array(strtolower($record['extension']), TP_IMAGE_FILE_EXT) === true ? 1 : 0,
3256 3255
                         'id' => $record['id'],
3257 3256
                         'key' => $session->get('user-key_tmp'),
3258
-                        'internalFilename' => basename($record['name'], '.' . $record['extension']),
3257
+                        'internalFilename' => basename($record['name'], '.'.$record['extension']),
3259 3258
                     )
3260 3259
                 );
3261 3260
             }
@@ -3293,7 +3292,7 @@  discard block
 block discarded – undo
3293 3292
                     array(
3294 3293
                         'latest_items' => implode(';', $session->get('user-latest_items')),
3295 3294
                     ),
3296
-                    'id=' . $session->get('user-id')
3295
+                    'id='.$session->get('user-id')
3297 3296
                 );
3298 3297
             }
3299 3298
 
@@ -3302,8 +3301,8 @@  discard block
 block discarded – undo
3302 3301
             $listOptionsForRoles = array();
3303 3302
             $rows = DB::query(
3304 3303
                 'SELECT r.role_id AS role_id, t.title AS title
3305
-                FROM ' . prefixTable('roles_values') . ' AS r
3306
-                INNER JOIN ' . prefixTable('roles_title') . ' AS t ON (r.role_id = t.id)
3304
+                FROM ' . prefixTable('roles_values').' AS r
3305
+                INNER JOIN ' . prefixTable('roles_title').' AS t ON (r.role_id = t.id)
3307 3306
                 WHERE r.folder_id = %i',
3308 3307
                 $dataItem['id_tree']
3309 3308
             );
@@ -3317,9 +3316,9 @@  discard block
 block discarded – undo
3317 3316
                 );
3318 3317
                 $rows2 = DB::query(
3319 3318
                     'SELECT id, login, fonction_id, email, name, lastname
3320
-                    FROM ' . prefixTable('users') . '
3319
+                    FROM ' . prefixTable('users').'
3321 3320
                     WHERE fonction_id LIKE %s',
3322
-                    '%' . $record['role_id'] . '%'
3321
+                    '%'.$record['role_id'].'%'
3323 3322
                 );
3324 3323
                 foreach ($rows2 as $record2) {
3325 3324
                     foreach (explode(';', $record2['fonction_id']) as $role) {
@@ -3332,7 +3331,7 @@  discard block
 block discarded – undo
3332 3331
                                 array(
3333 3332
                                     'id' => (int) $record2['id'],
3334 3333
                                     'login' => $record2['login'],
3335
-                                    'name' => $record2['name'] . ' ' . $record2['lastname'],
3334
+                                    'name' => $record2['name'].' '.$record2['lastname'],
3336 3335
                                     'email' => $record2['email'],
3337 3336
                                 )
3338 3337
                             );
@@ -3351,16 +3350,16 @@  discard block
 block discarded – undo
3351 3350
                 $path = '';
3352 3351
                 foreach ($arbo as $elem) {
3353 3352
                     if (empty($path) === true) {
3354
-                        $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' ';
3353
+                        $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' ';
3355 3354
                     } else {
3356
-                        $path .= '&#8594; ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
3355
+                        $path .= '&#8594; '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
3357 3356
                     }
3358 3357
                 }
3359 3358
                 // Build text to show user
3360 3359
                 if (empty($path) === true) {
3361 3360
                     $path = addslashes($dataItem['label']);
3362 3361
                 } else {
3363
-                    $path = addslashes($dataItem['label']) . ' (' . $path . ')';
3362
+                    $path = addslashes($dataItem['label']).' ('.$path.')';
3364 3363
                 }
3365 3364
 
3366 3365
                 // Add Admins to notification list if expected
@@ -3383,7 +3382,7 @@  discard block
 block discarded – undo
3383 3382
                         array(
3384 3383
                             addslashes($session->get('user-login')),
3385 3384
                             $path,
3386
-                            $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $dataItem['id'],
3385
+                            $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$dataItem['id'],
3387 3386
                         ),
3388 3387
                         $lang->get('email_on_open_notification_mail')
3389 3388
                     ),
@@ -3393,7 +3392,7 @@  discard block
 block discarded – undo
3393 3392
             }
3394 3393
 
3395 3394
             // has this item a change proposal
3396
-            DB::query('SELECT * FROM ' . prefixTable('items_change') . ' WHERE item_id = %i', $inputData['id']);
3395
+            DB::query('SELECT * FROM '.prefixTable('items_change').' WHERE item_id = %i', $inputData['id']);
3397 3396
             $returnArray['has_change_proposal'] = DB::count();
3398 3397
 
3399 3398
             // Setting
@@ -3404,7 +3403,7 @@  discard block
 block discarded – undo
3404 3403
             if (isset($SETTINGS['otv_is_enabled']) === true && (int) $SETTINGS['otv_is_enabled'] === 1) {
3405 3404
                 DB::query(
3406 3405
                     'SELECT *
3407
-                    FROM ' . prefixTable('otv') . '
3406
+                    FROM ' . prefixTable('otv').'
3408 3407
                     WHERE item_id = %i
3409 3408
                     AND time_limit > %i',
3410 3409
                     $inputData['id'],
@@ -3504,7 +3503,7 @@  discard block
 block discarded – undo
3504 3503
         // Load item data
3505 3504
         $data = DB::queryFirstRow(
3506 3505
             'SELECT id_tree, id, label
3507
-            FROM ' . prefixTable('items') . '
3506
+            FROM ' . prefixTable('items').'
3508 3507
             WHERE id = %i OR item_key = %s',
3509 3508
             $inputData['itemId'],
3510 3509
             $inputData['itemKey']
@@ -3595,7 +3594,7 @@  discard block
 block discarded – undo
3595 3594
         // Load item data
3596 3595
         $dataItem = DB::queryFirstRow(
3597 3596
             'SELECT secret, enabled
3598
-            FROM ' . prefixTable('items_otp') . '
3597
+            FROM ' . prefixTable('items_otp').'
3599 3598
             WHERE item_id = %i',
3600 3599
             $inputData['id']
3601 3600
         );
@@ -3677,13 +3676,13 @@  discard block
 block discarded – undo
3677 3676
 
3678 3677
         // Check if user is allowed to access this folder
3679 3678
         if (!in_array($inputData['folderId'], $session->get('user-accessible_folders'))) {
3680
-            echo '[{"error" : "' . $lang->get('error_not_allowed_to') . '"}]';
3679
+            echo '[{"error" : "'.$lang->get('error_not_allowed_to').'"}]';
3681 3680
             break;
3682 3681
         }
3683 3682
 
3684 3683
         // Check if title doesn't contains html codes
3685 3684
         if (preg_match_all('|<[^>]+>(.*)</[^>]+>|U', $title, $out)) {
3686
-            echo '[ { "error" : "' . $lang->get('error_html_codes') . '" } ]';
3685
+            echo '[ { "error" : "'.$lang->get('error_html_codes').'" } ]';
3687 3686
             break;
3688 3687
         }
3689 3688
         // check that title is not numeric
@@ -3694,9 +3693,9 @@  discard block
 block discarded – undo
3694 3693
 
3695 3694
         // Check if duplicate folders name are allowed
3696 3695
         if (isset($SETTINGS['duplicate_folder']) && $SETTINGS['duplicate_folder'] === '0') {
3697
-            $data = DB::queryFirstRow('SELECT id, title FROM ' . prefixTable('nested_tree') . ' WHERE title = %s', $title);
3696
+            $data = DB::queryFirstRow('SELECT id, title FROM '.prefixTable('nested_tree').' WHERE title = %s', $title);
3698 3697
             if (empty($data['id']) === false && $dataReceived['folder'] !== $data['id']) {
3699
-                echo '[ { "error" : "' . $lang->get('error_group_exist') . '" } ]';
3698
+                echo '[ { "error" : "'.$lang->get('error_group_exist').'" } ]';
3700 3699
                 break;
3701 3700
             }
3702 3701
         }
@@ -3704,7 +3703,7 @@  discard block
 block discarded – undo
3704 3703
         // query on folder
3705 3704
         $data = DB::queryfirstrow(
3706 3705
             'SELECT parent_id, personal_folder
3707
-            FROM ' . prefixTable('nested_tree') . '
3706
+            FROM ' . prefixTable('nested_tree').'
3708 3707
             WHERE id = %i',
3709 3708
             $inputData['folderId']
3710 3709
         );
@@ -3714,20 +3713,20 @@  discard block
 block discarded – undo
3714 3713
         if ($session->get('user-admin') !== 1 && $session->get('user-manager') !== 1 && $data['personal_folder'] === '0') {
3715 3714
             $data = DB::queryfirstrow(
3716 3715
                 'SELECT valeur
3717
-                FROM ' . prefixTable('misc') . '
3716
+                FROM ' . prefixTable('misc').'
3718 3717
                 WHERE intitule = %i AND type = %s',
3719 3718
                 $data['parent_id'],
3720 3719
                 'complex'
3721 3720
             );
3722 3721
             if (intval($dataReceived['complexity']) < intval($data['valeur'])) {
3723
-                echo '[ { "error" : "' . $lang->get('error_folder_complexity_lower_than_top_folder') . ' [<b>' . TP_PW_COMPLEXITY[$data['valeur']][1] . '</b>]"} ]';
3722
+                echo '[ { "error" : "'.$lang->get('error_folder_complexity_lower_than_top_folder').' [<b>'.TP_PW_COMPLEXITY[$data['valeur']][1].'</b>]"} ]';
3724 3723
                 break;
3725 3724
             }
3726 3725
         }
3727 3726
 
3728 3727
         // update Folders table
3729 3728
         $tmp = DB::queryFirstRow(
3730
-            'SELECT title, parent_id, personal_folder FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
3729
+            'SELECT title, parent_id, personal_folder FROM '.prefixTable('nested_tree').' WHERE id = %i',
3731 3730
             $dataReceived['folder']
3732 3731
         );
3733 3732
         if ($tmp['parent_id'] !== 0 || $tmp['title'] !== $session->get('user-id') || $tmp['personal_folder'] !== 1) {
@@ -3841,7 +3840,7 @@  discard block
 block discarded – undo
3841 3840
             $uniqueLoadData['path'] = $arr_arbo;
3842 3841
 
3843 3842
             // store last folder accessed in cookie
3844
-            $arr_cookie_options = array (
3843
+            $arr_cookie_options = array(
3845 3844
                 'expires' => time() + TP_ONE_DAY_SECONDS * 5,
3846 3845
                 'path' => '/', 
3847 3846
                 'secure' => true,
@@ -3856,7 +3855,7 @@  discard block
 block discarded – undo
3856 3855
             foreach ($session->get('user-roles_array') as $role) {
3857 3856
                 $roleQ = DB::queryfirstrow(
3858 3857
                     'SELECT allow_pw_change
3859
-                    FROM ' . prefixTable('roles_title') . '
3858
+                    FROM ' . prefixTable('roles_title').'
3860 3859
                     WHERE id = %i',
3861 3860
                     $role
3862 3861
                 );
@@ -3887,11 +3886,11 @@  discard block
 block discarded – undo
3887 3886
                 
3888 3887
                 foreach ($session->get('user-roles_array') as $role) {
3889 3888
                     $access = DB::queryFirstRow(
3890
-                        'SELECT type FROM ' . prefixTable('roles_values') . ' WHERE role_id = %i AND folder_id = %i',
3889
+                        'SELECT type FROM '.prefixTable('roles_values').' WHERE role_id = %i AND folder_id = %i',
3891 3890
                         $role,
3892 3891
                         $inputData['id']
3893 3892
                     );
3894
-                    if (DB::count()>0) {
3893
+                    if (DB::count() > 0) {
3895 3894
                         if ($access['type'] === 'R') {
3896 3895
                             array_push($arrTmp, 10);
3897 3896
                         } elseif ($access['type'] === 'W') {
@@ -3956,7 +3955,7 @@  discard block
 block discarded – undo
3956 3955
             } else {
3957 3956
                 DB::query(
3958 3957
                     'SELECT *
3959
-                    FROM ' . prefixTable('items') . '
3958
+                    FROM ' . prefixTable('items').'
3960 3959
                     WHERE inactif = %i',
3961 3960
                     0
3962 3961
                 );
@@ -3966,7 +3965,7 @@  discard block
 block discarded – undo
3966 3965
 
3967 3966
             // Get folder complexity
3968 3967
             $folderComplexity = DB::queryFirstRow(
3969
-                'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %i',
3968
+                'SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %i',
3970 3969
                 'complex',
3971 3970
                 $inputData['id']
3972 3971
             );
@@ -3978,7 +3977,7 @@  discard block
 block discarded – undo
3978 3977
             if (isset($SETTINGS['item_extra_fields']) && (int) $SETTINGS['item_extra_fields'] === 1) {
3979 3978
                 $folderRow = DB::query(
3980 3979
                     'SELECT id_category
3981
-                    FROM ' . prefixTable('categories_folders') . '
3980
+                    FROM ' . prefixTable('categories_folders').'
3982 3981
                     WHERE id_folder = %i',
3983 3982
                     $inputData['id']
3984 3983
                 );
@@ -4093,9 +4092,9 @@  discard block
 block discarded – undo
4093 4092
             // List all ITEMS
4094 4093
             if ($folderIsPf === false) {
4095 4094
                 $where->add('i.inactif=%i', 0);
4096
-                $sql_e='(SELECT date FROM ' . prefixTable('log_items') 
4095
+                $sql_e = '(SELECT date FROM '.prefixTable('log_items') 
4097 4096
                     . " WHERE action = 'at_creation' AND id_item=i.id " 
4098
-                    . 'union all SELECT date FROM '. prefixTable('log_items') 
4097
+                    . 'union all SELECT date FROM '.prefixTable('log_items') 
4099 4098
                     . " WHERE action = 'at_modification' AND raison = 'at_pw'
4100 4099
                     AND id_item=i.id ORDER BY date DESC LIMIT 1)";
4101 4100
                 $where->add('l.date=%l', $sql_e);
@@ -4103,8 +4102,8 @@  discard block
 block discarded – undo
4103 4102
                     $where->add('i.id IN %ls', explode(',', $limited_to_items));
4104 4103
                 }
4105 4104
 
4106
-                $query_limit = ' LIMIT ' .
4107
-                    $start . ',' .
4105
+                $query_limit = ' LIMIT '.
4106
+                    $start.','.
4108 4107
                     $post_nb_items_to_display_once;
4109 4108
                 //db::debugmode(true);
4110 4109
                 $rows = DB::query(
@@ -4116,9 +4115,9 @@  discard block
 block discarded – undo
4116 4115
                     l.id_user AS log_user,
4117 4116
                     i.url AS link,
4118 4117
                     i.email AS email
4119
-                    FROM ' . prefixTable('items') . ' AS i
4120
-                    INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (i.id_tree = n.id)
4121
-                    INNER JOIN ' . prefixTable('log_items') . ' AS l ON (i.id = l.id_item)
4118
+                    FROM ' . prefixTable('items').' AS i
4119
+                    INNER JOIN ' . prefixTable('nested_tree').' AS n ON (i.id_tree = n.id)
4120
+                    INNER JOIN ' . prefixTable('log_items').' AS l ON (i.id = l.id_item)
4122 4121
                     WHERE %l
4123 4122
                     GROUP BY i.id, l.date, l.id_user, l.action
4124 4123
                     ORDER BY i.label ASC, l.date DESC' . $query_limit,
@@ -4138,9 +4137,9 @@  discard block
 block discarded – undo
4138 4137
                     l.id_user AS log_user,
4139 4138
                     i.url AS link,
4140 4139
                     i.email AS email
4141
-                    FROM ' . prefixTable('items') . ' AS i
4142
-                    INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (i.id_tree = n.id)
4143
-                    INNER JOIN ' . prefixTable('log_items') . ' AS l ON (i.id = l.id_item)
4140
+                    FROM ' . prefixTable('items').' AS i
4141
+                    INNER JOIN ' . prefixTable('nested_tree').' AS n ON (i.id_tree = n.id)
4142
+                    INNER JOIN ' . prefixTable('log_items').' AS l ON (i.id = l.id_item)
4144 4143
                     WHERE %l
4145 4144
                     GROUP BY i.id, l.date, l.id_user, l.action
4146 4145
                     ORDER BY i.label ASC, l.date DESC',
@@ -4171,7 +4170,7 @@  discard block
 block discarded – undo
4171 4170
                     $item_is_restricted_to_role = false;
4172 4171
                     DB::queryfirstrow(
4173 4172
                         'SELECT role_id
4174
-                        FROM ' . prefixTable('restriction_to_roles') . '
4173
+                        FROM ' . prefixTable('restriction_to_roles').'
4175 4174
                         WHERE item_id = %i',
4176 4175
                         $record['id']
4177 4176
                     );
@@ -4183,7 +4182,7 @@  discard block
 block discarded – undo
4183 4182
                     $user_is_included_in_role = false;
4184 4183
                     DB::query(
4185 4184
                         'SELECT role_id
4186
-                        FROM ' . prefixTable('restriction_to_roles') . '
4185
+                        FROM ' . prefixTable('restriction_to_roles').'
4187 4186
                         WHERE item_id = %i AND role_id IN %ls',
4188 4187
                         $record['id'],
4189 4188
                         $session->get('user-roles_array')
@@ -4390,9 +4389,9 @@  discard block
 block discarded – undo
4390 4389
         if ((int) $start === 0) {
4391 4390
             DB::query(
4392 4391
                 'SELECT i.id
4393
-                FROM ' . prefixTable('items') . ' as i
4394
-                INNER JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree = n.id)
4395
-                INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id = l.id_item)
4392
+                FROM ' . prefixTable('items').' as i
4393
+                INNER JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree = n.id)
4394
+                INNER JOIN ' . prefixTable('log_items').' as l ON (i.id = l.id_item)
4396 4395
                 WHERE %l
4397 4396
                 ORDER BY i.label ASC, l.date DESC',
4398 4397
                 $where
@@ -4457,8 +4456,8 @@  discard block
 block discarded – undo
4457 4456
         $dataItem = DB::queryfirstrow(
4458 4457
             'SELECT i.pw AS pw, s.share_key AS share_key, i.id AS id,
4459 4458
                     i.label AS label, i.id_tree AS id_tree
4460
-            FROM ' . prefixTable('items') . ' AS i
4461
-            INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (s.object_id = i.id)
4459
+            FROM ' . prefixTable('items').' AS i
4460
+            INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (s.object_id = i.id)
4462 4461
             WHERE user_id = %i AND (i.item_key = %s OR i.id = %i)',
4463 4462
             $session->get('user-id'),
4464 4463
             $inputData['itemKey'] ?? '',
@@ -4553,7 +4552,7 @@  discard block
 block discarded – undo
4553 4552
             // get if existing edition lock
4554 4553
             $dataItemEditionLocks = DB::query(
4555 4554
                 'SELECT timestamp, user_id
4556
-                FROM ' . prefixTable('items_edition') . '
4555
+                FROM ' . prefixTable('items_edition').'
4557 4556
                 WHERE item_id = %i 
4558 4557
                 ORDER BY increment_id DESC',
4559 4558
                 $inputData['itemId']
@@ -4562,7 +4561,7 @@  discard block
 block discarded – undo
4562 4561
             if (WIP === true) error_log('Existing edition locks: '.DB::count());
4563 4562
 
4564 4563
             // Check if item has no edition lock
4565
-            if ((int) DB::count() > 0 ) {
4564
+            if ((int) DB::count() > 0) {
4566 4565
                 // get last edition lock
4567 4566
                 $dataLastItemEditionLock = $dataItemEditionLocks[0];
4568 4567
 
@@ -4572,10 +4571,10 @@  discard block
 block discarded – undo
4572 4571
                 } else {
4573 4572
                     $delay = EDITION_LOCK_PERIOD; // One day delay
4574 4573
                 }
4575
-                if (WIP === true) error_log('delay: ' . $delay);
4574
+                if (WIP === true) error_log('delay: '.$delay);
4576 4575
 
4577 4576
                 // We remove old edition locks if delay is expired meaning more than 1 day long
4578
-                if (round(abs(time() - $dataTmp['timestamp']),0) > $delay) {
4577
+                if (round(abs(time() - $dataTmp['timestamp']), 0) > $delay) {
4579 4578
                     // Case where time is expired
4580 4579
                     // In this case, delete edition lock and possible ongoing processes
4581 4580
                     // and continue editing this time
@@ -4592,7 +4591,7 @@  discard block
 block discarded – undo
4592 4591
                         // Get process Id
4593 4592
                         $processDetail = DB::queryFirstRow(
4594 4593
                             'SELECT increment_id
4595
-                            FROM ' . prefixTable('background_tasks') . '
4594
+                            FROM ' . prefixTable('background_tasks').'
4596 4595
                             WHERE item_id = %i AND finished_at = ""',
4597 4596
                             $inputData['itemId']
4598 4597
                         );
@@ -4610,7 +4609,7 @@  discard block
 block discarded – undo
4610 4609
                     // get if existing process ongoing for this item
4611 4610
                     $dataItemProcessOngoing = DB::queryFirstRow(
4612 4611
                         'SELECT JSON_EXTRACT(arguments, "$.all_users_except_id") AS all_users_except_id
4613
-                        FROM ' . prefixTable('background_tasks') . '
4612
+                        FROM ' . prefixTable('background_tasks').'
4614 4613
                         WHERE item_id = %i AND finished_at = ""
4615 4614
                         ORDER BY increment_id DESC',
4616 4615
                         $inputData['itemId']
@@ -4637,7 +4636,7 @@  discard block
 block discarded – undo
4637 4636
                         );
4638 4637
                         break;
4639 4638
                     }
4640
-                } elseif (round(abs(time() - $dataTmp['timestamp']),0) <= $delay) {
4639
+                } elseif (round(abs(time() - $dataTmp['timestamp']), 0) <= $delay) {
4641 4640
                     // Case where edition lock is already taken by another user
4642 4641
                     // Then no edition is possible
4643 4642
                     $returnValues = array(
@@ -4666,7 +4665,7 @@  discard block
 block discarded – undo
4666 4665
         // do query on this folder
4667 4666
         $data_this_folder = DB::queryFirstRow(
4668 4667
             'SELECT id, personal_folder, title
4669
-            FROM ' . prefixTable('nested_tree') . '
4668
+            FROM ' . prefixTable('nested_tree').'
4670 4669
             WHERE id = %s',
4671 4670
             $inputData['folderId']
4672 4671
         );
@@ -4706,8 +4705,8 @@  discard block
 block discarded – undo
4706 4705
         $visibilite = '';
4707 4706
         $data = DB::queryFirstRow(
4708 4707
             'SELECT m.valeur, n.personal_folder
4709
-            FROM ' . prefixTable('misc') . ' AS m
4710
-            INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (m.intitule = n.id)
4708
+            FROM ' . prefixTable('misc').' AS m
4709
+            INNER JOIN ' . prefixTable('nested_tree').' AS n ON (m.intitule = n.id)
4711 4710
             WHERE type=%s AND intitule = %s',
4712 4711
             'complex',
4713 4712
             $inputData['folderId']
@@ -4720,8 +4719,8 @@  discard block
 block discarded – undo
4720 4719
             // Prepare Item actual visibility (what Users/Roles can see it)
4721 4720
             $rows = DB::query(
4722 4721
                 'SELECT t.title
4723
-                FROM ' . prefixTable('roles_values') . ' as v
4724
-                INNER JOIN ' . prefixTable('roles_title') . ' as t ON (v.role_id = t.id)
4722
+                FROM ' . prefixTable('roles_values').' as v
4723
+                INNER JOIN ' . prefixTable('roles_title').' as t ON (v.role_id = t.id)
4725 4724
                 WHERE v.folder_id = %i
4726 4725
                 GROUP BY title',
4727 4726
                 $inputData['folderId']
@@ -4730,7 +4729,7 @@  discard block
 block discarded – undo
4730 4729
                 if (empty($visibilite)) {
4731 4730
                     $visibilite = $record['title'];
4732 4731
                 } else {
4733
-                    $visibilite .= ' - ' . $record['title'];
4732
+                    $visibilite .= ' - '.$record['title'];
4734 4733
                 }
4735 4734
             }
4736 4735
         } else {
@@ -4740,14 +4739,14 @@  discard block
 block discarded – undo
4740 4739
             // do new query to know if current folder is pf
4741 4740
             $data_pf = DB::queryFirstRow(
4742 4741
                 'SELECT personal_folder
4743
-                FROM ' . prefixTable('nested_tree') . '
4742
+                FROM ' . prefixTable('nested_tree').'
4744 4743
                 WHERE id = %s',
4745 4744
                 $inputData['folderId']
4746 4745
             );
4747 4746
             
4748 4747
             $folder_is_personal = $data_pf !== null ? (int) $data_pf['personal_folder'] : 0;
4749 4748
             
4750
-            $visibilite = $session->get('user-name') . ' ' . $session->get('user-lastname') . ' (' . $session->get('user-login') . ')';
4749
+            $visibilite = $session->get('user-name').' '.$session->get('user-lastname').' ('.$session->get('user-login').')';
4751 4750
         }
4752 4751
 
4753 4752
         recupDroitCreationSansComplexite($inputData['folderId']);
@@ -4757,8 +4756,8 @@  discard block
 block discarded – undo
4757 4756
         $listOptionsForRoles = array();
4758 4757
         $rows = DB::query(
4759 4758
             'SELECT r.role_id AS role_id, t.title AS title
4760
-            FROM ' . prefixTable('roles_values') . ' AS r
4761
-            INNER JOIN ' . prefixTable('roles_title') . ' AS t ON (r.role_id = t.id)
4759
+            FROM ' . prefixTable('roles_values').' AS r
4760
+            INNER JOIN ' . prefixTable('roles_title').' AS t ON (r.role_id = t.id)
4762 4761
             WHERE r.folder_id = %i',
4763 4762
             $inputData['folderId']
4764 4763
         );
@@ -4772,7 +4771,7 @@  discard block
 block discarded – undo
4772 4771
             );
4773 4772
             $rows2 = DB::query(
4774 4773
                 'SELECT id, login, fonction_id, email, name, lastname
4775
-                FROM ' . prefixTable('users') . '
4774
+                FROM ' . prefixTable('users').'
4776 4775
                 WHERE admin = 0 AND fonction_id is not null'
4777 4776
             );
4778 4777
             foreach ($rows2 as $record2) {
@@ -4786,7 +4785,7 @@  discard block
 block discarded – undo
4786 4785
                             array(
4787 4786
                                 'id' => $record2['id'],
4788 4787
                                 'login' => $record2['login'],
4789
-                                'name' => $record2['name'] . ' ' . $record2['lastname'],
4788
+                                'name' => $record2['name'].' '.$record2['lastname'],
4790 4789
                                 'email' => $record2['email'],
4791 4790
                             )
4792 4791
                         );
@@ -4803,13 +4802,13 @@  discard block
 block discarded – undo
4803 4802
                 //db::debugmode(true);
4804 4803
                 $access = DB::queryFirstRow(
4805 4804
                     'SELECT type
4806
-                    FROM ' . prefixTable('roles_values') . '
4805
+                    FROM ' . prefixTable('roles_values').'
4807 4806
                     WHERE role_id = %i AND folder_id = %i',
4808 4807
                     $role,
4809 4808
                     $inputData['folderId']
4810 4809
                 );
4811 4810
                 //db::debugmode(false);
4812
-                if (DB::count()>0) {
4811
+                if (DB::count() > 0) {
4813 4812
                     if ($access['type'] === 'R') {
4814 4813
                         array_push($arrTmp, 10);
4815 4814
                     } elseif ($access['type'] === 'W') {
@@ -4837,7 +4836,7 @@  discard block
 block discarded – undo
4837 4836
             // Check if personal folder is owned by user
4838 4837
             $folder = DB::queryFirstRow(
4839 4838
                 'SELECT id
4840
-                FROM ' . prefixTable('nested_tree') . '
4839
+                FROM ' . prefixTable('nested_tree').'
4841 4840
                 WHERE title = %s',
4842 4841
                 $session->get('user-id'),
4843 4842
             );
@@ -4942,7 +4941,7 @@  discard block
 block discarded – undo
4942 4941
         // Get some info before deleting
4943 4942
         $data = DB::queryFirstRow(
4944 4943
             'SELECT name, id_item, file
4945
-            FROM ' . prefixTable('files') . '
4944
+            FROM ' . prefixTable('files').'
4946 4945
             WHERE id = %i',
4947 4946
             $fileId
4948 4947
         );
@@ -4950,7 +4949,7 @@  discard block
 block discarded – undo
4950 4949
         // Load item data
4951 4950
         $data_item = DB::queryFirstRow(
4952 4951
             'SELECT id_tree
4953
-            FROM ' . prefixTable('items') . '
4952
+            FROM ' . prefixTable('items').'
4954 4953
             WHERE id = %i',
4955 4954
             $data['id_item']
4956 4955
         );
@@ -4980,7 +4979,7 @@  discard block
 block discarded – undo
4980 4979
                 $session->get('user-id'),
4981 4980
                 'at_modification',
4982 4981
                 $session->get('user-login'),
4983
-                'at_del_file : ' . $data['name']
4982
+                'at_del_file : '.$data['name']
4984 4983
             );
4985 4984
 
4986 4985
             // DElete sharekeys
@@ -4991,7 +4990,7 @@  discard block
 block discarded – undo
4991 4990
             );
4992 4991
 
4993 4992
             // Delete file from server
4994
-            $fileToDelete = $SETTINGS['path_to_upload_folder'] . '/' . TP_FILE_PREFIX . base64_decode($data['file']);
4993
+            $fileToDelete = $SETTINGS['path_to_upload_folder'].'/'.TP_FILE_PREFIX.base64_decode($data['file']);
4995 4994
             $fileToDelete = realpath($fileToDelete);
4996 4995
             if ($fileToDelete && strpos($fileToDelete, $SETTINGS['path_to_upload_folder']) === 0) {
4997 4996
                 fileDelete($fileToDelete, $SETTINGS);
@@ -5045,7 +5044,7 @@  discard block
 block discarded – undo
5045 5044
             // Update SESSION with this new favourite
5046 5045
             $data = DB::queryfirstrow(
5047 5046
                 'SELECT label,id_tree
5048
-                FROM ' . prefixTable('items') . '
5047
+                FROM ' . prefixTable('items').'
5049 5048
                 WHERE id = %i',
5050 5049
                 $inputData['itemId']
5051 5050
             );
@@ -5054,7 +5053,7 @@  discard block
 block discarded – undo
5054 5053
                 [
5055 5054
                     $inputData['itemId'] => [
5056 5055
                         'label' => $data['label'],
5057
-                        'url' => 'index.php?page=items&amp;group=' . $data['id_tree'] . '&amp;id=' . $inputData['itemId'],
5056
+                        'url' => 'index.php?page=items&amp;group='.$data['id_tree'].'&amp;id='.$inputData['itemId'],
5058 5057
                     ],
5059 5058
                 ],
5060 5059
                 'add'
@@ -5123,8 +5122,8 @@  discard block
 block discarded – undo
5123 5122
         // get data about item
5124 5123
         $dataSource = DB::queryfirstrow(
5125 5124
             'SELECT i.pw, f.personal_folder,i.id_tree, f.title,i.label
5126
-            FROM ' . prefixTable('items') . ' as i
5127
-            INNER JOIN ' . prefixTable('nested_tree') . ' as f ON (i.id_tree=f.id)
5125
+            FROM ' . prefixTable('items').' as i
5126
+            INNER JOIN ' . prefixTable('nested_tree').' as f ON (i.id_tree=f.id)
5128 5127
             WHERE i.id=%i',
5129 5128
             $inputData['itemId']
5130 5129
         );
@@ -5168,7 +5167,7 @@  discard block
 block discarded – undo
5168 5167
         // get data about new folder
5169 5168
         $dataDestination = DB::queryfirstrow(
5170 5169
             'SELECT personal_folder, title
5171
-            FROM ' . prefixTable('nested_tree') . '
5170
+            FROM ' . prefixTable('nested_tree').'
5172 5171
             WHERE id = %i',
5173 5172
             $inputData['folderId']
5174 5173
         );
@@ -5221,7 +5220,7 @@  discard block
 block discarded – undo
5221 5220
             // Get fields for this Item
5222 5221
             $rows = DB::query(
5223 5222
                 'SELECT id
5224
-                FROM ' . prefixTable('categories_items') . '
5223
+                FROM ' . prefixTable('categories_items').'
5225 5224
                 WHERE item_id = %i',
5226 5225
                 $inputData['itemId']
5227 5226
             );
@@ -5238,7 +5237,7 @@  discard block
 block discarded – undo
5238 5237
             // Get FILES for this Item
5239 5238
             $rows = DB::query(
5240 5239
                 'SELECT id
5241
-                FROM ' . prefixTable('files') . '
5240
+                FROM ' . prefixTable('files').'
5242 5241
                 WHERE id_item = %i',
5243 5242
                 $inputData['itemId']
5244 5243
             );
@@ -5285,7 +5284,7 @@  discard block
 block discarded – undo
5285 5284
             // Get the ITEM object key for the user
5286 5285
             $userKey = DB::queryFirstRow(
5287 5286
                 'SELECT share_key
5288
-                FROM ' . prefixTable('sharekeys_items') . '
5287
+                FROM ' . prefixTable('sharekeys_items').'
5289 5288
                 WHERE user_id = %i AND object_id = %i',
5290 5289
                 $session->get('user-id'),
5291 5290
                 $inputData['itemId']
@@ -5296,7 +5295,7 @@  discard block
 block discarded – undo
5296 5295
                 // This is a public object
5297 5296
                 $users = DB::query(
5298 5297
                     'SELECT id, public_key
5299
-                    FROM ' . prefixTable('users') . '
5298
+                    FROM ' . prefixTable('users').'
5300 5299
                     WHERE id NOT IN %li
5301 5300
                     AND public_key != ""',
5302 5301
                     $tpUsersIDs
@@ -5319,14 +5318,14 @@  discard block
 block discarded – undo
5319 5318
             // Get fields for this Item
5320 5319
             $rows = DB::query(
5321 5320
                 'SELECT id
5322
-                FROM ' . prefixTable('categories_items') . '
5321
+                FROM ' . prefixTable('categories_items').'
5323 5322
                 WHERE item_id = %i',
5324 5323
                 $inputData['itemId']
5325 5324
             );
5326 5325
             foreach ($rows as $field) {
5327 5326
                 $userKey = DB::queryFirstRow(
5328 5327
                     'SELECT share_key
5329
-                    FROM ' . prefixTable('sharekeys_fields') . '
5328
+                    FROM ' . prefixTable('sharekeys_fields').'
5330 5329
                     WHERE user_id = %i AND object_id = %i',
5331 5330
                     $session->get('user-id'),
5332 5331
                     $field['id']
@@ -5337,7 +5336,7 @@  discard block
 block discarded – undo
5337 5336
                     // This is a public object
5338 5337
                     $users = DB::query(
5339 5338
                         'SELECT id, public_key
5340
-                        FROM ' . prefixTable('users') . '
5339
+                        FROM ' . prefixTable('users').'
5341 5340
                         WHERE id NOT IN %li
5342 5341
                         AND public_key != ""',
5343 5342
                         $tpUsersIDs
@@ -5360,14 +5359,14 @@  discard block
 block discarded – undo
5360 5359
             // Get FILES for this Item
5361 5360
             $rows = DB::query(
5362 5361
                 'SELECT id
5363
-                FROM ' . prefixTable('files') . '
5362
+                FROM ' . prefixTable('files').'
5364 5363
                 WHERE id_item = %i',
5365 5364
                 $inputData['itemId']
5366 5365
             );
5367 5366
             foreach ($rows as $attachment) {
5368 5367
                 $userKey = DB::queryFirstRow(
5369 5368
                     'SELECT share_key
5370
-                    FROM ' . prefixTable('sharekeys_files') . '
5369
+                    FROM ' . prefixTable('sharekeys_files').'
5371 5370
                     WHERE user_id = %i AND object_id = %i',
5372 5371
                     $session->get('user-id'),
5373 5372
                     $attachment['id']
@@ -5378,7 +5377,7 @@  discard block
 block discarded – undo
5378 5377
                     // This is a public object
5379 5378
                     $users = DB::query(
5380 5379
                         'SELECT id, public_key
5381
-                        FROM ' . prefixTable('users') . '
5380
+                        FROM ' . prefixTable('users').'
5382 5381
                         WHERE id NOT IN %li
5383 5382
                         AND public_key != ""',
5384 5383
                         $tpUsersIDs
@@ -5419,7 +5418,7 @@  discard block
 block discarded – undo
5419 5418
             $session->get('user-id'),
5420 5419
             'at_modification',
5421 5420
             $session->get('user-login'),
5422
-            'at_moved : ' . $dataSource['title'] . ' -> ' . $dataDestination['title']
5421
+            'at_moved : '.$dataSource['title'].' -> '.$dataDestination['title']
5423 5422
         );
5424 5423
 
5425 5424
         // Update cache table
@@ -5478,8 +5477,8 @@  discard block
 block discarded – undo
5478 5477
                 // get data about item
5479 5478
                 $dataSource = DB::queryfirstrow(
5480 5479
                     'SELECT i.pw, f.personal_folder,i.id_tree, f.title,i.label
5481
-                    FROM ' . prefixTable('items') . ' as i
5482
-                    INNER JOIN ' . prefixTable('nested_tree') . ' as f ON (i.id_tree=f.id)
5480
+                    FROM ' . prefixTable('items').' as i
5481
+                    INNER JOIN ' . prefixTable('nested_tree').' as f ON (i.id_tree=f.id)
5483 5482
                     WHERE i.id=%i',
5484 5483
                     $item_id
5485 5484
                 );
@@ -5501,7 +5500,7 @@  discard block
 block discarded – undo
5501 5500
 
5502 5501
                 // get data about new folder
5503 5502
                 $dataDestination = DB::queryfirstrow(
5504
-                    'SELECT personal_folder, title FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
5503
+                    'SELECT personal_folder, title FROM '.prefixTable('nested_tree').' WHERE id = %i',
5505 5504
                     $inputData['folderId']
5506 5505
                 );
5507 5506
 
@@ -5543,7 +5542,7 @@  discard block
 block discarded – undo
5543 5542
                     // Get fields for this Item
5544 5543
                     $rows = DB::query(
5545 5544
                         'SELECT id
5546
-                        FROM ' . prefixTable('categories_items') . '
5545
+                        FROM ' . prefixTable('categories_items').'
5547 5546
                         WHERE item_id = %i',
5548 5547
                         $item_id
5549 5548
                     );
@@ -5560,7 +5559,7 @@  discard block
 block discarded – undo
5560 5559
                     // Get FILES for this Item
5561 5560
                     $rows = DB::query(
5562 5561
                         'SELECT id
5563
-                        FROM ' . prefixTable('files') . '
5562
+                        FROM ' . prefixTable('files').'
5564 5563
                         WHERE id_item = %i',
5565 5564
                         $item_id
5566 5565
                     );
@@ -5615,7 +5614,7 @@  discard block
 block discarded – undo
5615 5614
                     // Get the ITEM object key for the user
5616 5615
                     $userKey = DB::queryFirstRow(
5617 5616
                         'SELECT share_key
5618
-                        FROM ' . prefixTable('sharekeys_items') . '
5617
+                        FROM ' . prefixTable('sharekeys_items').'
5619 5618
                         WHERE user_id = %i AND object_id = %i',
5620 5619
                         $session->get('user-id'),
5621 5620
                         $item_id
@@ -5626,7 +5625,7 @@  discard block
 block discarded – undo
5626 5625
                         // This is a public object
5627 5626
                         $users = DB::query(
5628 5627
                             'SELECT id, public_key
5629
-                            FROM ' . prefixTable('users') . '
5628
+                            FROM ' . prefixTable('users').'
5630 5629
                             WHERE id NOT IN %li
5631 5630
                             AND public_key != ""',
5632 5631
                             $tpUsersIDs
@@ -5649,14 +5648,14 @@  discard block
 block discarded – undo
5649 5648
                     // Get fields for this Item
5650 5649
                     $rows = DB::query(
5651 5650
                         'SELECT id
5652
-                        FROM ' . prefixTable('categories_items') . '
5651
+                        FROM ' . prefixTable('categories_items').'
5653 5652
                         WHERE item_id = %i',
5654 5653
                         $item_id
5655 5654
                     );
5656 5655
                     foreach ($rows as $field) {
5657 5656
                         $userKey = DB::queryFirstRow(
5658 5657
                             'SELECT share_key
5659
-                            FROM ' . prefixTable('sharekeys_fields') . '
5658
+                            FROM ' . prefixTable('sharekeys_fields').'
5660 5659
                             WHERE user_id = %i AND object_id = %i',
5661 5660
                             $session->get('user-id'),
5662 5661
                             $field['id']
@@ -5667,7 +5666,7 @@  discard block
 block discarded – undo
5667 5666
                             // This is a public object
5668 5667
                             $users = DB::query(
5669 5668
                                 'SELECT id, public_key
5670
-                                FROM ' . prefixTable('users') . '
5669
+                                FROM ' . prefixTable('users').'
5671 5670
                                 WHERE id NOT IN %li
5672 5671
                                 AND public_key != ""',
5673 5672
                                 $tpUsersIDs
@@ -5691,14 +5690,14 @@  discard block
 block discarded – undo
5691 5690
                     // Get FILES for this Item
5692 5691
                     $rows = DB::query(
5693 5692
                         'SELECT id
5694
-                        FROM ' . prefixTable('files') . '
5693
+                        FROM ' . prefixTable('files').'
5695 5694
                         WHERE id_item = %i',
5696 5695
                         $item_id
5697 5696
                     );
5698 5697
                     foreach ($rows as $attachment) {
5699 5698
                         $userKey = DB::queryFirstRow(
5700 5699
                             'SELECT share_key
5701
-                            FROM ' . prefixTable('sharekeys_files') . '
5700
+                            FROM ' . prefixTable('sharekeys_files').'
5702 5701
                             WHERE user_id = %i AND object_id = %i',
5703 5702
                             $session->get('user-id'),
5704 5703
                             $attachment['id']
@@ -5709,7 +5708,7 @@  discard block
 block discarded – undo
5709 5708
                             // This is a public object
5710 5709
                             $users = DB::query(
5711 5710
                                 'SELECT id, public_key
5712
-                                FROM ' . prefixTable('users') . '
5711
+                                FROM ' . prefixTable('users').'
5713 5712
                                 WHERE id NOT IN %li
5714 5713
                                 AND public_key != ""',
5715 5714
                                 $tpUsersIDs
@@ -5749,13 +5748,13 @@  discard block
 block discarded – undo
5749 5748
                     $session->get('user-id'),
5750 5749
                     'at_modification',
5751 5750
                     $session->get('user-login'),
5752
-                    'at_moved : ' . $dataSource['title'] . ' -> ' . $dataDestination['title']
5751
+                    'at_moved : '.$dataSource['title'].' -> '.$dataDestination['title']
5753 5752
                 );
5754 5753
             }
5755 5754
         }
5756 5755
 
5757 5756
         // reload cache table
5758
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
5757
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
5759 5758
         updateCacheTable('reload', null);
5760 5759
 
5761 5760
         echo (string) prepareExchangedData(
@@ -5819,7 +5818,7 @@  discard block
 block discarded – undo
5819 5818
                 // get info
5820 5819
                 $dataSource = DB::queryfirstrow(
5821 5820
                     'SELECT label, id_tree
5822
-                    FROM ' . prefixTable('items') . '
5821
+                    FROM ' . prefixTable('items').'
5823 5822
                     WHERE id=%i',
5824 5823
                     $item_id
5825 5824
                 );
@@ -5920,14 +5919,14 @@  discard block
 block discarded – undo
5920 5919
             // Variables
5921 5920
             $dataAuthor = DB::queryfirstrow(
5922 5921
                 'SELECT email,login
5923
-                FROM ' . prefixTable('users') . '
5922
+                FROM ' . prefixTable('users').'
5924 5923
                 WHERE id = %i',
5925 5924
                 $post_content[1]
5926 5925
             );
5927 5926
 
5928 5927
             $dataItem = DB::queryfirstrow(
5929 5928
                 'SELECT label, id_tree
5930
-                FROM ' . prefixTable('items') . '
5929
+                FROM ' . prefixTable('items').'
5931 5930
                 WHERE id = %i',
5932 5931
                 $post_content[0]
5933 5932
             );
@@ -5944,7 +5943,7 @@  discard block
 block discarded – undo
5944 5943
                 $lang->get('email_request_access_subject'),
5945 5944
                 str_replace(
5946 5945
                     array('#tp_item_author#', '#tp_user#', '#tp_item#'),
5947
-                    array(' ' . addslashes($dataAuthor['login']), addslashes($session->get('user-login')), $path),
5946
+                    array(' '.addslashes($dataAuthor['login']), addslashes($session->get('user-login')), $path),
5948 5947
                     $lang->get('email_request_access_mail')
5949 5948
                 ),
5950 5949
                 $dataAuthor['email'],
@@ -5953,7 +5952,7 @@  discard block
 block discarded – undo
5953 5952
         } elseif ($inputData['cat'] === 'share_this_item') {
5954 5953
             $dataItem = DB::queryfirstrow(
5955 5954
                 'SELECT label,id_tree
5956
-                FROM ' . prefixTable('items') . '
5955
+                FROM ' . prefixTable('items').'
5957 5956
                 WHERE id= %i',
5958 5957
                 $inputData['id']
5959 5958
             );
@@ -5976,7 +5975,7 @@  discard block
 block discarded – undo
5976 5975
                     ),
5977 5976
                     array(
5978 5977
                         empty($SETTINGS['email_server_url']) === false ?
5979
-                            $SETTINGS['email_server_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $inputData['id'] : $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $inputData['id'],
5978
+                            $SETTINGS['email_server_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$inputData['id'] : $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$inputData['id'],
5980 5979
                         addslashes($session->get('user-login')),
5981 5980
                         addslashes($path),
5982 5981
                     ),
@@ -6025,8 +6024,8 @@  discard block
 block discarded – undo
6025 6024
         // Get all informations for this item
6026 6025
         $dataItem = DB::queryfirstrow(
6027 6026
             'SELECT *
6028
-            FROM ' . prefixTable('items') . ' as i
6029
-            INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
6027
+            FROM ' . prefixTable('items').' as i
6028
+            INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
6030 6029
             WHERE i.id=%i AND l.action = %s',
6031 6030
             $item_id,
6032 6031
             'at_creation'
@@ -6055,18 +6054,18 @@  discard block
 block discarded – undo
6055 6054
                 $session->get('user-login'),
6056 6055
                 htmlspecialchars_decode($label, ENT_QUOTES),
6057 6056
                 null,
6058
-                (string) dateToStamp($date.' '.$time, $SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'])
6057
+                (string) dateToStamp($date.' '.$time, $SETTINGS['date_format'].' '.$SETTINGS['time_format'])
6059 6058
             );
6060 6059
             // Prepare new line
6061 6060
             $data = DB::queryfirstrow(
6062
-                'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i ORDER BY date DESC',
6061
+                'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i ORDER BY date DESC',
6063 6062
                 $item_id
6064 6063
             );
6065
-            $historic = date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $data['date']) . ' - ' . $session->get('user-login') . ' - ' . $lang->get($data['action']) . ' - ' . $data['raison'];
6064
+            $historic = date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $data['date']).' - '.$session->get('user-login').' - '.$lang->get($data['action']).' - '.$data['raison'];
6066 6065
             // send back
6067 6066
             $data = array(
6068 6067
                 'error' => '',
6069
-                'new_line' => '<br>' . addslashes($historic),
6068
+                'new_line' => '<br>'.addslashes($historic),
6070 6069
             );
6071 6070
             echo (string) prepareExchangedData(
6072 6071
                 $data,
@@ -6141,8 +6140,8 @@  discard block
 block discarded – undo
6141 6140
         // Should we log a password change?
6142 6141
         $itemQ = DB::queryFirstRow(
6143 6142
             'SELECT s.share_key, i.pw
6144
-            FROM ' . prefixTable('items') . ' AS i
6145
-            INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (i.id = s.object_id)
6143
+            FROM ' . prefixTable('items').' AS i
6144
+            INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (i.id = s.object_id)
6146 6145
             WHERE s.user_id = %i AND s.object_id = %i',
6147 6146
             $session->get('user-id'),
6148 6147
             $dataReceived['id']
@@ -6197,7 +6196,7 @@  discard block
 block discarded – undo
6197 6196
         if (isset($SETTINGS['otv_expiration_period']) === false) {
6198 6197
             $SETTINGS['otv_expiration_period'] = 7;
6199 6198
         }
6200
-        $url = $SETTINGS['cpassman_url'] . '/index.php?' . http_build_query($otv_session);
6199
+        $url = $SETTINGS['cpassman_url'].'/index.php?'.http_build_query($otv_session);
6201 6200
 
6202 6201
         echo json_encode(
6203 6202
             array(
@@ -6228,7 +6227,7 @@  discard block
 block discarded – undo
6228 6227
         // get parameters from original link
6229 6228
         $url = $dataReceived['original_link'];
6230 6229
         $parts = parse_url($url);
6231
-        if(isset($parts['query'])){
6230
+        if (isset($parts['query'])) {
6232 6231
             parse_str($parts['query'], $orignal_link_parameters);
6233 6232
         } else {
6234 6233
             $orignal_link_parameters = array();
@@ -6259,13 +6258,13 @@  discard block
 block discarded – undo
6259 6258
             $domain_scheme = parse_url($SETTINGS['cpassman_url'], PHP_URL_SCHEME);
6260 6259
             $domain_host = parse_url($SETTINGS['cpassman_url'], PHP_URL_HOST);
6261 6260
             if (str_contains($domain_host, 'www.') === true) {
6262
-                $domain_host = (string) $SETTINGS['otv_subdomain'] . '.' . substr($domain_host, 4);
6261
+                $domain_host = (string) $SETTINGS['otv_subdomain'].'.'.substr($domain_host, 4);
6263 6262
             } else {
6264
-                $domain_host = (string) $SETTINGS['otv_subdomain'] . '.' . $domain_host;
6263
+                $domain_host = (string) $SETTINGS['otv_subdomain'].'.'.$domain_host;
6265 6264
             }
6266
-            $url = $domain_scheme.'://'.$domain_host . '/index.php?'.http_build_query($otv_session);
6265
+            $url = $domain_scheme.'://'.$domain_host.'/index.php?'.http_build_query($otv_session);
6267 6266
         } else {
6268
-            $url = $SETTINGS['cpassman_url'] . '/index.php?'.http_build_query($otv_session);
6267
+            $url = $SETTINGS['cpassman_url'].'/index.php?'.http_build_query($otv_session);
6269 6268
         }
6270 6269
 
6271 6270
         echo (string) prepareExchangedData(
@@ -6300,8 +6299,8 @@  discard block
 block discarded – undo
6300 6299
             'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status,
6301 6300
             f.extension AS extension, f.type AS type,
6302 6301
             s.share_key AS share_key
6303
-            FROM ' . prefixTable('files') . ' AS f
6304
-            INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id)
6302
+            FROM ' . prefixTable('files').' AS f
6303
+            INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id)
6305 6304
             WHERE s.user_id = %i AND s.object_id = %i',
6306 6305
             $session->get('user-id'),
6307 6306
             $inputData['id']
@@ -6322,7 +6321,7 @@  discard block
 block discarded – undo
6322 6321
         //$fileName = basename($file_info['name'], '.'.$file_info['extension']);
6323 6322
 
6324 6323
         // prepare image info
6325
-        $post_title = basename($file_info['name'], '.' . $file_info['extension']);
6324
+        $post_title = basename($file_info['name'], '.'.$file_info['extension']);
6326 6325
         $post_title = isBase64($post_title) === true ? base64_decode($post_title) : $post_title;
6327 6326
         
6328 6327
         // Get image content
@@ -6349,7 +6348,7 @@  discard block
 block discarded – undo
6349 6348
         echo (string) prepareExchangedData(
6350 6349
             array(
6351 6350
                 'error' => false,
6352
-                'filename' => $post_title . '.' . $file_info['extension'],
6351
+                'filename' => $post_title.'.'.$file_info['extension'],
6353 6352
                 'file_type' => $file_info['type'],
6354 6353
                 'file_content' => $fileContent,
6355 6354
             ),
@@ -6463,7 +6462,7 @@  discard block
 block discarded – undo
6463 6462
                     $arbo = $tree->getPath($folder->id, false);
6464 6463
                     $path = '';
6465 6464
                     foreach ($arbo as $elem) {
6466
-                        $path = (empty($path) ? '' : $path . ' / ') . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
6465
+                        $path = (empty($path) ? '' : $path.' / ').htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
6467 6466
                     }
6468 6467
 
6469 6468
                     // Build array
@@ -6532,7 +6531,7 @@  discard block
 block discarded – undo
6532 6531
         if (is_array($foldersArray) === true && $inputData['data'] !== '[null]') {
6533 6532
             $rows = DB::query(
6534 6533
                 'SELECT id, categories
6535
-                FROM ' . prefixTable('nested_tree') . '
6534
+                FROM ' . prefixTable('nested_tree').'
6536 6535
                 WHERE id IN (%l)',
6537 6536
                 implode(',', $foldersArray)
6538 6537
             );
@@ -6574,7 +6573,7 @@  discard block
 block discarded – undo
6574 6573
         // get item info
6575 6574
         $dataItem = DB::queryFirstRow(
6576 6575
             'SELECT *
6577
-            FROM ' . prefixTable('items') . '
6576
+            FROM ' . prefixTable('items').'
6578 6577
             WHERE id=%i',
6579 6578
             $inputData['itemId']
6580 6579
         );
@@ -6586,8 +6585,8 @@  discard block
 block discarded – undo
6586 6585
             'SELECT l.date as date, l.action as action, l.raison as raison,
6587 6586
                 u.login as login, u.avatar_thumb as avatar_thumb, u.name as name, u.lastname as lastname,
6588 6587
                 l.old_value as old_value
6589
-            FROM ' . prefixTable('log_items') . ' as l
6590
-            INNER JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id)
6588
+            FROM ' . prefixTable('log_items').' as l
6589
+            INNER JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id)
6591 6590
             WHERE id_item=%i AND l.action NOT IN (%l)
6592 6591
             ORDER BY date DESC',
6593 6592
             $inputData['itemId'],
@@ -6602,18 +6601,18 @@  discard block
 block discarded – undo
6602 6601
             
6603 6602
             // imported via API
6604 6603
             if (empty($record['login']) === true) {
6605
-                $record['login'] = $lang->get('imported_via_api') . ' [' . $record['raison'] . ']';
6604
+                $record['login'] = $lang->get('imported_via_api').' ['.$record['raison'].']';
6606 6605
             }
6607 6606
             
6608 6607
             // Prepare avatar
6609 6608
             if (isset($record['avatar_thumb']) && empty($record['avatar_thumb']) === false) {
6610
-                if (file_exists($SETTINGS['cpassman_dir'] . '/includes/avatars/' . $record['avatar_thumb'])) {
6611
-                    $avatar = $SETTINGS['cpassman_url'] . '/includes/avatars/' . $record['avatar_thumb'];
6609
+                if (file_exists($SETTINGS['cpassman_dir'].'/includes/avatars/'.$record['avatar_thumb'])) {
6610
+                    $avatar = $SETTINGS['cpassman_url'].'/includes/avatars/'.$record['avatar_thumb'];
6612 6611
                 } else {
6613
-                    $avatar = $SETTINGS['cpassman_url'] . '/includes/images/photo.jpg';
6612
+                    $avatar = $SETTINGS['cpassman_url'].'/includes/images/photo.jpg';
6614 6613
                 }
6615 6614
             } else {
6616
-                $avatar = $SETTINGS['cpassman_url'] . '/includes/images/photo.jpg';
6615
+                $avatar = $SETTINGS['cpassman_url'].'/includes/images/photo.jpg';
6617 6616
             }
6618 6617
 
6619 6618
             // Prepare action
@@ -6633,7 +6632,7 @@  discard block
 block discarded – undo
6633 6632
                         $previous_passwords, 
6634 6633
                         [
6635 6634
                             'password' => htmlentities($previous_pwd['string']),
6636
-                            'date' => date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']),
6635
+                            'date' => date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']),
6637 6636
                         ]
6638 6637
                     );
6639 6638
                 }
@@ -6646,19 +6645,19 @@  discard block
 block discarded – undo
6646 6645
                 $action = $lang->get($reason[0]);
6647 6646
                 if ($reason[0] === 'at_moved') {
6648 6647
                     $tmp = explode(' -> ', $reason[1]);
6649
-                    $detail = $lang->get('from') . ' <span class="font-weight-light">' . $tmp[0] . '</span> ' . $lang->get('to') . ' <span class="font-weight-light">' . $tmp[1] . ' </span>';
6648
+                    $detail = $lang->get('from').' <span class="font-weight-light">'.$tmp[0].'</span> '.$lang->get('to').' <span class="font-weight-light">'.$tmp[1].' </span>';
6650 6649
                 } elseif ($reason[0] === 'at_field') {
6651 6650
                     $tmp = explode(' => ', $reason[1]);
6652 6651
                     if (count($tmp) > 1) {
6653
-                        $detail = '<b>' . trim($tmp[0]) . '</b> | ' . $lang->get('previous_value') .
6654
-                            ': <span class="font-weight-light">' . trim($tmp[1]) . '</span>';
6652
+                        $detail = '<b>'.trim($tmp[0]).'</b> | '.$lang->get('previous_value').
6653
+                            ': <span class="font-weight-light">'.trim($tmp[1]).'</span>';
6655 6654
                     } else {
6656 6655
                         $detail = trim($reason[1]);
6657 6656
                     }
6658 6657
                 } elseif (in_array($reason[0], array('at_restriction', 'at_email', 'at_login', 'at_label', 'at_url', 'at_tag')) === true) {
6659 6658
                     $tmp = explode(' => ', $reason[1]);
6660 6659
                     $detail = empty(trim($tmp[0])) === true ?
6661
-                        $lang->get('no_previous_value') : $lang->get('previous_value') . ': <span class="font-weight-light">' . $tmp[0] . ' </span>';
6660
+                        $lang->get('no_previous_value') : $lang->get('previous_value').': <span class="font-weight-light">'.$tmp[0].' </span>';
6662 6661
                 } elseif ($reason[0] === 'at_automatic_del') {
6663 6662
                     $detail = $lang->get($reason[1]);
6664 6663
                 } elseif ($reason[0] === 'at_anyoneconmodify' || $reason[0] === 'at_otp_status') {
@@ -6667,7 +6666,7 @@  discard block
 block discarded – undo
6667 6666
                     $tmp = explode(':', $reason[1]);
6668 6667
                     $tmp = explode('.', $tmp[0]);
6669 6668
                     $detail = isBase64($tmp[0]) === true ?
6670
-                        base64_decode($tmp[0]) . '.' . $tmp[1] : $tmp[0];
6669
+                        base64_decode($tmp[0]).'.'.$tmp[1] : $tmp[0];
6671 6670
                 } elseif ($reason[0] === 'at_import') {
6672 6671
                     $detail = '';
6673 6672
                 } elseif (in_array($reason[0], array('csv', 'pdf')) === true) {
@@ -6686,8 +6685,8 @@  discard block
 block discarded – undo
6686 6685
                 array(
6687 6686
                     'avatar' => $avatar,
6688 6687
                     'login' => $record['login'],
6689
-                    'name' => $record['name'] . ' ' . $record['lastname'],
6690
-                    'date' => date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']),
6688
+                    'name' => $record['name'].' '.$record['lastname'],
6689
+                    'date' => date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']),
6691 6690
                     'action' => $action,
6692 6691
                     'detail' => $detail,
6693 6692
                 )
@@ -6775,11 +6774,11 @@  discard block
 block discarded – undo
6775 6774
 
6776 6775
         // get some info to add to the notification email
6777 6776
         $resp_user = DB::queryfirstrow(
6778
-            'SELECT login FROM ' . prefixTable('users') . ' WHERE id = %i',
6777
+            'SELECT login FROM '.prefixTable('users').' WHERE id = %i',
6779 6778
             $session->get('user-id')
6780 6779
         );
6781 6780
         $resp_folder = DB::queryfirstrow(
6782
-            'SELECT title FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
6781
+            'SELECT title FROM '.prefixTable('nested_tree').' WHERE id = %i',
6783 6782
             $folder
6784 6783
         );
6785 6784
 
@@ -6788,7 +6787,7 @@  discard block
 block discarded – undo
6788 6787
         $emailService = new EmailService();
6789 6788
         $rows = DB::query(
6790 6789
             'SELECT email
6791
-            FROM ' . prefixTable('users') . '
6790
+            FROM ' . prefixTable('users').'
6792 6791
             WHERE `gestionnaire` = %i AND `email` IS NOT NULL',
6793 6792
             1
6794 6793
         );
@@ -6834,7 +6833,7 @@  discard block
 block discarded – undo
6834 6833
         // Send email
6835 6834
         $dataItem = DB::queryfirstrow(
6836 6835
             'SELECT label, id_tree
6837
-            FROM ' . prefixTable('items') . '
6836
+            FROM ' . prefixTable('items').'
6838 6837
             WHERE id = %i',
6839 6838
             $inputData['itemId']
6840 6839
         );
@@ -6888,7 +6887,7 @@  discard block
 block discarded – undo
6888 6887
 
6889 6888
         DB::query(
6890 6889
             'SELECT *
6891
-            FROM ' . prefixTable('notification') . '
6890
+            FROM ' . prefixTable('notification').'
6892 6891
             WHERE item_id = %i AND user_id = %i',
6893 6892
             $inputData['itemId'],
6894 6893
             $session->get('user-id')
@@ -6960,7 +6959,7 @@  discard block
 block discarded – undo
6960 6959
         // And related logs
6961 6960
         $rows = DB::query(
6962 6961
             'SELECT id, file AS filename
6963
-            FROM ' . prefixTable('files') . '
6962
+            FROM ' . prefixTable('files').'
6964 6963
             WHERE id_item = %i AND confirmed = %i',
6965 6964
             $inputData['itemId'],
6966 6965
             0
@@ -6974,12 +6973,12 @@  discard block
 block discarded – undo
6974 6973
             );
6975 6974
 
6976 6975
             // Delete file on server
6977
-            unlink($SETTINGS['path_to_upload_folder'] . '/' . TP_FILE_PREFIX . base64_decode($file['filename']));
6976
+            unlink($SETTINGS['path_to_upload_folder'].'/'.TP_FILE_PREFIX.base64_decode($file['filename']));
6978 6977
 
6979 6978
             // Delete related logs
6980 6979
             $logFile = DB::query(
6981 6980
                 'SELECT increment_id, raison
6982
-                FROM ' . prefixTable('log_items') . '
6981
+                FROM ' . prefixTable('log_items').'
6983 6982
                 WHERE id_item = %i AND id_user = %i AND action = %s AND raison LIKE "at_add_file :%"',
6984 6983
                 $inputData['itemId'],
6985 6984
                 $session->get('user-id'),
@@ -7038,7 +7037,7 @@  discard block
 block discarded – undo
7038 7037
         // Confirm attachments
7039 7038
         $rows = DB::query(
7040 7039
             'SELECT id, file AS filename
7041
-            FROM ' . prefixTable('files') . '
7040
+            FROM ' . prefixTable('files').'
7042 7041
             WHERE id_item = %i AND confirmed = %i',
7043 7042
             $inputData['itemId'],
7044 7043
             0
@@ -7124,15 +7123,15 @@  discard block
 block discarded – undo
7124 7123
         case 'autocomplete_tags':
7125 7124
             // Get a list off all existing TAGS
7126 7125
             $listOfTags = '';
7127
-            $rows = DB::query('SELECT tag FROM ' . prefixTable('tags') . ' WHERE tag LIKE %ss GROUP BY tag', $inputData['getTerm']);
7126
+            $rows = DB::query('SELECT tag FROM '.prefixTable('tags').' WHERE tag LIKE %ss GROUP BY tag', $inputData['getTerm']);
7128 7127
             foreach ($rows as $record) {
7129 7128
                 if (empty($listOfTags)) {
7130
-                    $listOfTags = '"' . $record['tag'] . '"';
7129
+                    $listOfTags = '"'.$record['tag'].'"';
7131 7130
                 } else {
7132
-                    $listOfTags .= ', "' . $record['tag'] . '"';
7131
+                    $listOfTags .= ', "'.$record['tag'].'"';
7133 7132
                 }
7134 7133
             }
7135
-            echo '[' . $listOfTags . ']';
7134
+            echo '['.$listOfTags.']';
7136 7135
             break;
7137 7136
     }
7138 7137
 }
@@ -7148,7 +7147,7 @@  discard block
 block discarded – undo
7148 7147
 {
7149 7148
     $data = DB::queryFirstRow(
7150 7149
         'SELECT bloquer_creation, bloquer_modification, personal_folder
7151
-        FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
7150
+        FROM ' . prefixTable('nested_tree').' WHERE id = %i',
7152 7151
         $groupe
7153 7152
     );
7154 7153
     // Check if it's in a personal folder. If yes, then force complexity overhead.
@@ -7252,7 +7251,7 @@  discard block
 block discarded – undo
7252 7251
     global $SETTINGS;
7253 7252
 
7254 7253
     // Retrieve the current lock information for the item
7255
-    $itemLockInfo = DB::queryFirstRow('SELECT timestamp, user_id FROM ' . prefixTable('items_edition') . ' WHERE item_id = %i', $itemId);
7254
+    $itemLockInfo = DB::queryFirstRow('SELECT timestamp, user_id FROM '.prefixTable('items_edition').' WHERE item_id = %i', $itemId);
7256 7255
 
7257 7256
     // Check if the item is locked by another user
7258 7257
     if ($itemLockInfo && $itemLockInfo['user_id'] !== $userId) {
@@ -7271,7 +7270,7 @@  discard block
 block discarded – undo
7271 7270
     
7272 7271
     // Check if there's an ongoing background encryption process for the item
7273 7272
     $ongoingProcess = DB::queryFirstRow(
7274
-        'SELECT 1 FROM ' . prefixTable('background_tasks') . ' WHERE item_id = %i AND finished_at = "" LIMIT 1', 
7273
+        'SELECT 1 FROM '.prefixTable('background_tasks').' WHERE item_id = %i AND finished_at = "" LIMIT 1', 
7275 7274
         $itemId
7276 7275
     );
7277 7276
 
@@ -7289,7 +7288,7 @@  discard block
 block discarded – undo
7289 7288
 function getUserVisibleFolders(int $userId): array
7290 7289
 {
7291 7290
     // Query to retrieve visible folders for the user
7292
-    $data = DB::queryFirstRow('SELECT visible_folders FROM ' . prefixTable('cache_tree') . ' WHERE user_id = %i', $userId);
7291
+    $data = DB::queryFirstRow('SELECT visible_folders FROM '.prefixTable('cache_tree').' WHERE user_id = %i', $userId);
7293 7292
     
7294 7293
     // Decode JSON data into an array; return an empty array if the data is invalid
7295 7294
     return json_decode($data['visible_folders'], true) ?? [];
@@ -7313,7 +7312,7 @@  discard block
 block discarded – undo
7313 7312
 
7314 7313
     // Query the access rights for the given roles and folder
7315 7314
     $accessTypes = DB::queryFirstColumn(
7316
-        'SELECT type FROM ' . prefixTable('roles_values') . ' WHERE role_id IN %ls AND folder_id = %i', 
7315
+        'SELECT type FROM '.prefixTable('roles_values').' WHERE role_id IN %ls AND folder_id = %i', 
7317 7316
         $roles, 
7318 7317
         $treeId
7319 7318
     );
Please login to merge, or discard this patch.
Braces   +21 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1223,7 +1223,9 @@  discard block
 block discarded – undo
1223 1223
                 );
1224 1224
 
1225 1225
                 // Create a task to create sharekeys for users
1226
-                if (WIP=== true) error_log('createTaskForItem - new password for this item - '.$post_password ." -- ". $pw);
1226
+                if (WIP=== true) {
1227
+                    error_log('createTaskForItem - new password for this item - '.$post_password ." -- ". $pw);
1228
+                }
1227 1229
                 $tasksToBePerformed = ['item_password'];
1228 1230
                 $encryptionTaskIsRequested = true;
1229 1231
             } else {
@@ -1539,7 +1541,9 @@  discard block
 block discarded – undo
1539 1541
 
1540 1542
             // create a task for all fields updated
1541 1543
             if ($encryptionTaskIsRequested === true) {
1542
-                if (WIP === true) error_log('createTaskForItem - '.print_r($tasksToBePerformed, true));
1544
+                if (WIP === true) {
1545
+                    error_log('createTaskForItem - '.print_r($tasksToBePerformed, true));
1546
+                }
1543 1547
                 createTaskForItem(
1544 1548
                     'item_update_create_keys',
1545 1549
                     $tasksToBePerformed,
@@ -2046,7 +2050,9 @@  discard block
 block discarded – undo
2046 2050
                 $inputData['itemId']
2047 2051
             );
2048 2052
             foreach ($rows as $record) {
2049
-                if ($record['raison'] === NULL) continue;
2053
+                if ($record['raison'] === NULL) {
2054
+                    continue;
2055
+                }
2050 2056
                 $reason = explode(':', $record['raison']);
2051 2057
                 if (count($reason) > 0) {
2052 2058
                     $sentence = date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) . ' - '
@@ -4559,7 +4565,9 @@  discard block
 block discarded – undo
4559 4565
                 $inputData['itemId']
4560 4566
             );
4561 4567
             
4562
-            if (WIP === true) error_log('Existing edition locks: '.DB::count());
4568
+            if (WIP === true) {
4569
+                error_log('Existing edition locks: '.DB::count());
4570
+            }
4563 4571
 
4564 4572
             // Check if item has no edition lock
4565 4573
             if ((int) DB::count() > 0 ) {
@@ -4572,7 +4580,9 @@  discard block
 block discarded – undo
4572 4580
                 } else {
4573 4581
                     $delay = EDITION_LOCK_PERIOD; // One day delay
4574 4582
                 }
4575
-                if (WIP === true) error_log('delay: ' . $delay);
4583
+                if (WIP === true) {
4584
+                    error_log('delay: ' . $delay);
4585
+                }
4576 4586
 
4577 4587
                 // We remove old edition locks if delay is expired meaning more than 1 day long
4578 4588
                 if (round(abs(time() - $dataTmp['timestamp']),0) > $delay) {
@@ -4580,7 +4590,9 @@  discard block
 block discarded – undo
4580 4590
                     // In this case, delete edition lock and possible ongoing processes
4581 4591
                     // and continue editing this time
4582 4592
                     // We coonsidere if the most recent item is still locked then all other locks can be removed
4583
-                    if (WIP === true)  error_log('Delay is expired, removing old locks');
4593
+                    if (WIP === true) {
4594
+                        error_log('Delay is expired, removing old locks');
4595
+                    }
4584 4596
                     foreach ($dataItemEditionLocks as $itemEditionLock) {
4585 4597
                         // delete lock
4586 4598
                         DB::delete(
@@ -4847,8 +4859,9 @@  discard block
 block discarded – undo
4847 4859
                 $ids = $tree->getDescendants($folder['id'], true, false, true);
4848 4860
 
4849 4861
                 // This folder is owned by user
4850
-                if (in_array($inputData['folderId'], $ids))
4851
-                    $accessLevel = 30;
4862
+                if (in_array($inputData['folderId'], $ids)) {
4863
+                                    $accessLevel = 30;
4864
+                }
4852 4865
             }
4853 4866
         }
4854 4867
 
Please login to merge, or discard this patch.
self-unlock.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 use Symfony\Component\HttpFoundation\Request as SymfonyRequest;
34 34
 
35 35
 // Load functions
36
-require_once __DIR__. '/includes/config/include.php';
36
+require_once __DIR__.'/includes/config/include.php';
37 37
 require_once __DIR__.'/sources/main.functions.php';
38 38
 
39 39
 // init
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
 // Check for existing lock
54 54
 $result = DB::queryFirstField(
55 55
     'SELECT 1
56
-     FROM ' . prefixTable('auth_failures') . '
56
+     FROM ' . prefixTable('auth_failures').'
57 57
      WHERE unlock_at = (
58 58
         SELECT MAX(unlock_at)
59
-        FROM ' . prefixTable('auth_failures') . '
59
+        FROM ' . prefixTable('auth_failures').'
60 60
         WHERE unlock_at > %s
61 61
         AND source = %s AND value = %s)
62 62
      AND unlock_code = %s',
Please login to merge, or discard this patch.
sources/identify.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2663,7 +2663,7 @@
 block discarded – undo
2663 2663
             'SELECT email, name
2664 2664
              FROM '.prefixTable('users').'
2665 2665
              WHERE login = %s',
2666
-             $value
2666
+                $value
2667 2667
         );
2668 2668
 
2669 2669
         // No valid email address for user
Please login to merge, or discard this patch.
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2401,7 +2401,9 @@  discard block
 block discarded – undo
2401 2401
         // Complete $userInfo
2402 2402
         $userInfo['has_been_created'] = 1;
2403 2403
 
2404
-        if (WIP === true) error_log("--- USER CREATED ---");
2404
+        if (WIP === true) {
2405
+            error_log("--- USER CREATED ---");
2406
+        }
2405 2407
 
2406 2408
         return [
2407 2409
             'error' => false,
@@ -2437,7 +2439,9 @@  discard block
 block discarded – undo
2437 2439
         }
2438 2440
 
2439 2441
         // Oauth2 user already exists and authenticated
2440
-        if (WIP === true) error_log("--- USER AUTHENTICATED ---");
2442
+        if (WIP === true) {
2443
+            error_log("--- USER AUTHENTICATED ---");
2444
+        }
2441 2445
         $userInfo['has_been_created'] = 0;
2442 2446
 
2443 2447
         $passwordManager = new PasswordManager();
@@ -2667,8 +2671,9 @@  discard block
 block discarded – undo
2667 2671
         );
2668 2672
 
2669 2673
         // No valid email address for user
2670
-        if (!$userInfos || !filter_var($userInfos['email'], FILTER_VALIDATE_EMAIL))
2671
-            return;
2674
+        if (!$userInfos || !filter_var($userInfos['email'], FILTER_VALIDATE_EMAIL)) {
2675
+                    return;
2676
+        }
2672 2677
 
2673 2678
         $unlock_url = $SETTINGS['cpassman_url'].'/self-unlock.php?login='.$value.'&otp='.$unlock_code;
2674 2679
 
Please login to merge, or discard this patch.
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
     $sessionPwdAttempts = $session->get('pwd_attempts');
148 148
     $sessionUrl = $session->get('user-initial_url');
149 149
     $server = [];
150
-    $server['PHP_AUTH_USER'] =  $request->getUser();
150
+    $server['PHP_AUTH_USER'] = $request->getUser();
151 151
     $server['PHP_AUTH_PW'] = $request->getPassword();
152 152
     
153 153
     // decrypt and retreive data in JSON format
@@ -162,18 +162,18 @@  discard block
 block discarded – undo
162 162
     }
163 163
 
164 164
     // Check if Duo auth is in progress and pass the pw and login back to the standard login process
165
-    if(
165
+    if (
166 166
         isKeyExistingAndEqual('duo', 1, $SETTINGS) === true
167 167
         && $dataReceived['user_2fa_selection'] === 'duo'
168 168
         && $session->get('user-duo_status') === 'IN_PROGRESS'
169 169
         && !empty($dataReceived['duo_state'])
170
-    ){
170
+    ) {
171 171
         $key = hash('sha256', $dataReceived['duo_state']);
172 172
         $iv = substr(hash('sha256', $dataReceived['duo_state']), 0, 16);
173 173
         $duo_data_dec = openssl_decrypt(base64_decode($session->get('user-duo_data')), 'AES-256-CBC', $key, 0, $iv);
174 174
         // Clear the data from the Duo process to continue clean with the standard login process
175
-        $session->set('user-duo_data','');
176
-        if($duo_data_dec === false) {
175
+        $session->set('user-duo_data', '');
176
+        if ($duo_data_dec === false) {
177 177
             // Add failed authentication log
178 178
             addFailedAuthentication(filter_var($dataReceived['login'], FILTER_SANITIZE_FULL_SPECIAL_CHARS), getClientIpServer());
179 179
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
         $dataReceived['login'] = $duo_data['duo_login'];
192 192
     }
193 193
 
194
-    if(isset($dataReceived['pw']) === false || isset($dataReceived['login']) === false) {
194
+    if (isset($dataReceived['pw']) === false || isset($dataReceived['login']) === false) {
195 195
         echo json_encode([
196 196
             'data' => prepareExchangedData(
197 197
                 [
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
         }
537 537
         // Append with roles from AD groups
538 538
         if (is_null($userInfo['roles_from_ad_groups']) === false) {
539
-            $userInfo['fonction_id'] = empty($userInfo['fonction_id'])  === true ? $userInfo['roles_from_ad_groups'] : $userInfo['fonction_id']. ';' . $userInfo['roles_from_ad_groups'];
539
+            $userInfo['fonction_id'] = empty($userInfo['fonction_id']) === true ? $userInfo['roles_from_ad_groups'] : $userInfo['fonction_id'].';'.$userInfo['roles_from_ad_groups'];
540 540
         }
541 541
         // store
542 542
         $session->set('user-roles', $userInfo['fonction_id']);
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
         if (count($session->get('user-roles_array')) > 0) {
549 549
             $rolesList = DB::query(
550 550
                 'SELECT id, title, complexity
551
-                FROM ' . prefixTable('roles_title') . '
551
+                FROM ' . prefixTable('roles_title').'
552 552
                 WHERE id IN %li',
553 553
                 $session->get('user-roles_array')
554 554
             );
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
             if ($adjustPermissions) {
595 595
                 $session->set('user-admin', (int) $userInfo['admin']);
596 596
                 $session->set('user-manager', (int) $userInfo['gestionnaire']);
597
-                $session->set('user-can_manage_all_users',(int)  $userInfo['can_manage_all_users']);
597
+                $session->set('user-can_manage_all_users', (int) $userInfo['can_manage_all_users']);
598 598
                 $session->set('user-read_only', (int) $userInfo['read_only']);
599 599
                 DB::update(
600 600
                     prefixTable('users'),
@@ -665,10 +665,10 @@  discard block
 block discarded – undo
665 665
         $session->set('user-latest_items_tab', []);
666 666
         $session->set('user-nb_roles', 0);
667 667
         foreach ($session->get('user-latest_items') as $item) {
668
-            if (! empty($item)) {
668
+            if (!empty($item)) {
669 669
                 $dataLastItems = DB::queryFirstRow(
670 670
                     'SELECT id,label,id_tree
671
-                    FROM ' . prefixTable('items') . '
671
+                    FROM ' . prefixTable('items').'
672 672
                     WHERE id=%i',
673 673
                     $item
674 674
                 );
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
                     [
678 678
                         'id' => $item,
679 679
                         'label' => $dataLastItems['label'],
680
-                        'url' => 'index.php?page=items&amp;group=' . $dataLastItems['id_tree'] . '&amp;id=' . $item,
680
+                        'url' => 'index.php?page=items&amp;group='.$dataLastItems['id_tree'].'&amp;id='.$item,
681 681
                     ],
682 682
                     'add'
683 683
                 );
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
         // Get cahce tree info
688 688
         $cacheTreeData = DB::queryFirstRow(
689 689
             'SELECT visible_folders
690
-            FROM ' . prefixTable('cache_tree') . '
690
+            FROM ' . prefixTable('cache_tree').'
691 691
             WHERE user_id=%i',
692 692
             (int) $session->get('user-id')
693 693
         );
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
             && (int) $sessionAdmin !== 1
720 720
         ) {
721 721
             // get all Admin users
722
-            $val = DB::queryfirstrow('SELECT email FROM ' . prefixTable('users') . " WHERE admin = %i and email != ''", 1);
722
+            $val = DB::queryfirstrow('SELECT email FROM '.prefixTable('users')." WHERE admin = %i and email != ''", 1);
723 723
             if (DB::count() > 0) {
724 724
                 // Add email to table
725 725
                 prepareSendingEmail(
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
                             '#tp_time#',
732 732
                         ],
733 733
                         [
734
-                            ' ' . $session->get('user-login') . ' (IP: ' . getClientIpServer() . ')',
734
+                            ' '.$session->get('user-login').' (IP: '.getClientIpServer().')',
735 735
                             date($SETTINGS['date_format'], (int) $session->get('user-last_connection')),
736 736
                             date($SETTINGS['time_format'], (int) $session->get('user-last_connection')),
737 737
                         ],
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
 {
843 843
     $rows = DB::query(
844 844
         'SELECT date
845
-        FROM ' . prefixTable('log_system') . "
845
+        FROM ' . prefixTable('log_system')."
846 846
         WHERE field_1 = %s
847 847
         AND type = 'failed_auth'
848 848
         AND label = 'password_is_not_correct'
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
         foreach ($rows as $record) {
857 857
             array_push(
858 858
                 $arrAttempts,
859
-                date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date'])
859
+                date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date'])
860 860
             );
861 861
         }
862 862
     }
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
     $ldapConnection
892 892
 ) : bool
893 893
 {
894
-    include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
894
+    include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
895 895
 
896 896
     if ((int) $userInfoDisabled === 1) {
897 897
         return false;
@@ -1086,7 +1086,7 @@  discard block
 block discarded – undo
1086 1086
     } catch (Exception $e) {
1087 1087
         return [
1088 1088
             'error' => true,
1089
-            'message' => "Error: " . $e->getMessage(),
1089
+            'message' => "Error: ".$e->getMessage(),
1090 1090
         ];
1091 1091
     }
1092 1092
 }
@@ -1117,7 +1117,7 @@  discard block
 block discarded – undo
1117 1117
                 'type' => 'OpenLDAP'
1118 1118
             ];
1119 1119
         default:
1120
-            throw new Exception("Unsupported LDAP type: " . $SETTINGS['ldap_type']);
1120
+            throw new Exception("Unsupported LDAP type: ".$SETTINGS['ldap_type']);
1121 1121
     }
1122 1122
 }
1123 1123
 
@@ -1254,7 +1254,7 @@  discard block
 block discarded – undo
1254 1254
         );
1255 1255
     }
1256 1256
     
1257
-    throw new Exception("Unsupported LDAP type: " . $ldapHandler['type']);
1257
+    throw new Exception("Unsupported LDAP type: ".$ldapHandler['type']);
1258 1258
 }
1259 1259
 
1260 1260
 /**
@@ -1271,12 +1271,12 @@  discard block
 block discarded – undo
1271 1271
     if (isset($SETTINGS['enable_ad_users_with_ad_groups']) === true && (int) $SETTINGS['enable_ad_users_with_ad_groups'] === 1) {
1272 1272
         // Get user groups from AD
1273 1273
         $user_ad_groups = [];
1274
-        foreach($groups as $group) {
1274
+        foreach ($groups as $group) {
1275 1275
             //print_r($group);
1276 1276
             // get relation role id for AD group
1277 1277
             $role = DB::queryFirstRow(
1278 1278
                 'SELECT lgr.role_id
1279
-                FROM ' . prefixTable('ldap_groups_roles') . ' AS lgr
1279
+                FROM ' . prefixTable('ldap_groups_roles').' AS lgr
1280 1280
                 WHERE lgr.ldap_group_id = %s',
1281 1281
                 $group
1282 1282
             );
@@ -1421,7 +1421,7 @@  discard block
 block discarded – undo
1421 1421
     }
1422 1422
 
1423 1423
     // Now check yubico validity
1424
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/Yubico/Yubico.php';
1424
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/Yubico/Yubico.php';
1425 1425
     $yubi = new Auth_Yubico($yubico_user_id, $yubico_user_key);
1426 1426
     $auth = $yubi->verify($yubico_key);
1427 1427
     //, null, null, null, 60
@@ -1480,7 +1480,7 @@  discard block
 block discarded – undo
1480 1480
             // Check if exists in DB
1481 1481
             $groupData = DB::queryFirstRow(
1482 1482
                 'SELECT id
1483
-                FROM ' . prefixTable('roles_title') . '
1483
+                FROM ' . prefixTable('roles_title').'
1484 1484
                 WHERE title = %s',
1485 1485
                 $group["displayName"]
1486 1486
             );
@@ -1610,7 +1610,7 @@  discard block
 block discarded – undo
1610 1610
             
1611 1611
             // generate new QR
1612 1612
             $new_2fa_qr = $tfa->getQRCodeImageAsDataUri(
1613
-                'Teampass - ' . $username,
1613
+                'Teampass - '.$username,
1614 1614
                 $userInfo['ga']
1615 1615
             );
1616 1616
             // clear temporary code from DB
@@ -1623,7 +1623,7 @@  discard block
 block discarded – undo
1623 1623
                 $userInfo['id']
1624 1624
             );
1625 1625
             $firstTime = [
1626
-                'value' => '<img src="' . $new_2fa_qr . '">',
1626
+                'value' => '<img src="'.$new_2fa_qr.'">',
1627 1627
                 'user_admin' => isset($sessionAdmin) ? (int) $sessionAdmin : '',
1628 1628
                 'initial_url' => isset($sessionUrl) === true ? $sessionUrl : '',
1629 1629
                 'pwd_attempts' => (int) $sessionPwdAttempts,
@@ -1779,7 +1779,7 @@  discard block
 block discarded – undo
1779 1779
         }*/
1780 1780
         return [
1781 1781
             'error' => true,
1782
-            'message' => $duo_error . $lang->get('duo_error_check_config'),
1782
+            'message' => $duo_error.$lang->get('duo_error_check_config'),
1783 1783
             'pwd_attempts' => (int) $sessionPwdAttempts,
1784 1784
             'debug_message' => $e->getMessage(),
1785 1785
             'proceedIdentification' => false,
@@ -1795,7 +1795,7 @@  discard block
 block discarded – undo
1795 1795
         } catch (DuoException $e) {
1796 1796
             return [
1797 1797
                 'error' => true,
1798
-                'message' => $duo_error . $lang->get('duo_error_url'),
1798
+                'message' => $duo_error.$lang->get('duo_error_url'),
1799 1799
                 'pwd_attempts' => (int) $sessionPwdAttempts,
1800 1800
                 'debug_message' => $e->getMessage(),
1801 1801
                 'proceedIdentification' => false,
@@ -1803,7 +1803,7 @@  discard block
 block discarded – undo
1803 1803
         }
1804 1804
         
1805 1805
         // Somethimes Duo return success but fail to return a URL, double check if the URL has been created
1806
-        if (!empty($duo_redirect_url) && isset($duo_redirect_url) && filter_var($duo_redirect_url,FILTER_SANITIZE_URL)) {
1806
+        if (!empty($duo_redirect_url) && isset($duo_redirect_url) && filter_var($duo_redirect_url, FILTER_SANITIZE_URL)) {
1807 1807
             // Since Duo Universal requires a redirect, let's store some info when the user get's back after completing the Duo prompt
1808 1808
             $key = hash('sha256', $duo_state);
1809 1809
             $iv = substr(hash('sha256', $duo_state), 0, 16);
@@ -1831,7 +1831,7 @@  discard block
 block discarded – undo
1831 1831
         } else {
1832 1832
             return [
1833 1833
                 'error' => true,
1834
-                'message' => $duo_error . $lang->get('duo_error_url'),
1834
+                'message' => $duo_error.$lang->get('duo_error_url'),
1835 1835
                 'pwd_attempts' => (int) $sessionPwdAttempts,
1836 1836
                 'proceedIdentification' => false,
1837 1837
             ];
@@ -1852,8 +1852,8 @@  discard block
 block discarded – undo
1852 1852
         // return the response (which should be the user name)
1853 1853
         if ($decoded_token['preferred_username'] === $username) {
1854 1854
             $session->set('user-duo_status', 'COMPLET');
1855
-            $session->set('user-duo_state','');
1856
-            $session->set('user-duo_data','');
1855
+            $session->set('user-duo_state', '');
1856
+            $session->set('user-duo_data', '');
1857 1857
             $session->set('user-login', $username);
1858 1858
 
1859 1859
             return [
@@ -1864,9 +1864,9 @@  discard block
 block discarded – undo
1864 1864
             ];
1865 1865
         } else {
1866 1866
             // Something wrong, username from the original Duo request is different than the one received now
1867
-            $session->set('user-duo_status','');
1868
-            $session->set('user-duo_state','');
1869
-            $session->set('user-duo_data','');
1867
+            $session->set('user-duo_status', '');
1868
+            $session->set('user-duo_state', '');
1869
+            $session->set('user-duo_data', '');
1870 1870
 
1871 1871
             return [
1872 1872
                 'error' => true,
@@ -1877,9 +1877,9 @@  discard block
 block discarded – undo
1877 1877
         }
1878 1878
     }
1879 1879
     // If we are here something wrong
1880
-    $session->set('user-duo_status','');
1881
-    $session->set('user-duo_state','');
1882
-    $session->set('user-duo_data','');
1880
+    $session->set('user-duo_status', '');
1881
+    $session->set('user-duo_state', '');
1882
+    $session->set('user-duo_data', '');
1883 1883
     return [
1884 1884
         'error' => true,
1885 1885
         'message' => $lang->get('duo_login_mismatch'),
@@ -1991,7 +1991,7 @@  discard block
 block discarded – undo
1991 1991
         // Check for existing lock
1992 1992
         $unlock_at = DB::queryFirstField(
1993 1993
             'SELECT MAX(unlock_at)
1994
-             FROM ' . prefixTable('auth_failures') . '
1994
+             FROM ' . prefixTable('auth_failures').'
1995 1995
              WHERE unlock_at > %s
1996 1996
              AND ((source = %s AND value = %s) OR (source = %s AND value = %s))',
1997 1997
             date('Y-m-d H:i:s', time()),
@@ -2013,8 +2013,8 @@  discard block
 block discarded – undo
2013 2013
         // Get user info from DB
2014 2014
         $data = DB::queryFirstRow(
2015 2015
             'SELECT u.*, a.value AS api_key
2016
-            FROM ' . prefixTable('users') . ' AS u
2017
-            LEFT JOIN ' . prefixTable('api') . ' AS a ON (u.id = a.user_id)
2016
+            FROM ' . prefixTable('users').' AS u
2017
+            LEFT JOIN ' . prefixTable('api').' AS a ON (u.id = a.user_id)
2018 2018
             WHERE login = %s AND deleted_at IS NULL',
2019 2019
             $login
2020 2020
         );
@@ -2134,7 +2134,7 @@  discard block
 block discarded – undo
2134 2134
             'array' => [
2135 2135
                 'value' => 'bruteforce_wait',
2136 2136
                 'error' => true,
2137
-                'message' => $lang->get('bruteforce_wait') . (string) $e->getMessage(),
2137
+                'message' => $lang->get('bruteforce_wait').(string) $e->getMessage(),
2138 2138
             ]
2139 2139
         ];
2140 2140
     }
@@ -2566,15 +2566,15 @@  discard block
 block discarded – undo
2566 2566
 
2567 2567
             if ($ret['error'] !== false) {
2568 2568
                 logEvents($SETTINGS, 'failed_auth', 'bad_duo_mfa', '', stripslashes($username), stripslashes($username));
2569
-                $session->set('user-duo_status','');
2570
-                $session->set('user-duo_state','');
2571
-                $session->set('user-duo_data','');
2569
+                $session->set('user-duo_status', '');
2570
+                $session->set('user-duo_state', '');
2571
+                $session->set('user-duo_data', '');
2572 2572
                 return [
2573 2573
                     'error' => true,
2574 2574
                     'mfaData' => $ret,
2575 2575
                     'mfaQRCodeInfos' => false,
2576 2576
                 ];
2577
-            } else if ($ret['duo_url_ready'] === true){
2577
+            } else if ($ret['duo_url_ready'] === true) {
2578 2578
                 return [
2579 2579
                     'error' => false,
2580 2580
                     'mfaData' => $ret,
@@ -2638,7 +2638,7 @@  discard block
 block discarded – undo
2638 2638
     // Count failed attempts from this source
2639 2639
     $count = DB::queryFirstField(
2640 2640
         'SELECT COUNT(*)
2641
-        FROM ' . prefixTable('auth_failures') . '
2641
+        FROM ' . prefixTable('auth_failures').'
2642 2642
         WHERE source = %s AND value = %s',
2643 2643
         $source,
2644 2644
         $value
Please login to merge, or discard this patch.
sources/users.datatable.php 1 patch
Spacing   +15 added lines, -17 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 ) {
78 78
     // Not allowed page
79 79
     $session->set('system-error_code', ERR_NOT_ALLOWED);
80
-    include $SETTINGS['cpassman_dir'] . '/error.php';
80
+    include $SETTINGS['cpassman_dir'].'/error.php';
81 81
     exit;
82 82
 }
83 83
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
     if (isset($order['column']) && preg_match('#^(asc|desc)$#i', $order['dir'])) {
129 129
         $columnIndex = filter_var($order['column'], FILTER_SANITIZE_NUMBER_INT);
130 130
         $dir = filter_var($order['dir'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
131
-        $sOrder .= $aColumns[$columnIndex] . ' ' . $dir . ', ';
131
+        $sOrder .= $aColumns[$columnIndex].' '.$dir.', ';
132 132
     }
133 133
 
134 134
     $sOrder = substr_replace($sOrder, '', -2);
@@ -152,15 +152,15 @@  discard block
 block discarded – undo
152 152
 
153 153
 if ($letter !== '' && $letter !== 'None') {
154 154
     $sWhere .= ' AND (';
155
-    $sWhere .= $aColumns[1] . " LIKE '" . $letter . "%' OR ";
156
-    $sWhere .= $aColumns[2] . " LIKE '" . $letter . "%' OR ";
157
-    $sWhere .= $aColumns[3] . " LIKE '" . $letter . "%' ";
155
+    $sWhere .= $aColumns[1]." LIKE '".$letter."%' OR ";
156
+    $sWhere .= $aColumns[2]." LIKE '".$letter."%' OR ";
157
+    $sWhere .= $aColumns[3]." LIKE '".$letter."%' ";
158 158
     $sWhere .= ')';
159 159
 } elseif ($searchValue !== '') {
160 160
     $sWhere .= ' AND (';
161
-    $sWhere .= $aColumns[1] . " LIKE '" . $searchValue . "%' OR ";
162
-    $sWhere .= $aColumns[2] . " LIKE '" . $searchValue . "%' OR ";
163
-    $sWhere .= $aColumns[3] . " LIKE '" . $searchValue . "%' ";
161
+    $sWhere .= $aColumns[1]." LIKE '".$searchValue."%' OR ";
162
+    $sWhere .= $aColumns[2]." LIKE '".$searchValue."%' OR ";
163
+    $sWhere .= $aColumns[3]." LIKE '".$searchValue."%' ";
164 164
     $sWhere .= ')';
165 165
 }
166 166
 
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
         // Check for existing lock
248 248
         $unlock_at = DB::queryFirstField(
249 249
             'SELECT MAX(unlock_at)
250
-             FROM ' . prefixTable('auth_failures') . '
250
+             FROM ' . prefixTable('auth_failures').'
251 251
              WHERE unlock_at > %s AND source = %s AND value = %s',
252 252
             date('Y-m-d H:i:s', time()),
253 253
             'login',
@@ -256,33 +256,31 @@  discard block
 block discarded – undo
256 256
 
257 257
         // Get some infos about user
258 258
         $userDisplayInfos = 
259
-            (isset($userDate['date']) ? '<i class=\"fas fa-calendar-day infotip text-info ml-2\" title=\"'.$lang->get('creation_date').': '.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $userDate['date']).'\"></i>' : '')
259
+            (isset($userDate['date']) ? '<i class=\"fas fa-calendar-day infotip text-info ml-2\" title=\"'.$lang->get('creation_date').': '.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $userDate['date']).'\"></i>' : '')
260 260
             .
261 261
             ((int) $record['last_connexion'] > 0 ? '<i class=\"far fa-clock infotip text-info ml-2\" title=\"'.$lang->get('index_last_seen').": ".
262
-            date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['last_connexion']).'\"></i>' : '')
262
+            date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['last_connexion']).'\"></i>' : '')
263 263
             .
264 264
             ((int) $record['user_ip'] > 0 ? '<i class=\"fas fa-street-view infotip text-info ml-1\" title=\"'.$lang->get('ip').": ".($record['user_ip']).'\"></i>' : '')
265 265
             .
266 266
             ($record['auth_type'] === 'ldap' ? '<i class=\"far fa-address-book infotip text-warning ml-1\" title=\"'.$lang->get('managed_through_ad').'\"></i>' : '')
267 267
             .
268 268
             ((in_array($record['id'], [OTV_USER_ID, TP_USER_ID, SSH_USER_ID, API_USER_ID]) === false && (int) $record['admin'] !== 1 && ((int) $SETTINGS['duo'] === 1 || (int) $SETTINGS['google_authentication'] === 1)) ?
269
-                ((int) $record['mfa_enabled'] === 1 ? '' : '<i class=\"fa-solid fa-fingerprint infotip ml-1\" style=\"color:Tomato\" title=\"'.$lang->get('mfa_disabled_for_user').'\"></i>') :
270
-                ''
269
+                ((int) $record['mfa_enabled'] === 1 ? '' : '<i class=\"fa-solid fa-fingerprint infotip ml-1\" style=\"color:Tomato\" title=\"'.$lang->get('mfa_disabled_for_user').'\"></i>') : ''
271 270
                 )
272 271
             .
273 272
             (($unlock_at) ? '<i class=\"fas fa-solid text-red fa-lock infotip text-info ml-1\" title=\"'.$lang->get('bruteforce_unlock_at').$unlock_at.'\"></i>' : '');
274 273
         if ($request->query->filter('display_warnings', '', FILTER_VALIDATE_BOOLEAN) === true) {
275 274
             $userDisplayInfos .= '<br>'.
276 275
                 ((in_array($record['id'], [OTV_USER_ID, TP_USER_ID, SSH_USER_ID, API_USER_ID]) === false && (int) $record['admin'] !== 1 && is_null($record['keys_recovery_time']) === true) ? 
277
-                    '<i class=\"fa-solid fa-download infotip ml-1\" style=\"color:Tomato\" title=\"'.$lang->get('recovery_keys_not_downloaded').'\"></i>' :
278
-                    ''
276
+                    '<i class=\"fa-solid fa-download infotip ml-1\" style=\"color:Tomato\" title=\"'.$lang->get('recovery_keys_not_downloaded').'\"></i>' : ''
279 277
                 ).
280 278
                 ((in_array($record['id'], [OTV_USER_ID, TP_USER_ID, SSH_USER_ID, API_USER_ID]) === false && (int) $record['pw_passwordlib'] === 1) ? '<i class=\"fa-solid fa-person-walking-luggage infotip ml-1\" style=\"color:Tomato\" title=\"Old password encryption. Shall login to initialize.\"></i>' : '');
281 279
         }
282 280
 
283 281
         $sOutput .= '["<span data-id=\"'.$record['id'].'\" data-fullname=\"'.
284
-            (empty($record['name']) === false ? htmlentities($record['name'], ENT_QUOTES|ENT_SUBSTITUTE|ENT_DISALLOWED) : '').' '.
285
-            (empty($record['lastname']) === false ? htmlentities($record['lastname'], ENT_QUOTES|ENT_SUBSTITUTE|ENT_DISALLOWED) : '').
282
+            (empty($record['name']) === false ? htmlentities($record['name'], ENT_QUOTES | ENT_SUBSTITUTE | ENT_DISALLOWED) : '').' '.
283
+            (empty($record['lastname']) === false ? htmlentities($record['lastname'], ENT_QUOTES | ENT_SUBSTITUTE | ENT_DISALLOWED) : '').
286 284
             '\" data-auth-type=\"'.$record['auth_type'].'\" data-special=\"'.$record['special'].'\" data-mfa-enabled=\"'.$record['mfa_enabled'].'\" data-otp-provided=\"'.(isset($record['otp_provided']) === true ? $record['otp_provided'] : '').'\"></span>", ';
287 285
         //col2
288 286
         $sOutput .= '"'.
Please login to merge, or discard this patch.
scripts/background_tasks___items_handler.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 DB::debugmode(false);
76 76
 $process_to_perform = DB::queryfirstrow(
77 77
     'SELECT *
78
-    FROM ' . prefixTable('background_tasks') . '
78
+    FROM ' . prefixTable('background_tasks').'
79 79
     WHERE is_in_progress = %i AND process_type IN ("item_copy", "new_item", "update_item", "item_update_create_keys")
80 80
     ORDER BY increment_id ASC',
81 81
     1
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
     // search for next process to handle
94 94
     $process_to_perform = DB::queryfirstrow(
95 95
         'SELECT *
96
-        FROM ' . prefixTable('background_tasks') . '
96
+        FROM ' . prefixTable('background_tasks').'
97 97
         WHERE is_in_progress = %i AND (finished_at = "" OR finished_at IS NULL) AND process_type IN ("item_copy", "new_item", "update_item", "item_update_create_keys")
98 98
         ORDER BY increment_id ASC',
99 99
         0
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
             $process_to_perform['increment_id']
112 112
         );
113 113
 
114
-        provideLog('[PROCESS][#'. $process_to_perform['increment_id'].'][START]', $SETTINGS);
114
+        provideLog('[PROCESS][#'.$process_to_perform['increment_id'].'][START]', $SETTINGS);
115 115
         handleTask(
116 116
             $process_to_perform['increment_id'],
117 117
             json_decode($process_to_perform['arguments'], true),
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
         // Search if there are remaining tasks
142 142
         $process_to_perform = DB::queryFirstField(
143 143
             'SELECT 1
144
-            FROM ' . prefixTable('background_tasks') . '
144
+            FROM ' . prefixTable('background_tasks').'
145 145
             WHERE is_in_progress = %i AND process_type IN (
146 146
                 "item_copy",
147 147
                 "new_item",
@@ -180,10 +180,10 @@  discard block
 block discarded – undo
180 180
  */
181 181
 function handleTask(int $processId, array $ProcessArguments, array $SETTINGS, int $itemId = null): bool
182 182
 {
183
-    provideLog('[PROCESS][#'. $processId.'][START]', $SETTINGS);
183
+    provideLog('[PROCESS][#'.$processId.'][START]', $SETTINGS);
184 184
     $task_to_perform = DB::queryfirstrow(
185 185
         'SELECT *
186
-        FROM ' . prefixTable('background_subtasks') . '
186
+        FROM ' . prefixTable('background_subtasks').'
187 187
         WHERE task_id = %i AND finished_at IS NULL
188 188
         ORDER BY increment_id ASC',
189 189
         $processId
@@ -197,13 +197,13 @@  discard block
 block discarded – undo
197 197
         // if sub_task_in_progress === 1 then exit
198 198
         if ((int) $task_to_perform['sub_task_in_progress'] !== 0) {
199 199
             // Task is currently being in progress by another server process
200
-            provideLog('[TASK][#'. $task_to_perform['increment_id'].'][WARNING] Similar task already being processes', $SETTINGS);
200
+            provideLog('[TASK][#'.$task_to_perform['increment_id'].'][WARNING] Similar task already being processes', $SETTINGS);
201 201
             return false;
202 202
         }
203 203
 
204 204
         // handle next task
205 205
         $args = json_decode($task_to_perform['task'], true);
206
-        provideLog('[TASK][#'. $task_to_perform['increment_id'].'][START]Task '.$args['step'], $SETTINGS);
206
+        provideLog('[TASK][#'.$task_to_perform['increment_id'].'][START]Task '.$args['step'], $SETTINGS);
207 207
 
208 208
         // flag as in progress
209 209
         DB::update(
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
         DB::update(
246 246
             prefixTable('background_subtasks'),
247 247
             array(
248
-                'sub_task_in_progress' => 0,    // flag sub task is no more in prgoress
248
+                'sub_task_in_progress' => 0, // flag sub task is no more in prgoress
249 249
                 'task' => json_encode(["status" => "Done"]),
250 250
                 'is_in_progress' => -1,
251 251
                 'finished_at' => time(),
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
         // are all tasks done?
261 261
         DB::query(
262 262
             'SELECT *
263
-            FROM ' . prefixTable('background_subtasks') . '
263
+            FROM ' . prefixTable('background_subtasks').'
264 264
             WHERE task_id = %i AND finished_at IS NULL',
265 265
             $processId
266 266
         );
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
         // Loop on all files for this item
333 333
         // and encrypt them for each user
334 334
         if (WIP === true) provideLog('[DEBUG] '.print_r($args['files_keys'], true), $SETTINGS);
335
-        foreach($args['files_keys'] as $file) {
335
+        foreach ($args['files_keys'] as $file) {
336 336
             storeUsersShareKey(
337 337
                 prefixTable('sharekeys_items'),
338 338
                 0,
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
         // Loop on all encrypted fields for this item
349 349
         // and encrypt them for each user
350 350
         if (WIP === true) provideLog('[DEBUG] '.print_r($args, true), $SETTINGS);
351
-        foreach($args['fields_keys'] as $field) {
351
+        foreach ($args['fields_keys'] as $field) {
352 352
             storeUsersShareKey(
353 353
                 prefixTable('sharekeys_fields'),
354 354
                 0,
@@ -400,6 +400,6 @@  discard block
 block discarded – undo
400 400
     DB::query(
401 401
         'DELETE FROM '.prefixTable('items_edition').'
402 402
         WHERE timestamp < %i',
403
-        ($SETTINGS['delay_item_edition'] > 0) ? time() - ($SETTINGS['delay_item_edition']*60) : time() - EDITION_LOCK_PERIOD
403
+        ($SETTINGS['delay_item_edition'] > 0) ? time() - ($SETTINGS['delay_item_edition'] * 60) : time() - EDITION_LOCK_PERIOD
404 404
     );
405 405
 }
Please login to merge, or discard this patch.
Braces   +15 added lines, -6 removed lines patch added patch discarded remove patch
@@ -83,7 +83,9 @@  discard block
 block discarded – undo
83 83
 
84 84
 if (DB::count() > 0) {
85 85
     // handle tasks inside this process
86
-    if (WIP === true) error_log("Process in progress: ".$process_to_perform['increment_id']);
86
+    if (WIP === true) {
87
+        error_log("Process in progress: ".$process_to_perform['increment_id']);
88
+    }
87 89
     handleTask(
88 90
         $process_to_perform['increment_id'],
89 91
         json_decode($process_to_perform['arguments'], true),
@@ -100,7 +102,9 @@  discard block
 block discarded – undo
100 102
     );
101 103
     
102 104
     if (DB::count() > 0) {
103
-        if (WIP === true) error_log("New process ta start: ".$process_to_perform['increment_id']);
105
+        if (WIP === true) {
106
+            error_log("New process ta start: ".$process_to_perform['increment_id']);
107
+        }
104 108
         // update DB - started_at
105 109
         DB::update(
106 110
             prefixTable('background_tasks'),
@@ -153,8 +157,9 @@  discard block
 block discarded – undo
153 157
         );
154 158
 
155 159
         // No more tasks, exit
156
-        if ($process_to_perform !== 1)
157
-            break;
160
+        if ($process_to_perform !== 1) {
161
+                    break;
162
+        }
158 163
 
159 164
         // Run next task
160 165
         $process = new Symfony\Component\Process\Process([
@@ -331,7 +336,9 @@  discard block
 block discarded – undo
331 336
     if ($args['step'] === 'create_users_files_key') {
332 337
         // Loop on all files for this item
333 338
         // and encrypt them for each user
334
-        if (WIP === true) provideLog('[DEBUG] '.print_r($args['files_keys'], true), $SETTINGS);
339
+        if (WIP === true) {
340
+            provideLog('[DEBUG] '.print_r($args['files_keys'], true), $SETTINGS);
341
+        }
335 342
         foreach($args['files_keys'] as $file) {
336 343
             storeUsersShareKey(
337 344
                 prefixTable('sharekeys_items'),
@@ -347,7 +354,9 @@  discard block
 block discarded – undo
347 354
     } elseif ($args['step'] === 'create_users_fields_key') {
348 355
         // Loop on all encrypted fields for this item
349 356
         // and encrypt them for each user
350
-        if (WIP === true) provideLog('[DEBUG] '.print_r($args, true), $SETTINGS);
357
+        if (WIP === true) {
358
+            provideLog('[DEBUG] '.print_r($args, true), $SETTINGS);
359
+        }
351 360
         foreach($args['fields_keys'] as $field) {
352 361
             storeUsersShareKey(
353 362
                 prefixTable('sharekeys_fields'),
Please login to merge, or discard this patch.
sources/logs.datatables.php 1 patch
Spacing   +23 added lines, -24 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 ) {
77 77
     // Not allowed page
78 78
     $session->set('system-error_code', ERR_NOT_ALLOWED);
79
-    include $SETTINGS['cpassman_dir'] . '/error.php';
79
+    include $SETTINGS['cpassman_dir'].'/error.php';
80 80
     exit;
81 81
 }
82 82
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
     
169 169
     // Output
170 170
     $sOutput = '{';
171
-    $sOutput .= '"sEcho": '. $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
171
+    $sOutput .= '"sEcho": '.$request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
172 172
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
173 173
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
174 174
     $sOutput .= '"aaData": ';
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 
242 242
     // Output
243 243
     $sOutput = '{';
244
-    $sOutput .= '"sEcho": '. $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
244
+    $sOutput .= '"sEcho": '.$request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
245 245
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
246 246
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
247 247
     $sOutput .= '"aaData": ';
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 
315 315
     // Output
316 316
     $sOutput = '{';
317
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
317
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
318 318
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
319 319
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
320 320
     $sOutput .= '"aaData": ';
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 
388 388
     // Output
389 389
     $sOutput = '{';
390
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
390
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
391 391
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
392 392
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
393 393
     $sOutput .= '"aaData": [ ';
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
 
491 491
     // Output
492 492
     $sOutput = '{';
493
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
493
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
494 494
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
495 495
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
496 496
     $sOutput .= '"aaData": [ ';
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
         $iTotal = 0;
573 573
     }
574 574
     $sOutput = '{';
575
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
575
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
576 576
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
577 577
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
578 578
     $sOutput .= '"aaData": ';
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
 
649 649
     // Output
650 650
     $sOutput = '{';
651
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
651
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
652 652
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
653 653
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
654 654
     $sOutput .= '"aaData": ';
@@ -717,7 +717,7 @@  discard block
 block discarded – undo
717 717
 
718 718
     // Output
719 719
     $sOutput = '{';
720
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
720
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
721 721
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
722 722
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
723 723
     $sOutput .= '"aaData": ';
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 
792 792
     // Output
793 793
     $sOutput = '{';
794
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
794
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
795 795
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
796 796
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
797 797
     $sOutput .= '"aaData": ';
@@ -868,7 +868,7 @@  discard block
 block discarded – undo
868 868
             FROM '.prefixTable('background_tasks').' AS p 
869 869
             LEFT JOIN '.prefixTable('users').' AS u ON %l
870 870
             WHERE %l ORDER BY %l %l LIMIT %i, %i';
871
-    $params = ['u.id = json_extract(p.arguments, "$[0]")',$sWhere, $orderColumn, $orderDirection, $sLimitStart, $sLimitLength];
871
+    $params = ['u.id = json_extract(p.arguments, "$[0]")', $sWhere, $orderColumn, $orderDirection, $sLimitStart, $sLimitLength];
872 872
 
873 873
     // Get the records
874 874
     $rows = DB::query($sql, ...$params);
@@ -876,7 +876,7 @@  discard block
 block discarded – undo
876 876
 
877 877
     // Output
878 878
     $sOutput = '{';
879
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
879
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
880 880
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
881 881
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
882 882
     $sOutput .= '"aaData": ';
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
         //col1
892 892
         $sOutput .= '"<span data-done=\"'.$record['is_in_progress'].'\" data-type=\"'.$record['process_type'].'\" data-process-id=\"'.$record['increment_id'].'\"></span>", ';
893 893
         //col2
894
-        $sOutput .= '"'.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['created_at']).'", ';
894
+        $sOutput .= '"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['created_at']).'", ';
895 895
         //col3
896 896
         //$sOutput .= '"'.($record['updated_at'] === '' ? '-' : date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['updated_at'])).'", ';
897 897
         $sOutput .= '"<div class=\"progress mt-2\"><div class=\"progress-bar\" style=\"width: '.$subtaskProgress.'\">'.$subtaskProgress.'</div></div>", ';
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
         // col5
902 902
         if (in_array($record['process_type'], array('create_user_keys', 'item_copy')) === true) {
903 903
             $data_user = DB::queryfirstrow(
904
-                'SELECT name, lastname FROM ' . prefixTable('users') . '
904
+                'SELECT name, lastname FROM '.prefixTable('users').'
905 905
                 WHERE id = %i',
906 906
                 json_decode($record['arguments'], true)['new_user_id']
907 907
             );
@@ -957,7 +957,7 @@  discard block
 block discarded – undo
957 957
     FROM '.prefixTable('background_tasks').' AS p 
958 958
     LEFT JOIN '.prefixTable('users').' AS u ON %l
959 959
     WHERE %l ORDER BY %l %l LIMIT %i, %i';
960
-    $params = ['u.id = json_extract(p.arguments, "$[0]")',$sWhere, $orderColumn, $orderDirection, $sLimitStart, $sLimitLength];
960
+    $params = ['u.id = json_extract(p.arguments, "$[0]")', $sWhere, $orderColumn, $orderDirection, $sLimitStart, $sLimitLength];
961 961
 
962 962
     // Get the records
963 963
     $rows = DB::query($sql, ...$params);
@@ -965,7 +965,7 @@  discard block
 block discarded – undo
965 965
 
966 966
     // Output
967 967
     $sOutput = '{';
968
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
968
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
969 969
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
970 970
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
971 971
     $sOutput .= '"aaData": ';
@@ -981,13 +981,12 @@  discard block
 block discarded – undo
981 981
         //col1
982 982
         $sOutput .= '"", ';
983 983
         //col2
984
-        $sOutput .= '"'.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['created_at']).'", ';
984
+        $sOutput .= '"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['created_at']).'", ';
985 985
         //col3
986 986
         $sOutput .= is_null($record['started_at']) === false ?
987
-            ('"'.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['started_at']).'", ') :
988
-                ('"'.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['created_at']).'", ');
987
+            ('"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['started_at']).'", ') : ('"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['created_at']).'", ');
989 988
         //col4
990
-        $sOutput .= '"'.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['finished_at']).'", ';
989
+        $sOutput .= '"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['finished_at']).'", ';
991 990
         // col7
992 991
         $sOutput .= '"'.gmdate('H:i:s', (int) $record['finished_at'] - (is_null($record['started_at']) === false ? (int) $record['started_at'] : (int) $record['created_at'])).'",';
993 992
         //col5
@@ -1006,7 +1005,7 @@  discard block
 block discarded – undo
1006 1005
         $newUserId = array_key_exists('new_user_id', $arguments) ? $arguments['new_user_id'] : null;
1007 1006
         if ($record['process_type'] === 'create_user_keys' && is_null($newUserId) === false && empty($newUserId) === false) {
1008 1007
             $data_user = DB::queryfirstrow(
1009
-                'SELECT name, lastname, login FROM ' . prefixTable('users') . '
1008
+                'SELECT name, lastname, login FROM '.prefixTable('users').'
1010 1009
                 WHERE id = %i',
1011 1010
                 $newUserId
1012 1011
             );
@@ -1022,7 +1021,7 @@  discard block
 block discarded – undo
1022 1021
         } elseif ($record['process_type'] === 'user_build_cache_tree') {
1023 1022
             $user = json_decode($record['arguments'], true)['user_id'];
1024 1023
             $data_user = DB::queryfirstrow(
1025
-                'SELECT name, lastname, login FROM ' . prefixTable('users') . '
1024
+                'SELECT name, lastname, login FROM '.prefixTable('users').'
1026 1025
                 WHERE id = %i',
1027 1026
                 $user
1028 1027
             );
@@ -1056,7 +1055,7 @@  discard block
 block discarded – undo
1056 1055
 {
1057 1056
     $subtasks = DB::query(
1058 1057
         'SELECT *
1059
-        FROM ' . prefixTable('background_subtasks') . '
1058
+        FROM ' . prefixTable('background_subtasks').'
1060 1059
         WHERE task_id = %i',
1061 1060
         $id
1062 1061
     );
@@ -1072,5 +1071,5 @@  discard block
 block discarded – undo
1072 1071
         $i++;
1073 1072
     }
1074 1073
 
1075
-    return ($finished_nb !== 0 ? pourcentage($finished_nb, $nb, 100) : 0) .'%';
1074
+    return ($finished_nb !== 0 ? pourcentage($finished_nb, $nb, 100) : 0).'%';
1076 1075
 }
1077 1076
\ No newline at end of file
Please login to merge, or discard this patch.
sources/upload.files.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 ) {
77 77
     // Not allowed page
78 78
     $session->set('system-error_code', ERR_NOT_ALLOWED);
79
-    include $SETTINGS['cpassman_dir'] . '/error.php';
79
+    include $SETTINGS['cpassman_dir'].'/error.php';
80 80
     exit;
81 81
 }
82 82
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
     } else {
131 131
         // check if token is expired
132 132
         $data = DB::queryFirstRow(
133
-            'SELECT end_timestamp FROM ' . prefixTable('tokens') . ' WHERE user_id = %i AND token = %s',
133
+            'SELECT end_timestamp FROM '.prefixTable('tokens').' WHERE user_id = %i AND token = %s',
134 134
             $session->get('user-id'),
135 135
             $post_user_token
136 136
         );
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 
155 155
 // HTTP headers for no cache etc
156 156
 header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
157
-header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
157
+header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
158 158
 header('Cache-Control: no-store, no-cache, must-revalidate');
159 159
 header('Cache-Control: post-check=0, pre-check=0', false);
160 160
 
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
     }
167 167
 
168 168
     // Set directory used to store file
169
-    $targetDir = realpath($SETTINGS['cpassman_dir'] . '/includes/avatars');
169
+    $targetDir = realpath($SETTINGS['cpassman_dir'].'/includes/avatars');
170 170
 } else {
171 171
     $targetDir = realpath($SETTINGS['path_to_files_folder']);
172 172
 }
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
     $file_name = preg_replace('/[^a-zA-Z0-9-_\.]/', '', strtolower(basename($file->getClientOriginalName())));
220 220
     
221 221
     if (strlen($file_name) == 0 || strlen($file_name) > $MAX_FILENAME_LENGTH) {
222
-        error_log('Invalid file name: ' . $file_name . '.');
222
+        error_log('Invalid file name: '.$file_name.'.');
223 223
         echo handleUploadError('Invalid file name provided.');
224 224
         return false;
225 225
     }
@@ -233,13 +233,13 @@  discard block
 block discarded – undo
233 233
             $ext = strtolower($ext);
234 234
         } else {
235 235
             // Case where the file extension is not a string
236
-            error_log('Invalid file name: ' . $file_name . '.');
236
+            error_log('Invalid file name: '.$file_name.'.');
237 237
             echo handleUploadError('Invalid file extension.');
238 238
             return false;
239 239
         }
240 240
     } else {
241 241
         // Case where the file name is not a string
242
-        error_log('Invalid file name: ' . $file_name . '.');
242
+        error_log('Invalid file name: '.$file_name.'.');
243 243
         echo handleUploadError('Invalid file.');
244 244
         return false;
245 245
     }
@@ -247,8 +247,8 @@  discard block
 block discarded – undo
247 247
     // Validate against a list of allowed extensions
248 248
     $allowed_extensions = explode(
249 249
         ',',
250
-        $SETTINGS['upload_docext'] . ',' . $SETTINGS['upload_imagesext'] .
251
-            ',' . $SETTINGS['upload_pkgext'] . ',' . $SETTINGS['upload_otherext']
250
+        $SETTINGS['upload_docext'].','.$SETTINGS['upload_imagesext'].
251
+            ','.$SETTINGS['upload_pkgext'].','.$SETTINGS['upload_otherext']
252 252
     );
253 253
     if (
254 254
         !in_array($ext, $allowed_extensions) 
@@ -267,25 +267,25 @@  discard block
 block discarded – undo
267 267
 
268 268
 // is destination folder writable
269 269
 if (is_writable($SETTINGS['path_to_files_folder']) === false) {
270
-    echo handleUploadError('Not enough permissions on folder ' . $SETTINGS['path_to_files_folder'] . '.');
270
+    echo handleUploadError('Not enough permissions on folder '.$SETTINGS['path_to_files_folder'].'.');
271 271
     return false;
272 272
 }
273 273
 
274 274
 // Make sure the fileName is unique but only if chunking is disabled
275
-if ($chunks < 2 && file_exists($targetDir . DIRECTORY_SEPARATOR . $fileName)) {
275
+if ($chunks < 2 && file_exists($targetDir.DIRECTORY_SEPARATOR.$fileName)) {
276 276
     // $ext is guaranteed to be a string due to prior checks
277 277
     $fileNameA = substr($fileName, 0, strlen(/** @scrutinizer ignore-type */$ext));
278 278
     $fileNameB = substr($fileName, strlen(/** @scrutinizer ignore-type */$ext));
279 279
 
280 280
     $count = 1;
281
-    while (file_exists($targetDir . DIRECTORY_SEPARATOR . $fileNameA . '_' . $count . $fileNameB)) {
281
+    while (file_exists($targetDir.DIRECTORY_SEPARATOR.$fileNameA.'_'.$count.$fileNameB)) {
282 282
         ++$count;
283 283
     }
284 284
 
285
-    $fileName = $fileNameA . '_' . $count . $fileNameB;
285
+    $fileName = $fileNameA.'_'.$count.$fileNameB;
286 286
 }
287 287
 
288
-$filePath = $targetDir . DIRECTORY_SEPARATOR . $fileName;
288
+$filePath = $targetDir.DIRECTORY_SEPARATOR.$fileName;
289 289
 
290 290
 // Create target dir
291 291
 if (!file_exists($targetDir)) {
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 // Remove old temp files
300 300
 if ($cleanupTargetDir && is_dir($targetDir) && ($dir = opendir($targetDir))) {
301 301
     while (($fileClean = readdir($dir)) !== false) {
302
-        $tmpfilePath = $targetDir . DIRECTORY_SEPARATOR . $fileClean;
302
+        $tmpfilePath = $targetDir.DIRECTORY_SEPARATOR.$fileClean;
303 303
 
304 304
         // Remove temp file if it is older than the max age and is not the current file
305 305
         if (
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 
314 314
     closedir($dir);
315 315
 } else {
316
-    echo handleUploadError('Not enough permissions on folder ' . $SETTINGS['path_to_files_folder'] . '.');
316
+    echo handleUploadError('Not enough permissions on folder '.$SETTINGS['path_to_files_folder'].'.');
317 317
     return false;
318 318
 }
319 319
 
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 
354 354
                 // Safe destination folder
355 355
                 $uploadDir = realpath($SETTINGS['path_to_upload_folder']);
356
-                $destinationPath = $uploadDir . DIRECTORY_SEPARATOR . $fileName;
356
+                $destinationPath = $uploadDir.DIRECTORY_SEPARATOR.$fileName;
357 357
                 
358 358
                 if (move_uploaded_file($tmpFilePath, $destinationPath)) {
359 359
                     // Open the moved file in read mode
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
             return false;
395 395
         }
396 396
     } else {
397
-        echo handleUploadError('Failed to move uploaded file to ' . $SETTINGS['path_to_files_folder'] . '.');
397
+        echo handleUploadError('Failed to move uploaded file to '.$SETTINGS['path_to_files_folder'].'.');
398 398
         return false;
399 399
     }
400 400
 } else {
@@ -410,14 +410,14 @@  discard block
 block discarded – undo
410 410
                 fwrite($out, $buff);
411 411
             }
412 412
         } else {
413
-            echo handleUploadError('Failed to open input stream ' . $SETTINGS['path_to_files_folder'] . '.');
413
+            echo handleUploadError('Failed to open input stream '.$SETTINGS['path_to_files_folder'].'.');
414 414
             return false;
415 415
         }
416 416
 
417 417
         fclose($in);
418 418
         fclose($out);
419 419
     } else {
420
-        echo handleUploadError('Failed to open output stream ' . $SETTINGS['path_to_files_folder'] . '.');
420
+        echo handleUploadError('Failed to open output stream '.$SETTINGS['path_to_files_folder'].'.');
421 421
         return false;
422 422
     }
423 423
 }
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 ) {
451 451
     rename(
452 452
         $filePath,
453
-        $targetDir . DIRECTORY_SEPARATOR . $newFileName
453
+        $targetDir.DIRECTORY_SEPARATOR.$newFileName
454 454
     );
455 455
 
456 456
     // Add in DB
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
 ) {
480 480
     rename(
481 481
         $filePath,
482
-        $targetDir . DIRECTORY_SEPARATOR . $newFileName
482
+        $targetDir.DIRECTORY_SEPARATOR.$newFileName
483 483
     );
484 484
 
485 485
     // Add in DB
@@ -512,13 +512,13 @@  discard block
 block discarded – undo
512 512
     // rename the file
513 513
     rename(
514 514
         $filePath,
515
-        $targetDir . DIRECTORY_SEPARATOR . $newFileName . '.' . $ext
515
+        $targetDir.DIRECTORY_SEPARATOR.$newFileName.'.'.$ext
516 516
     );
517 517
 
518 518
     // make thumbnail
519 519
     $ret = makeThumbnail(
520
-        $targetDir . DIRECTORY_SEPARATOR . $newFileName . '.' . $ext,
521
-        $targetDir . DIRECTORY_SEPARATOR . $newFileName . '_thumb' . '.' . $ext,
520
+        $targetDir.DIRECTORY_SEPARATOR.$newFileName.'.'.$ext,
521
+        $targetDir.DIRECTORY_SEPARATOR.$newFileName.'_thumb'.'.'.$ext,
522 522
         40
523 523
     );
524 524
 
@@ -530,21 +530,21 @@  discard block
 block discarded – undo
530 530
     }
531 531
 
532 532
     // get current avatar and delete it
533
-    $data = DB::queryFirstRow('SELECT avatar, avatar_thumb FROM ' . prefixTable('users') . ' WHERE id=%i', $session->get('user-id'));
534
-    fileDelete($targetDir . DIRECTORY_SEPARATOR . $data['avatar'], $SETTINGS);
535
-    fileDelete($targetDir . DIRECTORY_SEPARATOR . $data['avatar_thumb'], $SETTINGS);
533
+    $data = DB::queryFirstRow('SELECT avatar, avatar_thumb FROM '.prefixTable('users').' WHERE id=%i', $session->get('user-id'));
534
+    fileDelete($targetDir.DIRECTORY_SEPARATOR.$data['avatar'], $SETTINGS);
535
+    fileDelete($targetDir.DIRECTORY_SEPARATOR.$data['avatar_thumb'], $SETTINGS);
536 536
 
537 537
     // store in DB the new avatar
538 538
     DB::query(
539
-        'UPDATE ' . prefixTable('users') . "
540
-        SET avatar='" . $newFileName . '.' . $ext . "', avatar_thumb='" . $newFileName . '_thumb' . '.' . $ext . "'
539
+        'UPDATE '.prefixTable('users')."
540
+        SET avatar='" . $newFileName.'.'.$ext."', avatar_thumb='".$newFileName.'_thumb'.'.'.$ext."'
541 541
         WHERE id=%i",
542 542
         $session->get('user-id')
543 543
     );
544 544
 
545 545
     // store in session
546
-    $session->set('user-avatar', $newFileName . '.' . $ext);
547
-    $session->set('user-avatar_thumb', $newFileName . '_thumb' . '.' . $ext);
546
+    $session->set('user-avatar', $newFileName.'.'.$ext);
547
+    $session->set('user-avatar_thumb', $newFileName.'_thumb'.'.'.$ext);
548 548
 
549 549
     // return info
550 550
     echo prepareExchangedData(
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
 ) {
564 564
     rename(
565 565
         $filePath,
566
-        $targetDir . DIRECTORY_SEPARATOR . $newFileName
566
+        $targetDir.DIRECTORY_SEPARATOR.$newFileName
567 567
     );
568 568
 
569 569
     // Add in DB
Please login to merge, or discard this patch.
pages/profile.js.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('profile') === false) {
74 74
     // Not allowed page
75 75
     $session->set('system-error_code', ERR_NOT_ALLOWED);
76
-    include $SETTINGS['cpassman_dir'] . '/error.php';
76
+    include $SETTINGS['cpassman_dir'].'/error.php';
77 77
     exit;
78 78
 }
79 79
 ?>
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
     })
98 98
 
99 99
     // Select user properties
100
-    $('#profile-user-language option[value=<?php echo $session->get('user-language');?>').attr('selected','selected');
100
+    $('#profile-user-language option[value=<?php echo $session->get('user-language'); ?>').attr('selected','selected');
101 101
 
102 102
 
103 103
     // AVATAR IMPORT
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 
296 296
                     // reload page in case of language change
297 297
                     if ($('#profile-user-language').val()
298
-                        && $('#profile-user-language').val().toLowerCase() !== '<?php echo $session->get('user-language');?>') {
298
+                        && $('#profile-user-language').val().toLowerCase() !== '<?php echo $session->get('user-language'); ?>') {
299 299
                         // prepare reload
300 300
                         $(this).delay(3000).queue(function() {
301 301
                             document.location.href = "index.php?page=profile";
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
                         // Inform user
307 307
                         toastr.remove();
308 308
                         toastr.info(
309
-                            '<?php echo $lang->get('alert_page_will_reload') . ' ... ' . $lang->get('please_wait'); ?>',
309
+                            '<?php echo $lang->get('alert_page_will_reload').' ... '.$lang->get('please_wait'); ?>',
310 310
                             '', {
311 311
                                 timeOut: 3000,
312 312
                                 progressBar: true
@@ -410,27 +410,27 @@  discard block
 block discarded – undo
410 410
         "defaultText": "<?php echo $lang->get('index_pw_level_txt'); ?>",
411 411
         "ratings": [
412 412
             {
413
-                "minScore": <?php echo TP_PW_STRENGTH_1;?>,
413
+                "minScore": <?php echo TP_PW_STRENGTH_1; ?>,
414 414
                 "className": "meterWarn",
415 415
                 "text": "<?php echo $lang->get('complex_level1'); ?>"
416 416
             },
417 417
             {
418
-                "minScore": <?php echo TP_PW_STRENGTH_2;?>,
418
+                "minScore": <?php echo TP_PW_STRENGTH_2; ?>,
419 419
                 "className": "meterWarn",
420 420
                 "text": "<?php echo $lang->get('complex_level2'); ?>"
421 421
             },
422 422
             {
423
-                "minScore": <?php echo TP_PW_STRENGTH_3;?>,
423
+                "minScore": <?php echo TP_PW_STRENGTH_3; ?>,
424 424
                 "className": "meterGood",
425 425
                 "text": "<?php echo $lang->get('complex_level3'); ?>"
426 426
             },
427 427
             {
428
-                "minScore": <?php echo TP_PW_STRENGTH_4;?>,
428
+                "minScore": <?php echo TP_PW_STRENGTH_4; ?>,
429 429
                 "className": "meterGood",
430 430
                 "text": "<?php echo $lang->get('complex_level4'); ?>"
431 431
             },
432 432
             {
433
-                "minScore": <?php echo TP_PW_STRENGTH_5;?>,
433
+                "minScore": <?php echo TP_PW_STRENGTH_5; ?>,
434 434
                 "className": "meterExcel",
435 435
                 "text": "<?php echo $lang->get('complex_level5'); ?>"
436 436
             }
@@ -523,27 +523,27 @@  discard block
 block discarded – undo
523 523
         "defaultText": "<?php echo $lang->get('index_pw_level_txt'); ?>",
524 524
         "ratings": [
525 525
             {
526
-                "minScore": <?php echo TP_PW_STRENGTH_1;?>,
526
+                "minScore": <?php echo TP_PW_STRENGTH_1; ?>,
527 527
                 "className": "meterWarn",
528 528
                 "text": "<?php echo $lang->get('complex_level1'); ?>"
529 529
             },
530 530
             {
531
-                "minScore": <?php echo TP_PW_STRENGTH_2;?>,
531
+                "minScore": <?php echo TP_PW_STRENGTH_2; ?>,
532 532
                 "className": "meterWarn",
533 533
                 "text": "<?php echo $lang->get('complex_level2'); ?>"
534 534
             },
535 535
             {
536
-                "minScore": <?php echo TP_PW_STRENGTH_3;?>,
536
+                "minScore": <?php echo TP_PW_STRENGTH_3; ?>,
537 537
                 "className": "meterGood",
538 538
                 "text": "<?php echo $lang->get('complex_level3'); ?>"
539 539
             },
540 540
             {
541
-                "minScore": <?php echo TP_PW_STRENGTH_4;?>,
541
+                "minScore": <?php echo TP_PW_STRENGTH_4; ?>,
542 542
                 "className": "meterGood",
543 543
                 "text": "<?php echo $lang->get('complex_level4'); ?>"
544 544
             },
545 545
             {
546
-                "minScore": <?php echo TP_PW_STRENGTH_5;?>,
546
+                "minScore": <?php echo TP_PW_STRENGTH_5; ?>,
547 547
                 "className": "meterExcel",
548 548
                 "text": "<?php echo $lang->get('complex_level5'); ?>"
549 549
             }
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
         }
560 560
     });
561 561
 
562
-    $('#profile-keys_download-date').text('<?php echo null === $session->get('user-keys_recovery_time') ? $lang->get('none') : date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $session->get('user-keys_recovery_time')); ?>');
562
+    $('#profile-keys_download-date').text('<?php echo null === $session->get('user-keys_recovery_time') ? $lang->get('none') : date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $session->get('user-keys_recovery_time')); ?>');
563 563
 
564 564
     $("#open-dialog-keys-download").on('click', function(event) {
565 565
         event.preventDefault();
Please login to merge, or discard this patch.
pages/items.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('items') === false) {
70 70
     // Not allowed page
71 71
     $session->set('system-error_code', ERR_NOT_ALLOWED);
72
-    include $SETTINGS['cpassman_dir'] . '/error.php';
72
+    include $SETTINGS['cpassman_dir'].'/error.php';
73 73
     exit;
74 74
 }
75 75
 // Define Timezone
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 
91 91
 // Get list of users
92 92
 $usersList = [];
93
-$rows = DB::query('SELECT id,login,email FROM ' . prefixTable('users') . ' ORDER BY login ASC');
93
+$rows = DB::query('SELECT id,login,email FROM '.prefixTable('users').' ORDER BY login ASC');
94 94
 foreach ($rows as $record) {
95 95
     $usersList[$record['login']] = [
96 96
         'id' => $record['id'],
@@ -101,16 +101,16 @@  discard block
 block discarded – undo
101 101
 // Get list of roles
102 102
 $arrRoles = [];
103 103
 $listRoles = '';
104
-$rows = DB::query('SELECT id,title FROM ' . prefixTable('roles_title') . ' ORDER BY title ASC');
104
+$rows = DB::query('SELECT id,title FROM '.prefixTable('roles_title').' ORDER BY title ASC');
105 105
 foreach ($rows as $reccord) {
106 106
     $arrRoles[$reccord['title']] = [
107 107
         'id' => $reccord['id'],
108 108
         'title' => $reccord['title'],
109 109
     ];
110 110
     if (empty($listRoles)) {
111
-        $listRoles = $reccord['id'] . '#' . $reccord['title'];
111
+        $listRoles = $reccord['id'].'#'.$reccord['title'];
112 112
     } else {
113
-        $listRoles .= ';' . $reccord['id'] . '#' . $reccord['title'];
113
+        $listRoles .= ';'.$reccord['id'].'#'.$reccord['title'];
114 114
     }
115 115
 }
116 116
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
                         <li class="nav-item"><a class="nav-link" href="#tab_3" data-toggle="tab"><i class="fa-solid fa-archive mr-2"></i><?php echo $lang->get('attachments'); ?></a></li>
186 186
                         <?php
187 187
                         echo isset($SETTINGS['item_extra_fields']) === true && (int) $SETTINGS['item_extra_fields'] === 1 ? '
188
-                            <li class="nav-item"><a class="nav-link" href="#tab_4" data-toggle="tab"><i class="fa-solid fa-cubes mr-2"></i>' . $lang->get('fields') . '</a></li>' : '';
188
+                            <li class="nav-item"><a class="nav-link" href="#tab_4" data-toggle="tab"><i class="fa-solid fa-cubes mr-2"></i>' . $lang->get('fields').'</a></li>' : '';
189 189
                         ?>
190 190
                     </ul>
191 191
                 </div><!-- /.card-header -->
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
                                                 <?php
255 255
                                                 for ($i = 4; $i <= $SETTINGS['pwd_maximum_length']; ++$i) {
256 256
                                                     echo '
257
-                                                <option>' . $i . '</option>';
257
+                                                <option>' . $i.'</option>';
258 258
                                                 }
259 259
                                                 ?>
260 260
                                             </select>
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
                                     <span class="ml-2 col-md-1 clear-me-html" id="form-item-icon-show"></span>
285 285
                                 </div>
286 286
                                 <small class='form-text text-muted'>
287
-                                    <?php echo $lang->get('fontawesome_icon_tip'); ?><a href="<?php echo FONTAWESOME_URL;?>" target="_blank"><i class="fa-solid fa-external-link-alt ml-1"></i></a>
287
+                                    <?php echo $lang->get('fontawesome_icon_tip'); ?><a href="<?php echo FONTAWESOME_URL; ?>" target="_blank"><i class="fa-solid fa-external-link-alt ml-1"></i></a>
288 288
                                 </small>
289 289
                             </div>
290 290
 
@@ -472,39 +472,39 @@  discard block
 block discarded – undo
472 472
                             <div class="tab-pane" id="tab_4">
473 473
                                 <div id="form-item-field" class="hidden">
474 474
                                     <?php
475
-                                        $session_item_fields = $session->get('system-item_fields');//print_r($session_item_fields);
475
+                                        $session_item_fields = $session->get('system-item_fields'); //print_r($session_item_fields);
476 476
                                         if (isset($session_item_fields) === true) {
477 477
                                             foreach ($session_item_fields as $category) {
478 478
                                                 //print_r($category);
479 479
                                                 echo '
480
-                                            <div class="callout callout-info form-item-category hidden" id="form-item-category-' . $category['id'] . '">
481
-                                                <h5>' . $category['title'] . '</h5>
480
+                                            <div class="callout callout-info form-item-category hidden" id="form-item-category-' . $category['id'].'">
481
+                                                <h5>' . $category['title'].'</h5>
482 482
                                                 <p>';
483 483
                                                 foreach ($category['fields'] as $field) {
484 484
                                                     if ($field['type'] === 'textarea') {
485 485
                                                         echo '
486
-                                                    <div class="form-group mb-3 form-item-field" id="form-item-field-' . $field['id'] . '" data-field-id="' . $field['id'] . '">
486
+                                                    <div class="form-group mb-3 form-item-field" id="form-item-field-' . $field['id'].'" data-field-id="'.$field['id'].'">
487 487
                                                         <label>' . $field['title'],
488 488
                                                             $field['is_mandatory'] === '1' ?
489
-                                                                '<span class="fa-solid fa-fire text-danger ml-1 infotip" title="' . $lang->get('is_mandatory') . '"></span>' : '',
489
+                                                                '<span class="fa-solid fa-fire text-danger ml-1 infotip" title="'.$lang->get('is_mandatory').'"></span>' : '',
490 490
                                                             '</label>
491
-                                                        <textarea class="form-control form-item-control form-item-field-custom" rows="2" data-field-name="' . $field['id'] . '" data-field-mandatory="' . $field['is_mandatory'] . '" data-field-regex="' . $field['regex'] . '" data-change-ongoing="0"></textarea>
491
+                                                        <textarea class="form-control form-item-control form-item-field-custom" rows="2" data-field-name="' . $field['id'].'" data-field-mandatory="'.$field['is_mandatory'].'" data-field-regex="'.$field['regex'].'" data-change-ongoing="0"></textarea>
492 492
                                                     </div>';
493 493
                                                     } else {
494 494
                                                         echo '
495
-                                                    <div class="input-group mb-3 form-item-field" id="form-item-field-' . $field['id'] . '" data-field-id="' . $field['id'] . '">
495
+                                                    <div class="input-group mb-3 form-item-field" id="form-item-field-' . $field['id'].'" data-field-id="'.$field['id'].'">
496 496
                                                         <div class="input-group-prepend">
497 497
                                                             <span class="input-group-text">' . $field['title'],
498 498
                                                             $field['is_mandatory'] === '1' ?
499
-                                                                '<span class="fa-solid fa-fire text-danger ml-1 infotip" title="' . $lang->get('is_mandatory') . '"></span>' : '',
499
+                                                                '<span class="fa-solid fa-fire text-danger ml-1 infotip" title="'.$lang->get('is_mandatory').'"></span>' : '',
500 500
                                                             '</span>
501 501
                                                         </div>
502
-                                                        <input type="' . $field['type'] . '" class="form-control form-item-control form-item-field-custom" data-field-name="' . $field['id'] . '" data-field-mandatory="' . $field['is_mandatory'] . '" data-field-regex="' . $field['regex'] . '" data-change-ongoing="0">
502
+                                                        <input type="' . $field['type'].'" class="form-control form-item-control form-item-field-custom" data-field-name="'.$field['id'].'" data-field-mandatory="'.$field['is_mandatory'].'" data-field-regex="'.$field['regex'].'" data-change-ongoing="0">
503 503
                                                     </div>';
504 504
                                                     }
505 505
                                                     if (!empty($field['regex'])) {
506 506
                                                         echo '
507
-                                                    <div>Regex: '. $field['regex'] .'</div>
507
+                                                    <div>Regex: '. $field['regex'].'</div>
508 508
                                                         ';
509 509
                                                     }
510 510
                                                 }
@@ -515,8 +515,8 @@  discard block
 block discarded – undo
515 515
                                                 ) {
516 516
                                                     echo '
517 517
                                                     <div class="form-check icheck-blue">
518
-                                                        <input type="checkbox" class="form-check-input form-check-input-template form-item-control flat-blue" data-category-id="' . $category['id'] . '" data-change-ongoing="0" data-field-name="template" id="template_' . $category['id'] . '">
519
-                                                        <label class="form-check-label ml-3" for="template_' . $category['id'] . '">' . $lang->get('main_template') . '</label>
518
+                                                        <input type="checkbox" class="form-check-input form-check-input-template form-item-control flat-blue" data-category-id="' . $category['id'].'" data-change-ongoing="0" data-field-name="template" id="template_'.$category['id'].'">
519
+                                                        <label class="form-check-label ml-3" for="template_' . $category['id'].'">'.$lang->get('main_template').'</label>
520 520
                                                     </div>';
521 521
                                                 }
522 522
                                                 echo '
@@ -526,8 +526,8 @@  discard block
 block discarded – undo
526 526
                                         } else {
527 527
                                             echo
528 528
                                             '<div class="alert alert-info">
529
-                                                <h5><i class="icon fa fa-info mr-3"></i>' . $lang->get('information') . '</h5>
530
-                                                ' . $lang->get('no_fields') . '
529
+                                                <h5><i class="icon fa fa-info mr-3"></i>' . $lang->get('information').'</h5>
530
+                                                ' . $lang->get('no_fields').'
531 531
                                             </div>';
532 532
                                         } ?>
533 533
                                 </div>
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
                         <p><?php
669 669
                             echo str_replace(
670 670
         ['##otv_expiration_period##', '. '],
671
-        ['<span class="text-bold text-primary">' . $SETTINGS['otv_expiration_period'] . '</span>', '<br>'],
671
+        ['<span class="text-bold text-primary">'.$SETTINGS['otv_expiration_period'].'</span>', '<br>'],
672 672
         $lang->get('otv_message')
673 673
     );
674 674
                             ?></p>
@@ -686,9 +686,9 @@  discard block
 block discarded – undo
686 686
 
687 687
                     <div class="row">
688 688
                         <div class="form-group col-4">
689
-                            <label for="form-item-otv-days"><i class="fa-regular fa-calendar-days mr-2"></i><?php echo $lang->get('number_of_days'); ?> (<?php echo $lang->get('maximum').': '.$SETTINGS['otv_expiration_period'];?>)</label>
689
+                            <label for="form-item-otv-days"><i class="fa-regular fa-calendar-days mr-2"></i><?php echo $lang->get('number_of_days'); ?> (<?php echo $lang->get('maximum').': '.$SETTINGS['otv_expiration_period']; ?>)</label>
690 690
                             <div class="input-group mb-3">
691
-                                <input type="number" class="form-control clear-me-val" id="form-item-otv-days" min="0" max="<?php echo $SETTINGS['otv_expiration_period'];?>" value="<?php echo $SETTINGS['otv_expiration_period'];?>">
691
+                                <input type="number" class="form-control clear-me-val" id="form-item-otv-days" min="0" max="<?php echo $SETTINGS['otv_expiration_period']; ?>" value="<?php echo $SETTINGS['otv_expiration_period']; ?>">
692 692
                             </div>
693 693
                         </div>
694 694
 
@@ -776,7 +776,7 @@  discard block
 block discarded – undo
776 776
                             <select class="form-control form-folder-control select2" style="width:100%;" id="form-folder-add-complexicity" required>
777 777
                                 <?php
778 778
                                 foreach (TP_PW_COMPLEXITY as $key => $value) {
779
-                                    echo '<option value="' . $key . '">' . $value[1] . '</option>';
779
+                                    echo '<option value="'.$key.'">'.$value[1].'</option>';
780 780
                                 }
781 781
                                 ?>
782 782
                             </select>
@@ -794,14 +794,14 @@  discard block
 block discarded – undo
794 794
                             <label><?php echo $lang->get('icon'); ?></label>
795 795
                             <input type="text" class="form-control form-folder-control" id="form-folder-add-icon">
796 796
                             <small class='form-text text-muted'>
797
-                                <?php echo $lang->get('fontawesome_icon_tip'); ?><a href="<?php echo FONTAWESOME_URL;?>" target="_blank"><i class="fa-solid fa-external-link-alt ml-1"></i></a>
797
+                                <?php echo $lang->get('fontawesome_icon_tip'); ?><a href="<?php echo FONTAWESOME_URL; ?>" target="_blank"><i class="fa-solid fa-external-link-alt ml-1"></i></a>
798 798
                             </small>
799 799
                         </div>
800 800
                         <div class="form-group">
801 801
                             <label><?php echo $lang->get('icon_on_selection'); ?></label>
802 802
                             <input type="text" class="form-control form-folder-control" id="form-folder-add-icon-selected">
803 803
                             <small class='form-text text-muted'>
804
-                                <?php echo $lang->get('fontawesome_icon_tip'); ?><a href="<?php echo FONTAWESOME_URL;?>" target="_blank"><i class="fa-solid fa-external-link-alt ml-1"></i></a>
804
+                                <?php echo $lang->get('fontawesome_icon_tip'); ?><a href="<?php echo FONTAWESOME_URL; ?>" target="_blank"><i class="fa-solid fa-external-link-alt ml-1"></i></a>
805 805
                             </small>
806 806
                         </div>
807 807
                     </div>
@@ -1212,18 +1212,18 @@  discard block
 block discarded – undo
1212 1212
                                 <?php
1213 1213
                                     foreach ($session_item_fields as $elem) {
1214 1214
                                         echo '
1215
-                                <div class="callout callout-info card-item-category hidden" id="card-item-category-' . $elem['id'] . '">
1216
-                                    <h5>' . $elem['title'] . '</h5>
1215
+                                <div class="callout callout-info card-item-category hidden" id="card-item-category-' . $elem['id'].'">
1216
+                                    <h5>' . $elem['title'].'</h5>
1217 1217
                                     <p>
1218 1218
                                         <ul class="list-group list-group-unbordered mb-3">';
1219 1219
                                         foreach ($elem['fields'] as $field) {
1220 1220
                                             echo '
1221
-                                            <li class="list-group-item card-item-field hidden" id="card-item-field-' . $field['id'] . '">
1222
-                                                <span id="card-item-field-title-' . $field['id'] . '"><b>' . $field['title'] . '</b></span>
1223
-                                                <button type="button" class="float-right btn btn-secondary btn-sm ml-1 btn-copy-clipboard-clear"  data-clipboard-target="card-item-field-value-' . $field['id'] . '">
1221
+                                            <li class="list-group-item card-item-field hidden" id="card-item-field-' . $field['id'].'">
1222
+                                                <span id="card-item-field-title-' . $field['id'].'"><b>'.$field['title'].'</b></span>
1223
+                                                <button type="button" class="float-right btn btn-secondary btn-sm ml-1 btn-copy-clipboard-clear"  data-clipboard-target="card-item-field-value-' . $field['id'].'">
1224 1224
                                                     <i class="fa-solid fa-copy"></i>
1225 1225
                                                 </button>
1226
-                                                <span class="card-item-field-value float-right ml-1" id="card-item-field-value-' . $field['id'] . '"></span>
1226
+                                                <span class="card-item-field-value float-right ml-1" id="card-item-field-value-' . $field['id'].'"></span>
1227 1227
                                             </li>';
1228 1228
                                         }
1229 1229
                                         echo '
Please login to merge, or discard this patch.