Passed
Push — master ( 5f4a9c...d3570e )
by Nils
04:23
created
sources/items.queries.php 1 patch
Spacing   +293 added lines, -293 removed lines patch added patch discarded remove patch
@@ -37,12 +37,12 @@  discard block
 block discarded – undo
37 37
 }
38 38
 
39 39
 // Do checks
40
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
41
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
40
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
41
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
42 42
 if (checkUser($_SESSION['user_id'], $_SESSION['key'], 'items', $SETTINGS) === false) {
43 43
     // Not allowed page
44 44
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
45
-    include $SETTINGS['cpassman_dir'] . '/error.php';
45
+    include $SETTINGS['cpassman_dir'].'/error.php';
46 46
     exit;
47 47
 }
48 48
 
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
     date_default_timezone_set('UTC');
56 56
 }
57 57
 
58
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
59
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
58
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
59
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
60 60
 header('Content-type: text/html; charset=utf-8');
61 61
 header('Cache-Control: no-cache, must-revalidate');
62 62
 require_once 'main.functions.php';
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 }
77 77
 
78 78
 // Connect to mysql server
79
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
79
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
80 80
 if (defined('DB_PASSWD_CLEAR') === false) {
81 81
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
82 82
 }
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 DB::$connect_options = DB_CONNECT_OPTIONS;
91 91
 
92 92
 // Load Tree
93
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tree/NestedTree/NestedTree.php';
93
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tree/NestedTree/NestedTree.php';
94 94
 $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
95 95
 
96 96
 
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
                 // About special settings
328 328
                 $dataFolderSettings = DB::queryFirstRow(
329 329
                     'SELECT bloquer_creation, bloquer_modification, personal_folder
330
-                    FROM ' . prefixTable('nested_tree') . ' 
330
+                    FROM ' . prefixTable('nested_tree').' 
331 331
                     WHERE id = %i',
332 332
                     $inputData['folderId']
333 333
                 );
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
                 // Get folder complexity
345 345
                 $folderComplexity = DB::queryfirstrow(
346 346
                     'SELECT valeur
347
-                    FROM ' . prefixTable('misc') . '
347
+                    FROM ' . prefixTable('misc').'
348 348
                     WHERE type = %s AND intitule = %i',
349 349
                     'complex',
350 350
                     $inputData['folderId']
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
                 $itemExists = 0;
371 371
                 $newID = '';
372 372
                 $data = DB::queryfirstrow(
373
-                    'SELECT * FROM ' . prefixTable('items') . '
373
+                    'SELECT * FROM '.prefixTable('items').'
374 374
                     WHERE label = %s AND inactif = %i',
375 375
                     $inputData['label'],
376 376
                     0
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
                                 // should we encrypt the data
498 498
                                 $dataTmp = DB::queryFirstRow(
499 499
                                     'SELECT encrypted_data
500
-                                    FROM ' . prefixTable('categories') . '
500
+                                    FROM ' . prefixTable('categories').'
501 501
                                     WHERE id = %i',
502 502
                                     $field_data[0]
503 503
                                 );
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
                     ) {
554 554
                         DB::queryFirstRow(
555 555
                             'SELECT *
556
-                            FROM ' . prefixTable('templates') . '
556
+                            FROM ' . prefixTable('templates').'
557 557
                             WHERE item_id = %i',
558 558
                             $newID
559 559
                         );
@@ -622,11 +622,11 @@  discard block
 block discarded – undo
622 622
                     ) {
623 623
                         foreach ($post_restricted_to as $userRest) {
624 624
                             if (empty($userRest) === false) {
625
-                                $dataTmp = DB::queryfirstrow('SELECT login FROM ' . prefixTable('users') . ' WHERE id= %i', $userRest);
625
+                                $dataTmp = DB::queryfirstrow('SELECT login FROM '.prefixTable('users').' WHERE id= %i', $userRest);
626 626
                                 if (empty($listOfRestricted)) {
627 627
                                     $listOfRestricted = $dataTmp['login'];
628 628
                                 } else {
629
-                                    $listOfRestricted .= ';' . $dataTmp['login'];
629
+                                    $listOfRestricted .= ';'.$dataTmp['login'];
630 630
                                 }
631 631
                             }
632 632
                         }
@@ -640,11 +640,11 @@  discard block
 block discarded – undo
640 640
                         if (empty($data['restricted_to']) === false) {
641 641
                             foreach (explode(';', $data['restricted_to']) as $userRest) {
642 642
                                 if (empty($userRest) === false) {
643
-                                    $dataTmp = DB::queryfirstrow('SELECT login FROM ' . prefixTable('users') . ' WHERE id= ' . $userRest);
643
+                                    $dataTmp = DB::queryfirstrow('SELECT login FROM '.prefixTable('users').' WHERE id= '.$userRest);
644 644
                                     if (empty($oldRestrictionList) === true) {
645 645
                                         $oldRestrictionList = $dataTmp['login'];
646 646
                                     } else {
647
-                                        $oldRestrictionList .= ';' . $dataTmp['login'];
647
+                                        $oldRestrictionList .= ';'.$dataTmp['login'];
648 648
                                     }
649 649
                                 }
650 650
                             }
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
                     if (empty($post_uploaded_file_id) === false) {
708 708
                         $rows = DB::query(
709 709
                             'SELECT id
710
-                            FROM ' . prefixTable('files') . '
710
+                            FROM ' . prefixTable('files').'
711 711
                             WHERE id_item = %s',
712 712
                             $post_uploaded_file_id
713 713
                         );
@@ -747,14 +747,14 @@  discard block
 block discarded – undo
747 747
                                     langHdl('email_subject'),
748 748
                                     str_replace(
749 749
                                         array('#label', '#link'),
750
-                                        array($path, $SETTINGS['email_server_url'] . '/index.php?page=items&group=' . $inputData['folderId'] . '&id=' . $newID . $txt['email_body3']),
750
+                                        array($path, $SETTINGS['email_server_url'].'/index.php?page=items&group='.$inputData['folderId'].'&id='.$newID.$txt['email_body3']),
751 751
                                         langHdl('new_item_email_body')
752 752
                                     ),
753 753
                                     $emailAddress,
754 754
                                     $SETTINGS,
755 755
                                     str_replace(
756 756
                                         array('#label', '#link'),
757
-                                        array($path, $SETTINGS['email_server_url'] . '/index.php?page=items&group=' . $inputData['folderId'] . '&id=' . $newID . $txt['email_body3']),
757
+                                        array($path, $SETTINGS['email_server_url'].'/index.php?page=items&group='.$inputData['folderId'].'&id='.$newID.$txt['email_body3']),
758 758
                                         langHdl('new_item_email_body')
759 759
                                     )
760 760
                                 );
@@ -804,7 +804,7 @@  discard block
 block discarded – undo
804 804
 
805 805
             // Encrypt data to return
806 806
             echo (string) prepareExchangedData(
807
-                $SETTINGS['cpassman_dir'],$arrData,
807
+                $SETTINGS['cpassman_dir'], $arrData,
808 808
                 'encode'
809 809
             );
810 810
             break;
@@ -928,7 +928,7 @@  discard block
 block discarded – undo
928 928
                 // About special settings
929 929
                 $dataFolderSettings = DB::queryFirstRow(
930 930
                     'SELECT bloquer_creation, bloquer_modification, personal_folder, title
931
-                    FROM ' . prefixTable('nested_tree') . ' 
931
+                    FROM ' . prefixTable('nested_tree').' 
932 932
                     WHERE id = %i',
933 933
                     $inputData['folderId']
934 934
                 );
@@ -944,7 +944,7 @@  discard block
 block discarded – undo
944 944
                 // Get folder complexity
945 945
                 $folderComplexity = DB::queryfirstrow(
946 946
                     'SELECT valeur
947
-                    FROM ' . prefixTable('misc') . '
947
+                    FROM ' . prefixTable('misc').'
948 948
                     WHERE type = %s AND intitule = %i',
949 949
                     'complex',
950 950
                     $inputData['folderId']
@@ -984,8 +984,8 @@  discard block
 block discarded – undo
984 984
                 // Get all informations for this item
985 985
                 $dataItem = DB::queryfirstrow(
986 986
                     'SELECT *
987
-                    FROM ' . prefixTable('items') . ' as i
988
-                    INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
987
+                    FROM ' . prefixTable('items').' as i
988
+                    INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
989 989
                     WHERE i.id=%i AND l.action = %s',
990 990
                     $inputData['itemId'],
991 991
                     'at_creation'
@@ -995,7 +995,7 @@  discard block
 block discarded – undo
995 995
 				//db::debugmode(true);
996 996
                 DB::query(
997 997
                     'SELECT *
998
-                    FROM ' . prefixTable('sharekeys_items') . '
998
+                    FROM ' . prefixTable('sharekeys_items').'
999 999
                     WHERE object_id = %i AND user_id = %s',
1000 1000
                     $inputData['itemId'],
1001 1001
                     $_SESSION['user_id']
@@ -1044,9 +1044,9 @@  discard block
 block discarded – undo
1044 1044
                         '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, 
1045 1045
                         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,
1046 1046
                         u.login as user_login, u.email as user_email
1047
-                        FROM ' . prefixTable('items') . ' as i
1048
-                        INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id=l.id_item)
1049
-                        INNER JOIN ' . prefixTable('users') . ' as u ON (u.id=l.id_user)
1047
+                        FROM ' . prefixTable('items').' as i
1048
+                        INNER JOIN ' . prefixTable('log_items').' as l ON (i.id=l.id_item)
1049
+                        INNER JOIN ' . prefixTable('users').' as u ON (u.id=l.id_user)
1050 1050
                         WHERE i.id=%i',
1051 1051
                         $inputData['itemId']
1052 1052
                     );
@@ -1054,7 +1054,7 @@  discard block
 block discarded – undo
1054 1054
                     // Should we log a password change?
1055 1055
                     $userKey = DB::queryFirstRow(
1056 1056
                         'SELECT share_key
1057
-                        FROM ' . prefixTable('sharekeys_items') . '
1057
+                        FROM ' . prefixTable('sharekeys_items').'
1058 1058
                         WHERE user_id = %i AND object_id = %i',
1059 1059
                         $_SESSION['user_id'],
1060 1060
                         $inputData['itemId']
@@ -1113,7 +1113,7 @@  discard block
 block discarded – undo
1113 1113
                     // Get list of tags
1114 1114
                     $itemTags = DB::queryFirstColumn(
1115 1115
                         'SELECT tag
1116
-                        FROM ' . prefixTable('tags') . '
1116
+                        FROM ' . prefixTable('tags').'
1117 1117
                         WHERE item_id = %i',
1118 1118
                         $inputData['itemId']
1119 1119
                     );
@@ -1156,7 +1156,7 @@  discard block
 block discarded – undo
1156 1156
                             $_SESSION['user_id'],
1157 1157
                             'at_modification',
1158 1158
                             $_SESSION['login'],
1159
-                            'at_tag : ' . implode(' ', $itemTags) . ' => ' . $post_tags
1159
+                            'at_tag : '.implode(' ', $itemTags).' => '.$post_tags
1160 1160
                         );
1161 1161
                     }
1162 1162
 
@@ -1194,8 +1194,8 @@  discard block
 block discarded – undo
1194 1194
                                     'SELECT c.id AS id, c.title AS title, i.data AS data, i.data_iv AS data_iv,
1195 1195
                                     i.encryption_type AS encryption_type, c.encrypted_data AS encrypted_data,
1196 1196
                                     c.masked AS masked, i.id AS field_item_id
1197
-                                    FROM ' . prefixTable('categories_items') . ' AS i
1198
-                                    INNER JOIN ' . prefixTable('categories') . ' AS c ON (i.field_id=c.id)
1197
+                                    FROM ' . prefixTable('categories_items').' AS i
1198
+                                    INNER JOIN ' . prefixTable('categories').' AS c ON (i.field_id=c.id)
1199 1199
                                     WHERE i.field_id = %i AND i.item_id = %i',
1200 1200
                                     $field['id'],
1201 1201
                                     $inputData['itemId']
@@ -1209,7 +1209,7 @@  discard block
 block discarded – undo
1209 1209
                                     // Perform new query
1210 1210
                                     $dataTmpCat = DB::queryFirstRow(
1211 1211
                                         'SELECT id, title, encrypted_data, masked
1212
-                                        FROM ' . prefixTable('categories') . '
1212
+                                        FROM ' . prefixTable('categories').'
1213 1213
                                         WHERE id = %i',
1214 1214
                                         $field['id']
1215 1215
                                     );
@@ -1281,7 +1281,7 @@  discard block
 block discarded – undo
1281 1281
                                         $_SESSION['user_id'],
1282 1282
                                         'at_modification',
1283 1283
                                         $_SESSION['login'],
1284
-                                        'at_field : ' . $dataTmpCat['title'] . ' : ' . $field['value']
1284
+                                        'at_field : '.$dataTmpCat['title'].' : '.$field['value']
1285 1285
                                     );
1286 1286
                                 } else {
1287 1287
                                     // compare the old and new value
@@ -1289,7 +1289,7 @@  discard block
 block discarded – undo
1289 1289
                                         // Get user sharekey for this field
1290 1290
                                         $userKey = DB::queryFirstRow(
1291 1291
                                             'SELECT share_key
1292
-                                            FROM ' . prefixTable('sharekeys_fields') . '
1292
+                                            FROM ' . prefixTable('sharekeys_fields').'
1293 1293
                                             WHERE user_id = %i AND object_id = %i',
1294 1294
                                             $_SESSION['user_id'],
1295 1295
                                             $dataTmpCat['field_item_id']
@@ -1359,7 +1359,7 @@  discard block
 block discarded – undo
1359 1359
                                             $_SESSION['user_id'],
1360 1360
                                             'at_modification',
1361 1361
                                             $_SESSION['login'],
1362
-                                            'at_field : ' . $dataTmpCat['title'] . ' => ' . $oldVal
1362
+                                            'at_field : '.$dataTmpCat['title'].' => '.$oldVal
1363 1363
                                         );
1364 1364
                                     }
1365 1365
                                 }
@@ -1384,7 +1384,7 @@  discard block
 block discarded – undo
1384 1384
                     ) {
1385 1385
                         DB::queryFirstRow(
1386 1386
                             'SELECT *
1387
-                            FROM ' . prefixTable('templates') . '
1387
+                            FROM ' . prefixTable('templates').'
1388 1388
                             WHERE item_id = %i',
1389 1389
                             $inputData['itemId']
1390 1390
                         );
@@ -1427,7 +1427,7 @@  discard block
 block discarded – undo
1427 1427
                         // check if elem exists in Table. If not add it or update it.
1428 1428
                         DB::query(
1429 1429
                             'SELECT *
1430
-                            FROM ' . prefixTable('automatic_del') . '
1430
+                            FROM ' . prefixTable('automatic_del').'
1431 1431
                             WHERE item_id = %i',
1432 1432
                             $inputData['itemId']
1433 1433
                         );
@@ -1454,7 +1454,7 @@  discard block
 block discarded – undo
1454 1454
                                 // Store updates performed
1455 1455
                                 array_push(
1456 1456
                                     $arrayOfChanges,
1457
-                                    langHdl('automatic_deletion_engaged') . ': ' . langHdl('enabled')
1457
+                                    langHdl('automatic_deletion_engaged').': '.langHdl('enabled')
1458 1458
                                 );
1459 1459
 
1460 1460
                                 // update LOG
@@ -1497,7 +1497,7 @@  discard block
 block discarded – undo
1497 1497
                                 // Store updates performed
1498 1498
                                 array_push(
1499 1499
                                     $arrayOfChanges,
1500
-                                    langHdl('automatic_deletion_engaged') . ': ' . langHdl('disabled')
1500
+                                    langHdl('automatic_deletion_engaged').': '.langHdl('disabled')
1501 1501
                                 );
1502 1502
 
1503 1503
                                 // update LOG
@@ -1530,7 +1530,7 @@  discard block
 block discarded – undo
1530 1530
                             if (empty($userId) === false) {
1531 1531
                                 $dataTmp = DB::queryfirstrow(
1532 1532
                                     'SELECT id, name, lastname
1533
-                                    FROM ' . prefixTable('users') . '
1533
+                                    FROM ' . prefixTable('users').'
1534 1534
                                     WHERE id= %i',
1535 1535
                                     $userId
1536 1536
                                 );
@@ -1538,7 +1538,7 @@  discard block
 block discarded – undo
1538 1538
                                 // Add to array
1539 1539
                                 array_push(
1540 1540
                                     $arrayOfUsersRestriction,
1541
-                                    $dataTmp['name'] . ' ' . $dataTmp['lastname']
1541
+                                    $dataTmp['name'].' '.$dataTmp['lastname']
1542 1542
                                 );
1543 1543
                                 array_push(
1544 1544
                                     $arrayOfUsersIdRestriction,
@@ -1569,8 +1569,8 @@  discard block
 block discarded – undo
1569 1569
                         // get values before deleting them
1570 1570
                         $rows = DB::query(
1571 1571
                             'SELECT t.title, t.id AS id
1572
-                            FROM ' . prefixTable('roles_title') . ' as t
1573
-                            INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (t.id=r.role_id)
1572
+                            FROM ' . prefixTable('roles_title').' as t
1573
+                            INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (t.id=r.role_id)
1574 1574
                             WHERE r.item_id = %i
1575 1575
                             ORDER BY t.title ASC',
1576 1576
                             $inputData['itemId']
@@ -1604,7 +1604,7 @@  discard block
 block discarded – undo
1604 1604
                                 );
1605 1605
                                 $dataTmp = DB::queryfirstrow(
1606 1606
                                     'SELECT title
1607
-                                    FROM ' . prefixTable('roles_title') . '
1607
+                                    FROM ' . prefixTable('roles_title').'
1608 1608
                                     WHERE id = %i',
1609 1609
                                     $role
1610 1610
                                 );
@@ -1645,8 +1645,8 @@  discard block
 block discarded – undo
1645 1645
                             $_SESSION['user_id'],
1646 1646
                             'at_modification',
1647 1647
                             $_SESSION['login'],
1648
-                            'at_restriction : ' . (count($diffUsersRestiction) > 0 ?
1649
-                                implode(', ', $arrayOfUsersRestriction) . (count($diffRolesRestiction) > 0 ? ', ' : '') : '') . (count($diffRolesRestiction) > 0 ? implode(', ', $arrayOfRestrictionRoles) : '')
1648
+                            'at_restriction : '.(count($diffUsersRestiction) > 0 ?
1649
+                                implode(', ', $arrayOfUsersRestriction).(count($diffRolesRestiction) > 0 ? ', ' : '') : '').(count($diffRolesRestiction) > 0 ? implode(', ', $arrayOfRestrictionRoles) : '')
1650 1650
                         );
1651 1651
                     }
1652 1652
 
@@ -1666,7 +1666,7 @@  discard block
 block discarded – undo
1666 1666
                             $_SESSION['user_id'],
1667 1667
                             'at_modification',
1668 1668
                             $_SESSION['login'],
1669
-                            'at_label : ' . $data['label'] . ' => ' . $inputData['label']
1669
+                            'at_label : '.$data['label'].' => '.$inputData['label']
1670 1670
                         );
1671 1671
                     }
1672 1672
                     // LOGIN
@@ -1685,7 +1685,7 @@  discard block
 block discarded – undo
1685 1685
                             $_SESSION['user_id'],
1686 1686
                             'at_modification',
1687 1687
                             $_SESSION['login'],
1688
-                            'at_login : ' . $data['login'] . ' => ' . $post_login
1688
+                            'at_login : '.$data['login'].' => '.$post_login
1689 1689
                         );
1690 1690
                     }
1691 1691
                     // EMAIL
@@ -1704,7 +1704,7 @@  discard block
 block discarded – undo
1704 1704
                             $_SESSION['user_id'],
1705 1705
                             'at_modification',
1706 1706
                             $_SESSION['login'],
1707
-                            'at_email : ' . $data['email'] . ' => ' . $post_email
1707
+                            'at_email : '.$data['email'].' => '.$post_email
1708 1708
                         );
1709 1709
                     }
1710 1710
                     // URL
@@ -1723,7 +1723,7 @@  discard block
 block discarded – undo
1723 1723
                             $_SESSION['user_id'],
1724 1724
                             'at_modification',
1725 1725
                             $_SESSION['login'],
1726
-                            'at_url : ' . $data['url'] . ' => ' . $post_url
1726
+                            'at_url : '.$data['url'].' => '.$post_url
1727 1727
                         );
1728 1728
                     }
1729 1729
                     // DESCRIPTION
@@ -1748,7 +1748,7 @@  discard block
 block discarded – undo
1748 1748
                     // FOLDER
1749 1749
                     if ((int) $data['id_tree'] !== (int) $inputData['folderId']) {
1750 1750
                         // Get name of folders
1751
-                        $dataTmp = DB::query('SELECT title FROM ' . prefixTable('nested_tree') . ' WHERE id IN %li', array($data['id_tree'], $inputData['folderId']));
1751
+                        $dataTmp = DB::query('SELECT title FROM '.prefixTable('nested_tree').' WHERE id IN %li', array($data['id_tree'], $inputData['folderId']));
1752 1752
 
1753 1753
                         // Store updates performed
1754 1754
                         array_push(
@@ -1764,7 +1764,7 @@  discard block
 block discarded – undo
1764 1764
                             $_SESSION['user_id'],
1765 1765
                             'at_modification',
1766 1766
                             $_SESSION['login'],
1767
-                            'at_category : ' . $dataTmp[0]['title'] . ' => ' . $dataTmp[1]['title']
1767
+                            'at_category : '.$dataTmp[0]['title'].' => '.$dataTmp[1]['title']
1768 1768
                         );
1769 1769
                     }
1770 1770
                     // ANYONE_CAN_MODIFY
@@ -1772,7 +1772,7 @@  discard block
 block discarded – undo
1772 1772
                         // Store updates performed
1773 1773
                         array_push(
1774 1774
                             $arrayOfChanges,
1775
-                            langHdl('at_anyoneconmodify') . ': ' . ((int) $post_anyone_can_modify === 0 ? langHdl('disabled') : langHdl('enabled'))
1775
+                            langHdl('at_anyoneconmodify').': '.((int) $post_anyone_can_modify === 0 ? langHdl('disabled') : langHdl('enabled'))
1776 1776
                         );
1777 1777
 
1778 1778
                         // Log
@@ -1783,15 +1783,15 @@  discard block
 block discarded – undo
1783 1783
                             $_SESSION['user_id'],
1784 1784
                             'at_modification',
1785 1785
                             $_SESSION['login'],
1786
-                            'at_anyoneconmodify : ' . ((int) $post_anyone_can_modify === 0 ? 'disabled' : 'enabled')
1786
+                            'at_anyoneconmodify : '.((int) $post_anyone_can_modify === 0 ? 'disabled' : 'enabled')
1787 1787
                         );
1788 1788
                     }
1789 1789
 
1790 1790
                     // Reload new values
1791 1791
                     $dataItem = DB::queryfirstrow(
1792 1792
                         'SELECT *
1793
-                        FROM ' . prefixTable('items') . ' as i
1794
-                        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
1793
+                        FROM ' . prefixTable('items').' as i
1794
+                        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
1795 1795
                         WHERE i.id = %i AND l.action = %s',
1796 1796
                         $inputData['itemId'],
1797 1797
                         'at_creation'
@@ -1800,8 +1800,8 @@  discard block
 block discarded – undo
1800 1800
                     $history = '';
1801 1801
                     $rows = DB::query(
1802 1802
                         'SELECT l.date as date, l.action as action, l.raison as raison, u.login as login
1803
-                        FROM ' . prefixTable('log_items') . ' as l
1804
-                        LEFT JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id)
1803
+                        FROM ' . prefixTable('log_items').' as l
1804
+                        LEFT JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id)
1805 1805
                         WHERE l.action <> %s AND id_item=%s',
1806 1806
                         'at_shown',
1807 1807
                         $inputData['itemId']
@@ -1810,14 +1810,14 @@  discard block
 block discarded – undo
1810 1810
                         if ($record['raison'] === NULL) continue;
1811 1811
                         $reason = explode(':', $record['raison']);
1812 1812
                         if (count($reason) > 0) {
1813
-                            $sentence = date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) . ' - '
1814
-                                . $record['login'] . ' - ' . langHdl($record['action']) . ' - '
1815
-                                . (empty($record['raison']) === false ? (count($reason) > 1 ? langHdl(trim($reason[0])) . ' : ' . $reason[1]
1813
+                            $sentence = date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']).' - '
1814
+                                . $record['login'].' - '.langHdl($record['action']).' - '
1815
+                                . (empty($record['raison']) === false ? (count($reason) > 1 ? langHdl(trim($reason[0])).' : '.$reason[1]
1816 1816
                                     : langHdl(trim($reason[0]))) : '');
1817 1817
                             if (empty($history)) {
1818 1818
                                 $history = $sentence;
1819 1819
                             } else {
1820
-                                $history .= '<br />' . $sentence;
1820
+                                $history .= '<br />'.$sentence;
1821 1821
                             }
1822 1822
                         }
1823 1823
                     }
@@ -1948,7 +1948,7 @@  discard block
 block discarded – undo
1948 1948
             ) {
1949 1949
                 // load the original record into an array
1950 1950
                 $originalRecord = DB::queryfirstrow(
1951
-                    'SELECT * FROM ' . prefixTable('items') . '
1951
+                    'SELECT * FROM '.prefixTable('items').'
1952 1952
                     WHERE id = %i',
1953 1953
                     $inputData['itemId']
1954 1954
                 );
@@ -1968,7 +1968,7 @@  discard block
 block discarded – undo
1968 1968
 
1969 1969
                 // Load the destination folder record into an array
1970 1970
                 $dataDestination = DB::queryfirstrow(
1971
-                    'SELECT personal_folder FROM ' . prefixTable('nested_tree') . '
1971
+                    'SELECT personal_folder FROM '.prefixTable('nested_tree').'
1972 1972
                     WHERE id = %i',
1973 1973
                     $post_dest_id
1974 1974
                 );
@@ -1976,7 +1976,7 @@  discard block
 block discarded – undo
1976 1976
                 // Get the ITEM object key for the user
1977 1977
                 $userKey = DB::queryFirstRow(
1978 1978
                     'SELECT share_key
1979
-                    FROM ' . prefixTable('sharekeys_items') . '
1979
+                    FROM ' . prefixTable('sharekeys_items').'
1980 1980
                     WHERE user_id = %i AND object_id = %i',
1981 1981
                     $_SESSION['user_id'],
1982 1982
                     $inputData['itemId']
@@ -2049,7 +2049,7 @@  discard block
 block discarded – undo
2049 2049
                 // Manage Custom Fields
2050 2050
                 $rows = DB::query(
2051 2051
                     'SELECT *
2052
-                    FROM ' . prefixTable('categories_items') . '
2052
+                    FROM ' . prefixTable('categories_items').'
2053 2053
                     WHERE item_id = %i',
2054 2054
                     $inputData['itemId']
2055 2055
                 );
@@ -2097,15 +2097,15 @@  discard block
 block discarded – undo
2097 2097
                 $rows = DB::query(
2098 2098
                     'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status, f.extension AS extension,
2099 2099
                     f.size AS size, f.type AS type, s.share_key AS share_key
2100
-                    FROM ' . prefixTable('files') . ' AS f
2101
-                    INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id)
2100
+                    FROM ' . prefixTable('files').' AS f
2101
+                    INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id)
2102 2102
                     WHERE s.user_id = %i AND f.id_item = %i',
2103 2103
                     $_SESSION['user_id'],
2104 2104
                     $inputData['itemId']
2105 2105
                 );
2106 2106
                 foreach ($rows as $record) {
2107 2107
                     // Check if file still exists
2108
-                    if (file_exists($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . TP_FILE_PREFIX . base64_decode($record['file'])) === true) {
2108
+                    if (file_exists($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.TP_FILE_PREFIX.base64_decode($record['file'])) === true) {
2109 2109
                         // Step1 - decrypt the file
2110 2110
                         $fileContent = decryptFile(
2111 2111
                             $record['file'],
@@ -2114,8 +2114,8 @@  discard block
 block discarded – undo
2114 2114
                         );
2115 2115
 
2116 2116
                         // Step2 - create file
2117
-                        $newFileName = md5(time() . '_' . $record['id']) . '.' . $record['extension'];
2118
-                        $outstream = fopen($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . $newFileName, 'ab');
2117
+                        $newFileName = md5(time().'_'.$record['id']).'.'.$record['extension'];
2118
+                        $outstream = fopen($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.$newFileName, 'ab');
2119 2119
                         if ($outstream === false) {
2120 2120
                             echo prepareExchangedData(
2121 2121
     $SETTINGS['cpassman_dir'],
@@ -2166,7 +2166,7 @@  discard block
 block discarded – undo
2166 2166
 
2167 2167
                 // -------------------------
2168 2168
                 // Add specific restrictions
2169
-                $rows = DB::query('SELECT * FROM ' . prefixTable('restriction_to_roles') . ' WHERE item_id = %i', $inputData['itemId']);
2169
+                $rows = DB::query('SELECT * FROM '.prefixTable('restriction_to_roles').' WHERE item_id = %i', $inputData['itemId']);
2170 2170
                 foreach ($rows as $record) {
2171 2171
                     DB::insert(
2172 2172
                         prefixTable('restriction_to_roles'),
@@ -2178,7 +2178,7 @@  discard block
 block discarded – undo
2178 2178
                 }
2179 2179
 
2180 2180
                 // Add Tags
2181
-                $rows = DB::query('SELECT * FROM ' . prefixTable('tags') . ' WHERE item_id = %i', $inputData['itemId']);
2181
+                $rows = DB::query('SELECT * FROM '.prefixTable('tags').' WHERE item_id = %i', $inputData['itemId']);
2182 2182
                 foreach ($rows as $record) {
2183 2183
                     DB::insert(
2184 2184
                         prefixTable('tags'),
@@ -2208,7 +2208,7 @@  discard block
 block discarded – undo
2208 2208
                     $_SESSION['login']
2209 2209
                 );
2210 2210
                 // reload cache table
2211
-                include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
2211
+                include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
2212 2212
                 updateCacheTable('reload', $SETTINGS, null);
2213 2213
 
2214 2214
                 echo (string) prepareExchangedData(
@@ -2256,7 +2256,7 @@  discard block
 block discarded – undo
2256 2256
 
2257 2257
             // Decrypt and retreive data in JSON format
2258 2258
             $dataReceived = prepareExchangedData(
2259
-                $SETTINGS['cpassman_dir'],$inputData['data'],
2259
+                $SETTINGS['cpassman_dir'], $inputData['data'],
2260 2260
                 'decode'
2261 2261
             );
2262 2262
 
@@ -2282,7 +2282,7 @@  discard block
 block discarded – undo
2282 2282
             // then we can show it
2283 2283
             $item_deleted = DB::queryFirstRow(
2284 2284
                 'SELECT *
2285
-                FROM ' . prefixTable('log_items') . '
2285
+                FROM ' . prefixTable('log_items').'
2286 2286
                 WHERE id_item = %i AND action = %s
2287 2287
                 ORDER BY date DESC
2288 2288
                 LIMIT 0, 1',
@@ -2293,7 +2293,7 @@  discard block
 block discarded – undo
2293 2293
 
2294 2294
             $item_restored = DB::queryFirstRow(
2295 2295
                 'SELECT *
2296
-                FROM ' . prefixTable('log_items') . '
2296
+                FROM ' . prefixTable('log_items').'
2297 2297
                 WHERE id_item = %i AND action = %s
2298 2298
                 ORDER BY date DESC
2299 2299
                 LIMIT 0, 1',
@@ -2318,8 +2318,8 @@  discard block
 block discarded – undo
2318 2318
             // Get all informations for this item
2319 2319
             $dataItem = DB::queryfirstrow(
2320 2320
                 'SELECT *
2321
-                FROM ' . prefixTable('items') . ' as i
2322
-                INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
2321
+                FROM ' . prefixTable('items').' as i
2322
+                INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
2323 2323
                 WHERE i.id = %i AND l.action = %s',
2324 2324
                 $inputData['id'],
2325 2325
                 'at_creation'
@@ -2328,7 +2328,7 @@  discard block
 block discarded – undo
2328 2328
             // Notification
2329 2329
             DB::queryfirstrow(
2330 2330
                 'SELECT *
2331
-                FROM ' . prefixTable('notification') . '
2331
+                FROM ' . prefixTable('notification').'
2332 2332
                 WHERE item_id = %i AND user_id = %i',
2333 2333
                 $inputData['id'],
2334 2334
                 $_SESSION['user_id']
@@ -2375,13 +2375,13 @@  discard block
 block discarded – undo
2375 2375
                     && (int) $SETTINGS['enable_email_notification_on_item_shown'] === 1
2376 2376
                     && (int) $user['admin'] === 1
2377 2377
                 ) {
2378
-                    $_SESSION['listNotificationEmails'] .= $user['email'] . ',';
2378
+                    $_SESSION['listNotificationEmails'] .= $user['email'].',';
2379 2379
                 }
2380 2380
             }
2381 2381
 
2382 2382
             // manage case of API user
2383 2383
             if ($dataItem['id_user'] === API_USER_ID) {
2384
-                $arrData['author'] = 'API [' . $dataItem['description'] . ']';
2384
+                $arrData['author'] = 'API ['.$dataItem['description'].']';
2385 2385
                 $arrData['id_user'] = API_USER_ID;
2386 2386
                 $arrData['author_email'] = '';
2387 2387
                 $arrData['notification_status'] = false;
@@ -2391,7 +2391,7 @@  discard block
 block discarded – undo
2391 2391
             $tags = array();
2392 2392
             $rows = DB::query(
2393 2393
                 'SELECT tag
2394
-                FROM ' . prefixTable('tags') . '
2394
+                FROM ' . prefixTable('tags').'
2395 2395
                 WHERE item_id = %i',
2396 2396
                 $inputData['id']
2397 2397
             );
@@ -2416,7 +2416,7 @@  discard block
 block discarded – undo
2416 2416
             // Check if user has a role that is accepted
2417 2417
             $rows_tmp = DB::query(
2418 2418
                 'SELECT role_id
2419
-                FROM ' . prefixTable('restriction_to_roles') . '
2419
+                FROM ' . prefixTable('restriction_to_roles').'
2420 2420
                 WHERE item_id=%i',
2421 2421
                 $inputData['id']
2422 2422
             );
@@ -2430,7 +2430,7 @@  discard block
 block discarded – undo
2430 2430
             // Get the object key for the user
2431 2431
             $userKey = DB::queryFirstRow(
2432 2432
                 'SELECT share_key
2433
-                FROM ' . prefixTable('sharekeys_items') . '
2433
+                FROM ' . prefixTable('sharekeys_items').'
2434 2434
                 WHERE user_id = %i AND object_id = %i',
2435 2435
                 $_SESSION['user_id'],
2436 2436
                 $inputData['id']
@@ -2529,8 +2529,8 @@  discard block
 block discarded – undo
2529 2529
                     // Add restriction if item is restricted to roles
2530 2530
                     $rows = DB::query(
2531 2531
                         'SELECT t.title, t.id
2532
-                        FROM ' . prefixTable('roles_title') . ' AS t
2533
-                        INNER JOIN ' . prefixTable('restriction_to_roles') . ' AS r ON (t.id=r.role_id)
2532
+                        FROM ' . prefixTable('roles_title').' AS t
2533
+                        INNER JOIN ' . prefixTable('restriction_to_roles').' AS r ON (t.id=r.role_id)
2534 2534
                         WHERE r.item_id = %i
2535 2535
                         ORDER BY t.title ASC',
2536 2536
                         $inputData['id']
@@ -2546,8 +2546,8 @@  discard block
 block discarded – undo
2546 2546
                     $tmp = array();
2547 2547
                     $rows = DB::query(
2548 2548
                         'SELECT k.label, k.id
2549
-                        FROM ' . prefixTable('kb_items') . ' as i
2550
-                        INNER JOIN ' . prefixTable('kb') . ' as k ON (i.kb_id=k.id)
2549
+                        FROM ' . prefixTable('kb_items').' as i
2550
+                        INNER JOIN ' . prefixTable('kb').' as k ON (i.kb_id=k.id)
2551 2551
                         WHERE i.item_id = %i
2552 2552
                         ORDER BY k.label ASC',
2553 2553
                         $inputData['id']
@@ -2628,7 +2628,7 @@  discard block
 block discarded – undo
2628 2628
                     $arrCatList = array();
2629 2629
                     $rows_tmp = DB::query(
2630 2630
                         'SELECT id_category
2631
-                        FROM ' . prefixTable('categories_folders') . '
2631
+                        FROM ' . prefixTable('categories_folders').'
2632 2632
                         WHERE id_folder=%i',
2633 2633
                         $inputData['folderId']
2634 2634
                     );
@@ -2643,8 +2643,8 @@  discard block
 block discarded – undo
2643 2643
                             'SELECT i.id AS id, i.field_id AS field_id, i.data AS data, i.item_id AS item_id,
2644 2644
                             i.encryption_type AS encryption_type, c.encrypted_data, c.parent_id AS parent_id,
2645 2645
                             c.type as field_type, c.masked AS field_masked, c.role_visibility AS role_visibility
2646
-                            FROM ' . prefixTable('categories_items') . ' AS i
2647
-                            INNER JOIN ' . prefixTable('categories') . ' AS c ON (i.field_id=c.id)
2646
+                            FROM ' . prefixTable('categories_items').' AS i
2647
+                            INNER JOIN ' . prefixTable('categories').' AS c ON (i.field_id=c.id)
2648 2648
                             WHERE i.item_id=%i AND c.parent_id IN %ls',
2649 2649
                             $inputData['id'],
2650 2650
                             $arrCatList
@@ -2655,11 +2655,11 @@  discard block
 block discarded – undo
2655 2655
 							//db::debugmode(true);
2656 2656
                             $userKey = DB::queryFirstRow(
2657 2657
                                 'SELECT share_key
2658
-                                FROM ' . prefixTable('sharekeys_fields') . '
2658
+                                FROM ' . prefixTable('sharekeys_fields').'
2659 2659
                                 WHERE user_id = %i AND object_id = %i',
2660 2660
                                 $_SESSION['user_id'],
2661 2661
                                 $row['id']
2662
-                            );//db::debugmode(false);
2662
+                            ); //db::debugmode(false);
2663 2663
                             $fieldText = [];
2664 2664
                             if (DB::count() === 0) {
2665 2665
                                 // Not encrypted
@@ -2701,7 +2701,7 @@  discard block
 block discarded – undo
2701 2701
                 if (isset($SETTINGS['item_creation_templates']) && (int) $SETTINGS['item_creation_templates'] === 1) {
2702 2702
                     $rows_tmp = DB::queryfirstrow(
2703 2703
                         'SELECT category_id
2704
-                        FROM ' . prefixTable('templates') . '
2704
+                        FROM ' . prefixTable('templates').'
2705 2705
                         WHERE item_id = %i',
2706 2706
                         $inputData['id']
2707 2707
                     );
@@ -2726,7 +2726,7 @@  discard block
 block discarded – undo
2726 2726
                     // Is the Item to be deleted?
2727 2727
                     $dataDelete = DB::queryfirstrow(
2728 2728
                         'SELECT * 
2729
-                        FROM ' . prefixTable('automatic_del') . '
2729
+                        FROM ' . prefixTable('automatic_del').'
2730 2730
                         WHERE item_id = %i',
2731 2731
                         $inputData['id']
2732 2732
                     );
@@ -2808,11 +2808,11 @@  discard block
 block discarded – undo
2808 2808
                 if (empty($dataItem['restricted_to']) === false) {
2809 2809
                     foreach (explode(';', $dataItem['restricted_to']) as $userRest) {
2810 2810
                         if (empty($userRest) === false) {
2811
-                            $dataTmp = DB::queryfirstrow('SELECT login FROM ' . prefixTable('users') . ' WHERE id= ' . $userRest);
2811
+                            $dataTmp = DB::queryfirstrow('SELECT login FROM '.prefixTable('users').' WHERE id= '.$userRest);
2812 2812
                             if (empty($listOfRestricted)) {
2813 2813
                                 $listOfRestricted = $dataTmp['login'];
2814 2814
                             } else {
2815
-                                $listOfRestricted .= ';' . $dataTmp['login'];
2815
+                                $listOfRestricted .= ';'.$dataTmp['login'];
2816 2816
                             }
2817 2817
                         }
2818 2818
                     }
@@ -2875,8 +2875,8 @@  discard block
 block discarded – undo
2875 2875
             // Load item data
2876 2876
             $dataItem = DB::queryFirstRow(
2877 2877
                 'SELECT i.*, n.title AS folder_title
2878
-                FROM ' . prefixTable('items') . ' AS i
2879
-                INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (i.id_tree = n.id)
2878
+                FROM ' . prefixTable('items').' AS i
2879
+                INNER JOIN ' . prefixTable('nested_tree').' AS n ON (i.id_tree = n.id)
2880 2880
                 WHERE i.id = %i',
2881 2881
                 $inputData['id']
2882 2882
             );
@@ -2898,7 +2898,7 @@  discard block
 block discarded – undo
2898 2898
             // Check if user has a role that is accepted
2899 2899
             $rows_tmp = DB::query(
2900 2900
                 'SELECT role_id
2901
-                FROM ' . prefixTable('restriction_to_roles') . '
2901
+                FROM ' . prefixTable('restriction_to_roles').'
2902 2902
                 WHERE item_id=%i',
2903 2903
                 $inputData['id']
2904 2904
             );
@@ -2945,7 +2945,7 @@  discard block
 block discarded – undo
2945 2945
                 // launch query
2946 2946
                 $rows = DB::query(
2947 2947
                     'SELECT id, name, file, extension, size
2948
-                    FROM ' . prefixTable('files') . '
2948
+                    FROM ' . prefixTable('files').'
2949 2949
                     WHERE id_item = %i AND confirmed = 1',
2950 2950
                     $inputData['id']
2951 2951
                 );
@@ -2954,7 +2954,7 @@  discard block
 block discarded – undo
2954 2954
                         $attachments,
2955 2955
                         array(
2956 2956
                             'icon' => fileFormatImage(strtolower($record['extension'])),
2957
-                            'filename' => basename($record['name'], '.' . $record['extension']),
2957
+                            'filename' => basename($record['name'], '.'.$record['extension']),
2958 2958
                             'extension' => $record['extension'],
2959 2959
                             'size' => formatSizeUnits((int) $record['size']),
2960 2960
                             'is_image' => in_array(strtolower($record['extension']), TP_IMAGE_FILE_EXT) === true ? 1 : 0,
@@ -2980,7 +2980,7 @@  discard block
 block discarded – undo
2980 2980
                         array(
2981 2981
                             'latest_items' => implode(';', $_SESSION['latest_items']),
2982 2982
                         ),
2983
-                        'id=' . $_SESSION['user_id']
2983
+                        'id='.$_SESSION['user_id']
2984 2984
                     );
2985 2985
                 }
2986 2986
 
@@ -2989,8 +2989,8 @@  discard block
 block discarded – undo
2989 2989
                 $listOptionsForRoles = array();
2990 2990
                 $rows = DB::query(
2991 2991
                     'SELECT r.role_id AS role_id, t.title AS title
2992
-                    FROM ' . prefixTable('roles_values') . ' AS r
2993
-                    INNER JOIN ' . prefixTable('roles_title') . ' AS t ON (r.role_id = t.id)
2992
+                    FROM ' . prefixTable('roles_values').' AS r
2993
+                    INNER JOIN ' . prefixTable('roles_title').' AS t ON (r.role_id = t.id)
2994 2994
                     WHERE r.folder_id = %i',
2995 2995
                     $dataItem['id_tree']
2996 2996
                 );
@@ -3004,9 +3004,9 @@  discard block
 block discarded – undo
3004 3004
                     );
3005 3005
                     $rows2 = DB::query(
3006 3006
                         'SELECT id, login, fonction_id, email, name, lastname
3007
-                        FROM ' . prefixTable('users') . '
3007
+                        FROM ' . prefixTable('users').'
3008 3008
                         WHERE fonction_id LIKE %s',
3009
-                        '%' . $record['role_id'] . '%'
3009
+                        '%'.$record['role_id'].'%'
3010 3010
                     );
3011 3011
                     foreach ($rows2 as $record2) {
3012 3012
                         foreach (explode(';', $record2['fonction_id']) as $role) {
@@ -3019,7 +3019,7 @@  discard block
 block discarded – undo
3019 3019
                                     array(
3020 3020
                                         'id' => (int) $record2['id'],
3021 3021
                                         'login' => $record2['login'],
3022
-                                        'name' => $record2['name'] . ' ' . $record2['lastname'],
3022
+                                        'name' => $record2['name'].' '.$record2['lastname'],
3023 3023
                                         'email' => $record2['email'],
3024 3024
                                     )
3025 3025
                                 );
@@ -3038,16 +3038,16 @@  discard block
 block discarded – undo
3038 3038
                     $path = '';
3039 3039
                     foreach ($arbo as $elem) {
3040 3040
                         if (empty($path) === true) {
3041
-                            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' ';
3041
+                            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' ';
3042 3042
                         } else {
3043
-                            $path .= '&#8594; ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
3043
+                            $path .= '&#8594; '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
3044 3044
                         }
3045 3045
                     }
3046 3046
                     // Build text to show user
3047 3047
                     if (empty($path) === true) {
3048 3048
                         $path = addslashes($dataItem['label']);
3049 3049
                     } else {
3050
-                        $path = addslashes($dataItem['label']) . ' (' . $path . ')';
3050
+                        $path = addslashes($dataItem['label']).' ('.$path.')';
3051 3051
                     }
3052 3052
 
3053 3053
                     // send back infos
@@ -3061,7 +3061,7 @@  discard block
 block discarded – undo
3061 3061
                                 array(
3062 3062
                                     addslashes($_SESSION['login']),
3063 3063
                                     $path,
3064
-                                    $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $dataItem['id'],
3064
+                                    $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$dataItem['id'],
3065 3065
                                 ),
3066 3066
                                 langHdl('email_on_open_notification_mail')
3067 3067
                             ),
@@ -3072,7 +3072,7 @@  discard block
 block discarded – undo
3072 3072
                 }
3073 3073
 
3074 3074
                 // has this item a change proposal
3075
-                DB::query('SELECT * FROM ' . prefixTable('items_change') . ' WHERE item_id = %i', $inputData['id']);
3075
+                DB::query('SELECT * FROM '.prefixTable('items_change').' WHERE item_id = %i', $inputData['id']);
3076 3076
                 $returnArray['has_change_proposal'] = DB::count();
3077 3077
 
3078 3078
                 // Setting
@@ -3170,7 +3170,7 @@  discard block
 block discarded – undo
3170 3170
             // Load item data
3171 3171
             $data = DB::queryFirstRow(
3172 3172
                 'SELECT id_tree
3173
-                FROM ' . prefixTable('items') . '
3173
+                FROM ' . prefixTable('items').'
3174 3174
                 WHERE id = %i',
3175 3175
                 $inputData['itemId']
3176 3176
             );
@@ -3236,7 +3236,7 @@  discard block
 block discarded – undo
3236 3236
             }
3237 3237
             // decrypt and retreive data in JSON format
3238 3238
             $dataReceived = prepareExchangedData(
3239
-    $SETTINGS['cpassman_dir'],$inputData['data'], 'decode');
3239
+    $SETTINGS['cpassman_dir'], $inputData['data'], 'decode');
3240 3240
 
3241 3241
             // Prepare variables
3242 3242
             $title = filter_var(htmlspecialchars_decode($dataReceived['title'], ENT_QUOTES), FILTER_SANITIZE_STRING);
@@ -3244,13 +3244,13 @@  discard block
 block discarded – undo
3244 3244
 
3245 3245
             // Check if user is allowed to access this folder
3246 3246
             if (!in_array($inputData['folderId'], $_SESSION['groupes_visibles'])) {
3247
-                echo '[{"error" : "' . langHdl('error_not_allowed_to') . '"}]';
3247
+                echo '[{"error" : "'.langHdl('error_not_allowed_to').'"}]';
3248 3248
                 break;
3249 3249
             }
3250 3250
 
3251 3251
             // Check if title doesn't contains html codes
3252 3252
             if (preg_match_all('|<[^>]+>(.*)</[^>]+>|U', $title, $out)) {
3253
-                echo '[ { "error" : "' . langHdl('error_html_codes') . '" } ]';
3253
+                echo '[ { "error" : "'.langHdl('error_html_codes').'" } ]';
3254 3254
                 break;
3255 3255
             }
3256 3256
             // check that title is not numeric
@@ -3261,9 +3261,9 @@  discard block
 block discarded – undo
3261 3261
 
3262 3262
             // Check if duplicate folders name are allowed
3263 3263
             if (isset($SETTINGS['duplicate_folder']) && $SETTINGS['duplicate_folder'] === '0') {
3264
-                $data = DB::queryFirstRow('SELECT id, title FROM ' . prefixTable('nested_tree') . ' WHERE title = %s', $title);
3264
+                $data = DB::queryFirstRow('SELECT id, title FROM '.prefixTable('nested_tree').' WHERE title = %s', $title);
3265 3265
                 if (empty($data['id']) === false && $dataReceived['folder'] !== $data['id']) {
3266
-                    echo '[ { "error" : "' . langHdl('error_group_exist') . '" } ]';
3266
+                    echo '[ { "error" : "'.langHdl('error_group_exist').'" } ]';
3267 3267
                     break;
3268 3268
                 }
3269 3269
             }
@@ -3271,7 +3271,7 @@  discard block
 block discarded – undo
3271 3271
             // query on folder
3272 3272
             $data = DB::queryfirstrow(
3273 3273
                 'SELECT parent_id, personal_folder
3274
-                FROM ' . prefixTable('nested_tree') . '
3274
+                FROM ' . prefixTable('nested_tree').'
3275 3275
                 WHERE id = %i',
3276 3276
                 $inputData['folderId']
3277 3277
             );
@@ -3281,20 +3281,20 @@  discard block
 block discarded – undo
3281 3281
             if ($_SESSION['is_admin'] !== 1 && $_SESSION['user_manager'] !== 1 && $data['personal_folder'] === '0') {
3282 3282
                 $data = DB::queryfirstrow(
3283 3283
                     'SELECT valeur
3284
-                    FROM ' . prefixTable('misc') . '
3284
+                    FROM ' . prefixTable('misc').'
3285 3285
                     WHERE intitule = %i AND type = %s',
3286 3286
                     $data['parent_id'],
3287 3287
                     'complex'
3288 3288
                 );
3289 3289
                 if (intval($dataReceived['complexity']) < intval($data['valeur'])) {
3290
-                    echo '[ { "error" : "' . langHdl('error_folder_complexity_lower_than_top_folder') . ' [<b>' . TP_PW_COMPLEXITY[$data['valeur']][1] . '</b>]"} ]';
3290
+                    echo '[ { "error" : "'.langHdl('error_folder_complexity_lower_than_top_folder').' [<b>'.TP_PW_COMPLEXITY[$data['valeur']][1].'</b>]"} ]';
3291 3291
                     break;
3292 3292
                 }
3293 3293
             }
3294 3294
 
3295 3295
             // update Folders table
3296 3296
             $tmp = DB::queryFirstRow(
3297
-                'SELECT title, parent_id, personal_folder FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
3297
+                'SELECT title, parent_id, personal_folder FROM '.prefixTable('nested_tree').' WHERE id = %i',
3298 3298
                 $dataReceived['folder']
3299 3299
             );
3300 3300
             if ($tmp['parent_id'] !== 0 || $tmp['title'] !== $_SESSION['user_id'] || $tmp['personal_folder'] !== 1) {
@@ -3353,7 +3353,7 @@  discard block
 block discarded – undo
3353 3353
             }
3354 3354
             // decrypt and retreive data in JSON format
3355 3355
             $dataReceived = prepareExchangedData(
3356
-    $SETTINGS['cpassman_dir'],$inputData['data'], 'decode');
3356
+    $SETTINGS['cpassman_dir'], $inputData['data'], 'decode');
3357 3357
             $post_source_folder_id = filter_var(htmlspecialchars_decode($dataReceived['source_folder_id']), FILTER_SANITIZE_NUMBER_INT);
3358 3358
             $post_target_folder_id = filter_var(htmlspecialchars_decode($dataReceived['target_folder_id']), FILTER_SANITIZE_NUMBER_INT);
3359 3359
 
@@ -3362,42 +3362,42 @@  discard block
 block discarded – undo
3362 3362
                     in_array($post_target_folder_id, $_SESSION['groupes_visibles']) === false) && ($post_target_folder_id === '0' &&
3363 3363
                     isset($SETTINGS['can_create_root_folder']) === true && (int) $SETTINGS['can_create_root_folder'] === 1)
3364 3364
             ) {
3365
-                $returnValues = '[{"error" : "' . langHdl('error_not_allowed_to') . '"}]';
3365
+                $returnValues = '[{"error" : "'.langHdl('error_not_allowed_to').'"}]';
3366 3366
                 echo $returnValues;
3367 3367
                 break;
3368 3368
             }
3369 3369
 
3370 3370
             $tmp_source = DB::queryFirstRow(
3371 3371
                 'SELECT title, parent_id, personal_folder
3372
-                FROM ' . prefixTable('nested_tree') . '
3372
+                FROM ' . prefixTable('nested_tree').'
3373 3373
                 WHERE id = %i',
3374 3374
                 $post_source_folder_id
3375 3375
             );
3376 3376
 
3377 3377
             $tmp_target = DB::queryFirstRow(
3378 3378
                 'SELECT title, parent_id, personal_folder
3379
-                FROM ' . prefixTable('nested_tree') . '
3379
+                FROM ' . prefixTable('nested_tree').'
3380 3380
                 WHERE id = %i',
3381 3381
                 $post_target_folder_id
3382 3382
             );
3383 3383
 
3384 3384
             // check if target is not a child of source
3385 3385
             if ($tree->isChildOf($post_target_folder_id, $post_source_folder_id) === true) {
3386
-                $returnValues = '[{"error" : "' . langHdl('error_not_allowed_to') . '"}]';
3386
+                $returnValues = '[{"error" : "'.langHdl('error_not_allowed_to').'"}]';
3387 3387
                 echo $returnValues;
3388 3388
                 break;
3389 3389
             }
3390 3390
 
3391 3391
             // check if source or target folder is PF. If Yes, then cancel operation
3392 3392
             if ((int) $tmp_source['personal_folder'] === 1 || (int) $tmp_target['personal_folder'] === 1) {
3393
-                $returnValues = '[{"error" : "' . langHdl('error_not_allowed_to') . '"}]';
3393
+                $returnValues = '[{"error" : "'.langHdl('error_not_allowed_to').'"}]';
3394 3394
                 echo $returnValues;
3395 3395
                 break;
3396 3396
             }
3397 3397
 
3398 3398
             // check if source or target folder is PF. If Yes, then cancel operation
3399 3399
             if ($tmp_source['title'] === $_SESSION['user_id'] || $tmp_target['title'] === $_SESSION['user_id']) {
3400
-                $returnValues = '[{"error" : "' . langHdl('error_not_allowed_to') . '"}]';
3400
+                $returnValues = '[{"error" : "'.langHdl('error_not_allowed_to').'"}]';
3401 3401
                 echo $returnValues;
3402 3402
                 break;
3403 3403
             }
@@ -3534,7 +3534,7 @@  discard block
 block discarded – undo
3534 3534
                 foreach ($_SESSION['user_roles'] as $role) {
3535 3535
                     $roleQ = DB::queryfirstrow(
3536 3536
                         'SELECT allow_pw_change
3537
-                        FROM ' . prefixTable('roles_title') . '
3537
+                        FROM ' . prefixTable('roles_title').'
3538 3538
                         WHERE id = %i',
3539 3539
                         $role
3540 3540
                     );
@@ -3559,11 +3559,11 @@  discard block
 block discarded – undo
3559 3559
                     
3560 3560
                     foreach ($_SESSION['user_roles'] as $role) {
3561 3561
                         $access = DB::queryFirstRow(
3562
-                            'SELECT type FROM ' . prefixTable('roles_values') . ' WHERE role_id = %i AND folder_id = %i',
3562
+                            'SELECT type FROM '.prefixTable('roles_values').' WHERE role_id = %i AND folder_id = %i',
3563 3563
                             $role,
3564 3564
                             $inputData['id']
3565 3565
                         );
3566
-                        if (DB::count()>0) {
3566
+                        if (DB::count() > 0) {
3567 3567
                             if ($access['type'] === 'R') {
3568 3568
                                 array_push($arrTmp, 10);
3569 3569
                             } elseif ($access['type'] === 'W') {
@@ -3628,7 +3628,7 @@  discard block
 block discarded – undo
3628 3628
                 } else {
3629 3629
                     DB::query(
3630 3630
                         'SELECT *
3631
-                        FROM ' . prefixTable('items') . '
3631
+                        FROM ' . prefixTable('items').'
3632 3632
                         WHERE inactif = %i',
3633 3633
                         0
3634 3634
                     );
@@ -3638,7 +3638,7 @@  discard block
 block discarded – undo
3638 3638
 
3639 3639
                 // Get folder complexity
3640 3640
                 $folderComplexity = DB::queryFirstRow(
3641
-                    'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %i',
3641
+                    'SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %i',
3642 3642
                     'complex',
3643 3643
                     $inputData['id']
3644 3644
                 );
@@ -3650,7 +3650,7 @@  discard block
 block discarded – undo
3650 3650
                 if (isset($SETTINGS['item_extra_fields']) && (int) $SETTINGS['item_extra_fields'] === 1) {
3651 3651
                     $folderRow = DB::query(
3652 3652
                         'SELECT id_category
3653
-                        FROM ' . prefixTable('categories_folders') . '
3653
+                        FROM ' . prefixTable('categories_folders').'
3654 3654
                         WHERE id_folder = %i',
3655 3655
                         $inputData['id']
3656 3656
                     );
@@ -3764,13 +3764,13 @@  discard block
 block discarded – undo
3764 3764
                 // List all ITEMS
3765 3765
                 if ($folderIsPf === false) {
3766 3766
                     $where->add('i.inactif=%i', 0);
3767
-                    $where->add('l.date=%l', '(SELECT date FROM ' . prefixTable('log_items') . " WHERE action IN ('at_creation', 'at_modification') AND id_item=i.id ORDER BY date DESC LIMIT 1)");
3767
+                    $where->add('l.date=%l', '(SELECT date FROM '.prefixTable('log_items')." WHERE action IN ('at_creation', 'at_modification') AND id_item=i.id ORDER BY date DESC LIMIT 1)");
3768 3768
                     if (empty($limited_to_items) === false) {
3769 3769
                         $where->add('i.id IN %ls', explode(',', $limited_to_items));
3770 3770
                     }
3771 3771
 
3772
-                    $query_limit = ' LIMIT ' .
3773
-                        $start . ',' .
3772
+                    $query_limit = ' LIMIT '.
3773
+                        $start.','.
3774 3774
                         $post_nb_items_to_display_once;
3775 3775
                     //db::debugmode(true);
3776 3776
                     $rows = DB::query(
@@ -3781,9 +3781,9 @@  discard block
 block discarded – undo
3781 3781
                         MIN(l.action) AS log_action,
3782 3782
                         l.id_user AS log_user,
3783 3783
                         i.url AS link
3784
-                        FROM ' . prefixTable('items') . ' AS i
3785
-                        INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (i.id_tree = n.id)
3786
-                        INNER JOIN ' . prefixTable('log_items') . ' AS l ON (i.id = l.id_item)
3784
+                        FROM ' . prefixTable('items').' AS i
3785
+                        INNER JOIN ' . prefixTable('nested_tree').' AS n ON (i.id_tree = n.id)
3786
+                        INNER JOIN ' . prefixTable('log_items').' AS l ON (i.id = l.id_item)
3787 3787
                         WHERE %l
3788 3788
                         GROUP BY i.id, l.date, l.id_user, l.action
3789 3789
                         ORDER BY i.label ASC, l.date DESC' . $query_limit,
@@ -3802,9 +3802,9 @@  discard block
 block discarded – undo
3802 3802
                         MIN(l.action) AS log_action,
3803 3803
                         l.id_user AS log_user,
3804 3804
                         i.url AS link
3805
-                        FROM ' . prefixTable('items') . ' AS i
3806
-                        INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (i.id_tree = n.id)
3807
-                        INNER JOIN ' . prefixTable('log_items') . ' AS l ON (i.id = l.id_item)
3805
+                        FROM ' . prefixTable('items').' AS i
3806
+                        INNER JOIN ' . prefixTable('nested_tree').' AS n ON (i.id_tree = n.id)
3807
+                        INNER JOIN ' . prefixTable('log_items').' AS l ON (i.id = l.id_item)
3808 3808
                         WHERE %l
3809 3809
                         GROUP BY i.id, l.date, l.id_user, l.action
3810 3810
                         ORDER BY i.label ASC, l.date DESC',
@@ -3834,7 +3834,7 @@  discard block
 block discarded – undo
3834 3834
                         $item_is_restricted_to_role = false;
3835 3835
                         DB::queryfirstrow(
3836 3836
                             'SELECT role_id
3837
-                            FROM ' . prefixTable('restriction_to_roles') . '
3837
+                            FROM ' . prefixTable('restriction_to_roles').'
3838 3838
                             WHERE item_id = %i',
3839 3839
                             $record['id']
3840 3840
                         );
@@ -3846,7 +3846,7 @@  discard block
 block discarded – undo
3846 3846
                         $user_is_included_in_role = false;
3847 3847
                         DB::query(
3848 3848
                             'SELECT role_id
3849
-                            FROM ' . prefixTable('restriction_to_roles') . '
3849
+                            FROM ' . prefixTable('restriction_to_roles').'
3850 3850
                             WHERE item_id = %i AND role_id IN %ls',
3851 3851
                             $record['id'],
3852 3852
                             $_SESSION['user_roles']
@@ -4051,9 +4051,9 @@  discard block
 block discarded – undo
4051 4051
             if ((int) $start === 0) {
4052 4052
                 DB::query(
4053 4053
                     'SELECT i.id
4054
-                    FROM ' . prefixTable('items') . ' as i
4055
-                    INNER JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree = n.id)
4056
-                    INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id = l.id_item)
4054
+                    FROM ' . prefixTable('items').' as i
4055
+                    INNER JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree = n.id)
4056
+                    INNER JOIN ' . prefixTable('log_items').' as l ON (i.id = l.id_item)
4057 4057
                     WHERE %l
4058 4058
                     ORDER BY i.label ASC, l.date DESC',
4059 4059
                     $where
@@ -4095,7 +4095,7 @@  discard block
 block discarded – undo
4095 4095
 
4096 4096
             // Encrypt data to return
4097 4097
             echo (string) prepareExchangedData(
4098
-                $SETTINGS['cpassman_dir'],$returnValues, 'encode');
4098
+                $SETTINGS['cpassman_dir'], $returnValues, 'encode');
4099 4099
 
4100 4100
             break;
4101 4101
 
@@ -4116,8 +4116,8 @@  discard block
 block discarded – undo
4116 4116
             // Run query
4117 4117
             $dataItem = DB::queryfirstrow(
4118 4118
                 'SELECT i.pw AS pw, s.share_key AS share_key
4119
-                FROM ' . prefixTable('items') . ' AS i
4120
-                INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (s.object_id = i.id)
4119
+                FROM ' . prefixTable('items').' AS i
4120
+                INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (s.object_id = i.id)
4121 4121
                 WHERE user_id = %i AND i.id = %i',
4122 4122
                 $_SESSION['user_id'],
4123 4123
                 $inputData['itemId']
@@ -4160,7 +4160,7 @@  discard block
 block discarded – undo
4160 4160
             if (null !== $inputData['itemId'] && empty($inputData['itemId']) === false) {
4161 4161
                 $dataItem = DB::queryfirstrow(
4162 4162
                     'SELECT perso, anyone_can_modify
4163
-                    FROM ' . prefixTable('items') . '
4163
+                    FROM ' . prefixTable('items').'
4164 4164
                     WHERE id=%i',
4165 4165
                     $inputData['itemId']
4166 4166
                 );
@@ -4199,7 +4199,7 @@  discard block
 block discarded – undo
4199 4199
                 */
4200 4200
 
4201 4201
                 // Lock Item (if already locked), go back and warn
4202
-                $dataTmp = DB::queryFirstRow('SELECT timestamp, user_id FROM ' . prefixTable('items_edition') . ' WHERE item_id = %i', $inputData['itemId']);
4202
+                $dataTmp = DB::queryFirstRow('SELECT timestamp, user_id FROM '.prefixTable('items_edition').' WHERE item_id = %i', $inputData['itemId']);
4203 4203
 
4204 4204
                 // If token is taken for this Item and delay is passed then delete it.
4205 4205
                 if (
@@ -4210,7 +4210,7 @@  discard block
 block discarded – undo
4210 4210
                     DB::delete(prefixTable('items_edition'), 'item_id = %i', $inputData['itemId']);
4211 4211
                     //reload the previous data
4212 4212
                     $dataTmp = DB::queryFirstRow(
4213
-                        'SELECT timestamp, user_id FROM ' . prefixTable('items_edition') . ' WHERE item_id = %i',
4213
+                        'SELECT timestamp, user_id FROM '.prefixTable('items_edition').' WHERE item_id = %i',
4214 4214
                         $inputData['itemId']
4215 4215
                     );
4216 4216
                 }
@@ -4254,7 +4254,7 @@  discard block
 block discarded – undo
4254 4254
             // do query on this folder
4255 4255
             $data_this_folder = DB::queryFirstRow(
4256 4256
                 'SELECT id, personal_folder, title
4257
-                FROM ' . prefixTable('nested_tree') . '
4257
+                FROM ' . prefixTable('nested_tree').'
4258 4258
                 WHERE id = %s',
4259 4259
                 $inputData['folderId']
4260 4260
             );
@@ -4295,8 +4295,8 @@  discard block
 block discarded – undo
4295 4295
             $visibilite = '';
4296 4296
             $data = DB::queryFirstRow(
4297 4297
                 'SELECT m.valeur, n.personal_folder
4298
-                FROM ' . prefixTable('misc') . ' AS m
4299
-                INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (m.intitule = n.id)
4298
+                FROM ' . prefixTable('misc').' AS m
4299
+                INNER JOIN ' . prefixTable('nested_tree').' AS n ON (m.intitule = n.id)
4300 4300
                 WHERE type=%s AND intitule = %s',
4301 4301
                 'complex',
4302 4302
                 $inputData['folderId']
@@ -4309,8 +4309,8 @@  discard block
 block discarded – undo
4309 4309
                 // Prepare Item actual visibility (what Users/Roles can see it)
4310 4310
                 $rows = DB::query(
4311 4311
                     'SELECT t.title
4312
-                    FROM ' . prefixTable('roles_values') . ' as v
4313
-                    INNER JOIN ' . prefixTable('roles_title') . ' as t ON (v.role_id = t.id)
4312
+                    FROM ' . prefixTable('roles_values').' as v
4313
+                    INNER JOIN ' . prefixTable('roles_title').' as t ON (v.role_id = t.id)
4314 4314
                     WHERE v.folder_id = %i
4315 4315
                     GROUP BY title',
4316 4316
                     $inputData['folderId']
@@ -4319,7 +4319,7 @@  discard block
 block discarded – undo
4319 4319
                     if (empty($visibilite)) {
4320 4320
                         $visibilite = $record['title'];
4321 4321
                     } else {
4322
-                        $visibilite .= ' - ' . $record['title'];
4322
+                        $visibilite .= ' - '.$record['title'];
4323 4323
                     }
4324 4324
                 }
4325 4325
             } else {
@@ -4329,14 +4329,14 @@  discard block
 block discarded – undo
4329 4329
                 // do new query to know if current folder is pf
4330 4330
                 $data_pf = DB::queryFirstRow(
4331 4331
                     'SELECT personal_folder
4332
-                    FROM ' . prefixTable('nested_tree') . '
4332
+                    FROM ' . prefixTable('nested_tree').'
4333 4333
                     WHERE id = %s',
4334 4334
                     $inputData['folderId']
4335 4335
                 );
4336 4336
                 
4337 4337
                 $folder_is_personal = $data_pf !== null ? (int) $data_pf['personal_folder'] : 0;
4338 4338
                 
4339
-                $visibilite = $_SESSION['name'] . ' ' . $_SESSION['lastname'] . ' (' . $_SESSION['login'] . ')';
4339
+                $visibilite = $_SESSION['name'].' '.$_SESSION['lastname'].' ('.$_SESSION['login'].')';
4340 4340
             }
4341 4341
 
4342 4342
             recupDroitCreationSansComplexite($inputData['folderId']);
@@ -4346,8 +4346,8 @@  discard block
 block discarded – undo
4346 4346
             $listOptionsForRoles = array();
4347 4347
             $rows = DB::query(
4348 4348
                 'SELECT r.role_id AS role_id, t.title AS title
4349
-                FROM ' . prefixTable('roles_values') . ' AS r
4350
-                INNER JOIN ' . prefixTable('roles_title') . ' AS t ON (r.role_id = t.id)
4349
+                FROM ' . prefixTable('roles_values').' AS r
4350
+                INNER JOIN ' . prefixTable('roles_title').' AS t ON (r.role_id = t.id)
4351 4351
                 WHERE r.folder_id = %i',
4352 4352
                 $inputData['folderId']
4353 4353
             );
@@ -4361,7 +4361,7 @@  discard block
 block discarded – undo
4361 4361
                 );
4362 4362
                 $rows2 = DB::query(
4363 4363
                     'SELECT id, login, fonction_id, email, name, lastname
4364
-                    FROM ' . prefixTable('users') . '
4364
+                    FROM ' . prefixTable('users').'
4365 4365
                     WHERE admin = 0'
4366 4366
                 );
4367 4367
                 foreach ($rows2 as $record2) {
@@ -4375,7 +4375,7 @@  discard block
 block discarded – undo
4375 4375
                                 array(
4376 4376
                                     'id' => $record2['id'],
4377 4377
                                     'login' => $record2['login'],
4378
-                                    'name' => $record2['name'] . ' ' . $record2['lastname'],
4378
+                                    'name' => $record2['name'].' '.$record2['lastname'],
4379 4379
                                     'email' => $record2['email'],
4380 4380
                                 )
4381 4381
                             );
@@ -4392,13 +4392,13 @@  discard block
 block discarded – undo
4392 4392
 					//db::debugmode(true);
4393 4393
 					$access = DB::queryFirstRow(
4394 4394
 						'SELECT type
4395
-						FROM ' . prefixTable('roles_values') . '
4395
+						FROM ' . prefixTable('roles_values').'
4396 4396
 						WHERE role_id = %i AND folder_id = %i',
4397 4397
 						$role,
4398 4398
 						$inputData['folderId']
4399 4399
 					);
4400 4400
 					//db::debugmode(false);
4401
-                    if (DB::count()>0) {
4401
+                    if (DB::count() > 0) {
4402 4402
                         if ($access['type'] === 'R') {
4403 4403
                             array_push($arrTmp, 10);
4404 4404
                         } elseif ($access['type'] === 'W') {
@@ -4439,7 +4439,7 @@  discard block
 block discarded – undo
4439 4439
                 'itemAccessRight' => isset($accessLevel) === true ? $accessLevel : '',
4440 4440
             );
4441 4441
             echo (string) prepareExchangedData(
4442
-                $SETTINGS['cpassman_dir'],$returnValues, 'encode');
4442
+                $SETTINGS['cpassman_dir'], $returnValues, 'encode');
4443 4443
             break;
4444 4444
 
4445 4445
             /*
@@ -4471,7 +4471,7 @@  discard block
 block discarded – undo
4471 4471
             // Get some info before deleting
4472 4472
             $data = DB::queryFirstRow(
4473 4473
                 'SELECT name, id_item, file
4474
-                FROM ' . prefixTable('files') . '
4474
+                FROM ' . prefixTable('files').'
4475 4475
                 WHERE id = %i',
4476 4476
                 $fileId
4477 4477
             );
@@ -4479,7 +4479,7 @@  discard block
 block discarded – undo
4479 4479
             // Load item data
4480 4480
             $data_item = DB::queryFirstRow(
4481 4481
                 'SELECT id_tree
4482
-                FROM ' . prefixTable('items') . '
4482
+                FROM ' . prefixTable('items').'
4483 4483
                 WHERE id = %i',
4484 4484
                 $data['id_item']
4485 4485
             );
@@ -4510,7 +4510,7 @@  discard block
 block discarded – undo
4510 4510
                     $_SESSION['user_id'],
4511 4511
                     'at_modification',
4512 4512
                     $_SESSION['login'],
4513
-                    'at_del_file : ' . $data['name']
4513
+                    'at_del_file : '.$data['name']
4514 4514
                 );
4515 4515
 
4516 4516
                 // DElete sharekeys
@@ -4521,7 +4521,7 @@  discard block
 block discarded – undo
4521 4521
                 );
4522 4522
 
4523 4523
                 // Delete file from server
4524
-                fileDelete($SETTINGS['path_to_upload_folder'] . '/' . TP_FILE_PREFIX . base64_decode($data['file']), $SETTINGS);
4524
+                fileDelete($SETTINGS['path_to_upload_folder'].'/'.TP_FILE_PREFIX.base64_decode($data['file']), $SETTINGS);
4525 4525
             }
4526 4526
 
4527 4527
             echo (string) prepareExchangedData(
@@ -4565,12 +4565,12 @@  discard block
 block discarded – undo
4565 4565
                 // Update SESSION with this new favourite
4566 4566
                 $data = DB::queryfirstrow(
4567 4567
                     'SELECT label,id_tree
4568
-                    FROM ' . prefixTable('items') . '
4568
+                    FROM ' . prefixTable('items').'
4569 4569
                     WHERE id = ' . mysqli_real_escape_string($link, $inputData['itemId'])
4570 4570
                 );
4571 4571
                 $_SESSION['favourites_tab'][$inputData['itemId']] = array(
4572 4572
                     'label' => $data['label'],
4573
-                    'url' => 'index.php?page=items&amp;group=' . $data['id_tree'] . '&amp;id=' . $inputData['itemId'],
4573
+                    'url' => 'index.php?page=items&amp;group='.$data['id_tree'].'&amp;id='.$inputData['itemId'],
4574 4574
                 );
4575 4575
             } elseif ((int) $inputData['destination'] === 1) {
4576 4576
                 // delete from session
@@ -4642,8 +4642,8 @@  discard block
 block discarded – undo
4642 4642
             // get data about item
4643 4643
             $dataSource = DB::queryfirstrow(
4644 4644
                 'SELECT i.pw, f.personal_folder,i.id_tree, f.title,i.label
4645
-                FROM ' . prefixTable('items') . ' as i
4646
-                INNER JOIN ' . prefixTable('nested_tree') . ' as f ON (i.id_tree=f.id)
4645
+                FROM ' . prefixTable('items').' as i
4646
+                INNER JOIN ' . prefixTable('nested_tree').' as f ON (i.id_tree=f.id)
4647 4647
                 WHERE i.id=%i',
4648 4648
                 $inputData['itemId']
4649 4649
             );
@@ -4651,7 +4651,7 @@  discard block
 block discarded – undo
4651 4651
             // get data about new folder
4652 4652
             $dataDestination = DB::queryfirstrow(
4653 4653
                 'SELECT personal_folder, title
4654
-                FROM ' . prefixTable('nested_tree') . '
4654
+                FROM ' . prefixTable('nested_tree').'
4655 4655
                 WHERE id = %i',
4656 4656
                 $inputData['folderId']
4657 4657
             );
@@ -4704,7 +4704,7 @@  discard block
 block discarded – undo
4704 4704
                 // Get fields for this Item
4705 4705
                 $rows = DB::query(
4706 4706
                     'SELECT id
4707
-                    FROM ' . prefixTable('categories_items') . '
4707
+                    FROM ' . prefixTable('categories_items').'
4708 4708
                     WHERE item_id = %i',
4709 4709
                     $inputData['itemId']
4710 4710
                 );
@@ -4721,7 +4721,7 @@  discard block
 block discarded – undo
4721 4721
                 // Get FILES for this Item
4722 4722
                 $rows = DB::query(
4723 4723
                     'SELECT id
4724
-                    FROM ' . prefixTable('files') . '
4724
+                    FROM ' . prefixTable('files').'
4725 4725
                     WHERE id_item = %i',
4726 4726
                     $inputData['itemId']
4727 4727
                 );
@@ -4766,7 +4766,7 @@  discard block
 block discarded – undo
4766 4766
                 // Get the ITEM object key for the user
4767 4767
                 $userKey = DB::queryFirstRow(
4768 4768
                     'SELECT share_key
4769
-                    FROM ' . prefixTable('sharekeys_items') . '
4769
+                    FROM ' . prefixTable('sharekeys_items').'
4770 4770
                     WHERE user_id = %i AND object_id = %i',
4771 4771
                     $_SESSION['user_id'],
4772 4772
                     $inputData['itemId']
@@ -4777,8 +4777,8 @@  discard block
 block discarded – undo
4777 4777
                     // This is a public object
4778 4778
                     $users = DB::query(
4779 4779
                         'SELECT id, public_key
4780
-                        FROM ' . prefixTable('users') . '
4781
-                        WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '","' . $_SESSION['user_id'] . '")
4780
+                        FROM ' . prefixTable('users').'
4781
+                        WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'","'.$_SESSION['user_id'].'")
4782 4782
                         AND public_key != ""'
4783 4783
                     );
4784 4784
                     foreach ($users as $user) {
@@ -4798,14 +4798,14 @@  discard block
 block discarded – undo
4798 4798
                 // Get fields for this Item
4799 4799
                 $rows = DB::query(
4800 4800
                     'SELECT id
4801
-                    FROM ' . prefixTable('categories_items') . '
4801
+                    FROM ' . prefixTable('categories_items').'
4802 4802
                     WHERE item_id = %i',
4803 4803
                     $inputData['itemId']
4804 4804
                 );
4805 4805
                 foreach ($rows as $field) {
4806 4806
                     $userKey = DB::queryFirstRow(
4807 4807
                         'SELECT share_key
4808
-                        FROM ' . prefixTable('sharekeys_fields') . '
4808
+                        FROM ' . prefixTable('sharekeys_fields').'
4809 4809
                         WHERE user_id = %i AND object_id = %i',
4810 4810
                         $_SESSION['user_id'],
4811 4811
                         $field['id']
@@ -4816,8 +4816,8 @@  discard block
 block discarded – undo
4816 4816
                         // This is a public object
4817 4817
                         $users = DB::query(
4818 4818
                             'SELECT id, public_key
4819
-                            FROM ' . prefixTable('users') . '
4820
-                            WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '","' . $_SESSION['user_id'] . '")
4819
+                            FROM ' . prefixTable('users').'
4820
+                            WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'","'.$_SESSION['user_id'].'")
4821 4821
                             AND public_key != ""'
4822 4822
                         );
4823 4823
                         foreach ($users as $user) {
@@ -4838,14 +4838,14 @@  discard block
 block discarded – undo
4838 4838
                 // Get FILES for this Item
4839 4839
                 $rows = DB::query(
4840 4840
                     'SELECT id
4841
-                    FROM ' . prefixTable('files') . '
4841
+                    FROM ' . prefixTable('files').'
4842 4842
                     WHERE id_item = %i',
4843 4843
                     $inputData['itemId']
4844 4844
                 );
4845 4845
                 foreach ($rows as $attachment) {
4846 4846
                     $userKey = DB::queryFirstRow(
4847 4847
                         'SELECT share_key
4848
-                        FROM ' . prefixTable('sharekeys_files') . '
4848
+                        FROM ' . prefixTable('sharekeys_files').'
4849 4849
                         WHERE user_id = %i AND object_id = %i',
4850 4850
                         $_SESSION['user_id'],
4851 4851
                         $attachment['id']
@@ -4856,8 +4856,8 @@  discard block
 block discarded – undo
4856 4856
                         // This is a public object
4857 4857
                         $users = DB::query(
4858 4858
                             'SELECT id, public_key
4859
-                            FROM ' . prefixTable('users') . '
4860
-                            WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '","' . $_SESSION['user_id'] . '")
4859
+                            FROM ' . prefixTable('users').'
4860
+                            WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'","'.$_SESSION['user_id'].'")
4861 4861
                             AND public_key != ""'
4862 4862
                         );
4863 4863
                         foreach ($users as $user) {
@@ -4894,7 +4894,7 @@  discard block
 block discarded – undo
4894 4894
                 $_SESSION['user_id'],
4895 4895
                 'at_modification',
4896 4896
                 $_SESSION['login'],
4897
-                'at_moved : ' . $dataSource['title'] . ' -> ' . $dataDestination['title']
4897
+                'at_moved : '.$dataSource['title'].' -> '.$dataDestination['title']
4898 4898
             );
4899 4899
 
4900 4900
             $returnValues = array(
@@ -4904,7 +4904,7 @@  discard block
 block discarded – undo
4904 4904
                 'to_folder' => $inputData['folderId'],
4905 4905
             );
4906 4906
             echo (string) prepareExchangedData(
4907
-    $SETTINGS['cpassman_dir'],$returnValues, 'encode');
4907
+    $SETTINGS['cpassman_dir'], $returnValues, 'encode');
4908 4908
             break;
4909 4909
 
4910 4910
             /*
@@ -4951,8 +4951,8 @@  discard block
 block discarded – undo
4951 4951
                     // get data about item
4952 4952
                     $dataSource = DB::queryfirstrow(
4953 4953
                         'SELECT i.pw, f.personal_folder,i.id_tree, f.title,i.label
4954
-                        FROM ' . prefixTable('items') . ' as i
4955
-                        INNER JOIN ' . prefixTable('nested_tree') . ' as f ON (i.id_tree=f.id)
4954
+                        FROM ' . prefixTable('items').' as i
4955
+                        INNER JOIN ' . prefixTable('nested_tree').' as f ON (i.id_tree=f.id)
4956 4956
                         WHERE i.id=%i',
4957 4957
                         $item_id
4958 4958
                     );
@@ -4975,7 +4975,7 @@  discard block
 block discarded – undo
4975 4975
 
4976 4976
                     // get data about new folder
4977 4977
                     $dataDestination = DB::queryfirstrow(
4978
-                        'SELECT personal_folder, title FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
4978
+                        'SELECT personal_folder, title FROM '.prefixTable('nested_tree').' WHERE id = %i',
4979 4979
                         $inputData['folderId']
4980 4980
                     );
4981 4981
 
@@ -5016,7 +5016,7 @@  discard block
 block discarded – undo
5016 5016
                         // Get fields for this Item
5017 5017
                         $rows = DB::query(
5018 5018
                             'SELECT id
5019
-                            FROM ' . prefixTable('categories_items') . '
5019
+                            FROM ' . prefixTable('categories_items').'
5020 5020
                             WHERE item_id = %i',
5021 5021
                             $item_id
5022 5022
                         );
@@ -5033,7 +5033,7 @@  discard block
 block discarded – undo
5033 5033
                         // Get FILES for this Item
5034 5034
                         $rows = DB::query(
5035 5035
                             'SELECT id
5036
-                            FROM ' . prefixTable('files') . '
5036
+                            FROM ' . prefixTable('files').'
5037 5037
                             WHERE id_item = %i',
5038 5038
                             $item_id
5039 5039
                         );
@@ -5086,7 +5086,7 @@  discard block
 block discarded – undo
5086 5086
                         // Get the ITEM object key for the user
5087 5087
                         $userKey = DB::queryFirstRow(
5088 5088
                             'SELECT share_key
5089
-                            FROM ' . prefixTable('sharekeys_items') . '
5089
+                            FROM ' . prefixTable('sharekeys_items').'
5090 5090
                             WHERE user_id = %i AND object_id = %i',
5091 5091
                             $_SESSION['user_id'],
5092 5092
                             $item_id
@@ -5097,8 +5097,8 @@  discard block
 block discarded – undo
5097 5097
                             // This is a public object
5098 5098
                             $users = DB::query(
5099 5099
                                 'SELECT id, public_key
5100
-                                FROM ' . prefixTable('users') . '
5101
-                                WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '","' . $_SESSION['user_id'] . '")
5100
+                                FROM ' . prefixTable('users').'
5101
+                                WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'","'.$_SESSION['user_id'].'")
5102 5102
                                 AND public_key != ""'
5103 5103
                             );
5104 5104
                             foreach ($users as $user) {
@@ -5118,14 +5118,14 @@  discard block
 block discarded – undo
5118 5118
                         // Get fields for this Item
5119 5119
                         $rows = DB::query(
5120 5120
                             'SELECT id
5121
-                            FROM ' . prefixTable('categories_items') . '
5121
+                            FROM ' . prefixTable('categories_items').'
5122 5122
                             WHERE item_id = %i',
5123 5123
                             $item_id
5124 5124
                         );
5125 5125
                         foreach ($rows as $field) {
5126 5126
                             $userKey = DB::queryFirstRow(
5127 5127
                                 'SELECT share_key
5128
-                                FROM ' . prefixTable('sharekeys_fields') . '
5128
+                                FROM ' . prefixTable('sharekeys_fields').'
5129 5129
                                 WHERE user_id = %i AND object_id = %i',
5130 5130
                                 $_SESSION['user_id'],
5131 5131
                                 $field['id']
@@ -5136,8 +5136,8 @@  discard block
 block discarded – undo
5136 5136
                                 // This is a public object
5137 5137
                                 $users = DB::query(
5138 5138
                                     'SELECT id, public_key
5139
-                                    FROM ' . prefixTable('users') . '
5140
-                                    WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '","' . $_SESSION['user_id'] . '")
5139
+                                    FROM ' . prefixTable('users').'
5140
+                                    WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'","'.$_SESSION['user_id'].'")
5141 5141
                                     AND public_key != ""'
5142 5142
                                 );
5143 5143
                                 foreach ($users as $user) {
@@ -5158,14 +5158,14 @@  discard block
 block discarded – undo
5158 5158
                         // Get FILES for this Item
5159 5159
                         $rows = DB::query(
5160 5160
                             'SELECT id
5161
-                            FROM ' . prefixTable('files') . '
5161
+                            FROM ' . prefixTable('files').'
5162 5162
                             WHERE id_item = %i',
5163 5163
                             $item_id
5164 5164
                         );
5165 5165
                         foreach ($rows as $attachment) {
5166 5166
                             $userKey = DB::queryFirstRow(
5167 5167
                                 'SELECT share_key
5168
-                                FROM ' . prefixTable('sharekeys_files') . '
5168
+                                FROM ' . prefixTable('sharekeys_files').'
5169 5169
                                 WHERE user_id = %i AND object_id = %i',
5170 5170
                                 $_SESSION['user_id'],
5171 5171
                                 $attachment['id']
@@ -5176,8 +5176,8 @@  discard block
 block discarded – undo
5176 5176
                                 // This is a public object
5177 5177
                                 $users = DB::query(
5178 5178
                                     'SELECT id, public_key
5179
-                                    FROM ' . prefixTable('users') . '
5180
-                                    WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '","' . $_SESSION['user_id'] . '")
5179
+                                    FROM ' . prefixTable('users').'
5180
+                                    WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'","'.$_SESSION['user_id'].'")
5181 5181
                                     AND public_key != ""'
5182 5182
                                 );
5183 5183
                                 foreach ($users as $user) {
@@ -5213,13 +5213,13 @@  discard block
 block discarded – undo
5213 5213
                         $_SESSION['user_id'],
5214 5214
                         'at_modification',
5215 5215
                         $_SESSION['login'],
5216
-                        'at_moved : ' . $dataSource['title'] . ' -> ' . $dataDestination['title']
5216
+                        'at_moved : '.$dataSource['title'].' -> '.$dataDestination['title']
5217 5217
                     );
5218 5218
                 }
5219 5219
             }
5220 5220
 
5221 5221
             // reload cache table
5222
-            require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
5222
+            require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
5223 5223
             updateCacheTable('reload', $SETTINGS, null);
5224 5224
 
5225 5225
             echo (string) prepareExchangedData(
@@ -5288,7 +5288,7 @@  discard block
 block discarded – undo
5288 5288
                     // get info
5289 5289
                     $dataSource = DB::queryfirstrow(
5290 5290
                         'SELECT label, id_tree
5291
-                        FROM ' . prefixTable('items') . '
5291
+                        FROM ' . prefixTable('items').'
5292 5292
                         WHERE id=%i',
5293 5293
                         $item_id
5294 5294
                     );
@@ -5393,8 +5393,8 @@  discard block
 block discarded – undo
5393 5393
             }
5394 5394
             if ($inputData['cat'] === 'request_access_to_author') {
5395 5395
                 // Variables
5396
-                $dataAuthor = DB::queryfirstrow('SELECT email,login FROM ' . prefixTable('users') . ' WHERE id = ' . $post_content[1]);
5397
-                $dataItem = DB::queryfirstrow('SELECT label, id_tree FROM ' . prefixTable('items') . ' WHERE id = ' . $post_content[0]);
5396
+                $dataAuthor = DB::queryfirstrow('SELECT email,login FROM '.prefixTable('users').' WHERE id = '.$post_content[1]);
5397
+                $dataItem = DB::queryfirstrow('SELECT label, id_tree FROM '.prefixTable('items').' WHERE id = '.$post_content[0]);
5398 5398
 
5399 5399
                 // Get path
5400 5400
                 $path = geItemReadablePath(
@@ -5408,7 +5408,7 @@  discard block
 block discarded – undo
5408 5408
                         langHdl('email_request_access_subject'),
5409 5409
                         str_replace(
5410 5410
                             array('#tp_item_author#', '#tp_user#', '#tp_item#'),
5411
-                            array(' ' . addslashes($dataAuthor['login']), addslashes($_SESSION['login']), $path),
5411
+                            array(' '.addslashes($dataAuthor['login']), addslashes($_SESSION['login']), $path),
5412 5412
                             langHdl('email_request_access_mail')
5413 5413
                         ),
5414 5414
                         $dataAuthor['email'],
@@ -5419,7 +5419,7 @@  discard block
 block discarded – undo
5419 5419
             } elseif ($inputData['cat'] === 'share_this_item') {
5420 5420
                 $dataItem = DB::queryfirstrow(
5421 5421
                     'SELECT label,id_tree
5422
-                    FROM ' . prefixTable('items') . '
5422
+                    FROM ' . prefixTable('items').'
5423 5423
                     WHERE id= %i',
5424 5424
                     $inputData['id']
5425 5425
                 );
@@ -5443,7 +5443,7 @@  discard block
 block discarded – undo
5443 5443
                             ),
5444 5444
                             array(
5445 5445
                                 empty($SETTINGS['email_server_url']) === false ?
5446
-                                    $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'],
5446
+                                    $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'],
5447 5447
                                 addslashes($_SESSION['login']),
5448 5448
                                 addslashes($path),
5449 5449
                             ),
@@ -5479,7 +5479,7 @@  discard block
 block discarded – undo
5479 5479
             if ($inputData['notifyType'] === 'on_show') {
5480 5480
                 // Check if values already exist
5481 5481
                 $data = DB::queryfirstrow(
5482
-                    'SELECT notification FROM ' . prefixTable('items') . ' WHERE id = %i',
5482
+                    'SELECT notification FROM '.prefixTable('items').' WHERE id = %i',
5483 5483
                     $inputData['itemId']
5484 5484
                 );
5485 5485
                 $notifiedUsers = explode(';', $data['notification']);
@@ -5490,8 +5490,8 @@  discard block
 block discarded – undo
5490 5490
                         prefixTable('items'),
5491 5491
                         array(
5492 5492
                             'notification' => empty($data['notification']) ?
5493
-                                $inputData['userId'] . ';'
5494
-                                : $data['notification'] . $inputData['userId'] ,
5493
+                                $inputData['userId'].';'
5494
+                                : $data['notification'].$inputData['userId'],
5495 5495
                         ),
5496 5496
                         'id=%i',
5497 5497
                         $inputData['itemId']
@@ -5507,7 +5507,7 @@  discard block
 block discarded – undo
5507 5507
                         array(
5508 5508
                             'notification' => empty($data['notification']) ?
5509 5509
                             $inputData['userId']
5510
-                                : $data['notification'] . ';' . $inputData['userId'],
5510
+                                : $data['notification'].';'.$inputData['userId'],
5511 5511
                         ),
5512 5512
                         'id=%i',
5513 5513
                         $inputData['itemId']
@@ -5540,8 +5540,8 @@  discard block
 block discarded – undo
5540 5540
             // Get all informations for this item
5541 5541
             $dataItem = DB::queryfirstrow(
5542 5542
                 'SELECT *
5543
-                FROM ' . prefixTable('items') . ' as i
5544
-                INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
5543
+                FROM ' . prefixTable('items').' as i
5544
+                INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
5545 5545
                 WHERE i.id=%i AND l.action = %s',
5546 5546
                 $dataReceived['item_id'],
5547 5547
                 'at_creation'
@@ -5572,14 +5572,14 @@  discard block
 block discarded – undo
5572 5572
                 );
5573 5573
                 // Prepare new line
5574 5574
                 $data = DB::queryfirstrow(
5575
-                    'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i ORDER BY date DESC',
5575
+                    'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i ORDER BY date DESC',
5576 5576
                     $dataReceived['item_id']
5577 5577
                 );
5578
-                $historic = date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], $data['date']) . ' - ' . $_SESSION['login'] . ' - ' . langHdl($data['action']) . ' - ' . $data['raison'];
5578
+                $historic = date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], $data['date']).' - '.$_SESSION['login'].' - '.langHdl($data['action']).' - '.$data['raison'];
5579 5579
                 // send back
5580 5580
                 $data = array(
5581 5581
                     'error' => '',
5582
-                    'new_line' => '<br>' . addslashes($historic),
5582
+                    'new_line' => '<br>'.addslashes($historic),
5583 5583
                 );
5584 5584
                 echo (string) prepareExchangedData(
5585 5585
                     $SETTINGS['cpassman_dir'],
@@ -5647,7 +5647,7 @@  discard block
 block discarded – undo
5647 5647
             }
5648 5648
 
5649 5649
             // delete all existing old otv codes
5650
-            $rows = DB::query('SELECT id FROM ' . prefixTable('otv') . ' WHERE timestamp < ' . (time() - $SETTINGS['otv_expiration_period'] * 86400));
5650
+            $rows = DB::query('SELECT id FROM '.prefixTable('otv').' WHERE timestamp < '.(time() - $SETTINGS['otv_expiration_period'] * 86400));
5651 5651
             foreach ($rows as $record) {
5652 5652
                 DB::delete(prefixTable('otv'), 'id=%i', $record['id']);
5653 5653
             }
@@ -5669,8 +5669,8 @@  discard block
 block discarded – undo
5669 5669
             // Should we log a password change?
5670 5670
             $itemQ = DB::queryFirstRow(
5671 5671
                 'SELECT s.share_key, i.pw
5672
-                FROM ' . prefixTable('items') . ' AS i
5673
-                INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (i.id = s.object_id)
5672
+                FROM ' . prefixTable('items').' AS i
5673
+                INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (i.id = s.object_id)
5674 5674
                 WHERE s.user_id = %i AND s.object_id = %i',
5675 5675
                 $_SESSION['user_id'],
5676 5676
                 $inputData['id']
@@ -5720,7 +5720,7 @@  discard block
 block discarded – undo
5720 5720
             if (isset($SETTINGS['otv_expiration_period']) === false) {
5721 5721
                 $SETTINGS['otv_expiration_period'] = 7;
5722 5722
             }
5723
-            $url = $SETTINGS['cpassman_url'] . '/index.php?otv=true&' . http_build_query($otv_session);
5723
+            $url = $SETTINGS['cpassman_url'].'/index.php?otv=true&'.http_build_query($otv_session);
5724 5724
             //$exp_date = date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], time() + (intval($SETTINGS['otv_expiration_period']) * 86400));
5725 5725
 
5726 5726
             echo json_encode(
@@ -5759,8 +5759,8 @@  discard block
 block discarded – undo
5759 5759
                 'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status,
5760 5760
                 f.extension AS extension, f.type AS type,
5761 5761
                 s.share_key AS share_key
5762
-                FROM ' . prefixTable('files') . ' AS f
5763
-                INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id)
5762
+                FROM ' . prefixTable('files').' AS f
5763
+                INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id)
5764 5764
                 WHERE s.user_id = %i AND s.object_id = %i',
5765 5765
                 $_SESSION['user_id'],
5766 5766
                 $inputData['id']
@@ -5782,7 +5782,7 @@  discard block
 block discarded – undo
5782 5782
             //$fileName = basename($file_info['name'], '.'.$file_info['extension']);
5783 5783
 
5784 5784
             // prepare image info
5785
-            $post_title = basename($file_info['name'], '.' . $file_info['extension']);
5785
+            $post_title = basename($file_info['name'], '.'.$file_info['extension']);
5786 5786
             $post_title = isBase64($post_title) === true ?
5787 5787
                 base64_decode($post_title) : $post_title;
5788 5788
             $image_code = $file_info['file'];
@@ -5800,7 +5800,7 @@  discard block
 block discarded – undo
5800 5800
     $SETTINGS['cpassman_dir'],
5801 5801
                 array(
5802 5802
                     'error' => false,
5803
-                    'filename' => $post_title . '.' . $file_info['extension'],
5803
+                    'filename' => $post_title.'.'.$file_info['extension'],
5804 5804
                     'file_type' => $file_info['type'],
5805 5805
                     'file_content' => $fileContent,
5806 5806
                 ),
@@ -5854,16 +5854,16 @@  discard block
 block discarded – undo
5854 5854
             $idFolder = $dataReceived['idFolder'];
5855 5855
 
5856 5856
             // don't check if Personal Folder
5857
-            $data = DB::queryFirstRow('SELECT title FROM ' . prefixTable('nested_tree') . ' WHERE id = %i', $idFolder);
5857
+            $data = DB::queryFirstRow('SELECT title FROM '.prefixTable('nested_tree').' WHERE id = %i', $idFolder);
5858 5858
             if ($data['title'] === $_SESSION['user_id']) {
5859 5859
                 // send data
5860
-                echo '[{"duplicate" : "' . $duplicate . '" , error" : ""}]';
5860
+                echo '[{"duplicate" : "'.$duplicate.'" , error" : ""}]';
5861 5861
             } else {
5862 5862
                 if ($inputData['option'] === 'same_folder') {
5863 5863
                     // case unique folder
5864 5864
                     DB::query(
5865 5865
                         'SELECT label
5866
-                        FROM ' . prefixTable('items') . '
5866
+                        FROM ' . prefixTable('items').'
5867 5867
                         WHERE id_tree = %i AND label = %s',
5868 5868
                         $idFolder,
5869 5869
                         $label
@@ -5875,7 +5875,7 @@  discard block
 block discarded – undo
5875 5875
                     $arrayPf = array();
5876 5876
                     if (empty($row['id']) === false) {
5877 5877
                         $rows = DB::query(
5878
-                            'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
5878
+                            'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
5879 5879
                             '1'
5880 5880
                         );
5881 5881
                         foreach ($rows as $record) {
@@ -5890,12 +5890,12 @@  discard block
 block discarded – undo
5890 5890
                     $where->add('id_tree = %i', $idFolder);
5891 5891
                     $where->add('label = %s', $label);
5892 5892
                     if (empty($arrayPf) === false) {
5893
-                        $where->add('id_tree NOT IN (' . implode(',', $arrayPf) . ')');
5893
+                        $where->add('id_tree NOT IN ('.implode(',', $arrayPf).')');
5894 5894
                     }
5895 5895
 
5896 5896
                     DB::query(
5897 5897
                         'SELECT label
5898
-                        FROM ' . prefixTable('items') . '
5898
+                        FROM ' . prefixTable('items').'
5899 5899
                         WHERE %l',
5900 5900
                         $where
5901 5901
                     );
@@ -5907,7 +5907,7 @@  discard block
 block discarded – undo
5907 5907
                 }
5908 5908
 
5909 5909
                 // send data
5910
-                echo '[{"duplicate" : "' . $duplicate . '" , "error" : ""}]';
5910
+                echo '[{"duplicate" : "'.$duplicate.'" , "error" : ""}]';
5911 5911
             }
5912 5912
             break;
5913 5913
 
@@ -5943,7 +5943,7 @@  discard block
 block discarded – undo
5943 5943
             // do we have a cache to be used?            
5944 5944
             $goCachedFolders = loadFoldersListByCache();
5945 5945
             if ($goCachedFolders['state'] === true) {
5946
-                $arr_data['folders'] = json_decode($goCachedFolders['data'], true);//print_r($arr_data);
5946
+                $arr_data['folders'] = json_decode($goCachedFolders['data'], true); //print_r($arr_data);
5947 5947
                 // send data
5948 5948
                 echo (string) prepareExchangedData(
5949 5949
                     $SETTINGS['cpassman_dir'],
@@ -5979,7 +5979,7 @@  discard block
 block discarded – undo
5979 5979
             }
5980 5980
 
5981 5981
             //Build tree
5982
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tree/NestedTree/NestedTree.php';
5982
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tree/NestedTree/NestedTree.php';
5983 5983
             $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
5984 5984
             $tree->rebuild();
5985 5985
             $folders = $tree->getDescendants();
@@ -6029,7 +6029,7 @@  discard block
 block discarded – undo
6029 6029
                             if (empty($arr_data['folders'][$inc]['path']) === true) {
6030 6030
                                 $arr_data['folders'][$inc]['path'] = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
6031 6031
                             } else {
6032
-                                $arr_data['folders'][$inc]['path'] .= ' / ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
6032
+                                $arr_data['folders'][$inc]['path'] .= ' / '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
6033 6033
                             }
6034 6034
                         }
6035 6035
 
@@ -6107,8 +6107,8 @@  discard block
 block discarded – undo
6107 6107
                     $rows_tmp = DB::query(
6108 6108
                         'SELECT c.id, c.title, c.level, c.type, c.masked, c.order, c.encrypted_data, c.role_visibility, c.is_mandatory,
6109 6109
                         f.id_category AS category_id
6110
-                        FROM ' . prefixTable('categories_folders') . ' AS f
6111
-                        INNER JOIN ' . prefixTable('categories') . ' AS c ON (f.id_category = c.parent_id)
6110
+                        FROM ' . prefixTable('categories_folders').' AS f
6111
+                        INNER JOIN ' . prefixTable('categories').' AS c ON (f.id_category = c.parent_id)
6112 6112
                         WHERE id_folder=%i',
6113 6113
                         $folder
6114 6114
                     );
@@ -6135,7 +6135,7 @@  discard block
 block discarded – undo
6135 6135
                 $valTemp = '';
6136 6136
                 $data = DB::queryFirstRow(
6137 6137
                     'SELECT valeur
6138
-                    FROM ' . prefixTable('misc') . '
6138
+                    FROM ' . prefixTable('misc').'
6139 6139
                     WHERE type = %s AND intitule=%i',
6140 6140
                     'complex',
6141 6141
                     $folder
@@ -6152,14 +6152,14 @@  discard block
 block discarded – undo
6152 6152
                 $valTemp = '';
6153 6153
                 $rows_tmp = DB::query(
6154 6154
                     'SELECT t.title
6155
-                    FROM ' . prefixTable('roles_values') . ' as v
6156
-                    INNER JOIN ' . prefixTable('roles_title') . ' as t ON (v.role_id = t.id)
6155
+                    FROM ' . prefixTable('roles_values').' as v
6156
+                    INNER JOIN ' . prefixTable('roles_title').' as t ON (v.role_id = t.id)
6157 6157
                     WHERE v.folder_id = %i
6158 6158
                     GROUP BY title',
6159 6159
                     $folder
6160 6160
                 );
6161 6161
                 foreach ($rows_tmp as $record) {
6162
-                    $valTemp .= (empty($valTemp) === true ? '' : ' - ') . $record['title'];
6162
+                    $valTemp .= (empty($valTemp) === true ? '' : ' - ').$record['title'];
6163 6163
                 }
6164 6164
                 $arr_data[$folder]['visibilityRoles'] = $valTemp;
6165 6165
             }
@@ -6195,7 +6195,7 @@  discard block
 block discarded – undo
6195 6195
             // get item info
6196 6196
             $dataItem = DB::queryFirstRow(
6197 6197
                 'SELECT *
6198
-                FROM ' . prefixTable('items') . '
6198
+                FROM ' . prefixTable('items').'
6199 6199
                 WHERE id=%i',
6200 6200
                 $inputData['itemId']
6201 6201
             );
@@ -6205,8 +6205,8 @@  discard block
 block discarded – undo
6205 6205
             $rows = DB::query(
6206 6206
                 'SELECT l.date as date, l.action as action, l.raison as raison,
6207 6207
                 u.login as login, u.avatar_thumb as avatar_thumb, u.name as name, u.lastname as lastname
6208
-                FROM ' . prefixTable('log_items') . ' as l
6209
-                LEFT JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id)
6208
+                FROM ' . prefixTable('log_items').' as l
6209
+                LEFT JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id)
6210 6210
                 WHERE id_item=%i AND action <> %s
6211 6211
                 ORDER BY date DESC',
6212 6212
                 $inputData['itemId'],
@@ -6221,7 +6221,7 @@  discard block
 block discarded – undo
6221 6221
                 
6222 6222
                 // imported via API
6223 6223
                 if (empty($record['login'])) {
6224
-                    $record['login'] = langHdl('imported_via_api') . ' [' . $record['raison'] . ']';
6224
+                    $record['login'] = langHdl('imported_via_api').' ['.$record['raison'].']';
6225 6225
                 }
6226 6226
 
6227 6227
                 if (
@@ -6232,13 +6232,13 @@  discard block
 block discarded – undo
6232 6232
                 ) {
6233 6233
                     // Prepare avatar
6234 6234
                     if (isset($record['avatar_thumb']) && empty($record['avatar_thumb']) === false) {
6235
-                        if (file_exists($SETTINGS['cpassman_dir'] . '/includes/avatars/' . $record['avatar_thumb'])) {
6236
-                            $avatar = $SETTINGS['cpassman_url'] . '/includes/avatars/' . $record['avatar_thumb'];
6235
+                        if (file_exists($SETTINGS['cpassman_dir'].'/includes/avatars/'.$record['avatar_thumb'])) {
6236
+                            $avatar = $SETTINGS['cpassman_url'].'/includes/avatars/'.$record['avatar_thumb'];
6237 6237
                         } else {
6238
-                            $avatar = $SETTINGS['cpassman_url'] . '/includes/images/photo.jpg';
6238
+                            $avatar = $SETTINGS['cpassman_url'].'/includes/images/photo.jpg';
6239 6239
                         }
6240 6240
                     } else {
6241
-                        $avatar = $SETTINGS['cpassman_url'] . '/includes/images/photo.jpg';
6241
+                        $avatar = $SETTINGS['cpassman_url'].'/includes/images/photo.jpg';
6242 6242
                     }
6243 6243
 
6244 6244
                     // Prepare action
@@ -6255,19 +6255,19 @@  discard block
 block discarded – undo
6255 6255
                         $action = langHdl($reason[0]);
6256 6256
                         if ($reason[0] === 'at_moved') {
6257 6257
                             $tmp = explode(' -> ', $reason[1]);
6258
-                            $detail = langHdl('from') . ' <span class="font-weight-light">' . $tmp[0] . '</span> ' . langHdl('to') . ' <span class="font-weight-light">' . $tmp[1] . ' </span>';
6258
+                            $detail = langHdl('from').' <span class="font-weight-light">'.$tmp[0].'</span> '.langHdl('to').' <span class="font-weight-light">'.$tmp[1].' </span>';
6259 6259
                         } elseif ($reason[0] === 'at_field') {
6260 6260
                             $tmp = explode(' => ', $reason[1]);
6261 6261
                             if (count($tmp) > 1) {
6262
-                                $detail = '<b>' . trim($tmp[0]) . '</b> | ' . langHdl('previous_value') .
6263
-                                    ': <span class="font-weight-light">' . trim($tmp[1]) . '</span>';
6262
+                                $detail = '<b>'.trim($tmp[0]).'</b> | '.langHdl('previous_value').
6263
+                                    ': <span class="font-weight-light">'.trim($tmp[1]).'</span>';
6264 6264
                             } else {
6265 6265
                                 $detail = trim($reason[1]);
6266 6266
                             }
6267 6267
                         } elseif (in_array($reason[0], array('at_restriction', 'at_email', 'at_login', 'at_label', 'at_url', 'at_tag')) === true) {
6268 6268
                             $tmp = explode(' => ', $reason[1]);
6269 6269
                             $detail = empty(trim($tmp[0])) === true ?
6270
-                                langHdl('no_previous_value') : langHdl('previous_value') . ': <span class="font-weight-light">' . $tmp[0] . ' </span>';
6270
+                                langHdl('no_previous_value') : langHdl('previous_value').': <span class="font-weight-light">'.$tmp[0].' </span>';
6271 6271
                         } elseif ($reason[0] === 'at_automatic_del') {
6272 6272
                             $detail = langHdl($reason[1]);
6273 6273
                         } elseif ($reason[0] === 'at_anyoneconmodify') {
@@ -6276,7 +6276,7 @@  discard block
 block discarded – undo
6276 6276
                             $tmp = explode(':', $reason[1]);
6277 6277
                             $tmp = explode('.', $tmp[0]);
6278 6278
                             $detail = isBase64($tmp[0]) === true ?
6279
-                                base64_decode($tmp[0]) . '.' . $tmp[1] : $tmp[0];
6279
+                                base64_decode($tmp[0]).'.'.$tmp[1] : $tmp[0];
6280 6280
                         } elseif ($reason[0] === 'at_import') {
6281 6281
                             $detail = '';
6282 6282
                         } elseif (in_array($reason[0], array('csv', 'pdf')) === true) {
@@ -6295,8 +6295,8 @@  discard block
 block discarded – undo
6295 6295
                         array(
6296 6296
                             'avatar' => $avatar,
6297 6297
                             'login' => $record['login'],
6298
-                            'name' => $record['name'] . ' ' . $record['lastname'],
6299
-                            'date' => date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']),
6298
+                            'name' => $record['name'].' '.$record['lastname'],
6299
+                            'date' => date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']),
6300 6300
                             'action' => $action,
6301 6301
                             'detail' => $detail,
6302 6302
                         )
@@ -6386,18 +6386,18 @@  discard block
 block discarded – undo
6386 6386
 
6387 6387
             // get some info to add to the notification email
6388 6388
             $resp_user = DB::queryfirstrow(
6389
-                'SELECT login FROM ' . prefixTable('users') . ' WHERE id = %i',
6389
+                'SELECT login FROM '.prefixTable('users').' WHERE id = %i',
6390 6390
                 $_SESSION['user_id']
6391 6391
             );
6392 6392
             $resp_folder = DB::queryfirstrow(
6393
-                'SELECT title FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
6393
+                'SELECT title FROM '.prefixTable('nested_tree').' WHERE id = %i',
6394 6394
                 $folder
6395 6395
             );
6396 6396
 
6397 6397
             // notify Managers
6398 6398
             $rows = DB::query(
6399 6399
                 'SELECT email
6400
-                FROM ' . prefixTable('users') . '
6400
+                FROM ' . prefixTable('users').'
6401 6401
                 WHERE `gestionnaire` = %i AND `email` IS NOT NULL',
6402 6402
                 1
6403 6403
             );
@@ -6429,14 +6429,14 @@  discard block
 block discarded – undo
6429 6429
             // Get list of users
6430 6430
             $usersList = array();
6431 6431
             $usersString = '';
6432
-            $rows = DB::query('SELECT id,login,email FROM ' . prefixTable('users') . ' ORDER BY login ASC');
6432
+            $rows = DB::query('SELECT id,login,email FROM '.prefixTable('users').' ORDER BY login ASC');
6433 6433
             foreach ($rows as $record) {
6434 6434
                 $usersList[$record['login']] = array(
6435 6435
                     'id' => $record['id'],
6436 6436
                     'login' => $record['login'],
6437 6437
                     'email' => $record['email'],
6438 6438
                 );
6439
-                $usersString .= $record['id'] . '#' . $record['login'] . ';';
6439
+                $usersString .= $record['id'].'#'.$record['login'].';';
6440 6440
             }
6441 6441
 
6442 6442
             $data = array(
@@ -6446,7 +6446,7 @@  discard block
 block discarded – undo
6446 6446
 
6447 6447
             // send data
6448 6448
             echo (string) prepareExchangedData(
6449
-    $SETTINGS['cpassman_dir'],$data, 'encode');
6449
+    $SETTINGS['cpassman_dir'], $data, 'encode');
6450 6450
             break;
6451 6451
 
6452 6452
         case 'send_request_access':
@@ -6464,7 +6464,7 @@  discard block
 block discarded – undo
6464 6464
             }
6465 6465
             // decrypt and retrieve data in JSON format
6466 6466
             $dataReceived = prepareExchangedData(
6467
-    $SETTINGS['cpassman_dir'],$inputData['data'], 'decode');
6467
+    $SETTINGS['cpassman_dir'], $inputData['data'], 'decode');
6468 6468
 
6469 6469
             // prepare variables
6470 6470
             //$post_email_body = filter_var($dataReceived['email'], FILTER_SANITIZE_STRING);
@@ -6473,7 +6473,7 @@  discard block
 block discarded – undo
6473 6473
             // Send email
6474 6474
             $dataItem = DB::queryfirstrow(
6475 6475
                 'SELECT label, id_tree
6476
-                FROM ' . prefixTable('items') . '
6476
+                FROM ' . prefixTable('items').'
6477 6477
                 WHERE id = %i',
6478 6478
                 $inputData['itemId']
6479 6479
             );
@@ -6562,7 +6562,7 @@  discard block
 block discarded – undo
6562 6562
             }
6563 6563
             // decrypt and retrieve data in JSON format
6564 6564
             $dataReceived = prepareExchangedData(
6565
-    $SETTINGS['cpassman_dir'],$inputData['data'], 'decode');
6565
+    $SETTINGS['cpassman_dir'], $inputData['data'], 'decode');
6566 6566
 
6567 6567
             // prepare variables
6568 6568
             $post_notification_status = (int) filter_var($dataReceived['notification_status'], FILTER_SANITIZE_NUMBER_INT);
@@ -6570,7 +6570,7 @@  discard block
 block discarded – undo
6570 6570
 
6571 6571
             DB::query(
6572 6572
                 'SELECT *
6573
-                FROM ' . prefixTable('notification') . '
6573
+                FROM ' . prefixTable('notification').'
6574 6574
                 WHERE item_id = %i AND user_id = %i',
6575 6575
                 $inputData['itemId'],
6576 6576
                 $_SESSION['user_id']
@@ -6607,7 +6607,7 @@  discard block
 block discarded – undo
6607 6607
 
6608 6608
             // send data
6609 6609
             echo (string) prepareExchangedData(
6610
-    $SETTINGS['cpassman_dir'],$data, 'encode');
6610
+    $SETTINGS['cpassman_dir'], $data, 'encode');
6611 6611
 
6612 6612
             break;
6613 6613
 
@@ -6630,7 +6630,7 @@  discard block
 block discarded – undo
6630 6630
             }
6631 6631
             // decrypt and retrieve data in JSON format
6632 6632
             $dataReceived = prepareExchangedData(
6633
-    $SETTINGS['cpassman_dir'],$inputData['data'], 'decode');
6633
+    $SETTINGS['cpassman_dir'], $inputData['data'], 'decode');
6634 6634
 
6635 6635
             // prepare variables
6636 6636
             $inputData['itemId'] = (int) filter_var($dataReceived['item_id'], FILTER_SANITIZE_NUMBER_INT);
@@ -6639,7 +6639,7 @@  discard block
 block discarded – undo
6639 6639
             // And related logs
6640 6640
             $rows = DB::query(
6641 6641
                 'SELECT id, file AS filename
6642
-                FROM ' . prefixTable('files') . '
6642
+                FROM ' . prefixTable('files').'
6643 6643
                 WHERE id_item = %i AND confirmed = %i',
6644 6644
                 $inputData['itemId'],
6645 6645
                 0
@@ -6653,12 +6653,12 @@  discard block
 block discarded – undo
6653 6653
                 );
6654 6654
 
6655 6655
                 // Delete file on server
6656
-                unlink($SETTINGS['path_to_upload_folder'] . '/' . TP_FILE_PREFIX . base64_decode($file['filename']));
6656
+                unlink($SETTINGS['path_to_upload_folder'].'/'.TP_FILE_PREFIX.base64_decode($file['filename']));
6657 6657
 
6658 6658
                 // Delete related logs
6659 6659
                 $logFile = DB::query(
6660 6660
                     'SELECT increment_id, raison
6661
-                    FROM ' . prefixTable('log_items') . '
6661
+                    FROM ' . prefixTable('log_items').'
6662 6662
                     WHERE id_item = %i AND id_user = %i AND action = %s AND raison LIKE "at_add_file :%"',
6663 6663
                     $inputData['itemId'],
6664 6664
                     $_SESSION['user_id'],
@@ -6683,7 +6683,7 @@  discard block
 block discarded – undo
6683 6683
 
6684 6684
             // send data
6685 6685
             echo (string) prepareExchangedData(
6686
-    $SETTINGS['cpassman_dir'],$data, 'encode');
6686
+    $SETTINGS['cpassman_dir'], $data, 'encode');
6687 6687
 
6688 6688
             break;
6689 6689
 
@@ -6717,7 +6717,7 @@  discard block
 block discarded – undo
6717 6717
             // Confirm attachments
6718 6718
             $rows = DB::query(
6719 6719
                 'SELECT id, file AS filename
6720
-                FROM ' . prefixTable('files') . '
6720
+                FROM ' . prefixTable('files').'
6721 6721
                 WHERE id_item = %i AND confirmed = %i',
6722 6722
                 $inputData['itemId'],
6723 6723
                 0
@@ -6740,7 +6740,7 @@  discard block
 block discarded – undo
6740 6740
 
6741 6741
             // send data
6742 6742
             echo (string) prepareExchangedData(
6743
-    $SETTINGS['cpassman_dir'],$data, 'encode');
6743
+    $SETTINGS['cpassman_dir'], $data, 'encode');
6744 6744
 
6745 6745
             break;
6746 6746
     }
@@ -6755,15 +6755,15 @@  discard block
 block discarded – undo
6755 6755
         case 'autocomplete_tags':
6756 6756
             // Get a list off all existing TAGS
6757 6757
             $listOfTags = '';
6758
-            $rows = DB::query('SELECT tag FROM ' . prefixTable('tags') . ' WHERE tag LIKE %ss GROUP BY tag', $inputData['getTerm']);
6758
+            $rows = DB::query('SELECT tag FROM '.prefixTable('tags').' WHERE tag LIKE %ss GROUP BY tag', $inputData['getTerm']);
6759 6759
             foreach ($rows as $record) {
6760 6760
                 if (empty($listOfTags)) {
6761
-                    $listOfTags = '"' . $record['tag'] . '"';
6761
+                    $listOfTags = '"'.$record['tag'].'"';
6762 6762
                 } else {
6763
-                    $listOfTags .= ', "' . $record['tag'] . '"';
6763
+                    $listOfTags .= ', "'.$record['tag'].'"';
6764 6764
                 }
6765 6765
             }
6766
-            echo '[' . $listOfTags . ']';
6766
+            echo '['.$listOfTags.']';
6767 6767
             break;
6768 6768
     }
6769 6769
 }
@@ -6779,7 +6779,7 @@  discard block
 block discarded – undo
6779 6779
 {
6780 6780
     $data = DB::queryFirstRow(
6781 6781
         'SELECT bloquer_creation, bloquer_modification, personal_folder
6782
-        FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
6782
+        FROM ' . prefixTable('nested_tree').' WHERE id = %i',
6783 6783
         $groupe
6784 6784
     );
6785 6785
     // Check if it's in a personal folder. If yes, then force complexity overhead.
Please login to merge, or discard this patch.
sources/main.functions.php 1 patch
Spacing   +262 added lines, -264 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 
34 34
 // Load config if $SETTINGS not defined
35 35
 if (isset($SETTINGS['cpassman_dir']) === false || empty($SETTINGS['cpassman_dir']) === true) {
36
-    include_once __DIR__ . '/../includes/config/tp.config.php';
36
+    include_once __DIR__.'/../includes/config/tp.config.php';
37 37
 }
38 38
 
39 39
 header('Content-type: text/html; charset=utf-8');
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     $session_language = $superGlobal->get(trim($string), 'SESSION', 'lang');
66 66
     if (isset($session_language) === false) {
67 67
         // Manage error and get English version
68
-        $language_array = include __DIR__. '/../includes/language/english.php';
68
+        $language_array = include __DIR__.'/../includes/language/english.php';
69 69
         print_r($session_language);
70 70
         $session_language = $language_array[trim($string)];
71 71
     }
@@ -116,29 +116,29 @@  discard block
 block discarded – undo
116 116
  */
117 117
 function cryption(string $message, string $ascii_key, string $type, array $SETTINGS): array
118 118
 {
119
-    $ascii_key = empty($ascii_key) === true ? file_get_contents(SECUREPATH . '/teampass-seckey.txt') : $ascii_key;
119
+    $ascii_key = empty($ascii_key) === true ? file_get_contents(SECUREPATH.'/teampass-seckey.txt') : $ascii_key;
120 120
     $err = false;
121 121
     // load PhpEncryption library
122 122
     if (isset($SETTINGS['cpassman_dir']) === false || empty($SETTINGS['cpassman_dir']) === true) {
123 123
         $path = '../includes/libraries/Encryption/Encryption/';
124 124
     } else {
125
-        $path = $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/';
126
-    }
127
-
128
-    include_once $path . 'Exception/CryptoException.php';
129
-    include_once $path . 'Exception/BadFormatException.php';
130
-    include_once $path . 'Exception/EnvironmentIsBrokenException.php';
131
-    include_once $path . 'Exception/IOException.php';
132
-    include_once $path . 'Exception/WrongKeyOrModifiedCiphertextException.php';
133
-    include_once $path . 'Crypto.php';
134
-    include_once $path . 'Encoding.php';
135
-    include_once $path . 'DerivedKeys.php';
136
-    include_once $path . 'Key.php';
137
-    include_once $path . 'KeyOrPassword.php';
138
-    include_once $path . 'File.php';
139
-    include_once $path . 'RuntimeTests.php';
140
-    include_once $path . 'KeyProtectedByPassword.php';
141
-    include_once $path . 'Core.php';
125
+        $path = $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/';
126
+    }
127
+
128
+    include_once $path.'Exception/CryptoException.php';
129
+    include_once $path.'Exception/BadFormatException.php';
130
+    include_once $path.'Exception/EnvironmentIsBrokenException.php';
131
+    include_once $path.'Exception/IOException.php';
132
+    include_once $path.'Exception/WrongKeyOrModifiedCiphertextException.php';
133
+    include_once $path.'Crypto.php';
134
+    include_once $path.'Encoding.php';
135
+    include_once $path.'DerivedKeys.php';
136
+    include_once $path.'Key.php';
137
+    include_once $path.'KeyOrPassword.php';
138
+    include_once $path.'File.php';
139
+    include_once $path.'RuntimeTests.php';
140
+    include_once $path.'KeyProtectedByPassword.php';
141
+    include_once $path.'Core.php';
142 142
     
143 143
     // convert KEY
144 144
     $key = \Defuse\Crypto\Key::loadFromAsciiSafeString($ascii_key);
@@ -183,20 +183,20 @@  discard block
 block discarded – undo
183 183
         $path = '../includes/libraries/Encryption/Encryption/';
184 184
     }
185 185
 
186
-    include_once $path . 'Exception/CryptoException.php';
187
-    include_once $path . 'Exception/BadFormatException.php';
188
-    include_once $path . 'Exception/EnvironmentIsBrokenException.php';
189
-    include_once $path . 'Exception/IOException.php';
190
-    include_once $path . 'Exception/WrongKeyOrModifiedCiphertextException.php';
191
-    include_once $path . 'Crypto.php';
192
-    include_once $path . 'Encoding.php';
193
-    include_once $path . 'DerivedKeys.php';
194
-    include_once $path . 'Key.php';
195
-    include_once $path . 'KeyOrPassword.php';
196
-    include_once $path . 'File.php';
197
-    include_once $path . 'RuntimeTests.php';
198
-    include_once $path . 'KeyProtectedByPassword.php';
199
-    include_once $path . 'Core.php';
186
+    include_once $path.'Exception/CryptoException.php';
187
+    include_once $path.'Exception/BadFormatException.php';
188
+    include_once $path.'Exception/EnvironmentIsBrokenException.php';
189
+    include_once $path.'Exception/IOException.php';
190
+    include_once $path.'Exception/WrongKeyOrModifiedCiphertextException.php';
191
+    include_once $path.'Crypto.php';
192
+    include_once $path.'Encoding.php';
193
+    include_once $path.'DerivedKeys.php';
194
+    include_once $path.'Key.php';
195
+    include_once $path.'KeyOrPassword.php';
196
+    include_once $path.'File.php';
197
+    include_once $path.'RuntimeTests.php';
198
+    include_once $path.'KeyProtectedByPassword.php';
199
+    include_once $path.'Core.php';
200 200
 
201 201
     $key = \Defuse\Crypto\Key::createNewRandomKey();
202 202
     $key = $key->saveToAsciiSafeString();
@@ -221,20 +221,20 @@  discard block
 block discarded – undo
221 221
         $path = '../includes/libraries/Encryption/Encryption/';
222 222
     }
223 223
 
224
-    include_once $path . 'Exception/CryptoException.php';
225
-    include_once $path . 'Exception/BadFormatException.php';
226
-    include_once $path . 'Exception/EnvironmentIsBrokenException.php';
227
-    include_once $path . 'Exception/IOException.php';
228
-    include_once $path . 'Exception/WrongKeyOrModifiedCiphertextException.php';
229
-    include_once $path . 'Crypto.php';
230
-    include_once $path . 'Encoding.php';
231
-    include_once $path . 'DerivedKeys.php';
232
-    include_once $path . 'Key.php';
233
-    include_once $path . 'KeyOrPassword.php';
234
-    include_once $path . 'File.php';
235
-    include_once $path . 'RuntimeTests.php';
236
-    include_once $path . 'KeyProtectedByPassword.php';
237
-    include_once $path . 'Core.php';
224
+    include_once $path.'Exception/CryptoException.php';
225
+    include_once $path.'Exception/BadFormatException.php';
226
+    include_once $path.'Exception/EnvironmentIsBrokenException.php';
227
+    include_once $path.'Exception/IOException.php';
228
+    include_once $path.'Exception/WrongKeyOrModifiedCiphertextException.php';
229
+    include_once $path.'Crypto.php';
230
+    include_once $path.'Encoding.php';
231
+    include_once $path.'DerivedKeys.php';
232
+    include_once $path.'Key.php';
233
+    include_once $path.'KeyOrPassword.php';
234
+    include_once $path.'File.php';
235
+    include_once $path.'RuntimeTests.php';
236
+    include_once $path.'KeyProtectedByPassword.php';
237
+    include_once $path.'Core.php';
238 238
     
239 239
     $protected_key = \Defuse\Crypto\KeyProtectedByPassword::createRandomPasswordProtectedKey($psk);
240 240
     return $protected_key->saveToAsciiSafeString(); // save this in user table
@@ -259,20 +259,20 @@  discard block
 block discarded – undo
259 259
         $path = '../includes/libraries/Encryption/Encryption/';
260 260
     }
261 261
 
262
-    include_once $path . 'Exception/CryptoException.php';
263
-    include_once $path . 'Exception/BadFormatException.php';
264
-    include_once $path . 'Exception/EnvironmentIsBrokenException.php';
265
-    include_once $path . 'Exception/IOException.php';
266
-    include_once $path . 'Exception/WrongKeyOrModifiedCiphertextException.php';
267
-    include_once $path . 'Crypto.php';
268
-    include_once $path . 'Encoding.php';
269
-    include_once $path . 'DerivedKeys.php';
270
-    include_once $path . 'Key.php';
271
-    include_once $path . 'KeyOrPassword.php';
272
-    include_once $path . 'File.php';
273
-    include_once $path . 'RuntimeTests.php';
274
-    include_once $path . 'KeyProtectedByPassword.php';
275
-    include_once $path . 'Core.php';
262
+    include_once $path.'Exception/CryptoException.php';
263
+    include_once $path.'Exception/BadFormatException.php';
264
+    include_once $path.'Exception/EnvironmentIsBrokenException.php';
265
+    include_once $path.'Exception/IOException.php';
266
+    include_once $path.'Exception/WrongKeyOrModifiedCiphertextException.php';
267
+    include_once $path.'Crypto.php';
268
+    include_once $path.'Encoding.php';
269
+    include_once $path.'DerivedKeys.php';
270
+    include_once $path.'Key.php';
271
+    include_once $path.'KeyOrPassword.php';
272
+    include_once $path.'File.php';
273
+    include_once $path.'RuntimeTests.php';
274
+    include_once $path.'KeyProtectedByPassword.php';
275
+    include_once $path.'Core.php';
276 276
 
277 277
     try {
278 278
         $user_key = $protected_key_encoded->unlockKey($psk);
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
  */
314 314
 function trimElement($chaine, string $element): string
315 315
 {
316
-    if (! empty($chaine)) {
316
+    if (!empty($chaine)) {
317 317
         if (is_array($chaine) === true) {
318 318
             $chaine = implode(';', $chaine);
319 319
         }
@@ -361,8 +361,8 @@  discard block
 block discarded – undo
361 361
  */
362 362
 function db_error_handler(array $params): void
363 363
 {
364
-    echo 'Error: ' . $params['error'] . "<br>\n";
365
-    echo 'Query: ' . $params['query'] . "<br>\n";
364
+    echo 'Error: '.$params['error']."<br>\n";
365
+    echo 'Query: '.$params['query']."<br>\n";
366 366
     throw new Exception('Error - Query', 1);
367 367
 }
368 368
 
@@ -384,12 +384,12 @@  discard block
 block discarded – undo
384 384
     $SETTINGS
385 385
 ) {
386 386
     //load ClassLoader
387
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
387
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
388 388
     // Load superglobal
389
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
389
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
390 390
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
391 391
     //Connect to DB
392
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
392
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
393 393
     if (defined('DB_PASSWD_CLEAR') === false) {
394 394
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
395 395
     }
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
     DB::$ssl = DB_SSL;
403 403
     DB::$connect_options = DB_CONNECT_OPTIONS;
404 404
     //Build tree
405
-    $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
405
+    $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
406 406
     $tree->register();
407 407
     $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
408 408
 
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 function identAdmin($idFonctions, $SETTINGS, $tree)
448 448
 {
449 449
     // Load superglobal
450
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
450
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
451 451
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
452 452
     // Init
453 453
     $groupesVisibles = [];
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
     $globalsVisibleFolders = $superGlobal->get('groupes_visibles', 'SESSION');
467 467
     $globalsPersonalVisibleFolders = $superGlobal->get('personal_visible_groups', 'SESSION');
468 468
     // Get list of Folders
469
-    $rows = DB::query('SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', 0);
469
+    $rows = DB::query('SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', 0);
470 470
     foreach ($rows as $record) {
471 471
         array_push($groupesVisibles, $record['id']);
472 472
     }
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
     }
486 486
     // Get ID of personal folder
487 487
     $persfld = DB::queryfirstrow(
488
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE title = %s',
488
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE title = %s',
489 489
         $globalsUserId
490 490
     );
491 491
     if (empty($persfld['id']) === false) {
@@ -506,20 +506,20 @@  discard block
 block discarded – undo
506 506
     // get complete list of ROLES
507 507
     $tmp = explode(';', $idFonctions);
508 508
     $rows = DB::query(
509
-        'SELECT * FROM ' . prefixTable('roles_title') . '
509
+        'SELECT * FROM '.prefixTable('roles_title').'
510 510
         ORDER BY title ASC'
511 511
     );
512 512
     foreach ($rows as $record) {
513
-        if (! empty($record['id']) && ! in_array($record['id'], $tmp)) {
513
+        if (!empty($record['id']) && !in_array($record['id'], $tmp)) {
514 514
             array_push($tmp, $record['id']);
515 515
         }
516 516
     }
517 517
     $superGlobal->put('fonction_id', implode(';', $tmp), 'SESSION');
518 518
     $superGlobal->put('is_admin', 1, 'SESSION');
519 519
     // Check if admin has created Folders and Roles
520
-    DB::query('SELECT * FROM ' . prefixTable('nested_tree') . '');
520
+    DB::query('SELECT * FROM '.prefixTable('nested_tree').'');
521 521
     $superGlobal->put('nb_folders', DB::count(), 'SESSION');
522
-    DB::query('SELECT * FROM ' . prefixTable('roles_title'));
522
+    DB::query('SELECT * FROM '.prefixTable('roles_title'));
523 523
     $superGlobal->put('nb_roles', DB::count(), 'SESSION');
524 524
 
525 525
     return true;
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
     object $tree
566 566
 ) {
567 567
     // Load superglobal
568
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
568
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
569 569
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
570 570
     // Init
571 571
     $superGlobal->put('groupes_visibles', [], 'SESSION');
@@ -604,10 +604,10 @@  discard block
 block discarded – undo
604 604
     // Does this user is allowed to see other items
605 605
     $inc = 0;
606 606
     $rows = DB::query(
607
-        'SELECT id, id_tree FROM ' . prefixTable('items') . '
607
+        'SELECT id, id_tree FROM '.prefixTable('items').'
608 608
             WHERE restricted_to LIKE %ss AND inactif = %s'.
609 609
             (count($allowedFolders) > 0 ? ' AND id_tree NOT IN ('.implode(',', $allowedFolders).')' : ''),
610
-        $globalsUserId . ';',
610
+        $globalsUserId.';',
611 611
         '0'
612 612
     );
613 613
     foreach ($rows as $record) {
@@ -621,8 +621,8 @@  discard block
 block discarded – undo
621 621
     // Check for the users roles if some specific rights exist on items
622 622
     $rows = DB::query(
623 623
         'SELECT i.id_tree, r.item_id
624
-        FROM ' . prefixTable('items') . ' as i
625
-        INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (r.item_id=i.id)
624
+        FROM ' . prefixTable('items').' as i
625
+        INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (r.item_id=i.id)
626 626
         WHERE r.role_id IN %li AND i.id_tree <> ""
627 627
         ORDER BY i.id_tree ASC',
628 628
         $userRoles
@@ -676,16 +676,16 @@  discard block
 block discarded – undo
676 676
         'SESSION'
677 677
     );
678 678
     // Folders and Roles numbers
679
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('nested_tree') . '');
679
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('nested_tree').'');
680 680
     $superGlobal->put('nb_folders', DB::count(), 'SESSION');
681
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('roles_title'));
681
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('roles_title'));
682 682
     $superGlobal->put('nb_roles', DB::count(), 'SESSION');
683 683
     // check if change proposals on User's items
684 684
     if (isset($SETTINGS['enable_suggestion']) === true && (int) $SETTINGS['enable_suggestion'] === 1) {
685 685
         $countNewItems = DB::query(
686 686
             'SELECT COUNT(*)
687
-            FROM ' . prefixTable('items_change') . ' AS c
688
-            LEFT JOIN ' . prefixTable('log_items') . ' AS i ON (c.item_id = i.id_item)
687
+            FROM ' . prefixTable('items_change').' AS c
688
+            LEFT JOIN ' . prefixTable('log_items').' AS i ON (c.item_id = i.id_item)
689 689
             WHERE i.action = %s AND i.id_user = %i',
690 690
             'at_creation',
691 691
             $globalsUserId
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
     
714 714
     $rows = DB::query(
715 715
         'SELECT *
716
-        FROM ' . prefixTable('roles_values') . '
716
+        FROM ' . prefixTable('roles_values').'
717 717
         WHERE role_id IN %li AND type IN %ls',
718 718
         $userRoles,
719 719
         ['W', 'ND', 'NE', 'NDNE', 'R']
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
     ) {
781 781
         $persoFld = DB::queryfirstrow(
782 782
             'SELECT id
783
-            FROM ' . prefixTable('nested_tree') . '
783
+            FROM ' . prefixTable('nested_tree').'
784 784
             WHERE title = %s AND personal_folder = %i'.
785 785
             (count($allowedFolders) > 0 ? ' AND id NOT IN ('.implode(',', $allowedFolders).')' : ''),
786 786
             $globalsUserId,
@@ -813,7 +813,7 @@  discard block
 block discarded – undo
813 813
     }
814 814
     $persoFlds = DB::query(
815 815
         'SELECT id
816
-        FROM ' . prefixTable('nested_tree') . '
816
+        FROM ' . prefixTable('nested_tree').'
817 817
         WHERE %l',
818 818
         $where
819 819
     );
@@ -877,9 +877,9 @@  discard block
 block discarded – undo
877 877
  */
878 878
 function cacheTableRefresh(array $SETTINGS): void
879 879
 {
880
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
880
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
881 881
     //Connect to DB
882
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
882
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
883 883
     if (defined('DB_PASSWD_CLEAR') === false) {
884 884
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
885 885
     }
@@ -896,12 +896,12 @@  discard block
 block discarded – undo
896 896
     $tree->register();
897 897
     $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
898 898
     // truncate table
899
-    DB::query('TRUNCATE TABLE ' . prefixTable('cache'));
899
+    DB::query('TRUNCATE TABLE '.prefixTable('cache'));
900 900
     // reload date
901 901
     $rows = DB::query(
902 902
         'SELECT *
903
-        FROM ' . prefixTable('items') . ' as i
904
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
903
+        FROM ' . prefixTable('items').' as i
904
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
905 905
         AND l.action = %s
906 906
         AND i.inactif = %i',
907 907
         'at_creation',
@@ -913,18 +913,18 @@  discard block
 block discarded – undo
913 913
             $tags = '';
914 914
             $itemTags = DB::query(
915 915
                 'SELECT tag
916
-                FROM ' . prefixTable('tags') . '
916
+                FROM ' . prefixTable('tags').'
917 917
                 WHERE item_id = %i AND tag != ""',
918 918
                 $record['id']
919 919
             );
920 920
             foreach ($itemTags as $itemTag) {
921
-                $tags .= $itemTag['tag'] . ' ';
921
+                $tags .= $itemTag['tag'].' ';
922 922
             }
923 923
 
924 924
             // Get renewal period
925 925
             $resNT = DB::queryfirstrow(
926 926
                 'SELECT renewal_period
927
-                FROM ' . prefixTable('nested_tree') . '
927
+                FROM ' . prefixTable('nested_tree').'
928 928
                 WHERE id = %i',
929 929
                 $record['id_tree']
930 930
             );
@@ -937,7 +937,7 @@  discard block
 block discarded – undo
937 937
                     // Is this a User id?
938 938
                     $user = DB::queryfirstrow(
939 939
                         'SELECT id, login
940
-                        FROM ' . prefixTable('users') . '
940
+                        FROM ' . prefixTable('users').'
941 941
                         WHERE id = %i',
942 942
                         $elem->title
943 943
                     );
@@ -955,11 +955,11 @@  discard block
 block discarded – undo
955 955
                     'id' => $record['id'],
956 956
                     'label' => $record['label'],
957 957
                     'description' => $record['description'] ?? '',
958
-                    'url' => isset($record['url']) && ! empty($record['url']) ? $record['url'] : '0',
958
+                    'url' => isset($record['url']) && !empty($record['url']) ? $record['url'] : '0',
959 959
                     'tags' => $tags,
960 960
                     'id_tree' => $record['id_tree'],
961 961
                     'perso' => $record['perso'],
962
-                    'restricted_to' => isset($record['restricted_to']) && ! empty($record['restricted_to']) ? $record['restricted_to'] : '0',
962
+                    'restricted_to' => isset($record['restricted_to']) && !empty($record['restricted_to']) ? $record['restricted_to'] : '0',
963 963
                     'login' => $record['login'] ?? '',
964 964
                     'folder' => implode(' > ', $folder),
965 965
                     'author' => $record['id_user'],
@@ -981,12 +981,12 @@  discard block
 block discarded – undo
981 981
  */
982 982
 function cacheTableUpdate(array $SETTINGS, ?int $ident = null): void
983 983
 {
984
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
984
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
985 985
     // Load superglobal
986
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
986
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
987 987
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
988 988
     //Connect to DB
989
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
989
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
990 990
     if (defined('DB_PASSWD_CLEAR') === false) {
991 991
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
992 992
     }
@@ -1005,7 +1005,7 @@  discard block
 block discarded – undo
1005 1005
     // get new value from db
1006 1006
     $data = DB::queryfirstrow(
1007 1007
         'SELECT label, description, id_tree, perso, restricted_to, login, url
1008
-        FROM ' . prefixTable('items') . '
1008
+        FROM ' . prefixTable('items').'
1009 1009
         WHERE id=%i',
1010 1010
         $ident
1011 1011
     );
@@ -1013,12 +1013,12 @@  discard block
 block discarded – undo
1013 1013
     $tags = '';
1014 1014
     $itemTags = DB::query(
1015 1015
         'SELECT tag
1016
-            FROM ' . prefixTable('tags') . '
1016
+            FROM ' . prefixTable('tags').'
1017 1017
             WHERE item_id = %i AND tag != ""',
1018 1018
         $ident
1019 1019
     );
1020 1020
     foreach ($itemTags as $itemTag) {
1021
-        $tags .= $itemTag['tag'] . ' ';
1021
+        $tags .= $itemTag['tag'].' ';
1022 1022
     }
1023 1023
     // form id_tree to full foldername
1024 1024
     $folder = [];
@@ -1029,7 +1029,7 @@  discard block
 block discarded – undo
1029 1029
             // Is this a User id?
1030 1030
             $user = DB::queryfirstrow(
1031 1031
                 'SELECT id, login
1032
-                FROM ' . prefixTable('users') . '
1032
+                FROM ' . prefixTable('users').'
1033 1033
                 WHERE id = %i',
1034 1034
                 $elem->title
1035 1035
             );
@@ -1047,10 +1047,10 @@  discard block
 block discarded – undo
1047 1047
             'label' => $data['label'],
1048 1048
             'description' => $data['description'],
1049 1049
             'tags' => $tags,
1050
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
1050
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
1051 1051
             'id_tree' => $data['id_tree'],
1052 1052
             'perso' => $data['perso'],
1053
-            'restricted_to' => isset($data['restricted_to']) && ! empty($data['restricted_to']) ? $data['restricted_to'] : '0',
1053
+            'restricted_to' => isset($data['restricted_to']) && !empty($data['restricted_to']) ? $data['restricted_to'] : '0',
1054 1054
             'login' => $data['login'] ?? '',
1055 1055
             'folder' => implode(' » ', $folder),
1056 1056
             'author' => $superGlobal->get('user_id', 'SESSION'),
@@ -1070,14 +1070,14 @@  discard block
 block discarded – undo
1070 1070
  */
1071 1071
 function cacheTableAdd(array $SETTINGS, ?int $ident = null): void
1072 1072
 {
1073
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1073
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1074 1074
     // Load superglobal
1075
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1075
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1076 1076
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1077 1077
     // Get superglobals
1078 1078
     $globalsUserId = $superGlobal->get('user_id', 'SESSION');
1079 1079
     //Connect to DB
1080
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1080
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1081 1081
     if (defined('DB_PASSWD_CLEAR') === false) {
1082 1082
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1083 1083
     }
@@ -1096,8 +1096,8 @@  discard block
 block discarded – undo
1096 1096
     // get new value from db
1097 1097
     $data = DB::queryFirstRow(
1098 1098
         'SELECT i.label, i.description, i.id_tree as id_tree, i.perso, i.restricted_to, i.id, i.login, i.url, l.date
1099
-        FROM ' . prefixTable('items') . ' as i
1100
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
1099
+        FROM ' . prefixTable('items').' as i
1100
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
1101 1101
         WHERE i.id = %i
1102 1102
         AND l.action = %s',
1103 1103
         $ident,
@@ -1107,12 +1107,12 @@  discard block
 block discarded – undo
1107 1107
     $tags = '';
1108 1108
     $itemTags = DB::query(
1109 1109
         'SELECT tag
1110
-            FROM ' . prefixTable('tags') . '
1110
+            FROM ' . prefixTable('tags').'
1111 1111
             WHERE item_id = %i AND tag != ""',
1112 1112
         $ident
1113 1113
     );
1114 1114
     foreach ($itemTags as $itemTag) {
1115
-        $tags .= $itemTag['tag'] . ' ';
1115
+        $tags .= $itemTag['tag'].' ';
1116 1116
     }
1117 1117
     // form id_tree to full foldername
1118 1118
     $folder = [];
@@ -1123,7 +1123,7 @@  discard block
 block discarded – undo
1123 1123
             // Is this a User id?
1124 1124
             $user = DB::queryfirstrow(
1125 1125
                 'SELECT id, login
1126
-                FROM ' . prefixTable('users') . '
1126
+                FROM ' . prefixTable('users').'
1127 1127
                 WHERE id = %i',
1128 1128
                 $elem->title
1129 1129
             );
@@ -1142,7 +1142,7 @@  discard block
 block discarded – undo
1142 1142
             'label' => $data['label'],
1143 1143
             'description' => $data['description'],
1144 1144
             'tags' => isset($tags) && empty($tags) === false ? $tags : 'None',
1145
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
1145
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
1146 1146
             'id_tree' => $data['id_tree'],
1147 1147
             'perso' => isset($data['perso']) && empty($data['perso']) === false && $data['perso'] !== 'None' ? $data['perso'] : '0',
1148 1148
             'restricted_to' => isset($data['restricted_to']) && empty($data['restricted_to']) === false ? $data['restricted_to'] : '0',
@@ -1164,52 +1164,52 @@  discard block
 block discarded – undo
1164 1164
 function getStatisticsData(array $SETTINGS): array
1165 1165
 {
1166 1166
     DB::query(
1167
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
1167
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
1168 1168
         0
1169 1169
     );
1170 1170
     $counter_folders = DB::count();
1171 1171
     DB::query(
1172
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
1172
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
1173 1173
         1
1174 1174
     );
1175 1175
     $counter_folders_perso = DB::count();
1176 1176
     DB::query(
1177
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
1177
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
1178 1178
         0
1179 1179
     );
1180 1180
     $counter_items = DB::count();
1181 1181
         DB::query(
1182
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
1182
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
1183 1183
         1
1184 1184
     );
1185 1185
     $counter_items_perso = DB::count();
1186 1186
         DB::query(
1187
-        'SELECT id FROM ' . prefixTable('users') . ''
1187
+        'SELECT id FROM '.prefixTable('users').''
1188 1188
     );
1189 1189
     $counter_users = DB::count();
1190 1190
         DB::query(
1191
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE admin = %i',
1191
+        'SELECT id FROM '.prefixTable('users').' WHERE admin = %i',
1192 1192
         1
1193 1193
     );
1194 1194
     $admins = DB::count();
1195 1195
     DB::query(
1196
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE gestionnaire = %i',
1196
+        'SELECT id FROM '.prefixTable('users').' WHERE gestionnaire = %i',
1197 1197
         1
1198 1198
     );
1199 1199
     $managers = DB::count();
1200 1200
     DB::query(
1201
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE read_only = %i',
1201
+        'SELECT id FROM '.prefixTable('users').' WHERE read_only = %i',
1202 1202
         1
1203 1203
     );
1204 1204
     $readOnly = DB::count();
1205 1205
     // list the languages
1206 1206
     $usedLang = [];
1207 1207
     $tp_languages = DB::query(
1208
-        'SELECT name FROM ' . prefixTable('languages')
1208
+        'SELECT name FROM '.prefixTable('languages')
1209 1209
     );
1210 1210
     foreach ($tp_languages as $tp_language) {
1211 1211
         DB::query(
1212
-            'SELECT * FROM ' . prefixTable('users') . ' WHERE user_language = %s',
1212
+            'SELECT * FROM '.prefixTable('users').' WHERE user_language = %s',
1213 1213
             $tp_language['name']
1214 1214
         );
1215 1215
         $usedLang[$tp_language['name']] = round((DB::count() * 100 / $counter_users), 0);
@@ -1218,12 +1218,12 @@  discard block
 block discarded – undo
1218 1218
     // get list of ips
1219 1219
     $usedIp = [];
1220 1220
     $tp_ips = DB::query(
1221
-        'SELECT user_ip FROM ' . prefixTable('users')
1221
+        'SELECT user_ip FROM '.prefixTable('users')
1222 1222
     );
1223 1223
     foreach ($tp_ips as $ip) {
1224 1224
         if (array_key_exists($ip['user_ip'], $usedIp)) {
1225 1225
             $usedIp[$ip['user_ip']] += $usedIp[$ip['user_ip']];
1226
-        } elseif (! empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1226
+        } elseif (!empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1227 1227
             $usedIp[$ip['user_ip']] = 1;
1228 1228
         }
1229 1229
     }
@@ -1289,21 +1289,21 @@  discard block
 block discarded – undo
1289 1289
     }
1290 1290
 
1291 1291
     // Load settings
1292
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
1292
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
1293 1293
     // Load superglobal
1294
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1294
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1295 1295
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1296 1296
     // Get user language
1297
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . (null !== $superGlobal->get('user_language', 'SESSION') ? $superGlobal->get('user_language', 'SESSION') : 'english') . '.php';
1297
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.(null !== $superGlobal->get('user_language', 'SESSION') ? $superGlobal->get('user_language', 'SESSION') : 'english').'.php';
1298 1298
     // Load library
1299
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1299
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1300 1300
     // load PHPMailer
1301
-    $mail = new SplClassLoader('PHPMailer\PHPMailer', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1301
+    $mail = new SplClassLoader('PHPMailer\PHPMailer', $SETTINGS['cpassman_dir'].'/includes/libraries');
1302 1302
     $mail->register();
1303 1303
     $mail = new PHPMailer\PHPMailer\PHPMailer(true);
1304 1304
 
1305 1305
     // send to user
1306
-    $mail->setLanguage('en', $SETTINGS['cpassman_dir'] . '/includes/libraries/PHPMailer/PHPMailer/language/');
1306
+    $mail->setLanguage('en', $SETTINGS['cpassman_dir'].'/includes/libraries/PHPMailer/PHPMailer/language/');
1307 1307
     $mail->SMTPDebug = isset($SETTINGS['email_debug_level']) === true ? $SETTINGS['email_debug_level'] : 0;
1308 1308
     $mail->Port = (int) $SETTINGS['email_port'];
1309 1309
     //COULD BE USED
@@ -1410,7 +1410,7 @@  discard block
 block discarded – undo
1410 1410
         <table width="600" cellpadding="0" cellspacing="0" border="0" class="container" bgcolor="#ffffff" style="border-spacing: 0; border-bottom: 1px solid #e0e0e0; box-shadow: 0 0 3px #ddd; color: #434343; font-family: Helvetica, Verdana, sans-serif;">
1411 1411
         <tr><td class="container-padding" bgcolor="#ffffff" style="border-collapse: collapse; border-left: 1px solid #e0e0e0; background-color: #ffffff; padding-left: 30px; padding-right: 30px;">
1412 1412
         <br><div style="float:right;">' .
1413
-        $textMail .
1413
+        $textMail.
1414 1414
         '<br><br></td></tr></table>
1415 1415
     </td></tr></table>
1416 1416
     <br></body></html>';
@@ -1423,7 +1423,7 @@  discard block
 block discarded – undo
1423 1423
  */
1424 1424
 function generateKey(): string
1425 1425
 {
1426
-    return substr(md5(rand() . rand()), 0, 15);
1426
+    return substr(md5(rand().rand()), 0, 15);
1427 1427
 }
1428 1428
 
1429 1429
 /**
@@ -1494,7 +1494,7 @@  discard block
 block discarded – undo
1494 1494
 {
1495 1495
     array_walk_recursive(
1496 1496
         $array,
1497
-        static function (&$item): void {
1497
+        static function(&$item): void {
1498 1498
             if (mb_detect_encoding((string) $item, 'utf-8', true) === false) {
1499 1499
                 $item = utf8_encode($item);
1500 1500
             }
@@ -1515,9 +1515,9 @@  discard block
 block discarded – undo
1515 1515
  */
1516 1516
 function prepareExchangedData($teampassDir, $data, string $type, ?string $key = null)
1517 1517
 {
1518
-    $teampassDir = __DIR__ . '/..';
1518
+    $teampassDir = __DIR__.'/..';
1519 1519
     // Load superglobal
1520
-    include_once $teampassDir . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1520
+    include_once $teampassDir.'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1521 1521
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1522 1522
     // Get superglobals
1523 1523
     if ($key !== null) {
@@ -1528,9 +1528,9 @@  discard block
 block discarded – undo
1528 1528
     }
1529 1529
 
1530 1530
     //load ClassLoader
1531
-    include_once $teampassDir . '/sources/SplClassLoader.php';
1531
+    include_once $teampassDir.'/sources/SplClassLoader.php';
1532 1532
     //Load CRYPTOJS
1533
-    include_once $teampassDir . '/includes/libraries/Encryption/CryptoJs/Encryption.php';
1533
+    include_once $teampassDir.'/includes/libraries/Encryption/CryptoJs/Encryption.php';
1534 1534
     if ($type === 'encode' && is_array($data) === true) {
1535 1535
         // Ensure UTF8 format
1536 1536
         $data = utf8Converter($data);
@@ -1601,8 +1601,8 @@  discard block
 block discarded – undo
1601 1601
  */
1602 1602
 function prefixTable(string $table): string
1603 1603
 {
1604
-    $safeTable = htmlspecialchars(DB_PREFIX . $table);
1605
-    if (! empty($safeTable)) {
1604
+    $safeTable = htmlspecialchars(DB_PREFIX.$table);
1605
+    if (!empty($safeTable)) {
1606 1606
         // sanitize string
1607 1607
         return $safeTable;
1608 1608
     }
@@ -1632,13 +1632,13 @@  discard block
 block discarded – undo
1632 1632
     bool $lowercase = false,
1633 1633
     array $SETTINGS = []
1634 1634
 ): string {
1635
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1636
-    $generator = new SplClassLoader('PasswordGenerator\Generator', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1635
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1636
+    $generator = new SplClassLoader('PasswordGenerator\Generator', $SETTINGS['cpassman_dir'].'/includes/libraries');
1637 1637
     $generator->register();
1638 1638
     $generator = new PasswordGenerator\Generator\ComputerPasswordGenerator();
1639 1639
     // Is PHP7 being used?
1640 1640
     if (version_compare(PHP_VERSION, '7.0.0', '>=')) {
1641
-        $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1641
+        $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', $SETTINGS['cpassman_dir'].'/includes/libraries');
1642 1642
         $php7generator->register();
1643 1643
         $generator->setRandomGenerator(new PasswordGenerator\RandomGenerator\Php7RandomGenerator());
1644 1644
     }
@@ -1673,7 +1673,7 @@  discard block
 block discarded – undo
1673 1673
 function send_syslog($message, $host, $port, $component = 'teampass'): void
1674 1674
 {
1675 1675
     $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
1676
-    $syslog_message = '<123>' . date('M d H:i:s ') . $component . ': ' . $message;
1676
+    $syslog_message = '<123>'.date('M d H:i:s ').$component.': '.$message;
1677 1677
     socket_sendto($sock, (string) $syslog_message, strlen($syslog_message), 0, (string) $host, (int) $port);
1678 1678
     socket_close($sock);
1679 1679
 }
@@ -1697,7 +1697,7 @@  discard block
 block discarded – undo
1697 1697
     }
1698 1698
 
1699 1699
     // include librairies & connect to DB
1700
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1700
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1701 1701
     if (defined('DB_PASSWD_CLEAR') === false) {
1702 1702
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1703 1703
     }
@@ -1723,14 +1723,14 @@  discard block
 block discarded – undo
1723 1723
     if (isset($SETTINGS['syslog_enable']) === true && (int) $SETTINGS['syslog_enable'] === 1) {
1724 1724
         if ($type === 'user_mngt') {
1725 1725
             send_syslog(
1726
-                'action=' . str_replace('at_', '', $label) . ' attribute=user user=' . $who . ' userid="' . $login . '" change="' . $field_1 . '" ',
1726
+                'action='.str_replace('at_', '', $label).' attribute=user user='.$who.' userid="'.$login.'" change="'.$field_1.'" ',
1727 1727
                 $SETTINGS['syslog_host'],
1728 1728
                 $SETTINGS['syslog_port'],
1729 1729
                 'teampass'
1730 1730
             );
1731 1731
         } else {
1732 1732
             send_syslog(
1733
-                'action=' . $type . ' attribute=' . $label . ' user=' . $who . ' userid="' . $login . '" ',
1733
+                'action='.$type.' attribute='.$label.' user='.$who.' userid="'.$login.'" ',
1734 1734
                 $SETTINGS['syslog_host'],
1735 1735
                 $SETTINGS['syslog_port'],
1736 1736
                 'teampass'
@@ -1764,7 +1764,7 @@  discard block
 block discarded – undo
1764 1764
     ?string $encryption_type = null
1765 1765
 ): void {
1766 1766
     // include librairies & connect to DB
1767
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1767
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1768 1768
     if (defined('DB_PASSWD_CLEAR') === false) {
1769 1769
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1770 1770
     }
@@ -1810,7 +1810,7 @@  discard block
 block discarded – undo
1810 1810
         if (empty($item_label) === true) {
1811 1811
             $dataItem = DB::queryfirstrow(
1812 1812
                 'SELECT id, id_tree, label
1813
-                FROM ' . prefixTable('items') . '
1813
+                FROM ' . prefixTable('items').'
1814 1814
                 WHERE id = %i',
1815 1815
                 $item_id
1816 1816
             );
@@ -1818,11 +1818,11 @@  discard block
 block discarded – undo
1818 1818
         }
1819 1819
 
1820 1820
         send_syslog(
1821
-            'action=' . str_replace('at_', '', $action) .
1822
-                ' attribute=' . str_replace('at_', '', $attribute[0]) .
1823
-                ' itemno=' . $item_id .
1824
-                ' user=' . is_null($login) === true ? '' : addslashes((string) $login) .
1825
-                ' itemname="' . addslashes($item_label) . '"',
1821
+            'action='.str_replace('at_', '', $action).
1822
+                ' attribute='.str_replace('at_', '', $attribute[0]).
1823
+                ' itemno='.$item_id.
1824
+                ' user='.is_null($login) === true ? '' : addslashes((string) $login).
1825
+                ' itemname="'.addslashes($item_label).'"',
1826 1826
             $SETTINGS['syslog_host'],
1827 1827
             $SETTINGS['syslog_port'],
1828 1828
             'teampass'
@@ -1850,7 +1850,7 @@  discard block
 block discarded – undo
1850 1850
         && $action === 'at_shown'
1851 1851
     ) {
1852 1852
         // Load superglobal
1853
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1853
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1854 1854
         $superGlobal = new protect\SuperGlobal\SuperGlobal();
1855 1855
         // Get superglobals
1856 1856
         $globalsLastname = $superGlobal->get('lastname', 'SESSION');
@@ -1859,7 +1859,7 @@  discard block
 block discarded – undo
1859 1859
         // Get info about item
1860 1860
         $dataItem = DB::queryfirstrow(
1861 1861
             'SELECT id, id_tree, label
1862
-            FROM ' . prefixTable('items') . '
1862
+            FROM ' . prefixTable('items').'
1863 1863
             WHERE id = %i',
1864 1864
             $item_id
1865 1865
         );
@@ -1873,9 +1873,9 @@  discard block
 block discarded – undo
1873 1873
                 'body' => str_replace(
1874 1874
                     ['#tp_user#', '#tp_item#', '#tp_link#'],
1875 1875
                     [
1876
-                        addslashes($globalsName . ' ' . $globalsLastname),
1876
+                        addslashes($globalsName.' '.$globalsLastname),
1877 1877
                         addslashes($item_label),
1878
-                        $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $item_id,
1878
+                        $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$item_id,
1879 1879
                     ],
1880 1880
                     langHdl('email_on_open_notification_mail')
1881 1881
                 ),
@@ -1899,7 +1899,7 @@  discard block
 block discarded – undo
1899 1899
 function notifyChangesToSubscribers(int $item_id, string $label, array $changes, array $SETTINGS): void
1900 1900
 {
1901 1901
     // Load superglobal
1902
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1902
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1903 1903
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1904 1904
     // Get superglobals
1905 1905
     $globalsUserId = $superGlobal->get('user_id', 'SESSION');
@@ -1909,8 +1909,8 @@  discard block
 block discarded – undo
1909 1909
     $notification = DB::queryOneColumn(
1910 1910
         'email',
1911 1911
         'SELECT *
1912
-        FROM ' . prefixTable('notification') . ' AS n
1913
-        INNER JOIN ' . prefixTable('users') . ' AS u ON (n.user_id = u.id)
1912
+        FROM ' . prefixTable('notification').' AS n
1913
+        INNER JOIN ' . prefixTable('users').' AS u ON (n.user_id = u.id)
1914 1914
         WHERE n.item_id = %i AND n.user_id != %i',
1915 1915
         $item_id,
1916 1916
         $globalsUserId
@@ -1921,7 +1921,7 @@  discard block
 block discarded – undo
1921 1921
         // Get list of changes
1922 1922
         $htmlChanges = '<ul>';
1923 1923
         foreach ($changes as $change) {
1924
-            $htmlChanges .= '<li>' . $change . '</li>';
1924
+            $htmlChanges .= '<li>'.$change.'</li>';
1925 1925
         }
1926 1926
         $htmlChanges .= '</ul>';
1927 1927
         // send email
@@ -1954,7 +1954,7 @@  discard block
 block discarded – undo
1954 1954
 function geItemReadablePath(int $id_tree, string $label, array $SETTINGS): string
1955 1955
 {
1956 1956
     // Class loader
1957
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1957
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1958 1958
     //Load Tree
1959 1959
     $tree = new SplClassLoader('Tree\NestedTree', '../includes/libraries');
1960 1960
     $tree->register();
@@ -1963,15 +1963,15 @@  discard block
 block discarded – undo
1963 1963
     $path = '';
1964 1964
     foreach ($arbo as $elem) {
1965 1965
         if (empty($path) === true) {
1966
-            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' ';
1966
+            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' ';
1967 1967
         } else {
1968
-            $path .= '&#8594; ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1968
+            $path .= '&#8594; '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1969 1969
         }
1970 1970
     }
1971 1971
 
1972 1972
     // Build text to show user
1973 1973
     if (empty($label) === false) {
1974
-        return empty($path) === true ? addslashes($label) : addslashes($label) . ' (' . $path . ')';
1974
+        return empty($path) === true ? addslashes($label) : addslashes($label).' ('.$path.')';
1975 1975
     }
1976 1976
     return empty($path) === true ? '' : $path;
1977 1977
 }
@@ -2028,9 +2028,9 @@  discard block
 block discarded – undo
2028 2028
  */
2029 2029
 function handleConfigFile($action, $SETTINGS, $field = null, $value = null)
2030 2030
 {
2031
-    $tp_config_file = $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php';
2031
+    $tp_config_file = $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php';
2032 2032
     // include librairies & connect to DB
2033
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2033
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2034 2034
     if (defined('DB_PASSWD_CLEAR') === false) {
2035 2035
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2036 2036
     }
@@ -2045,8 +2045,8 @@  discard block
 block discarded – undo
2045 2045
     if (file_exists($tp_config_file) === false || $action === 'rebuild') {
2046 2046
         // perform a copy
2047 2047
         if (file_exists($tp_config_file)) {
2048
-            if (! copy($tp_config_file, $tp_config_file . '.' . date('Y_m_d_His', time()))) {
2049
-                return "ERROR: Could not copy file '" . $tp_config_file . "'";
2048
+            if (!copy($tp_config_file, $tp_config_file.'.'.date('Y_m_d_His', time()))) {
2049
+                return "ERROR: Could not copy file '".$tp_config_file."'";
2050 2050
             }
2051 2051
         }
2052 2052
 
@@ -2056,11 +2056,11 @@  discard block
 block discarded – undo
2056 2056
         $data[1] = "global \$SETTINGS;\n";
2057 2057
         $data[2] = "\$SETTINGS = array (\n";
2058 2058
         $rows = DB::query(
2059
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s',
2059
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s',
2060 2060
             'admin'
2061 2061
         );
2062 2062
         foreach ($rows as $record) {
2063
-            array_push($data, "    '" . $record['intitule'] . "' => '" . $record['valeur'] . "',\n");
2063
+            array_push($data, "    '".$record['intitule']."' => '".$record['valeur']."',\n");
2064 2064
         }
2065 2065
         array_push($data, ");\n");
2066 2066
         $data = array_unique($data);
@@ -2074,15 +2074,15 @@  discard block
 block discarded – undo
2074 2074
                 break;
2075 2075
             }
2076 2076
 
2077
-            if (stristr($line, "'" . $field . "' => '")) {
2078
-                $data[$inc] = "    '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n";
2077
+            if (stristr($line, "'".$field."' => '")) {
2078
+                $data[$inc] = "    '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n";
2079 2079
                 $bFound = true;
2080 2080
                 break;
2081 2081
             }
2082 2082
             ++$inc;
2083 2083
         }
2084 2084
         if ($bFound === false) {
2085
-            $data[$inc] = "    '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n);\n";
2085
+            $data[$inc] = "    '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n);\n";
2086 2086
         }
2087 2087
     }
2088 2088
 
@@ -2112,7 +2112,7 @@  discard block
 block discarded – undo
2112 2112
 {
2113 2113
     global $SETTINGS;
2114 2114
     /* LOAD CPASSMAN SETTINGS */
2115
-    if (! isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
2115
+    if (!isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
2116 2116
         $SETTINGS = [];
2117 2117
         $SETTINGS['duplicate_folder'] = 0;
2118 2118
         //by default, this is set to 0;
@@ -2122,7 +2122,7 @@  discard block
 block discarded – undo
2122 2122
         //by default, this value is set to 5;
2123 2123
         $settings = [];
2124 2124
         $rows = DB::query(
2125
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s_type OR type=%s_type2',
2125
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s_type OR type=%s_type2',
2126 2126
             [
2127 2127
                 'type' => 'admin',
2128 2128
                 'type2' => 'settings',
@@ -2154,7 +2154,7 @@  discard block
 block discarded – undo
2154 2154
     $source_cf = [];
2155 2155
     $rows = DB::QUERY(
2156 2156
         'SELECT id_category
2157
-            FROM ' . prefixTable('categories_folders') . '
2157
+            FROM ' . prefixTable('categories_folders').'
2158 2158
             WHERE id_folder = %i',
2159 2159
         $source_id
2160 2160
     );
@@ -2165,7 +2165,7 @@  discard block
 block discarded – undo
2165 2165
     $target_cf = [];
2166 2166
     $rows = DB::QUERY(
2167 2167
         'SELECT id_category
2168
-            FROM ' . prefixTable('categories_folders') . '
2168
+            FROM ' . prefixTable('categories_folders').'
2169 2169
             WHERE id_folder = %i',
2170 2170
         $target_id
2171 2171
     );
@@ -2200,9 +2200,9 @@  discard block
 block discarded – undo
2200 2200
     string $password = null
2201 2201
 ) {
2202 2202
     // Load AntiXSS
2203
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php';
2204
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php';
2205
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php';
2203
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php';
2204
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php';
2205
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php';
2206 2206
     $antiXss = new voku\helper\AntiXSS();
2207 2207
     // Protect against bad inputs
2208 2208
     if (is_array($source_file) === true || is_array($target_file) === true) {
@@ -2214,7 +2214,7 @@  discard block
 block discarded – undo
2214 2214
     $target_file = $antiXss->xss_clean($target_file);
2215 2215
     if (empty($password) === true || is_null($password) === true) {
2216 2216
         // get KEY to define password
2217
-        $ascii_key = file_get_contents(SECUREPATH . '/teampass-seckey.txt');
2217
+        $ascii_key = file_get_contents(SECUREPATH.'/teampass-seckey.txt');
2218 2218
         $password = \Defuse\Crypto\Key::loadFromAsciiSafeString($ascii_key);
2219 2219
     }
2220 2220
 
@@ -2259,15 +2259,15 @@  discard block
 block discarded – undo
2259 2259
 ) {
2260 2260
     // load PhpEncryption library
2261 2261
     $path_to_encryption = '/includes/libraries/Encryption/Encryption/';
2262
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php';
2263
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php';
2264
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php';
2265
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php';
2266
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php';
2267
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php';
2268
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php';
2269
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php';
2270
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php';
2262
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php';
2263
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php';
2264
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php';
2265
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php';
2266
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php';
2267
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php';
2268
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php';
2269
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php';
2270
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php';
2271 2271
     try {
2272 2272
         \Defuse\Crypto\File::encryptFileWithPassword(
2273 2273
             $source_file,
@@ -2304,15 +2304,15 @@  discard block
 block discarded – undo
2304 2304
 ) {
2305 2305
     // load PhpEncryption library
2306 2306
     $path_to_encryption = '/includes/libraries/Encryption/Encryption/';
2307
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php';
2308
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php';
2309
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php';
2310
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php';
2311
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php';
2312
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php';
2313
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php';
2314
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php';
2315
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php';
2307
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php';
2308
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php';
2309
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php';
2310
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php';
2311
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php';
2312
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php';
2313
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php';
2314
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php';
2315
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php';
2316 2316
     try {
2317 2317
         \Defuse\Crypto\File::decryptFileWithPassword(
2318 2318
             $source_file,
@@ -2359,9 +2359,9 @@  discard block
 block discarded – undo
2359 2359
 function fileDelete(string $file, array $SETTINGS): void
2360 2360
 {
2361 2361
     // Load AntiXSS
2362
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php';
2363
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php';
2364
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php';
2362
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php';
2363
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php';
2364
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php';
2365 2365
     $antiXss = new voku\helper\AntiXSS();
2366 2366
     $file = $antiXss->xss_clean($file);
2367 2367
     if (is_file($file)) {
@@ -2411,7 +2411,7 @@  discard block
 block discarded – undo
2411 2411
     int  $dirPerm = 0755
2412 2412
 ) {
2413 2413
     // Check if the path exists
2414
-    if (! file_exists($path)) {
2414
+    if (!file_exists($path)) {
2415 2415
         return false;
2416 2416
     }
2417 2417
 
@@ -2449,7 +2449,7 @@  discard block
 block discarded – undo
2449 2449
  */
2450 2450
 function accessToItemIsGranted(int $item_id, array $SETTINGS)
2451 2451
 {
2452
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2452
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2453 2453
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
2454 2454
     // Prepare superGlobal variables
2455 2455
     $session_groupes_visibles = $superGlobal->get('groupes_visibles', 'SESSION');
@@ -2457,7 +2457,7 @@  discard block
 block discarded – undo
2457 2457
     // Load item data
2458 2458
     $data = DB::queryFirstRow(
2459 2459
         'SELECT id_tree
2460
-        FROM ' . prefixTable('items') . '
2460
+        FROM ' . prefixTable('items').'
2461 2461
         WHERE id = %i',
2462 2462
         $item_id
2463 2463
     );
@@ -2520,7 +2520,7 @@  discard block
 block discarded – undo
2520 2520
         }
2521 2521
         $host .= substr(explode(".", $email[1])[0], -1, 1);
2522 2522
     }
2523
-    $email = $name . "@" . $host . "." . explode(".", $email[1])[1];
2523
+    $email = $name."@".$host.".".explode(".", $email[1])[1];
2524 2524
     return $email;
2525 2525
 }
2526 2526
 
@@ -2536,8 +2536,8 @@  discard block
 block discarded – undo
2536 2536
 function performDBQuery(array $SETTINGS, string $fields, string $table): array
2537 2537
 {
2538 2538
     // include librairies & connect to DB
2539
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2540
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2539
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2540
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2541 2541
     if (defined('DB_PASSWD_CLEAR') === false) {
2542 2542
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2543 2543
     }
@@ -2551,7 +2551,7 @@  discard block
 block discarded – undo
2551 2551
     DB::$connect_options = DB_CONNECT_OPTIONS;
2552 2552
     // Insert log in DB
2553 2553
     return DB::query(
2554
-        'SELECT ' . $fields . '
2554
+        'SELECT '.$fields.'
2555 2555
         FROM ' . prefixTable($table)
2556 2556
     );
2557 2557
 }
@@ -2566,11 +2566,11 @@  discard block
 block discarded – undo
2566 2566
 function formatSizeUnits(int $bytes): string
2567 2567
 {
2568 2568
     if ($bytes >= 1073741824) {
2569
-        $bytes = number_format($bytes / 1073741824, 2) . ' GB';
2569
+        $bytes = number_format($bytes / 1073741824, 2).' GB';
2570 2570
     } elseif ($bytes >= 1048576) {
2571
-        $bytes = number_format($bytes / 1048576, 2) . ' MB';
2571
+        $bytes = number_format($bytes / 1048576, 2).' MB';
2572 2572
     } elseif ($bytes >= 1024) {
2573
-        $bytes = number_format($bytes / 1024, 2) . ' KB';
2573
+        $bytes = number_format($bytes / 1024, 2).' KB';
2574 2574
     } elseif ($bytes > 1) {
2575 2575
         $bytes .= ' bytes';
2576 2576
     } elseif ($bytes === 1) {
@@ -2779,14 +2779,14 @@  discard block
 block discarded – undo
2779 2779
 
2780 2780
     // Encrypt the file content
2781 2781
     $plaintext = file_get_contents(
2782
-        filter_var($fileInPath . '/' . $fileInName, FILTER_SANITIZE_URL)
2782
+        filter_var($fileInPath.'/'.$fileInName, FILTER_SANITIZE_URL)
2783 2783
     );
2784 2784
     $ciphertext = $cipher->encrypt($plaintext);
2785 2785
     // Save new file
2786 2786
     $hash = md5($plaintext);
2787
-    $fileOut = $fileInPath . '/' . TP_FILE_PREFIX . $hash;
2787
+    $fileOut = $fileInPath.'/'.TP_FILE_PREFIX.$hash;
2788 2788
     file_put_contents($fileOut, $ciphertext);
2789
-    unlink($fileInPath . '/' . $fileInName);
2789
+    unlink($fileInPath.'/'.$fileInName);
2790 2790
     return [
2791 2791
         'fileHash' => base64_encode($hash),
2792 2792
         'objectKey' => base64_encode($objectKey),
@@ -2804,7 +2804,7 @@  discard block
 block discarded – undo
2804 2804
  */
2805 2805
 function decryptFile(string $fileName, string $filePath, string $key): string
2806 2806
 {
2807
-    if (! defined('FILE_BUFFER_SIZE')) {
2807
+    if (!defined('FILE_BUFFER_SIZE')) {
2808 2808
         define('FILE_BUFFER_SIZE', 128 * 1024);
2809 2809
     }
2810 2810
 
@@ -2823,7 +2823,7 @@  discard block
 block discarded – undo
2823 2823
     $cipher->enableContinuousBuffer();
2824 2824
     $cipher->disablePadding();
2825 2825
     // Get file content
2826
-    $ciphertext = file_get_contents($filePath . '/' . TP_FILE_PREFIX . $fileName);
2826
+    $ciphertext = file_get_contents($filePath.'/'.TP_FILE_PREFIX.$fileName);
2827 2827
     // Decrypt file content and return
2828 2828
     return base64_encode($cipher->decrypt($ciphertext));
2829 2829
 }
@@ -2877,8 +2877,8 @@  discard block
 block discarded – undo
2877 2877
     array $SETTINGS
2878 2878
 ): void {
2879 2879
     // include librairies & connect to DB
2880
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2881
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2880
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2881
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2882 2882
     if (defined('DB_PASSWD_CLEAR') === false) {
2883 2883
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2884 2884
     }
@@ -2897,7 +2897,7 @@  discard block
 block discarded – undo
2897 2897
         $post_object_id
2898 2898
     );
2899 2899
     // Superglobals
2900
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2900
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2901 2901
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
2902 2902
     // Prepare superGlobal variables
2903 2903
     $sessionPpersonaFolders = $superGlobal->get('personal_folders', 'SESSION');
@@ -2922,8 +2922,8 @@  discard block
 block discarded – undo
2922 2922
         // Create sharekey for each user
2923 2923
         $users = DB::query(
2924 2924
             'SELECT id, public_key
2925
-            FROM ' . prefixTable('users') . '
2926
-            WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '")
2925
+            FROM ' . prefixTable('users').'
2926
+            WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'")
2927 2927
             AND public_key != ""'
2928 2928
         );
2929 2929
         foreach ($users as $user) {
@@ -2953,7 +2953,7 @@  discard block
 block discarded – undo
2953 2953
 function isBase64(string $str): bool
2954 2954
 {
2955 2955
     $str = (string) trim($str);
2956
-    if (! isset($str[0])) {
2956
+    if (!isset($str[0])) {
2957 2957
         return false;
2958 2958
     }
2959 2959
 
@@ -3021,12 +3021,12 @@  discard block
 block discarded – undo
3021 3021
         ],
3022 3022
     ];
3023 3023
     // Load expected libraries
3024
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
3025
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php';
3026
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php';
3027
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php';
3028
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php';
3029
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php';
3024
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
3025
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php';
3026
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php';
3027
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php';
3028
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php';
3029
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php';
3030 3030
     $ad = new SplClassLoader('LdapRecord', '../includes/libraries');
3031 3031
     $ad->register();
3032 3032
     $connection = new Connection($config);
@@ -3035,7 +3035,7 @@  discard block
 block discarded – undo
3035 3035
         $connection->connect();
3036 3036
     } catch (\LdapRecord\Auth\BindException $e) {
3037 3037
         $error = $e->getDetailedError();
3038
-        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage();
3038
+        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage();
3039 3039
         return false;
3040 3040
     }
3041 3041
 
@@ -3048,7 +3048,7 @@  discard block
 block discarded – undo
3048 3048
         }
3049 3049
     } catch (\LdapRecord\Auth\BindException $e) {
3050 3050
         $error = $e->getDetailedError();
3051
-        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage();
3051
+        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage();
3052 3052
         return false;
3053 3053
     }
3054 3054
 
@@ -3066,8 +3066,8 @@  discard block
 block discarded – undo
3066 3066
 function deleteUserObjetsKeys(int $userId, array $SETTINGS): bool
3067 3067
 {
3068 3068
     // include librairies & connect to DB
3069
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
3070
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
3069
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
3070
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
3071 3071
     if (defined('DB_PASSWD_CLEAR') === false) {
3072 3072
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
3073 3073
     }
@@ -3127,7 +3127,7 @@  discard block
 block discarded – undo
3127 3127
         foreach (DateTimeZone::listIdentifiers() as $timezone) {
3128 3128
             $now->setTimezone(new DateTimeZone($timezone));
3129 3129
             $offsets[] = $offset = $now->getOffset();
3130
-            $timezones[$timezone] = '(' . format_GMT_offset($offset) . ') ' . format_timezone_name($timezone);
3130
+            $timezones[$timezone] = '('.format_GMT_offset($offset).') '.format_timezone_name($timezone);
3131 3131
         }
3132 3132
 
3133 3133
         array_multisort($offsets, $timezones);
@@ -3147,7 +3147,7 @@  discard block
 block discarded – undo
3147 3147
 {
3148 3148
     $hours = intval($offset / 3600);
3149 3149
     $minutes = abs(intval($offset % 3600 / 60));
3150
-    return 'GMT' . ($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
3150
+    return 'GMT'.($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
3151 3151
 }
3152 3152
 
3153 3153
 /**
@@ -3250,8 +3250,7 @@  discard block
 block discarded – undo
3250 3250
 {
3251 3251
     if (isset($array[$key]) === true
3252 3252
         && (is_int($value) === true ?
3253
-            (int) $array[$key] === $value :
3254
-            (string) $array[$key] === $value)
3253
+            (int) $array[$key] === $value : (string) $array[$key] === $value)
3255 3254
     ) {
3256 3255
         return true;
3257 3256
     }
@@ -3273,8 +3272,7 @@  discard block
 block discarded – undo
3273 3272
 {
3274 3273
     if (isset($var) === false
3275 3274
         || (is_int($value) === true ?
3276
-            (int) $var === $value :
3277
-            (string) $var === $value)
3275
+            (int) $var === $value : (string) $var === $value)
3278 3276
     ) {
3279 3277
         return true;
3280 3278
     }
@@ -3325,7 +3323,7 @@  discard block
 block discarded – undo
3325 3323
  */
3326 3324
 function isSetArrayOfValues(array $arrayOfValues): bool
3327 3325
 {
3328
-    foreach($arrayOfValues as $value) {
3326
+    foreach ($arrayOfValues as $value) {
3329 3327
         if (isset($value) === false) {
3330 3328
             return false;
3331 3329
         }
@@ -3347,7 +3345,7 @@  discard block
 block discarded – undo
3347 3345
     /*PHP8 - integer|string*/$value
3348 3346
 ) : bool
3349 3347
 {
3350
-    foreach($arrayOfVars as $variable) {
3348
+    foreach ($arrayOfVars as $variable) {
3351 3349
         if ($variable !== $value) {
3352 3350
             return false;
3353 3351
         }
@@ -3367,7 +3365,7 @@  discard block
 block discarded – undo
3367 3365
     /*PHP8 - integer|string*/$value
3368 3366
 ) : bool
3369 3367
 {
3370
-    foreach($arrayOfVars as $variable) {
3368
+    foreach ($arrayOfVars as $variable) {
3371 3369
         if ($variable === $value) {
3372 3370
             return true;
3373 3371
         }
@@ -3440,16 +3438,16 @@  discard block
 block discarded – undo
3440 3438
 ): array
3441 3439
 {
3442 3440
     // Load Sanitizer library
3443
-    require_once $path . '/includes/libraries/Illuminate/Support/Traits/Macroable.php';
3444
-    require_once $path . '/includes/libraries/Illuminate/Support/Str.php';
3445
-    require_once $path . '/includes/libraries/Illuminate/Validation/ValidationRuleParser.php';
3446
-    require_once $path . '/includes/libraries/Illuminate/Support/Arr.php';
3447
-    require_once $path . '/includes/libraries/Elegant/sanitizer/Contracts/Filter.php';
3448
-    require_once $path . '/includes/libraries/Elegant/sanitizer/Filters/Trim.php';
3449
-    require_once $path . '/includes/libraries/Elegant/sanitizer/Filters/Cast.php';
3450
-    require_once $path . '/includes/libraries/Elegant/sanitizer/Filters/EscapeHTML.php';
3451
-    require_once $path . '/includes/libraries/Elegant/sanitizer/Filters/EmptyStringToNull.php';
3452
-    require_once $path . '/includes/libraries/Elegant/sanitizer/Sanitizer.php';
3441
+    require_once $path.'/includes/libraries/Illuminate/Support/Traits/Macroable.php';
3442
+    require_once $path.'/includes/libraries/Illuminate/Support/Str.php';
3443
+    require_once $path.'/includes/libraries/Illuminate/Validation/ValidationRuleParser.php';
3444
+    require_once $path.'/includes/libraries/Illuminate/Support/Arr.php';
3445
+    require_once $path.'/includes/libraries/Elegant/sanitizer/Contracts/Filter.php';
3446
+    require_once $path.'/includes/libraries/Elegant/sanitizer/Filters/Trim.php';
3447
+    require_once $path.'/includes/libraries/Elegant/sanitizer/Filters/Cast.php';
3448
+    require_once $path.'/includes/libraries/Elegant/sanitizer/Filters/EscapeHTML.php';
3449
+    require_once $path.'/includes/libraries/Elegant/sanitizer/Filters/EmptyStringToNull.php';
3450
+    require_once $path.'/includes/libraries/Elegant/sanitizer/Sanitizer.php';
3453 3451
 
3454 3452
     // Sanitize post and get variables
3455 3453
     $sanitizer = new Elegant\sanitizer\Sanitizer($data, $filters);
@@ -3467,9 +3465,9 @@  discard block
 block discarded – undo
3467 3465
  */
3468 3466
 function cacheTreeUserHandler(int $user_id, string $data, array $SETTINGS, string $field_update = '')
3469 3467
 {
3470
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
3468
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
3471 3469
     //Connect to DB
3472
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
3470
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
3473 3471
     if (defined('DB_PASSWD_CLEAR') === false) {
3474 3472
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
3475 3473
     }
@@ -3485,7 +3483,7 @@  discard block
 block discarded – undo
3485 3483
     // Exists ?
3486 3484
     $userCacheId = DB::queryfirstrow(
3487 3485
         'SELECT increment_id
3488
-        FROM ' . prefixTable('cache_tree') . '
3486
+        FROM ' . prefixTable('cache_tree').'
3489 3487
         WHERE user_id = %i',
3490 3488
         $user_id
3491 3489
     );
@@ -3533,7 +3531,7 @@  discard block
 block discarded – undo
3533 3531
  */
3534 3532
 function pourcentage(float $nombre, float $total, float $pourcentage): float
3535 3533
 { 
3536
-    $resultat = ($nombre/$total) * $pourcentage;
3534
+    $resultat = ($nombre / $total) * $pourcentage;
3537 3535
     return round($resultat);
3538 3536
 }
3539 3537
 
@@ -3551,7 +3549,7 @@  discard block
 block discarded – undo
3551 3549
 
3552 3550
     // Get last folder update
3553 3551
     $lastFolderChange = DB::queryfirstrow(
3554
-        'SELECT valeur FROM ' . prefixTable('misc') . '
3552
+        'SELECT valeur FROM '.prefixTable('misc').'
3555 3553
         WHERE type = %s AND intitule = %s',
3556 3554
         'timestamp',
3557 3555
         'last_folder_change'
@@ -3584,7 +3582,7 @@  discard block
 block discarded – undo
3584 3582
     // Does this user has a tree cache
3585 3583
     $userCacheTree = DB::queryfirstrow(
3586 3584
         'SELECT visible_folders
3587
-        FROM ' . prefixTable('cache_tree') . '
3585
+        FROM ' . prefixTable('cache_tree').'
3588 3586
         WHERE user_id = %i',
3589 3587
         $_SESSION['user_id']
3590 3588
     );
Please login to merge, or discard this patch.