Passed
Push — teampass_3.0 ( 9dbfce...b1a175 )
by Nils
07:54 queued 11s
created
sources/tree.php 1 patch
Spacing   +51 added lines, -56 removed lines patch added patch discarded remove patch
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
 }
43 43
 
44 44
 // includes
45
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
46
-require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
47
-require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
48
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
49
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
45
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
46
+require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
47
+require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
48
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
49
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
50 50
 
51 51
 // header
52 52
 header('Content-type: text/html; charset=utf-8');
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 }
61 61
 
62 62
 // Connect to mysql server
63
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
63
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
64 64
 if (defined('DB_PASSWD_CLEAR') === false) {
65 65
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
66 66
 }
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 DB::$encoding = DB_ENCODING;
73 73
 
74 74
 // Superglobal load
75
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
75
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
76 76
 $superGlobal = new protect\SuperGlobal\SuperGlobal();
77 77
 
78 78
 $sessionTreeStructure = $superGlobal->get('user_tree_structure', 'GET');
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
 
82 82
 $lastFolderChange = DB::query(
83
-    'SELECT * FROM ' . prefixTable('misc') . '
83
+    'SELECT * FROM '.prefixTable('misc').'
84 84
     WHERE type = %s AND intitule = %s',
85 85
     'timestamp',
86 86
     'last_folder_change'
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     || (isset($_GET['force_refresh']) === true && (int) $_GET['force_refresh'] === 1)
92 92
 ) {
93 93
     // Build tree
94
-    $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
94
+    $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
95 95
     $tree->register();
96 96
     $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
97 97
 
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
     $SETTINGS
190 190
 ) {
191 191
     // Load library
192
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
192
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
193 193
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
194 194
 
195 195
     // Prepare superGlobal variables
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
                 // get count of Items in this folder
244 244
                 DB::query(
245 245
                     'SELECT *
246
-                    FROM ' . prefixTable('items') . '
246
+                    FROM ' . prefixTable('items').'
247 247
                     WHERE inactif=%i AND id_tree = %i',
248 248
                     0,
249 249
                     $node->id
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
                 // get info about current folder
254 254
                 DB::query(
255 255
                     'SELECT *
256
-                    FROM ' . prefixTable('nested_tree') . '
256
+                    FROM ' . prefixTable('nested_tree').'
257 257
                     WHERE parent_id = %i',
258 258
                     $node->id
259 259
                 );
@@ -261,11 +261,10 @@  discard block
 block discarded – undo
261 261
 
262 262
                 // If personal Folder, convert id into user name
263 263
                 $node->title = ($node->title === $session_user_id && (int) $node->nlevel === 1) ?
264
-                    $session_login : 
265
-                    ($node->title === null ? '' : htmlspecialchars_decode($node->title, ENT_QUOTES));
264
+                    $session_login : ($node->title === null ? '' : htmlspecialchars_decode($node->title, ENT_QUOTES));
266 265
 
267 266
                 // prepare json return for current node
268
-                $parent = ($node->parent_id == 0) ? '#' : 'li_' . $node->parent_id;
267
+                $parent = ($node->parent_id == 0) ? '#' : 'li_'.$node->parent_id;
269 268
 
270 269
                 // special case for READ-ONLY folder
271 270
                 $title = ($session_user_read_only === true && !in_array($node->id, $session_personal_folders)) ? langHdl('read_only_account') : $title;
@@ -275,36 +274,33 @@  discard block
 block discarded – undo
275 274
 
276 275
                 if (in_array($node->id, $session_groupes_visibles)) {
277 276
                     if (in_array($node->id, $session_read_only_folders)) {
278
-                        $text = "<i class='far fa-eye fa-xs mr-1'></i>" . $text;
277
+                        $text = "<i class='far fa-eye fa-xs mr-1'></i>".$text;
279 278
                         $title = langHdl('read_only_account');
280 279
                         $restricted = 1;
281 280
                         $folderClass = 'folder_not_droppable';
282 281
                     } elseif ($session_user_read_only === true && !in_array($node->id, $session_personal_visible_groups)) {
283
-                        $text = "<i class='far fa-eye fa-xs mr-1'></i>" . $text;
282
+                        $text = "<i class='far fa-eye fa-xs mr-1'></i>".$text;
284 283
                     }
285 284
                     $text .= 
286
-                        ' <span class=\'badge badge-danger ml-2 items_count\' id=\'itcount_' . $node->id . '\'>' . $itemsNb . '</span>'
285
+                        ' <span class=\'badge badge-danger ml-2 items_count\' id=\'itcount_'.$node->id.'\'>'.$itemsNb.'</span>'
287 286
                         .((isset($SETTINGS['tree_counters']) && $SETTINGS['tree_counters'] == 1) ?
288
-                            '/'.$nbChildrenItems .
289
-                            '/'.(count($nodeDescendants) - 1)  :
290
-                            '')
287
+                            '/'.$nbChildrenItems.
288
+                            '/'.(count($nodeDescendants) - 1) : '')
291 289
                         .'</span>';
292 290
                 } elseif (in_array($node->id, $listFoldersLimitedKeys)) {
293 291
                     $restricted = '1';
294 292
                     $text .= 
295 293
                         $session_user_read_only === true ? 
296
-                            "<i class='far fa-eye fa-xs mr-1'></i>" :
297
-                            ''
298
-                        .'<span class=\'badge badge-danger ml-2 items_count\' id=\'itcount_' . $node->id . '\'>' . count($session_list_folders_limited[$node->id]) . '</span>';
294
+                            "<i class='far fa-eye fa-xs mr-1'></i>" : ''
295
+                        .'<span class=\'badge badge-danger ml-2 items_count\' id=\'itcount_'.$node->id.'\'>'.count($session_list_folders_limited[$node->id]).'</span>';
299 296
                 } elseif (in_array($node->id, $listRestrictedFoldersForItemsKeys)) {
300 297
                     $restricted = '1';
301 298
                     if ($session_user_read_only === true) {
302
-                        $text = "<i class='far fa-eye fa-xs mr-1'></i>" . $text;
299
+                        $text = "<i class='far fa-eye fa-xs mr-1'></i>".$text;
303 300
                     }
304 301
                     $text .= $session_user_read_only === true ? 
305
-                        "<i class='far fa-eye fa-xs mr-1'></i>" :
306
-                        ''
307
-                        . '<span class=\'badge badge-danger ml-2 items_count\' id=\'itcount_' . $node->id . '\'>' . count($session_list_restricted_folders_for_items[$node->id]) . '</span>';
302
+                        "<i class='far fa-eye fa-xs mr-1'></i>" : ''
303
+                        . '<span class=\'badge badge-danger ml-2 items_count\' id=\'itcount_'.$node->id.'\'>'.count($session_list_restricted_folders_for_items[$node->id]).'</span>';
308 304
                 } else {
309 305
                     $restricted = '1';
310 306
                     $folderClass = 'folder_not_droppable';
@@ -330,18 +326,18 @@  discard block
 block discarded – undo
330 326
                     array_push(
331 327
                         $ret_json,
332 328
                         array(
333
-                            'id' => 'li_' . $node->id,
329
+                            'id' => 'li_'.$node->id,
334 330
                             'parent' => $parent,
335 331
                             'text' => $text,
336 332
                             'children' => $childrenNb == 0 ? false : true,
337 333
                             'li_attr' => array(
338 334
                                 'class' => 'jstreeopen',
339
-                                'title' => 'ID [' . $node->id . '] ' . $title,
335
+                                'title' => 'ID ['.$node->id.'] '.$title,
340 336
                             ),
341 337
                             'a_attr' => array(
342
-                                'id' => 'fld_' . $node->id,
338
+                                'id' => 'fld_'.$node->id,
343 339
                                 'class' => $folderClass,
344
-                                'onclick' => 'ListerItems(' . $node->id . ', ' . $restricted . ', 0, 1)',
340
+                                'onclick' => 'ListerItems('.$node->id.', '.$restricted.', 0, 1)',
345 341
                                 'data-title' => $node->title,
346 342
                             ),
347 343
                         )
@@ -350,13 +346,13 @@  discard block
 block discarded – undo
350 346
                     array_push(
351 347
                         $ret_json,
352 348
                         array(
353
-                            'id' => 'li_' . $node->id,
349
+                            'id' => 'li_'.$node->id,
354 350
                             'parent' =>  $parent,
355 351
                             'children' => $childrenNb == 0 ? false : true,
356
-                            'text' => '<i class="fas fa-times fa-xs text-danger mr-1"></i>' . $text,
352
+                            'text' => '<i class="fas fa-times fa-xs text-danger mr-1"></i>'.$text,
357 353
                             'li_attr' => array(
358 354
                                 'class' => '',
359
-                                'title' => 'ID [' . $node->id . '] ' . langHdl('no_access'),
355
+                                'title' => 'ID ['.$node->id.'] '.langHdl('no_access'),
360 356
                             ),
361 357
                         )
362 358
                     );
@@ -408,7 +404,7 @@  discard block
 block discarded – undo
408 404
     }
409 405
 
410 406
     // Load library
411
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
407
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
412 408
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
413 409
 
414 410
     // Prepare superGlobal variables
@@ -445,7 +441,7 @@  discard block
 block discarded – undo
445 441
                 ) === true
446 442
             ) {
447 443
                 DB::query(
448
-                    'SELECT * FROM ' . prefixTable('items') . '
444
+                    'SELECT * FROM '.prefixTable('items').'
449 445
                     WHERE inactif=%i AND id_tree = %i',
450 446
                     0,
451 447
                     $node
@@ -475,7 +471,7 @@  discard block
 block discarded – undo
475 471
         if ($displayThisNode === true) {
476 472
             // get info about current folder
477 473
             DB::query(
478
-                'SELECT * FROM ' . prefixTable('items') . '
474
+                'SELECT * FROM '.prefixTable('items').'
479 475
                 WHERE inactif=%i AND id_tree = %i',
480 476
                 0,
481 477
                 $completTree[$nodeId]->id
@@ -503,7 +499,7 @@  discard block
 block discarded – undo
503 499
 
504 500
             if (in_array($completTree[$nodeId]->id, $session_groupes_visibles) === true) {
505 501
                 if (in_array($completTree[$nodeId]->id, $session_read_only_folders) === true) {
506
-                    $text = "<i class='far fa-eye fa-xs mr-1'></i>" . $text;
502
+                    $text = "<i class='far fa-eye fa-xs mr-1'></i>".$text;
507 503
                     $title = langHdl('read_only_account');
508 504
                     $restricted = 1;
509 505
                     $folderClass = 'folder_not_droppable';
@@ -511,27 +507,26 @@  discard block
 block discarded – undo
511 507
                     $session_user_read_only === true
512 508
                     && in_array($completTree[$nodeId]->id, $session_personal_visible_groups) === false
513 509
                 ) {
514
-                    $text = "<i class='far fa-eye fa-xs mr-1'></i>" . $text;
510
+                    $text = "<i class='far fa-eye fa-xs mr-1'></i>".$text;
515 511
                 }
516 512
                 $text .= 
517
-                    '<span class=\'badge badge-pill badge-light ml-2 items_count\' id=\'itcount_' . $completTree[$nodeId]->id . '\'>' . $itemsNb .
513
+                    '<span class=\'badge badge-pill badge-light ml-2 items_count\' id=\'itcount_'.$completTree[$nodeId]->id.'\'>'.$itemsNb.
518 514
                     ((isset($SETTINGS['tree_counters']) === true && (int) $SETTINGS['tree_counters'] === 1) ?
519
-                        '/'.$nbChildrenItems .
520
-                        '/'.(count($nodeDescendants) - 1)  :
521
-                        '')
515
+                        '/'.$nbChildrenItems.
516
+                        '/'.(count($nodeDescendants) - 1) : '')
522 517
                     . '</span>';
523 518
             } elseif (in_array($completTree[$nodeId]->id, $listFoldersLimitedKeys) === true) {
524 519
                 $restricted = '1';
525 520
                 if ($session_user_read_only === true) {
526
-                    $text = "<i class='far fa-eye fa-xs mr-1'></i>" . $text;
521
+                    $text = "<i class='far fa-eye fa-xs mr-1'></i>".$text;
527 522
                 }
528
-                $text .= '<span class=\'badge badge-pill badge-light ml-2 items_count\' id=\'itcount_' . $completTree[$nodeId]->id . '\'>' . count($session_list_folders_limited[$completTree[$nodeId]->id]);
523
+                $text .= '<span class=\'badge badge-pill badge-light ml-2 items_count\' id=\'itcount_'.$completTree[$nodeId]->id.'\'>'.count($session_list_folders_limited[$completTree[$nodeId]->id]);
529 524
             } elseif (in_array($completTree[$nodeId]->id, $listRestrictedFoldersForItemsKeys) === true) {
530 525
                 $restricted = '1';
531 526
                 if ($session_user_read_only === true) {
532
-                    $text = "<i class='far fa-eye fa-xs mr-1'></i>" . $text;
527
+                    $text = "<i class='far fa-eye fa-xs mr-1'></i>".$text;
533 528
                 }
534
-                $text .= '<span class=\'badge badge-pill badge-light ml-2 items_count\' id=\'itcount_' . $completTree[$nodeId]->id . '\'>' . count($session_list_restricted_folders_for_items[$completTree[$nodeId]->id]) . '</span>';
529
+                $text .= '<span class=\'badge badge-pill badge-light ml-2 items_count\' id=\'itcount_'.$completTree[$nodeId]->id.'\'>'.count($session_list_restricted_folders_for_items[$completTree[$nodeId]->id]).'</span>';
535 530
             } else {
536 531
                 $restricted = '1';
537 532
                 $folderClass = 'folder_not_droppable';
@@ -568,7 +563,7 @@  discard block
 block discarded – undo
568 563
             }
569 564
 
570 565
             // prepare json return for current node
571
-            $parent = ($completTree[$nodeId]->parent_id === '0') ? '#' : 'li_' . $completTree[$nodeId]->parent_id;
566
+            $parent = ($completTree[$nodeId]->parent_id === '0') ? '#' : 'li_'.$completTree[$nodeId]->parent_id;
572 567
 
573 568
             // handle displaying
574 569
             if (
@@ -588,17 +583,17 @@  discard block
 block discarded – undo
588 583
                 array_push(
589 584
                     $ret_json,
590 585
                     array(
591
-                        'id' => 'li_' . $completTree[$nodeId]->id,
586
+                        'id' => 'li_'.$completTree[$nodeId]->id,
592 587
                         'parent' => $last_visible_parent === -1 ? $parent : $last_visible_parent,
593 588
                         'text' => $text,
594 589
                         'li_attr' => array(
595 590
                             'class' => 'jstreeopen',
596
-                            'title' => 'ID [' . $completTree[$nodeId]->id . '] ' . $title,
591
+                            'title' => 'ID ['.$completTree[$nodeId]->id.'] '.$title,
597 592
                         ),
598 593
                         'a_attr' => array(
599
-                            'id' => 'fld_' . $completTree[$nodeId]->id,
594
+                            'id' => 'fld_'.$completTree[$nodeId]->id,
600 595
                             'class' => $folderClass,
601
-                            'onclick' => 'ListerItems(' . $completTree[$nodeId]->id . ', ' . $restricted . ', 0, 1)',
596
+                            'onclick' => 'ListerItems('.$completTree[$nodeId]->id.', '.$restricted.', 0, 1)',
602 597
                             'data-title' => $completTree[$nodeId]->title,
603 598
                         ),
604 599
                     )
@@ -607,12 +602,12 @@  discard block
 block discarded – undo
607 602
                 array_push(
608 603
                     $ret_json,
609 604
                     array(
610
-                        'id' => 'li_' . $completTree[$nodeId]->id,
605
+                        'id' => 'li_'.$completTree[$nodeId]->id,
611 606
                         'parent' => $last_visible_parent === -1 ? $parent : $last_visible_parent,
612
-                        'text' => '<i class="fas fa-times fa-xs text-danger mr-1"></i>' . $text,
607
+                        'text' => '<i class="fas fa-times fa-xs text-danger mr-1"></i>'.$text,
613 608
                         'li_attr' => array(
614 609
                             'class' => '',
615
-                            'title' => 'ID [' . $completTree[$nodeId]->id . '] ' . langHdl('no_access'),
610
+                            'title' => 'ID ['.$completTree[$nodeId]->id.'] '.langHdl('no_access'),
616 611
                         ),
617 612
                     )
618 613
                 );
Please login to merge, or discard this patch.
sources/aes.functions.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -37,12 +37,12 @@  discard block
 block discarded – undo
37 37
 }
38 38
 
39 39
 // Do checks
40
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
41
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
40
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
41
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
42 42
 if (checkUser($_SESSION['user_id'], $_SESSION['key'], 'items', $SETTINGS) === false) {
43 43
     // Not allowed page
44 44
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
45
-    include $SETTINGS['cpassman_dir'] . '/error.php';
45
+    include $SETTINGS['cpassman_dir'].'/error.php';
46 46
     exit;
47 47
 }
48 48
 
@@ -55,14 +55,14 @@  discard block
 block discarded – undo
55 55
     date_default_timezone_set('UTC');
56 56
 }
57 57
 
58
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
59
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
58
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
59
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
60 60
 header('Content-type: text/html; charset=utf-8');
61 61
 header('Cache-Control: no-cache, must-revalidate');
62 62
 require_once 'main.functions.php';
63 63
 
64 64
 // Connect to mysql server
65
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
65
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
66 66
 mysqli_connect(DB_HOST, DB_USER, defuseReturnDecrypted(DB_PASSWD, $SETTINGS), DB_NAME, (int) DB_PORT, null);
67 67
 
68 68
 // Protect POST
Please login to merge, or discard this patch.
sources/main.functions.php 1 patch
Spacing   +218 added lines, -218 removed lines patch added patch discarded remove patch
@@ -116,24 +116,24 @@  discard block
 block discarded – undo
116 116
  */
117 117
 function cryption(string $message, string $ascii_key, string $type, array $SETTINGS): array
118 118
 {
119
-    $ascii_key = empty($ascii_key) === true ? file_get_contents(SECUREPATH . '/teampass-seckey.txt') : $ascii_key;
119
+    $ascii_key = empty($ascii_key) === true ? file_get_contents(SECUREPATH.'/teampass-seckey.txt') : $ascii_key;
120 120
     $err = false;
121 121
     // load PhpEncryption library
122 122
     if (isset($SETTINGS['cpassman_dir']) === false || empty($SETTINGS['cpassman_dir']) === true) {
123 123
         $path = '../includes/libraries/Encryption/Encryption/';
124 124
     } else {
125
-        $path = $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/';
126
-    }
127
-
128
-    include_once $path . 'Crypto.php';
129
-    include_once $path . 'Encoding.php';
130
-    include_once $path . 'DerivedKeys.php';
131
-    include_once $path . 'Key.php';
132
-    include_once $path . 'KeyOrPassword.php';
133
-    include_once $path . 'File.php';
134
-    include_once $path . 'RuntimeTests.php';
135
-    include_once $path . 'KeyProtectedByPassword.php';
136
-    include_once $path . 'Core.php';
125
+        $path = $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/';
126
+    }
127
+
128
+    include_once $path.'Crypto.php';
129
+    include_once $path.'Encoding.php';
130
+    include_once $path.'DerivedKeys.php';
131
+    include_once $path.'Key.php';
132
+    include_once $path.'KeyOrPassword.php';
133
+    include_once $path.'File.php';
134
+    include_once $path.'RuntimeTests.php';
135
+    include_once $path.'KeyProtectedByPassword.php';
136
+    include_once $path.'Core.php';
137 137
     // convert KEY
138 138
     $key = \Defuse\Crypto\Key::loadFromAsciiSafeString($ascii_key);
139 139
     try {
@@ -175,15 +175,15 @@  discard block
 block discarded – undo
175 175
         $path = '../includes/libraries/Encryption/Encryption/';
176 176
     }
177 177
 
178
-    include_once $path . 'Crypto.php';
179
-    include_once $path . 'Encoding.php';
180
-    include_once $path . 'DerivedKeys.php';
181
-    include_once $path . 'Key.php';
182
-    include_once $path . 'KeyOrPassword.php';
183
-    include_once $path . 'File.php';
184
-    include_once $path . 'RuntimeTests.php';
185
-    include_once $path . 'KeyProtectedByPassword.php';
186
-    include_once $path . 'Core.php';
178
+    include_once $path.'Crypto.php';
179
+    include_once $path.'Encoding.php';
180
+    include_once $path.'DerivedKeys.php';
181
+    include_once $path.'Key.php';
182
+    include_once $path.'KeyOrPassword.php';
183
+    include_once $path.'File.php';
184
+    include_once $path.'RuntimeTests.php';
185
+    include_once $path.'KeyProtectedByPassword.php';
186
+    include_once $path.'Core.php';
187 187
     $key = \Defuse\Crypto\Key::createNewRandomKey();
188 188
     $key = $key->saveToAsciiSafeString();
189 189
     return $key;
@@ -205,15 +205,15 @@  discard block
 block discarded – undo
205 205
         $path = '../includes/libraries/Encryption/Encryption/';
206 206
     }
207 207
 
208
-    include_once $path . 'Crypto.php';
209
-    include_once $path . 'Encoding.php';
210
-    include_once $path . 'DerivedKeys.php';
211
-    include_once $path . 'Key.php';
212
-    include_once $path . 'KeyOrPassword.php';
213
-    include_once $path . 'File.php';
214
-    include_once $path . 'RuntimeTests.php';
215
-    include_once $path . 'KeyProtectedByPassword.php';
216
-    include_once $path . 'Core.php';
208
+    include_once $path.'Crypto.php';
209
+    include_once $path.'Encoding.php';
210
+    include_once $path.'DerivedKeys.php';
211
+    include_once $path.'Key.php';
212
+    include_once $path.'KeyOrPassword.php';
213
+    include_once $path.'File.php';
214
+    include_once $path.'RuntimeTests.php';
215
+    include_once $path.'KeyProtectedByPassword.php';
216
+    include_once $path.'Core.php';
217 217
     $protected_key = \Defuse\Crypto\KeyProtectedByPassword::createRandomPasswordProtectedKey($psk);
218 218
     return $protected_key->saveToAsciiSafeString(); // save this in user table
219 219
 }
@@ -235,15 +235,15 @@  discard block
 block discarded – undo
235 235
         $path = '../includes/libraries/Encryption/Encryption/';
236 236
     }
237 237
 
238
-    include_once $path . 'Crypto.php';
239
-    include_once $path . 'Encoding.php';
240
-    include_once $path . 'DerivedKeys.php';
241
-    include_once $path . 'Key.php';
242
-    include_once $path . 'KeyOrPassword.php';
243
-    include_once $path . 'File.php';
244
-    include_once $path . 'RuntimeTests.php';
245
-    include_once $path . 'KeyProtectedByPassword.php';
246
-    include_once $path . 'Core.php';
238
+    include_once $path.'Crypto.php';
239
+    include_once $path.'Encoding.php';
240
+    include_once $path.'DerivedKeys.php';
241
+    include_once $path.'Key.php';
242
+    include_once $path.'KeyOrPassword.php';
243
+    include_once $path.'File.php';
244
+    include_once $path.'RuntimeTests.php';
245
+    include_once $path.'KeyProtectedByPassword.php';
246
+    include_once $path.'Core.php';
247 247
     try {
248 248
         $protected_key = \Defuse\Crypto\KeyProtectedByPassword::loadFromAsciiSafeString($protected_key_encoded);
249 249
         $user_key = $protected_key->unlockKey($psk);
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
  */
283 283
 function trimElement($chaine, string $element): string
284 284
 {
285
-    if (! empty($chaine)) {
285
+    if (!empty($chaine)) {
286 286
         if (is_array($chaine) === true) {
287 287
             $chaine = implode(';', $chaine);
288 288
         }
@@ -326,8 +326,8 @@  discard block
 block discarded – undo
326 326
  */
327 327
 function db_error_handler(array $params): void
328 328
 {
329
-    echo 'Error: ' . $params['error'] . "<br>\n";
330
-    echo 'Query: ' . $params['query'] . "<br>\n";
329
+    echo 'Error: '.$params['error']."<br>\n";
330
+    echo 'Query: '.$params['query']."<br>\n";
331 331
     throw new Exception('Error - Query', 1);
332 332
 }
333 333
 
@@ -349,12 +349,12 @@  discard block
 block discarded – undo
349 349
     $SETTINGS
350 350
 ) {
351 351
     //load ClassLoader
352
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
352
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
353 353
     // Load superglobal
354
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
354
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
355 355
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
356 356
     //Connect to DB
357
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
357
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
358 358
     if (defined('DB_PASSWD_CLEAR') === false) {
359 359
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
360 360
     }
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
     DB::$port = DB_PORT;
366 366
     DB::$encoding = DB_ENCODING;
367 367
     //Build tree
368
-    $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
368
+    $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
369 369
     $tree->register();
370 370
     $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
371 371
     // Check if user is ADMINISTRATOR
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 function identAdmin($idFonctions, $SETTINGS, $tree)
409 409
 {
410 410
     // Load superglobal
411
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
411
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
412 412
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
413 413
     // Init
414 414
     $groupesVisibles = [];
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
     $globalsVisibleFolders = $superGlobal->get('groupes_visibles', 'SESSION');
428 428
     $globalsPersonalVisibleFolders = $superGlobal->get('personal_visible_groups', 'SESSION');
429 429
     // Get list of Folders
430
-    $rows = DB::query('SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', 0);
430
+    $rows = DB::query('SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', 0);
431 431
     foreach ($rows as $record) {
432 432
         array_push($groupesVisibles, $record['id']);
433 433
     }
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
     }
447 447
     // Get ID of personal folder
448 448
     $persfld = DB::queryfirstrow(
449
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE title = %s',
449
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE title = %s',
450 450
         $globalsUserId
451 451
     );
452 452
     if (empty($persfld['id']) === false) {
@@ -467,20 +467,20 @@  discard block
 block discarded – undo
467 467
     // get complete list of ROLES
468 468
     $tmp = explode(';', $idFonctions);
469 469
     $rows = DB::query(
470
-    'SELECT * FROM ' . prefixTable('roles_title') . '
470
+    'SELECT * FROM '.prefixTable('roles_title').'
471 471
         ORDER BY title ASC'
472 472
 );
473 473
     foreach ($rows as $record) {
474
-        if (! empty($record['id']) && ! in_array($record['id'], $tmp)) {
474
+        if (!empty($record['id']) && !in_array($record['id'], $tmp)) {
475 475
             array_push($tmp, $record['id']);
476 476
         }
477 477
     }
478 478
     $superGlobal->put('fonction_id', implode(';', $tmp), 'SESSION');
479 479
     $superGlobal->put('is_admin', 1, 'SESSION');
480 480
     // Check if admin has created Folders and Roles
481
-    DB::query('SELECT * FROM ' . prefixTable('nested_tree') . '');
481
+    DB::query('SELECT * FROM '.prefixTable('nested_tree').'');
482 482
     $superGlobal->put('nb_folders', DB::count(), 'SESSION');
483
-    DB::query('SELECT * FROM ' . prefixTable('roles_title'));
483
+    DB::query('SELECT * FROM '.prefixTable('roles_title'));
484 484
     $superGlobal->put('nb_roles', DB::count(), 'SESSION');
485 485
 }
486 486
 
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
     object $tree
525 525
 ) {
526 526
     // Load superglobal
527
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
527
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
528 528
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
529 529
     // Init
530 530
     $superGlobal->put('groupes_visibles', [], 'SESSION');
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
     // Get list of folders depending on Roles
553 553
     $rows = DB::query(
554 554
         'SELECT *
555
-        FROM ' . prefixTable('roles_values') . '
555
+        FROM ' . prefixTable('roles_values').'
556 556
         WHERE role_id IN %li AND type IN %ls',
557 557
         $userRoles,
558 558
         ['W', 'ND', 'NE', 'NDNE', 'R']
@@ -577,9 +577,9 @@  discard block
 block discarded – undo
577 577
     // Does this user is allowed to see other items
578 578
     $inc = 0;
579 579
     $rows = DB::query(
580
-    'SELECT id, id_tree FROM ' . prefixTable('items') . '
580
+    'SELECT id, id_tree FROM '.prefixTable('items').'
581 581
         WHERE restricted_to LIKE %ss AND inactif = %s',
582
-    $globalsUserId . ';',
582
+    $globalsUserId.';',
583 583
     '0'
584 584
 );
585 585
     foreach ($rows as $record) {
@@ -593,8 +593,8 @@  discard block
 block discarded – undo
593 593
     // Check for the users roles if some specific rights exist on items
594 594
     $rows = DB::query(
595 595
         'SELECT i.id_tree, r.item_id
596
-        FROM ' . prefixTable('items') . ' as i
597
-        INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (r.item_id=i.id)
596
+        FROM ' . prefixTable('items').' as i
597
+        INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (r.item_id=i.id)
598 598
         WHERE r.role_id IN %li
599 599
         ORDER BY i.id_tree ASC',
600 600
         $userRoles
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
     ) {
616 616
         $persoFld = DB::queryfirstrow(
617 617
             'SELECT id
618
-            FROM ' . prefixTable('nested_tree') . '
618
+            FROM ' . prefixTable('nested_tree').'
619 619
             WHERE title = %s AND personal_folder = %i',
620 620
             $globalsUserId,
621 621
             1
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
     }
649 649
     $persoFlds = DB::query(
650 650
         'SELECT id
651
-        FROM ' . prefixTable('nested_tree') . '
651
+        FROM ' . prefixTable('nested_tree').'
652 652
         WHERE %l',
653 653
         $where
654 654
     );
@@ -689,16 +689,16 @@  discard block
 block discarded – undo
689 689
     'SESSION'
690 690
 );
691 691
     // Folders and Roles numbers
692
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('nested_tree') . '');
692
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('nested_tree').'');
693 693
     $superGlobal->put('nb_folders', DB::count(), 'SESSION');
694
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('roles_title'));
694
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('roles_title'));
695 695
     $superGlobal->put('nb_roles', DB::count(), 'SESSION');
696 696
     // check if change proposals on User's items
697 697
     if (isset($SETTINGS['enable_suggestion']) === true && (int) $SETTINGS['enable_suggestion'] === 1) {
698 698
         DB::query(
699 699
             'SELECT *
700
-            FROM ' . prefixTable('items_change') . ' AS c
701
-            LEFT JOIN ' . prefixTable('log_items') . ' AS i ON (c.item_id = i.id_item)
700
+            FROM ' . prefixTable('items_change').' AS c
701
+            LEFT JOIN ' . prefixTable('log_items').' AS i ON (c.item_id = i.id_item)
702 702
             WHERE i.action = %s AND i.id_user = %i',
703 703
             'at_creation',
704 704
             $globalsUserId
@@ -742,9 +742,9 @@  discard block
 block discarded – undo
742 742
  */
743 743
 function cacheTableRefresh(array $SETTINGS): void
744 744
 {
745
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
745
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
746 746
     //Connect to DB
747
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
747
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
748 748
     if (defined('DB_PASSWD_CLEAR') === false) {
749 749
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
750 750
     }
@@ -759,12 +759,12 @@  discard block
 block discarded – undo
759 759
     $tree->register();
760 760
     $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
761 761
     // truncate table
762
-    DB::query('TRUNCATE TABLE ' . prefixTable('cache'));
762
+    DB::query('TRUNCATE TABLE '.prefixTable('cache'));
763 763
     // reload date
764 764
     $rows = DB::query(
765 765
         'SELECT *
766
-        FROM ' . prefixTable('items') . ' as i
767
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
766
+        FROM ' . prefixTable('items').' as i
767
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
768 768
         AND l.action = %s
769 769
         AND i.inactif = %i',
770 770
         'at_creation',
@@ -776,18 +776,18 @@  discard block
 block discarded – undo
776 776
             $tags = '';
777 777
             $itemTags = DB::query(
778 778
     'SELECT tag
779
-                FROM ' . prefixTable('tags') . '
779
+                FROM ' . prefixTable('tags').'
780 780
                 WHERE item_id = %i AND tag != ""',
781 781
     $record['id']
782 782
 );
783 783
             foreach ($itemTags as $itemTag) {
784
-                $tags .= $itemTag['tag'] . ' ';
784
+                $tags .= $itemTag['tag'].' ';
785 785
             }
786 786
 
787 787
             // Get renewal period
788 788
             $resNT = DB::queryfirstrow(
789 789
                 'SELECT renewal_period
790
-                FROM ' . prefixTable('nested_tree') . '
790
+                FROM ' . prefixTable('nested_tree').'
791 791
                 WHERE id = %i',
792 792
                 $record['id_tree']
793 793
             );
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
                     // Is this a User id?
801 801
                     $user = DB::queryfirstrow(
802 802
                         'SELECT id, login
803
-                        FROM ' . prefixTable('users') . '
803
+                        FROM ' . prefixTable('users').'
804 804
                         WHERE id = %i',
805 805
                         $elem->title
806 806
                     );
@@ -818,11 +818,11 @@  discard block
 block discarded – undo
818 818
                     'id' => $record['id'],
819 819
                     'label' => $record['label'],
820 820
                     'description' => $record['description'] ?? '',
821
-                    'url' => isset($record['url']) && ! empty($record['url']) ? $record['url'] : '0',
821
+                    'url' => isset($record['url']) && !empty($record['url']) ? $record['url'] : '0',
822 822
                     'tags' => $tags,
823 823
                     'id_tree' => $record['id_tree'],
824 824
                     'perso' => $record['perso'],
825
-                    'restricted_to' => isset($record['restricted_to']) && ! empty($record['restricted_to']) ? $record['restricted_to'] : '0',
825
+                    'restricted_to' => isset($record['restricted_to']) && !empty($record['restricted_to']) ? $record['restricted_to'] : '0',
826 826
                     'login' => $record['login'] ?? '',
827 827
                     'folder' => implode(' > ', $folder),
828 828
                     'author' => $record['id_user'],
@@ -842,12 +842,12 @@  discard block
 block discarded – undo
842 842
  */
843 843
 function cacheTableUpdate(array $SETTINGS, ?string $ident = null): void
844 844
 {
845
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
845
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
846 846
     // Load superglobal
847
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
847
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
848 848
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
849 849
     //Connect to DB
850
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
850
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
851 851
     if (defined('DB_PASSWD_CLEAR') === false) {
852 852
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
853 853
     }
@@ -864,7 +864,7 @@  discard block
 block discarded – undo
864 864
     // get new value from db
865 865
     $data = DB::queryfirstrow(
866 866
         'SELECT label, description, id_tree, perso, restricted_to, login, url
867
-        FROM ' . prefixTable('items') . '
867
+        FROM ' . prefixTable('items').'
868 868
         WHERE id=%i',
869 869
         $ident
870 870
     );
@@ -872,12 +872,12 @@  discard block
 block discarded – undo
872 872
     $tags = '';
873 873
     $itemTags = DB::query(
874 874
     'SELECT tag
875
-        FROM ' . prefixTable('tags') . '
875
+        FROM ' . prefixTable('tags').'
876 876
         WHERE item_id = %i AND tag != ""',
877 877
     $ident
878 878
 );
879 879
     foreach ($itemTags as $itemTag) {
880
-        $tags .= $itemTag['tag'] . ' ';
880
+        $tags .= $itemTag['tag'].' ';
881 881
     }
882 882
     // form id_tree to full foldername
883 883
     $folder = [];
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
             // Is this a User id?
889 889
             $user = DB::queryfirstrow(
890 890
                 'SELECT id, login
891
-                FROM ' . prefixTable('users') . '
891
+                FROM ' . prefixTable('users').'
892 892
                 WHERE id = %i',
893 893
                 $elem->title
894 894
             );
@@ -906,10 +906,10 @@  discard block
 block discarded – undo
906 906
             'label' => $data['label'],
907 907
             'description' => $data['description'],
908 908
             'tags' => $tags,
909
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
909
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
910 910
             'id_tree' => $data['id_tree'],
911 911
             'perso' => $data['perso'],
912
-            'restricted_to' => isset($data['restricted_to']) && ! empty($data['restricted_to']) ? $data['restricted_to'] : '0',
912
+            'restricted_to' => isset($data['restricted_to']) && !empty($data['restricted_to']) ? $data['restricted_to'] : '0',
913 913
             'login' => $data['login'] ?? '',
914 914
             'folder' => implode(' » ', $folder),
915 915
             'author' => $superGlobal->get('user_id', 'SESSION'),
@@ -927,14 +927,14 @@  discard block
 block discarded – undo
927 927
  */
928 928
 function cacheTableAdd(array $SETTINGS, ?string $ident = null): void
929 929
 {
930
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
930
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
931 931
     // Load superglobal
932
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
932
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
933 933
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
934 934
     // Get superglobals
935 935
     $globalsUserId = $superGlobal->get('user_id', 'SESSION');
936 936
     //Connect to DB
937
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
937
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
938 938
     if (defined('DB_PASSWD_CLEAR') === false) {
939 939
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
940 940
     }
@@ -951,8 +951,8 @@  discard block
 block discarded – undo
951 951
     // get new value from db
952 952
     $data = DB::queryFirstRow(
953 953
         'SELECT i.label, i.description, i.id_tree as id_tree, i.perso, i.restricted_to, i.id, i.login, i.url, l.date
954
-        FROM ' . prefixTable('items') . ' as i
955
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
954
+        FROM ' . prefixTable('items').' as i
955
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
956 956
         WHERE i.id = %i
957 957
         AND l.action = %s',
958 958
         $ident,
@@ -962,12 +962,12 @@  discard block
 block discarded – undo
962 962
     $tags = '';
963 963
     $itemTags = DB::query(
964 964
     'SELECT tag
965
-        FROM ' . prefixTable('tags') . '
965
+        FROM ' . prefixTable('tags').'
966 966
         WHERE item_id = %i AND tag != ""',
967 967
     $ident
968 968
 );
969 969
     foreach ($itemTags as $itemTag) {
970
-        $tags .= $itemTag['tag'] . ' ';
970
+        $tags .= $itemTag['tag'].' ';
971 971
     }
972 972
     // form id_tree to full foldername
973 973
     $folder = [];
@@ -978,7 +978,7 @@  discard block
 block discarded – undo
978 978
             // Is this a User id?
979 979
             $user = DB::queryfirstrow(
980 980
                 'SELECT id, login
981
-                FROM ' . prefixTable('users') . '
981
+                FROM ' . prefixTable('users').'
982 982
                 WHERE id = %i',
983 983
                 $elem->title
984 984
             );
@@ -997,7 +997,7 @@  discard block
 block discarded – undo
997 997
             'label' => $data['label'],
998 998
             'description' => $data['description'],
999 999
             'tags' => isset($tags) && empty($tags) === false ? $tags : 'None',
1000
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
1000
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
1001 1001
             'id_tree' => $data['id_tree'],
1002 1002
             'perso' => isset($data['perso']) && empty($data['perso']) === false && $data['perso'] !== 'None' ? $data['perso'] : '0',
1003 1003
             'restricted_to' => isset($data['restricted_to']) && empty($data['restricted_to']) === false ? $data['restricted_to'] : '0',
@@ -1019,52 +1019,52 @@  discard block
 block discarded – undo
1019 1019
 function getStatisticsData(array $SETTINGS): array
1020 1020
 {
1021 1021
     DB::query(
1022
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
1022
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
1023 1023
         0
1024 1024
     );
1025 1025
     $counter_folders = DB::count();
1026 1026
     DB::query(
1027
-    'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
1027
+    'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
1028 1028
     1
1029 1029
 );
1030 1030
     $counter_folders_perso = DB::count();
1031 1031
     DB::query(
1032
-    'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
1032
+    'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
1033 1033
     0
1034 1034
 );
1035 1035
     $counter_items = DB::count();
1036 1036
     DB::query(
1037
-    'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
1037
+    'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
1038 1038
     1
1039 1039
 );
1040 1040
     $counter_items_perso = DB::count();
1041 1041
     DB::query(
1042
-    'SELECT id FROM ' . prefixTable('users') . ''
1042
+    'SELECT id FROM '.prefixTable('users').''
1043 1043
 );
1044 1044
     $counter_users = DB::count();
1045 1045
     DB::query(
1046
-    'SELECT id FROM ' . prefixTable('users') . ' WHERE admin = %i',
1046
+    'SELECT id FROM '.prefixTable('users').' WHERE admin = %i',
1047 1047
     1
1048 1048
 );
1049 1049
     $admins = DB::count();
1050 1050
     DB::query(
1051
-    'SELECT id FROM ' . prefixTable('users') . ' WHERE gestionnaire = %i',
1051
+    'SELECT id FROM '.prefixTable('users').' WHERE gestionnaire = %i',
1052 1052
     1
1053 1053
 );
1054 1054
     $managers = DB::count();
1055 1055
     DB::query(
1056
-    'SELECT id FROM ' . prefixTable('users') . ' WHERE read_only = %i',
1056
+    'SELECT id FROM '.prefixTable('users').' WHERE read_only = %i',
1057 1057
     1
1058 1058
 );
1059 1059
     $readOnly = DB::count();
1060 1060
     // list the languages
1061 1061
     $usedLang = [];
1062 1062
     $tp_languages = DB::query(
1063
-    'SELECT name FROM ' . prefixTable('languages')
1063
+    'SELECT name FROM '.prefixTable('languages')
1064 1064
 );
1065 1065
     foreach ($tp_languages as $tp_language) {
1066 1066
         DB::query(
1067
-            'SELECT * FROM ' . prefixTable('users') . ' WHERE user_language = %s',
1067
+            'SELECT * FROM '.prefixTable('users').' WHERE user_language = %s',
1068 1068
             $tp_language['name']
1069 1069
         );
1070 1070
         $usedLang[$tp_language['name']] = round((DB::count() * 100 / $counter_users), 0);
@@ -1073,12 +1073,12 @@  discard block
 block discarded – undo
1073 1073
     // get list of ips
1074 1074
     $usedIp = [];
1075 1075
     $tp_ips = DB::query(
1076
-    'SELECT user_ip FROM ' . prefixTable('users')
1076
+    'SELECT user_ip FROM '.prefixTable('users')
1077 1077
 );
1078 1078
     foreach ($tp_ips as $ip) {
1079 1079
         if (array_key_exists($ip['user_ip'], $usedIp)) {
1080 1080
             $usedIp[$ip['user_ip']] = $usedIp[$ip['user_ip']] + 1;
1081
-        } elseif (! empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1081
+        } elseif (!empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1082 1082
             $usedIp[$ip['user_ip']] = 1;
1083 1083
         }
1084 1084
     }
@@ -1144,21 +1144,21 @@  discard block
 block discarded – undo
1144 1144
     }
1145 1145
 
1146 1146
     // Load settings
1147
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
1147
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
1148 1148
     // Load superglobal
1149
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1149
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1150 1150
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1151 1151
     // Get user language
1152
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $superGlobal->get('user_language', 'SESSION') . '.php';
1152
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$superGlobal->get('user_language', 'SESSION').'.php';
1153 1153
     // Load library
1154
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1154
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1155 1155
     // load PHPMailer
1156 1156
     $mail = new SplClassLoader('PHPMailer\PHPMailer', '../includes/libraries');
1157 1157
     $mail->register();
1158 1158
     $mail = new PHPMailer\PHPMailer\PHPMailer(true);
1159 1159
     try {
1160 1160
         // send to user
1161
-        $mail->setLanguage('en', $SETTINGS['cpassman_dir'] . '/includes/libraries/PHPMailer/PHPMailer/language/');
1161
+        $mail->setLanguage('en', $SETTINGS['cpassman_dir'].'/includes/libraries/PHPMailer/PHPMailer/language/');
1162 1162
         $mail->SMTPDebug = 0;
1163 1163
         //value 1 can be used to debug - 4 for debuging connections
1164 1164
         $mail->Port = $SETTINGS['email_port'];
@@ -1250,7 +1250,7 @@  discard block
 block discarded – undo
1250 1250
         <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;">
1251 1251
         <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;">
1252 1252
         <br><div style="float:right;">' .
1253
-        $textMail .
1253
+        $textMail.
1254 1254
         '<br><br></td></tr></table>
1255 1255
     </td></tr></table>
1256 1256
     <br></body></html>';
@@ -1261,7 +1261,7 @@  discard block
 block discarded – undo
1261 1261
  */
1262 1262
 function generateKey(): string
1263 1263
 {
1264
-    return substr(md5(rand() . rand()), 0, 15);
1264
+    return substr(md5(rand().rand()), 0, 15);
1265 1265
 }
1266 1266
 
1267 1267
 /**
@@ -1328,7 +1328,7 @@  discard block
 block discarded – undo
1328 1328
 {
1329 1329
     array_walk_recursive(
1330 1330
         $array,
1331
-        static function (&$item): void {
1331
+        static function(&$item): void {
1332 1332
             if (mb_detect_encoding((string) $item, 'utf-8', true) === false) {
1333 1333
                 $item = utf8_encode($item);
1334 1334
             }
@@ -1363,7 +1363,7 @@  discard block
 block discarded – undo
1363 1363
     }
1364 1364
 
1365 1365
     // Load superglobal
1366
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1366
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1367 1367
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1368 1368
     // Get superglobals
1369 1369
     if ($key !== null) {
@@ -1374,9 +1374,9 @@  discard block
 block discarded – undo
1374 1374
     }
1375 1375
 
1376 1376
     //load ClassLoader
1377
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1377
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1378 1378
     //Load AES
1379
-    $aes = new SplClassLoader('Encryption\Crypt', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1379
+    $aes = new SplClassLoader('Encryption\Crypt', $SETTINGS['cpassman_dir'].'/includes/libraries');
1380 1380
     $aes->register();
1381 1381
     if ($type === 'encode' && is_array($data) === true) {
1382 1382
         // Ensure UTF8 format
@@ -1466,8 +1466,8 @@  discard block
 block discarded – undo
1466 1466
  */
1467 1467
 function prefixTable(string $table): string
1468 1468
 {
1469
-    $safeTable = htmlspecialchars(DB_PREFIX . $table);
1470
-    if (! empty($safeTable)) {
1469
+    $safeTable = htmlspecialchars(DB_PREFIX.$table);
1470
+    if (!empty($safeTable)) {
1471 1471
         // sanitize string
1472 1472
         return $safeTable;
1473 1473
     }
@@ -1497,13 +1497,13 @@  discard block
 block discarded – undo
1497 1497
     bool $lowercase = false,
1498 1498
     array $SETTINGS = []
1499 1499
 ): string {
1500
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1501
-    $generator = new SplClassLoader('PasswordGenerator\Generator', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1500
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1501
+    $generator = new SplClassLoader('PasswordGenerator\Generator', $SETTINGS['cpassman_dir'].'/includes/libraries');
1502 1502
     $generator->register();
1503 1503
     $generator = new PasswordGenerator\Generator\ComputerPasswordGenerator();
1504 1504
     // Is PHP7 being used?
1505 1505
     if (version_compare(PHP_VERSION, '7.0.0', '>=')) {
1506
-        $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1506
+        $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', $SETTINGS['cpassman_dir'].'/includes/libraries');
1507 1507
         $php7generator->register();
1508 1508
         $generator->setRandomGenerator(new PasswordGenerator\RandomGenerator\Php7RandomGenerator());
1509 1509
     }
@@ -1533,7 +1533,7 @@  discard block
 block discarded – undo
1533 1533
 function send_syslog($message, $host, $port, $component = 'teampass'): void
1534 1534
 {
1535 1535
     $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
1536
-    $syslog_message = '<123>' . date('M d H:i:s ') . $component . ': ' . $message;
1536
+    $syslog_message = '<123>'.date('M d H:i:s ').$component.': '.$message;
1537 1537
     socket_sendto($sock, $syslog_message, strlen($syslog_message), 0, $host, $port);
1538 1538
     socket_close($sock);
1539 1539
 }
@@ -1555,7 +1555,7 @@  discard block
 block discarded – undo
1555 1555
     }
1556 1556
 
1557 1557
     // include librairies & connect to DB
1558
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1558
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1559 1559
     if (defined('DB_PASSWD_CLEAR') === false) {
1560 1560
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1561 1561
     }
@@ -1579,14 +1579,14 @@  discard block
 block discarded – undo
1579 1579
     if (isset($SETTINGS['syslog_enable']) === true && (int) $SETTINGS['syslog_enable'] === 1) {
1580 1580
         if ($type === 'user_mngt') {
1581 1581
             send_syslog(
1582
-                'action=' . str_replace('at_', '', $label) . ' attribute=user user=' . $who . ' userid="' . $login . '" change="' . $field_1 . '" ',
1582
+                'action='.str_replace('at_', '', $label).' attribute=user user='.$who.' userid="'.$login.'" change="'.$field_1.'" ',
1583 1583
                 $SETTINGS['syslog_host'],
1584 1584
                 $SETTINGS['syslog_port'],
1585 1585
                 'teampass'
1586 1586
             );
1587 1587
         } else {
1588 1588
             send_syslog(
1589
-                'action=' . $type . ' attribute=' . $label . ' user=' . $who . ' userid="' . $login . '" ',
1589
+                'action='.$type.' attribute='.$label.' user='.$who.' userid="'.$login.'" ',
1590 1590
                 $SETTINGS['syslog_host'],
1591 1591
                 $SETTINGS['syslog_port'],
1592 1592
                 'teampass'
@@ -1618,7 +1618,7 @@  discard block
 block discarded – undo
1618 1618
     ?string $encryption_type = null
1619 1619
 ): void {
1620 1620
     // include librairies & connect to DB
1621
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1621
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1622 1622
     if (defined('DB_PASSWD_CLEAR') === false) {
1623 1623
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1624 1624
     }
@@ -1662,7 +1662,7 @@  discard block
 block discarded – undo
1662 1662
         if (empty($item_label) === true) {
1663 1663
             $dataItem = DB::queryfirstrow(
1664 1664
                 'SELECT id, id_tree, label
1665
-                FROM ' . prefixTable('items') . '
1665
+                FROM ' . prefixTable('items').'
1666 1666
                 WHERE id = %i',
1667 1667
                 $item_id
1668 1668
             );
@@ -1670,11 +1670,11 @@  discard block
 block discarded – undo
1670 1670
         }
1671 1671
 
1672 1672
         send_syslog(
1673
-            'action=' . str_replace('at_', '', $action) .
1674
-                ' attribute=' . str_replace('at_', '', $attribute[0]) .
1675
-                ' itemno=' . $item_id .
1676
-                ' user=' . is_null($login) === true ? '' : addslashes((string) $login) .
1677
-                ' itemname="' . addslashes($item_label) . '"',
1673
+            'action='.str_replace('at_', '', $action).
1674
+                ' attribute='.str_replace('at_', '', $attribute[0]).
1675
+                ' itemno='.$item_id.
1676
+                ' user='.is_null($login) === true ? '' : addslashes((string) $login).
1677
+                ' itemname="'.addslashes($item_label).'"',
1678 1678
             $SETTINGS['syslog_host'],
1679 1679
             $SETTINGS['syslog_port'],
1680 1680
             'teampass'
@@ -1700,7 +1700,7 @@  discard block
 block discarded – undo
1700 1700
         && $action === 'at_shown'
1701 1701
     ) {
1702 1702
         // Load superglobal
1703
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1703
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1704 1704
         $superGlobal = new protect\SuperGlobal\SuperGlobal();
1705 1705
         // Get superglobals
1706 1706
         $globalsLastname = $superGlobal->get('lastname', 'SESSION');
@@ -1709,7 +1709,7 @@  discard block
 block discarded – undo
1709 1709
         // Get info about item
1710 1710
         $dataItem = DB::queryfirstrow(
1711 1711
             'SELECT id, id_tree, label
1712
-            FROM ' . prefixTable('items') . '
1712
+            FROM ' . prefixTable('items').'
1713 1713
             WHERE id = %i',
1714 1714
             $item_id
1715 1715
         );
@@ -1723,9 +1723,9 @@  discard block
 block discarded – undo
1723 1723
                 'body' => str_replace(
1724 1724
                     ['#tp_user#', '#tp_item#', '#tp_link#'],
1725 1725
                     [
1726
-                        addslashes($globalsName . ' ' . $globalsLastname),
1726
+                        addslashes($globalsName.' '.$globalsLastname),
1727 1727
                         addslashes($item_label),
1728
-                        $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $item_id,
1728
+                        $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$item_id,
1729 1729
                     ],
1730 1730
                     langHdl('email_on_open_notification_mail')
1731 1731
                 ),
@@ -1747,7 +1747,7 @@  discard block
 block discarded – undo
1747 1747
 function notifyChangesToSubscribers(int $item_id, string $label, array $changes, array $SETTINGS): void
1748 1748
 {
1749 1749
     // Load superglobal
1750
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1750
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1751 1751
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1752 1752
     // Get superglobals
1753 1753
     $globalsUserId = $superGlobal->get('user_id', 'SESSION');
@@ -1757,8 +1757,8 @@  discard block
 block discarded – undo
1757 1757
     $notification = DB::queryOneColumn(
1758 1758
         'email',
1759 1759
         'SELECT *
1760
-        FROM ' . prefixTable('notification') . ' AS n
1761
-        INNER JOIN ' . prefixTable('users') . ' AS u ON (n.user_id = u.id)
1760
+        FROM ' . prefixTable('notification').' AS n
1761
+        INNER JOIN ' . prefixTable('users').' AS u ON (n.user_id = u.id)
1762 1762
         WHERE n.item_id = %i AND n.user_id != %i',
1763 1763
         $item_id,
1764 1764
         $globalsUserId
@@ -1769,7 +1769,7 @@  discard block
 block discarded – undo
1769 1769
         // Get list of changes
1770 1770
         $htmlChanges = '<ul>';
1771 1771
         foreach ($changes as $change) {
1772
-            $htmlChanges .= '<li>' . $change . '</li>';
1772
+            $htmlChanges .= '<li>'.$change.'</li>';
1773 1773
         }
1774 1774
         $htmlChanges .= '</ul>';
1775 1775
         // send email
@@ -1800,7 +1800,7 @@  discard block
 block discarded – undo
1800 1800
 function geItemReadablePath(int $id_tree, string $label, array $SETTINGS): string
1801 1801
 {
1802 1802
     // Class loader
1803
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1803
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1804 1804
     //Load Tree
1805 1805
     $tree = new SplClassLoader('Tree\NestedTree', '../includes/libraries');
1806 1806
     $tree->register();
@@ -1809,15 +1809,15 @@  discard block
 block discarded – undo
1809 1809
     $path = '';
1810 1810
     foreach ($arbo as $elem) {
1811 1811
         if (empty($path) === true) {
1812
-            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' ';
1812
+            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' ';
1813 1813
         } else {
1814
-            $path .= '&#8594; ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1814
+            $path .= '&#8594; '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1815 1815
         }
1816 1816
     }
1817 1817
 
1818 1818
     // Build text to show user
1819 1819
     if (empty($label) === false) {
1820
-        return empty($path) === true ? addslashes($label) : addslashes($label) . ' (' . $path . ')';
1820
+        return empty($path) === true ? addslashes($label) : addslashes($label).' ('.$path.')';
1821 1821
     }
1822 1822
     return empty($path) === true ? '' : $path;
1823 1823
 
@@ -1874,9 +1874,9 @@  discard block
 block discarded – undo
1874 1874
  */
1875 1875
 function handleConfigFile($action, $SETTINGS, $field = null, $value = null)
1876 1876
 {
1877
-    $tp_config_file = $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php';
1877
+    $tp_config_file = $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php';
1878 1878
     // include librairies & connect to DB
1879
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1879
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1880 1880
     if (defined('DB_PASSWD_CLEAR') === false) {
1881 1881
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1882 1882
     }
@@ -1889,8 +1889,8 @@  discard block
 block discarded – undo
1889 1889
     if (file_exists($tp_config_file) === false || $action === 'rebuild') {
1890 1890
         // perform a copy
1891 1891
         if (file_exists($tp_config_file)) {
1892
-            if (! copy($tp_config_file, $tp_config_file . '.' . date('Y_m_d_His', time()))) {
1893
-                return "ERROR: Could not copy file '" . $tp_config_file . "'";
1892
+            if (!copy($tp_config_file, $tp_config_file.'.'.date('Y_m_d_His', time()))) {
1893
+                return "ERROR: Could not copy file '".$tp_config_file."'";
1894 1894
             }
1895 1895
         }
1896 1896
 
@@ -1900,11 +1900,11 @@  discard block
 block discarded – undo
1900 1900
         $data[1] = "global \$SETTINGS;\n";
1901 1901
         $data[2] = "\$SETTINGS = array (\n";
1902 1902
         $rows = DB::query(
1903
-    'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s',
1903
+    'SELECT * FROM '.prefixTable('misc').' WHERE type=%s',
1904 1904
     'admin'
1905 1905
 );
1906 1906
         foreach ($rows as $record) {
1907
-            array_push($data, "    '" . $record['intitule'] . "' => '" . $record['valeur'] . "',\n");
1907
+            array_push($data, "    '".$record['intitule']."' => '".$record['valeur']."',\n");
1908 1908
         }
1909 1909
         array_push($data, ");\n");
1910 1910
         $data = array_unique($data);
@@ -1918,15 +1918,15 @@  discard block
 block discarded – undo
1918 1918
                 break;
1919 1919
             }
1920 1920
 
1921
-            if (stristr($line, "'" . $field . "' => '")) {
1922
-                $data[$inc] = "    '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n";
1921
+            if (stristr($line, "'".$field."' => '")) {
1922
+                $data[$inc] = "    '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n";
1923 1923
                 $bFound = true;
1924 1924
                 break;
1925 1925
             }
1926 1926
             ++$inc;
1927 1927
         }
1928 1928
         if ($bFound === false) {
1929
-            $data[$inc] = "    '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n);\n";
1929
+            $data[$inc] = "    '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n);\n";
1930 1930
         }
1931 1931
     }
1932 1932
 
@@ -1952,7 +1952,7 @@  discard block
 block discarded – undo
1952 1952
 {
1953 1953
     global $SETTINGS;
1954 1954
     /* LOAD CPASSMAN SETTINGS */
1955
-    if (! isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
1955
+    if (!isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
1956 1956
         $SETTINGS = [];
1957 1957
         $SETTINGS['duplicate_folder'] = 0;
1958 1958
         //by default, this is set to 0;
@@ -1962,7 +1962,7 @@  discard block
 block discarded – undo
1962 1962
         //by default, this value is set to 5;
1963 1963
         $settings = [];
1964 1964
         $rows = DB::query(
1965
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s_type OR type=%s_type2',
1965
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s_type OR type=%s_type2',
1966 1966
             [
1967 1967
                 'type' => 'admin',
1968 1968
                 'type2' => 'settings',
@@ -1989,7 +1989,7 @@  discard block
 block discarded – undo
1989 1989
     $source_cf = [];
1990 1990
     $rows = DB::QUERY(
1991 1991
     'SELECT id_category
1992
-        FROM ' . prefixTable('categories_folders') . '
1992
+        FROM ' . prefixTable('categories_folders').'
1993 1993
         WHERE id_folder = %i',
1994 1994
     $source_id
1995 1995
 );
@@ -2000,7 +2000,7 @@  discard block
 block discarded – undo
2000 2000
     $target_cf = [];
2001 2001
     $rows = DB::QUERY(
2002 2002
     'SELECT id_category
2003
-        FROM ' . prefixTable('categories_folders') . '
2003
+        FROM ' . prefixTable('categories_folders').'
2004 2004
         WHERE id_folder = %i',
2005 2005
     $target_id
2006 2006
 );
@@ -2035,9 +2035,9 @@  discard block
 block discarded – undo
2035 2035
     $password = null
2036 2036
 ) {
2037 2037
     // Load AntiXSS
2038
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php';
2039
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php';
2040
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php';
2038
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php';
2039
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php';
2040
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php';
2041 2041
     $antiXss = new voku\helper\AntiXSS();
2042 2042
     // Protect against bad inputs
2043 2043
     if (is_array($source_file) === true || is_array($target_file) === true) {
@@ -2049,7 +2049,7 @@  discard block
 block discarded – undo
2049 2049
     $target_file = $antiXss->xss_clean($target_file);
2050 2050
     if (empty($password) === true || is_null($password) === true) {
2051 2051
         // get KEY to define password
2052
-        $ascii_key = file_get_contents(SECUREPATH . '/teampass-seckey.txt');
2052
+        $ascii_key = file_get_contents(SECUREPATH.'/teampass-seckey.txt');
2053 2053
         $password = \Defuse\Crypto\Key::loadFromAsciiSafeString($ascii_key);
2054 2054
     }
2055 2055
 
@@ -2095,15 +2095,15 @@  discard block
 block discarded – undo
2095 2095
 ) {
2096 2096
     // load PhpEncryption library
2097 2097
     $path_to_encryption = '/includes/libraries/Encryption/Encryption/';
2098
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php';
2099
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php';
2100
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php';
2101
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php';
2102
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php';
2103
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php';
2104
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php';
2105
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php';
2106
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php';
2098
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php';
2099
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php';
2100
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php';
2101
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php';
2102
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php';
2103
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php';
2104
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php';
2105
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php';
2106
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php';
2107 2107
     try {
2108 2108
         \Defuse\Crypto\File::encryptFileWithPassword(
2109 2109
             $source_file,
@@ -2140,15 +2140,15 @@  discard block
 block discarded – undo
2140 2140
 ) {
2141 2141
     // load PhpEncryption library
2142 2142
     $path_to_encryption = '/includes/libraries/Encryption/Encryption/';
2143
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php';
2144
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php';
2145
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php';
2146
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php';
2147
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php';
2148
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php';
2149
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php';
2150
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php';
2151
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php';
2143
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php';
2144
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php';
2145
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php';
2146
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php';
2147
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php';
2148
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php';
2149
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php';
2150
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php';
2151
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php';
2152 2152
     try {
2153 2153
         \Defuse\Crypto\File::decryptFileWithPassword(
2154 2154
             $source_file,
@@ -2193,9 +2193,9 @@  discard block
 block discarded – undo
2193 2193
 function fileDelete(string $file, array $SETTINGS): void
2194 2194
 {
2195 2195
     // Load AntiXSS
2196
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php';
2197
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php';
2198
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php';
2196
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php';
2197
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php';
2198
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php';
2199 2199
     $antiXss = new voku\helper\AntiXSS();
2200 2200
     $file = $antiXss->xss_clean($file);
2201 2201
     if (is_file($file)) {
@@ -2237,9 +2237,9 @@  discard block
 block discarded – undo
2237 2237
 *    More info at: http://php.net/chmod.
2238 2238
 */
2239 2239
 
2240
-function recursiveChmod($path, $filePerm=0644, $dirPerm=0755) {
2240
+function recursiveChmod($path, $filePerm = 0644, $dirPerm = 0755) {
2241 2241
     // Check if the path exists
2242
-    if (! file_exists($path)) {
2242
+    if (!file_exists($path)) {
2243 2243
         return false;
2244 2244
     }
2245 2245
 
@@ -2274,7 +2274,7 @@  discard block
 block discarded – undo
2274 2274
  */
2275 2275
 function accessToItemIsGranted(int $item_id, $SETTINGS)
2276 2276
 {
2277
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2277
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2278 2278
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
2279 2279
     // Prepare superGlobal variables
2280 2280
     $session_groupes_visibles = $superGlobal->get('groupes_visibles', 'SESSION');
@@ -2282,7 +2282,7 @@  discard block
 block discarded – undo
2282 2282
     // Load item data
2283 2283
     $data = DB::queryFirstRow(
2284 2284
         'SELECT id_tree
2285
-        FROM ' . prefixTable('items') . '
2285
+        FROM ' . prefixTable('items').'
2286 2286
         WHERE id = %i',
2287 2287
         $item_id
2288 2288
     );
@@ -2355,8 +2355,8 @@  discard block
 block discarded – undo
2355 2355
 function performDBQuery(array $SETTINGS, string $fields, string $table): array
2356 2356
 {
2357 2357
     // include librairies & connect to DB
2358
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2359
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2358
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2359
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2360 2360
     if (defined('DB_PASSWD_CLEAR') === false) {
2361 2361
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2362 2362
     }
@@ -2368,7 +2368,7 @@  discard block
 block discarded – undo
2368 2368
     DB::$encoding = DB_ENCODING;
2369 2369
     // Insert log in DB
2370 2370
     return DB::query(
2371
-        'SELECT ' . $fields . '
2371
+        'SELECT '.$fields.'
2372 2372
         FROM ' . prefixTable($table)
2373 2373
     );
2374 2374
 }
@@ -2381,11 +2381,11 @@  discard block
 block discarded – undo
2381 2381
 function formatSizeUnits(int $bytes): string
2382 2382
 {
2383 2383
     if ($bytes >= 1073741824) {
2384
-        $bytes = number_format($bytes / 1073741824, 2) . ' GB';
2384
+        $bytes = number_format($bytes / 1073741824, 2).' GB';
2385 2385
     } elseif ($bytes >= 1048576) {
2386
-        $bytes = number_format($bytes / 1048576, 2) . ' MB';
2386
+        $bytes = number_format($bytes / 1048576, 2).' MB';
2387 2387
     } elseif ($bytes >= 1024) {
2388
-        $bytes = number_format($bytes / 1024, 2) . ' KB';
2388
+        $bytes = number_format($bytes / 1024, 2).' KB';
2389 2389
     } elseif ($bytes > 1) {
2390 2390
         $bytes .= ' bytes';
2391 2391
     } elseif ($bytes === 1) {
@@ -2576,14 +2576,14 @@  discard block
 block discarded – undo
2576 2576
 
2577 2577
     // Encrypt the file content
2578 2578
     $plaintext = file_get_contents(
2579
-        filter_var($fileInPath . '/' . $fileInName, FILTER_SANITIZE_URL)
2579
+        filter_var($fileInPath.'/'.$fileInName, FILTER_SANITIZE_URL)
2580 2580
     );
2581 2581
     $ciphertext = $cipher->encrypt($plaintext);
2582 2582
     // Save new file
2583 2583
     $hash = md5($plaintext);
2584
-    $fileOut = $fileInPath . '/' . TP_FILE_PREFIX . $hash;
2584
+    $fileOut = $fileInPath.'/'.TP_FILE_PREFIX.$hash;
2585 2585
     file_put_contents($fileOut, $ciphertext);
2586
-    unlink($fileInPath . '/' . $fileInName);
2586
+    unlink($fileInPath.'/'.$fileInName);
2587 2587
     return [
2588 2588
         'fileHash' => base64_encode($hash),
2589 2589
         'objectKey' => base64_encode($objectKey),
@@ -2599,7 +2599,7 @@  discard block
 block discarded – undo
2599 2599
  */
2600 2600
 function decryptFile(string $fileName, string $filePath, string $key): string
2601 2601
 {
2602
-    if (! defined('FILE_BUFFER_SIZE')) {
2602
+    if (!defined('FILE_BUFFER_SIZE')) {
2603 2603
         define('FILE_BUFFER_SIZE', 128 * 1024);
2604 2604
     }
2605 2605
 
@@ -2618,7 +2618,7 @@  discard block
 block discarded – undo
2618 2618
     $cipher->enableContinuousBuffer();
2619 2619
     $cipher->disablePadding();
2620 2620
     // Get file content
2621
-    $ciphertext = file_get_contents($filePath . '/' . TP_FILE_PREFIX . $fileName);
2621
+    $ciphertext = file_get_contents($filePath.'/'.TP_FILE_PREFIX.$fileName);
2622 2622
     // Decrypt file content and return
2623 2623
     return base64_encode($cipher->decrypt($ciphertext));
2624 2624
 }
@@ -2668,8 +2668,8 @@  discard block
 block discarded – undo
2668 2668
     array $SETTINGS
2669 2669
 ): void {
2670 2670
     // include librairies & connect to DB
2671
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2672
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2671
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2672
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2673 2673
     if (defined('DB_PASSWD_CLEAR') === false) {
2674 2674
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2675 2675
     }
@@ -2686,7 +2686,7 @@  discard block
 block discarded – undo
2686 2686
         $post_object_id
2687 2687
     );
2688 2688
     // Superglobals
2689
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2689
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2690 2690
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
2691 2691
     // Prepare superGlobal variables
2692 2692
     $sessionPpersonaFolders = $superGlobal->get('personal_folders', 'SESSION');
@@ -2711,8 +2711,8 @@  discard block
 block discarded – undo
2711 2711
         // Create sharekey for each user
2712 2712
         $users = DB::query(
2713 2713
             'SELECT id, public_key
2714
-            FROM ' . prefixTable('users') . '
2715
-            WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '")
2714
+            FROM ' . prefixTable('users').'
2715
+            WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'")
2716 2716
             AND public_key != ""'
2717 2717
         );
2718 2718
         foreach ($users as $user) {
@@ -2740,7 +2740,7 @@  discard block
 block discarded – undo
2740 2740
 function isBase64(string $str): bool
2741 2741
 {
2742 2742
     $str = (string) trim($str);
2743
-    if (! isset($str[0])) {
2743
+    if (!isset($str[0])) {
2744 2744
         return false;
2745 2745
     }
2746 2746
 
@@ -2808,13 +2808,13 @@  discard block
 block discarded – undo
2808 2808
         ],
2809 2809
     ];
2810 2810
     // Load expected libraries
2811
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
2812
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php';
2813
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php';
2814
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php';
2815
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php';
2816
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapBase.php';
2817
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php';
2811
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
2812
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php';
2813
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php';
2814
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php';
2815
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php';
2816
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapBase.php';
2817
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php';
2818 2818
     $ad = new SplClassLoader('LdapRecord', '../includes/libraries');
2819 2819
     $ad->register();
2820 2820
     $connection = new Connection($config);
@@ -2823,7 +2823,7 @@  discard block
 block discarded – undo
2823 2823
         $connection->connect();
2824 2824
     } catch (\LdapRecord\Auth\BindException $e) {
2825 2825
         $error = $e->getDetailedError();
2826
-        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage();
2826
+        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage();
2827 2827
         return false;
2828 2828
     }
2829 2829
 
@@ -2832,7 +2832,7 @@  discard block
 block discarded – undo
2832 2832
         $connection->auth()->attempt($SETTINGS['ldap_user_attribute'].'='.$login.','.$SETTINGS['ldap_bdn'], $password, $stayAuthenticated = true);
2833 2833
     } catch (\LdapRecord\Auth\BindException $e) {
2834 2834
         $error = $e->getDetailedError();
2835
-        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage();
2835
+        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage();
2836 2836
         return false;
2837 2837
     }
2838 2838
 
@@ -2850,8 +2850,8 @@  discard block
 block discarded – undo
2850 2850
 function deleteUserObjetsKeys(int $userId, array $SETTINGS): bool
2851 2851
 {
2852 2852
     // include librairies & connect to DB
2853
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2854
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2853
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2854
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2855 2855
     if (defined('DB_PASSWD_CLEAR') === false) {
2856 2856
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2857 2857
     }
@@ -2905,7 +2905,7 @@  discard block
 block discarded – undo
2905 2905
         foreach (DateTimeZone::listIdentifiers() as $timezone) {
2906 2906
             $now->setTimezone(new DateTimeZone($timezone));
2907 2907
             $offsets[] = $offset = $now->getOffset();
2908
-            $timezones[$timezone] = '(' . format_GMT_offset($offset) . ') ' . format_timezone_name($timezone);
2908
+            $timezones[$timezone] = '('.format_GMT_offset($offset).') '.format_timezone_name($timezone);
2909 2909
         }
2910 2910
 
2911 2911
         array_multisort($offsets, $timezones);
@@ -2918,7 +2918,7 @@  discard block
 block discarded – undo
2918 2918
 {
2919 2919
     $hours = intval($offset / 3600);
2920 2920
     $minutes = abs(intval($offset % 3600 / 60));
2921
-    return 'GMT' . ($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
2921
+    return 'GMT'.($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
2922 2922
 }
2923 2923
 
2924 2924
 function format_timezone_name($name)
Please login to merge, or discard this patch.
sources/users.queries.php 1 patch
Spacing   +141 added lines, -141 removed lines patch added patch discarded remove patch
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
 }
48 48
 
49 49
 /* do checks */
50
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
51
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
50
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
51
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
52 52
 $isprofileupdate = filter_input(INPUT_POST, 'isprofileupdate', FILTER_SANITIZE_STRING);
53 53
 if (
54 54
     checkUser($_SESSION['user_id'], $_SESSION['key'], 'profile', $SETTINGS) === false
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
         || $isprofileupdate === false
60 60
     ) {
61 61
         $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
62
-        include $SETTINGS['cpassman_dir'] . '/error.php';
62
+        include $SETTINGS['cpassman_dir'].'/error.php';
63 63
         exit();
64 64
     } else {
65 65
         // Do special check to allow user to change attributes of his profile
@@ -68,20 +68,20 @@  discard block
 block discarded – undo
68 68
             || checkUser($_SESSION['user_id'], $_SESSION['key'], 'profile', $SETTINGS) === false
69 69
         ) {
70 70
             $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
71
-            include $SETTINGS['cpassman_dir'] . '/error.php';
71
+            include $SETTINGS['cpassman_dir'].'/error.php';
72 72
             exit();
73 73
         }
74 74
     }
75 75
 }
76 76
 
77
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
77
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
78 78
 header('Content-type: text/html; charset=utf-8');
79
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
80
-require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
81
-require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
79
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
80
+require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
81
+require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
82 82
 
83 83
 // Connect to mysql server
84
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
84
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
85 85
 if (defined('DB_PASSWD_CLEAR') === false) {
86 86
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
87 87
 }
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
             // Prepare variables
131 131
             $login = filter_var($dataReceived['login'], FILTER_SANITIZE_STRING);
132 132
             $email = filter_var($dataReceived['email'], FILTER_SANITIZE_EMAIL);
133
-            $password = '';//filter_var($dataReceived['pw'], FILTER_SANITIZE_STRING);
133
+            $password = ''; //filter_var($dataReceived['pw'], FILTER_SANITIZE_STRING);
134 134
             $lastname = filter_var($dataReceived['lastname'], FILTER_SANITIZE_STRING);
135 135
             $name = filter_var($dataReceived['name'], FILTER_SANITIZE_STRING);
136 136
             $is_admin = filter_var($dataReceived['admin'], FILTER_SANITIZE_NUMBER_INT);
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
             // Check if user already exists
160 160
             $data = DB::query(
161 161
                 'SELECT id, fonction_id, groupes_interdits, groupes_visibles
162
-                FROM ' . prefixTable('users') . '
162
+                FROM ' . prefixTable('users').'
163 163
                 WHERE login = %s',
164 164
                 $login
165 165
             );
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 
390 390
             // Get info about user to delete
391 391
             $data_user = DB::queryfirstrow(
392
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
392
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
393 393
                 WHERE id = %i',
394 394
                 $post_id
395 395
             );
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
                 );
409 409
                 // delete personal folder and subfolders
410 410
                 $data = DB::queryfirstrow(
411
-                    'SELECT id FROM ' . prefixTable('nested_tree') . '
411
+                    'SELECT id FROM '.prefixTable('nested_tree').'
412 412
                     WHERE title = %s AND personal_folder = %i',
413 413
                     $post_id,
414 414
                     '1'
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
                         DB::delete(prefixTable('nested_tree'), 'id = %i AND personal_folder = %i', $folder->id, '1');
422 422
                         // delete items & logs
423 423
                         $items = DB::query(
424
-                            'SELECT id FROM ' . prefixTable('items') . '
424
+                            'SELECT id FROM '.prefixTable('items').'
425 425
                             WHERE id_tree=%i AND perso = %i',
426 426
                             $folder->id,
427 427
                             '1'
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
 
479 479
             // Get info about user to delete
480 480
             $data_user = DB::queryfirstrow(
481
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
481
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
482 482
                 WHERE id = %i',
483 483
                 $post_id
484 484
             );
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 
521 521
             // Get info about user to delete
522 522
             $data_user = DB::queryfirstrow(
523
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
523
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
524 524
                 WHERE id = %i',
525 525
                 $post_id
526 526
             );
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
             // Get info about user to delete
564 564
             $data_user = DB::queryfirstrow(
565 565
                 'SELECT admin, isAdministratedByRole, can_manage_all_users, gestionnaire
566
-                FROM ' . prefixTable('users') . '
566
+                FROM ' . prefixTable('users').'
567 567
                 WHERE id = %i',
568 568
                 $post_id
569 569
             );
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
 
608 608
             // Get info about user to delete
609 609
             $data_user = DB::queryfirstrow(
610
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
610
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
611 611
                 WHERE id = %i',
612 612
                 $post_id
613 613
             );
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
             // Get info about user to delete
651 651
             $data_user = DB::queryfirstrow(
652 652
                 'SELECT admin, isAdministratedByRole, gestionnaire
653
-                FROM ' . prefixTable('users') . '
653
+                FROM ' . prefixTable('users').'
654 654
                 WHERE id = %i',
655 655
                 $post_id
656 656
             );
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
             // Get info about user to delete
694 694
             $data_user = DB::queryfirstrow(
695 695
                 'SELECT admin, isAdministratedByRole, gestionnaire
696
-                FROM ' . prefixTable('users') . '
696
+                FROM ' . prefixTable('users').'
697 697
                 WHERE id = %i',
698 698
                 $post_id
699 699
             );
@@ -733,7 +733,7 @@  discard block
 block discarded – undo
733 733
             // Get info about user to delete
734 734
             $data_user = DB::queryfirstrow(
735 735
                 'SELECT admin, isAdministratedByRole, gestionnaire
736
-                FROM ' . prefixTable('users') . '
736
+                FROM ' . prefixTable('users').'
737 737
                 WHERE id = %i',
738 738
                 $post_id
739 739
             );
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
             $return = array();
773 773
             // Check if folder exists
774 774
             $data = DB::query(
775
-                'SELECT * FROM ' . prefixTable('nested_tree') . '
775
+                'SELECT * FROM '.prefixTable('nested_tree').'
776 776
                 WHERE title = %s AND parent_id = %i',
777 777
                 filter_input(INPUT_POST, 'domain', FILTER_SANITIZE_STRING),
778 778
                 '0'
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
             }
786 786
             // Check if role exists
787 787
             $data = DB::query(
788
-                'SELECT * FROM ' . prefixTable('roles_title') . '
788
+                'SELECT * FROM '.prefixTable('roles_title').'
789 789
                 WHERE title = %s',
790 790
                 filter_input(INPUT_POST, 'domain', FILTER_SANITIZE_STRING)
791 791
             );
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
         case 'user_log_items':
806 806
             $nb_pages = 1;
807 807
             $logs = $sql_filter = '';
808
-            $pages = '<table style=\'border-top:1px solid #969696;\'><tr><td>' . langHdl('pages') . '&nbsp;:&nbsp;</td>';
808
+            $pages = '<table style=\'border-top:1px solid #969696;\'><tr><td>'.langHdl('pages').'&nbsp;:&nbsp;</td>';
809 809
 
810 810
             // Prepare POST variables
811 811
             $post_nb_items_by_page = filter_input(INPUT_POST, 'nb_items_by_page', FILTER_SANITIZE_NUMBER_INT);
@@ -817,14 +817,14 @@  discard block
 block discarded – undo
817 817
                     && !empty(filter_input(INPUT_POST, 'filter', FILTER_SANITIZE_STRING))
818 818
                     && filter_input(INPUT_POST, 'filter', FILTER_SANITIZE_STRING) !== 'all'
819 819
                 ) {
820
-                    $sql_filter = " AND l.action = '" . filter_input(INPUT_POST, 'filter', FILTER_SANITIZE_STRING) . "'";
820
+                    $sql_filter = " AND l.action = '".filter_input(INPUT_POST, 'filter', FILTER_SANITIZE_STRING)."'";
821 821
                 }
822 822
                 // get number of pages
823 823
                 DB::query(
824 824
                     'SELECT *
825
-                    FROM ' . prefixTable('log_items') . ' as l
826
-                    INNER JOIN ' . prefixTable('items') . ' as i ON (l.id_item=i.id)
827
-                    INNER JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id)
825
+                    FROM ' . prefixTable('log_items').' as l
826
+                    INNER JOIN ' . prefixTable('items').' as i ON (l.id_item=i.id)
827
+                    INNER JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id)
828 828
                     WHERE l.id_user = %i ' . $sql_filter,
829 829
                     filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT)
830 830
                 );
@@ -842,19 +842,19 @@  discard block
 block discarded – undo
842 842
                 // launch query
843 843
                 $rows = DB::query(
844 844
                     'SELECT l.date as date, u.login as login, i.label as label, l.action as action
845
-                    FROM ' . prefixTable('log_items') . ' as l
846
-                    INNER JOIN ' . prefixTable('items') . ' as i ON (l.id_item=i.id)
847
-                    INNER JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id)
848
-                    WHERE l.id_user = %i ' . $sql_filter . '
845
+                    FROM ' . prefixTable('log_items').' as l
846
+                    INNER JOIN ' . prefixTable('items').' as i ON (l.id_item=i.id)
847
+                    INNER JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id)
848
+                    WHERE l.id_user = %i ' . $sql_filter.'
849 849
                     ORDER BY date DESC
850
-                    LIMIT ' . intval($start) . ',' . intval($post_nb_items_by_page),
850
+                    LIMIT ' . intval($start).','.intval($post_nb_items_by_page),
851 851
                     filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT)
852 852
                 );
853 853
             } else {
854 854
                 // get number of pages
855 855
                 DB::query(
856 856
                     'SELECT *
857
-                    FROM ' . prefixTable('log_system') . '
857
+                    FROM ' . prefixTable('log_system').'
858 858
                     WHERE type = %s AND field_1=%i',
859 859
                     'user_mngt',
860 860
                     filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT)
@@ -873,7 +873,7 @@  discard block
 block discarded – undo
873 873
                 // launch query
874 874
                 $rows = DB::query(
875 875
                     'SELECT *
876
-                    FROM ' . prefixTable('log_system') . '
876
+                    FROM ' . prefixTable('log_system').'
877 877
                     WHERE type = %s AND field_1 = %i
878 878
                     ORDER BY date DESC
879 879
                     LIMIT %i, %i',
@@ -887,7 +887,7 @@  discard block
 block discarded – undo
887 887
             if (isset($counter) && $counter != 0) {
888 888
                 $nb_pages = ceil($counter / intval($post_nb_items_by_page));
889 889
                 for ($i = 1; $i <= $nb_pages; ++$i) {
890
-                    $pages .= '<td onclick=\'displayLogs(' . $i . ',\"' . $post_scope . '\")\'><span style=\'cursor:pointer;' . (filter_input(INPUT_POST, 'page', FILTER_SANITIZE_NUMBER_INT) === $i ? 'font-weight:bold;font-size:18px;\'>' . $i : '\'>' . $i) . '</span></td>';
890
+                    $pages .= '<td onclick=\'displayLogs('.$i.',\"'.$post_scope.'\")\'><span style=\'cursor:pointer;'.(filter_input(INPUT_POST, 'page', FILTER_SANITIZE_NUMBER_INT) === $i ? 'font-weight:bold;font-size:18px;\'>'.$i : '\'>'.$i).'</span></td>';
891 891
                 }
892 892
             }
893 893
             $pages .= '</tr></table>';
@@ -896,7 +896,7 @@  discard block
 block discarded – undo
896 896
                     if ($post_scope === 'user_mngt') {
897 897
                         $user = DB::queryfirstrow(
898 898
                             'SELECT login
899
-                            from ' . prefixTable('users') . '
899
+                            from ' . prefixTable('users').'
900 900
                             WHERE id=%i',
901 901
                             $record['qui']
902 902
                         );
@@ -906,7 +906,7 @@  discard block
 block discarded – undo
906 906
                         if ($tmp[0] == 'at_user_initial_pwd_changed') {
907 907
                             $label = langHdl('log_user_initial_pwd_changed');
908 908
                         } elseif ($tmp[0] == 'at_user_email_changed') {
909
-                            $label = langHdl('log_user_email_changed') . $tmp[1];
909
+                            $label = langHdl('log_user_email_changed').$tmp[1];
910 910
                         } elseif ($tmp[0] == 'at_user_added') {
911 911
                             $label = langHdl('log_user_created');
912 912
                         } elseif ($tmp[0] == 'at_user_locked') {
@@ -917,14 +917,14 @@  discard block
 block discarded – undo
917 917
                             $label = langHdl('log_user_pwd_changed');
918 918
                         }
919 919
                         // prepare log
920
-                        $logs .= '<tr><td>' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], $record['date']) . '</td><td align=\"center\">' . $label . '</td><td align=\"center\">' . $user['login'] . '</td><td align=\"center\"></td></tr>';
920
+                        $logs .= '<tr><td>'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], $record['date']).'</td><td align=\"center\">'.$label.'</td><td align=\"center\">'.$user['login'].'</td><td align=\"center\"></td></tr>';
921 921
                     } else {
922
-                        $logs .= '<tr><td>' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], $record['date']) . '</td><td align=\"center\">' . str_replace('"', '\"', $record['label']) . '</td><td align=\"center\">' . $record['login'] . '</td><td align=\"center\">' . langHdl($record['action']) . '</td></tr>';
922
+                        $logs .= '<tr><td>'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], $record['date']).'</td><td align=\"center\">'.str_replace('"', '\"', $record['label']).'</td><td align=\"center\">'.$record['login'].'</td><td align=\"center\">'.langHdl($record['action']).'</td></tr>';
923 923
                     }
924 924
                 }
925 925
             }
926 926
 
927
-            echo '[ { "table_logs": "' . ($logs) . '", "pages": "' . ($pages) . '", "error" : "no" } ]';
927
+            echo '[ { "table_logs": "'.($logs).'", "pages": "'.($pages).'", "error" : "no" } ]';
928 928
             break;
929 929
 
930 930
             /*
@@ -949,7 +949,7 @@  discard block
 block discarded – undo
949 949
             } else {
950 950
                 // Get folder id for Admin
951 951
                 $admin_folder = DB::queryFirstRow(
952
-                    'SELECT id FROM ' . prefixTable('nested_tree') . '
952
+                    'SELECT id FROM '.prefixTable('nested_tree').'
953 953
                     WHERE title = %i AND personal_folder = %i',
954 954
                     intval($_SESSION['user_id']),
955 955
                     '1'
@@ -960,15 +960,15 @@  discard block
 block discarded – undo
960 960
                     // Get each Items in PF
961 961
                     $rows = DB::query(
962 962
                         'SELECT i.pw, i.label, l.id_user
963
-                        FROM ' . prefixTable('items') . ' as i
964
-                        LEFT JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item=i.id)
963
+                        FROM ' . prefixTable('items').' as i
964
+                        LEFT JOIN ' . prefixTable('log_items').' as l ON (l.id_item=i.id)
965 965
                         WHERE l.action = %s AND i.perso=%i AND i.id_tree=%i',
966 966
                         'at_creation',
967 967
                         '1',
968 968
                         intval($folder->id)
969 969
                     );
970 970
                     foreach ($rows as $record) {
971
-                        echo $record['label'] . ' - ';
971
+                        echo $record['label'].' - ';
972 972
                         // Change user
973 973
                         DB::update(
974 974
                             prefixTable('log_items'),
@@ -1003,7 +1003,7 @@  discard block
 block discarded – undo
1003 1003
             // Get info about user to delete
1004 1004
             $data_user = DB::queryfirstrow(
1005 1005
                 'SELECT admin, isAdministratedByRole, gestionnaire
1006
-                FROM ' . prefixTable('users') . '
1006
+                FROM ' . prefixTable('users').'
1007 1007
                 WHERE id = %i',
1008 1008
                 $post_user_id
1009 1009
             );
@@ -1040,7 +1040,7 @@  discard block
 block discarded – undo
1040 1040
 
1041 1041
             // Do
1042 1042
             $rows = DB::query(
1043
-                'SELECT id FROM ' . prefixTable('users') . '
1043
+                'SELECT id FROM '.prefixTable('users').'
1044 1044
                 WHERE timestamp != %s AND admin != %i',
1045 1045
                 '',
1046 1046
                 '1'
@@ -1049,7 +1049,7 @@  discard block
 block discarded – undo
1049 1049
                 // Get info about user to delete
1050 1050
                 $data_user = DB::queryfirstrow(
1051 1051
                     'SELECT admin, isAdministratedByRole, gestionnaire
1052
-                    FROM ' . prefixTable('users') . '
1052
+                    FROM ' . prefixTable('users').'
1053 1053
                     WHERE id = %i',
1054 1054
                     $record['id']
1055 1055
                 );
@@ -1103,7 +1103,7 @@  discard block
 block discarded – undo
1103 1103
             // Get info about user
1104 1104
             $rowUser = DB::queryfirstrow(
1105 1105
                 'SELECT *
1106
-                FROM ' . prefixTable('users') . '
1106
+                FROM ' . prefixTable('users').'
1107 1107
                 WHERE id = %i',
1108 1108
                 $post_id
1109 1109
             );
@@ -1121,7 +1121,7 @@  discard block
 block discarded – undo
1121 1121
                 $arrFldAllowed = array();
1122 1122
 
1123 1123
                 //Build tree
1124
-                $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1124
+                $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
1125 1125
                 $tree->register();
1126 1126
                 $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
1127 1127
 
@@ -1132,7 +1132,7 @@  discard block
 block discarded – undo
1132 1132
                 // array of roles for actual user
1133 1133
                 $my_functions = explode(';', $_SESSION['fonction_id']);
1134 1134
 
1135
-                $rows = DB::query('SELECT id,title,creator_id FROM ' . prefixTable('roles_title'));
1135
+                $rows = DB::query('SELECT id,title,creator_id FROM '.prefixTable('roles_title'));
1136 1136
                 foreach ($rows as $record) {
1137 1137
                     if (
1138 1138
                         (int) $_SESSION['is_admin'] === 1
@@ -1168,7 +1168,7 @@  discard block
 block discarded – undo
1168 1168
                 $rolesList = array();
1169 1169
                 $managedBy = array();
1170 1170
                 $selected = '';
1171
-                $rows = DB::query('SELECT id,title FROM ' . prefixTable('roles_title') . ' ORDER BY title ASC');
1171
+                $rows = DB::query('SELECT id,title FROM '.prefixTable('roles_title').' ORDER BY title ASC');
1172 1172
                 foreach ($rows as $reccord) {
1173 1173
                     $rolesList[$reccord['id']] = array('id' => $reccord['id'], 'title' => $reccord['title']);
1174 1174
                 }
@@ -1199,7 +1199,7 @@  discard block
 block discarded – undo
1199 1199
                         array_push(
1200 1200
                             $managedBy,
1201 1201
                             array(
1202
-                                'title' => langHdl('managers_of') . ' ' . $fonction['title'],
1202
+                                'title' => langHdl('managers_of').' '.$fonction['title'],
1203 1203
                                 'id' => $fonction['id'],
1204 1204
                                 'selected' => $selected,
1205 1205
                             )
@@ -1281,9 +1281,9 @@  discard block
 block discarded – undo
1281 1281
 
1282 1282
                 // get USER STATUS
1283 1283
                 if ($rowUser['disabled'] == 1) {
1284
-                    $arrData['info'] = langHdl('user_info_locked') . '<br><input type="checkbox" value="unlock" name="1" class="chk">&nbsp;<label for="1">' . langHdl('user_info_unlock_question') . '</label><br><input type="checkbox"  value="delete" id="account_delete" class="chk mr-2" name="2" onclick="confirmDeletion()">label for="2">' . langHdl('user_info_delete_question') . '</label>';
1284
+                    $arrData['info'] = langHdl('user_info_locked').'<br><input type="checkbox" value="unlock" name="1" class="chk">&nbsp;<label for="1">'.langHdl('user_info_unlock_question').'</label><br><input type="checkbox"  value="delete" id="account_delete" class="chk mr-2" name="2" onclick="confirmDeletion()">label for="2">'.langHdl('user_info_delete_question').'</label>';
1285 1285
                 } else {
1286
-                    $arrData['info'] = langHdl('user_info_active') . '<br><input type="checkbox" value="lock" class="chk">&nbsp;' . langHdl('user_info_lock_question');
1286
+                    $arrData['info'] = langHdl('user_info_active').'<br><input type="checkbox" value="lock" class="chk">&nbsp;'.langHdl('user_info_lock_question');
1287 1287
                 }
1288 1288
 
1289 1289
                 $arrData['error'] = false;
@@ -1375,7 +1375,7 @@  discard block
 block discarded – undo
1375 1375
                 // count number of admins
1376 1376
                 $users = DB::query(
1377 1377
                     'SELECT id
1378
-                    FROM ' . prefixTable('users') . '
1378
+                    FROM ' . prefixTable('users').'
1379 1379
                     WHERE admin = 1 AND email != "" AND pw != ""'
1380 1380
                 );
1381 1381
                 if (DB::count() === 1) {
@@ -1461,7 +1461,7 @@  discard block
 block discarded – undo
1461 1461
 
1462 1462
             // Get info about user to delete
1463 1463
             $data_user = DB::queryfirstrow(
1464
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
1464
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
1465 1465
                 WHERE id = %i',
1466 1466
                 $post_id
1467 1467
             );
@@ -1482,7 +1482,7 @@  discard block
 block discarded – undo
1482 1482
                     );
1483 1483
                     // delete personal folder and subfolders
1484 1484
                     $data = DB::queryfirstrow(
1485
-                        'SELECT id FROM ' . prefixTable('nested_tree') . '
1485
+                        'SELECT id FROM '.prefixTable('nested_tree').'
1486 1486
                         WHERE title = %s AND personal_folder = %i',
1487 1487
                         $post_id,
1488 1488
                         '1'
@@ -1495,7 +1495,7 @@  discard block
 block discarded – undo
1495 1495
                             DB::delete(prefixTable('nested_tree'), 'id = %i AND personal_folder = %i', $folder->id, '1');
1496 1496
                             // delete items & logs
1497 1497
                             $items = DB::query(
1498
-                                'SELECT id FROM ' . prefixTable('items') . '
1498
+                                'SELECT id FROM '.prefixTable('items').'
1499 1499
                                 WHERE id_tree=%i AND perso = %i',
1500 1500
                                 $folder->id,
1501 1501
                                 '1'
@@ -1516,7 +1516,7 @@  discard block
 block discarded – undo
1516 1516
                 } else {
1517 1517
                     // Get old data about user
1518 1518
                     $oldData = DB::queryfirstrow(
1519
-                        'SELECT * FROM ' . prefixTable('users') . '
1519
+                        'SELECT * FROM '.prefixTable('users').'
1520 1520
                         WHERE id = %i',
1521 1521
                         $post_id
1522 1522
                     );
@@ -1546,7 +1546,7 @@  discard block
 block discarded – undo
1546 1546
 
1547 1547
                     // update LOG
1548 1548
                     if ($oldData['email'] !== $post_email) {
1549
-                        logEvents($SETTINGS, 'user_mngt', 'at_user_email_changed:' . $oldData['email'], intval($_SESSION['user_id']), $_SESSION['login'], $post_id);
1549
+                        logEvents($SETTINGS, 'user_mngt', 'at_user_email_changed:'.$oldData['email'], intval($_SESSION['user_id']), $_SESSION['login'], $post_id);
1550 1550
                     }
1551 1551
                 }
1552 1552
                 echo prepareExchangedData(
@@ -1601,7 +1601,7 @@  discard block
 block discarded – undo
1601 1601
 
1602 1602
             // Get info about user to delete
1603 1603
             $data_user = DB::queryfirstrow(
1604
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
1604
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
1605 1605
                 WHERE id = %i',
1606 1606
                 $post_id
1607 1607
             );
@@ -1651,7 +1651,7 @@  discard block
 block discarded – undo
1651 1651
             }
1652 1652
 
1653 1653
             DB::queryfirstrow(
1654
-                'SELECT * FROM ' . prefixTable('users') . '
1654
+                'SELECT * FROM '.prefixTable('users').'
1655 1655
                 WHERE login = %s',
1656 1656
                 filter_input(INPUT_POST, 'login', FILTER_SANITIZE_STRING)
1657 1657
             );
@@ -1700,14 +1700,14 @@  discard block
 block discarded – undo
1700 1700
             $arrData = array();
1701 1701
 
1702 1702
             //Build tree
1703
-            $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1703
+            $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
1704 1704
             $tree->register();
1705 1705
             $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
1706 1706
 
1707 1707
             // get User info
1708 1708
             $rowUser = DB::queryFirstRow(
1709 1709
                 'SELECT login, name, lastname, email, disabled, fonction_id, groupes_interdits, groupes_visibles, isAdministratedByRole, avatar_thumb
1710
-                FROM ' . prefixTable('users') . '
1710
+                FROM ' . prefixTable('users').'
1711 1711
                 WHERE id = %i',
1712 1712
                 $post_id
1713 1713
             );
@@ -1725,7 +1725,7 @@  discard block
 block discarded – undo
1725 1725
                 // refine folders based upon roles
1726 1726
                 $rows = DB::query(
1727 1727
                     'SELECT folder_id, type
1728
-                    FROM ' . prefixTable('roles_values') . '
1728
+                    FROM ' . prefixTable('roles_values').'
1729 1729
                     WHERE role_id IN %ls
1730 1730
                     ORDER BY folder_id ASC',
1731 1731
                     $arrData['functions']
@@ -1754,7 +1754,7 @@  discard block
 block discarded – undo
1754 1754
                             // get folder name
1755 1755
                             $row = DB::queryFirstRow(
1756 1756
                                 'SELECT title, nlevel, id
1757
-                                FROM ' . prefixTable('nested_tree') . '
1757
+                                FROM ' . prefixTable('nested_tree').'
1758 1758
                                 WHERE id = %i',
1759 1759
                                 $fld['id']
1760 1760
                             );
@@ -1767,34 +1767,34 @@  discard block
 block discarded – undo
1767 1767
 
1768 1768
                             // manage right icon
1769 1769
                             if ($fld['type'] == 'W') {
1770
-                                $label = '<i class="fas fa-indent infotip text-success mr-2" title="' . langHdl('write') . '"></i>' .
1771
-                                    '<i class="fas fa-edit infotip text-success mr-2" title="' . langHdl('edit') . '"></i>' .
1772
-                                    '<i class="fas fa-eraser infotip text-success" title="' . langHdl('delete') . '"></i>';
1770
+                                $label = '<i class="fas fa-indent infotip text-success mr-2" title="'.langHdl('write').'"></i>'.
1771
+                                    '<i class="fas fa-edit infotip text-success mr-2" title="'.langHdl('edit').'"></i>'.
1772
+                                    '<i class="fas fa-eraser infotip text-success" title="'.langHdl('delete').'"></i>';
1773 1773
                             } elseif ($fld['type'] == 'ND') {
1774
-                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . langHdl('write') . '"></i>' .
1775
-                                    '<i class="fas fa-edit infotip text-success mr-2" title="' . langHdl('edit') . '"></i>' .
1776
-                                    '<i class="fas fa-eraser infotip text-danger" title="' . langHdl('no_delete') . '"></i>';
1774
+                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.langHdl('write').'"></i>'.
1775
+                                    '<i class="fas fa-edit infotip text-success mr-2" title="'.langHdl('edit').'"></i>'.
1776
+                                    '<i class="fas fa-eraser infotip text-danger" title="'.langHdl('no_delete').'"></i>';
1777 1777
                             } elseif ($fld['type'] == 'NE') {
1778
-                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . langHdl('write') . '"></i>' .
1779
-                                    '<i class="fas fa-edit infotip text-danger mr-2" title="' . langHdl('no_edit') . '"></i>' .
1780
-                                    '<i class="fas fa-eraser infotip text-success" title="' . langHdl('delete') . '"></i>';
1778
+                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.langHdl('write').'"></i>'.
1779
+                                    '<i class="fas fa-edit infotip text-danger mr-2" title="'.langHdl('no_edit').'"></i>'.
1780
+                                    '<i class="fas fa-eraser infotip text-success" title="'.langHdl('delete').'"></i>';
1781 1781
                             } elseif ($fld['type'] == 'NDNE') {
1782
-                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . langHdl('write') . '"></i>' .
1783
-                                    '<i class="fas fa-edit infotip text-danger mr-2" title="' . langHdl('no_edit') . '"></i>' .
1784
-                                    '<i class="fas fa-eraser infotip text-danger" title="' . langHdl('no_delete') . '"></i>';
1782
+                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.langHdl('write').'"></i>'.
1783
+                                    '<i class="fas fa-edit infotip text-danger mr-2" title="'.langHdl('no_edit').'"></i>'.
1784
+                                    '<i class="fas fa-eraser infotip text-danger" title="'.langHdl('no_delete').'"></i>';
1785 1785
                             } else {
1786
-                                $label = '<i class="fas fa-eye infotip text-info mr-2" title="' . langHdl('read') . '"></i>';
1786
+                                $label = '<i class="fas fa-eye infotip text-info mr-2" title="'.langHdl('read').'"></i>';
1787 1787
                             }
1788 1788
 
1789
-                            $html .= '<tr><td>' . $ident . $row['title'] .
1790
-                                ' <small>[' . $row['id'] . ']</small></td><td>' . $label . '</td></tr>';
1789
+                            $html .= '<tr><td>'.$ident.$row['title'].
1790
+                                ' <small>['.$row['id'].']</small></td><td>'.$label.'</td></tr>';
1791 1791
                             break;
1792 1792
                         }
1793 1793
                     }
1794 1794
                 }
1795 1795
 
1796
-                $html_full = '<table id="table-folders" class="table table-bordered table-striped dt-responsive nowrap" style="width:100%"><tbody>' .
1797
-                    $html . '</tbody></table>';
1796
+                $html_full = '<table id="table-folders" class="table table-bordered table-striped dt-responsive nowrap" style="width:100%"><tbody>'.
1797
+                    $html.'</tbody></table>';
1798 1798
             } else {
1799 1799
                 $html_full = '';
1800 1800
             }
@@ -1840,7 +1840,7 @@  discard block
 block discarded – undo
1840 1840
             if ((int) $_SESSION['is_admin'] === 0 && (int) $_SESSION['user_can_manage_all_users'] === 0) {
1841 1841
                 $rows = DB::query(
1842 1842
                     'SELECT *
1843
-                    FROM ' . prefixTable('users') . '
1843
+                    FROM ' . prefixTable('users').'
1844 1844
                     WHERE admin = %i AND isAdministratedByRole IN %ls',
1845 1845
                     '0',
1846 1846
                     array_filter($_SESSION['user_roles'])
@@ -1848,7 +1848,7 @@  discard block
 block discarded – undo
1848 1848
             } else {
1849 1849
                 $rows = DB::query(
1850 1850
                     'SELECT *
1851
-                    FROM ' . prefixTable('users') . '
1851
+                    FROM ' . prefixTable('users').'
1852 1852
                     WHERE admin = %i',
1853 1853
                     '0'
1854 1854
                 );
@@ -1860,7 +1860,7 @@  discard block
 block discarded – undo
1860 1860
                 $groupIds = [];
1861 1861
                 foreach (explode(';', $record['fonction_id']) as $group) {
1862 1862
                     $tmp = DB::queryfirstrow(
1863
-                        'SELECT id, title FROM ' . prefixTable('roles_title') . '
1863
+                        'SELECT id, title FROM '.prefixTable('roles_title').'
1864 1864
                         WHERE id = %i',
1865 1865
                         $group
1866 1866
                     );
@@ -1872,7 +1872,7 @@  discard block
 block discarded – undo
1872 1872
 
1873 1873
                 // Get managed_by
1874 1874
                 $managedBy = DB::queryfirstrow(
1875
-                    'SELECT id, title FROM ' . prefixTable('roles_title') . '
1875
+                    'SELECT id, title FROM '.prefixTable('roles_title').'
1876 1876
                     WHERE id = %i',
1877 1877
                     $record['isAdministratedByRole']
1878 1878
                 );
@@ -1882,7 +1882,7 @@  discard block
 block discarded – undo
1882 1882
                 $foldersAllowedIds = [];
1883 1883
                 foreach (explode(';', $record['groupes_visibles']) as $role) {
1884 1884
                     $tmp = DB::queryfirstrow(
1885
-                        'SELECT id, title FROM ' . prefixTable('nested_tree') . '
1885
+                        'SELECT id, title FROM '.prefixTable('nested_tree').'
1886 1886
                         WHERE id = %i',
1887 1887
                         $role
1888 1888
                     );
@@ -1895,7 +1895,7 @@  discard block
 block discarded – undo
1895 1895
                 $foldersForbiddenIds = [];
1896 1896
                 foreach (explode(';', $record['groupes_interdits']) as $role) {
1897 1897
                     $tmp = DB::queryfirstrow(
1898
-                        'SELECT id, title FROM ' . prefixTable('nested_tree') . '
1898
+                        'SELECT id, title FROM '.prefixTable('nested_tree').'
1899 1899
                         WHERE id = %i',
1900 1900
                         $role
1901 1901
                     );
@@ -1913,7 +1913,7 @@  discard block
 block discarded – undo
1913 1913
                         'login' => $record['login'],
1914 1914
                         'groups' => implode(', ', $groups),
1915 1915
                         'groupIds' => $groupIds,
1916
-                        'managedBy' => $managedBy=== null ? langHdl('administrator') : $managedBy['title'],
1916
+                        'managedBy' => $managedBy === null ? langHdl('administrator') : $managedBy['title'],
1917 1917
                         'managedById' => $managedBy === null ? 0 : $managedBy['id'],
1918 1918
                         'foldersAllowed' => implode(', ', $foldersAllowed),
1919 1919
                         'foldersAllowedIds' => $foldersAllowedIds,
@@ -1991,7 +1991,7 @@  discard block
 block discarded – undo
1991 1991
 
1992 1992
             // Get info about user
1993 1993
             $data_user = DB::queryfirstrow(
1994
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
1994
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
1995 1995
                 WHERE id = %i',
1996 1996
                 $post_source_id
1997 1997
             );
@@ -2151,14 +2151,14 @@  discard block
 block discarded – undo
2151 2151
             if (empty($post_context) === false && $post_context === 'add_one_role_to_user') {
2152 2152
                 $data_user = DB::queryfirstrow(
2153 2153
                     'SELECT fonction_id
2154
-                    FROM ' . prefixTable('users') . '
2154
+                    FROM ' . prefixTable('users').'
2155 2155
                     WHERE id = %i',
2156 2156
                     $post_user_id
2157 2157
                 );
2158 2158
 
2159 2159
                 if ($data_user) {
2160 2160
                     // Ensure array is unique
2161
-                    $post_new_value = str_replace(',', ';', $data_user['fonction_id']) . ';' . $post_new_value;
2161
+                    $post_new_value = str_replace(',', ';', $data_user['fonction_id']).';'.$post_new_value;
2162 2162
                     $post_new_value = implode(';', array_unique(explode(';', $post_new_value)));
2163 2163
                 } else {
2164 2164
                     // User not found
@@ -2213,7 +2213,7 @@  discard block
 block discarded – undo
2213 2213
             if (filter_input(INPUT_POST, 'step', FILTER_SANITIZE_STRING) === 'refresh') {
2214 2214
                 $record = DB::queryFirstRow(
2215 2215
                     'SELECT user_ip_lastdate
2216
-                    FROM ' . prefixTable('users') . '
2216
+                    FROM ' . prefixTable('users').'
2217 2217
                     WHERE id = %i',
2218 2218
                     $_SESSION['user_id']
2219 2219
                 );
@@ -2305,38 +2305,38 @@  discard block
 block discarded – undo
2305 2305
             ];
2306 2306
 
2307 2307
             // Load expected libraries
2308
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
2309
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php';
2310
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Symfony/contracts/Translation/TranslatorInterface.php';
2311
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonTimeZone.php';
2312
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Units.php';
2313
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Week.php';
2314
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Timestamp.php';
2315
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Test.php';
2316
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/ObjectInitialisation.php';
2317
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Serialization.php';
2318
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/IntervalRounding.php';
2319
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Rounding.php';
2320
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Localization.php';
2321
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Options.php';
2322
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Cast.php';
2323
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mutability.php';
2324
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Modifiers.php';
2325
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mixin.php';
2326
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Macro.php';
2327
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Difference.php';
2328
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Creator.php';
2329
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Converter.php';
2330
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Comparison.php';
2331
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Boundaries.php';
2332
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Date.php';
2333
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonInterface.php';
2334
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Carbon.php';
2335
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php';
2336
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php';
2337
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php';
2338
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapBase.php';
2339
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php';
2308
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
2309
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php';
2310
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Symfony/contracts/Translation/TranslatorInterface.php';
2311
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonTimeZone.php';
2312
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Units.php';
2313
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Week.php';
2314
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Timestamp.php';
2315
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Test.php';
2316
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/ObjectInitialisation.php';
2317
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Serialization.php';
2318
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/IntervalRounding.php';
2319
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Rounding.php';
2320
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Localization.php';
2321
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Options.php';
2322
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Cast.php';
2323
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mutability.php';
2324
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Modifiers.php';
2325
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mixin.php';
2326
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Macro.php';
2327
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Difference.php';
2328
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Creator.php';
2329
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Converter.php';
2330
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Comparison.php';
2331
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Boundaries.php';
2332
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Date.php';
2333
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonInterface.php';
2334
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Carbon.php';
2335
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php';
2336
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php';
2337
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php';
2338
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapBase.php';
2339
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php';
2340 2340
 
2341 2341
             $ad = new SplClassLoader('LdapRecord', '../includes/libraries');
2342 2342
             $ad->register();
@@ -2352,7 +2352,7 @@  discard block
 block discarded – undo
2352 2352
                 echo prepareExchangedData(
2353 2353
                     array(
2354 2354
                         'error' => true,
2355
-                        'message' => "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage(). "<br>".$error->getDiagnosticMessage(),
2355
+                        'message' => "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage()."<br>".$error->getDiagnosticMessage(),
2356 2356
                     ),
2357 2357
                     'encode'
2358 2358
                 );
@@ -2372,11 +2372,11 @@  discard block
 block discarded – undo
2372 2372
                 ['objectclass', '=', 'inetorgperson'],
2373 2373
             ])->get();
2374 2374
             
2375
-            foreach($users as $i => $adUser) {
2375
+            foreach ($users as $i => $adUser) {
2376 2376
                 //print_r($user);
2377 2377
 
2378 2378
                 // Build the list of all groups in AD
2379
-                foreach($adUser['memberof'] as $j => $adUserGroup) {
2379
+                foreach ($adUser['memberof'] as $j => $adUserGroup) {
2380 2380
                     if (empty($adUserGroup) === false) {
2381 2381
                         $adGroup = substr($adUserGroup, 3, strpos($adUserGroup, ',') - 3);
2382 2382
                         if (in_array($adGroup, $adRoles) === false && empty($adGroup) === false) {
@@ -2391,7 +2391,7 @@  discard block
 block discarded – undo
2391 2391
                     // Get his ID
2392 2392
                     DB::queryfirstrow(
2393 2393
                         'SELECT id, fonction_id, auth_type
2394
-                        FROM ' . prefixTable('users') . '
2394
+                        FROM ' . prefixTable('users').'
2395 2395
                         WHERE login = %s',
2396 2396
                         $userLogin
2397 2397
                     );
@@ -2426,7 +2426,7 @@  discard block
 block discarded – undo
2426 2426
             }
2427 2427
 
2428 2428
             // Get all groups in Teampass
2429
-            $rows = DB::query('SELECT id,title FROM ' . prefixTable('roles_title'));
2429
+            $rows = DB::query('SELECT id,title FROM '.prefixTable('roles_title'));
2430 2430
             foreach ($rows as $record) {
2431 2431
                 array_push(
2432 2432
                     $teampassRoles,
@@ -2492,7 +2492,7 @@  discard block
 block discarded – undo
2492 2492
             // Check if user already exists
2493 2493
             $data = DB::query(
2494 2494
                 'SELECT id, fonction_id, groupes_interdits, groupes_visibles
2495
-                FROM ' . prefixTable('users') . '
2495
+                FROM ' . prefixTable('users').'
2496 2496
                 WHERE login = %s',
2497 2497
                 $post_login
2498 2498
             );
@@ -2596,7 +2596,7 @@  discard block
 block discarded – undo
2596 2596
                 );
2597 2597
 
2598 2598
                 // Rebuild tree
2599
-                $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
2599
+                $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
2600 2600
                 $tree->register();
2601 2601
                 $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
2602 2602
                 $tree->rebuild();
@@ -2664,7 +2664,7 @@  discard block
 block discarded – undo
2664 2664
             // Check if user already exists
2665 2665
             $data = DB::query(
2666 2666
                 'SELECT id
2667
-                FROM ' . prefixTable('users') . '
2667
+                FROM ' . prefixTable('users').'
2668 2668
                 WHERE id = %i',
2669 2669
                 $post_id
2670 2670
             );
@@ -2740,7 +2740,7 @@  discard block
 block discarded – undo
2740 2740
             // Check if user already exists
2741 2741
             $userInfo = DB::queryfirstrow(
2742 2742
                 'SELECT id, private_key, public_key
2743
-                FROM ' . prefixTable('users') . '
2743
+                FROM ' . prefixTable('users').'
2744 2744
                 WHERE id = %i',
2745 2745
                 $post_userid
2746 2746
             );
@@ -2775,7 +2775,7 @@  discard block
 block discarded – undo
2775 2775
             if (count($_SESSION['personal_folders']) > 0) {
2776 2776
                 DB::query(
2777 2777
                     'SELECT id
2778
-                    FROM ' . prefixTable('items') . '
2778
+                    FROM ' . prefixTable('items').'
2779 2779
                     WHERE id_tree IN %ls',
2780 2780
                     $_SESSION['personal_folders']
2781 2781
                 );
@@ -2853,7 +2853,7 @@  discard block
 block discarded – undo
2853 2853
             // Check if user already exists
2854 2854
             DB::query(
2855 2855
                 'SELECT id
2856
-                FROM ' . prefixTable('users') . '
2856
+                FROM ' . prefixTable('users').'
2857 2857
                 WHERE id = %i',
2858 2858
                 $post_id
2859 2859
             );
@@ -2907,7 +2907,7 @@  discard block
 block discarded – undo
2907 2907
 
2908 2908
     // Get info about user
2909 2909
     $data_user = DB::queryfirstrow(
2910
-        'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
2910
+        'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
2911 2911
         WHERE id = %i',
2912 2912
         $value[1]
2913 2913
     );
@@ -2940,7 +2940,7 @@  discard block
 block discarded – undo
2940 2940
             logEvents(
2941 2941
                 $SETTINGS,
2942 2942
                 'user_mngt',
2943
-                'at_user_new_' . $value[0] . ':' . $value[1],
2943
+                'at_user_new_'.$value[0].':'.$value[1],
2944 2944
                 $_SESSION['user_id'],
2945 2945
                 $_SESSION['login'],
2946 2946
                 filter_input(INPUT_POST, 'id', FILTER_SANITIZE_STRING)
@@ -2972,7 +2972,7 @@  discard block
 block discarded – undo
2972 2972
 
2973 2973
     // Get info about user
2974 2974
     $data_user = DB::queryfirstrow(
2975
-        'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
2975
+        'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
2976 2976
         WHERE id = %i',
2977 2977
         $value[1]
2978 2978
     );
Please login to merge, or discard this patch.
sources/downloadFile.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 }
52 52
 
53 53
 // Include files
54
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
54
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
55 55
 $superGlobal = new protect\SuperGlobal\SuperGlobal();
56 56
 // Prepare GET variables
57 57
 $get_filename = $superGlobal->get('name', 'GET');
@@ -59,17 +59,17 @@  discard block
 block discarded – undo
59 59
 $get_pathIsFiles = $superGlobal->get('pathIsFiles', 'GET');
60 60
 
61 61
 // prepare Encryption class calls
62
-header('Content-disposition: attachment; filename=' . rawurldecode(basename($get_filename)));
62
+header('Content-disposition: attachment; filename='.rawurldecode(basename($get_filename)));
63 63
 header('Content-Type: application/octet-stream');
64 64
 header('Cache-Control: must-revalidate, no-cache, no-store');
65 65
 header('Expires: 0');
66 66
 if (isset($_GET['pathIsFiles']) && (int) $get_pathIsFiles === 1) {
67
-    readfile($SETTINGS['path_to_files_folder'] . '/' . basename($get_filename));
67
+    readfile($SETTINGS['path_to_files_folder'].'/'.basename($get_filename));
68 68
 } else {
69 69
     include_once 'main.functions.php';
70
-    require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
70
+    require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
71 71
     // connect to the server
72
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
72
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
73 73
     if (defined('DB_PASSWD_CLEAR') === false) {
74 74
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
75 75
     }
@@ -83,8 +83,8 @@  discard block
 block discarded – undo
83 83
     $file_info = DB::queryfirstrow(
84 84
         'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status, f.extension AS extension,
85 85
         s.share_key AS share_key
86
-        FROM ' . prefixTable('files') . ' AS f
87
-        INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id)
86
+        FROM ' . prefixTable('files').' AS f
87
+        INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id)
88 88
         WHERE s.user_id = %i AND s.object_id = %i',
89 89
         $_SESSION['user_id'],
90 90
         $get_fileid
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
     header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
104 104
     header('Cache-Control: private', false);
105 105
     header('Content-Type: application/octet-stream');
106
-    header('Content-Disposition: attachment; filename="' . $filename . '.' . $file_info['extension'] . '";');
106
+    header('Content-Disposition: attachment; filename="'.$filename.'.'.$file_info['extension'].'";');
107 107
     header('Content-Transfer-Encoding: binary');
108 108
     // Stream the CSV data
109 109
     exit(base64_decode($fileContent));
Please login to merge, or discard this patch.
sources/ldap.queries.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -47,26 +47,26 @@  discard block
 block discarded – undo
47 47
 }
48 48
 
49 49
 /* do checks */
50
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
51
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
50
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
51
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
52 52
 if (!checkUser($_SESSION['user_id'], $_SESSION['key'], 'ldap', $SETTINGS)) {
53 53
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
54
-    include $SETTINGS['cpassman_dir'] . '/error.php';
54
+    include $SETTINGS['cpassman_dir'].'/error.php';
55 55
     exit();
56 56
 }
57 57
 
58
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
59
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
60
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php';
58
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
59
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
60
+require_once $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php';
61 61
 
62 62
 header('Content-type: text/html; charset=utf-8');
63 63
 header('Cache-Control: no-cache, no-store, must-revalidate');
64 64
 
65
-require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
66
-require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
65
+require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
66
+require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
67 67
 
68 68
 // connect to the server
69
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
69
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
70 70
 if (defined('DB_PASSWD_CLEAR') === false) {
71 71
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
72 72
 }
@@ -126,38 +126,38 @@  discard block
 block discarded – undo
126 126
         ];
127 127
         
128 128
         // Load expected libraries
129
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/helpers.php';
130
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
131
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php';
132
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Symfony/contracts/Translation/TranslatorInterface.php';
133
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonTimeZone.php';
134
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Units.php';
135
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Week.php';
136
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Timestamp.php';
137
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Test.php';
138
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/ObjectInitialisation.php';
139
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Serialization.php';
140
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/IntervalRounding.php';
141
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Rounding.php';
142
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Localization.php';
143
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Options.php';
144
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Cast.php';
145
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mutability.php';
146
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Modifiers.php';
147
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mixin.php';
148
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Macro.php';
149
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Difference.php';
150
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Creator.php';
151
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Converter.php';
152
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Comparison.php';
153
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Boundaries.php';
154
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Date.php';
155
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonInterface.php';
156
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Carbon.php';
157
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php';
158
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php';
159
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php';
160
-        require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapBase.php';
129
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/helpers.php';
130
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
131
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php';
132
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Symfony/contracts/Translation/TranslatorInterface.php';
133
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonTimeZone.php';
134
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Units.php';
135
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Week.php';
136
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Timestamp.php';
137
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Test.php';
138
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/ObjectInitialisation.php';
139
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Serialization.php';
140
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/IntervalRounding.php';
141
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Rounding.php';
142
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Localization.php';
143
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Options.php';
144
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Cast.php';
145
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mutability.php';
146
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Modifiers.php';
147
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mixin.php';
148
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Macro.php';
149
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Difference.php';
150
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Creator.php';
151
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Converter.php';
152
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Comparison.php';
153
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Boundaries.php';
154
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Date.php';
155
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonInterface.php';
156
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Carbon.php';
157
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php';
158
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php';
159
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php';
160
+        require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapBase.php';
161 161
 
162 162
         $ad = new SplClassLoader('LdapRecord', '../includes/libraries');
163 163
         $ad->register();
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
             echo prepareExchangedData(
173 173
                 array(
174 174
                     'error' => true,
175
-                    'message' => "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage(). "<br>".$error->getDiagnosticMessage(),
175
+                    'message' => "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage()."<br>".$error->getDiagnosticMessage(),
176 176
                 ),
177 177
                 'encode'
178 178
             );
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
             echo prepareExchangedData(
194 194
                 array(
195 195
                     'error' => true,
196
-                    'message' => "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage(). "<br>".$error->getDiagnosticMessage(),
196
+                    'message' => "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage()."<br>".$error->getDiagnosticMessage(),
197 197
                 ),
198 198
                 'encode'
199 199
             );
Please login to merge, or discard this patch.
sources/backups.queries.php 1 patch
Spacing   +32 added lines, -32 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;
@@ -103,21 +103,21 @@  discard block
 block discarded – undo
103 103
             // Prepare variables
104 104
             $post_key = filter_var($dataReceived['encryptionKey'], FILTER_SANITIZE_STRING);
105 105
 
106
-            require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
106
+            require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
107 107
             $return = '';
108 108
 
109 109
             //Get all tables
110 110
             $tables = array();
111 111
             $result = DB::query('SHOW TABLES');
112 112
             foreach ($result as $row) {
113
-                $tables[] = $row['Tables_in_' . DB_NAME];
113
+                $tables[] = $row['Tables_in_'.DB_NAME];
114 114
             }
115 115
 
116 116
             //cycle through
117 117
             foreach ($tables as $table) {
118 118
                 if (empty($pre) || substr_count($table, $pre) > 0) {
119 119
                     // Do query
120
-                    $result = DB::queryRaw('SELECT * FROM ' . $table);
120
+                    $result = DB::queryRaw('SELECT * FROM '.$table);
121 121
                     DB::queryRaw(
122 122
                         'SELECT *
123 123
                         FROM INFORMATION_SCHEMA.COLUMNS
@@ -129,19 +129,19 @@  discard block
 block discarded – undo
129 129
                     $numFields = DB::count();
130 130
 
131 131
                     // prepare a drop table
132
-                    $return .= 'DROP TABLE ' . $table . ';';
133
-                    $row2 = DB::queryfirstrow('SHOW CREATE TABLE ' . $table);
134
-                    $return .= "\n\n" . $row2['Create Table'] . ";\n\n";
132
+                    $return .= 'DROP TABLE '.$table.';';
133
+                    $row2 = DB::queryfirstrow('SHOW CREATE TABLE '.$table);
134
+                    $return .= "\n\n".$row2['Create Table'].";\n\n";
135 135
 
136 136
                     //prepare all fields and datas
137 137
                     for ($i = 0; $i < $numFields; ++$i) {
138 138
                         while ($row = $result->fetch_row()) {
139
-                            $return .= 'INSERT INTO ' . $table . ' VALUES(';
139
+                            $return .= 'INSERT INTO '.$table.' VALUES(';
140 140
                             for ($j = 0; $j < $numFields; ++$j) {
141 141
                                 $row[$j] = addslashes($row[$j]);
142 142
                                 $row[$j] = preg_replace("/\n/", '\\n', $row[$j]);
143 143
                                 if (isset($row[$j])) {
144
-                                    $return .= '"' . $row[$j] . '"';
144
+                                    $return .= '"'.$row[$j].'"';
145 145
                                 } else {
146 146
                                     $return .= 'NULL';
147 147
                                 }
@@ -161,8 +161,8 @@  discard block
 block discarded – undo
161 161
                 $token = GenerateCryptKey(20, false, true, true, false, true, $SETTINGS);
162 162
 
163 163
                 //save file
164
-                $filename = time() . '-' . $token . '.sql';
165
-                $handle = fopen($SETTINGS['path_to_files_folder'] . '/' . $filename, 'w+');
164
+                $filename = time().'-'.$token.'.sql';
165
+                $handle = fopen($SETTINGS['path_to_files_folder'].'/'.$filename, 'w+');
166 166
                 if ($handle !== false) {
167 167
                     //write file
168 168
                     fwrite($handle, $return);
@@ -174,17 +174,17 @@  discard block
 block discarded – undo
174 174
                     // Encrypt the file
175 175
                     prepareFileWithDefuse(
176 176
                         'encrypt',
177
-                        $SETTINGS['path_to_files_folder'] . '/' . $filename,
178
-                        $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
177
+                        $SETTINGS['path_to_files_folder'].'/'.$filename,
178
+                        $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
179 179
                         $SETTINGS,
180 180
                         $post_key
181 181
                     );
182 182
 
183 183
                     // Do clean
184
-                    unlink($SETTINGS['path_to_files_folder'] . '/' . $filename);
184
+                    unlink($SETTINGS['path_to_files_folder'].'/'.$filename);
185 185
                     rename(
186
-                        $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
187
-                        $SETTINGS['path_to_files_folder'] . '/' . $filename
186
+                        $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
187
+                        $SETTINGS['path_to_files_folder'].'/'.$filename
188 188
                     );
189 189
                 }
190 190
 
@@ -204,9 +204,9 @@  discard block
 block discarded – undo
204 204
                     array(
205 205
                         'error' => false,
206 206
                         'message' => '',
207
-                        'download' => 'sources/downloadFile.php?name=' . urlencode($filename) .
208
-                            '&sub=files&file=' . $filename . '&type=sql&key=' . $_SESSION['key'] . '&key_tmp=' .
209
-                            $_SESSION['key_tmp'] . '&pathIsFiles=1',
207
+                        'download' => 'sources/downloadFile.php?name='.urlencode($filename).
208
+                            '&sub=files&file='.$filename.'&type=sql&key='.$_SESSION['key'].'&key_tmp='.
209
+                            $_SESSION['key_tmp'].'&pathIsFiles=1',
210 210
                     ),
211 211
                     'encode'
212 212
                 );
@@ -252,12 +252,12 @@  discard block
 block discarded – undo
252 252
             $post_key = filter_var($dataReceived['encryptionKey'], FILTER_SANITIZE_STRING);
253 253
             $post_backupFile = filter_var($dataReceived['backupFile'], FILTER_SANITIZE_STRING);
254 254
 
255
-            include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
255
+            include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
256 256
 
257 257
             // Get filename from database
258 258
             $data = DB::queryFirstRow(
259 259
                 'SELECT valeur
260
-                FROM ' . prefixTable('misc') . '
260
+                FROM ' . prefixTable('misc').'
261 261
                 WHERE increment_id = %i',
262 262
                 $post_backupFile
263 263
             );
@@ -276,22 +276,22 @@  discard block
 block discarded – undo
276 276
                 // Decrypt the file
277 277
                 $ret = prepareFileWithDefuse(
278 278
                     'decrypt',
279
-                    $SETTINGS['path_to_files_folder'] . '/' . $post_backupFile,
280
-                    $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $post_backupFile,
279
+                    $SETTINGS['path_to_files_folder'].'/'.$post_backupFile,
280
+                    $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$post_backupFile,
281 281
                     $SETTINGS,
282 282
                     $post_key
283 283
                 );
284 284
 
285 285
                 if (empty($ret) === false) {
286
-                    echo '[{"result":"db_restore" , "message":"' . $ret . '"}]';
286
+                    echo '[{"result":"db_restore" , "message":"'.$ret.'"}]';
287 287
                     break;
288 288
                 }
289 289
 
290 290
                 // Do clean
291
-                fileDelete($SETTINGS['path_to_files_folder'] . '/' . $post_backupFile, $SETTINGS);
292
-                $post_backupFile = $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $post_backupFile;
291
+                fileDelete($SETTINGS['path_to_files_folder'].'/'.$post_backupFile, $SETTINGS);
292
+                $post_backupFile = $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$post_backupFile;
293 293
             } else {
294
-                $post_backupFile = $SETTINGS['path_to_files_folder'] . '/' . $post_backupFile;
294
+                $post_backupFile = $SETTINGS['path_to_files_folder'].'/'.$post_backupFile;
295 295
             }
296 296
 
297 297
             //read sql file
Please login to merge, or discard this patch.
sources/folders.queries.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -37,12 +37,12 @@  discard block
 block discarded – undo
37 37
 }
38 38
 
39 39
 // Do checks
40
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
41
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
40
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
41
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
42 42
 if (checkUser($_SESSION['user_id'], $_SESSION['key'], 'folders', $SETTINGS) === false) {
43 43
     // Not allowed page
44 44
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
45
-    include $SETTINGS['cpassman_dir'] . '/error.php';
45
+    include $SETTINGS['cpassman_dir'].'/error.php';
46 46
     exit();
47 47
 }
48 48
 
@@ -55,14 +55,14 @@  discard block
 block discarded – undo
55 55
     date_default_timezone_set('UTC');
56 56
 }
57 57
 
58
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
58
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
59 59
 header('Content-type: text/html; charset=utf-8');
60
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
61
-require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
62
-require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
60
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
61
+require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
62
+require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
63 63
 
64 64
 // Connect to mysql server
65
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
65
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
66 66
 if (defined('DB_PASSWD_CLEAR') === false) {
67 67
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
68 68
 }
@@ -132,14 +132,14 @@  discard block
 block discarded – undo
132 132
                     && $t->personal_folder == 0
133 133
                 ) {
134 134
                     // get $t->parent_id
135
-                    $data = DB::queryFirstRow('SELECT title FROM ' . prefixTable('nested_tree') . ' WHERE id = %i', $t->parent_id);
135
+                    $data = DB::queryFirstRow('SELECT title FROM '.prefixTable('nested_tree').' WHERE id = %i', $t->parent_id);
136 136
                     if ($t->nlevel == 1) {
137 137
                         $data['title'] = langHdl('root');
138 138
                     }
139 139
 
140 140
                     // get rights on this folder
141 141
                     $arrayRights = array();
142
-                    $rows = DB::query('SELECT fonction_id  FROM ' . prefixTable('rights') . ' WHERE authorized=%i AND tree_id = %i', 1, $t->id);
142
+                    $rows = DB::query('SELECT fonction_id  FROM '.prefixTable('rights').' WHERE authorized=%i AND tree_id = %i', 1, $t->id);
143 143
                     foreach ($rows as $record) {
144 144
                         array_push($arrayRights, $record['fonction_id']);
145 145
                     }
@@ -156,8 +156,8 @@  discard block
 block discarded – undo
156 156
                     $node_data = DB::queryFirstRow(
157 157
                         'SELECT m.valeur AS valeur, n.renewal_period AS renewal_period,
158 158
                         n.bloquer_creation AS bloquer_creation, n.bloquer_modification AS bloquer_modification
159
-                        FROM ' . prefixTable('misc') . ' AS m,
160
-                        ' . prefixTable('nested_tree') . ' AS n
159
+                        FROM ' . prefixTable('misc').' AS m,
160
+                        ' . prefixTable('nested_tree').' AS n
161 161
                         WHERE m.type=%s AND m.intitule = n.id AND m.intitule = %i',
162 162
                         'complex',
163 163
                         $t->id
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
                     //col7
191 191
                     $data7 = DB::queryFirstRow(
192 192
                         'SELECT bloquer_creation,bloquer_modification
193
-                        FROM ' . prefixTable('nested_tree') . '
193
+                        FROM ' . prefixTable('nested_tree').'
194 194
                         WHERE id = %i',
195 195
                         intval($t->id)
196 196
                     );
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
             // Get info about this folder
326 326
             $dataFolder = DB::queryfirstrow(
327 327
                 'SELECT *
328
-                FROM ' . prefixTable('nested_tree') . '
328
+                FROM ' . prefixTable('nested_tree').'
329 329
                 WHERE id = %i',
330 330
                 $post_folder_id
331 331
             );
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
             //check if parent folder is personal
362 362
             $dataParent = DB::queryfirstrow(
363 363
                 'SELECT personal_folder, bloquer_creation, bloquer_modification
364
-                FROM ' . prefixTable('nested_tree') . '
364
+                FROM ' . prefixTable('nested_tree').'
365 365
                 WHERE id = %i',
366 366
                 $post_parent_id
367 367
             );
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
                     // get complexity level for this folder
391 391
                     $data = DB::queryfirstrow(
392 392
                         'SELECT valeur
393
-                        FROM ' . prefixTable('misc') . '
393
+                        FROM ' . prefixTable('misc').'
394 394
                         WHERE intitule = %i AND type = %s',
395 395
                         $post_parent_id,
396 396
                         'complex'
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
                             array(
402 402
                                 'error' => true,
403 403
                                 'message' => langHdl('error_folder_complexity_lower_than_top_folder')
404
-                                    . ' [<b>' . TP_PW_COMPLEXITY[$data['valeur']][1] . '</b>]',
404
+                                    . ' [<b>'.TP_PW_COMPLEXITY[$data['valeur']][1].'</b>]',
405 405
                             ),
406 406
                             'encode'
407 407
                         );
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
             ) {
555 555
                 DB::query(
556 556
                     'SELECT *
557
-                    FROM ' . prefixTable('nested_tree') . '
557
+                    FROM ' . prefixTable('nested_tree').'
558 558
                     WHERE title = %s',
559 559
                     $post_title
560 560
                 );
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
             //check if parent folder is personal
575 575
             $data = DB::queryfirstrow(
576 576
                 'SELECT personal_folder, bloquer_creation, bloquer_modification
577
-                FROM ' . prefixTable('nested_tree') . '
577
+                FROM ' . prefixTable('nested_tree').'
578 578
                 WHERE id = %i',
579 579
                 $post_parent_id
580 580
             );
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
                     // get complexity level for this folder
604 604
                     $data = DB::queryfirstrow(
605 605
                         'SELECT valeur
606
-                        FROM ' . prefixTable('misc') . '
606
+                        FROM ' . prefixTable('misc').'
607 607
                         WHERE intitule = %i AND type = %s',
608 608
                         $post_parent_id,
609 609
                         'complex'
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
                             array(
614 614
                                 'error' => true,
615 615
                                 'message' => langHdl('error_folder_complexity_lower_than_top_folder')
616
-                                    . ' [<b>' . TP_PW_COMPLEXITY[$data['valeur']][1] . '</b>]',
616
+                                    . ' [<b>'.TP_PW_COMPLEXITY[$data['valeur']][1].'</b>]',
617 617
                             ),
618 618
                             'encode'
619 619
                         );
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
                     && (int) $SETTINGS['subfolder_rights_as_parent'] === 1
688 688
                 ) {
689 689
                     //If it is a subfolder, then give access to it for all roles that allows the parent folder
690
-                    $rows = DB::query('SELECT role_id, type FROM ' . prefixTable('roles_values') . ' WHERE folder_id = %i', $post_parent_id);
690
+                    $rows = DB::query('SELECT role_id, type FROM '.prefixTable('roles_values').' WHERE folder_id = %i', $post_parent_id);
691 691
                     foreach ($rows as $record) {
692 692
                         //add access to this subfolder
693 693
                         DB::insert(
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
                 }
703 703
 
704 704
                 // if parent folder has Custom Fields Categories then add to this child one too
705
-                $rows = DB::query('SELECT id_category FROM ' . prefixTable('categories_folders') . ' WHERE id_folder = %i', $post_parent_id);
705
+                $rows = DB::query('SELECT id_category FROM '.prefixTable('categories_folders').' WHERE id_folder = %i', $post_parent_id);
706 706
                 foreach ($rows as $record) {
707 707
                     //add CF Category to this subfolder
708 708
                     DB::insert(
@@ -779,17 +779,17 @@  discard block
 block discarded – undo
779 779
                                 prefixTable('misc'),
780 780
                                 array(
781 781
                                     'type' => 'folder_deleted',
782
-                                    'intitule' => 'f' . $folder->id,
783
-                                    'valeur' => $folder->id . ', ' . $folder->parent_id . ', ' .
784
-                                        $folder->title . ', ' . $folder->nleft . ', ' . $folder->nright . ', ' .
785
-                                        $folder->nlevel . ', 0, 0, 0, 0',
782
+                                    'intitule' => 'f'.$folder->id,
783
+                                    'valeur' => $folder->id.', '.$folder->parent_id.', '.
784
+                                        $folder->title.', '.$folder->nleft.', '.$folder->nright.', '.
785
+                                        $folder->nlevel.', 0, 0, 0, 0',
786 786
                                 )
787 787
                             );
788 788
                             //array for delete folder
789 789
                             $folderForDel[] = $folder->id;
790 790
 
791 791
                             //delete items & logs
792
-                            $items = DB::query('SELECT id FROM ' . prefixTable('items') . ' WHERE id_tree=%i', $folder->id);
792
+                            $items = DB::query('SELECT id FROM '.prefixTable('items').' WHERE id_tree=%i', $folder->id);
793 793
                             foreach ($items as $item) {
794 794
                                 DB::update(
795 795
                                     prefixTable('items'),
@@ -846,7 +846,7 @@  discard block
 block discarded – undo
846 846
             $tree->rebuild();
847 847
 
848 848
             // reload cache table
849
-            include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
849
+            include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
850 850
             updateCacheTable('reload', $SETTINGS, '');
851 851
 
852 852
             echo prepareExchangedData(
@@ -932,7 +932,7 @@  discard block
 block discarded – undo
932 932
                 // get complexity of current node
933 933
                 $nodeComplexity = DB::queryfirstrow(
934 934
                     'SELECT valeur
935
-                    FROM ' . prefixTable('misc') . '
935
+                    FROM ' . prefixTable('misc').'
936 936
                     WHERE intitule = %i AND type= %s',
937 937
                     $nodeInfo->id,
938 938
                     'complex'
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
                 // If it is a subfolder, then give access to it for all roles that allows the parent folder
1008 1008
                 $rows = DB::query(
1009 1009
                     'SELECT role_id, type
1010
-                    FROM ' . prefixTable('roles_values') . '
1010
+                    FROM ' . prefixTable('roles_values').'
1011 1011
                     WHERE folder_id = %i',
1012 1012
                     $parentId
1013 1013
                 );
@@ -1015,7 +1015,7 @@  discard block
 block discarded – undo
1015 1015
                     // Add access to this subfolder after checking that it is not already set
1016 1016
                     DB::query(
1017 1017
                         'SELECT *
1018
-                        FROM ' . prefixTable('roles_values') . '
1018
+                        FROM ' . prefixTable('roles_values').'
1019 1019
                         WHERE folder_id = %i AND role_id = %i',
1020 1020
                         $newFolderId,
1021 1021
                         $record['role_id']
@@ -1035,7 +1035,7 @@  discard block
 block discarded – undo
1035 1035
                 // if parent folder has Custom Fields Categories then add to this child one too
1036 1036
                 $rows = DB::query(
1037 1037
                     'SELECT id_category
1038
-                    FROM ' . prefixTable('categories_folders') . '
1038
+                    FROM ' . prefixTable('categories_folders').'
1039 1039
                     WHERE id_folder = %i',
1040 1040
                     $nodeInfo->id
1041 1041
                 );
@@ -1054,7 +1054,7 @@  discard block
 block discarded – undo
1054 1054
 
1055 1055
                 $rows = DB::query(
1056 1056
                     'SELECT *
1057
-                    FROM ' . prefixTable('items') . '
1057
+                    FROM ' . prefixTable('items').'
1058 1058
                     WHERE id_tree = %i',
1059 1059
                     $nodeInfo->id
1060 1060
                 );
@@ -1063,7 +1063,7 @@  discard block
 block discarded – undo
1063 1063
                     // if it is then don't copy it
1064 1064
                     $item_deleted = DB::queryFirstRow(
1065 1065
                         'SELECT *
1066
-                        FROM ' . prefixTable('log_items') . '
1066
+                        FROM ' . prefixTable('log_items').'
1067 1067
                         WHERE id_item = %i AND action = %s
1068 1068
                         ORDER BY date DESC
1069 1069
                         LIMIT 0, 1',
@@ -1074,7 +1074,7 @@  discard block
 block discarded – undo
1074 1074
 
1075 1075
                     $item_restored = DB::queryFirstRow(
1076 1076
                         'SELECT *
1077
-                        FROM ' . prefixTable('log_items') . '
1077
+                        FROM ' . prefixTable('log_items').'
1078 1078
                         WHERE id_item = %i AND action = %s
1079 1079
                         ORDER BY date DESC
1080 1080
                         LIMIT 0, 1',
@@ -1089,7 +1089,7 @@  discard block
 block discarded – undo
1089 1089
                         // Get the ITEM object key for the user
1090 1090
                         $userKey = DB::queryFirstRow(
1091 1091
                             'SELECT share_key
1092
-                            FROM ' . prefixTable('sharekeys_items') . '
1092
+                            FROM ' . prefixTable('sharekeys_items').'
1093 1093
                             WHERE user_id = %i AND object_id = %i',
1094 1094
                             $_SESSION['user_id'],
1095 1095
                             $record['id']
@@ -1163,7 +1163,7 @@  discard block
 block discarded – undo
1163 1163
                         // Manage Custom Fields
1164 1164
                         $categories = DB::query(
1165 1165
                             'SELECT *
1166
-                            FROM ' . prefixTable('categories_items') . '
1166
+                            FROM ' . prefixTable('categories_items').'
1167 1167
                             WHERE item_id = %i',
1168 1168
                             $record['id']
1169 1169
                         );
@@ -1211,15 +1211,15 @@  discard block
 block discarded – undo
1211 1211
                         $files = DB::query(
1212 1212
                             'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status, f.extension AS extension,
1213 1213
                             f.size AS size, f.type AS type, s.share_key AS share_key
1214
-                            FROM ' . prefixTable('files') . ' AS f
1215
-                            INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id)
1214
+                            FROM ' . prefixTable('files').' AS f
1215
+                            INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id)
1216 1216
                             WHERE s.user_id = %i AND f.id_item = %i',
1217 1217
                             $_SESSION['user_id'],
1218 1218
                             $record['id']
1219 1219
                         );
1220 1220
                         foreach ($files as $file) {
1221 1221
                             // Check if file still exists
1222
-                            if (file_exists($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . TP_FILE_PREFIX . base64_decode($file['file'])) === true) {
1222
+                            if (file_exists($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.TP_FILE_PREFIX.base64_decode($file['file'])) === true) {
1223 1223
                                 // Step1 - decrypt the file
1224 1224
                                 $fileContent = decryptFile(
1225 1225
                                     $file['file'],
@@ -1228,9 +1228,9 @@  discard block
 block discarded – undo
1228 1228
                                 );
1229 1229
 
1230 1230
                                 // Step2 - create file
1231
-                                $newFileName = md5(time() . '_' . $file['id']) . '.' . $file['extension'];
1231
+                                $newFileName = md5(time().'_'.$file['id']).'.'.$file['extension'];
1232 1232
 
1233
-                                $outstream = fopen($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . $newFileName, 'ab');
1233
+                                $outstream = fopen($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.$newFileName, 'ab');
1234 1234
                                 if ($outstream === false) {
1235 1235
                                     echo prepareExchangedData(
1236 1236
                                         array(
@@ -1305,7 +1305,7 @@  discard block
 block discarded – undo
1305 1305
             $tree->rebuild();
1306 1306
 
1307 1307
             // reload cache table
1308
-            include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1308
+            include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1309 1309
             updateCacheTable('reload', $SETTINGS, '');
1310 1310
 
1311 1311
             $data = array(
@@ -1367,7 +1367,7 @@  discard block
 block discarded – undo
1367 1367
                     // Get path
1368 1368
                     $text = '';
1369 1369
                     foreach ($tree->getPath($folder->id, false) as $fld) {
1370
-                        $text .= empty($text) === true ? '     [<i>' . $fld->title : ' > ' . $fld->title;
1370
+                        $text .= empty($text) === true ? '     [<i>'.$fld->title : ' > '.$fld->title;
1371 1371
                     }
1372 1372
 
1373 1373
                     // Save array
@@ -1377,7 +1377,7 @@  discard block
 block discarded – undo
1377 1377
                             'id' => (int) $folder->id,
1378 1378
                             'label' => $folder->title,
1379 1379
                             'level' => $folder->nlevel,
1380
-                            'path' => empty($text) === true ? '' : $text . '</i>]'
1380
+                            'path' => empty($text) === true ? '' : $text.'</i>]'
1381 1381
                         )
1382 1382
                     );
1383 1383
                 }
Please login to merge, or discard this patch.
sources/admin.queries.php 1 patch
Spacing   +189 added lines, -189 removed lines patch added patch discarded remove patch
@@ -46,25 +46,25 @@  discard block
 block discarded – undo
46 46
 }
47 47
 
48 48
 /* do checks */
49
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
50
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
49
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
50
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
51 51
 if (!checkUser($_SESSION['user_id'], $_SESSION['key'], 'options', $SETTINGS)) {
52 52
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
53
-    include $SETTINGS['cpassman_dir'] . '/error.php';
53
+    include $SETTINGS['cpassman_dir'].'/error.php';
54 54
     exit;
55 55
 }
56 56
 
57
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
58
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
59
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php';
57
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
58
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
59
+require_once $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php';
60 60
 
61 61
 header('Content-type: text/html; charset=utf-8');
62 62
 header('Cache-Control: no-cache, no-store, must-revalidate');
63 63
 
64
-require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
64
+require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
65 65
 
66 66
 // connect to the server
67
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
67
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
68 68
 if (defined('DB_PASSWD_CLEAR') === false) {
69 69
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
70 70
 }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
                         array(
118 118
                             'http' => array(
119 119
                                 'ignore_errors' => true,
120
-                                'proxy' => $SETTINGS['proxy_ip'] . ':' . $SETTINGS['proxy_port'],
120
+                                'proxy' => $SETTINGS['proxy_ip'].':'.$SETTINGS['proxy_port'],
121 121
                             ),
122 122
                         )
123 123
                     );
@@ -136,16 +136,16 @@  discard block
 block discarded – undo
136 136
                     $json_array = json_decode($json, true);
137 137
 
138 138
                     // About version
139
-                    $text .= '<li><u>' . $LANG['your_version'] . '</u> : ' . TP_VERSION_FULL;
139
+                    $text .= '<li><u>'.$LANG['your_version'].'</u> : '.TP_VERSION_FULL;
140 140
                     if (floatval(TP_VERSION_FULL) < floatval($json_array['info']['version'])) {
141
-                        $text .= '&nbsp;&nbsp;<b>' . $LANG['please_update'] . '</b>';
141
+                        $text .= '&nbsp;&nbsp;<b>'.$LANG['please_update'].'</b>';
142 142
                     }
143 143
                     $text .= '</li>';
144 144
 
145 145
                     // Libraries
146 146
                     $text .= '<li><u>Libraries</u> :</li>';
147 147
                     foreach ($json_array['libraries'] as $key => $val) {
148
-                        $text .= "<li>&nbsp;<span class='fa fa-caret-right'></span>&nbsp;" . $key . " (<a href='" . $val . "' target='_blank'>" . $val . '</a>)</li>';
148
+                        $text .= "<li>&nbsp;<span class='fa fa-caret-right'></span>&nbsp;".$key." (<a href='".$val."' target='_blank'>".$val.'</a>)</li>';
149 149
                     }
150 150
                 }
151 151
             } else {
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
         }
157 157
         $text .= '</ul>';
158 158
 
159
-        echo '[{"error":"' . $error . '" , "output":"' . str_replace(array("\n", "\t", "\r"), '', $text) . '"}]';
159
+        echo '[{"error":"'.$error.'" , "output":"'.str_replace(array("\n", "\t", "\r"), '', $text).'"}]';
160 160
         break;
161 161
 
162 162
         //##########################################################
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
         //get through all users
189 189
         $rows = DB::query(
190 190
             'SELECT id, login, email
191
-            FROM ' . prefixTable('users') . '
191
+            FROM ' . prefixTable('users').'
192 192
             ORDER BY login ASC'
193 193
         );
194 194
         foreach ($rows as $record) {
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
             //if folder doesn't exist then create it
206 206
             $data = DB::queryfirstrow(
207 207
                 'SELECT id
208
-                FROM ' . prefixTable('nested_tree') . '
208
+                FROM ' . prefixTable('nested_tree').'
209 209
                 WHERE title = %s AND parent_id = %i',
210 210
                 $record['id'],
211 211
                 0
@@ -267,8 +267,8 @@  discard block
 block discarded – undo
267 267
         echo prepareExchangedData(
268 268
             array(
269 269
                 'error' => false,
270
-                'message' => langHdl('last_execution') . ' ' .
271
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], time()) .
270
+                'message' => langHdl('last_execution').' '.
271
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], time()).
272 272
                     '<i class="fas fa-check text-success ml-2"></i>',
273 273
             ),
274 274
             'encode'
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
         }
303 303
 
304 304
         //Libraries call
305
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
305
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
306 306
 
307 307
         //init
308 308
         $foldersIds = array();
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
             }
317 317
         }
318 318
 
319
-        $items = DB::query('SELECT id,label FROM ' . prefixTable('items') . ' WHERE id_tree NOT IN %li', $foldersIds);
319
+        $items = DB::query('SELECT id,label FROM '.prefixTable('items').' WHERE id_tree NOT IN %li', $foldersIds);
320 320
         foreach ($items as $item) {
321 321
             //Delete item
322 322
             DB::DELETE(prefixTable('items'), 'id = %i', $item['id']);
@@ -337,12 +337,12 @@  discard block
 block discarded – undo
337 337
         // delete orphan items
338 338
         $rows = DB::query(
339 339
             'SELECT id
340
-            FROM ' . prefixTable('items') . '
340
+            FROM ' . prefixTable('items').'
341 341
             ORDER BY id ASC'
342 342
         );
343 343
         foreach ($rows as $item) {
344 344
             DB::query(
345
-                'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i AND action = %s',
345
+                'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i AND action = %s',
346 346
                 $item['id'],
347 347
                 'at_creation'
348 348
             );
@@ -372,11 +372,11 @@  discard block
 block discarded – undo
372 372
         echo prepareExchangedData(
373 373
             array(
374 374
                 'error' => false,
375
-                'message' => langHdl('last_execution') . ' ' .
376
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], time()) .
375
+                'message' => langHdl('last_execution').' '.
376
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], time()).
377 377
                     '<i class="fas fa-check text-success ml-2 mr-3"></i>
378 378
                     <i class="fas fa-chevron-right mr-2"></i>' .
379
-                    $nbItemsDeleted . ' ' . langHdl('deleted_items'),
379
+                    $nbItemsDeleted.' '.langHdl('deleted_items'),
380 380
             ),
381 381
             'encode'
382 382
         );
@@ -408,21 +408,21 @@  discard block
 block discarded – undo
408 408
             break;
409 409
         }
410 410
 
411
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
411
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
412 412
         $return = '';
413 413
 
414 414
         //Get all tables
415 415
         $tables = array();
416 416
         $result = DB::query('SHOW TABLES');
417 417
         foreach ($result as $row) {
418
-            $tables[] = $row['Tables_in_' . $database];
418
+            $tables[] = $row['Tables_in_'.$database];
419 419
         }
420 420
 
421 421
         //cycle through
422 422
         foreach ($tables as $table) {
423 423
             if (defined('DB_PREFIX') || substr_count($table, DB_PREFIX) > 0) {
424 424
                 // Do query
425
-                $result = DB::queryRaw('SELECT * FROM ' . $table);
425
+                $result = DB::queryRaw('SELECT * FROM '.$table);
426 426
                 DB::queryRaw(
427 427
                     'SELECT *
428 428
                     FROM INFORMATION_SCHEMA.COLUMNS
@@ -434,19 +434,19 @@  discard block
 block discarded – undo
434 434
                 $numFields = DB::count();
435 435
 
436 436
                 // prepare a drop table
437
-                $return .= 'DROP TABLE ' . $table . ';';
438
-                $row2 = DB::queryfirstrow('SHOW CREATE TABLE ' . $table);
439
-                $return .= "\n\n" . $row2['Create Table'] . ";\n\n";
437
+                $return .= 'DROP TABLE '.$table.';';
438
+                $row2 = DB::queryfirstrow('SHOW CREATE TABLE '.$table);
439
+                $return .= "\n\n".$row2['Create Table'].";\n\n";
440 440
 
441 441
                 //prepare all fields and datas
442 442
                 for ($i = 0; $i < $numFields; ++$i) {
443 443
                     while ($row = $result->fetch_row()) {
444
-                        $return .= 'INSERT INTO ' . $table . ' VALUES(';
444
+                        $return .= 'INSERT INTO '.$table.' VALUES(';
445 445
                         for ($j = 0; $j < $numFields; ++$j) {
446 446
                             $row[$j] = addslashes($row[$j]);
447 447
                             $row[$j] = preg_replace("/\n/", '\\n', $row[$j]);
448 448
                             if (isset($row[$j])) {
449
-                                $return .= '"' . $row[$j] . '"';
449
+                                $return .= '"'.$row[$j].'"';
450 450
                             } else {
451 451
                                 $return .= 'NULL';
452 452
                             }
@@ -466,8 +466,8 @@  discard block
 block discarded – undo
466 466
             $token = GenerateCryptKey(20, false, true, true, false, true, $SETTINGS);
467 467
 
468 468
             //save file
469
-            $filename = time() . '-' . $token . '.sql';
470
-            $handle = fopen($SETTINGS['path_to_files_folder'] . '/' . $filename, 'w+');
469
+            $filename = time().'-'.$token.'.sql';
470
+            $handle = fopen($SETTINGS['path_to_files_folder'].'/'.$filename, 'w+');
471 471
             if ($handle !== false) {
472 472
                 //write file
473 473
                 fwrite($handle, $return);
@@ -479,17 +479,17 @@  discard block
 block discarded – undo
479 479
                 // Encrypt the file
480 480
                 prepareFileWithDefuse(
481 481
                     'encrypt',
482
-                    $SETTINGS['path_to_files_folder'] . '/' . $filename,
483
-                    $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
482
+                    $SETTINGS['path_to_files_folder'].'/'.$filename,
483
+                    $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
484 484
                     $SETTINGS,
485 485
                     $post_option
486 486
                 );
487 487
 
488 488
                 // Do clean
489
-                unlink($SETTINGS['path_to_files_folder'] . '/' . $filename);
489
+                unlink($SETTINGS['path_to_files_folder'].'/'.$filename);
490 490
                 rename(
491
-                    $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
492
-                    $SETTINGS['path_to_files_folder'] . '/' . $filename
491
+                    $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
492
+                    $SETTINGS['path_to_files_folder'].'/'.$filename
493 493
                 );
494 494
             }
495 495
 
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
             //update LOG
500 500
             logEvents($SETTINGS, 'admin_action', 'dataBase backup', $_SESSION['user_id'], $_SESSION['login']);
501 501
 
502
-            echo '[{"result":"db_backup" , "href":"sources/downloadFile.php?name=' . urlencode($filename) . '&sub=files&file=' . $filename . '&type=sql&key=' . $_SESSION['key'] . '&key_tmp=' . $_SESSION['key_tmp'] . '&pathIsFiles=1"}]';
502
+            echo '[{"result":"db_backup" , "href":"sources/downloadFile.php?name='.urlencode($filename).'&sub=files&file='.$filename.'&type=sql&key='.$_SESSION['key'].'&key_tmp='.$_SESSION['key_tmp'].'&pathIsFiles=1"}]';
503 503
         }
504 504
         break;
505 505
 
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
             );
529 529
             break;
530 530
         }
531
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
531
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
532 532
 
533 533
         $dataPost = explode('&', $post_option);
534 534
         $file = htmlspecialchars($dataPost[0]);
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
         // Get filename from database
538 538
         $data = DB::queryFirstRow(
539 539
             'SELECT valeur
540
-            FROM ' . prefixTable('misc') . '
540
+            FROM ' . prefixTable('misc').'
541 541
             WHERE increment_id = %i',
542 542
             $file
543 543
         );
@@ -556,22 +556,22 @@  discard block
 block discarded – undo
556 556
             // Decrypt the file
557 557
             $ret = prepareFileWithDefuse(
558 558
                 'decrypt',
559
-                $SETTINGS['path_to_files_folder'] . '/' . $file,
560
-                $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $file,
559
+                $SETTINGS['path_to_files_folder'].'/'.$file,
560
+                $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$file,
561 561
                 $SETTINGS,
562 562
                 $key
563 563
             );
564 564
 
565 565
             if (empty($ret) === false) {
566
-                echo '[{"result":"db_restore" , "message":"' . $ret . '"}]';
566
+                echo '[{"result":"db_restore" , "message":"'.$ret.'"}]';
567 567
                 break;
568 568
             }
569 569
 
570 570
             // Do clean
571
-            fileDelete($SETTINGS['path_to_files_folder'] . '/' . $file, $SETTINGS);
572
-            $file = $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $file;
571
+            fileDelete($SETTINGS['path_to_files_folder'].'/'.$file, $SETTINGS);
572
+            $file = $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$file;
573 573
         } else {
574
-            $file = $SETTINGS['path_to_files_folder'] . '/' . $file;
574
+            $file = $SETTINGS['path_to_files_folder'].'/'.$file;
575 575
         }
576 576
 
577 577
         //read sql file
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
         fclose($handle);
589 589
 
590 590
         //delete file
591
-        unlink($SETTINGS['path_to_files_folder'] . '/' . $file);
591
+        unlink($SETTINGS['path_to_files_folder'].'/'.$file);
592 592
 
593 593
         //Show done
594 594
         echo '[{"result":"db_restore" , "message":""}]';
@@ -626,8 +626,8 @@  discard block
 block discarded – undo
626 626
             foreach ($table as $i => $tablename) {
627 627
                 if (substr_count($tablename, DB_PREFIX) > 0) {
628 628
                     // launch optimization quieries
629
-                    DB::query('ANALYZE TABLE `' . $tablename . '`');
630
-                    DB::query('OPTIMIZE TABLE `' . $tablename . '`');
629
+                    DB::query('ANALYZE TABLE `'.$tablename.'`');
630
+                    DB::query('OPTIMIZE TABLE `'.$tablename.'`');
631 631
                 }
632 632
             }
633 633
         }
@@ -635,12 +635,12 @@  discard block
 block discarded – undo
635 635
         //Clean up LOG_ITEMS table
636 636
         $rows = DB::query(
637 637
             'SELECT id
638
-            FROM ' . prefixTable('items') . '
638
+            FROM ' . prefixTable('items').'
639 639
             ORDER BY id ASC'
640 640
         );
641 641
         foreach ($rows as $item) {
642 642
             DB::query(
643
-                'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i AND action = %s',
643
+                'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i AND action = %s',
644 644
                 $item['id'],
645 645
                 'at_creation'
646 646
             );
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
             if ($counter === 0) {
649 649
                 //Create new at_creation entry
650 650
                 $rowTmp = DB::queryFirstRow(
651
-                    'SELECT date, id_user FROM ' . prefixTable('log_items') . ' WHERE id_item=%i ORDER BY date ASC',
651
+                    'SELECT date, id_user FROM '.prefixTable('log_items').' WHERE id_item=%i ORDER BY date ASC',
652 652
                     $item['id']
653 653
                 );
654 654
                 DB::insert(
@@ -678,8 +678,8 @@  discard block
 block discarded – undo
678 678
         echo prepareExchangedData(
679 679
             array(
680 680
                 'error' => false,
681
-                'message' => langHdl('last_execution') . ' ' .
682
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], time()) .
681
+                'message' => langHdl('last_execution').' '.
682
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], time()).
683 683
                     '<i class="fas fa-check text-success ml-2"></i>',
684 684
             ),
685 685
             'encode'
@@ -712,14 +712,14 @@  discard block
 block discarded – undo
712 712
             break;
713 713
         }
714 714
 
715
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
715
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
716 716
 
717 717
         //read folder
718 718
         if (is_dir($SETTINGS['path_to_files_folder']) === false) {
719 719
             echo prepareExchangedData(
720 720
                 array(
721 721
                     'error' => true,
722
-                    'message' => langHdl('file_folder_not_accessible') . ": " . $SETTINGS['path_to_files_folder'],
722
+                    'message' => langHdl('file_folder_not_accessible').": ".$SETTINGS['path_to_files_folder'],
723 723
                 ),
724 724
                 'encode'
725 725
             );
@@ -731,8 +731,8 @@  discard block
 block discarded – undo
731 731
             //delete file FILES
732 732
             while (false !== ($f = readdir($dir))) {
733 733
                 if ($f !== '.' && $f !== '..' && $f !== '.htaccess') {
734
-                    if (file_exists($dir . $f) && ((time() - filectime($dir . $f)) > 604800)) {
735
-                        fileDelete($dir . '/' . $f, $SETTINGS);
734
+                    if (file_exists($dir.$f) && ((time() - filectime($dir.$f)) > 604800)) {
735
+                        fileDelete($dir.'/'.$f, $SETTINGS);
736 736
                     }
737 737
                 }
738 738
             }
@@ -746,7 +746,7 @@  discard block
 block discarded – undo
746 746
             echo prepareExchangedData(
747 747
                 array(
748 748
                     'error' => true,
749
-                    'message' => langHdl('file_folder_not_accessible') . ": " . $SETTINGS['path_to_upload_folder'],
749
+                    'message' => langHdl('file_folder_not_accessible').": ".$SETTINGS['path_to_upload_folder'],
750 750
                 ),
751 751
                 'encode'
752 752
             );
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
             while (false !== ($f = readdir($dir))) {
761 761
                 if ($f !== '.' && $f !== '..') {
762 762
                     if (strpos($f, '_delete.') > 0) {
763
-                        fileDelete($SETTINGS['path_to_upload_folder'] . '/' . $f, $SETTINGS);
763
+                        fileDelete($SETTINGS['path_to_upload_folder'].'/'.$f, $SETTINGS);
764 764
                     }
765 765
                 }
766 766
             }
@@ -782,11 +782,11 @@  discard block
 block discarded – undo
782 782
         echo prepareExchangedData(
783 783
             array(
784 784
                 'error' => false,
785
-                'message' => langHdl('last_execution') . ' ' .
786
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], time()) .
785
+                'message' => langHdl('last_execution').' '.
786
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], time()).
787 787
                     '<i class="fas fa-check text-success ml-2 mr-3"></i>
788 788
                     <i class="fas fa-chevron-right mr-2"></i>' .
789
-                    $nbItemsDeleted . ' ' . langHdl('deleted_items'),
789
+                    $nbItemsDeleted.' '.langHdl('deleted_items'),
790 790
             ),
791 791
             'encode'
792 792
         );
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
             break;
820 820
         }
821 821
 
822
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
822
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
823 823
         updateCacheTable('reload', $SETTINGS, '');
824 824
 
825 825
         // Log
@@ -835,8 +835,8 @@  discard block
 block discarded – undo
835 835
         echo prepareExchangedData(
836 836
             [
837 837
                 'error' => false,
838
-                'message' => langHdl('last_execution') . ' ' .
839
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], time()) .
838
+                'message' => langHdl('last_execution').' '.
839
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], time()).
840 840
                     '<i class="fas fa-check text-success mr-2"></i>',
841 841
             ],
842 842
             'encode'
@@ -871,7 +871,7 @@  discard block
 block discarded – undo
871 871
         }
872 872
 
873 873
         // Perform
874
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
874
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
875 875
         $ret = handleConfigFile('rebuild', $SETTINGS);
876 876
 
877 877
         // Log
@@ -898,8 +898,8 @@  discard block
 block discarded – undo
898 898
         echo prepareExchangedData(
899 899
             array(
900 900
                 'error' => false,
901
-                'message' => langHdl('last_execution') . ' ' .
902
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], time()) .
901
+                'message' => langHdl('last_execution').' '.
902
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], time()).
903 903
                     '<i class="fas fa-check text-success ml-2"></i>',
904 904
             ),
905 905
             'encode'
@@ -939,33 +939,33 @@  discard block
 block discarded – undo
939 939
         $filename = $post_option;
940 940
         $tp_settings = [];
941 941
         //get backups infos
942
-        $rows = DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s', 'admin');
942
+        $rows = DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s', 'admin');
943 943
         foreach ($rows as $record) {
944 944
             $tp_settings[$record['intitule']] = $record['valeur'];
945 945
         }
946 946
 
947 947
         // check if backup file is in DB.
948 948
         // If YES then it is encrypted with DEFUSE
949
-        $bck = DB::queryFirstRow('SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'backup', 'filename');
949
+        $bck = DB::queryFirstRow('SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'backup', 'filename');
950 950
 
951 951
         //read file
952 952
         $return = '';
953
-        $Fnm = $tp_settings['bck_script_path'] . '/' . $filename . '.sql';
953
+        $Fnm = $tp_settings['bck_script_path'].'/'.$filename.'.sql';
954 954
         if (file_exists($Fnm)) {
955 955
             if (!empty($bck) && $bck['valeur'] === $filename) {
956 956
                 $err = '';
957 957
 
958 958
                 // it means that file is DEFUSE encrypted
959
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Crypto.php';
960
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/DerivedKeys.php';
961
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/KeyOrPassword.php';
962
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/File.php';
963
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Core.php';
959
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Crypto.php';
960
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/DerivedKeys.php';
961
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/KeyOrPassword.php';
962
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/File.php';
963
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Core.php';
964 964
 
965 965
                 try {
966 966
                     \Defuse\Crypto\File::decryptFileWithPassword(
967
-                        $SETTINGS['bck_script_path'] . '/' . $post_option . '.sql',
968
-                        $SETTINGS['bck_script_path'] . '/' . str_replace('encrypted', 'clear', $filename) . '.sql',
967
+                        $SETTINGS['bck_script_path'].'/'.$post_option.'.sql',
968
+                        $SETTINGS['bck_script_path'].'/'.str_replace('encrypted', 'clear', $filename).'.sql',
969 969
                         base64_decode($SETTINGS['bck_script_key'])
970 970
                     );
971 971
                 } catch (Defuse\Crypto\Exception\WrongKeyOrModifiedCiphertextException $ex) {
@@ -973,7 +973,7 @@  discard block
 block discarded – undo
973 973
                 }
974 974
 
975 975
                 if (!empty($err)) {
976
-                    echo '[{ "result":"backup_decrypt_fails" , "msg":"' . $err . '"}]';
976
+                    echo '[{ "result":"backup_decrypt_fails" , "msg":"'.$err.'"}]';
977 977
                     break;
978 978
                 }
979 979
             } else {
@@ -995,19 +995,19 @@  discard block
 block discarded – undo
995 995
                 );
996 996
 
997 997
                 //save the file
998
-                $handle = fopen($tp_settings['bck_script_path'] . '/' . $filename . '.clear.sql', 'w+');
998
+                $handle = fopen($tp_settings['bck_script_path'].'/'.$filename.'.clear.sql', 'w+');
999 999
                 if ($handle !== false) {
1000 1000
                     fwrite($handle, $return);
1001 1001
                     fclose($handle);
1002 1002
                 }
1003 1003
             }
1004 1004
             $result = 'backup_decrypt_success';
1005
-            $msg = $tp_settings['bck_script_path'] . '/' . $filename . '.clear.sql';
1005
+            $msg = $tp_settings['bck_script_path'].'/'.$filename.'.clear.sql';
1006 1006
         } else {
1007 1007
             $result = 'backup_decrypt_fails';
1008
-            $msg = 'File not found: ' . $Fnm;
1008
+            $msg = 'File not found: '.$Fnm;
1009 1009
         }
1010
-        echo '[{ "result":"' . $result . '" , "msg":"' . $msg . '"}]';
1010
+        echo '[{ "result":"'.$result.'" , "msg":"'.$msg.'"}]';
1011 1011
         break;
1012 1012
 
1013 1013
         /*
@@ -1041,22 +1041,22 @@  discard block
 block discarded – undo
1041 1041
         require_once 'main.functions.php';
1042 1042
 
1043 1043
         // store old sk
1044
-        $_SESSION['reencrypt_old_salt'] = file_get_contents(SECUREPATH . '/teampass-seckey.txt');
1044
+        $_SESSION['reencrypt_old_salt'] = file_get_contents(SECUREPATH.'/teampass-seckey.txt');
1045 1045
 
1046 1046
         // generate new saltkey
1047
-        $old_sk_filename = SECUREPATH . '/teampass-seckey.txt.' . date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))) . '.' . time();
1047
+        $old_sk_filename = SECUREPATH.'/teampass-seckey.txt.'.date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))).'.'.time();
1048 1048
         copy(
1049
-            SECUREPATH . '/teampass-seckey.txt',
1049
+            SECUREPATH.'/teampass-seckey.txt',
1050 1050
             $old_sk_filename
1051 1051
         );
1052 1052
         $new_key = defuse_generate_key();
1053 1053
         file_put_contents(
1054
-            SECUREPATH . '/teampass-seckey.txt',
1054
+            SECUREPATH.'/teampass-seckey.txt',
1055 1055
             $new_key
1056 1056
         );
1057 1057
 
1058 1058
         // store new sk
1059
-        $_SESSION['reencrypt_new_salt'] = file_get_contents(SECUREPATH . '/teampass-seckey.txt');
1059
+        $_SESSION['reencrypt_new_salt'] = file_get_contents(SECUREPATH.'/teampass-seckey.txt');
1060 1060
 
1061 1061
         //put tool in maintenance.
1062 1062
         DB::update(
@@ -1072,13 +1072,13 @@  discard block
 block discarded – undo
1072 1072
         logEvents($SETTINGS, 'system', 'change_salt_key', $_SESSION['user_id'], $_SESSION['login']);
1073 1073
 
1074 1074
         // get number of items to change
1075
-        DB::query('SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i', 0);
1075
+        DB::query('SELECT id FROM '.prefixTable('items').' WHERE perso = %i', 0);
1076 1076
         $nb_of_items = DB::count();
1077 1077
 
1078 1078
         // create backup table
1079
-        DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
1079
+        DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup'));
1080 1080
         DB::query(
1081
-            'CREATE TABLE `' . prefixTable('sk_reencrypt_backup') . '` (
1081
+            'CREATE TABLE `'.prefixTable('sk_reencrypt_backup').'` (
1082 1082
             `id` int(12) NOT null AUTO_INCREMENT,
1083 1083
             `current_table` varchar(100) NOT NULL,
1084 1084
             `current_field` varchar(500) NOT NULL,
@@ -1106,7 +1106,7 @@  discard block
 block discarded – undo
1106 1106
         );
1107 1107
 
1108 1108
         // delete previous backup files
1109
-        $files = glob($SETTINGS['path_to_upload_folder'] . '/*'); // get all file names
1109
+        $files = glob($SETTINGS['path_to_upload_folder'].'/*'); // get all file names
1110 1110
         foreach ($files as $file) { // iterate files
1111 1111
             if (is_file($file)) {
1112 1112
                 $file_parts = pathinfo($file);
@@ -1188,7 +1188,7 @@  discard block
 block discarded – undo
1188 1188
                 echo prepareExchangedData(
1189 1189
                     array(
1190 1190
                         'error' => true,
1191
-                        'message' => 'Input `' . $objects[0] . '` is not allowed',
1191
+                        'message' => 'Input `'.$objects[0].'` is not allowed',
1192 1192
                         'nbOfItems' => '',
1193 1193
                         'nextAction' => '',
1194 1194
                     ),
@@ -1201,9 +1201,9 @@  discard block
 block discarded – undo
1201 1201
                 //change all encrypted data in Items (passwords)
1202 1202
                 $rows = DB::query(
1203 1203
                     'SELECT id, pw, pw_iv
1204
-                    FROM ' . prefixTable('items') . '
1204
+                    FROM ' . prefixTable('items').'
1205 1205
                     WHERE perso = %s
1206
-                    LIMIT ' . $post_start . ', ' . $post_length,
1206
+                    LIMIT ' . $post_start.', '.$post_length,
1207 1207
                     '0'
1208 1208
                 );
1209 1209
                 foreach ($rows as $record) {
@@ -1215,7 +1215,7 @@  discard block
 block discarded – undo
1215 1215
                             'current_field' => 'pw',
1216 1216
                             'value_id' => $record['id'],
1217 1217
                             'value' => $record['pw'],
1218
-                            'current_sql' => 'UPDATE ' . prefixTable('items') . " SET pw = '" . $record['pw'] . "' WHERE id = '" . $record['id'] . "';",
1218
+                            'current_sql' => 'UPDATE '.prefixTable('items')." SET pw = '".$record['pw']."' WHERE id = '".$record['id']."';",
1219 1219
                             'value2' => 'none',
1220 1220
                             'result' => 'none',
1221 1221
                         )
@@ -1264,9 +1264,9 @@  discard block
 block discarded – undo
1264 1264
                 //change all encrypted data in Logs (passwords)
1265 1265
                 $rows = DB::query(
1266 1266
                     'SELECT raison, increment_id
1267
-                    FROM ' . prefixTable('log_items') . "
1267
+                    FROM ' . prefixTable('log_items')."
1268 1268
                     WHERE action = %s AND raison LIKE 'at_pw :%'
1269
-                    LIMIT " . $post_start . ', ' . $post_length,
1269
+                    LIMIT " . $post_start.', '.$post_length,
1270 1270
                     'at_modification'
1271 1271
                 );
1272 1272
                 foreach ($rows as $record) {
@@ -1278,7 +1278,7 @@  discard block
 block discarded – undo
1278 1278
                             'current_field' => 'raison',
1279 1279
                             'value_id' => $record['increment_id'],
1280 1280
                             'value' => $record['raison'],
1281
-                            'current_sql' => 'UPDATE ' . prefixTable('log_items') . " SET raison = '" . $record['raison'] . "' WHERE increment_id = '" . $record['increment_id'] . "';",
1281
+                            'current_sql' => 'UPDATE '.prefixTable('log_items')." SET raison = '".$record['raison']."' WHERE increment_id = '".$record['increment_id']."';",
1282 1282
                             'value2' => 'none',
1283 1283
                             'result' => 'none',
1284 1284
                         )
@@ -1306,7 +1306,7 @@  discard block
 block discarded – undo
1306 1306
                         DB::update(
1307 1307
                             prefixTable('log_items'),
1308 1308
                             array(
1309
-                                'raison' => 'at_pw :' . $encrypt['string'],
1309
+                                'raison' => 'at_pw :'.$encrypt['string'],
1310 1310
                                 'encryption_type' => 'defuse',
1311 1311
                             ),
1312 1312
                             'increment_id = %i',
@@ -1331,8 +1331,8 @@  discard block
 block discarded – undo
1331 1331
                 //change all encrypted data in CATEGORIES (passwords)
1332 1332
                 $rows = DB::query(
1333 1333
                     'SELECT id, data
1334
-                    FROM ' . prefixTable('categories_items') . '
1335
-                    LIMIT ' . $post_start . ', ' . $post_length
1334
+                    FROM ' . prefixTable('categories_items').'
1335
+                    LIMIT ' . $post_start.', '.$post_length
1336 1336
                 );
1337 1337
                 foreach ($rows as $record) {
1338 1338
                     // backup data
@@ -1343,7 +1343,7 @@  discard block
 block discarded – undo
1343 1343
                             'current_field' => 'data',
1344 1344
                             'value_id' => $record['id'],
1345 1345
                             'value' => $record['data'],
1346
-                            'current_sql' => 'UPDATE ' . prefixTable('categories_items') . " SET data = '" . $record['data'] . "' WHERE id = '" . $record['id'] . "';",
1346
+                            'current_sql' => 'UPDATE '.prefixTable('categories_items')." SET data = '".$record['data']."' WHERE id = '".$record['id']."';",
1347 1347
                             'value2' => 'none',
1348 1348
                             'result' => 'none',
1349 1349
                         )
@@ -1391,9 +1391,9 @@  discard block
 block discarded – undo
1391 1391
                 // Change all encrypted data in FILES (passwords)
1392 1392
                 $rows = DB::query(
1393 1393
                     'SELECT id, file, status
1394
-                    FROM ' . prefixTable('files') . "
1394
+                    FROM ' . prefixTable('files')."
1395 1395
                     WHERE status = 'encrypted'
1396
-                    LIMIT " . $post_start . ', ' . $post_length
1396
+                    LIMIT " . $post_start.', '.$post_length
1397 1397
                 );
1398 1398
                 foreach ($rows as $record) {
1399 1399
                     // backup data
@@ -1411,20 +1411,20 @@  discard block
 block discarded – undo
1411 1411
                     );
1412 1412
                     $newID = DB::insertId();
1413 1413
 
1414
-                    if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['file'])) {
1414
+                    if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['file'])) {
1415 1415
                         // make a copy of file
1416 1416
                         if (!copy(
1417
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
1418
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '.copy'
1417
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
1418
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'.copy'
1419 1419
                         )) {
1420 1420
                             $error = 'Copy not possible';
1421 1421
                             exit;
1422 1422
                         } else {
1423 1423
                             // prepare a bck of file (that will not be deleted)
1424
-                            $backup_filename = $record['file'] . '.bck-change-sk.' . time();
1424
+                            $backup_filename = $record['file'].'.bck-change-sk.'.time();
1425 1425
                             copy(
1426
-                                $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
1427
-                                $SETTINGS['path_to_upload_folder'] . '/' . $backup_filename
1426
+                                $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
1427
+                                $SETTINGS['path_to_upload_folder'].'/'.$backup_filename
1428 1428
                             );
1429 1429
                         }
1430 1430
 
@@ -1432,24 +1432,24 @@  discard block
 block discarded – undo
1432 1432
                         // STEP1 - Do decryption
1433 1433
                         prepareFileWithDefuse(
1434 1434
                             'decrypt',
1435
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
1436
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted',
1435
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
1436
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted',
1437 1437
                             $SETTINGS
1438 1438
                         );
1439 1439
 
1440 1440
                         // Do cleanup of files
1441
-                        unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['file']);
1441
+                        unlink($SETTINGS['path_to_upload_folder'].'/'.$record['file']);
1442 1442
 
1443 1443
                         // STEP2 - Do encryption
1444 1444
                         prepareFileWithDefuse(
1445 1445
                             'encryp',
1446
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted',
1447
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
1446
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted',
1447
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
1448 1448
                             $SETTINGS
1449 1449
                         );
1450 1450
 
1451 1451
                         // Do cleanup of files
1452
-                        unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted');
1452
+                        unlink($SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted');
1453 1453
 
1454 1454
                         // Update backup table
1455 1455
                         DB::update(
@@ -1475,13 +1475,13 @@  discard block
 block discarded – undo
1475 1475
                 // do some things for new object
1476 1476
                 if (isset($objects[0])) {
1477 1477
                     if ($objects[0] === 'logs') {
1478
-                        DB::query('SELECT increment_id FROM ' . prefixTable('log_items') . " WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
1478
+                        DB::query('SELECT increment_id FROM '.prefixTable('log_items')." WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
1479 1479
                     } elseif ($objects[0] === 'files') {
1480
-                        DB::query('SELECT id FROM ' . prefixTable('files'));
1480
+                        DB::query('SELECT id FROM '.prefixTable('files'));
1481 1481
                     } elseif ($objects[0] === 'categories') {
1482
-                        DB::query('SELECT id FROM ' . prefixTable('categories_items'));
1482
+                        DB::query('SELECT id FROM '.prefixTable('categories_items'));
1483 1483
                     } elseif ($objects[0] === 'custfields') {
1484
-                        DB::query('SELECT raison FROM ' . prefixTable('log_items') . " WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
1484
+                        DB::query('SELECT raison FROM '.prefixTable('log_items')." WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
1485 1485
                     }
1486 1486
                     $nb_of_items = DB::count();
1487 1487
                 } else {
@@ -1600,12 +1600,12 @@  discard block
 block discarded – undo
1600 1600
                 );
1601 1601
             } elseif ($record['current_table'] === 'files') {
1602 1602
                 // restore backup file
1603
-                if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value'])) {
1604
-                    unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['value']);
1605
-                    if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value2'])) {
1603
+                if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value'])) {
1604
+                    unlink($SETTINGS['path_to_upload_folder'].'/'.$record['value']);
1605
+                    if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value2'])) {
1606 1606
                         rename(
1607
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['value2'],
1608
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['value']
1607
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['value2'],
1608
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['value']
1609 1609
                         );
1610 1610
                     }
1611 1611
                 }
@@ -1616,15 +1616,15 @@  discard block
 block discarded – undo
1616 1616
 
1617 1617
         // restore saltkey file
1618 1618
         if (file_exists($previous_saltkey_filename)) {
1619
-            unlink(SECUREPATH . '/teampass-seckey.txt');
1619
+            unlink(SECUREPATH.'/teampass-seckey.txt');
1620 1620
             rename(
1621 1621
                 $previous_saltkey_filename,
1622
-                SECUREPATH . '/teampass-seckey.txt'
1622
+                SECUREPATH.'/teampass-seckey.txt'
1623 1623
             );
1624 1624
         }
1625 1625
 
1626 1626
         // drop table
1627
-        DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
1627
+        DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup'));
1628 1628
 
1629 1629
         // Send back
1630 1630
         echo prepareExchangedData(
@@ -1667,17 +1667,17 @@  discard block
 block discarded – undo
1667 1667
         // delete files
1668 1668
         $rows = DB::query(
1669 1669
             'SELECT value, value2
1670
-            FROM ' . prefixTable('sk_reencrypt_backup') . "
1670
+            FROM ' . prefixTable('sk_reencrypt_backup')."
1671 1671
             WHERE current_table = 'files'"
1672 1672
         );
1673 1673
         foreach ($rows as $record) {
1674
-            if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value2'])) {
1675
-                unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['value2']);
1674
+            if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value2'])) {
1675
+                unlink($SETTINGS['path_to_upload_folder'].'/'.$record['value2']);
1676 1676
             }
1677 1677
         }
1678 1678
 
1679 1679
         // drop table
1680
-        DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
1680
+        DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup'));
1681 1681
 
1682 1682
         echo '[{"status":"done"}]';
1683 1683
         break;
@@ -1709,7 +1709,7 @@  discard block
 block discarded – undo
1709 1709
             );
1710 1710
             break;
1711 1711
         } else {
1712
-            require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1712
+            require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1713 1713
 
1714 1714
             //send email
1715 1715
             $ret = json_decode(
@@ -1748,11 +1748,11 @@  discard block
 block discarded – undo
1748 1748
             break;
1749 1749
         }
1750 1750
 
1751
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1751
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1752 1752
 
1753 1753
         $rows = DB::query(
1754 1754
             'SELECT *
1755
-            FROM ' . prefixTable('emails') . '
1755
+            FROM ' . prefixTable('emails').'
1756 1756
             WHERE status = %s OR status = %s',
1757 1757
             'not_sent',
1758 1758
             ''
@@ -1837,9 +1837,9 @@  discard block
 block discarded – undo
1837 1837
             break;
1838 1838
         }
1839 1839
 
1840
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1840
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1841 1841
 
1842
-        $rows = DB::query('SELECT * FROM ' . prefixTable('emails') . ' WHERE status = %s OR status = %s', 'not_sent', '');
1842
+        $rows = DB::query('SELECT * FROM '.prefixTable('emails').' WHERE status = %s OR status = %s', 'not_sent', '');
1843 1843
         foreach ($rows as $record) {
1844 1844
             //send email
1845 1845
             $ret = json_decode(
@@ -1907,7 +1907,7 @@  discard block
 block discarded – undo
1907 1907
             break;
1908 1908
         }
1909 1909
 
1910
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1910
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1911 1911
 
1912 1912
         // init
1913 1913
         $filesList = array();
@@ -1920,7 +1920,7 @@  discard block
 block discarded – undo
1920 1920
                 FROM ' . prefixTable('files')
1921 1921
             );
1922 1922
             foreach ($rows as $record) {
1923
-                if (is_file($SETTINGS['path_to_upload_folder'] . '/' . $record['file'])) {
1923
+                if (is_file($SETTINGS['path_to_upload_folder'].'/'.$record['file'])) {
1924 1924
                     $addFile = false;
1925 1925
                     if (($post_option === 'attachments-decrypt' && $record['status'] === 'encrypted')
1926 1926
                         || ($post_option === 'attachments-encrypt' && $record['status'] === 'clear')
@@ -1985,8 +1985,8 @@  discard block
 block discarded – undo
1985 1985
         $post_list = filter_var_array($post_list, FILTER_SANITIZE_STRING);
1986 1986
         $post_counter = filter_var($post_counter, FILTER_SANITIZE_NUMBER_INT);
1987 1987
 
1988
-        include $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
1989
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1988
+        include $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
1989
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1990 1990
 
1991 1991
         $cpt = 0;
1992 1992
         $continu = true;
@@ -1994,15 +1994,15 @@  discard block
 block discarded – undo
1994 1994
         $message = '';
1995 1995
 
1996 1996
         // load PhpEncryption library
1997
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Crypto.php';
1998
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Encoding.php';
1999
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/DerivedKeys.php';
2000
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Key.php';
2001
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/KeyOrPassword.php';
2002
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/File.php';
2003
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/RuntimeTests.php';
2004
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/KeyProtectedByPassword.php';
2005
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Core.php';
1997
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Crypto.php';
1998
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Encoding.php';
1999
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/DerivedKeys.php';
2000
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Key.php';
2001
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/KeyOrPassword.php';
2002
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/File.php';
2003
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/RuntimeTests.php';
2004
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/KeyProtectedByPassword.php';
2005
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Core.php';
2006 2006
 
2007 2007
         // treat 10 files
2008 2008
         foreach ($post_list as $file) {
@@ -2010,35 +2010,35 @@  discard block
 block discarded – undo
2010 2010
                 // Get file name
2011 2011
                 $file_info = DB::queryfirstrow(
2012 2012
                     'SELECT file
2013
-                    FROM ' . prefixTable('files') . '
2013
+                    FROM ' . prefixTable('files').'
2014 2014
                     WHERE id = %i',
2015 2015
                     $file
2016 2016
                 );
2017 2017
 
2018 2018
                 // skip file is Coherancey not respected
2019
-                if (is_file($SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'])) {
2019
+                if (is_file($SETTINGS['path_to_upload_folder'].'/'.$file_info['file'])) {
2020 2020
                     // Case where we want to decrypt
2021 2021
                     if ($post_option === 'decrypt') {
2022 2022
                         prepareFileWithDefuse(
2023 2023
                             'decrypt',
2024
-                            $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'],
2025
-                            $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
2024
+                            $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'],
2025
+                            $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
2026 2026
                             $SETTINGS
2027 2027
                         );
2028 2028
                         // Case where we want to encrypt
2029 2029
                     } elseif ($post_option === 'encrypt') {
2030 2030
                         prepareFileWithDefuse(
2031 2031
                             'encrypt',
2032
-                            $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'],
2033
-                            $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
2032
+                            $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'],
2033
+                            $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
2034 2034
                             $SETTINGS
2035 2035
                         );
2036 2036
                     }
2037 2037
                     // Do file cleanup
2038
-                    fileDelete($SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'], $SETTINGS);
2038
+                    fileDelete($SETTINGS['path_to_upload_folder'].'/'.$file_info['file'], $SETTINGS);
2039 2039
                     rename(
2040
-                        $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
2041
-                        $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file']
2040
+                        $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
2041
+                        $SETTINGS['path_to_upload_folder'].'/'.$file_info['file']
2042 2042
                     );
2043 2043
 
2044 2044
                     // store in DB
@@ -2073,8 +2073,8 @@  discard block
 block discarded – undo
2073 2073
                 $post_option === 'attachments-decrypt' ? 'clear' : 'encrypted'
2074 2074
             );
2075 2075
 
2076
-            $message = langHdl('last_execution') . ' ' .
2077
-                date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], time()) .
2076
+            $message = langHdl('last_execution').' '.
2077
+                date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], time()).
2078 2078
                 '<i class="fas fa-check text-success ml-2 mr-3"></i>';
2079 2079
         }
2080 2080
 
@@ -2161,7 +2161,7 @@  discard block
 block discarded – undo
2161 2161
             $post_id = filter_var($dataReceived['id'], FILTER_SANITIZE_STRING);
2162 2162
 
2163 2163
             DB::query(
2164
-                'DELETE FROM ' . prefixTable('api') . ' WHERE id = %i',
2164
+                'DELETE FROM '.prefixTable('api').' WHERE id = %i',
2165 2165
                 $post_id
2166 2166
             );
2167 2167
         }
@@ -2253,7 +2253,7 @@  discard block
 block discarded – undo
2253 2253
             // Delete existing key
2254 2254
         } elseif (null !== $post_action && $post_action === 'delete') {
2255 2255
             $post_id = filter_var($dataReceived['id'], FILTER_SANITIZE_STRING);
2256
-            DB::query('DELETE FROM ' . prefixTable('api') . ' WHERE id=%i', $post_id);
2256
+            DB::query('DELETE FROM '.prefixTable('api').' WHERE id=%i', $post_id);
2257 2257
         }
2258 2258
 
2259 2259
         echo prepareExchangedData(
@@ -2268,7 +2268,7 @@  discard block
 block discarded – undo
2268 2268
 
2269 2269
     case 'save_api_status':
2270 2270
         // Do query
2271
-        DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'api');
2271
+        DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'api');
2272 2272
         $counter = DB::count();
2273 2273
         if ($counter === 0) {
2274 2274
             DB::insert(
@@ -2294,7 +2294,7 @@  discard block
 block discarded – undo
2294 2294
         break;
2295 2295
 
2296 2296
     case 'save_duo_status':
2297
-        DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'duo');
2297
+        DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'duo');
2298 2298
         $counter = DB::count();
2299 2299
         if ($counter === 0) {
2300 2300
             DB::insert(
@@ -2337,7 +2337,7 @@  discard block
 block discarded – undo
2337 2337
         foreach ($dataReceived as $key => $value) {
2338 2338
             DB::query(
2339 2339
                 'SELECT * 
2340
-                FROM ' . prefixTable('misc') . '
2340
+                FROM ' . prefixTable('misc').'
2341 2341
                 WHERE type = %s AND intitule = %s',
2342 2342
                 'admin',
2343 2343
                 $key
@@ -2405,7 +2405,7 @@  discard block
 block discarded – undo
2405 2405
         } else {
2406 2406
             $tmp = 1;
2407 2407
         }
2408
-        DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'google_authentication');
2408
+        DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'google_authentication');
2409 2409
         $counter = DB::count();
2410 2410
         if ($counter === 0) {
2411 2411
             DB::insert(
@@ -2431,7 +2431,7 @@  discard block
 block discarded – undo
2431 2431
 
2432 2432
         // ga_website_name
2433 2433
         if (is_null($dataReceived['ga_website_name']) === false) {
2434
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'ga_website_name');
2434
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'ga_website_name');
2435 2435
             $counter = DB::count();
2436 2436
             if ($counter === 0) {
2437 2437
                 DB::insert(
@@ -2462,7 +2462,7 @@  discard block
 block discarded – undo
2462 2462
         }
2463 2463
 
2464 2464
         // send data
2465
-        echo '[{"result" : "' . addslashes($LANG['done']) . '" , "error" : ""}]';
2465
+        echo '[{"result" : "'.addslashes($LANG['done']).'" , "error" : ""}]';
2466 2466
         break;
2467 2467
 
2468 2468
     case 'save_agses_options':
@@ -2485,7 +2485,7 @@  discard block
 block discarded – undo
2485 2485
 
2486 2486
         // agses_hosted_url
2487 2487
         if (!is_null($dataReceived['agses_hosted_url'])) {
2488
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_url');
2488
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_url');
2489 2489
             $counter = DB::count();
2490 2490
             if ($counter === 0) {
2491 2491
                 DB::insert(
@@ -2514,7 +2514,7 @@  discard block
 block discarded – undo
2514 2514
 
2515 2515
         // agses_hosted_id
2516 2516
         if (!is_null($dataReceived['agses_hosted_id'])) {
2517
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_id');
2517
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_id');
2518 2518
             $counter = DB::count();
2519 2519
             if ($counter === 0) {
2520 2520
                 DB::insert(
@@ -2543,7 +2543,7 @@  discard block
 block discarded – undo
2543 2543
 
2544 2544
         // agses_hosted_apikey
2545 2545
         if (!is_null($dataReceived['agses_hosted_apikey'])) {
2546
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_apikey');
2546
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_apikey');
2547 2547
             $counter = DB::count();
2548 2548
             if ($counter === 0) {
2549 2549
                 DB::insert(
@@ -2571,7 +2571,7 @@  discard block
 block discarded – undo
2571 2571
         }
2572 2572
 
2573 2573
         // send data
2574
-        echo '[{"result" : "' . addslashes($LANG['done']) . '" , "error" : ""}]';
2574
+        echo '[{"result" : "'.addslashes($LANG['done']).'" , "error" : ""}]';
2575 2575
         break;
2576 2576
 
2577 2577
     case 'save_option_change':
@@ -2607,7 +2607,7 @@  discard block
 block discarded – undo
2607 2607
 
2608 2608
         // Check if setting is already in DB. If NO then insert, if YES then update.
2609 2609
         $data = DB::query(
2610
-            'SELECT * FROM ' . prefixTable('misc') . '
2610
+            'SELECT * FROM '.prefixTable('misc').'
2611 2611
             WHERE type = %s AND intitule = %s',
2612 2612
             $type,
2613 2613
             $dataReceived['field']
@@ -2629,7 +2629,7 @@  discard block
 block discarded – undo
2629 2629
                     array(
2630 2630
                         'valeur' => time(),
2631 2631
                         'type' => $type,
2632
-                        'intitule' => $dataReceived['field'] . '_time',
2632
+                        'intitule' => $dataReceived['field'].'_time',
2633 2633
                     )
2634 2634
                 );
2635 2635
             }
@@ -2647,10 +2647,10 @@  discard block
 block discarded – undo
2647 2647
             if ($dataReceived['field'] === 'send_stats') {
2648 2648
                 // Check if previous time exists, if not them insert this value in DB
2649 2649
                 DB::query(
2650
-                    'SELECT * FROM ' . prefixTable('misc') . '
2650
+                    'SELECT * FROM '.prefixTable('misc').'
2651 2651
                     WHERE type = %s AND intitule = %s',
2652 2652
                     $type,
2653
-                    $dataReceived['field'] . '_time'
2653
+                    $dataReceived['field'].'_time'
2654 2654
                 );
2655 2655
                 $counter = DB::count();
2656 2656
                 if ($counter === 0) {
@@ -2659,7 +2659,7 @@  discard block
 block discarded – undo
2659 2659
                         array(
2660 2660
                             'valeur' => 0,
2661 2661
                             'type' => $type,
2662
-                            'intitule' => $dataReceived['field'] . '_time',
2662
+                            'intitule' => $dataReceived['field'].'_time',
2663 2663
                         )
2664 2664
                     );
2665 2665
                 } else {
@@ -2679,13 +2679,13 @@  discard block
 block discarded – undo
2679 2679
         // special Cases
2680 2680
         if ($dataReceived['field'] === 'cpassman_url') {
2681 2681
             // update also jsUrl for CSFP protection
2682
-            $jsUrl = $dataReceived['value'] . '/includes/libraries/csrfp/js/csrfprotector.js';
2682
+            $jsUrl = $dataReceived['value'].'/includes/libraries/csrfp/js/csrfprotector.js';
2683 2683
             $csrfp_file = '../includes/libraries/csrfp/libs/csrfp.config.php';
2684 2684
             $data = file_get_contents($csrfp_file);
2685 2685
             $posJsUrl = strpos($data, '"jsUrl" => "');
2686 2686
             $posEndLine = strpos($data, '",', $posJsUrl);
2687 2687
             $line = substr($data, $posJsUrl, ($posEndLine - $posJsUrl + 2));
2688
-            $newdata = str_replace($line, '"jsUrl" => "' . filter_var($jsUrl, FILTER_SANITIZE_STRING) . '",', $data);
2688
+            $newdata = str_replace($line, '"jsUrl" => "'.filter_var($jsUrl, FILTER_SANITIZE_STRING).'",', $data);
2689 2689
             file_put_contents($csrfp_file, $newdata);
2690 2690
         } elseif ($dataReceived['field'] === 'restricted_to_input' && $dataReceived['value'] === '0') {
2691 2691
             DB::update(
@@ -2709,7 +2709,7 @@  discard block
 block discarded – undo
2709 2709
         echo prepareExchangedData(
2710 2710
             array(
2711 2711
                 'error' => false,
2712
-                'misc' => $counter . ' ; ' . $SETTINGS[$dataReceived['field']],
2712
+                'misc' => $counter.' ; '.$SETTINGS[$dataReceived['field']],
2713 2713
             ),
2714 2714
             'encode'
2715 2715
         );
@@ -2751,7 +2751,7 @@  discard block
 block discarded – undo
2751 2751
 
2752 2752
         // send statistics
2753 2753
         if (null !== $post_status) {
2754
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'send_stats');
2754
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'send_stats');
2755 2755
             $counter = DB::count();
2756 2756
             if ($counter === 0) {
2757 2757
                 DB::insert(
@@ -2783,7 +2783,7 @@  discard block
 block discarded – undo
2783 2783
 
2784 2784
         // send statistics items
2785 2785
         if (null !== $post_list) {
2786
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'send_statistics_items');
2786
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'send_statistics_items');
2787 2787
             $counter = DB::count();
2788 2788
             if ($counter === 0) {
2789 2789
                 DB::insert(
@@ -2830,7 +2830,7 @@  discard block
 block discarded – undo
2830 2830
             break;
2831 2831
         }
2832 2832
 
2833
-        if (DB::query("SHOW TABLES LIKE '" . prefixTable('sk_reencrypt_backup') . "'")) {
2833
+        if (DB::query("SHOW TABLES LIKE '".prefixTable('sk_reencrypt_backup')."'")) {
2834 2834
             if (DB::count() === 1) {
2835 2835
                 echo true;
2836 2836
             } else {
@@ -2868,7 +2868,7 @@  discard block
 block discarded – undo
2868 2868
 
2869 2869
         $rows = DB::query(
2870 2870
             'SELECT id, title
2871
-                FROM ' . prefixTable('roles_title') . '
2871
+                FROM ' . prefixTable('roles_title').'
2872 2872
                 ORDER BY title ASC'
2873 2873
         );
2874 2874
         foreach ($rows as $record) {
Please login to merge, or discard this patch.