Passed
Push — master ( d66e0a...b50064 )
by Nils
04:06
created
sources/backups.queries.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -37,23 +37,23 @@  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'], 'options', $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
 
49
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
50
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
49
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
50
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
51 51
 header('Content-type: text/html; charset=utf-8');
52 52
 header('Cache-Control: no-cache, must-revalidate');
53 53
 require_once 'main.functions.php';
54 54
 
55 55
 // Connect to mysql server
56
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
56
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
57 57
 DB::$host = DB_HOST;
58 58
 DB::$user = DB_USER;
59 59
 DB::$password = DB_PASSWD_CLEAR;
@@ -111,21 +111,21 @@  discard block
 block discarded – undo
111 111
             // Prepare variables
112 112
             $post_key = filter_var($dataReceived['encryptionKey'], FILTER_SANITIZE_STRING);
113 113
 
114
-            require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
114
+            require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
115 115
             $return = '';
116 116
 
117 117
             //Get all tables
118 118
             $tables = array();
119 119
             $result = DB::query('SHOW TABLES');
120 120
             foreach ($result as $row) {
121
-                $tables[] = $row['Tables_in_' . DB_NAME];
121
+                $tables[] = $row['Tables_in_'.DB_NAME];
122 122
             }
123 123
 
124 124
             //cycle through
125 125
             foreach ($tables as $table) {
126 126
                 if (empty($pre) || substr_count($table, $pre) > 0) {
127 127
                     // Do query
128
-                    $result = DB::queryRaw('SELECT * FROM ' . $table);
128
+                    $result = DB::queryRaw('SELECT * FROM '.$table);
129 129
                     DB::queryRaw(
130 130
                         'SELECT *
131 131
                         FROM INFORMATION_SCHEMA.COLUMNS
@@ -137,19 +137,19 @@  discard block
 block discarded – undo
137 137
                     $numFields = DB::count();
138 138
 
139 139
                     // prepare a drop table
140
-                    $return .= 'DROP TABLE ' . $table . ';';
141
-                    $row2 = DB::queryfirstrow('SHOW CREATE TABLE ' . $table);
142
-                    $return .= "\n\n" . $row2['Create Table'] . ";\n\n";
140
+                    $return .= 'DROP TABLE '.$table.';';
141
+                    $row2 = DB::queryfirstrow('SHOW CREATE TABLE '.$table);
142
+                    $return .= "\n\n".$row2['Create Table'].";\n\n";
143 143
 
144 144
                     //prepare all fields and datas
145 145
                     for ($i = 0; $i < $numFields; ++$i) {
146 146
                         while ($row = $result->fetch_row()) {
147
-                            $return .= 'INSERT INTO ' . $table . ' VALUES(';
147
+                            $return .= 'INSERT INTO '.$table.' VALUES(';
148 148
                             for ($j = 0; $j < $numFields; ++$j) {
149 149
                                 $row[$j] = is_null($row[$j]) === false ? addslashes($row[$j]) : '';
150 150
                                 $row[$j] = preg_replace("/\n/", '\\n', $row[$j]);
151 151
                                 if (isset($row[$j])) {
152
-                                    $return .= '"' . $row[$j] . '"';
152
+                                    $return .= '"'.$row[$j].'"';
153 153
                                 } else {
154 154
                                     $return .= 'NULL';
155 155
                                 }
@@ -169,8 +169,8 @@  discard block
 block discarded – undo
169 169
                 $token = GenerateCryptKey(20, false, true, true, false, true, $SETTINGS);
170 170
 
171 171
                 //save file
172
-                $filename = time() . '-' . $token . '.sql';
173
-                $handle = fopen($SETTINGS['path_to_files_folder'] . '/' . $filename, 'w+');
172
+                $filename = time().'-'.$token.'.sql';
173
+                $handle = fopen($SETTINGS['path_to_files_folder'].'/'.$filename, 'w+');
174 174
                 if ($handle !== false) {
175 175
                     //write file
176 176
                     fwrite($handle, $return);
@@ -182,17 +182,17 @@  discard block
 block discarded – undo
182 182
                     // Encrypt the file
183 183
                     prepareFileWithDefuse(
184 184
                         'encrypt',
185
-                        $SETTINGS['path_to_files_folder'] . '/' . $filename,
186
-                        $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
185
+                        $SETTINGS['path_to_files_folder'].'/'.$filename,
186
+                        $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
187 187
                         $SETTINGS,
188 188
                         $post_key
189 189
                     );
190 190
 
191 191
                     // Do clean
192
-                    unlink($SETTINGS['path_to_files_folder'] . '/' . $filename);
192
+                    unlink($SETTINGS['path_to_files_folder'].'/'.$filename);
193 193
                     rename(
194
-                        $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
195
-                        $SETTINGS['path_to_files_folder'] . '/' . $filename
194
+                        $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
195
+                        $SETTINGS['path_to_files_folder'].'/'.$filename
196 196
                     );
197 197
                 }
198 198
 
@@ -213,9 +213,9 @@  discard block
 block discarded – undo
213 213
                     array(
214 214
                         'error' => false,
215 215
                         'message' => '',
216
-                        'download' => 'sources/downloadFile.php?name=' . urlencode($filename) .
217
-                            '&sub=files&file=' . $filename . '&type=sql&key=' . $_SESSION['key'] . '&key_tmp=' .
218
-                            $_SESSION['key_tmp'] . '&pathIsFiles=1',
216
+                        'download' => 'sources/downloadFile.php?name='.urlencode($filename).
217
+                            '&sub=files&file='.$filename.'&type=sql&key='.$_SESSION['key'].'&key_tmp='.
218
+                            $_SESSION['key_tmp'].'&pathIsFiles=1',
219 219
                     ),
220 220
                     'encode'
221 221
                 );
@@ -268,12 +268,12 @@  discard block
 block discarded – undo
268 268
             $post_key = filter_var($dataReceived['encryptionKey'], FILTER_SANITIZE_STRING);
269 269
             $post_backupFile = filter_var($dataReceived['backupFile'], FILTER_SANITIZE_STRING);
270 270
 
271
-            include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
271
+            include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
272 272
 
273 273
             // Get filename from database
274 274
             $data = DB::queryFirstRow(
275 275
                 'SELECT valeur
276
-                FROM ' . prefixTable('misc') . '
276
+                FROM ' . prefixTable('misc').'
277 277
                 WHERE increment_id = %i',
278 278
                 $post_backupFile
279 279
             );
@@ -292,8 +292,8 @@  discard block
 block discarded – undo
292 292
                 // Decrypt the file
293 293
                 $ret = prepareFileWithDefuse(
294 294
                     'decrypt',
295
-                    $SETTINGS['path_to_files_folder'] . '/' . $post_backupFile,
296
-                    $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $post_backupFile,
295
+                    $SETTINGS['path_to_files_folder'].'/'.$post_backupFile,
296
+                    $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$post_backupFile,
297 297
                     $SETTINGS,
298 298
                     $post_key
299 299
                 );
@@ -311,10 +311,10 @@  discard block
 block discarded – undo
311 311
                 }
312 312
 
313 313
                 // Do clean
314
-                fileDelete($SETTINGS['path_to_files_folder'] . '/' . $post_backupFile, $SETTINGS);
315
-                $post_backupFile = $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $post_backupFile;
314
+                fileDelete($SETTINGS['path_to_files_folder'].'/'.$post_backupFile, $SETTINGS);
315
+                $post_backupFile = $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$post_backupFile;
316 316
             } else {
317
-                $post_backupFile = $SETTINGS['path_to_files_folder'] . '/' . $post_backupFile;
317
+                $post_backupFile = $SETTINGS['path_to_files_folder'].'/'.$post_backupFile;
318 318
             }
319 319
 
320 320
             //read sql file
Please login to merge, or discard this patch.
sources/main.functions.php 1 patch
Spacing   +278 added lines, -280 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 
35 35
 // Load config if $SETTINGS not defined
36 36
 if (isset($SETTINGS['cpassman_dir']) === false || empty($SETTINGS['cpassman_dir']) === true) {
37
-    include_once __DIR__ . '/../includes/config/tp.config.php';
37
+    include_once __DIR__.'/../includes/config/tp.config.php';
38 38
 }
39 39
 
40 40
 header('Content-type: text/html; charset=utf-8');
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
         */
74 74
         $session_language = $_SESSION['teampass']['en_lang'][trim($string)];
75 75
         if (isset($session_language) === false) {
76
-            $_SESSION['teampass']['en_lang'] = include_once __DIR__. '/../includes/language/english.php';
76
+            $_SESSION['teampass']['en_lang'] = include_once __DIR__.'/../includes/language/english.php';
77 77
             $session_language = $_SESSION['teampass']['en_lang'][trim($string)];
78 78
         }
79 79
     }
@@ -124,25 +124,25 @@  discard block
 block discarded – undo
124 124
  */
125 125
 function cryption(string $message, string $ascii_key, string $type, ?array $SETTINGS = []): array
126 126
 {
127
-    $ascii_key = empty($ascii_key) === true ? file_get_contents(SECUREPATH . '/teampass-seckey.txt') : $ascii_key;
127
+    $ascii_key = empty($ascii_key) === true ? file_get_contents(SECUREPATH.'/teampass-seckey.txt') : $ascii_key;
128 128
     $err = false;
129 129
     
130 130
     $path = __DIR__.'/../includes/libraries/Encryption/Encryption/';
131 131
 
132
-    include_once $path . 'Exception/CryptoException.php';
133
-    include_once $path . 'Exception/BadFormatException.php';
134
-    include_once $path . 'Exception/EnvironmentIsBrokenException.php';
135
-    include_once $path . 'Exception/IOException.php';
136
-    include_once $path . 'Exception/WrongKeyOrModifiedCiphertextException.php';
137
-    include_once $path . 'Crypto.php';
138
-    include_once $path . 'Encoding.php';
139
-    include_once $path . 'DerivedKeys.php';
140
-    include_once $path . 'Key.php';
141
-    include_once $path . 'KeyOrPassword.php';
142
-    include_once $path . 'File.php';
143
-    include_once $path . 'RuntimeTests.php';
144
-    include_once $path . 'KeyProtectedByPassword.php';
145
-    include_once $path . 'Core.php';
132
+    include_once $path.'Exception/CryptoException.php';
133
+    include_once $path.'Exception/BadFormatException.php';
134
+    include_once $path.'Exception/EnvironmentIsBrokenException.php';
135
+    include_once $path.'Exception/IOException.php';
136
+    include_once $path.'Exception/WrongKeyOrModifiedCiphertextException.php';
137
+    include_once $path.'Crypto.php';
138
+    include_once $path.'Encoding.php';
139
+    include_once $path.'DerivedKeys.php';
140
+    include_once $path.'Key.php';
141
+    include_once $path.'KeyOrPassword.php';
142
+    include_once $path.'File.php';
143
+    include_once $path.'RuntimeTests.php';
144
+    include_once $path.'KeyProtectedByPassword.php';
145
+    include_once $path.'Core.php';
146 146
     
147 147
     // convert KEY
148 148
     $key = \Defuse\Crypto\Key::loadFromAsciiSafeString($ascii_key);
@@ -187,20 +187,20 @@  discard block
 block discarded – undo
187 187
         $path = '../includes/libraries/Encryption/Encryption/';
188 188
     }
189 189
 
190
-    include_once $path . 'Exception/CryptoException.php';
191
-    include_once $path . 'Exception/BadFormatException.php';
192
-    include_once $path . 'Exception/EnvironmentIsBrokenException.php';
193
-    include_once $path . 'Exception/IOException.php';
194
-    include_once $path . 'Exception/WrongKeyOrModifiedCiphertextException.php';
195
-    include_once $path . 'Crypto.php';
196
-    include_once $path . 'Encoding.php';
197
-    include_once $path . 'DerivedKeys.php';
198
-    include_once $path . 'Key.php';
199
-    include_once $path . 'KeyOrPassword.php';
200
-    include_once $path . 'File.php';
201
-    include_once $path . 'RuntimeTests.php';
202
-    include_once $path . 'KeyProtectedByPassword.php';
203
-    include_once $path . 'Core.php';
190
+    include_once $path.'Exception/CryptoException.php';
191
+    include_once $path.'Exception/BadFormatException.php';
192
+    include_once $path.'Exception/EnvironmentIsBrokenException.php';
193
+    include_once $path.'Exception/IOException.php';
194
+    include_once $path.'Exception/WrongKeyOrModifiedCiphertextException.php';
195
+    include_once $path.'Crypto.php';
196
+    include_once $path.'Encoding.php';
197
+    include_once $path.'DerivedKeys.php';
198
+    include_once $path.'Key.php';
199
+    include_once $path.'KeyOrPassword.php';
200
+    include_once $path.'File.php';
201
+    include_once $path.'RuntimeTests.php';
202
+    include_once $path.'KeyProtectedByPassword.php';
203
+    include_once $path.'Core.php';
204 204
 
205 205
     $key = \Defuse\Crypto\Key::createNewRandomKey();
206 206
     $key = $key->saveToAsciiSafeString();
@@ -225,20 +225,20 @@  discard block
 block discarded – undo
225 225
         $path = '../includes/libraries/Encryption/Encryption/';
226 226
     }
227 227
 
228
-    include_once $path . 'Exception/CryptoException.php';
229
-    include_once $path . 'Exception/BadFormatException.php';
230
-    include_once $path . 'Exception/EnvironmentIsBrokenException.php';
231
-    include_once $path . 'Exception/IOException.php';
232
-    include_once $path . 'Exception/WrongKeyOrModifiedCiphertextException.php';
233
-    include_once $path . 'Crypto.php';
234
-    include_once $path . 'Encoding.php';
235
-    include_once $path . 'DerivedKeys.php';
236
-    include_once $path . 'Key.php';
237
-    include_once $path . 'KeyOrPassword.php';
238
-    include_once $path . 'File.php';
239
-    include_once $path . 'RuntimeTests.php';
240
-    include_once $path . 'KeyProtectedByPassword.php';
241
-    include_once $path . 'Core.php';
228
+    include_once $path.'Exception/CryptoException.php';
229
+    include_once $path.'Exception/BadFormatException.php';
230
+    include_once $path.'Exception/EnvironmentIsBrokenException.php';
231
+    include_once $path.'Exception/IOException.php';
232
+    include_once $path.'Exception/WrongKeyOrModifiedCiphertextException.php';
233
+    include_once $path.'Crypto.php';
234
+    include_once $path.'Encoding.php';
235
+    include_once $path.'DerivedKeys.php';
236
+    include_once $path.'Key.php';
237
+    include_once $path.'KeyOrPassword.php';
238
+    include_once $path.'File.php';
239
+    include_once $path.'RuntimeTests.php';
240
+    include_once $path.'KeyProtectedByPassword.php';
241
+    include_once $path.'Core.php';
242 242
     
243 243
     $protected_key = \Defuse\Crypto\KeyProtectedByPassword::createRandomPasswordProtectedKey($psk);
244 244
     return $protected_key->saveToAsciiSafeString(); // save this in user table
@@ -263,20 +263,20 @@  discard block
 block discarded – undo
263 263
         $path = '../includes/libraries/Encryption/Encryption/';
264 264
     }
265 265
 
266
-    include_once $path . 'Exception/CryptoException.php';
267
-    include_once $path . 'Exception/BadFormatException.php';
268
-    include_once $path . 'Exception/EnvironmentIsBrokenException.php';
269
-    include_once $path . 'Exception/IOException.php';
270
-    include_once $path . 'Exception/WrongKeyOrModifiedCiphertextException.php';
271
-    include_once $path . 'Crypto.php';
272
-    include_once $path . 'Encoding.php';
273
-    include_once $path . 'DerivedKeys.php';
274
-    include_once $path . 'Key.php';
275
-    include_once $path . 'KeyOrPassword.php';
276
-    include_once $path . 'File.php';
277
-    include_once $path . 'RuntimeTests.php';
278
-    include_once $path . 'KeyProtectedByPassword.php';
279
-    include_once $path . 'Core.php';
266
+    include_once $path.'Exception/CryptoException.php';
267
+    include_once $path.'Exception/BadFormatException.php';
268
+    include_once $path.'Exception/EnvironmentIsBrokenException.php';
269
+    include_once $path.'Exception/IOException.php';
270
+    include_once $path.'Exception/WrongKeyOrModifiedCiphertextException.php';
271
+    include_once $path.'Crypto.php';
272
+    include_once $path.'Encoding.php';
273
+    include_once $path.'DerivedKeys.php';
274
+    include_once $path.'Key.php';
275
+    include_once $path.'KeyOrPassword.php';
276
+    include_once $path.'File.php';
277
+    include_once $path.'RuntimeTests.php';
278
+    include_once $path.'KeyProtectedByPassword.php';
279
+    include_once $path.'Core.php';
280 280
 
281 281
     try {
282 282
         $user_key = $protected_key_encoded->unlockKey($psk);
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
  */
318 318
 function trimElement($chaine, string $element): string
319 319
 {
320
-    if (! empty($chaine)) {
320
+    if (!empty($chaine)) {
321 321
         if (is_array($chaine) === true) {
322 322
             $chaine = implode(';', $chaine);
323 323
         }
@@ -365,8 +365,8 @@  discard block
 block discarded – undo
365 365
  */
366 366
 function db_error_handler(array $params): void
367 367
 {
368
-    echo 'Error: ' . $params['error'] . "<br>\n";
369
-    echo 'Query: ' . $params['query'] . "<br>\n";
368
+    echo 'Error: '.$params['error']."<br>\n";
369
+    echo 'Query: '.$params['query']."<br>\n";
370 370
     throw new Exception('Error - Query', 1);
371 371
 }
372 372
 
@@ -388,12 +388,12 @@  discard block
 block discarded – undo
388 388
     $SETTINGS
389 389
 ) {
390 390
     //load ClassLoader
391
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
391
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
392 392
     // Load superglobal
393
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
393
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
394 394
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
395 395
     //Connect to DB
396
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
396
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
397 397
     if (defined('DB_PASSWD_CLEAR') === false) {
398 398
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
399 399
     }
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
     DB::$ssl = DB_SSL;
407 407
     DB::$connect_options = DB_CONNECT_OPTIONS;
408 408
     //Build tree
409
-    $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
409
+    $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
410 410
     $tree->register();
411 411
     $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
412 412
 
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 function identAdmin($idFonctions, $SETTINGS, $tree)
452 452
 {
453 453
     // Load superglobal
454
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
454
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
455 455
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
456 456
     // Init
457 457
     $groupesVisibles = [];
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
     $globalsVisibleFolders = $superGlobal->get('groupes_visibles', 'SESSION');
471 471
     $globalsPersonalVisibleFolders = $superGlobal->get('personal_visible_groups', 'SESSION');
472 472
     // Get list of Folders
473
-    $rows = DB::query('SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', 0);
473
+    $rows = DB::query('SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', 0);
474 474
     foreach ($rows as $record) {
475 475
         array_push($groupesVisibles, $record['id']);
476 476
     }
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
     }
490 490
     // Get ID of personal folder
491 491
     $persfld = DB::queryfirstrow(
492
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE title = %s',
492
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE title = %s',
493 493
         $globalsUserId
494 494
     );
495 495
     if (empty($persfld['id']) === false) {
@@ -510,20 +510,20 @@  discard block
 block discarded – undo
510 510
     // get complete list of ROLES
511 511
     $tmp = explode(';', $idFonctions);
512 512
     $rows = DB::query(
513
-        'SELECT * FROM ' . prefixTable('roles_title') . '
513
+        'SELECT * FROM '.prefixTable('roles_title').'
514 514
         ORDER BY title ASC'
515 515
     );
516 516
     foreach ($rows as $record) {
517
-        if (! empty($record['id']) && ! in_array($record['id'], $tmp)) {
517
+        if (!empty($record['id']) && !in_array($record['id'], $tmp)) {
518 518
             array_push($tmp, $record['id']);
519 519
         }
520 520
     }
521 521
     $superGlobal->put('fonction_id', implode(';', $tmp), 'SESSION');
522 522
     $superGlobal->put('is_admin', 1, 'SESSION');
523 523
     // Check if admin has created Folders and Roles
524
-    DB::query('SELECT * FROM ' . prefixTable('nested_tree') . '');
524
+    DB::query('SELECT * FROM '.prefixTable('nested_tree').'');
525 525
     $superGlobal->put('nb_folders', DB::count(), 'SESSION');
526
-    DB::query('SELECT * FROM ' . prefixTable('roles_title'));
526
+    DB::query('SELECT * FROM '.prefixTable('roles_title'));
527 527
     $superGlobal->put('nb_roles', DB::count(), 'SESSION');
528 528
 
529 529
     return true;
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
     object $tree
570 570
 ) {
571 571
     // Load superglobal
572
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
572
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
573 573
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
574 574
     // Init
575 575
     $superGlobal->put('groupes_visibles', [], 'SESSION');
@@ -608,10 +608,10 @@  discard block
 block discarded – undo
608 608
     // Does this user is allowed to see other items
609 609
     $inc = 0;
610 610
     $rows = DB::query(
611
-        'SELECT id, id_tree FROM ' . prefixTable('items') . '
611
+        'SELECT id, id_tree FROM '.prefixTable('items').'
612 612
             WHERE restricted_to LIKE %ss AND inactif = %s'.
613 613
             (count($allowedFolders) > 0 ? ' AND id_tree NOT IN ('.implode(',', $allowedFolders).')' : ''),
614
-        $globalsUserId . ';',
614
+        $globalsUserId.';',
615 615
         '0'
616 616
     );
617 617
     foreach ($rows as $record) {
@@ -625,8 +625,8 @@  discard block
 block discarded – undo
625 625
     // Check for the users roles if some specific rights exist on items
626 626
     $rows = DB::query(
627 627
         'SELECT i.id_tree, r.item_id
628
-        FROM ' . prefixTable('items') . ' as i
629
-        INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (r.item_id=i.id)
628
+        FROM ' . prefixTable('items').' as i
629
+        INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (r.item_id=i.id)
630 630
         WHERE r.role_id IN %li AND i.id_tree <> ""
631 631
         ORDER BY i.id_tree ASC',
632 632
         $userRoles
@@ -680,16 +680,16 @@  discard block
 block discarded – undo
680 680
         'SESSION'
681 681
     );
682 682
     // Folders and Roles numbers
683
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('nested_tree') . '');
683
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('nested_tree').'');
684 684
     $superGlobal->put('nb_folders', DB::count(), 'SESSION');
685
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('roles_title'));
685
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('roles_title'));
686 686
     $superGlobal->put('nb_roles', DB::count(), 'SESSION');
687 687
     // check if change proposals on User's items
688 688
     if (isset($SETTINGS['enable_suggestion']) === true && (int) $SETTINGS['enable_suggestion'] === 1) {
689 689
         $countNewItems = DB::query(
690 690
             'SELECT COUNT(*)
691
-            FROM ' . prefixTable('items_change') . ' AS c
692
-            LEFT JOIN ' . prefixTable('log_items') . ' AS i ON (c.item_id = i.id_item)
691
+            FROM ' . prefixTable('items_change').' AS c
692
+            LEFT JOIN ' . prefixTable('log_items').' AS i ON (c.item_id = i.id_item)
693 693
             WHERE i.action = %s AND i.id_user = %i',
694 694
             'at_creation',
695 695
             $globalsUserId
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
 {
717 717
     $rows = DB::query(
718 718
         'SELECT *
719
-        FROM ' . prefixTable('roles_values') . '
719
+        FROM ' . prefixTable('roles_values').'
720 720
         WHERE role_id IN %li AND type IN %ls',
721 721
         $userRoles,
722 722
         ['W', 'ND', 'NE', 'NDNE', 'R']
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
     ) {
784 784
         $persoFld = DB::queryfirstrow(
785 785
             'SELECT id
786
-            FROM ' . prefixTable('nested_tree') . '
786
+            FROM ' . prefixTable('nested_tree').'
787 787
             WHERE title = %s AND personal_folder = %i'.
788 788
             (count($allowedFolders) > 0 ? ' AND id NOT IN ('.implode(',', $allowedFolders).')' : ''),
789 789
             $globalsUserId,
@@ -816,7 +816,7 @@  discard block
 block discarded – undo
816 816
     }
817 817
     $persoFlds = DB::query(
818 818
         'SELECT id
819
-        FROM ' . prefixTable('nested_tree') . '
819
+        FROM ' . prefixTable('nested_tree').'
820 820
         WHERE %l',
821 821
         $where
822 822
     );
@@ -880,9 +880,9 @@  discard block
 block discarded – undo
880 880
  */
881 881
 function cacheTableRefresh(array $SETTINGS): void
882 882
 {
883
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
883
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
884 884
     //Connect to DB
885
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
885
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
886 886
     if (defined('DB_PASSWD_CLEAR') === false) {
887 887
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
888 888
     }
@@ -899,12 +899,12 @@  discard block
 block discarded – undo
899 899
     $tree->register();
900 900
     $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
901 901
     // truncate table
902
-    DB::query('TRUNCATE TABLE ' . prefixTable('cache'));
902
+    DB::query('TRUNCATE TABLE '.prefixTable('cache'));
903 903
     // reload date
904 904
     $rows = DB::query(
905 905
         'SELECT *
906
-        FROM ' . prefixTable('items') . ' as i
907
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
906
+        FROM ' . prefixTable('items').' as i
907
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
908 908
         AND l.action = %s
909 909
         AND i.inactif = %i',
910 910
         'at_creation',
@@ -916,18 +916,18 @@  discard block
 block discarded – undo
916 916
             $tags = '';
917 917
             $itemTags = DB::query(
918 918
                 'SELECT tag
919
-                FROM ' . prefixTable('tags') . '
919
+                FROM ' . prefixTable('tags').'
920 920
                 WHERE item_id = %i AND tag != ""',
921 921
                 $record['id']
922 922
             );
923 923
             foreach ($itemTags as $itemTag) {
924
-                $tags .= $itemTag['tag'] . ' ';
924
+                $tags .= $itemTag['tag'].' ';
925 925
             }
926 926
 
927 927
             // Get renewal period
928 928
             $resNT = DB::queryfirstrow(
929 929
                 'SELECT renewal_period
930
-                FROM ' . prefixTable('nested_tree') . '
930
+                FROM ' . prefixTable('nested_tree').'
931 931
                 WHERE id = %i',
932 932
                 $record['id_tree']
933 933
             );
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
                     // Is this a User id?
941 941
                     $user = DB::queryfirstrow(
942 942
                         'SELECT id, login
943
-                        FROM ' . prefixTable('users') . '
943
+                        FROM ' . prefixTable('users').'
944 944
                         WHERE id = %i',
945 945
                         $elem->title
946 946
                     );
@@ -958,11 +958,11 @@  discard block
 block discarded – undo
958 958
                     'id' => $record['id'],
959 959
                     'label' => $record['label'],
960 960
                     'description' => $record['description'] ?? '',
961
-                    'url' => isset($record['url']) && ! empty($record['url']) ? $record['url'] : '0',
961
+                    'url' => isset($record['url']) && !empty($record['url']) ? $record['url'] : '0',
962 962
                     'tags' => $tags,
963 963
                     'id_tree' => $record['id_tree'],
964 964
                     'perso' => $record['perso'],
965
-                    'restricted_to' => isset($record['restricted_to']) && ! empty($record['restricted_to']) ? $record['restricted_to'] : '0',
965
+                    'restricted_to' => isset($record['restricted_to']) && !empty($record['restricted_to']) ? $record['restricted_to'] : '0',
966 966
                     'login' => $record['login'] ?? '',
967 967
                     'folder' => implode(' > ', $folder),
968 968
                     'author' => $record['id_user'],
@@ -984,12 +984,12 @@  discard block
 block discarded – undo
984 984
  */
985 985
 function cacheTableUpdate(array $SETTINGS, ?int $ident = null): void
986 986
 {
987
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
987
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
988 988
     // Load superglobal
989
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
989
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
990 990
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
991 991
     //Connect to DB
992
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
992
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
993 993
     if (defined('DB_PASSWD_CLEAR') === false) {
994 994
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
995 995
     }
@@ -1008,7 +1008,7 @@  discard block
 block discarded – undo
1008 1008
     // get new value from db
1009 1009
     $data = DB::queryfirstrow(
1010 1010
         'SELECT label, description, id_tree, perso, restricted_to, login, url
1011
-        FROM ' . prefixTable('items') . '
1011
+        FROM ' . prefixTable('items').'
1012 1012
         WHERE id=%i',
1013 1013
         $ident
1014 1014
     );
@@ -1016,12 +1016,12 @@  discard block
 block discarded – undo
1016 1016
     $tags = '';
1017 1017
     $itemTags = DB::query(
1018 1018
         'SELECT tag
1019
-            FROM ' . prefixTable('tags') . '
1019
+            FROM ' . prefixTable('tags').'
1020 1020
             WHERE item_id = %i AND tag != ""',
1021 1021
         $ident
1022 1022
     );
1023 1023
     foreach ($itemTags as $itemTag) {
1024
-        $tags .= $itemTag['tag'] . ' ';
1024
+        $tags .= $itemTag['tag'].' ';
1025 1025
     }
1026 1026
     // form id_tree to full foldername
1027 1027
     $folder = [];
@@ -1032,7 +1032,7 @@  discard block
 block discarded – undo
1032 1032
             // Is this a User id?
1033 1033
             $user = DB::queryfirstrow(
1034 1034
                 'SELECT id, login
1035
-                FROM ' . prefixTable('users') . '
1035
+                FROM ' . prefixTable('users').'
1036 1036
                 WHERE id = %i',
1037 1037
                 $elem->title
1038 1038
             );
@@ -1050,10 +1050,10 @@  discard block
 block discarded – undo
1050 1050
             'label' => $data['label'],
1051 1051
             'description' => $data['description'],
1052 1052
             'tags' => $tags,
1053
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
1053
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
1054 1054
             'id_tree' => $data['id_tree'],
1055 1055
             'perso' => $data['perso'],
1056
-            'restricted_to' => isset($data['restricted_to']) && ! empty($data['restricted_to']) ? $data['restricted_to'] : '0',
1056
+            'restricted_to' => isset($data['restricted_to']) && !empty($data['restricted_to']) ? $data['restricted_to'] : '0',
1057 1057
             'login' => $data['login'] ?? '',
1058 1058
             'folder' => implode(' » ', $folder),
1059 1059
             'author' => $superGlobal->get('user_id', 'SESSION'),
@@ -1073,14 +1073,14 @@  discard block
 block discarded – undo
1073 1073
  */
1074 1074
 function cacheTableAdd(array $SETTINGS, ?int $ident = null): void
1075 1075
 {
1076
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1076
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1077 1077
     // Load superglobal
1078
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1078
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1079 1079
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1080 1080
     // Get superglobals
1081 1081
     $globalsUserId = $superGlobal->get('user_id', 'SESSION');
1082 1082
     //Connect to DB
1083
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1083
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1084 1084
     if (defined('DB_PASSWD_CLEAR') === false) {
1085 1085
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1086 1086
     }
@@ -1099,8 +1099,8 @@  discard block
 block discarded – undo
1099 1099
     // get new value from db
1100 1100
     $data = DB::queryFirstRow(
1101 1101
         'SELECT i.label, i.description, i.id_tree as id_tree, i.perso, i.restricted_to, i.id, i.login, i.url, l.date
1102
-        FROM ' . prefixTable('items') . ' as i
1103
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
1102
+        FROM ' . prefixTable('items').' as i
1103
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
1104 1104
         WHERE i.id = %i
1105 1105
         AND l.action = %s',
1106 1106
         $ident,
@@ -1110,12 +1110,12 @@  discard block
 block discarded – undo
1110 1110
     $tags = '';
1111 1111
     $itemTags = DB::query(
1112 1112
         'SELECT tag
1113
-            FROM ' . prefixTable('tags') . '
1113
+            FROM ' . prefixTable('tags').'
1114 1114
             WHERE item_id = %i AND tag != ""',
1115 1115
         $ident
1116 1116
     );
1117 1117
     foreach ($itemTags as $itemTag) {
1118
-        $tags .= $itemTag['tag'] . ' ';
1118
+        $tags .= $itemTag['tag'].' ';
1119 1119
     }
1120 1120
     // form id_tree to full foldername
1121 1121
     $folder = [];
@@ -1126,7 +1126,7 @@  discard block
 block discarded – undo
1126 1126
             // Is this a User id?
1127 1127
             $user = DB::queryfirstrow(
1128 1128
                 'SELECT id, login
1129
-                FROM ' . prefixTable('users') . '
1129
+                FROM ' . prefixTable('users').'
1130 1130
                 WHERE id = %i',
1131 1131
                 $elem->title
1132 1132
             );
@@ -1145,7 +1145,7 @@  discard block
 block discarded – undo
1145 1145
             'label' => $data['label'],
1146 1146
             'description' => $data['description'],
1147 1147
             'tags' => isset($tags) && empty($tags) === false ? $tags : 'None',
1148
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
1148
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
1149 1149
             'id_tree' => $data['id_tree'],
1150 1150
             'perso' => isset($data['perso']) && empty($data['perso']) === false && $data['perso'] !== 'None' ? $data['perso'] : '0',
1151 1151
             'restricted_to' => isset($data['restricted_to']) && empty($data['restricted_to']) === false ? $data['restricted_to'] : '0',
@@ -1167,52 +1167,52 @@  discard block
 block discarded – undo
1167 1167
 function getStatisticsData(array $SETTINGS): array
1168 1168
 {
1169 1169
     DB::query(
1170
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
1170
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
1171 1171
         0
1172 1172
     );
1173 1173
     $counter_folders = DB::count();
1174 1174
     DB::query(
1175
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
1175
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
1176 1176
         1
1177 1177
     );
1178 1178
     $counter_folders_perso = DB::count();
1179 1179
     DB::query(
1180
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
1180
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
1181 1181
         0
1182 1182
     );
1183 1183
     $counter_items = DB::count();
1184 1184
         DB::query(
1185
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
1185
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
1186 1186
         1
1187 1187
     );
1188 1188
     $counter_items_perso = DB::count();
1189 1189
         DB::query(
1190
-        'SELECT id FROM ' . prefixTable('users') . ''
1190
+        'SELECT id FROM '.prefixTable('users').''
1191 1191
     );
1192 1192
     $counter_users = DB::count();
1193 1193
         DB::query(
1194
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE admin = %i',
1194
+        'SELECT id FROM '.prefixTable('users').' WHERE admin = %i',
1195 1195
         1
1196 1196
     );
1197 1197
     $admins = DB::count();
1198 1198
     DB::query(
1199
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE gestionnaire = %i',
1199
+        'SELECT id FROM '.prefixTable('users').' WHERE gestionnaire = %i',
1200 1200
         1
1201 1201
     );
1202 1202
     $managers = DB::count();
1203 1203
     DB::query(
1204
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE read_only = %i',
1204
+        'SELECT id FROM '.prefixTable('users').' WHERE read_only = %i',
1205 1205
         1
1206 1206
     );
1207 1207
     $readOnly = DB::count();
1208 1208
     // list the languages
1209 1209
     $usedLang = [];
1210 1210
     $tp_languages = DB::query(
1211
-        'SELECT name FROM ' . prefixTable('languages')
1211
+        'SELECT name FROM '.prefixTable('languages')
1212 1212
     );
1213 1213
     foreach ($tp_languages as $tp_language) {
1214 1214
         DB::query(
1215
-            'SELECT * FROM ' . prefixTable('users') . ' WHERE user_language = %s',
1215
+            'SELECT * FROM '.prefixTable('users').' WHERE user_language = %s',
1216 1216
             $tp_language['name']
1217 1217
         );
1218 1218
         $usedLang[$tp_language['name']] = round((DB::count() * 100 / $counter_users), 0);
@@ -1221,12 +1221,12 @@  discard block
 block discarded – undo
1221 1221
     // get list of ips
1222 1222
     $usedIp = [];
1223 1223
     $tp_ips = DB::query(
1224
-        'SELECT user_ip FROM ' . prefixTable('users')
1224
+        'SELECT user_ip FROM '.prefixTable('users')
1225 1225
     );
1226 1226
     foreach ($tp_ips as $ip) {
1227 1227
         if (array_key_exists($ip['user_ip'], $usedIp)) {
1228 1228
             $usedIp[$ip['user_ip']] += $usedIp[$ip['user_ip']];
1229
-        } elseif (! empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1229
+        } elseif (!empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1230 1230
             $usedIp[$ip['user_ip']] = 1;
1231 1231
         }
1232 1232
     }
@@ -1292,21 +1292,21 @@  discard block
 block discarded – undo
1292 1292
     }
1293 1293
 
1294 1294
     // Load settings
1295
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
1295
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
1296 1296
     // Load superglobal
1297
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1297
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1298 1298
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1299 1299
     // Get user language
1300
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . (null !== $superGlobal->get('user_language', 'SESSION') ? $superGlobal->get('user_language', 'SESSION') : 'english') . '.php';
1300
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.(null !== $superGlobal->get('user_language', 'SESSION') ? $superGlobal->get('user_language', 'SESSION') : 'english').'.php';
1301 1301
     // Load library
1302
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1302
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1303 1303
     // load PHPMailer
1304
-    $mail = new SplClassLoader('PHPMailer\PHPMailer', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1304
+    $mail = new SplClassLoader('PHPMailer\PHPMailer', $SETTINGS['cpassman_dir'].'/includes/libraries');
1305 1305
     $mail->register();
1306 1306
     $mail = new PHPMailer\PHPMailer\PHPMailer(true);
1307 1307
 
1308 1308
     // send to user
1309
-    $mail->setLanguage('en', $SETTINGS['cpassman_dir'] . '/includes/libraries/PHPMailer/PHPMailer/language/');
1309
+    $mail->setLanguage('en', $SETTINGS['cpassman_dir'].'/includes/libraries/PHPMailer/PHPMailer/language/');
1310 1310
     $mail->SMTPDebug = isset($SETTINGS['email_debug_level']) === true ? $SETTINGS['email_debug_level'] : 0;
1311 1311
     $mail->Port = (int) $SETTINGS['email_port'];
1312 1312
     //COULD BE USED
@@ -1413,7 +1413,7 @@  discard block
 block discarded – undo
1413 1413
         <table width="600" cellpadding="0" cellspacing="0" border="0" class="container" bgcolor="#ffffff" style="border-spacing: 0; border-bottom: 1px solid #e0e0e0; box-shadow: 0 0 3px #ddd; color: #434343; font-family: Helvetica, Verdana, sans-serif;">
1414 1414
         <tr><td class="container-padding" bgcolor="#ffffff" style="border-collapse: collapse; border-left: 1px solid #e0e0e0; background-color: #ffffff; padding-left: 30px; padding-right: 30px;">
1415 1415
         <br><div style="float:right;">' .
1416
-        $textMail .
1416
+        $textMail.
1417 1417
         '<br><br></td></tr></table>
1418 1418
     </td></tr></table>
1419 1419
     <br></body></html>';
@@ -1426,7 +1426,7 @@  discard block
 block discarded – undo
1426 1426
  */
1427 1427
 function generateKey(): string
1428 1428
 {
1429
-    return substr(md5(rand() . rand()), 0, 15);
1429
+    return substr(md5(rand().rand()), 0, 15);
1430 1430
 }
1431 1431
 
1432 1432
 /**
@@ -1497,7 +1497,7 @@  discard block
 block discarded – undo
1497 1497
 {
1498 1498
     array_walk_recursive(
1499 1499
         $array,
1500
-        static function (&$item): void {
1500
+        static function(&$item): void {
1501 1501
             if (mb_detect_encoding((string) $item, 'utf-8', true) === false) {
1502 1502
                 $item = utf8_encode($item);
1503 1503
             }
@@ -1518,9 +1518,9 @@  discard block
 block discarded – undo
1518 1518
  */
1519 1519
 function prepareExchangedData($teampassDir, $data, string $type, ?string $key = null)
1520 1520
 {
1521
-    $teampassDir = __DIR__ . '/..';
1521
+    $teampassDir = __DIR__.'/..';
1522 1522
     // Load superglobal
1523
-    include_once $teampassDir . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1523
+    include_once $teampassDir.'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1524 1524
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1525 1525
     // Get superglobals
1526 1526
     if ($key !== null) {
@@ -1531,10 +1531,10 @@  discard block
 block discarded – undo
1531 1531
     }
1532 1532
 
1533 1533
     //load Encoding
1534
-    include_once $teampassDir . '/includes/libraries/ForceUTF8/Encoding.php';
1534
+    include_once $teampassDir.'/includes/libraries/ForceUTF8/Encoding.php';
1535 1535
     
1536 1536
     //Load CRYPTOJS
1537
-    include_once $teampassDir . '/includes/libraries/Encryption/CryptoJs/Encryption.php';
1537
+    include_once $teampassDir.'/includes/libraries/Encryption/CryptoJs/Encryption.php';
1538 1538
 
1539 1539
     // Perform
1540 1540
     if ($type === 'encode' && is_array($data) === true) {
@@ -1607,8 +1607,8 @@  discard block
 block discarded – undo
1607 1607
  */
1608 1608
 function prefixTable(string $table): string
1609 1609
 {
1610
-    $safeTable = htmlspecialchars(DB_PREFIX . $table);
1611
-    if (! empty($safeTable)) {
1610
+    $safeTable = htmlspecialchars(DB_PREFIX.$table);
1611
+    if (!empty($safeTable)) {
1612 1612
         // sanitize string
1613 1613
         return $safeTable;
1614 1614
     }
@@ -1638,13 +1638,13 @@  discard block
 block discarded – undo
1638 1638
     bool $lowercase = false,
1639 1639
     array $SETTINGS = []
1640 1640
 ): string {
1641
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1642
-    $generator = new SplClassLoader('PasswordGenerator\Generator', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1641
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1642
+    $generator = new SplClassLoader('PasswordGenerator\Generator', $SETTINGS['cpassman_dir'].'/includes/libraries');
1643 1643
     $generator->register();
1644 1644
     $generator = new PasswordGenerator\Generator\ComputerPasswordGenerator();
1645 1645
     // Is PHP7 being used?
1646 1646
     if (version_compare(PHP_VERSION, '7.0.0', '>=')) {
1647
-        $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1647
+        $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', $SETTINGS['cpassman_dir'].'/includes/libraries');
1648 1648
         $php7generator->register();
1649 1649
         $generator->setRandomGenerator(new PasswordGenerator\RandomGenerator\Php7RandomGenerator());
1650 1650
     }
@@ -1679,7 +1679,7 @@  discard block
 block discarded – undo
1679 1679
 function send_syslog($message, $host, $port, $component = 'teampass'): void
1680 1680
 {
1681 1681
     $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
1682
-    $syslog_message = '<123>' . date('M d H:i:s ') . $component . ': ' . $message;
1682
+    $syslog_message = '<123>'.date('M d H:i:s ').$component.': '.$message;
1683 1683
     socket_sendto($sock, (string) $syslog_message, strlen($syslog_message), 0, (string) $host, (int) $port);
1684 1684
     socket_close($sock);
1685 1685
 }
@@ -1703,7 +1703,7 @@  discard block
 block discarded – undo
1703 1703
     }
1704 1704
 
1705 1705
     // include librairies & connect to DB
1706
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1706
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1707 1707
     if (defined('DB_PASSWD_CLEAR') === false) {
1708 1708
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1709 1709
     }
@@ -1729,14 +1729,14 @@  discard block
 block discarded – undo
1729 1729
     if (isset($SETTINGS['syslog_enable']) === true && (int) $SETTINGS['syslog_enable'] === 1) {
1730 1730
         if ($type === 'user_mngt') {
1731 1731
             send_syslog(
1732
-                'action=' . str_replace('at_', '', $label) . ' attribute=user user=' . $who . ' userid="' . $login . '" change="' . $field_1 . '" ',
1732
+                'action='.str_replace('at_', '', $label).' attribute=user user='.$who.' userid="'.$login.'" change="'.$field_1.'" ',
1733 1733
                 $SETTINGS['syslog_host'],
1734 1734
                 $SETTINGS['syslog_port'],
1735 1735
                 'teampass'
1736 1736
             );
1737 1737
         } else {
1738 1738
             send_syslog(
1739
-                'action=' . $type . ' attribute=' . $label . ' user=' . $who . ' userid="' . $login . '" ',
1739
+                'action='.$type.' attribute='.$label.' user='.$who.' userid="'.$login.'" ',
1740 1740
                 $SETTINGS['syslog_host'],
1741 1741
                 $SETTINGS['syslog_port'],
1742 1742
                 'teampass'
@@ -1770,7 +1770,7 @@  discard block
 block discarded – undo
1770 1770
     ?string $encryption_type = null
1771 1771
 ): void {
1772 1772
     // include librairies & connect to DB
1773
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1773
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1774 1774
     if (defined('DB_PASSWD_CLEAR') === false) {
1775 1775
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1776 1776
     }
@@ -1816,7 +1816,7 @@  discard block
 block discarded – undo
1816 1816
         if (empty($item_label) === true) {
1817 1817
             $dataItem = DB::queryfirstrow(
1818 1818
                 'SELECT id, id_tree, label
1819
-                FROM ' . prefixTable('items') . '
1819
+                FROM ' . prefixTable('items').'
1820 1820
                 WHERE id = %i',
1821 1821
                 $item_id
1822 1822
             );
@@ -1824,11 +1824,11 @@  discard block
 block discarded – undo
1824 1824
         }
1825 1825
 
1826 1826
         send_syslog(
1827
-            'action=' . str_replace('at_', '', $action) .
1828
-                ' attribute=' . str_replace('at_', '', $attribute[0]) .
1829
-                ' itemno=' . $item_id .
1830
-                ' user=' . is_null($login) === true ? '' : addslashes((string) $login) .
1831
-                ' itemname="' . addslashes($item_label) . '"',
1827
+            'action='.str_replace('at_', '', $action).
1828
+                ' attribute='.str_replace('at_', '', $attribute[0]).
1829
+                ' itemno='.$item_id.
1830
+                ' user='.is_null($login) === true ? '' : addslashes((string) $login).
1831
+                ' itemname="'.addslashes($item_label).'"',
1832 1832
             $SETTINGS['syslog_host'],
1833 1833
             $SETTINGS['syslog_port'],
1834 1834
             'teampass'
@@ -1856,7 +1856,7 @@  discard block
 block discarded – undo
1856 1856
         && $action === 'at_shown'
1857 1857
     ) {
1858 1858
         // Load superglobal
1859
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1859
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1860 1860
         $superGlobal = new protect\SuperGlobal\SuperGlobal();
1861 1861
         // Get superglobals
1862 1862
         $globalsLastname = $superGlobal->get('lastname', 'SESSION');
@@ -1865,7 +1865,7 @@  discard block
 block discarded – undo
1865 1865
         // Get info about item
1866 1866
         $dataItem = DB::queryfirstrow(
1867 1867
             'SELECT id, id_tree, label
1868
-            FROM ' . prefixTable('items') . '
1868
+            FROM ' . prefixTable('items').'
1869 1869
             WHERE id = %i',
1870 1870
             $item_id
1871 1871
         );
@@ -1879,9 +1879,9 @@  discard block
 block discarded – undo
1879 1879
                 'body' => str_replace(
1880 1880
                     ['#tp_user#', '#tp_item#', '#tp_link#'],
1881 1881
                     [
1882
-                        addslashes($globalsName . ' ' . $globalsLastname),
1882
+                        addslashes($globalsName.' '.$globalsLastname),
1883 1883
                         addslashes($item_label),
1884
-                        $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $item_id,
1884
+                        $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$item_id,
1885 1885
                     ],
1886 1886
                     langHdl('email_on_open_notification_mail')
1887 1887
                 ),
@@ -1905,7 +1905,7 @@  discard block
 block discarded – undo
1905 1905
 function notifyChangesToSubscribers(int $item_id, string $label, array $changes, array $SETTINGS): void
1906 1906
 {
1907 1907
     // Load superglobal
1908
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1908
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1909 1909
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1910 1910
     // Get superglobals
1911 1911
     $globalsUserId = $superGlobal->get('user_id', 'SESSION');
@@ -1915,8 +1915,8 @@  discard block
 block discarded – undo
1915 1915
     $notification = DB::queryOneColumn(
1916 1916
         'email',
1917 1917
         'SELECT *
1918
-        FROM ' . prefixTable('notification') . ' AS n
1919
-        INNER JOIN ' . prefixTable('users') . ' AS u ON (n.user_id = u.id)
1918
+        FROM ' . prefixTable('notification').' AS n
1919
+        INNER JOIN ' . prefixTable('users').' AS u ON (n.user_id = u.id)
1920 1920
         WHERE n.item_id = %i AND n.user_id != %i',
1921 1921
         $item_id,
1922 1922
         $globalsUserId
@@ -1927,7 +1927,7 @@  discard block
 block discarded – undo
1927 1927
         // Get list of changes
1928 1928
         $htmlChanges = '<ul>';
1929 1929
         foreach ($changes as $change) {
1930
-            $htmlChanges .= '<li>' . $change . '</li>';
1930
+            $htmlChanges .= '<li>'.$change.'</li>';
1931 1931
         }
1932 1932
         $htmlChanges .= '</ul>';
1933 1933
         // send email
@@ -1960,7 +1960,7 @@  discard block
 block discarded – undo
1960 1960
 function geItemReadablePath(int $id_tree, string $label, array $SETTINGS): string
1961 1961
 {
1962 1962
     // Class loader
1963
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1963
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1964 1964
     //Load Tree
1965 1965
     $tree = new SplClassLoader('Tree\NestedTree', '../includes/libraries');
1966 1966
     $tree->register();
@@ -1969,15 +1969,15 @@  discard block
 block discarded – undo
1969 1969
     $path = '';
1970 1970
     foreach ($arbo as $elem) {
1971 1971
         if (empty($path) === true) {
1972
-            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' ';
1972
+            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' ';
1973 1973
         } else {
1974
-            $path .= '&#8594; ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1974
+            $path .= '&#8594; '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1975 1975
         }
1976 1976
     }
1977 1977
 
1978 1978
     // Build text to show user
1979 1979
     if (empty($label) === false) {
1980
-        return empty($path) === true ? addslashes($label) : addslashes($label) . ' (' . $path . ')';
1980
+        return empty($path) === true ? addslashes($label) : addslashes($label).' ('.$path.')';
1981 1981
     }
1982 1982
     return empty($path) === true ? '' : $path;
1983 1983
 }
@@ -2034,9 +2034,9 @@  discard block
 block discarded – undo
2034 2034
  */
2035 2035
 function handleConfigFile($action, $SETTINGS, $field = null, $value = null)
2036 2036
 {
2037
-    $tp_config_file = $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php';
2037
+    $tp_config_file = $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php';
2038 2038
     // include librairies & connect to DB
2039
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2039
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2040 2040
     if (defined('DB_PASSWD_CLEAR') === false) {
2041 2041
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2042 2042
     }
@@ -2051,8 +2051,8 @@  discard block
 block discarded – undo
2051 2051
     if (file_exists($tp_config_file) === false || $action === 'rebuild') {
2052 2052
         // perform a copy
2053 2053
         if (file_exists($tp_config_file)) {
2054
-            if (! copy($tp_config_file, $tp_config_file . '.' . date('Y_m_d_His', time()))) {
2055
-                return "ERROR: Could not copy file '" . $tp_config_file . "'";
2054
+            if (!copy($tp_config_file, $tp_config_file.'.'.date('Y_m_d_His', time()))) {
2055
+                return "ERROR: Could not copy file '".$tp_config_file."'";
2056 2056
             }
2057 2057
         }
2058 2058
 
@@ -2062,11 +2062,11 @@  discard block
 block discarded – undo
2062 2062
         $data[1] = "global \$SETTINGS;\n";
2063 2063
         $data[2] = "\$SETTINGS = array (\n";
2064 2064
         $rows = DB::query(
2065
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s',
2065
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s',
2066 2066
             'admin'
2067 2067
         );
2068 2068
         foreach ($rows as $record) {
2069
-            array_push($data, "    '" . $record['intitule'] . "' => '" . $record['valeur'] . "',\n");
2069
+            array_push($data, "    '".$record['intitule']."' => '".$record['valeur']."',\n");
2070 2070
         }
2071 2071
         array_push($data, ");\n");
2072 2072
         $data = array_unique($data);
@@ -2080,15 +2080,15 @@  discard block
 block discarded – undo
2080 2080
                 break;
2081 2081
             }
2082 2082
 
2083
-            if (stristr($line, "'" . $field . "' => '")) {
2084
-                $data[$inc] = "    '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n";
2083
+            if (stristr($line, "'".$field."' => '")) {
2084
+                $data[$inc] = "    '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n";
2085 2085
                 $bFound = true;
2086 2086
                 break;
2087 2087
             }
2088 2088
             ++$inc;
2089 2089
         }
2090 2090
         if ($bFound === false) {
2091
-            $data[$inc] = "    '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n);\n";
2091
+            $data[$inc] = "    '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n);\n";
2092 2092
         }
2093 2093
     }
2094 2094
 
@@ -2118,7 +2118,7 @@  discard block
 block discarded – undo
2118 2118
 {
2119 2119
     global $SETTINGS;
2120 2120
     /* LOAD CPASSMAN SETTINGS */
2121
-    if (! isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
2121
+    if (!isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
2122 2122
         $SETTINGS = [];
2123 2123
         $SETTINGS['duplicate_folder'] = 0;
2124 2124
         //by default, this is set to 0;
@@ -2128,7 +2128,7 @@  discard block
 block discarded – undo
2128 2128
         //by default, this value is set to 5;
2129 2129
         $settings = [];
2130 2130
         $rows = DB::query(
2131
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s_type OR type=%s_type2',
2131
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s_type OR type=%s_type2',
2132 2132
             [
2133 2133
                 'type' => 'admin',
2134 2134
                 'type2' => 'settings',
@@ -2160,7 +2160,7 @@  discard block
 block discarded – undo
2160 2160
     $source_cf = [];
2161 2161
     $rows = DB::QUERY(
2162 2162
         'SELECT id_category
2163
-            FROM ' . prefixTable('categories_folders') . '
2163
+            FROM ' . prefixTable('categories_folders').'
2164 2164
             WHERE id_folder = %i',
2165 2165
         $source_id
2166 2166
     );
@@ -2171,7 +2171,7 @@  discard block
 block discarded – undo
2171 2171
     $target_cf = [];
2172 2172
     $rows = DB::QUERY(
2173 2173
         'SELECT id_category
2174
-            FROM ' . prefixTable('categories_folders') . '
2174
+            FROM ' . prefixTable('categories_folders').'
2175 2175
             WHERE id_folder = %i',
2176 2176
         $target_id
2177 2177
     );
@@ -2206,9 +2206,9 @@  discard block
 block discarded – undo
2206 2206
     string $password = null
2207 2207
 ) {
2208 2208
     // Load AntiXSS
2209
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php';
2210
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php';
2211
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php';
2209
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php';
2210
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php';
2211
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php';
2212 2212
     $antiXss = new voku\helper\AntiXSS();
2213 2213
     // Protect against bad inputs
2214 2214
     if (is_array($source_file) === true || is_array($target_file) === true) {
@@ -2220,7 +2220,7 @@  discard block
 block discarded – undo
2220 2220
     $target_file = $antiXss->xss_clean($target_file);
2221 2221
     if (empty($password) === true || is_null($password) === true) {
2222 2222
         // get KEY to define password
2223
-        $ascii_key = file_get_contents(SECUREPATH . '/teampass-seckey.txt');
2223
+        $ascii_key = file_get_contents(SECUREPATH.'/teampass-seckey.txt');
2224 2224
         $password = \Defuse\Crypto\Key::loadFromAsciiSafeString($ascii_key);
2225 2225
     }
2226 2226
 
@@ -2265,20 +2265,20 @@  discard block
 block discarded – undo
2265 2265
 ) {
2266 2266
     // load PhpEncryption library
2267 2267
     $path_to_encryption = '/includes/libraries/Encryption/Encryption/';
2268
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/CryptoException.php';
2269
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/BadFormatException.php';
2270
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/IOException.php';
2271
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/EnvironmentIsBrokenException.php';
2272
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/WrongKeyOrModifiedCiphertextException.php';
2273
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php';
2274
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php';
2275
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php';
2276
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php';
2277
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php';
2278
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php';
2279
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php';
2280
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php';
2281
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php';
2268
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/CryptoException.php';
2269
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/BadFormatException.php';
2270
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/IOException.php';
2271
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/EnvironmentIsBrokenException.php';
2272
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/WrongKeyOrModifiedCiphertextException.php';
2273
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php';
2274
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php';
2275
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php';
2276
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php';
2277
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php';
2278
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php';
2279
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php';
2280
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php';
2281
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php';
2282 2282
     try {
2283 2283
         \Defuse\Crypto\File::encryptFileWithPassword(
2284 2284
             $source_file,
@@ -2315,20 +2315,20 @@  discard block
 block discarded – undo
2315 2315
 ) {
2316 2316
     // load PhpEncryption library
2317 2317
     $path_to_encryption = '/includes/libraries/Encryption/Encryption/';
2318
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/CryptoException.php';
2319
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/BadFormatException.php';
2320
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/IOException.php';
2321
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/EnvironmentIsBrokenException.php';
2322
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/WrongKeyOrModifiedCiphertextException.php';
2323
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php';
2324
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php';
2325
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php';
2326
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php';
2327
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php';
2328
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php';
2329
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php';
2330
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php';
2331
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php';
2318
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/CryptoException.php';
2319
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/BadFormatException.php';
2320
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/IOException.php';
2321
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/EnvironmentIsBrokenException.php';
2322
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/WrongKeyOrModifiedCiphertextException.php';
2323
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php';
2324
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php';
2325
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php';
2326
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php';
2327
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php';
2328
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php';
2329
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php';
2330
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php';
2331
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php';
2332 2332
     try {
2333 2333
         \Defuse\Crypto\File::decryptFileWithPassword(
2334 2334
             $source_file,
@@ -2375,9 +2375,9 @@  discard block
 block discarded – undo
2375 2375
 function fileDelete(string $file, array $SETTINGS): void
2376 2376
 {
2377 2377
     // Load AntiXSS
2378
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php';
2379
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php';
2380
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php';
2378
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php';
2379
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php';
2380
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php';
2381 2381
     $antiXss = new voku\helper\AntiXSS();
2382 2382
     $file = $antiXss->xss_clean($file);
2383 2383
     if (is_file($file)) {
@@ -2427,7 +2427,7 @@  discard block
 block discarded – undo
2427 2427
     int  $dirPerm = 0755
2428 2428
 ) {
2429 2429
     // Check if the path exists
2430
-    if (! file_exists($path)) {
2430
+    if (!file_exists($path)) {
2431 2431
         return false;
2432 2432
     }
2433 2433
 
@@ -2465,7 +2465,7 @@  discard block
 block discarded – undo
2465 2465
  */
2466 2466
 function accessToItemIsGranted(int $item_id, array $SETTINGS)
2467 2467
 {
2468
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2468
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2469 2469
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
2470 2470
     // Prepare superGlobal variables
2471 2471
     $session_groupes_visibles = $superGlobal->get('groupes_visibles', 'SESSION');
@@ -2473,7 +2473,7 @@  discard block
 block discarded – undo
2473 2473
     // Load item data
2474 2474
     $data = DB::queryFirstRow(
2475 2475
         'SELECT id_tree
2476
-        FROM ' . prefixTable('items') . '
2476
+        FROM ' . prefixTable('items').'
2477 2477
         WHERE id = %i',
2478 2478
         $item_id
2479 2479
     );
@@ -2536,7 +2536,7 @@  discard block
 block discarded – undo
2536 2536
         }
2537 2537
         $host .= substr(explode(".", $email[1])[0], -1, 1);
2538 2538
     }
2539
-    $email = $name . "@" . $host . "." . explode(".", $email[1])[1];
2539
+    $email = $name."@".$host.".".explode(".", $email[1])[1];
2540 2540
     return $email;
2541 2541
 }
2542 2542
 
@@ -2552,8 +2552,8 @@  discard block
 block discarded – undo
2552 2552
 function performDBQuery(array $SETTINGS, string $fields, string $table): array
2553 2553
 {
2554 2554
     // include librairies & connect to DB
2555
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2556
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2555
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2556
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2557 2557
     if (defined('DB_PASSWD_CLEAR') === false) {
2558 2558
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2559 2559
     }
@@ -2567,7 +2567,7 @@  discard block
 block discarded – undo
2567 2567
     DB::$connect_options = DB_CONNECT_OPTIONS;
2568 2568
     // Insert log in DB
2569 2569
     return DB::query(
2570
-        'SELECT ' . $fields . '
2570
+        'SELECT '.$fields.'
2571 2571
         FROM ' . prefixTable($table)
2572 2572
     );
2573 2573
 }
@@ -2582,11 +2582,11 @@  discard block
 block discarded – undo
2582 2582
 function formatSizeUnits(int $bytes): string
2583 2583
 {
2584 2584
     if ($bytes >= 1073741824) {
2585
-        $bytes = number_format($bytes / 1073741824, 2) . ' GB';
2585
+        $bytes = number_format($bytes / 1073741824, 2).' GB';
2586 2586
     } elseif ($bytes >= 1048576) {
2587
-        $bytes = number_format($bytes / 1048576, 2) . ' MB';
2587
+        $bytes = number_format($bytes / 1048576, 2).' MB';
2588 2588
     } elseif ($bytes >= 1024) {
2589
-        $bytes = number_format($bytes / 1024, 2) . ' KB';
2589
+        $bytes = number_format($bytes / 1024, 2).' KB';
2590 2590
     } elseif ($bytes > 1) {
2591 2591
         $bytes .= ' bytes';
2592 2592
     } elseif ($bytes === 1) {
@@ -2795,14 +2795,14 @@  discard block
 block discarded – undo
2795 2795
 
2796 2796
     // Encrypt the file content
2797 2797
     $plaintext = file_get_contents(
2798
-        filter_var($fileInPath . '/' . $fileInName, FILTER_SANITIZE_URL)
2798
+        filter_var($fileInPath.'/'.$fileInName, FILTER_SANITIZE_URL)
2799 2799
     );
2800 2800
     $ciphertext = $cipher->encrypt($plaintext);
2801 2801
     // Save new file
2802 2802
     $hash = md5($plaintext);
2803
-    $fileOut = $fileInPath . '/' . TP_FILE_PREFIX . $hash;
2803
+    $fileOut = $fileInPath.'/'.TP_FILE_PREFIX.$hash;
2804 2804
     file_put_contents($fileOut, $ciphertext);
2805
-    unlink($fileInPath . '/' . $fileInName);
2805
+    unlink($fileInPath.'/'.$fileInName);
2806 2806
     return [
2807 2807
         'fileHash' => base64_encode($hash),
2808 2808
         'objectKey' => base64_encode($objectKey),
@@ -2820,7 +2820,7 @@  discard block
 block discarded – undo
2820 2820
  */
2821 2821
 function decryptFile(string $fileName, string $filePath, string $key): string
2822 2822
 {
2823
-    if (! defined('FILE_BUFFER_SIZE')) {
2823
+    if (!defined('FILE_BUFFER_SIZE')) {
2824 2824
         define('FILE_BUFFER_SIZE', 128 * 1024);
2825 2825
     }
2826 2826
 
@@ -2839,7 +2839,7 @@  discard block
 block discarded – undo
2839 2839
     $cipher->enableContinuousBuffer();
2840 2840
     $cipher->disablePadding();
2841 2841
     // Get file content
2842
-    $ciphertext = file_get_contents($filePath . '/' . TP_FILE_PREFIX . $fileName);
2842
+    $ciphertext = file_get_contents($filePath.'/'.TP_FILE_PREFIX.$fileName);
2843 2843
     // Decrypt file content and return
2844 2844
     return base64_encode($cipher->decrypt($ciphertext));
2845 2845
 }
@@ -2893,8 +2893,8 @@  discard block
 block discarded – undo
2893 2893
     array $SETTINGS
2894 2894
 ): void {
2895 2895
     // include librairies & connect to DB
2896
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2897
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2896
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2897
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2898 2898
     if (defined('DB_PASSWD_CLEAR') === false) {
2899 2899
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2900 2900
     }
@@ -2913,7 +2913,7 @@  discard block
 block discarded – undo
2913 2913
         $post_object_id
2914 2914
     );
2915 2915
     // Superglobals
2916
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2916
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2917 2917
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
2918 2918
     // Prepare superGlobal variables
2919 2919
     $sessionPpersonaFolders = $superGlobal->get('personal_folders', 'SESSION');
@@ -2938,8 +2938,8 @@  discard block
 block discarded – undo
2938 2938
         // Create sharekey for each user
2939 2939
         $users = DB::query(
2940 2940
             'SELECT id, public_key
2941
-            FROM ' . prefixTable('users') . '
2942
-            WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '")
2941
+            FROM ' . prefixTable('users').'
2942
+            WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'")
2943 2943
             AND public_key != ""'
2944 2944
         );
2945 2945
         foreach ($users as $user) {
@@ -2969,7 +2969,7 @@  discard block
 block discarded – undo
2969 2969
 function isBase64(string $str): bool
2970 2970
 {
2971 2971
     $str = (string) trim($str);
2972
-    if (! isset($str[0])) {
2972
+    if (!isset($str[0])) {
2973 2973
         return false;
2974 2974
     }
2975 2975
 
@@ -3037,12 +3037,12 @@  discard block
 block discarded – undo
3037 3037
         ],
3038 3038
     ];
3039 3039
     // Load expected libraries
3040
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
3041
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php';
3042
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php';
3043
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php';
3044
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php';
3045
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php';
3040
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
3041
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php';
3042
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php';
3043
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php';
3044
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php';
3045
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php';
3046 3046
     $ad = new SplClassLoader('LdapRecord', '../includes/libraries');
3047 3047
     $ad->register();
3048 3048
     $connection = new Connection($config);
@@ -3051,7 +3051,7 @@  discard block
 block discarded – undo
3051 3051
         $connection->connect();
3052 3052
     } catch (\LdapRecord\Auth\BindException $e) {
3053 3053
         $error = $e->getDetailedError();
3054
-        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage();
3054
+        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage();
3055 3055
         return false;
3056 3056
     }
3057 3057
 
@@ -3064,7 +3064,7 @@  discard block
 block discarded – undo
3064 3064
         }
3065 3065
     } catch (\LdapRecord\Auth\BindException $e) {
3066 3066
         $error = $e->getDetailedError();
3067
-        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage();
3067
+        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage();
3068 3068
         return false;
3069 3069
     }
3070 3070
 
@@ -3082,8 +3082,8 @@  discard block
 block discarded – undo
3082 3082
 function deleteUserObjetsKeys(int $userId, array $SETTINGS): bool
3083 3083
 {
3084 3084
     // include librairies & connect to DB
3085
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
3086
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
3085
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
3086
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
3087 3087
     if (defined('DB_PASSWD_CLEAR') === false) {
3088 3088
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
3089 3089
     }
@@ -3143,7 +3143,7 @@  discard block
 block discarded – undo
3143 3143
         foreach (DateTimeZone::listIdentifiers() as $timezone) {
3144 3144
             $now->setTimezone(new DateTimeZone($timezone));
3145 3145
             $offsets[] = $offset = $now->getOffset();
3146
-            $timezones[$timezone] = '(' . format_GMT_offset($offset) . ') ' . format_timezone_name($timezone);
3146
+            $timezones[$timezone] = '('.format_GMT_offset($offset).') '.format_timezone_name($timezone);
3147 3147
         }
3148 3148
 
3149 3149
         array_multisort($offsets, $timezones);
@@ -3163,7 +3163,7 @@  discard block
 block discarded – undo
3163 3163
 {
3164 3164
     $hours = intval($offset / 3600);
3165 3165
     $minutes = abs(intval($offset % 3600 / 60));
3166
-    return 'GMT' . ($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
3166
+    return 'GMT'.($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
3167 3167
 }
3168 3168
 
3169 3169
 /**
@@ -3263,8 +3263,7 @@  discard block
 block discarded – undo
3263 3263
 {
3264 3264
     if (isset($array[$key]) === true
3265 3265
         && (is_int($value) === true ?
3266
-            (int) $array[$key] === $value :
3267
-            (string) $array[$key] === $value)
3266
+            (int) $array[$key] === $value : (string) $array[$key] === $value)
3268 3267
     ) {
3269 3268
         return true;
3270 3269
     }
@@ -3286,8 +3285,7 @@  discard block
 block discarded – undo
3286 3285
 {
3287 3286
     if (isset($var) === false
3288 3287
         || (is_int($value) === true ?
3289
-            (int) $var === $value :
3290
-            (string) $var === $value)
3288
+            (int) $var === $value : (string) $var === $value)
3291 3289
     ) {
3292 3290
         return true;
3293 3291
     }
@@ -3338,7 +3336,7 @@  discard block
 block discarded – undo
3338 3336
  */
3339 3337
 function isSetArrayOfValues(array $arrayOfValues): bool
3340 3338
 {
3341
-    foreach($arrayOfValues as $value) {
3339
+    foreach ($arrayOfValues as $value) {
3342 3340
         if (isset($value) === false) {
3343 3341
             return false;
3344 3342
         }
@@ -3360,7 +3358,7 @@  discard block
 block discarded – undo
3360 3358
     /*PHP8 - integer|string*/$value
3361 3359
 ) : bool
3362 3360
 {
3363
-    foreach($arrayOfVars as $variable) {
3361
+    foreach ($arrayOfVars as $variable) {
3364 3362
         if ($variable !== $value) {
3365 3363
             return false;
3366 3364
         }
@@ -3380,7 +3378,7 @@  discard block
 block discarded – undo
3380 3378
     /*PHP8 - integer|string*/$value
3381 3379
 ) : bool
3382 3380
 {
3383
-    foreach($arrayOfVars as $variable) {
3381
+    foreach ($arrayOfVars as $variable) {
3384 3382
         if ($variable === $value) {
3385 3383
             return true;
3386 3384
         }
@@ -3453,16 +3451,16 @@  discard block
 block discarded – undo
3453 3451
 ): array
3454 3452
 {
3455 3453
     // Load Sanitizer library
3456
-    require_once $path . '/includes/libraries/Illuminate/Support/Traits/Macroable.php';
3457
-    require_once $path . '/includes/libraries/Illuminate/Support/Str.php';
3458
-    require_once $path . '/includes/libraries/Illuminate/Validation/ValidationRuleParser.php';
3459
-    require_once $path . '/includes/libraries/Illuminate/Support/Arr.php';
3460
-    require_once $path . '/includes/libraries/Elegant/sanitizer/Contracts/Filter.php';
3461
-    require_once $path . '/includes/libraries/Elegant/sanitizer/Filters/Trim.php';
3462
-    require_once $path . '/includes/libraries/Elegant/sanitizer/Filters/Cast.php';
3463
-    require_once $path . '/includes/libraries/Elegant/sanitizer/Filters/EscapeHTML.php';
3464
-    require_once $path . '/includes/libraries/Elegant/sanitizer/Filters/EmptyStringToNull.php';
3465
-    require_once $path . '/includes/libraries/Elegant/sanitizer/Sanitizer.php';
3454
+    require_once $path.'/includes/libraries/Illuminate/Support/Traits/Macroable.php';
3455
+    require_once $path.'/includes/libraries/Illuminate/Support/Str.php';
3456
+    require_once $path.'/includes/libraries/Illuminate/Validation/ValidationRuleParser.php';
3457
+    require_once $path.'/includes/libraries/Illuminate/Support/Arr.php';
3458
+    require_once $path.'/includes/libraries/Elegant/sanitizer/Contracts/Filter.php';
3459
+    require_once $path.'/includes/libraries/Elegant/sanitizer/Filters/Trim.php';
3460
+    require_once $path.'/includes/libraries/Elegant/sanitizer/Filters/Cast.php';
3461
+    require_once $path.'/includes/libraries/Elegant/sanitizer/Filters/EscapeHTML.php';
3462
+    require_once $path.'/includes/libraries/Elegant/sanitizer/Filters/EmptyStringToNull.php';
3463
+    require_once $path.'/includes/libraries/Elegant/sanitizer/Sanitizer.php';
3466 3464
 
3467 3465
     // Sanitize post and get variables
3468 3466
     $sanitizer = new Elegant\sanitizer\Sanitizer($data, $filters);
@@ -3480,9 +3478,9 @@  discard block
 block discarded – undo
3480 3478
  */
3481 3479
 function cacheTreeUserHandler(int $user_id, string $data, array $SETTINGS, string $field_update = '')
3482 3480
 {
3483
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
3481
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
3484 3482
     //Connect to DB
3485
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
3483
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
3486 3484
     if (defined('DB_PASSWD_CLEAR') === false) {
3487 3485
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
3488 3486
     }
@@ -3498,7 +3496,7 @@  discard block
 block discarded – undo
3498 3496
     // Exists ?
3499 3497
     $userCacheId = DB::queryfirstrow(
3500 3498
         'SELECT increment_id
3501
-        FROM ' . prefixTable('cache_tree') . '
3499
+        FROM ' . prefixTable('cache_tree').'
3502 3500
         WHERE user_id = %i',
3503 3501
         $user_id
3504 3502
     );
@@ -3547,7 +3545,7 @@  discard block
 block discarded – undo
3547 3545
  */
3548 3546
 function pourcentage(float $nombre, float $total, float $pourcentage): float
3549 3547
 { 
3550
-    $resultat = ($nombre/$total) * $pourcentage;
3548
+    $resultat = ($nombre / $total) * $pourcentage;
3551 3549
     return round($resultat);
3552 3550
 }
3553 3551
 
@@ -3575,7 +3573,7 @@  discard block
 block discarded – undo
3575 3573
 
3576 3574
     // Get last folder update
3577 3575
     $lastFolderChange = DB::queryfirstrow(
3578
-        'SELECT valeur FROM ' . prefixTable('misc') . '
3576
+        'SELECT valeur FROM '.prefixTable('misc').'
3579 3577
         WHERE type = %s AND intitule = %s',
3580 3578
         'timestamp',
3581 3579
         'last_folder_change'
@@ -3605,7 +3603,7 @@  discard block
 block discarded – undo
3605 3603
     // Does this user has a tree cache
3606 3604
     $userCacheTree = DB::queryfirstrow(
3607 3605
         'SELECT '.$fieldName.'
3608
-        FROM ' . prefixTable('cache_tree') . '
3606
+        FROM ' . prefixTable('cache_tree').'
3609 3607
         WHERE user_id = %i',
3610 3608
         $_SESSION['user_id']
3611 3609
     );
@@ -3634,10 +3632,10 @@  discard block
 block discarded – undo
3634 3632
 )
3635 3633
 {
3636 3634
     //load ClassLoader
3637
-    include_once __DIR__. '/../sources/SplClassLoader.php';
3635
+    include_once __DIR__.'/../sources/SplClassLoader.php';
3638 3636
     
3639 3637
     //Connect to DB
3640
-    include_once __DIR__. '/../includes/libraries/Database/Meekrodb/db.class.php';
3638
+    include_once __DIR__.'/../includes/libraries/Database/Meekrodb/db.class.php';
3641 3639
     if (defined('DB_PASSWD_CLEAR') === false) {
3642 3640
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, []));
3643 3641
     }
@@ -3656,7 +3654,7 @@  discard block
 block discarded – undo
3656 3654
     if (count($folderIds) === 0) {
3657 3655
         $folderIds = DB::queryFirstColumn(
3658 3656
             'SELECT id
3659
-            FROM ' . prefixTable('nested_tree') . '
3657
+            FROM ' . prefixTable('nested_tree').'
3660 3658
             WHERE personal_folder=%i',
3661 3659
             0
3662 3660
         );
@@ -3673,8 +3671,8 @@  discard block
 block discarded – undo
3673 3671
         $rows_tmp = DB::query(
3674 3672
             'SELECT c.id, c.title, c.level, c.type, c.masked, c.order, c.encrypted_data, c.role_visibility, c.is_mandatory,
3675 3673
             f.id_category AS category_id
3676
-            FROM ' . prefixTable('categories_folders') . ' AS f
3677
-            INNER JOIN ' . prefixTable('categories') . ' AS c ON (f.id_category = c.parent_id)
3674
+            FROM ' . prefixTable('categories_folders').' AS f
3675
+            INNER JOIN ' . prefixTable('categories').' AS c ON (f.id_category = c.parent_id)
3678 3676
             WHERE id_folder=%i',
3679 3677
             $folder
3680 3678
         );
@@ -3700,7 +3698,7 @@  discard block
 block discarded – undo
3700 3698
         $valTemp = '';
3701 3699
         $data = DB::queryFirstRow(
3702 3700
             'SELECT valeur
3703
-            FROM ' . prefixTable('misc') . '
3701
+            FROM ' . prefixTable('misc').'
3704 3702
             WHERE type = %s AND intitule=%i',
3705 3703
             'complex',
3706 3704
             $folder
@@ -3717,14 +3715,14 @@  discard block
 block discarded – undo
3717 3715
         $valTemp = '';
3718 3716
         $rows_tmp = DB::query(
3719 3717
             'SELECT t.title
3720
-            FROM ' . prefixTable('roles_values') . ' as v
3721
-            INNER JOIN ' . prefixTable('roles_title') . ' as t ON (v.role_id = t.id)
3718
+            FROM ' . prefixTable('roles_values').' as v
3719
+            INNER JOIN ' . prefixTable('roles_title').' as t ON (v.role_id = t.id)
3722 3720
             WHERE v.folder_id = %i
3723 3721
             GROUP BY title',
3724 3722
             $folder
3725 3723
         );
3726 3724
         foreach ($rows_tmp as $record) {
3727
-            $valTemp .= (empty($valTemp) === true ? '' : ' - ') . $record['title'];
3725
+            $valTemp .= (empty($valTemp) === true ? '' : ' - ').$record['title'];
3728 3726
         }
3729 3727
         $arr_data['visibilityRoles'] = $valTemp;
3730 3728
 
Please login to merge, or discard this patch.