Passed
Push — teampass_3.0 ( ba9006...b28540 )
by Nils
10:11
created
sources/folders.queries.php 1 patch
Spacing   +46 added lines, -46 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'], 'folders', $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,14 +55,14 @@  discard block
 block discarded – undo
55 55
     date_default_timezone_set('UTC');
56 56
 }
57 57
 
58
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
58
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
59 59
 header('Content-type: text/html; charset=utf-8');
60
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
61
-require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
62
-require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
60
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
61
+require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
62
+require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
63 63
 
64 64
 // Connect to mysql server
65
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
65
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
66 66
 if (defined('DB_PASSWD_CLEAR') === false) {
67 67
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
68 68
 }
@@ -132,14 +132,14 @@  discard block
 block discarded – undo
132 132
                     && $t->personal_folder == 0
133 133
                 ) {
134 134
                     // get $t->parent_id
135
-                    $data = DB::queryFirstRow('SELECT title FROM ' . prefixTable('nested_tree') . ' WHERE id = %i', $t->parent_id);
135
+                    $data = DB::queryFirstRow('SELECT title FROM '.prefixTable('nested_tree').' WHERE id = %i', $t->parent_id);
136 136
                     if ($t->nlevel == 1) {
137 137
                         $data['title'] = langHdl('root');
138 138
                     }
139 139
 
140 140
                     // get rights on this folder
141 141
                     $arrayRights = array();
142
-                    $rows = DB::query('SELECT fonction_id  FROM ' . prefixTable('rights') . ' WHERE authorized=%i AND tree_id = %i', 1, $t->id);
142
+                    $rows = DB::query('SELECT fonction_id  FROM '.prefixTable('rights').' WHERE authorized=%i AND tree_id = %i', 1, $t->id);
143 143
                     foreach ($rows as $record) {
144 144
                         array_push($arrayRights, $record['fonction_id']);
145 145
                     }
@@ -156,8 +156,8 @@  discard block
 block discarded – undo
156 156
                     $node_data = DB::queryFirstRow(
157 157
                         'SELECT m.valeur AS valeur, n.renewal_period AS renewal_period,
158 158
                         n.bloquer_creation AS bloquer_creation, n.bloquer_modification AS bloquer_modification
159
-                        FROM ' . prefixTable('misc') . ' AS m,
160
-                        ' . prefixTable('nested_tree') . ' AS n
159
+                        FROM ' . prefixTable('misc').' AS m,
160
+                        ' . prefixTable('nested_tree').' AS n
161 161
                         WHERE m.type=%s AND m.intitule = n.id AND m.intitule = %i',
162 162
                         'complex',
163 163
                         $t->id
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
                     //col7
191 191
                     $data7 = DB::queryFirstRow(
192 192
                         'SELECT bloquer_creation,bloquer_modification
193
-                        FROM ' . prefixTable('nested_tree') . '
193
+                        FROM ' . prefixTable('nested_tree').'
194 194
                         WHERE id = %i',
195 195
                         intval($t->id)
196 196
                     );
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
             // Get info about this folder
326 326
             $dataFolder = DB::queryfirstrow(
327 327
                 'SELECT *
328
-                FROM ' . prefixTable('nested_tree') . '
328
+                FROM ' . prefixTable('nested_tree').'
329 329
                 WHERE id = %i',
330 330
                 $post_folder_id
331 331
             );
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
             //check if parent folder is personal
362 362
             $dataParent = DB::queryfirstrow(
363 363
                 'SELECT personal_folder, bloquer_creation, bloquer_modification
364
-                FROM ' . prefixTable('nested_tree') . '
364
+                FROM ' . prefixTable('nested_tree').'
365 365
                 WHERE id = %i',
366 366
                 $post_parent_id
367 367
             );
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
                     // get complexity level for this folder
391 391
                     $data = DB::queryfirstrow(
392 392
                         'SELECT valeur
393
-                        FROM ' . prefixTable('misc') . '
393
+                        FROM ' . prefixTable('misc').'
394 394
                         WHERE intitule = %i AND type = %s',
395 395
                         $post_parent_id,
396 396
                         'complex'
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
                             array(
402 402
                                 'error' => true,
403 403
                                 'message' => langHdl('error_folder_complexity_lower_than_top_folder')
404
-                                    . ' [<b>' . TP_PW_COMPLEXITY[$data['valeur']][1] . '</b>]',
404
+                                    . ' [<b>'.TP_PW_COMPLEXITY[$data['valeur']][1].'</b>]',
405 405
                             ),
406 406
                             'encode'
407 407
                         );
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
             ) {
555 555
                 DB::query(
556 556
                     'SELECT *
557
-                    FROM ' . prefixTable('nested_tree') . '
557
+                    FROM ' . prefixTable('nested_tree').'
558 558
                     WHERE title = %s',
559 559
                     $post_title
560 560
                 );
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
             //check if parent folder is personal
575 575
             $data = DB::queryfirstrow(
576 576
                 'SELECT personal_folder, bloquer_creation, bloquer_modification
577
-                FROM ' . prefixTable('nested_tree') . '
577
+                FROM ' . prefixTable('nested_tree').'
578 578
                 WHERE id = %i',
579 579
                 $post_parent_id
580 580
             );
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
                     // get complexity level for this folder
604 604
                     $data = DB::queryfirstrow(
605 605
                         'SELECT valeur
606
-                        FROM ' . prefixTable('misc') . '
606
+                        FROM ' . prefixTable('misc').'
607 607
                         WHERE intitule = %i AND type = %s',
608 608
                         $post_parent_id,
609 609
                         'complex'
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
                             array(
614 614
                                 'error' => true,
615 615
                                 'message' => langHdl('error_folder_complexity_lower_than_top_folder')
616
-                                    . ' [<b>' . TP_PW_COMPLEXITY[$data['valeur']][1] . '</b>]',
616
+                                    . ' [<b>'.TP_PW_COMPLEXITY[$data['valeur']][1].'</b>]',
617 617
                             ),
618 618
                             'encode'
619 619
                         );
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
                     && (int) $SETTINGS['subfolder_rights_as_parent'] === 1
688 688
                 ) {
689 689
                     //If it is a subfolder, then give access to it for all roles that allows the parent folder
690
-                    $rows = DB::query('SELECT role_id, type FROM ' . prefixTable('roles_values') . ' WHERE folder_id = %i', $post_parent_id);
690
+                    $rows = DB::query('SELECT role_id, type FROM '.prefixTable('roles_values').' WHERE folder_id = %i', $post_parent_id);
691 691
                     foreach ($rows as $record) {
692 692
                         //add access to this subfolder
693 693
                         DB::insert(
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
                 }
703 703
 
704 704
                 // if parent folder has Custom Fields Categories then add to this child one too
705
-                $rows = DB::query('SELECT id_category FROM ' . prefixTable('categories_folders') . ' WHERE id_folder = %i', $post_parent_id);
705
+                $rows = DB::query('SELECT id_category FROM '.prefixTable('categories_folders').' WHERE id_folder = %i', $post_parent_id);
706 706
                 foreach ($rows as $record) {
707 707
                     //add CF Category to this subfolder
708 708
                     DB::insert(
@@ -779,17 +779,17 @@  discard block
 block discarded – undo
779 779
                                 prefixTable('misc'),
780 780
                                 array(
781 781
                                     'type' => 'folder_deleted',
782
-                                    'intitule' => 'f' . $folder->id,
783
-                                    'valeur' => $folder->id . ', ' . $folder->parent_id . ', ' .
784
-                                        $folder->title . ', ' . $folder->nleft . ', ' . $folder->nright . ', ' .
785
-                                        $folder->nlevel . ', 0, 0, 0, 0',
782
+                                    'intitule' => 'f'.$folder->id,
783
+                                    'valeur' => $folder->id.', '.$folder->parent_id.', '.
784
+                                        $folder->title.', '.$folder->nleft.', '.$folder->nright.', '.
785
+                                        $folder->nlevel.', 0, 0, 0, 0',
786 786
                                 )
787 787
                             );
788 788
                             //array for delete folder
789 789
                             $folderForDel[] = $folder->id;
790 790
 
791 791
                             //delete items & logs
792
-                            $items = DB::query('SELECT id FROM ' . prefixTable('items') . ' WHERE id_tree=%i', $folder->id);
792
+                            $items = DB::query('SELECT id FROM '.prefixTable('items').' WHERE id_tree=%i', $folder->id);
793 793
                             foreach ($items as $item) {
794 794
                                 DB::update(
795 795
                                     prefixTable('items'),
@@ -846,7 +846,7 @@  discard block
 block discarded – undo
846 846
             $tree->rebuild();
847 847
 
848 848
             // reload cache table
849
-            include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
849
+            include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
850 850
             updateCacheTable('reload', $SETTINGS, null);
851 851
 
852 852
             echo prepareExchangedData(
@@ -932,7 +932,7 @@  discard block
 block discarded – undo
932 932
                 // get complexity of current node
933 933
                 $nodeComplexity = DB::queryfirstrow(
934 934
                     'SELECT valeur
935
-                    FROM ' . prefixTable('misc') . '
935
+                    FROM ' . prefixTable('misc').'
936 936
                     WHERE intitule = %i AND type= %s',
937 937
                     $nodeInfo->id,
938 938
                     'complex'
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
                 // If it is a subfolder, then give access to it for all roles that allows the parent folder
1008 1008
                 $rows = DB::query(
1009 1009
                     'SELECT role_id, type
1010
-                    FROM ' . prefixTable('roles_values') . '
1010
+                    FROM ' . prefixTable('roles_values').'
1011 1011
                     WHERE folder_id = %i',
1012 1012
                     $parentId
1013 1013
                 );
@@ -1015,7 +1015,7 @@  discard block
 block discarded – undo
1015 1015
                     // Add access to this subfolder after checking that it is not already set
1016 1016
                     DB::query(
1017 1017
                         'SELECT *
1018
-                        FROM ' . prefixTable('roles_values') . '
1018
+                        FROM ' . prefixTable('roles_values').'
1019 1019
                         WHERE folder_id = %i AND role_id = %i',
1020 1020
                         $newFolderId,
1021 1021
                         $record['role_id']
@@ -1035,7 +1035,7 @@  discard block
 block discarded – undo
1035 1035
                 // if parent folder has Custom Fields Categories then add to this child one too
1036 1036
                 $rows = DB::query(
1037 1037
                     'SELECT id_category
1038
-                    FROM ' . prefixTable('categories_folders') . '
1038
+                    FROM ' . prefixTable('categories_folders').'
1039 1039
                     WHERE id_folder = %i',
1040 1040
                     $nodeInfo->id
1041 1041
                 );
@@ -1054,7 +1054,7 @@  discard block
 block discarded – undo
1054 1054
 
1055 1055
                 $rows = DB::query(
1056 1056
                     'SELECT *
1057
-                    FROM ' . prefixTable('items') . '
1057
+                    FROM ' . prefixTable('items').'
1058 1058
                     WHERE id_tree = %i',
1059 1059
                     $nodeInfo->id
1060 1060
                 );
@@ -1063,7 +1063,7 @@  discard block
 block discarded – undo
1063 1063
                     // if it is then don't copy it
1064 1064
                     $item_deleted = DB::queryFirstRow(
1065 1065
                         'SELECT *
1066
-                        FROM ' . prefixTable('log_items') . '
1066
+                        FROM ' . prefixTable('log_items').'
1067 1067
                         WHERE id_item = %i AND action = %s
1068 1068
                         ORDER BY date DESC
1069 1069
                         LIMIT 0, 1',
@@ -1074,7 +1074,7 @@  discard block
 block discarded – undo
1074 1074
 
1075 1075
                     $item_restored = DB::queryFirstRow(
1076 1076
                         'SELECT *
1077
-                        FROM ' . prefixTable('log_items') . '
1077
+                        FROM ' . prefixTable('log_items').'
1078 1078
                         WHERE id_item = %i AND action = %s
1079 1079
                         ORDER BY date DESC
1080 1080
                         LIMIT 0, 1',
@@ -1089,7 +1089,7 @@  discard block
 block discarded – undo
1089 1089
                         // Get the ITEM object key for the user
1090 1090
                         $userKey = DB::queryFirstRow(
1091 1091
                             'SELECT share_key
1092
-                            FROM ' . prefixTable('sharekeys_items') . '
1092
+                            FROM ' . prefixTable('sharekeys_items').'
1093 1093
                             WHERE user_id = %i AND object_id = %i',
1094 1094
                             $_SESSION['user_id'],
1095 1095
                             $record['id']
@@ -1163,7 +1163,7 @@  discard block
 block discarded – undo
1163 1163
                         // Manage Custom Fields
1164 1164
                         $categories = DB::query(
1165 1165
                             'SELECT *
1166
-                            FROM ' . prefixTable('categories_items') . '
1166
+                            FROM ' . prefixTable('categories_items').'
1167 1167
                             WHERE item_id = %i',
1168 1168
                             $record['id']
1169 1169
                         );
@@ -1211,15 +1211,15 @@  discard block
 block discarded – undo
1211 1211
                         $files = DB::query(
1212 1212
                             'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status, f.extension AS extension,
1213 1213
                             f.size AS size, f.type AS type, s.share_key AS share_key
1214
-                            FROM ' . prefixTable('files') . ' AS f
1215
-                            INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id)
1214
+                            FROM ' . prefixTable('files').' AS f
1215
+                            INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id)
1216 1216
                             WHERE s.user_id = %i AND f.id_item = %i',
1217 1217
                             $_SESSION['user_id'],
1218 1218
                             $record['id']
1219 1219
                         );
1220 1220
                         foreach ($files as $file) {
1221 1221
                             // Check if file still exists
1222
-                            if (file_exists($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . TP_FILE_PREFIX . base64_decode($file['file'])) === true) {
1222
+                            if (file_exists($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.TP_FILE_PREFIX.base64_decode($file['file'])) === true) {
1223 1223
                                 // Step1 - decrypt the file
1224 1224
                                 $fileContent = decryptFile(
1225 1225
                                     $file['file'],
@@ -1228,9 +1228,9 @@  discard block
 block discarded – undo
1228 1228
                                 );
1229 1229
 
1230 1230
                                 // Step2 - create file
1231
-                                $newFileName = md5(time() . '_' . $file['id']) . '.' . $file['extension'];
1231
+                                $newFileName = md5(time().'_'.$file['id']).'.'.$file['extension'];
1232 1232
 
1233
-                                $outstream = fopen($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . $newFileName, 'ab');
1233
+                                $outstream = fopen($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.$newFileName, 'ab');
1234 1234
                                 if ($outstream === false) {
1235 1235
                                     echo prepareExchangedData(
1236 1236
                                         array(
@@ -1305,7 +1305,7 @@  discard block
 block discarded – undo
1305 1305
             $tree->rebuild();
1306 1306
 
1307 1307
             // reload cache table
1308
-            include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1308
+            include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1309 1309
             updateCacheTable('reload', $SETTINGS, NULL);
1310 1310
 
1311 1311
             $data = array(
@@ -1367,7 +1367,7 @@  discard block
 block discarded – undo
1367 1367
                     // Get path
1368 1368
                     $text = '';
1369 1369
                     foreach ($tree->getPath($folder->id, false) as $fld) {
1370
-                        $text .= empty($text) === true ? '     [<i>' . $fld->title : ' > ' . $fld->title;
1370
+                        $text .= empty($text) === true ? '     [<i>'.$fld->title : ' > '.$fld->title;
1371 1371
                     }
1372 1372
 
1373 1373
                     // Save array
@@ -1377,7 +1377,7 @@  discard block
 block discarded – undo
1377 1377
                             'id' => (int) $folder->id,
1378 1378
                             'label' => $folder->title,
1379 1379
                             'level' => $folder->nlevel,
1380
-                            'path' => empty($text) === true ? '' : $text . '</i>]'
1380
+                            'path' => empty($text) === true ? '' : $text.'</i>]'
1381 1381
                         )
1382 1382
                     );
1383 1383
                 }
Please login to merge, or discard this patch.
sources/main.queries.php 1 patch
Spacing   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
 date_default_timezone_set(isset($SETTINGS['timezone']) === true ? $SETTINGS['timezone'] : 'UTC');
46 46
 
47 47
 // DO CHECKS
48
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
49
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
48
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
49
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
50 50
 $post_type = filter_input(INPUT_POST, 'type', FILTER_SANITIZE_STRING);
51 51
 if (
52 52
     isset($post_type) === true
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     && checkUser($_SESSION['user_id'], $_SESSION['key'], 'home', $SETTINGS) === false
63 63
 ) {
64 64
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
65
-    include $SETTINGS['cpassman_dir'] . '/error.php';
65
+    include $SETTINGS['cpassman_dir'].'/error.php';
66 66
     exit();
67 67
 } elseif ((isset($_SESSION['user_id']) === true
68 68
         && isset($_SESSION['key'])) === true
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     mainQuery($SETTINGS);
75 75
 } else {
76 76
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
77
-    include $SETTINGS['cpassman_dir'] . '/error.php';
77
+    include $SETTINGS['cpassman_dir'].'/error.php';
78 78
     exit();
79 79
 }
80 80
 
@@ -89,13 +89,13 @@  discard block
 block discarded – undo
89 89
 
90 90
 
91 91
     // Includes
92
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
93
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
94
-    include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
95
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
92
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
93
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
94
+    include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
95
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
96 96
 
97 97
     // Connect to mysql server
98
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
98
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
99 99
 
100 100
     DB::$host = DB_HOST;
101 101
     DB::$user = DB_USER;
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     DB::$encoding = DB_ENCODING;
106 106
 
107 107
     // User's language loading
108
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
108
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
109 109
 
110 110
     // Prepare post variables
111 111
     $post_key = filter_input(INPUT_POST, 'key', FILTER_SANITIZE_STRING);
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
             $pwdlib = new PasswordLib\PasswordLib();
250 250
             // generate key
251 251
             $key = $pwdlib->getRandomToken(filter_input(INPUT_POST, 'size', FILTER_SANITIZE_NUMBER_INT));
252
-            echo '[{"key" : "' . htmlentities($key, ENT_QUOTES) . '"}]';
252
+            echo '[{"key" : "'.htmlentities($key, ENT_QUOTES).'"}]';
253 253
             break;
254 254
 
255 255
         /*
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
                 )
279 279
             );
280 280
 
281
-            echo '[{"token" : "' . $token . '"}]';
281
+            echo '[{"token" : "'.$token.'"}]';
282 282
             break;
283 283
 
284 284
 
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
         // check if expected security level is reached
579 579
         $dataUser = DB::queryfirstrow(
580 580
             'SELECT *
581
-            FROM ' . prefixTable('users') . ' WHERE id = %i',
581
+            FROM ' . prefixTable('users').' WHERE id = %i',
582 582
             $post_user_id
583 583
         );
584 584
 
@@ -599,8 +599,8 @@  discard block
 block discarded – undo
599 599
         if (empty($dataUser['fonction_id']) === false) {
600 600
             $data = DB::queryFirstRow(
601 601
                 'SELECT complexity
602
-                FROM ' . prefixTable('roles_title') . '
603
-                WHERE id IN (' . $dataUser['fonction_id'] . ')
602
+                FROM ' . prefixTable('roles_title').'
603
+                WHERE id IN (' . $dataUser['fonction_id'].')
604 604
                 ORDER BY complexity DESC'
605 605
             );
606 606
         } else {
@@ -613,8 +613,8 @@  discard block
 block discarded – undo
613 613
             return prepareExchangedData(
614 614
                 array(
615 615
                     'error' => true,
616
-                    'message' => '<div style="margin:10px 0 10px 15px;">' . langHdl('complexity_level_not_reached') . '.<br>' .
617
-                        langHdl('expected_complexity_level') . ': <b>' . TP_PW_COMPLEXITY[$data['complexity']][1] . '</b></div>',
616
+                    'message' => '<div style="margin:10px 0 10px 15px;">'.langHdl('complexity_level_not_reached').'.<br>'.
617
+                        langHdl('expected_complexity_level').': <b>'.TP_PW_COMPLEXITY[$data['complexity']][1].'</b></div>',
618 618
                 ),
619 619
                 'encode'
620 620
             );
@@ -715,14 +715,14 @@  discard block
 block discarded – undo
715 715
         // Get data about user
716 716
         $data = DB::queryfirstrow(
717 717
             'SELECT id, email, pw
718
-            FROM ' . prefixTable('users') . '
718
+            FROM ' . prefixTable('users').'
719 719
             WHERE login = %s',
720 720
             $post_login
721 721
         );
722 722
     } else {
723 723
         $data = DB::queryfirstrow(
724 724
             'SELECT id, login, email, pw
725
-            FROM ' . prefixTable('users') . '
725
+            FROM ' . prefixTable('users').'
726 726
             WHERE id = %i',
727 727
             $post_id
728 728
         );
@@ -732,7 +732,7 @@  discard block
 block discarded – undo
732 732
     $counter = DB::count();
733 733
 
734 734
     // load passwordLib library
735
-    $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries');
735
+    $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries');
736 736
     $pwdlib->register();
737 737
     $pwdlib = new PasswordLib\PasswordLib();
738 738
 
@@ -779,7 +779,7 @@  discard block
 block discarded – undo
779 779
     }
780 780
     
781 781
     // generate new GA user code
782
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php';
782
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php';
783 783
     $tfa = new Authentication\TwoFactorAuth\TwoFactorAuth($SETTINGS['ga_website_name']);
784 784
     $gaSecretKey = $tfa->createSecret();
785 785
     $gaTemporaryCode = GenerateCryptKey(12, false, true, true, false, true, $SETTINGS);
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
                 'email' => $data['email'],
822 822
                 'email_result' => str_replace(
823 823
                     '#email#',
824
-                    '<b>' . obfuscateEmail($data['email']) . '</b>',
824
+                    '<b>'.obfuscateEmail($data['email']).'</b>',
825 825
                     addslashes(langHdl('admin_email_result_ok'))
826 826
                 ),
827 827
             ),
@@ -837,7 +837,7 @@  discard block
 block discarded – undo
837 837
             'email' => $data['email'],
838 838
             'email_result' => str_replace(
839 839
                 '#email#',
840
-                '<b>' . obfuscateEmail($data['email']) . '</b>',
840
+                '<b>'.obfuscateEmail($data['email']).'</b>',
841 841
                 addslashes(langHdl('admin_email_result_ok'))
842 842
             ),
843 843
         ),
@@ -853,7 +853,7 @@  discard block
 block discarded – undo
853 853
         && (int) $SETTINGS['enable_send_email_on_user_login'] === 1
854 854
     ) {
855 855
         $row = DB::queryFirstRow(
856
-            'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s',
856
+            'SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s',
857 857
             'cron',
858 858
             'sending_emails'
859 859
         );
@@ -861,12 +861,12 @@  discard block
 block discarded – undo
861 861
         if ((int) (time() - $row['valeur']) >= 300 || (int) $row['valeur'] === 0) {
862 862
             $rows = DB::query(
863 863
                 'SELECT *
864
-                FROM ' . prefixTable('emails') .
864
+                FROM ' . prefixTable('emails').
865 865
                 ' WHERE status != %s',
866 866
                 'sent'
867 867
             );
868 868
             foreach ($rows as $record) {
869
-                echo $record['increment_id'] . " >> ";
869
+                echo $record['increment_id']." >> ";
870 870
                 // Send email
871 871
                 $ret = json_decode(
872 872
                     sendEmail(
@@ -965,8 +965,8 @@  discard block
 block discarded – undo
965 965
     $arr_html = array();
966 966
     $rows = DB::query(
967 967
         'SELECT i.id AS id, i.label AS label, i.id_tree AS id_tree, l.date, i.perso AS perso, i.restricted_to AS restricted
968
-        FROM ' . prefixTable('log_items') . ' AS l
969
-        RIGHT JOIN ' . prefixTable('items') . ' AS i ON (l.id_item = i.id)
968
+        FROM ' . prefixTable('log_items').' AS l
969
+        RIGHT JOIN ' . prefixTable('items').' AS i ON (l.id_item = i.id)
970 970
         WHERE l.action = %s AND l.id_user = %i
971 971
         ORDER BY l.date DESC
972 972
         LIMIT 0, 100',
@@ -999,7 +999,7 @@  discard block
 block discarded – undo
999 999
         isset($SETTINGS['enable_suggestion']) === true && (int) $SETTINGS['enable_suggestion'] === 1
1000 1000
         && ((int) $_SESSION['user_admin'] === 1 || (int) $_SESSION['user_manager'] === 1)
1001 1001
     ) {
1002
-        DB::query('SELECT * FROM ' . prefixTable('suggestion'));
1002
+        DB::query('SELECT * FROM '.prefixTable('suggestion'));
1003 1003
         $nb_suggestions_waiting = DB::count();
1004 1004
     }
1005 1005
 
@@ -1035,13 +1035,13 @@  discard block
 block discarded – undo
1035 1035
             if ($data === 'stat_languages') {
1036 1036
                 $tmp = '';
1037 1037
                 foreach ($stats_data[$data] as $key => $value) {
1038
-                    $tmp .= $tmp === '' ? $key . '-' . $value : ',' . $key . '-' . $value;
1038
+                    $tmp .= $tmp === '' ? $key.'-'.$value : ','.$key.'-'.$value;
1039 1039
                 }
1040 1040
                 $statsToSend[$data] = $tmp;
1041 1041
             } elseif ($data === 'stat_country') {
1042 1042
                 $tmp = '';
1043 1043
                 foreach ($stats_data[$data] as $key => $value) {
1044
-                    $tmp .= $tmp === '' ? $key . '-' . $value : ',' . $key . '-' . $value;
1044
+                    $tmp .= $tmp === '' ? $key.'-'.$value : ','.$key.'-'.$value;
1045 1045
                 }
1046 1046
                 $statsToSend[$data] = $tmp;
1047 1047
             } else {
@@ -1115,8 +1115,8 @@  discard block
 block discarded – undo
1115 1115
             if (strpos($line, 'cpassman_url') > 0 && empty($url_found) === true) {
1116 1116
                 $url_found = substr($line, 19, strlen($line) - 22);
1117 1117
                 $tmp = parse_url($url_found);
1118
-                $anonym_url = $tmp['scheme'] . '://<anonym_url>' . $tmp['path'];
1119
-                $line = "'cpassman_url' => '" . $anonym_url . "\n";
1118
+                $anonym_url = $tmp['scheme'].'://<anonym_url>'.$tmp['path'];
1119
+                $line = "'cpassman_url' => '".$anonym_url."\n";
1120 1120
             }
1121 1121
 
1122 1122
             // Anonymize all urls
@@ -1143,7 +1143,7 @@  discard block
 block discarded – undo
1143 1143
     $teampass_errors = '';
1144 1144
     $rows = DB::query(
1145 1145
         'SELECT label, date AS error_date
1146
-        FROM ' . prefixTable('log_system') . "
1146
+        FROM ' . prefixTable('log_system')."
1147 1147
         WHERE `type` LIKE 'error'
1148 1148
         ORDER BY `date` DESC
1149 1149
         LIMIT 0, 10"
@@ -1151,9 +1151,9 @@  discard block
 block discarded – undo
1151 1151
     if (DB::count() > 0) {
1152 1152
         foreach ($rows as $record) {
1153 1153
             if (empty($teampass_errors) === true) {
1154
-                $teampass_errors = ' * ' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['error_date']) . ' - ' . $record['label'];
1154
+                $teampass_errors = ' * '.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['error_date']).' - '.$record['label'];
1155 1155
             } else {
1156
-                $teampass_errors .= ' * ' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['error_date']) . ' - ' . $record['label'];
1156
+                $teampass_errors .= ' * '.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['error_date']).' - '.$record['label'];
1157 1157
             }
1158 1158
         }
1159 1159
     }
@@ -1162,7 +1162,7 @@  discard block
 block discarded – undo
1162 1162
 
1163 1163
     // Now prepare text
1164 1164
     $txt = '### Page on which it happened
1165
-' . $post_data['current_page'] . '
1165
+' . $post_data['current_page'].'
1166 1166
 
1167 1167
 ### Steps to reproduce
1168 1168
 1.
@@ -1177,39 +1177,39 @@  discard block
 block discarded – undo
1177 1177
 Tell us what happens instead
1178 1178
 
1179 1179
 ### Server configuration
1180
-**Operating system**: ' . php_uname() . '
1180
+**Operating system**: ' . php_uname().'
1181 1181
 
1182
-**Web server:** ' . $_SERVER['SERVER_SOFTWARE'] . '
1182
+**Web server:** ' . $_SERVER['SERVER_SOFTWARE'].'
1183 1183
 
1184
-**Database:** ' . ($link === false ? langHdl('undefined') : mysqli_get_server_info($link)) . '
1184
+**Database:** ' . ($link === false ? langHdl('undefined') : mysqli_get_server_info($link)).'
1185 1185
 
1186
-**PHP version:** ' . PHP_VERSION . '
1186
+**PHP version:** ' . PHP_VERSION.'
1187 1187
 
1188
-**Teampass version:** ' . TP_VERSION_FULL . '
1188
+**Teampass version:** ' . TP_VERSION_FULL.'
1189 1189
 
1190 1190
 **Teampass configuration file:**
1191 1191
 ```
1192
-' . $list_of_options . '
1192
+' . $list_of_options.'
1193 1193
 ```
1194 1194
 
1195 1195
 **Updated from an older Teampass or fresh install:**
1196 1196
 
1197 1197
 ### Client configuration
1198 1198
 
1199
-**Browser:** ' . $post_data['browser_name'] . ' - ' . $post_data['browser_version'] . '
1199
+**Browser:** ' . $post_data['browser_name'].' - '.$post_data['browser_version'].'
1200 1200
 
1201
-**Operating system:** ' . $post_data['os'] . ' - ' . $post_data['os_archi'] . 'bits
1201
+**Operating system:** ' . $post_data['os'].' - '.$post_data['os_archi'].'bits
1202 1202
 
1203 1203
 ### Logs
1204 1204
 
1205 1205
 #### Web server error log
1206 1206
 ```
1207
-' . $err['message'] . ' - ' . $err['file'] . ' (' . $err['line'] . ')
1207
+' . $err['message'].' - '.$err['file'].' ('.$err['line'].')
1208 1208
 ```
1209 1209
 
1210 1210
 #### Teampass 10 last system errors
1211 1211
 ```
1212
-' . $teampass_errors . '
1212
+' . $teampass_errors.'
1213 1213
 ```
1214 1214
 
1215 1215
 #### Log from the web-browser developer console (CTRL + SHIFT + i)
@@ -1237,7 +1237,7 @@  discard block
 block discarded – undo
1237 1237
         // Check if user exists
1238 1238
         $userInfo = DB::queryFirstRow(
1239 1239
             'SELECT public_key, private_key, pw
1240
-            FROM ' . prefixTable('users') . '
1240
+            FROM ' . prefixTable('users').'
1241 1241
             WHERE id = %i',
1242 1242
             $post_user_id
1243 1243
         );
@@ -1245,14 +1245,14 @@  discard block
 block discarded – undo
1245 1245
             // Get one item
1246 1246
             $record = DB::queryFirstRow(
1247 1247
                 'SELECT id, pw
1248
-                FROM ' . prefixTable('items') . '
1248
+                FROM ' . prefixTable('items').'
1249 1249
                 WHERE perso = 0'
1250 1250
             );
1251 1251
 
1252 1252
             // Get itemKey from current user
1253 1253
             $currentUserKey = DB::queryFirstRow(
1254 1254
                 'SELECT share_key, increment_id
1255
-                FROM ' . prefixTable('sharekeys_items') . '
1255
+                FROM ' . prefixTable('sharekeys_items').'
1256 1256
                 WHERE object_id = %i AND user_id = %i',
1257 1257
                 $record['id'],
1258 1258
                 $post_user_id
@@ -1280,7 +1280,7 @@  discard block
 block discarded – undo
1280 1280
             
1281 1281
             // Use the password check
1282 1282
             // load passwordLib library
1283
-            $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1283
+            $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries');
1284 1284
             $pwdlib->register();
1285 1285
             $pwdlib = new PasswordLib\PasswordLib();
1286 1286
             
@@ -1324,7 +1324,7 @@  discard block
 block discarded – undo
1324 1324
         // Get user info
1325 1325
         $userData = DB::queryFirstRow(
1326 1326
             'SELECT private_key
1327
-            FROM ' . prefixTable('users') . '
1327
+            FROM ' . prefixTable('users').'
1328 1328
             WHERE id = %i',
1329 1329
             $post_user_id
1330 1330
         );
@@ -1351,7 +1351,7 @@  discard block
 block discarded – undo
1351 1351
             );
1352 1352
 
1353 1353
             // Load superGlobals
1354
-            include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1354
+            include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1355 1355
             $superGlobal = new protect\SuperGlobal\SuperGlobal();
1356 1356
 
1357 1357
             $superGlobal->put('private_key', $privateKey, 'SESSION', 'user');
@@ -1389,7 +1389,7 @@  discard block
 block discarded – undo
1389 1389
         // Get user info
1390 1390
         $userData = DB::queryFirstRow(
1391 1391
             'SELECT email, auth_type, login
1392
-            FROM ' . prefixTable('users') . '
1392
+            FROM ' . prefixTable('users').'
1393 1393
             WHERE id = %i',
1394 1394
             $post_user_id
1395 1395
         );
@@ -1523,7 +1523,7 @@  discard block
 block discarded – undo
1523 1523
         // Get user info
1524 1524
         $userData = DB::queryFirstRow(
1525 1525
             'SELECT email, auth_type, login
1526
-            FROM ' . prefixTable('users') . '
1526
+            FROM ' . prefixTable('users').'
1527 1527
             WHERE id = %i',
1528 1528
             $post_user_id
1529 1529
         );
@@ -1586,13 +1586,13 @@  discard block
 block discarded – undo
1586 1586
         // Check if user exists
1587 1587
         DB::queryFirstRow(
1588 1588
             'SELECT *
1589
-            FROM ' . prefixTable('users') . '
1589
+            FROM ' . prefixTable('users').'
1590 1590
             WHERE id = %i',
1591 1591
             $post_user_id
1592 1592
         );
1593 1593
         if (DB::count() > 0) {
1594 1594
             // Include libraries
1595
-            include_once $SETTINGS['cpassman_dir'] . '/sources/aes.functions.php';
1595
+            include_once $SETTINGS['cpassman_dir'].'/sources/aes.functions.php';
1596 1596
 
1597 1597
             // CLear old sharekeys
1598 1598
             if ($post_self_change === false) {
@@ -1644,13 +1644,13 @@  discard block
 block discarded – undo
1644 1644
         // Check if user exists
1645 1645
         $userInfo = DB::queryFirstRow(
1646 1646
             'SELECT public_key
1647
-            FROM ' . prefixTable('users') . '
1647
+            FROM ' . prefixTable('users').'
1648 1648
             WHERE id = %i',
1649 1649
             $post_user_id
1650 1650
         );
1651 1651
         if (DB::count() > 0) {
1652 1652
             // Include libraries
1653
-            include_once $SETTINGS['cpassman_dir'] . '/sources/aes.functions.php';
1653
+            include_once $SETTINGS['cpassman_dir'].'/sources/aes.functions.php';
1654 1654
 
1655 1655
             // WHAT STEP TO PERFORM?
1656 1656
             if ($post_action === 'step0') {
@@ -1809,15 +1809,15 @@  discard block
 block discarded – undo
1809 1809
     // Loop on items
1810 1810
     $rows = DB::query(
1811 1811
         'SELECT id, pw
1812
-        FROM ' . prefixTable('items') . '
1812
+        FROM ' . prefixTable('items').'
1813 1813
         WHERE perso = 0
1814
-        LIMIT ' . $post_start . ', ' . $post_length
1814
+        LIMIT ' . $post_start.', '.$post_length
1815 1815
     );
1816 1816
     foreach ($rows as $record) {
1817 1817
         // Get itemKey from current user
1818 1818
         $currentUserKey = DB::queryFirstRow(
1819 1819
             'SELECT share_key, increment_id
1820
-            FROM ' . prefixTable('sharekeys_items') . '
1820
+            FROM ' . prefixTable('sharekeys_items').'
1821 1821
             WHERE object_id = %i AND user_id = %i',
1822 1822
             $record['id'],
1823 1823
             $_SESSION['user_id']
@@ -1845,7 +1845,7 @@  discard block
 block discarded – undo
1845 1845
             if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
1846 1846
                 $currentUserKey = DB::queryFirstRow(
1847 1847
                     'SELECT increment_id
1848
-                    FROM ' . prefixTable('sharekeys_items') . '
1848
+                    FROM ' . prefixTable('sharekeys_items').'
1849 1849
                     WHERE object_id = %i AND user_id = %i',
1850 1850
                     $record['id'],
1851 1851
                     $post_user_id
@@ -1878,7 +1878,7 @@  discard block
 block discarded – undo
1878 1878
     // SHould we change step?
1879 1879
     DB::query(
1880 1880
         'SELECT *
1881
-        FROM ' . prefixTable('items') . '
1881
+        FROM ' . prefixTable('items').'
1882 1882
         WHERE perso = 0'
1883 1883
     );
1884 1884
 
@@ -1902,15 +1902,15 @@  discard block
 block discarded – undo
1902 1902
     // Loop on logs
1903 1903
     $rows = DB::query(
1904 1904
         'SELECT increment_id
1905
-        FROM ' . prefixTable('log_items') . '
1905
+        FROM ' . prefixTable('log_items').'
1906 1906
         WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"
1907
-        LIMIT ' . $post_start . ', ' . $post_length
1907
+        LIMIT ' . $post_start.', '.$post_length
1908 1908
     );
1909 1909
     foreach ($rows as $record) {
1910 1910
         // Get itemKey from current user
1911 1911
         $currentUserKey = DB::queryFirstRow(
1912 1912
             'SELECT share_key
1913
-            FROM ' . prefixTable('sharekeys_logs') . '
1913
+            FROM ' . prefixTable('sharekeys_logs').'
1914 1914
             WHERE object_id = %i AND user_id = %i',
1915 1915
             $record['increment_id'],
1916 1916
             $_SESSION['user_id']
@@ -1937,7 +1937,7 @@  discard block
 block discarded – undo
1937 1937
             if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
1938 1938
                 $currentUserKey = DB::queryFirstRow(
1939 1939
                     'SELECT increment_id
1940
-                    FROM ' . prefixTable('sharekeys_items') . '
1940
+                    FROM ' . prefixTable('sharekeys_items').'
1941 1941
                     WHERE object_id = %i AND user_id = %i',
1942 1942
                     $record['id'],
1943 1943
                     $post_user_id
@@ -1959,7 +1959,7 @@  discard block
 block discarded – undo
1959 1959
     // SHould we change step?
1960 1960
     DB::query(
1961 1961
         'SELECT increment_id
1962
-        FROM ' . prefixTable('log_items') . '
1962
+        FROM ' . prefixTable('log_items').'
1963 1963
         WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"'
1964 1964
     );
1965 1965
 
@@ -1983,15 +1983,15 @@  discard block
 block discarded – undo
1983 1983
     // Loop on fields
1984 1984
     $rows = DB::query(
1985 1985
         'SELECT id
1986
-        FROM ' . prefixTable('categories_items') . '
1986
+        FROM ' . prefixTable('categories_items').'
1987 1987
         WHERE encryption_type = "teampass_aes"
1988
-        LIMIT ' . $post_start . ', ' . $post_length
1988
+        LIMIT ' . $post_start.', '.$post_length
1989 1989
     );
1990 1990
     foreach ($rows as $record) {
1991 1991
         // Get itemKey from current user
1992 1992
         $currentUserKey = DB::queryFirstRow(
1993 1993
             'SELECT share_key
1994
-            FROM ' . prefixTable('sharekeys_fields') . '
1994
+            FROM ' . prefixTable('sharekeys_fields').'
1995 1995
             WHERE object_id = %i AND user_id = %i',
1996 1996
             $record['id'],
1997 1997
             $_SESSION['user_id']
@@ -2018,7 +2018,7 @@  discard block
 block discarded – undo
2018 2018
             if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
2019 2019
                 $currentUserKey = DB::queryFirstRow(
2020 2020
                     'SELECT increment_id
2021
-                    FROM ' . prefixTable('sharekeys_items') . '
2021
+                    FROM ' . prefixTable('sharekeys_items').'
2022 2022
                     WHERE object_id = %i AND user_id = %i',
2023 2023
                     $record['id'],
2024 2024
                     $post_user_id
@@ -2040,7 +2040,7 @@  discard block
 block discarded – undo
2040 2040
     // SHould we change step?
2041 2041
     DB::query(
2042 2042
         'SELECT *
2043
-        FROM ' . prefixTable('categories_items') . '
2043
+        FROM ' . prefixTable('categories_items').'
2044 2044
         WHERE encryption_type = "teampass_aes"'
2045 2045
     );
2046 2046
 
@@ -2064,14 +2064,14 @@  discard block
 block discarded – undo
2064 2064
     // Loop on suggestions
2065 2065
     $rows = DB::query(
2066 2066
         'SELECT id
2067
-        FROM ' . prefixTable('suggestion') . '
2068
-        LIMIT ' . $post_start . ', ' . $post_length
2067
+        FROM ' . prefixTable('suggestion').'
2068
+        LIMIT ' . $post_start.', '.$post_length
2069 2069
     );
2070 2070
     foreach ($rows as $record) {
2071 2071
         // Get itemKey from current user
2072 2072
         $currentUserKey = DB::queryFirstRow(
2073 2073
             'SELECT share_key
2074
-            FROM ' . prefixTable('sharekeys_suggestions') . '
2074
+            FROM ' . prefixTable('sharekeys_suggestions').'
2075 2075
             WHERE object_id = %i AND user_id = %i',
2076 2076
             $record['id'],
2077 2077
             $_SESSION['user_id']
@@ -2098,7 +2098,7 @@  discard block
 block discarded – undo
2098 2098
             if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
2099 2099
                 $currentUserKey = DB::queryFirstRow(
2100 2100
                     'SELECT increment_id
2101
-                    FROM ' . prefixTable('sharekeys_items') . '
2101
+                    FROM ' . prefixTable('sharekeys_items').'
2102 2102
                     WHERE object_id = %i AND user_id = %i',
2103 2103
                     $record['id'],
2104 2104
                     $post_user_id
@@ -2143,15 +2143,15 @@  discard block
 block discarded – undo
2143 2143
     // Loop on files
2144 2144
     $rows = DB::query(
2145 2145
         'SELECT id
2146
-        FROM ' . prefixTable('files') . '
2147
-        WHERE status = "' . TP_ENCRYPTION_NAME . '"
2148
-        LIMIT ' . $post_start . ', ' . $post_length
2146
+        FROM ' . prefixTable('files').'
2147
+        WHERE status = "' . TP_ENCRYPTION_NAME.'"
2148
+        LIMIT ' . $post_start.', '.$post_length
2149 2149
     ); //aes_encryption
2150 2150
     foreach ($rows as $record) {
2151 2151
         // Get itemKey from current user
2152 2152
         $currentUserKey = DB::queryFirstRow(
2153 2153
             'SELECT share_key
2154
-            FROM ' . prefixTable('sharekeys_files') . '
2154
+            FROM ' . prefixTable('sharekeys_files').'
2155 2155
             WHERE object_id = %i AND user_id = %i',
2156 2156
             $record['id'],
2157 2157
             $_SESSION['user_id']
@@ -2178,7 +2178,7 @@  discard block
 block discarded – undo
2178 2178
             if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
2179 2179
                 $currentUserKey = DB::queryFirstRow(
2180 2180
                     'SELECT increment_id
2181
-                    FROM ' . prefixTable('sharekeys_items') . '
2181
+                    FROM ' . prefixTable('sharekeys_items').'
2182 2182
                     WHERE object_id = %i AND user_id = %i',
2183 2183
                     $record['id'],
2184 2184
                     $post_user_id
@@ -2200,8 +2200,8 @@  discard block
 block discarded – undo
2200 2200
     // SHould we change step?
2201 2201
     DB::query(
2202 2202
         'SELECT *
2203
-        FROM ' . prefixTable('files') . '
2204
-        WHERE status = "' . TP_ENCRYPTION_NAME . '"'
2203
+        FROM ' . prefixTable('files').'
2204
+        WHERE status = "' . TP_ENCRYPTION_NAME.'"'
2205 2205
     );
2206 2206
 
2207 2207
     $next_start = (int) $post_start + (int) $post_length;
@@ -2233,16 +2233,16 @@  discard block
 block discarded – undo
2233 2233
     if (count($_SESSION['personal_folders']) > 0) {
2234 2234
         $rows = DB::query(
2235 2235
             'SELECT id, pw
2236
-            FROM ' . prefixTable('items') . '
2236
+            FROM ' . prefixTable('items').'
2237 2237
             WHERE perso = 1 AND id_tree IN %ls
2238
-            LIMIT ' . $post_start . ', ' . $post_length,
2238
+            LIMIT ' . $post_start.', '.$post_length,
2239 2239
             $_SESSION['personal_folders']
2240 2240
         );
2241 2241
         foreach ($rows as $record) {
2242 2242
             // Get itemKey from current user
2243 2243
             $currentUserKey = DB::queryFirstRow(
2244 2244
                 'SELECT share_key, increment_id
2245
-                FROM ' . prefixTable('sharekeys_items') . '
2245
+                FROM ' . prefixTable('sharekeys_items').'
2246 2246
                 WHERE object_id = %i AND user_id = %i',
2247 2247
                 $record['id'],
2248 2248
                 $_SESSION['user_id']
@@ -2269,7 +2269,7 @@  discard block
 block discarded – undo
2269 2269
                 if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
2270 2270
                     $currentUserKey = DB::queryFirstRow(
2271 2271
                         'SELECT increment_id
2272
-                        FROM ' . prefixTable('sharekeys_items') . '
2272
+                        FROM ' . prefixTable('sharekeys_items').'
2273 2273
                         WHERE object_id = %i AND user_id = %i',
2274 2274
                         $record['id'],
2275 2275
                         $post_user_id
@@ -2292,7 +2292,7 @@  discard block
 block discarded – undo
2292 2292
     // SHould we change step?
2293 2293
     DB::query(
2294 2294
         'SELECT *
2295
-        FROM ' . prefixTable('items') . '
2295
+        FROM ' . prefixTable('items').'
2296 2296
         WHERE perso = 0'
2297 2297
     );
2298 2298
 
@@ -2316,7 +2316,7 @@  discard block
 block discarded – undo
2316 2316
         // Check if user exists
2317 2317
         $userInfo = DB::queryFirstRow(
2318 2318
             'SELECT public_key, encrypted_psk
2319
-            FROM ' . prefixTable('users') . '
2319
+            FROM ' . prefixTable('users').'
2320 2320
             WHERE id = %i',
2321 2321
             $post_user_id
2322 2322
         );
@@ -2341,9 +2341,9 @@  discard block
 block discarded – undo
2341 2341
                 // Loop on persoanl items
2342 2342
                 $rows = DB::query(
2343 2343
                     'SELECT id, pw
2344
-                    FROM ' . prefixTable('items') . '
2344
+                    FROM ' . prefixTable('items').'
2345 2345
                     WHERE perso = 1 AND id_tree IN %ls
2346
-                    LIMIT ' . $post_start . ', ' . $post_length,
2346
+                    LIMIT ' . $post_start.', '.$post_length,
2347 2347
                     $_SESSION['personal_folders']
2348 2348
                 );
2349 2349
                 $countUserPersonalItems = DB::count();
@@ -2386,7 +2386,7 @@  discard block
 block discarded – undo
2386 2386
                         // Loop on files
2387 2387
                         $rows = DB::query(
2388 2388
                             'SELECT id, file
2389
-                            FROM ' . prefixTable('files') . '
2389
+                            FROM ' . prefixTable('files').'
2390 2390
                             WHERE status != %s
2391 2391
                             AND id_item = %i',
2392 2392
                             TP_ENCRYPTION_NAME,
@@ -2397,14 +2397,14 @@  discard block
 block discarded – undo
2397 2397
                             // Now decrypt the file
2398 2398
                             prepareFileWithDefuse(
2399 2399
                                 'decrypt',
2400
-                                $SETTINGS['path_to_upload_folder'] . '/' . $record2['file'],
2401
-                                $SETTINGS['path_to_upload_folder'] . '/' . $record2['file'] . '.delete',
2400
+                                $SETTINGS['path_to_upload_folder'].'/'.$record2['file'],
2401
+                                $SETTINGS['path_to_upload_folder'].'/'.$record2['file'].'.delete',
2402 2402
                                 $SETTINGS,
2403 2403
                                 $post_user_psk
2404 2404
                             );
2405 2405
 
2406 2406
                             // Encrypt the file
2407
-                            $encryptedFile = encryptFile($record2['file'] . '.delete', $SETTINGS['path_to_upload_folder']);
2407
+                            $encryptedFile = encryptFile($record2['file'].'.delete', $SETTINGS['path_to_upload_folder']);
2408 2408
 
2409 2409
                             DB::update(
2410 2410
                                 prefixTable('files'),
@@ -2427,7 +2427,7 @@  discard block
 block discarded – undo
2427 2427
                             );
2428 2428
 
2429 2429
                             // Unlink original file
2430
-                            unlink($SETTINGS['path_to_upload_folder'] . '/' . $record2['file']);
2430
+                            unlink($SETTINGS['path_to_upload_folder'].'/'.$record2['file']);
2431 2431
                         }
2432 2432
                     }
2433 2433
                 }
@@ -2496,7 +2496,7 @@  discard block
 block discarded – undo
2496 2496
         // Get user info
2497 2497
         $userData = DB::queryFirstRow(
2498 2498
             'SELECT '.$post_fields.'
2499
-            FROM ' . prefixTable('users') . '
2499
+            FROM ' . prefixTable('users').'
2500 2500
             WHERE id = %i',
2501 2501
             $post_user_id
2502 2502
         );
@@ -2531,7 +2531,7 @@  discard block
 block discarded – undo
2531 2531
         // Get user info
2532 2532
         $userData = DB::queryFirstRow(
2533 2533
             'SELECT auth_type, login, private_key
2534
-            FROM ' . prefixTable('users') . '
2534
+            FROM ' . prefixTable('users').'
2535 2535
             WHERE id = %i',
2536 2536
             $post_user_id
2537 2537
         );
@@ -2542,7 +2542,7 @@  discard block
 block discarded – undo
2542 2542
             $privateKey = decryptPrivateKey($post_current_pwd, $userData['private_key']);
2543 2543
 
2544 2544
             // Load superGlobals
2545
-            include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2545
+            include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2546 2546
             $superGlobal = new protect\SuperGlobal\SuperGlobal();
2547 2547
 
2548 2548
             if ($superGlobal->get('private_key', 'SESSION', 'user') === $privateKey) {
@@ -2575,7 +2575,7 @@  discard block
 block discarded – undo
2575 2575
                 return prepareExchangedData(
2576 2576
                     array(
2577 2577
                         'error' => false,
2578
-                        'message' => langHdl('done'),'',
2578
+                        'message' => langHdl('done'), '',
2579 2579
                     ),
2580 2580
                     'encode'
2581 2581
                 );
@@ -2613,7 +2613,7 @@  discard block
 block discarded – undo
2613 2613
         // Get user info
2614 2614
         $userData = DB::queryFirstRow(
2615 2615
             'SELECT auth_type, login, private_key, special
2616
-            FROM ' . prefixTable('users') . '
2616
+            FROM ' . prefixTable('users').'
2617 2617
             WHERE id = %i',
2618 2618
             $post_user_id
2619 2619
         );
@@ -2643,14 +2643,14 @@  discard block
 block discarded – undo
2643 2643
                 );
2644 2644
 
2645 2645
                 // Load superGlobals
2646
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2646
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2647 2647
                 $superGlobal = new protect\SuperGlobal\SuperGlobal();
2648 2648
                 $superGlobal->put('private_key', $privateKey, 'SESSION', 'user');
2649 2649
 
2650 2650
                 return prepareExchangedData(
2651 2651
                     array(
2652 2652
                         'error' => false,
2653
-                        'message' => langHdl('done'),'',
2653
+                        'message' => langHdl('done'), '',
2654 2654
                     ),
2655 2655
                     'encode'
2656 2656
                 );
@@ -2674,14 +2674,14 @@  discard block
 block discarded – undo
2674 2674
             // Get one item
2675 2675
             $record = DB::queryFirstRow(
2676 2676
                 'SELECT id, pw
2677
-                FROM ' . prefixTable('items') . '
2677
+                FROM ' . prefixTable('items').'
2678 2678
                 WHERE perso = 0'
2679 2679
             );
2680 2680
 
2681 2681
             // Get itemKey from current user
2682 2682
             $currentUserKey = DB::queryFirstRow(
2683 2683
                 'SELECT share_key, increment_id
2684
-                FROM ' . prefixTable('sharekeys_items') . '
2684
+                FROM ' . prefixTable('sharekeys_items').'
2685 2685
                 WHERE object_id = %i AND user_id = %i',
2686 2686
                 $record['id'],
2687 2687
                 $post_user_id
@@ -2709,7 +2709,7 @@  discard block
 block discarded – undo
2709 2709
                     );
2710 2710
                     
2711 2711
                     // Load superGlobals
2712
-                    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2712
+                    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2713 2713
                     $superGlobal = new protect\SuperGlobal\SuperGlobal();
2714 2714
                     $superGlobal->put('private_key', $privateKey, 'SESSION', 'user');
2715 2715
 
@@ -2763,7 +2763,7 @@  discard block
 block discarded – undo
2763 2763
             $_SESSION['user_id']
2764 2764
         );
2765 2765
         // Return data
2766
-        return '[{"new_value":"' . $_SESSION['sessionDuration'] . '"}]';
2766
+        return '[{"new_value":"'.$_SESSION['sessionDuration'].'"}]';
2767 2767
     }
2768 2768
     
2769 2769
     return '[{"new_value":"expired"}]';
Please login to merge, or discard this patch.
sources/identify.php 1 patch
Spacing   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -44,23 +44,23 @@  discard block
 block discarded – undo
44 44
     throw new Exception("Error file '/includes/config/tp.config.php' not exists", 1);
45 45
 }
46 46
 
47
-if (! isset($SETTINGS['cpassman_dir']) || empty($SETTINGS['cpassman_dir']) === true || $SETTINGS['cpassman_dir'] === '.') {
47
+if (!isset($SETTINGS['cpassman_dir']) || empty($SETTINGS['cpassman_dir']) === true || $SETTINGS['cpassman_dir'] === '.') {
48 48
     $SETTINGS = [];
49 49
     $SETTINGS['cpassman_dir'] = '..';
50 50
 }
51 51
 
52
-require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
53
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
54
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
52
+require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
53
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
54
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
55 55
 
56 56
 // If Debug then clean the files
57 57
 if (DEBUGLDAP === true) {
58
-    define('DEBUGLDAPFILE', $SETTINGS['path_to_files_folder'] . '/ldap.debug.txt');
58
+    define('DEBUGLDAPFILE', $SETTINGS['path_to_files_folder'].'/ldap.debug.txt');
59 59
     $fp = fopen(DEBUGLDAPFILE, 'w');
60 60
     fclose($fp);
61 61
 }
62 62
 if (DEBUGDUO === true) {
63
-    define('DEBUGDUOFILE', $SETTINGS['path_to_files_folder'] . '/duo.debug.txt');
63
+    define('DEBUGDUOFILE', $SETTINGS['path_to_files_folder'].'/duo.debug.txt');
64 64
     $fp = fopen(DEBUGDUOFILE, 'w');
65 65
     fclose($fp);
66 66
 }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 if (defined('DB_PASSWD_CLEAR') === false) {
77 77
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
78 78
 }
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
 }
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     // Get DUO keys
96 96
     $duoData = DB::query(
97 97
         'SELECT intitule, valeur
98
-        FROM ' . prefixTable('misc') . '
98
+        FROM ' . prefixTable('misc').'
99 99
         WHERE type = %s',
100 100
         'duoSecurity'
101 101
     );
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     }
106 106
 
107 107
     // load library
108
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/DuoSecurity/Duo.php';
108
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/DuoSecurity/Duo.php';
109 109
     $sig_request = Duo::signRequest(
110 110
         $_GLOBALS['IKEY'],
111 111
         $_GLOBALS['SKEY'],
@@ -116,16 +116,16 @@  discard block
 block discarded – undo
116 116
         debugIdentify(
117 117
             DEBUGDUO,
118 118
             DEBUGDUOFILE,
119
-            "\n\n-----\n\n" .
120
-                'sig request : ' . $post_login . "\n" .
121
-                'resp : ' . $sig_request . "\n"
119
+            "\n\n-----\n\n".
120
+                'sig request : '.$post_login."\n".
121
+                'resp : '.$sig_request."\n"
122 122
         );
123 123
     }
124 124
 
125 125
     // load csrfprotector
126
-    $csrfp_config = include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/csrfp/libs/csrfp.config.php';
126
+    $csrfp_config = include_once $SETTINGS['cpassman_dir'].'/includes/libraries/csrfp/libs/csrfp.config.php';
127 127
     // return result
128
-    echo '[{"sig_request" : "' . $sig_request . '" , "csrfp_token" : "' . $csrfp_config['CSRFP_TOKEN'] . '" , "csrfp_key" : "' . filter_var($_COOKIE[$csrfp_config['CSRFP_TOKEN']], FILTER_SANITIZE_STRING) . '"}]';
128
+    echo '[{"sig_request" : "'.$sig_request.'" , "csrfp_token" : "'.$csrfp_config['CSRFP_TOKEN'].'" , "csrfp_key" : "'.filter_var($_COOKIE[$csrfp_config['CSRFP_TOKEN']], FILTER_SANITIZE_STRING).'"}]';
129 129
 // ---
130 130
     // ---
131 131
 } elseif ($post_type === 'identify_duo_user_check') {
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
     //--------
136 136
 
137 137
     // load library
138
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/DuoSecurity/Duo.php';
138
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/DuoSecurity/Duo.php';
139 139
     $authenticated_username = Duo::verifyResponse(
140 140
         $SETTINGS['duo_ikey'],
141 141
         $SETTINGS['duo_skey'],
@@ -146,9 +146,9 @@  discard block
 block discarded – undo
146 146
         debugIdentify(
147 147
             DEBUGDUO,
148 148
             DEBUGDUOFILE,
149
-            "\n\n-----\n\n" .
150
-                'sig response : ' . $post_sig_response . "\n" .
151
-                'resp : ' . $authenticated_username . "\n"
149
+            "\n\n-----\n\n".
150
+                'sig response : '.$post_sig_response."\n".
151
+                'resp : '.$authenticated_username."\n"
152 152
         );
153 153
     }
154 154
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
             // is user in Teampass?
160 160
             DB::queryfirstrow(
161 161
                 'SELECT id
162
-                FROM ' . prefixTable('users') . '
162
+                FROM ' . prefixTable('users').'
163 163
                 WHERE login = %s',
164 164
                 $post_login
165 165
             );
@@ -169,9 +169,9 @@  discard block
 block discarded – undo
169 169
             }
170 170
         }
171 171
 
172
-        echo '[{"authenticated_username" : "' . $authenticated_username . '"}]';
172
+        echo '[{"authenticated_username" : "'.$authenticated_username.'"}]';
173 173
     } else {
174
-        echo '[{"authenticated_username" : "' . $authenticated_username . '"}]';
174
+        echo '[{"authenticated_username" : "'.$authenticated_username.'"}]';
175 175
     }
176 176
     // ---
177 177
     // ---
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
     //--------
182 182
 
183 183
     // Load superGlobals
184
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
184
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
185 185
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
186 186
     // Prepare GET variables
187 187
     $sessionPwdAttempts = $superGlobal->get('pwd_attempts', 'SESSION');
@@ -284,19 +284,19 @@  discard block
 block discarded – undo
284 284
     } else {
285 285
         throw new Exception("Error file '/includes/config/tp.config.php' not exists", 1);
286 286
     }
287
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
288
-    include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
289
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
287
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
288
+    include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
289
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
290 290
     
291 291
     header('Content-type: text/html; charset=utf-8');
292 292
     error_reporting(E_ERROR);
293 293
 
294 294
     // Load AntiXSS
295
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php';
295
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php';
296 296
     $antiXss = new voku\helper\AntiXSS();
297 297
 
298 298
     // Load superGlobals
299
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
299
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
300 300
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
301 301
 
302 302
     // Prepare GET variables
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
     $server['PHP_AUTH_PW'] = $superGlobal->get('PHP_AUTH_PW', 'SERVER');
311 311
 
312 312
     // connect to the server
313
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
313
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
314 314
     DB::$host = DB_HOST;
315 315
     DB::$user = DB_USER;
316 316
     DB::$password = defined('DB_PASSWD_CLEAR') === false ? defuseReturnDecrypted(DB_PASSWD, $SETTINGS) : DB_PASSWD_CLEAR;
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
     DB::$port = DB_PORT;
319 319
     DB::$encoding = DB_ENCODING;
320 320
     // User's language loading
321
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $sessionUserLanguage . '.php';
321
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$sessionUserLanguage.'.php';
322 322
     
323 323
     // decrypt and retreive data in JSON format
324 324
     if (empty($sessionKey) === true) {
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
         //$arrAttempts = array();
444 444
         $rows = DB::query(
445 445
             'SELECT date
446
-            FROM ' . prefixTable('log_system') . "
446
+            FROM ' . prefixTable('log_system')."
447 447
             WHERE field_1 = %s
448 448
             AND type = 'failed_auth'
449 449
             AND label = 'user_password_not_correct'
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
             foreach ($rows as $record) {
460 460
                 array_push(
461 461
                     $arrAttempts,
462
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date'])
462
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date'])
463 463
                 );
464 464
             }
465 465
         }
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
         $superGlobal->put('user_upgrade_needed', $userInfo['upgrade_needed'], 'SESSION');
496 496
         $superGlobal->put('user_force_relog', $userInfo['force-relog'], 'SESSION');
497 497
         // get personal settings
498
-        if (! isset($userInfo['treeloadstrategy']) || empty($userInfo['treeloadstrategy'])) {
498
+        if (!isset($userInfo['treeloadstrategy']) || empty($userInfo['treeloadstrategy'])) {
499 499
             $userInfo['treeloadstrategy'] = 'full';
500 500
         }
501 501
         $superGlobal->put('treeloadstrategy', $userInfo['treeloadstrategy'], 'SESSION', 'user');
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
         foreach ($superGlobal->get('user_roles', 'SESSION') as $role) {
598 598
             $resRoles = DB::queryFirstRow(
599 599
                 'SELECT title, complexity
600
-                FROM ' . prefixTable('roles_title') . '
600
+                FROM ' . prefixTable('roles_title').'
601 601
                 WHERE id=%i',
602 602
                 $role
603 603
             );
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
 
619 619
         // build complete array of roles
620 620
         $superGlobal->put('arr_roles_full', [], 'SESSION');
621
-        $rows = DB::query('SELECT id, title FROM ' . prefixTable('roles_title') . ' ORDER BY title ASC');
621
+        $rows = DB::query('SELECT id, title FROM '.prefixTable('roles_title').' ORDER BY title ASC');
622 622
         foreach ($rows as $record) {
623 623
             $superGlobal->put(
624 624
                 $record['id'],
@@ -708,10 +708,10 @@  discard block
 block discarded – undo
708 708
         $superGlobal->put('latest_items_tab', [], 'SESSION');
709 709
         $superGlobal->put('nb_roles', 0, 'SESSION');
710 710
         foreach ($superGlobal->get('latest_items', 'SESSION') as $item) {
711
-            if (! empty($item)) {
711
+            if (!empty($item)) {
712 712
                 $dataLastItems = DB::queryFirstRow(
713 713
                     'SELECT id,label,id_tree
714
-                    FROM ' . prefixTable('items') . '
714
+                    FROM ' . prefixTable('items').'
715 715
                     WHERE id=%i',
716 716
                     $item
717 717
                 );
@@ -720,7 +720,7 @@  discard block
 block discarded – undo
720 720
                     [
721 721
                         'id' => $item,
722 722
                         'label' => $dataLastItems['label'],
723
-                        'url' => 'index.php?page=items&amp;group=' . $dataLastItems['id_tree'] . '&amp;id=' . $item,
723
+                        'url' => 'index.php?page=items&amp;group='.$dataLastItems['id_tree'].'&amp;id='.$item,
724 724
                     ],
725 725
                     'SESSION',
726 726
                     'latest_items_tab'
@@ -737,12 +737,12 @@  discard block
 block discarded – undo
737 737
         ) {
738 738
             // get all Admin users
739 739
             $receivers = '';
740
-            $rows = DB::query('SELECT email FROM ' . prefixTable('users') . " WHERE admin = %i and email != ''", 1);
740
+            $rows = DB::query('SELECT email FROM '.prefixTable('users')." WHERE admin = %i and email != ''", 1);
741 741
             foreach ($rows as $record) {
742 742
                 if (empty($receivers)) {
743 743
                     $receivers = $record['email'];
744 744
                 } else {
745
-                    $receivers = ',' . $record['email'];
745
+                    $receivers = ','.$record['email'];
746 746
                 }
747 747
             }
748 748
             // Add email to table
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
                             '#tp_time#',
759 759
                         ],
760 760
                         [
761
-                            ' ' . $superGlobal->get('login', 'SESSION') . ' (IP: ' . getClientIpServer() . ')',
761
+                            ' '.$superGlobal->get('login', 'SESSION').' (IP: '.getClientIpServer().')',
762 762
                             date($SETTINGS['date_format'], (int) $superGlobal->get('last_connection', 'SESSION')),
763 763
                             date($SETTINGS['time_format'], (int) $superGlobal->get('last_connection', 'SESSION')),
764 764
                         ],
@@ -903,8 +903,8 @@  discard block
 block discarded – undo
903 903
     debugIdentify(
904 904
         DEBUGDUO,
905 905
         DEBUGDUOFILE,
906
-        "\n\n----\n" .
907
-            'Identified : ' . filter_var($return, FILTER_SANITIZE_STRING) . "\n\n"
906
+        "\n\n----\n".
907
+            'Identified : '.filter_var($return, FILTER_SANITIZE_STRING)."\n\n"
908 908
     );
909 909
     echo prepareExchangedData(
910 910
         [
@@ -970,44 +970,44 @@  discard block
 block discarded – undo
970 970
         ],
971 971
     ];
972 972
     // Load expected libraries
973
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Illuminate/Contracts/Auth/Authenticatable.php';
974
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/EnumeratesValues.php';
975
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
976
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/helpers.php';
977
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php';
978
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Contracts/Support/Jsonable.php';
979
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Contracts/Support/Arrayable.php';
980
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Enumerable.php';
981
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Collection.php';
982
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonTimeZone.php';
983
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Units.php';
984
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Week.php';
985
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Timestamp.php';
986
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Test.php';
987
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/ObjectInitialisation.php';
988
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Serialization.php';
989
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/IntervalRounding.php';
990
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Rounding.php';
991
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Localization.php';
992
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Options.php';
993
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Cast.php';
994
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mutability.php';
995
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Modifiers.php';
996
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mixin.php';
997
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Macro.php';
998
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Difference.php';
999
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Creator.php';
1000
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Converter.php';
1001
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Comparison.php';
1002
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Boundaries.php';
1003
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Date.php';
1004
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonInterface.php';
1005
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Carbon.php';
1006
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php';
1007
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php';
1008
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php';
1009
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapBase.php';
1010
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php';
973
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Illuminate/Contracts/Auth/Authenticatable.php';
974
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/EnumeratesValues.php';
975
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
976
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/helpers.php';
977
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php';
978
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Contracts/Support/Jsonable.php';
979
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Contracts/Support/Arrayable.php';
980
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Enumerable.php';
981
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Collection.php';
982
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonTimeZone.php';
983
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Units.php';
984
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Week.php';
985
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Timestamp.php';
986
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Test.php';
987
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/ObjectInitialisation.php';
988
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Serialization.php';
989
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/IntervalRounding.php';
990
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Rounding.php';
991
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Localization.php';
992
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Options.php';
993
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Cast.php';
994
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mutability.php';
995
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Modifiers.php';
996
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mixin.php';
997
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Macro.php';
998
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Difference.php';
999
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Creator.php';
1000
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Converter.php';
1001
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Comparison.php';
1002
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Boundaries.php';
1003
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Date.php';
1004
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonInterface.php';
1005
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Carbon.php';
1006
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php';
1007
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php';
1008
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php';
1009
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapBase.php';
1010
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php';
1011 1011
     $ad = new SplClassLoader('LdapRecord', '../includes/libraries');
1012 1012
     $ad->register();
1013 1013
     $connection = new Connection($config);
@@ -1019,7 +1019,7 @@  discard block
 block discarded – undo
1019 1019
         $error = $e->getDetailedError();
1020 1020
         return [
1021 1021
             'error' => true,
1022
-            'message' => langHdl('error').' : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage().' '.$config['username'],
1022
+            'message' => langHdl('error').' : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage().' '.$config['username'],
1023 1023
 
1024 1024
         ];
1025 1025
     }
@@ -1047,7 +1047,7 @@  discard block
 block discarded – undo
1047 1047
     }
1048 1048
 
1049 1049
     // load passwordLib library
1050
-    $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1050
+    $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries');
1051 1051
     $pwdlib->register();
1052 1052
     $pwdlib = new PasswordLib\PasswordLib();
1053 1053
     $hashedPassword = $pwdlib->createPasswordHash($passwordClear);
@@ -1112,7 +1112,7 @@  discard block
 block discarded – undo
1112 1112
 function yubicoMFACheck($dataReceived, string $userInfo, array $SETTINGS): array
1113 1113
 {
1114 1114
     // Load superGlobals
1115
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1115
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1116 1116
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1117 1117
     $sessionAdmin = $superGlobal->get('user_admin', 'SESSION');
1118 1118
     $sessionUrl = $superGlobal->get('initial_url', 'SESSION');
@@ -1151,7 +1151,7 @@  discard block
 block discarded – undo
1151 1151
     }
1152 1152
 
1153 1153
     // Now check yubico validity
1154
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/Yubico/Yubico.php';
1154
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/Yubico/Yubico.php';
1155 1155
     $yubi = new Auth_Yubico($yubico_user_id, $yubico_user_key);
1156 1156
     $auth = $yubi->verify($yubico_key);
1157 1157
     //, null, null, null, 60
@@ -1203,7 +1203,7 @@  discard block
 block discarded – undo
1203 1203
             'gestionnaire' => '0',
1204 1204
             'can_manage_all_users' => '0',
1205 1205
             'personal_folder' => $SETTINGS['enable_pf_feature'] === '1' ? '1' : '0',
1206
-            'fonction_id' => (empty($retLDAP['user_info_from_ad'][0]['commonGroupsLdapVsTeampass']) === false ? $retLDAP['user_info_from_ad'][0]['commonGroupsLdapVsTeampass'] . ';' : '') . (isset($SETTINGS['ldap_new_user_role']) === true ? $SETTINGS['ldap_new_user_role'] : '0'),
1206
+            'fonction_id' => (empty($retLDAP['user_info_from_ad'][0]['commonGroupsLdapVsTeampass']) === false ? $retLDAP['user_info_from_ad'][0]['commonGroupsLdapVsTeampass'].';' : '').(isset($SETTINGS['ldap_new_user_role']) === true ? $SETTINGS['ldap_new_user_role'] : '0'),
1207 1207
             'groupes_interdits' => '',
1208 1208
             'groupes_visibles' => '',
1209 1209
             'last_pw_change' => (int) time(),
@@ -1228,7 +1228,7 @@  discard block
 block discarded – undo
1228 1228
             ]
1229 1229
         );
1230 1230
         // Rebuild tree
1231
-        $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1231
+        $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
1232 1232
         $tree->register();
1233 1233
         $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
1234 1234
         $tree->rebuild();
@@ -1259,13 +1259,13 @@  discard block
 block discarded – undo
1259 1259
         && empty($dataReceived['GACode']) === false
1260 1260
     ) {
1261 1261
         // Load superGlobals
1262
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1262
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1263 1263
         $superGlobal = new protect\SuperGlobal\SuperGlobal();
1264 1264
         $sessionAdmin = $superGlobal->get('user_admin', 'SESSION');
1265 1265
         $sessionUrl = $superGlobal->get('initial_url', 'SESSION');
1266 1266
         $sessionPwdAttempts = $superGlobal->get('pwd_attempts', 'SESSION');
1267 1267
         // load library
1268
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php';
1268
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php';
1269 1269
         // create new instance
1270 1270
         $tfa = new Authentication\TwoFactorAuth\TwoFactorAuth($SETTINGS['ga_website_name']);
1271 1271
         // Init
@@ -1287,7 +1287,7 @@  discard block
 block discarded – undo
1287 1287
             $mfaMessage = langHdl('ga_flash_qr_and_login');
1288 1288
             // generate new QR
1289 1289
             $new_2fa_qr = $tfa->getQRCodeImageAsDataUri(
1290
-                'Teampass - ' . $username,
1290
+                'Teampass - '.$username,
1291 1291
                 $userInfo['ga']
1292 1292
             );
1293 1293
             // clear temporary code from DB
@@ -1300,7 +1300,7 @@  discard block
 block discarded – undo
1300 1300
                 $userInfo['id']
1301 1301
             );
1302 1302
             $firstTime = [
1303
-                'value' => '<img src="' . $new_2fa_qr . '">',
1303
+                'value' => '<img src="'.$new_2fa_qr.'">',
1304 1304
                 'user_admin' => isset($sessionAdmin) ? (int) $sessionAdmin : '',
1305 1305
                 'initial_url' => isset($sessionUrl) === true ? $sessionUrl : '',
1306 1306
                 'pwd_attempts' => (int) $sessionPwdAttempts,
@@ -1352,8 +1352,8 @@  discard block
 block discarded – undo
1352 1352
     // Set to false
1353 1353
     $userPasswordVerified = false;
1354 1354
     // load passwordLib library
1355
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1356
-    $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1355
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1356
+    $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries');
1357 1357
     $pwdlib->register();
1358 1358
     $pwdlib = new PasswordLib\PasswordLib();
1359 1359
     // Check if old encryption used
@@ -1484,7 +1484,7 @@  discard block
 block discarded – undo
1484 1484
     // Brute force management
1485 1485
     if ($sessionPwdAttempts > 3) {
1486 1486
         // Load superGlobals
1487
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1487
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1488 1488
         $superGlobal = new protect\SuperGlobal\SuperGlobal();
1489 1489
         $superGlobal->put('next_possible_pwd_attempts', time() + 10, 'SESSION');
1490 1490
         $superGlobal->put('pwd_attempts', 0, 'SESSION');
@@ -1526,7 +1526,7 @@  discard block
 block discarded – undo
1526 1526
     // Check if user exists
1527 1527
     $userInfo = DB::queryFirstRow(
1528 1528
         'SELECT *
1529
-        FROM ' . prefixTable('users') . ' WHERE login=%s',
1529
+        FROM ' . prefixTable('users').' WHERE login=%s',
1530 1530
         $username
1531 1531
     );
1532 1532
     
Please login to merge, or discard this patch.
sources/tree.php 1 patch
Spacing   +47 added lines, -51 removed lines patch added patch discarded remove patch
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
 }
43 43
 
44 44
 // includes
45
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
46
-require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
47
-require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
48
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
49
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
45
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
46
+require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
47
+require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
48
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
49
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
50 50
 
51 51
 // header
52 52
 header('Content-type: text/html; charset=utf-8');
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 }
61 61
 
62 62
 // Connect to mysql server
63
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
63
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
64 64
 if (defined('DB_PASSWD_CLEAR') === false) {
65 65
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
66 66
 }
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 DB::$encoding = DB_ENCODING;
73 73
 
74 74
 // Superglobal load
75
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
75
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
76 76
 $superGlobal = new protect\SuperGlobal\SuperGlobal();
77 77
 $get = [];
78 78
 $get['user_tree_structure'] = $superGlobal->get('user_tree_structure', 'GET');
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 $session['personal_visible_groups'] = $superGlobal->get('personal_visible_groups', 'SESSION');
93 93
 
94 94
 $lastFolderChange = DB::query(
95
-    'SELECT * FROM ' . prefixTable('misc') . '
95
+    'SELECT * FROM '.prefixTable('misc').'
96 96
     WHERE type = %s AND intitule = %s',
97 97
     'timestamp',
98 98
     'last_folder_change'
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
     || (isset($get['force_refresh']) === true && (int) $get['force_refresh'] === 1)
104 104
 ) {
105 105
     // Build tree
106
-    $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
106
+    $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
107 107
     $tree->register();
108 108
     $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
109 109
 
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
     $SETTINGS
214 214
 ) {
215 215
     // Load library
216
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
216
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
217 217
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
218 218
 
219 219
     // Prepare superGlobal variables
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
                 // get count of Items in this folder
268 268
                 DB::query(
269 269
                     'SELECT *
270
-                    FROM ' . prefixTable('items') . '
270
+                    FROM ' . prefixTable('items').'
271 271
                     WHERE inactif=%i AND id_tree = %i',
272 272
                     0,
273 273
                     $node->id
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
                 // get info about current folder
278 278
                 DB::query(
279 279
                     'SELECT *
280
-                    FROM ' . prefixTable('nested_tree') . '
280
+                    FROM ' . prefixTable('nested_tree').'
281 281
                     WHERE parent_id = %i',
282 282
                     $node->id
283 283
                 );
@@ -285,11 +285,10 @@  discard block
 block discarded – undo
285 285
 
286 286
                 // If personal Folder, convert id into user name
287 287
                 $node->title = $node->title === $session_user_id && (int) $node->nlevel === 1 ?
288
-                    $session_login :
289
-                    ($node->title === null ? '' : htmlspecialchars_decode($node->title, ENT_QUOTES));
288
+                    $session_login : ($node->title === null ? '' : htmlspecialchars_decode($node->title, ENT_QUOTES));
290 289
 
291 290
                 // prepare json return for current node
292
-                $parent = $node->parent_id === 0 ? '#' : 'li_' . $node->parent_id;
291
+                $parent = $node->parent_id === 0 ? '#' : 'li_'.$node->parent_id;
293 292
 
294 293
                 // special case for READ-ONLY folder
295 294
                 $title = $session_user_read_only === true && in_array($node->id, $session_personal_folders) === false ? langHdl('read_only_account') : $title;
@@ -299,33 +298,30 @@  discard block
 block discarded – undo
299 298
 
300 299
                 if (in_array($node->id, $session_groupes_visibles)) {
301 300
                     if (in_array($node->id, $session_read_only_folders)) {
302
-                        $text = "<i class='far fa-eye fa-xs mr-1'></i>" . $text;
301
+                        $text = "<i class='far fa-eye fa-xs mr-1'></i>".$text;
303 302
                         $title = langHdl('read_only_account');
304 303
                         $restricted = 1;
305 304
                         $folderClass = 'folder_not_droppable';
306 305
                     } elseif ($session_user_read_only === true && !in_array($node->id, $session_personal_visible_groups)) {
307
-                        $text = "<i class='far fa-eye fa-xs mr-1'></i>" . $text;
306
+                        $text = "<i class='far fa-eye fa-xs mr-1'></i>".$text;
308 307
                     }
309 308
                     $text .=
310
-                        ' <span class=\'badge badge-danger ml-2 items_count\' id=\'itcount_' . $node->id . '\'>' . $itemsNb . '</span>'
309
+                        ' <span class=\'badge badge-danger ml-2 items_count\' id=\'itcount_'.$node->id.'\'>'.$itemsNb.'</span>'
311 310
                         .(isset($SETTINGS['tree_counters']) && $SETTINGS['tree_counters'] === 1 ?
312
-                            '/'.$nbChildrenItems .'/'.(count($nodeDescendants) - 1)  :
313
-                            '')
311
+                            '/'.$nbChildrenItems.'/'.(count($nodeDescendants) - 1) : '')
314 312
                         .'</span>';
315 313
                 } elseif (in_array($node->id, $listFoldersLimitedKeys)) {
316 314
                     $restricted = 1;
317 315
                     $text .= 
318 316
                         $session_user_read_only === true ?
319
-                            "<i class='far fa-eye fa-xs mr-1'></i>" :
320
-                            '<span class="badge badge-danger ml-2 items_count" id="itcount_' . $node->id . '">' . count($session_list_folders_limited[$node->id]) . '</span>';
317
+                            "<i class='far fa-eye fa-xs mr-1'></i>" : '<span class="badge badge-danger ml-2 items_count" id="itcount_'.$node->id.'">'.count($session_list_folders_limited[$node->id]).'</span>';
321 318
                 } elseif (in_array($node->id, $listRestrictedFoldersForItemsKeys)) {
322 319
                     $restricted = 1;
323 320
                     if ($session_user_read_only === true) {
324
-                        $text = "<i class='far fa-eye fa-xs mr-1'></i>" . $text;
321
+                        $text = "<i class='far fa-eye fa-xs mr-1'></i>".$text;
325 322
                     }
326 323
                     $text .= $session_user_read_only === true ? 
327
-                        "<i class='far fa-eye fa-xs mr-1'></i>" :
328
-                        '<span class="badge badge-danger ml-2 items_count" id="itcount_' . $node->id . '">' . count($session_list_restricted_folders_for_items[$node->id]) . '</span>';
324
+                        "<i class='far fa-eye fa-xs mr-1'></i>" : '<span class="badge badge-danger ml-2 items_count" id="itcount_'.$node->id.'">'.count($session_list_restricted_folders_for_items[$node->id]).'</span>';
329 325
                 } else {
330 326
                     $restricted = 1;
331 327
                     $folderClass = 'folder_not_droppable';
@@ -351,18 +347,18 @@  discard block
 block discarded – undo
351 347
                     array_push(
352 348
                         $ret_json,
353 349
                         array(
354
-                            'id' => 'li_' . $node->id,
350
+                            'id' => 'li_'.$node->id,
355 351
                             'parent' => $parent,
356 352
                             'text' => $text,
357 353
                             'children' => $childrenNb === 0 ? false : true,
358 354
                             'li_attr' => array(
359 355
                                 'class' => 'jstreeopen',
360
-                                'title' => 'ID [' . $node->id . '] ' . $title,
356
+                                'title' => 'ID ['.$node->id.'] '.$title,
361 357
                             ),
362 358
                             'a_attr' => array(
363
-                                'id' => 'fld_' . $node->id,
359
+                                'id' => 'fld_'.$node->id,
364 360
                                 'class' => $folderClass,
365
-                                'onclick' => 'ListerItems(' . $node->id . ', ' . $restricted . ', 0, 1)',
361
+                                'onclick' => 'ListerItems('.$node->id.', '.$restricted.', 0, 1)',
366 362
                                 'data-title' => $node->title,
367 363
                             ),
368 364
                         )
@@ -371,13 +367,13 @@  discard block
 block discarded – undo
371 367
                     array_push(
372 368
                         $ret_json,
373 369
                         array(
374
-                            'id' => 'li_' . $node->id,
370
+                            'id' => 'li_'.$node->id,
375 371
                             'parent' =>  $parent,
376 372
                             'children' => $childrenNb === 0 ? false : true,
377
-                            'text' => '<i class="fas fa-times fa-xs text-danger mr-1"></i>' . $text,
373
+                            'text' => '<i class="fas fa-times fa-xs text-danger mr-1"></i>'.$text,
378 374
                             'li_attr' => array(
379 375
                                 'class' => '',
380
-                                'title' => 'ID [' . $node->id . '] ' . langHdl('no_access'),
376
+                                'title' => 'ID ['.$node->id.'] '.langHdl('no_access'),
381 377
                             ),
382 378
                         )
383 379
                     );
@@ -470,7 +466,7 @@  discard block
 block discarded – undo
470 466
                 ) === true
471 467
             ) {
472 468
                 DB::query(
473
-                    'SELECT * FROM ' . prefixTable('items') . '
469
+                    'SELECT * FROM '.prefixTable('items').'
474 470
                     WHERE inactif=%i AND id_tree = %i',
475 471
                     0,
476 472
                     $node
@@ -557,7 +553,7 @@  discard block
 block discarded – undo
557 553
 {
558 554
     // get info about current folder
559 555
     DB::query(
560
-        'SELECT * FROM ' . prefixTable('items') . '
556
+        'SELECT * FROM '.prefixTable('items').'
561 557
         WHERE inactif=%i AND id_tree = %i',
562 558
         0,
563 559
         $completTree[$nodeId]->id
@@ -658,7 +654,7 @@  discard block
 block discarded – undo
658 654
     */
659 655
 
660 656
     // prepare json return for current node
661
-    $parent = $completTree[$nodeId]->parent_id === '0' ? '#' : 'li_' . $completTree[$nodeId]->parent_id;
657
+    $parent = $completTree[$nodeId]->parent_id === '0' ? '#' : 'li_'.$completTree[$nodeId]->parent_id;
662 658
 
663 659
     // handle displaying
664 660
     if (
@@ -678,17 +674,17 @@  discard block
 block discarded – undo
678 674
         array_push(
679 675
             $ret_json,
680 676
             array(
681
-                'id' => 'li_' . $completTree[$nodeId]->id,
677
+                'id' => 'li_'.$completTree[$nodeId]->id,
682 678
                 'parent' => $last_visible_parent === -1 ? $parent : $last_visible_parent,
683 679
                 'text' => $text.$completTree[$nodeId]->title.$nodeData['html'],
684 680
                 'li_attr' => array(
685 681
                     'class' => 'jstreeopen',
686
-                    'title' => 'ID [' . $completTree[$nodeId]->id . '] ' . $nodeData['title'],
682
+                    'title' => 'ID ['.$completTree[$nodeId]->id.'] '.$nodeData['title'],
687 683
                 ),
688 684
                 'a_attr' => array(
689
-                    'id' => 'fld_' . $completTree[$nodeId]->id,
685
+                    'id' => 'fld_'.$completTree[$nodeId]->id,
690 686
                     'class' => $nodeData['folderClass'],
691
-                    'onclick' => 'ListerItems(' . $completTree[$nodeId]->id . ', ' . $nodeData['restricted'] . ', 0, 1)',
687
+                    'onclick' => 'ListerItems('.$completTree[$nodeId]->id.', '.$nodeData['restricted'].', 0, 1)',
692 688
                     'data-title' => $completTree[$nodeId]->title,
693 689
                 ),
694 690
             )
@@ -697,12 +693,12 @@  discard block
 block discarded – undo
697 693
         array_push(
698 694
             $ret_json,
699 695
             array(
700
-                'id' => 'li_' . $completTree[$nodeId]->id,
696
+                'id' => 'li_'.$completTree[$nodeId]->id,
701 697
                 'parent' => $last_visible_parent === -1 ? $parent : $last_visible_parent,
702 698
                 'text' => '<i class="fas fa-times fa-xs text-danger mr-1"></i>'.$text.$completTree[$nodeId]->title.$nodeData['html'],
703 699
                 'li_attr' => array(
704 700
                     'class' => '',
705
-                    'title' => 'ID [' . $completTree[$nodeId]->id . '] ' . langHdl('no_access'),
701
+                    'title' => 'ID ['.$completTree[$nodeId]->id.'] '.langHdl('no_access'),
706 702
                 ),
707 703
             )
708 704
         );
@@ -765,8 +761,8 @@  discard block
 block discarded – undo
765 761
     if (in_array($nodeId, $session_groupes_visibles) === true) {
766 762
         if (in_array($nodeId, $session_read_only_folders) === true) {
767 763
             return [
768
-                'html' => '<i class="far fa-eye fa-xs mr-1"></i><span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . $itemsNb .
769
-                    ($tree_counters === 1 ? '/'.$nbChildrenItems .'/'.(count($nodeDescendants) - 1)  : '') . '</span>',
764
+                'html' => '<i class="far fa-eye fa-xs mr-1"></i><span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.$itemsNb.
765
+                    ($tree_counters === 1 ? '/'.$nbChildrenItems.'/'.(count($nodeDescendants) - 1) : '').'</span>',
770 766
                 'title' => langHdl('read_only_account'),
771 767
                 'restricted' => 1,
772 768
                 'folderClass' => 'folder_not_droppable',
@@ -780,8 +776,8 @@  discard block
 block discarded – undo
780 776
             && in_array($nodeId, $session_personal_visible_groups) === false
781 777
         ) {
782 778
             return [
783
-                'html' => '<i class="far fa-eye fa-xs mr-1"></i><span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . $itemsNb .
784
-                    ($tree_counters === 1 ? '/'.$nbChildrenItems .'/'.(count($nodeDescendants) - 1)  : '') . '</span>',
779
+                'html' => '<i class="far fa-eye fa-xs mr-1"></i><span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.$itemsNb.
780
+                    ($tree_counters === 1 ? '/'.$nbChildrenItems.'/'.(count($nodeDescendants) - 1) : '').'</span>',
785 781
                 'title' => $title,
786 782
                 'restricted' => 0,
787 783
                 'folderClass' => 'folder',
@@ -791,8 +787,8 @@  discard block
 block discarded – undo
791 787
         }
792 788
         
793 789
         return [
794
-            'html' => '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . $itemsNb .
795
-                ($tree_counters === 1 ? '/'.$nbChildrenItems .'/'.(count($nodeDescendants) - 1)  : '') . '</span>',
790
+            'html' => '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.$itemsNb.
791
+                ($tree_counters === 1 ? '/'.$nbChildrenItems.'/'.(count($nodeDescendants) - 1) : '').'</span>',
796 792
             'title' => $title,
797 793
             'restricted' => 0,
798 794
             'folderClass' => 'folder',
@@ -803,8 +799,8 @@  discard block
 block discarded – undo
803 799
     
804 800
     if (in_array($nodeId, $listFoldersLimitedKeys) === true) {
805 801
         return [
806
-            'html' => ($session_user_read_only === true ? '<i class="far fa-eye fa-xs mr-1"></i>' : '') .
807
-                '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . count($session_list_folders_limited[$nodeId]) . '</span>',
802
+            'html' => ($session_user_read_only === true ? '<i class="far fa-eye fa-xs mr-1"></i>' : '').
803
+                '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.count($session_list_folders_limited[$nodeId]).'</span>',
808 804
             'title' => $title,
809 805
             'restricted' => 1,
810 806
             'folderClass' => 'folder',
@@ -815,8 +811,8 @@  discard block
 block discarded – undo
815 811
     
816 812
     if (in_array($nodeId, $listRestrictedFoldersForItemsKeys) === true) {
817 813
         return [
818
-            'html' => $session_user_read_only === true ? '<i class="far fa-eye fa-xs mr-1"></i>' : '' .
819
-                '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . count($session_list_restricted_folders_for_items[$nodeId]) . '</span>',
814
+            'html' => $session_user_read_only === true ? '<i class="far fa-eye fa-xs mr-1"></i>' : ''.
815
+                '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.count($session_list_restricted_folders_for_items[$nodeId]).'</span>',
820 816
             'title' => $title,
821 817
             'restricted' => 1,
822 818
             'folderClass' => 'folder',
Please login to merge, or discard this patch.