Passed
Push — master ( e44054...5990bd )
by Nils
04:09
created
index.php 1 patch
Spacing   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
 }
73 73
 
74 74
 // Include files
75
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
76
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
75
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
76
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
77 77
 // Quick major version check -> upgrade needed?
78 78
 if (isset($SETTINGS['cpassman_version']) === true && version_compare(TP_VERSION, $SETTINGS['cpassman_version']) > 0) {
79 79
     // Perform redirection
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
     exit;
87 87
 }
88 88
 
89
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
89
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
90 90
 $superGlobal = new protect\SuperGlobal\SuperGlobal();
91 91
 
92 92
 if (isset($SETTINGS['cpassman_url']) === false || $SETTINGS['cpassman_url'] === '') {
@@ -94,8 +94,8 @@  discard block
 block discarded – undo
94 94
 }
95 95
 
96 96
 // Include files
97
-require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
98
-require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
97
+require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
98
+require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
99 99
 // Open MYSQL database connection
100 100
 require_once './includes/libraries/Database/Meekrodb/db.class.php';
101 101
 if (defined('DB_PASSWD_CLEAR') === false) {
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 DB::$ssl = DB_SSL;
111 111
 DB::$connect_options = DB_CONNECT_OPTIONS;
112 112
 // Load Core library
113
-require_once $SETTINGS['cpassman_dir'] . '/sources/core.php';
113
+require_once $SETTINGS['cpassman_dir'].'/sources/core.php';
114 114
 // Prepare POST variables
115 115
 $post_language = filter_input(INPUT_POST, 'language', FILTER_SANITIZE_STRING);
116 116
 // Prepare superGlobal variables
@@ -140,8 +140,8 @@  discard block
 block discarded – undo
140 140
     //get default language
141 141
     $dataLanguage = DB::queryFirstRow(
142 142
         'SELECT m.valeur AS valeur, l.flag AS flag
143
-        FROM ' . prefixTable('misc') . ' AS m
144
-        INNER JOIN ' . prefixTable('languages') . ' AS l ON (m.valeur = l.name)
143
+        FROM ' . prefixTable('misc').' AS m
144
+        INNER JOIN ' . prefixTable('languages').' AS l ON (m.valeur = l.name)
145 145
         WHERE m.type=%s_type AND m.intitule=%s_intitule',
146 146
         [
147 147
             'type' => 'admin',
@@ -183,23 +183,23 @@  discard block
 block discarded – undo
183 183
 
184 184
 // Load user languages files
185 185
 if (in_array($session_user_language, $languagesList) === true) {
186
-    if (file_exists($SETTINGS['cpassman_dir'] . '/includes/language/' . $session_user_language . '.php') === true) {
187
-        $_SESSION['teampass']['lang'] = include $SETTINGS['cpassman_dir'] . '/includes/language/' . $session_user_language . '.php';
186
+    if (file_exists($SETTINGS['cpassman_dir'].'/includes/language/'.$session_user_language.'.php') === true) {
187
+        $_SESSION['teampass']['lang'] = include $SETTINGS['cpassman_dir'].'/includes/language/'.$session_user_language.'.php';
188 188
     }
189 189
 } else {
190 190
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
191 191
     //not allowed page
192
-    include $SETTINGS['cpassman_dir'] . '/error.php';
192
+    include $SETTINGS['cpassman_dir'].'/error.php';
193 193
 }
194 194
 
195 195
 // load 2FA Google
196 196
 if (isset($SETTINGS['google_authentication']) === true && $SETTINGS['google_authentication'] === '1') {
197
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php';
197
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php';
198 198
 }
199 199
 
200 200
 // load 2FA Yubico
201 201
 if (isset($SETTINGS['yubico_authentication']) === true && $SETTINGS['yubico_authentication'] === '1') {
202
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/Yubico/Yubico.php';
202
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/Yubico/Yubico.php';
203 203
 }
204 204
 
205 205
 // Some template adjust
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
     <!-- Toastr -->
257 257
     <link rel="stylesheet" href="plugins/toastr/toastr.min.css" />
258 258
     <!-- favicon -->
259
-    <link rel="shortcut icon" type="image/png" href="<?php echo $SETTINGS['favicon'];?>"/>
259
+    <link rel="shortcut icon" type="image/png" href="<?php echo $SETTINGS['favicon']; ?>"/>
260 260
 </head>
261 261
 
262 262
 
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
             ),
288 288
             'SESSION'
289 289
         );
290
-        include $SETTINGS['cpassman_dir'] . '/error.php';
290
+        include $SETTINGS['cpassman_dir'].'/error.php';
291 291
     }
292 292
 } elseif (
293 293
     $session_validite_pw !== null
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
                         <div class="dropdown show">
332 332
                             <a class="btn btn-primary dropdown-toggle" href="#" data-toggle="dropdown">
333 333
                                 <?php
334
-                                    echo $session_name . '&nbsp;' . $session_lastname; ?>
334
+                                    echo $session_name.'&nbsp;'.$session_lastname; ?>
335 335
                             </a>
336 336
 
337 337
                             <div class="dropdown-menu dropdown-menu-right">
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
             <!-- Main Sidebar Container -->
370 370
             <aside class="main-sidebar sidebar-dark-primary elevation-4">
371 371
                 <!-- Brand Logo -->
372
-                <a href="<?php echo $SETTINGS['cpassman_url'] . '/index.php?page=items'; ?>" class="brand-link">
372
+                <a href="<?php echo $SETTINGS['cpassman_url'].'/index.php?page=items'; ?>" class="brand-link">
373 373
                     <img src="includes/images/teampass-logo2-home.png" alt="Teampass Logo" class="brand-image">
374 374
                     <span class="brand-text font-weight-light"><?php echo TP_TOOL_NAME; ?></span>
375 375
                 </a>
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
                         <a href="#" data-name="items" class="nav-link', $get['page'] === 'items' ? ' active' : '', '">
388 388
                         <i class="nav-icon fas fa-key"></i>
389 389
                         <p>
390
-                            ' . langHdl('pw') . '
390
+                            ' . langHdl('pw').'
391 391
                         </p>
392 392
                         </a>
393 393
                     </li>';
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
                         <a href="#" data-name="import" class="nav-link', $get['page'] === 'import' ? ' active' : '', '">
404 404
                         <i class="nav-icon fas fa-file-import"></i>
405 405
                         <p>
406
-                            ' . langHdl('import') . '
406
+                            ' . langHdl('import').'
407 407
                         </p>
408 408
                         </a>
409 409
                     </li>';
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
                         <a href="#" data-name="export" class="nav-link', $get['page'] === 'export' ? ' active' : '', '">
425 425
                         <i class="nav-icon fas fa-file-export"></i>
426 426
                         <p>
427
-                            ' . langHdl('export') . '
427
+                            ' . langHdl('export').'
428 428
                         </p>
429 429
                         </a>
430 430
                     </li>';
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
                         <a href="#" data-name="search" class="nav-link', $get['page'] === 'search' ? ' active' : '', '">
452 452
                         <i class="nav-icon fas fa-search"></i>
453 453
                         <p>
454
-                            ' . langHdl('find') . '
454
+                            ' . langHdl('find').'
455 455
                         </p>
456 456
                         </a>
457 457
                     </li>';
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
                         <a href="#" data-name="favourites" class="nav-link', $get['page'] === 'admin' ? ' favourites' : '', '">
468 468
                         <i class="nav-icon fas fa-star"></i>
469 469
                         <p>
470
-                            ' . langHdl('favorites') . '
470
+                            ' . langHdl('favorites').'
471 471
                         </p>
472 472
                         </a>
473 473
                     </li>';
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
                         <a href="#" data-name="suggestion" class="nav-link', $get['page'] === 'suggestion' ? ' active' : '', '">
498 498
                         <i class="nav-icon fas fa-lightbulb"></i>
499 499
                         <p>
500
-                            ' . langHdl('suggestion_menu') . '
500
+                            ' . langHdl('suggestion_menu').'
501 501
                         </p>
502 502
                         </a>
503 503
                     </li>';
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
                         <a href="#" data-name="admin" class="nav-link', $get['page'] === 'admin' ? ' active' : '', '">
511 511
                         <i class="nav-icon fas fa-info"></i>
512 512
                         <p>
513
-                            ' . langHdl('admin_main') . '
513
+                            ' . langHdl('admin_main').'
514 514
                         </p>
515 515
                         </a>
516 516
                     </li>
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
                         <a href="#" class="nav-link">
519 519
                             <i class="nav-icon fas fa-wrench"></i>
520 520
                             <p>
521
-                                ' . langHdl('admin_settings') . '
521
+                                ' . langHdl('admin_settings').'
522 522
                                 <i class="fas fa-angle-left right"></i>
523 523
                             </p>
524 524
                         </a>
@@ -526,55 +526,55 @@  discard block
 block discarded – undo
526 526
                             <li class="nav-item">
527 527
                                 <a href="#" data-name="options" class="nav-link', $get['page'] === 'options' ? ' active' : '', '">
528 528
                                     <i class="fas fa-check-double nav-icon"></i>
529
-                                    <p>' . langHdl('options') . '</p>
529
+                                    <p>' . langHdl('options').'</p>
530 530
                                 </a>
531 531
                             </li>
532 532
                             <li class="nav-item">
533 533
                                 <a href="#" data-name="2fa" class="nav-link', $get['page'] === '2fa' ? ' active' : '', '">
534 534
                                     <i class="fas fa-qrcode nav-icon"></i>
535
-                                    <p>' . langHdl('mfa_short') . '</p>
535
+                                    <p>' . langHdl('mfa_short').'</p>
536 536
                                 </a>
537 537
                             </li>
538 538
                             <li class="nav-item">
539 539
                                 <a href="#" data-name="api" class="nav-link', $get['page'] === 'api' ? ' active' : '', '">
540 540
                                     <i class="fas fa-cubes nav-icon"></i>
541
-                                    <p>' . langHdl('api') . '</p>
541
+                                    <p>' . langHdl('api').'</p>
542 542
                                 </a>
543 543
                             </li>
544 544
                             <li class="nav-item">
545 545
                                 <a href="#" data-name="backups" class="nav-link', $get['page'] === 'backups' ? ' active' : '', '">
546 546
                                     <i class="fas fa-database nav-icon"></i>
547
-                                    <p>' . langHdl('backups') . '</p>
547
+                                    <p>' . langHdl('backups').'</p>
548 548
                                 </a>
549 549
                             </li>
550 550
                             <li class="nav-item">
551 551
                                 <a href="#" data-name="emails" class="nav-link', $get['page'] === 'emails' ? ' active' : '', '">
552 552
                                     <i class="fas fa-envelope nav-icon"></i>
553
-                                    <p>' . langHdl('emails') . '</p>
553
+                                    <p>' . langHdl('emails').'</p>
554 554
                                 </a>
555 555
                             </li>
556 556
                             <li class="nav-item">
557 557
                                 <a href="#" data-name="fields" class="nav-link', $get['page'] === 'fields' ? ' active' : '', '">
558 558
                                     <i class="fas fa-keyboard nav-icon"></i>
559
-                                    <p>' . langHdl('fields') . '</p>
559
+                                    <p>' . langHdl('fields').'</p>
560 560
                                 </a>
561 561
                             </li>
562 562
                             <li class="nav-item">
563 563
                                 <a href="#" data-name="ldap" class="nav-link', $get['page'] === 'ldap' ? ' active' : '', '">
564 564
                                     <i class="fas fa-id-card nav-icon"></i>
565
-                                    <p>' . langHdl('ldap') . '</p>
565
+                                    <p>' . langHdl('ldap').'</p>
566 566
                                 </a>
567 567
                             </li>
568 568
                             <li class="nav-item">
569 569
                                 <a href="#" data-name="uploads" class="nav-link', $get['page'] === 'uploads' ? ' active' : '', '">
570 570
                                     <i class="fas fa-file-upload nav-icon"></i>
571
-                                    <p>' . langHdl('uploads') . '</p>
571
+                                    <p>' . langHdl('uploads').'</p>
572 572
                                 </a>
573 573
                             </li>
574 574
                             <li class="nav-item">
575 575
                                 <a href="#" data-name="statistics" class="nav-link', $get['page'] === 'statistics' ? ' active' : '', '">
576 576
                                     <i class="fas fa-chart-bar nav-icon"></i>
577
-                                    <p>' . langHdl('statistics') . '</p>
577
+                                    <p>' . langHdl('statistics').'</p>
578 578
                                 </a>
579 579
                             </li>
580 580
                         </ul>
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
                         <a href="#" data-name="actions" class="nav-link', $get['page'] === 'actions' ? ' active' : '', '">
584 584
                         <i class="nav-icon fas fa-cogs"></i>
585 585
                         <p>
586
-                            ' . langHdl('actions') . '
586
+                            ' . langHdl('actions').'
587 587
                         </p>
588 588
                         </a>
589 589
                     </li>';
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
                         <a href="#" data-name="folders" class="nav-link', $get['page'] === 'folders' ? ' active' : '', '">
600 600
                         <i class="nav-icon fas fa-folder-open"></i>
601 601
                         <p>
602
-                            ' . langHdl('folders') . '
602
+                            ' . langHdl('folders').'
603 603
                         </p>
604 604
                         </a>
605 605
                     </li>
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
                         <a href="#" data-name="roles" class="nav-link', $get['page'] === 'roles' ? ' active' : '', '">
608 608
                         <i class="nav-icon fas fa-graduation-cap"></i>
609 609
                         <p>
610
-                            ' . langHdl('roles') . '
610
+                            ' . langHdl('roles').'
611 611
                         </p>
612 612
                         </a>
613 613
                     </li>
@@ -615,38 +615,38 @@  discard block
 block discarded – undo
615 615
                         <a href="#" data-name="users" class="nav-link', $get['page'] === 'users' ? ' active' : '', '">
616 616
                         <i class="nav-icon fas fa-users"></i>
617 617
                         <p>
618
-                            ' . langHdl('users') . '
618
+                            ' . langHdl('users').'
619 619
                         </p>
620 620
                         </a>
621 621
                     </li>
622 622
                     <li class="nav-item has-treeview', $menuUtilities === true ? ' menu-open' : '', '">
623 623
                         <a href="#" class="nav-link">
624 624
                         <i class="nav-icon fas fa-cubes"></i>
625
-                        <p>' . langHdl('admin_views') . '<i class="fas fa-angle-left right"></i></p>
625
+                        <p>' . langHdl('admin_views').'<i class="fas fa-angle-left right"></i></p>
626 626
                         </a>
627 627
                         <ul class="nav nav-treeview">
628 628
                           <li class="nav-item">
629 629
                             <a href="#" data-name="utilities.renewal" class="nav-link', $get['page'] === 'utilities.renewal' ? ' active' : '', '">
630 630
                               <i class="far fa-calendar-alt nav-icon"></i>
631
-                              <p>' . langHdl('renewal') . '</p>
631
+                              <p>' . langHdl('renewal').'</p>
632 632
                             </a>
633 633
                           </li>
634 634
                           <li class="nav-item">
635 635
                             <a href="#" data-name="utilities.deletion" class="nav-link', $get['page'] === 'utilities.deletion' ? ' active' : '', '">
636 636
                               <i class="fas fa-trash-alt nav-icon"></i>
637
-                              <p>' . langHdl('deletion') . '</p>
637
+                              <p>' . langHdl('deletion').'</p>
638 638
                             </a>
639 639
                           </li>
640 640
                           <li class="nav-item">
641 641
                             <a href="#" data-name="utilities.logs" class="nav-link', $get['page'] === 'utilities.logs' ? ' active' : '', '">
642 642
                               <i class="fas fa-history nav-icon"></i>
643
-                              <p>' . langHdl('logs') . '</p>
643
+                              <p>' . langHdl('logs').'</p>
644 644
                             </a>
645 645
                           </li>
646 646
                           <li class="nav-item">
647 647
                             <a href="#" data-name="utilities.database" class="nav-link', $get['page'] === 'utilities.database' ? ' active' : '', '">
648 648
                               <i class="fas fa-database nav-icon"></i>
649
-                              <p>' . langHdl('database') . '</p>
649
+                              <p>' . langHdl('database').'</p>
650 650
                             </a>
651 651
                           </li>
652 652
                         </ul>
@@ -657,10 +657,10 @@  discard block
 block discarded – undo
657 657
                     <!-- /.sidebar-menu -->
658 658
                 <div class="menu-footer">
659 659
                     <div class="" id="sidebar-footer">
660
-                        <i class="fas fa-clock-o mr-2 infotip text-info pointer" title="<?php echo langHdl('server_time') . ' ' .
661
-                            date($SETTINGS['date_format'], (int) $server['request_time']) . ' - ' .
660
+                        <i class="fas fa-clock-o mr-2 infotip text-info pointer" title="<?php echo langHdl('server_time').' '.
661
+                            date($SETTINGS['date_format'], (int) $server['request_time']).' - '.
662 662
                             date($SETTINGS['time_format'], (int) $server['request_time']); ?>"></i>
663
-                        <i class="fas fa-users mr-2 infotip text-info pointer" title="<?php echo $session_nb_users_online . ' ' . langHdl('users_online'); ?>"></i>
663
+                        <i class="fas fa-users mr-2 infotip text-info pointer" title="<?php echo $session_nb_users_online.' '.langHdl('users_online'); ?>"></i>
664 664
                         <a href="<?php echo READTHEDOC_URL; ?>" target="_blank" class="text-info"><i class="fas fa-book mr-2 infotip" title="<?php echo langHdl('documentation_canal'); ?> ReadTheDocs"></i></a>
665 665
                         <a href="<?php echo REDDIT_URL; ?>" target="_blank" class="text-info"><i class="fab fa-reddit-alien mr-2 infotip" title="<?php echo langHdl('admin_help'); ?>"></i></a>
666 666
                         <i class="fas fa-bug infotip pointer text-info" title="<?php echo langHdl('bugs_page'); ?>" onclick="generateBugReport()"></i>
@@ -962,18 +962,18 @@  discard block
 block discarded – undo
962 962
                     } elseif ($get['page'] === 'items') {
963 963
                         // SHow page with Items
964 964
                         if ((int) $session_user_admin !== 1) {
965
-                            include $SETTINGS['cpassman_dir'] . '/pages/items.php';
965
+                            include $SETTINGS['cpassman_dir'].'/pages/items.php';
966 966
                         } elseif ((int) $session_user_admin === 1) {
967
-                            include $SETTINGS['cpassman_dir'] . '/pages/admin.php';
967
+                            include $SETTINGS['cpassman_dir'].'/pages/admin.php';
968 968
                         } else {
969 969
                             $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
970 970
                             //not allowed page
971
-                            include $SETTINGS['cpassman_dir'] . '/error.php';
971
+                            include $SETTINGS['cpassman_dir'].'/error.php';
972 972
                         }
973 973
                     } elseif (in_array($get['page'], array_keys($mngPages)) === true) {
974 974
                         // Define if user is allowed to see management pages
975 975
                         if ($session_user_admin === 1) {
976
-                            include $SETTINGS['cpassman_dir'] . '/pages/' . $mngPages[$get['page']];
976
+                            include $SETTINGS['cpassman_dir'].'/pages/'.$mngPages[$get['page']];
977 977
                         } elseif ($session_user_manager === 1 || $session_user_human_resources === 1) {
978 978
                             if ($get['page'] !== 'manage_main'
979 979
                                 && $get['page'] !== 'manage_settings'
@@ -982,15 +982,15 @@  discard block
 block discarded – undo
982 982
                             } else {
983 983
                                 $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
984 984
                                 //not allowed page
985
-                                include $SETTINGS['cpassman_dir'] . '/error.php';
985
+                                include $SETTINGS['cpassman_dir'].'/error.php';
986 986
                             }
987 987
                         } else {
988 988
                             $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
989 989
                             //not allowed page
990
-                            include $SETTINGS['cpassman_dir'] . '/error.php';
990
+                            include $SETTINGS['cpassman_dir'].'/error.php';
991 991
                         }
992 992
                     } elseif (empty($get['page']) === false) {
993
-                        include $SETTINGS['cpassman_dir'] . '/pages/' . $get['page'] . '.php';
993
+                        include $SETTINGS['cpassman_dir'].'/pages/'.$get['page'].'.php';
994 994
                     } else {
995 995
                         $_SESSION['error']['code'] = ERR_NOT_EXIST;
996 996
                         //page doesn't exist
@@ -1080,7 +1080,7 @@  discard block
 block discarded – undo
1080 1080
     $superGlobal->put('initialUrl', '', 'SESSION');
1081 1081
 
1082 1082
     // LOGIN form
1083
-    include $SETTINGS['cpassman_dir'] . '/includes/core/login.php';
1083
+    include $SETTINGS['cpassman_dir'].'/includes/core/login.php';
1084 1084
 }
1085 1085
 
1086 1086
     ?>
@@ -1271,61 +1271,61 @@  discard block
 block discarded – undo
1271 1271
     isset($_SESSION['CPM']) === true
1272 1272
     && isset($SETTINGS['cpassman_dir']) === true
1273 1273
 ) {
1274
-    include_once $SETTINGS['cpassman_dir'] . '/includes/core/load.js.php';
1274
+    include_once $SETTINGS['cpassman_dir'].'/includes/core/load.js.php';
1275 1275
     if ($menuAdmin === true) {
1276
-        include_once $SETTINGS['cpassman_dir'] . '/pages/admin.js.php';
1276
+        include_once $SETTINGS['cpassman_dir'].'/pages/admin.js.php';
1277 1277
         if ($get['page'] === '2fa') {
1278
-            include_once $SETTINGS['cpassman_dir'] . '/pages/2fa.js.php';
1278
+            include_once $SETTINGS['cpassman_dir'].'/pages/2fa.js.php';
1279 1279
         } elseif ($get['page'] === 'api') {
1280
-            include_once $SETTINGS['cpassman_dir'] . '/pages/api.js.php';
1280
+            include_once $SETTINGS['cpassman_dir'].'/pages/api.js.php';
1281 1281
         } elseif ($get['page'] === 'backups') {
1282
-            include_once $SETTINGS['cpassman_dir'] . '/pages/backups.js.php';
1282
+            include_once $SETTINGS['cpassman_dir'].'/pages/backups.js.php';
1283 1283
         } elseif ($get['page'] === 'emails') {
1284
-            include_once $SETTINGS['cpassman_dir'] . '/pages/emails.js.php';
1284
+            include_once $SETTINGS['cpassman_dir'].'/pages/emails.js.php';
1285 1285
         } elseif ($get['page'] === 'ldap') {
1286
-            include_once $SETTINGS['cpassman_dir'] . '/pages/ldap.js.php';
1286
+            include_once $SETTINGS['cpassman_dir'].'/pages/ldap.js.php';
1287 1287
         } elseif ($get['page'] === 'uploads') {
1288
-            include_once $SETTINGS['cpassman_dir'] . '/pages/uploads.js.php';
1288
+            include_once $SETTINGS['cpassman_dir'].'/pages/uploads.js.php';
1289 1289
         } elseif ($get['page'] === 'actions') {
1290
-            include_once $SETTINGS['cpassman_dir'] . '/pages/actions.js.php';
1290
+            include_once $SETTINGS['cpassman_dir'].'/pages/actions.js.php';
1291 1291
         } elseif ($get['page'] === 'fields') {
1292
-            include_once $SETTINGS['cpassman_dir'] . '/pages/fields.js.php';
1292
+            include_once $SETTINGS['cpassman_dir'].'/pages/fields.js.php';
1293 1293
         } elseif ($get['page'] === 'options') {
1294
-            include_once $SETTINGS['cpassman_dir'] . '/pages/options.js.php';
1294
+            include_once $SETTINGS['cpassman_dir'].'/pages/options.js.php';
1295 1295
         } elseif ($get['page'] === 'statistics') {
1296
-            include_once $SETTINGS['cpassman_dir'] . '/pages/statistics.js.php';
1296
+            include_once $SETTINGS['cpassman_dir'].'/pages/statistics.js.php';
1297 1297
         }
1298 1298
     } elseif (isset($get['page']) === true && $get['page'] !== '') {
1299 1299
         if ($get['page'] === 'items') {
1300
-            include_once $SETTINGS['cpassman_dir'] . '/pages/items.js.php';
1300
+            include_once $SETTINGS['cpassman_dir'].'/pages/items.js.php';
1301 1301
         } elseif ($get['page'] === 'import') {
1302
-            include_once $SETTINGS['cpassman_dir'] . '/pages/import.js.php';
1302
+            include_once $SETTINGS['cpassman_dir'].'/pages/import.js.php';
1303 1303
         } elseif ($get['page'] === 'export') {
1304
-            include_once $SETTINGS['cpassman_dir'] . '/pages/export.js.php';
1304
+            include_once $SETTINGS['cpassman_dir'].'/pages/export.js.php';
1305 1305
         } elseif ($get['page'] === 'offline') {
1306
-            include_once $SETTINGS['cpassman_dir'] . '/pages/offline.js.php';
1306
+            include_once $SETTINGS['cpassman_dir'].'/pages/offline.js.php';
1307 1307
         } elseif ($get['page'] === 'search') {
1308
-            include_once $SETTINGS['cpassman_dir'] . '/pages/search.js.php';
1308
+            include_once $SETTINGS['cpassman_dir'].'/pages/search.js.php';
1309 1309
         } elseif ($get['page'] === 'profile') {
1310
-            include_once $SETTINGS['cpassman_dir'] . '/pages/profile.js.php';
1310
+            include_once $SETTINGS['cpassman_dir'].'/pages/profile.js.php';
1311 1311
         } elseif ($get['page'] === 'favourites') {
1312
-            include_once $SETTINGS['cpassman_dir'] . '/pages/favorites.js.php';
1312
+            include_once $SETTINGS['cpassman_dir'].'/pages/favorites.js.php';
1313 1313
         } elseif ($get['page'] === 'folders') {
1314
-            include_once $SETTINGS['cpassman_dir'] . '/pages/folders.js.php';
1314
+            include_once $SETTINGS['cpassman_dir'].'/pages/folders.js.php';
1315 1315
         } elseif ($get['page'] === 'users') {
1316
-            include_once $SETTINGS['cpassman_dir'] . '/pages/users.js.php';
1316
+            include_once $SETTINGS['cpassman_dir'].'/pages/users.js.php';
1317 1317
         } elseif ($get['page'] === 'roles') {
1318
-            include_once $SETTINGS['cpassman_dir'] . '/pages/roles.js.php';
1318
+            include_once $SETTINGS['cpassman_dir'].'/pages/roles.js.php';
1319 1319
         } elseif ($get['page'] === 'utilities.deletion') {
1320
-            include_once $SETTINGS['cpassman_dir'] . '/pages/utilities.deletion.js.php';
1320
+            include_once $SETTINGS['cpassman_dir'].'/pages/utilities.deletion.js.php';
1321 1321
         } elseif ($get['page'] === 'utilities.logs') {
1322
-            include_once $SETTINGS['cpassman_dir'] . '/pages/utilities.logs.js.php';
1322
+            include_once $SETTINGS['cpassman_dir'].'/pages/utilities.logs.js.php';
1323 1323
         } elseif ($get['page'] === 'utilities.database') {
1324
-            include_once $SETTINGS['cpassman_dir'] . '/pages/utilities.database.js.php';
1324
+            include_once $SETTINGS['cpassman_dir'].'/pages/utilities.database.js.php';
1325 1325
         } elseif ($get['page'] === 'utilities.renewal') {
1326
-            include_once $SETTINGS['cpassman_dir'] . '/pages/utilities.renewal.js.php';
1326
+            include_once $SETTINGS['cpassman_dir'].'/pages/utilities.renewal.js.php';
1327 1327
         }
1328 1328
     } else {
1329
-        include_once $SETTINGS['cpassman_dir'] . '/includes/core/login.js.php';
1329
+        include_once $SETTINGS['cpassman_dir'].'/includes/core/login.js.php';
1330 1330
     }
1331 1331
 }
Please login to merge, or discard this patch.
sources/export.queries.php 1 patch
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -50,26 +50,26 @@  discard block
 block discarded – undo
50 50
 }
51 51
 
52 52
 // Do checks
53
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
54
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
53
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
54
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
55 55
 if (checkUser($_SESSION['user_id'], $_SESSION['key'], 'items', $SETTINGS) === false) {
56 56
     // Not allowed page
57 57
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
58
-    include $SETTINGS['cpassman_dir'] . '/error.php';
58
+    include $SETTINGS['cpassman_dir'].'/error.php';
59 59
     exit();
60 60
 }
61 61
 
62 62
 // No time limit
63 63
 set_time_limit(0);
64 64
 
65
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
65
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
66 66
 header('Content-type: text/html; charset=utf-8');
67 67
 error_reporting(E_ERROR);
68
-require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
69
-require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
68
+require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
69
+require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
70 70
 
71 71
 // Connect to mysql server
72
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
72
+require_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,12 +83,12 @@  discard block
 block discarded – undo
83 83
 DB::$connect_options = DB_CONNECT_OPTIONS;
84 84
 
85 85
 // Build tree
86
-$tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
86
+$tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
87 87
 $tree->register();
88 88
 $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
89 89
 
90 90
 // User's language loading
91
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
91
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
92 92
 
93 93
 // Prepare POST variables
94 94
 $id = filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT);
@@ -139,9 +139,9 @@  discard block
 block discarded – undo
139 139
                         'SELECT i.id as id, i.id_tree as id_tree, i.restricted_to as restricted_to, i.perso as perso,
140 140
                             i.label as label, i.description as description, i.pw as pw, i.login as login, i.url as url,
141 141
                             i.email as email,l.date as date, i.pw_iv as pw_iv,n.renewal_period as renewal_period
142
-                        FROM ' . prefixTable('items') . ' as i
143
-                        INNER JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree = n.id)
144
-                        INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id = l.id_item)
142
+                        FROM ' . prefixTable('items').' as i
143
+                        INNER JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree = n.id)
144
+                        INNER JOIN ' . prefixTable('log_items').' as l ON (i.id = l.id_item)
145 145
                         WHERE i.inactif = %i
146 146
                         AND i.id_tree= %i
147 147
                         AND (l.action = %s OR (l.action = %s AND l.raison LIKE %s))
@@ -164,8 +164,8 @@  discard block
 block discarded – undo
164 164
                                 // Run query
165 165
                                 $dataItem = DB::queryfirstrow(
166 166
                                     'SELECT i.pw AS pw, s.share_key AS share_key
167
-                                    FROM ' . prefixTable('items') . ' AS i
168
-                                    INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (s.object_id = i.id)
167
+                                    FROM ' . prefixTable('items').' AS i
168
+                                    INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (s.object_id = i.id)
169 169
                                     WHERE user_id = %i AND i.id = %i',
170 170
                                     $_SESSION['user_id'],
171 171
                                     $record['id']
@@ -189,8 +189,8 @@  discard block
 block discarded – undo
189 189
                                 $arr_kbs = [];
190 190
                                 $rows_kb = DB::query(
191 191
                                     'SELECT b.label, b.id
192
-                                    FROM ' . prefixTable('kb_items') . ' AS a
193
-                                    INNER JOIN ' . prefixTable('kb') . ' AS b ON (a.kb_id = b.id)
192
+                                    FROM ' . prefixTable('kb_items').' AS a
193
+                                    INNER JOIN ' . prefixTable('kb').' AS b ON (a.kb_id = b.id)
194 194
                                     WHERE a.item_id = %i',
195 195
                                     $record['id']
196 196
                                 );
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
                                 $arr_tags = [];
203 203
                                 $rows_tag = DB::query(
204 204
                                     'SELECT tag
205
-                                    FROM ' . prefixTable('tags') . '
205
+                                    FROM ' . prefixTable('tags').'
206 206
                                     WHERE item_id = %i',
207 207
                                     $record['id']
208 208
                                 );
@@ -249,14 +249,14 @@  discard block
 block discarded – undo
249 249
                 $tmp .= array2csv($value);
250 250
             }
251 251
 
252
-            echo '[{"content":"' . base64_encode($tmp) . '"}]';
252
+            echo '[{"content":"'.base64_encode($tmp).'"}]';
253 253
             break;
254 254
 
255 255
             /*
256 256
          * PDF - step 1 - Prepare database
257 257
          */
258 258
         case 'initialize_export_table':
259
-            DB::query('TRUNCATE TABLE ' . prefixTable('export'));
259
+            DB::query('TRUNCATE TABLE '.prefixTable('export'));
260 260
             break;
261 261
 
262 262
             /*
@@ -305,9 +305,9 @@  discard block
 block discarded – undo
305 305
                     'SELECT i.id as id, i.restricted_to as restricted_to, i.perso as perso, i.label as label, i.description as description, i.pw as pw, i.login as login, i.url as url, i.email as email,
306 306
                         l.date as date, i.pw_iv as pw_iv,
307 307
                         n.renewal_period as renewal_period
308
-                        FROM ' . prefixTable('items') . ' as i
309
-                        INNER JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree = n.id)
310
-                        INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id = l.id_item)
308
+                        FROM ' . prefixTable('items').' as i
309
+                        INNER JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree = n.id)
310
+                        INNER JOIN ' . prefixTable('log_items').' as l ON (i.id = l.id_item)
311 311
                         WHERE i.inactif = %i
312 312
                         AND i.id_tree= %i
313 313
                         AND (l.action = %s OR (l.action = %s AND l.raison LIKE %s))
@@ -333,8 +333,8 @@  discard block
 block discarded – undo
333 333
                             // Run query
334 334
                             $dataItem = DB::queryfirstrow(
335 335
                                 'SELECT i.pw AS pw, s.share_key AS share_key
336
-                                FROM ' . prefixTable('items') . ' AS i
337
-                                INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (s.object_id = i.id)
336
+                                FROM ' . prefixTable('items').' AS i
337
+                                INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (s.object_id = i.id)
338 338
                                 WHERE user_id = %i AND i.id = %i',
339 339
                                 $_SESSION['user_id'],
340 340
                                 $record['id']
@@ -358,8 +358,8 @@  discard block
 block discarded – undo
358 358
                             $arr_kbs = '';
359 359
                             $rows_kb = DB::query(
360 360
                                 'SELECT b.label, b.id
361
-                                FROM ' . prefixTable('kb_items') . ' AS a
362
-                                INNER JOIN ' . prefixTable('kb') . ' AS b ON (a.kb_id = b.id)
361
+                                FROM ' . prefixTable('kb_items').' AS a
362
+                                INNER JOIN ' . prefixTable('kb').' AS b ON (a.kb_id = b.id)
363 363
                                 WHERE a.item_id = %i',
364 364
                                 $record['id']
365 365
                             );
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
                                 if (empty($arr_kbs)) {
368 368
                                     $arr_kbs = $rec_kb['label'];
369 369
                                 } else {
370
-                                    $arr_kbs .= ' | ' . $rec_kb['label'];
370
+                                    $arr_kbs .= ' | '.$rec_kb['label'];
371 371
                                 }
372 372
                             }
373 373
 
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
                             $arr_tags = '';
376 376
                             $rows_tag = DB::query(
377 377
                                 'SELECT tag
378
-                                FROM ' . prefixTable('tags') . '
378
+                                FROM ' . prefixTable('tags').'
379 379
                                 WHERE item_id = %i',
380 380
                                 $record['id']
381 381
                             );
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
                                 if (empty($arr_tags)) {
384 384
                                     $arr_tags = $rec_tag['tag'];
385 385
                                 } else {
386
-                                    $arr_tags .= ' ' . $rec_tag['tag'];
386
+                                    $arr_tags .= ' '.$rec_tag['tag'];
387 387
                                 }
388 388
                             }
389 389
 
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
             //header('Content-type: application/pdf');
458 458
 
459 459
             // query
460
-            $rows = DB::query('SELECT * FROM ' . prefixTable('export'));
460
+            $rows = DB::query('SELECT * FROM '.prefixTable('export'));
461 461
             $counter = DB::count();
462 462
             if ($counter > 0) {
463 463
                 define('K_TCPDF_THROW_EXCEPTION_ERROR', true);
@@ -466,8 +466,8 @@  discard block
 block discarded – undo
466 466
                 $prev_path = '';
467 467
 
468 468
                 //Prepare the PDF file
469
-                require_once($SETTINGS['cpassman_dir'] . '/includes/libraries/Pdf/tcpdf/config/tcpdf_config.php');
470
-                include $SETTINGS['cpassman_dir'] . '/includes/libraries/Pdf/tcpdf/tcpdf.php';
469
+                require_once($SETTINGS['cpassman_dir'].'/includes/libraries/Pdf/tcpdf/config/tcpdf_config.php');
470
+                include $SETTINGS['cpassman_dir'].'/includes/libraries/Pdf/tcpdf/tcpdf.php';
471 471
 
472 472
                 $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
473 473
                 $pdf->SetProtection(array('print'), $dataReceived['pdf_password'], null);
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
 
480 480
                 // set default header data
481 481
                 $pdf->SetHeaderData(
482
-                    $SETTINGS['cpassman_dir'] . '/includes/images/teampass-logo2-home.png',
482
+                    $SETTINGS['cpassman_dir'].'/includes/images/teampass-logo2-home.png',
483 483
                     PDF_HEADER_LOGO_WIDTH,
484 484
                     'Teampass export',
485 485
                     $_SESSION['lastname']." ".$_SESSION['name'].' @ '.date($SETTINGS['date_format']." ".$SETTINGS['time_format'], (int) time())
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
                 logEvents($SETTINGS, 'pdf_export', '', (string) $_SESSION['user_id'], $_SESSION['login']);
584 584
 
585 585
                 //clean table
586
-                DB::query('TRUNCATE TABLE ' . prefixTable('export'));
586
+                DB::query('TRUNCATE TABLE '.prefixTable('export'));
587 587
 
588 588
                 // Clean any content of the output buffer
589 589
                 ob_end_clean();
@@ -598,8 +598,8 @@  discard block
 block discarded – undo
598 598
             // step 1:
599 599
             // - prepare export file
600 600
             // - get full list of objects id to export
601
-            include $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
602
-            include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/GibberishAES/GibberishAES.php';
601
+            include $SETTINGS['cpassman_dir'].'/includes/config/include.php';
602
+            include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/GibberishAES/GibberishAES.php';
603 603
             $idsList = array();
604 604
 
605 605
             foreach (explode(';', $post_ids) as $id) {
@@ -611,9 +611,9 @@  discard block
 block discarded – undo
611 611
                     // count elements to display
612 612
                     $result = DB::query(
613 613
                         'SELECT i.id AS id, i.label AS label, i.restricted_to AS restricted_to, i.perso AS perso
614
-                    FROM ' . prefixTable('items') . ' as i
615
-                    INNER JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree = n.id)
616
-                    INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id = l.id_item)
614
+                    FROM ' . prefixTable('items').' as i
615
+                    INNER JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree = n.id)
616
+                    INNER JOIN ' . prefixTable('log_items').' as l ON (i.id = l.id_item)
617 617
                     WHERE i.inactif = %i
618 618
                     AND i.id_tree= %i
619 619
                     AND (l.action = %s OR (l.action = %s AND l.raison LIKE %s))
@@ -641,9 +641,9 @@  discard block
 block discarded – undo
641 641
 
642 642
             // prepare export file
643 643
             //save the file
644
-            $html_file = '/teampass_export_' . time() . '_' . generateKey() . '.html';
644
+            $html_file = '/teampass_export_'.time().'_'.generateKey().'.html';
645 645
             //print_r($full_listing);
646
-            $outstream = fopen($SETTINGS['path_to_files_folder'] . $html_file, 'w');
646
+            $outstream = fopen($SETTINGS['path_to_files_folder'].$html_file, 'w');
647 647
             if ($outstream === false) {
648 648
                 echo '[{"error":"true"}]';
649 649
                 break;
@@ -667,12 +667,12 @@  discard block
 block discarded – undo
667 667
     </style>
668 668
     </head>
669 669
     <body>
670
-    <input type="hidden" id="generation_date" value="' . GibberishAES::enc(/** @scrutinizer ignore-type */ (string) time(), $post_pdf_password) . '" />
670
+    <input type="hidden" id="generation_date" value="' . GibberishAES::enc(/** @scrutinizer ignore-type */ (string) time(), $post_pdf_password).'" />
671 671
     <div id="header">
672
-    ' . TP_TOOL_NAME . ' - Off Line mode
672
+    ' . TP_TOOL_NAME.' - Off Line mode
673 673
     </div>
674 674
     <div style="margin:10px; font-size:9px;">
675
-    <i>This page was generated by <b>' . $_SESSION['name'] . ' ' . $_SESSION['lastname'] . '</b>, the ' . date('Y/m/d H:i:s') . '.</i>
675
+    <i>This page was generated by <b>' . $_SESSION['name'].' '.$_SESSION['lastname'].'</b>, the '.date('Y/m/d H:i:s').'.</i>
676 676
     <span id="info_page" style="margin-left:20px; font-weight:bold; font-size: 14px; color:red;"></span>
677 677
     </div>
678 678
     <div id="information"></div>
@@ -683,11 +683,11 @@  discard block
 block discarded – undo
683 683
     <div>
684 684
     <table id="itemsTable">
685 685
         <thead><tr>
686
-            <th style="width:15%;">' . $LANG['label'] . '</th>
687
-            <th style="width:10%;">' . $LANG['pw'] . '</th>
688
-            <th style="width:30%;">' . $LANG['description'] . '</th>
689
-            <th style="width:5%;">' . $LANG['user_login'] . '</th>
690
-            <th style="width:20%;">' . $LANG['url'] . '</th>
686
+            <th style="width:15%;">' . $LANG['label'].'</th>
687
+            <th style="width:10%;">' . $LANG['pw'].'</th>
688
+            <th style="width:30%;">' . $LANG['description'].'</th>
689
+            <th style="width:5%;">' . $LANG['user_login'].'</th>
690
+            <th style="width:20%;">' . $LANG['url'].'</th>
691 691
         </tr></thead>
692 692
         <tbody id="itemsTable_tbody">'
693 693
             );
@@ -712,22 +712,22 @@  discard block
 block discarded – undo
712 712
                 || in_array($post_idTree, $_SESSION['groupes_visibles']) === false
713 713
                 || (in_array($post_idTree, $_SESSION['no_access_folders']) === true)
714 714
             ) {
715
-                echo '[{"loop":"true", "number":"' . $post_number . '", "cpt":"' . $post_cpt . '", "file":"' . $post_file . '", "idsList":"' . $post_idsList . '" , "file_link":"' . $post_file_link . '"}]';
715
+                echo '[{"loop":"true", "number":"'.$post_number.'", "cpt":"'.$post_cpt.'", "file":"'.$post_file.'", "idsList":"'.$post_idsList.'" , "file_link":"'.$post_file_link.'"}]';
716 716
                 break;
717 717
             }
718 718
 
719 719
             $full_listing = array();
720 720
             $items_id_list = array();
721
-            include $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
722
-            include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/GibberishAES/GibberishAES.php';
721
+            include $SETTINGS['cpassman_dir'].'/includes/config/include.php';
722
+            include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/GibberishAES/GibberishAES.php';
723 723
 
724 724
             $rows = DB::query(
725 725
                 'SELECT i.id as id, i.url as url, i.perso as perso, i.label as label, i.description as description, i.pw as pw, i.login as login, i.id_tree as id_tree,
726 726
                 l.date as date, i.pw_iv as pw_iv,
727 727
                 n.renewal_period as renewal_period
728
-            FROM ' . prefixTable('items') . ' as i
729
-            INNER JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree = n.id)
730
-            INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id = l.id_item)
728
+            FROM ' . prefixTable('items').' as i
729
+            INNER JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree = n.id)
730
+            INNER JOIN ' . prefixTable('log_items').' as l ON (i.id = l.id_item)
731 731
             WHERE i.inactif = %i
732 732
             AND i.id_tree= %i
733 733
             AND (l.action = %s OR (l.action = %s AND l.raison LIKE %s))
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
             }
788 788
 
789 789
             //save in export file
790
-            $outstream = fopen($post_file . '.txt', 'a');
790
+            $outstream = fopen($post_file.'.txt', 'a');
791 791
             if ($outstream === false) {
792 792
                 echo '[{"error":"true"}]';
793 793
                 break;
@@ -825,13 +825,13 @@  discard block
 block discarded – undo
825 825
                         if (empty($arboHtml)) {
826 826
                             $arboHtml = $arboHtml_tmp;
827 827
                         } else {
828
-                            $arboHtml .= ' » ' . $arboHtml_tmp;
828
+                            $arboHtml .= ' » '.$arboHtml_tmp;
829 829
                         }
830 830
                     }
831 831
                     fputs(
832 832
                         $outstream,
833 833
                         '
834
-        <tr class="path"><td colspan="5">' . $arboHtml . '</td></tr>'
834
+        <tr class="path"><td colspan="5">' . $arboHtml.'</td></tr>'
835 835
                     );
836 836
                     $idTree = $elem['id_tree'];
837 837
                 }
@@ -840,12 +840,12 @@  discard block
 block discarded – undo
840 840
                 fputs(
841 841
                     $outstream,
842 842
                     '
843
-        <tr class="' . $lineType . '">
844
-            <td>' . addslashes($elem['label']) . '</td>
845
-            <td align="center"><span class="span_pw" id="span_' . $elem['id'] . '"><a href="#" onclick="decryptme(' . $elem['id'] . ', \'' . $encPw . '\');return false;">Decrypt </a></span><input type="hidden" id="hide_' . $elem['id'] . '" value="' . $encPw . '" /></td>
846
-            <td>' . $desc . '</td>
847
-            <td align="center">' . $login . '</td>
848
-            <td align="center">' . $url . '</td>
843
+        <tr class="' . $lineType.'">
844
+            <td>' . addslashes($elem['label']).'</td>
845
+            <td align="center"><span class="span_pw" id="span_' . $elem['id'].'"><a href="#" onclick="decryptme('.$elem['id'].', \''.$encPw.'\');return false;">Decrypt </a></span><input type="hidden" id="hide_'.$elem['id'].'" value="'.$encPw.'" /></td>
846
+            <td>' . $desc.'</td>
847
+            <td align="center">' . $login.'</td>
848
+            <td align="center">' . $url.'</td>
849 849
             </tr>'
850 850
                 );
851 851
             }
@@ -853,29 +853,29 @@  discard block
 block discarded – undo
853 853
             fclose($outstream);
854 854
 
855 855
             // send back and continue
856
-            echo '[{"loop":"true", "number":"' . $post_number . '", "cpt":"' . $post_cpt . '", "file":"' . $post_file . '", "idsList":"' . $post_idsList . '" , "file_link":"' . $post_file_link . '"}]';
856
+            echo '[{"loop":"true", "number":"'.$post_number.'", "cpt":"'.$post_cpt.'", "file":"'.$post_file.'", "idsList":"'.$post_idsList.'" , "file_link":"'.$post_file_link.'"}]';
857 857
             break;
858 858
 
859 859
             //CASE export in HTML format - Iteration loop
860 860
         case 'export_to_html_format_finalize':
861 861
             // Load includes
862
-            include $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
863
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/GibberishAES/GibberishAES.php';
862
+            include $SETTINGS['cpassman_dir'].'/includes/config/include.php';
863
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/GibberishAES/GibberishAES.php';
864 864
 
865 865
             // read the content of the temporary file
866
-            $handle = fopen($post_file . '.txt', 'r');
866
+            $handle = fopen($post_file.'.txt', 'r');
867 867
             if ($handle === false) {
868 868
                 echo '[{"error":"true"}]';
869 869
                 break;
870 870
             }
871
-            $contents = fread($handle, filesize($post_file . '.txt'));
871
+            $contents = fread($handle, filesize($post_file.'.txt'));
872 872
             if ($contents === false) {
873 873
                 echo '[{"error":"true"}]';
874 874
                 break;
875 875
             }
876 876
             fclose($handle);
877
-            if (is_file($post_file . '.txt')) {
878
-                unlink($post_file . '.txt');
877
+            if (is_file($post_file.'.txt')) {
878
+                unlink($post_file.'.txt');
879 879
             }
880 880
 
881 881
             // Encrypt its content
@@ -886,7 +886,7 @@  discard block
 block discarded – undo
886 886
                 if (empty($encrypted_text) === true) {
887 887
                     $encrypted_text = GibberishAES::enc(/** @scrutinizer ignore-type */ $chunk, $post_pdf_password);
888 888
                 } else {
889
-                    $encrypted_text .= '|#|#|' . GibberishAES::enc(/** @scrutinizer ignore-type */ $chunk, $post_pdf_password);
889
+                    $encrypted_text .= '|#|#|'.GibberishAES::enc(/** @scrutinizer ignore-type */ $chunk, $post_pdf_password);
890 890
                 }
891 891
             }
892 892
 
@@ -903,9 +903,9 @@  discard block
 block discarded – undo
903 903
         </table></div>
904 904
         <input type="button" value="Hide all" onclick="hideAll()" />
905 905
         <div id="footer" style="text-align:center;">
906
-            <a href="https://teampass.net/about/" target="_blank" style="">' . TP_TOOL_NAME . '&nbsp;' . TP_VERSION_FULL . '&nbsp;' . TP_COPYRIGHT . '</a>
906
+            <a href="https://teampass.net/about/" target="_blank" style="">' . TP_TOOL_NAME.'&nbsp;'.TP_VERSION_FULL.'&nbsp;'.TP_COPYRIGHT.'</a>
907 907
         </div>
908
-        <div id="enc_html" style="display:none;">' . $encrypted_text . '</div>
908
+        <div id="enc_html" style="display:none;">' . $encrypted_text.'</div>
909 909
         </body>
910 910
     </html>
911 911
     <script type="text/javascript">
@@ -1011,9 +1011,9 @@  discard block
 block discarded – undo
1011 1011
 
1012 1012
             fclose($outstream);
1013 1013
 
1014
-            echo '[{"text":"<a href=\'' .
1015
-                $post_file_link .
1016
-                '\' target=\'_blank\'>' . $LANG['pdf_download'] . '</a>"}]';
1014
+            echo '[{"text":"<a href=\''.
1015
+                $post_file_link.
1016
+                '\' target=\'_blank\'>'.$LANG['pdf_download'].'</a>"}]';
1017 1017
             break;
1018 1018
     }
1019 1019
 }
Please login to merge, or discard this patch.
sources/expired.datatables.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 require_once 'SecureHandler.php';
29 29
 session_name('teampass_session');
30 30
 session_start();
31
-if (! isset($_SESSION['CPM']) || $_SESSION['CPM'] === false || ! isset($_SESSION['key']) || empty($_SESSION['key'])) {
31
+if (!isset($_SESSION['CPM']) || $_SESSION['CPM'] === false || !isset($_SESSION['key']) || empty($_SESSION['key'])) {
32 32
     die('Hacking attempt...');
33 33
 }
34 34
 
@@ -42,22 +42,22 @@  discard block
 block discarded – undo
42 42
 }
43 43
 
44 44
 // Do checks
45
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
46
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
45
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
46
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
47 47
 if (checkUser($_SESSION['user_id'], $_SESSION['key'], 'folders', $SETTINGS) === false) {
48 48
     // Not allowed page
49 49
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
50
-    include $SETTINGS['cpassman_dir'] . '/error.php';
50
+    include $SETTINGS['cpassman_dir'].'/error.php';
51 51
     exit;
52 52
 }
53 53
 
54
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
55
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
54
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
55
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
56 56
 header('Content-type: text/html; charset=utf-8');
57 57
 header('Cache-Control: no-cache, must-revalidate');
58 58
 require_once 'main.functions.php';
59 59
 // Connect to mysql server
60
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
60
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
61 61
 if (defined('DB_PASSWD_CLEAR') === false) {
62 62
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
63 63
 }
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
 DB::$ssl = DB_SSL;
71 71
 DB::$connect_options = DB_CONNECT_OPTIONS;
72 72
 // Class loader
73
-require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
73
+require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
74 74
 //Build tree
75
-$tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
75
+$tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
76 76
 $tree->register();
77 77
 $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
78 78
 //Columns name
@@ -83,22 +83,22 @@  discard block
 block discarded – undo
83 83
 $sOrder = $sLimit = '';
84 84
 // Is a date sent?
85 85
 if (isset($_GET['dateCriteria']) === true && empty($_GET['dateCriteria']) === false) {
86
-    $sWhere .= ' AND a.del_value < ' . round(filter_var($_GET['dateCriteria'], FILTER_SANITIZE_NUMBER_INT) / 1000, 0);
86
+    $sWhere .= ' AND a.del_value < '.round(filter_var($_GET['dateCriteria'], FILTER_SANITIZE_NUMBER_INT) / 1000, 0);
87 87
 }
88 88
 //echo $sWhere;
89 89
 /* BUILD QUERY */
90 90
 //Paging
91 91
 $sLimit = '';
92 92
 if (isset($_GET['length']) === true && (int) $_GET['length'] !== -1) {
93
-    $sLimit = ' LIMIT ' . filter_var($_GET['start'], FILTER_SANITIZE_NUMBER_INT) . ', ' . filter_var($_GET['length'], FILTER_SANITIZE_NUMBER_INT) . '';
93
+    $sLimit = ' LIMIT '.filter_var($_GET['start'], FILTER_SANITIZE_NUMBER_INT).', '.filter_var($_GET['length'], FILTER_SANITIZE_NUMBER_INT).'';
94 94
 }
95 95
 
96 96
 //Ordering
97 97
 if (isset($_GET['order'][0]['dir']) && in_array($_GET['order'][0]['dir'], $aSortTypes)) {
98 98
     $sOrder = 'ORDER BY  ';
99 99
     if (preg_match('#^(asc|desc)$#i', $_GET['order'][0]['column'])) {
100
-        $sOrder .= '' . $aColumns[filter_var($_GET['order'][0]['column'], FILTER_SANITIZE_NUMBER_INT)] . ' '
101
-            . filter_var($_GET['order'][0]['column'], FILTER_SANITIZE_STRING) . ', ';
100
+        $sOrder .= ''.$aColumns[filter_var($_GET['order'][0]['column'], FILTER_SANITIZE_NUMBER_INT)].' '
101
+            . filter_var($_GET['order'][0]['column'], FILTER_SANITIZE_STRING).', ';
102 102
     }
103 103
 
104 104
     $sOrder = substr_replace($sOrder, '', -2);
@@ -119,29 +119,29 @@  discard block
 block discarded – undo
119 119
     && $_GET['letter'] !== 'None'
120 120
 ) {
121 121
     $sWhere .= ' AND ';
122
-    $sWhere .= $aColumns[1] . " LIKE '" . filter_var($_GET['letter'], FILTER_SANITIZE_STRING) . "%' OR ";
123
-    $sWhere .= $aColumns[2] . " LIKE '" . filter_var($_GET['letter'], FILTER_SANITIZE_STRING) . "%' OR ";
124
-    $sWhere .= $aColumns[3] . " LIKE '" . filter_var($_GET['letter'], FILTER_SANITIZE_STRING) . "%' ";
122
+    $sWhere .= $aColumns[1]." LIKE '".filter_var($_GET['letter'], FILTER_SANITIZE_STRING)."%' OR ";
123
+    $sWhere .= $aColumns[2]." LIKE '".filter_var($_GET['letter'], FILTER_SANITIZE_STRING)."%' OR ";
124
+    $sWhere .= $aColumns[3]." LIKE '".filter_var($_GET['letter'], FILTER_SANITIZE_STRING)."%' ";
125 125
 } elseif (isset($_GET['search']['value']) === true && $_GET['search']['value'] !== '') {
126 126
     $sWhere = ' AND ';
127
-    $sWhere .= $aColumns[1] . " LIKE '" . filter_var($_GET['search']['value'], FILTER_SANITIZE_STRING) . "%' OR ";
128
-    $sWhere .= $aColumns[2] . " LIKE '" . filter_var($_GET['search']['value'], FILTER_SANITIZE_STRING) . "%' OR ";
129
-    $sWhere .= $aColumns[3] . " LIKE '" . filter_var($_GET['search']['value'], FILTER_SANITIZE_STRING) . "%' ";
127
+    $sWhere .= $aColumns[1]." LIKE '".filter_var($_GET['search']['value'], FILTER_SANITIZE_STRING)."%' OR ";
128
+    $sWhere .= $aColumns[2]." LIKE '".filter_var($_GET['search']['value'], FILTER_SANITIZE_STRING)."%' OR ";
129
+    $sWhere .= $aColumns[3]." LIKE '".filter_var($_GET['search']['value'], FILTER_SANITIZE_STRING)."%' ";
130 130
 }
131 131
 
132 132
 $rows = DB::query(
133 133
     'SELECT a.item_id, i.label, a.del_value, i.id_tree
134
-    FROM ' . prefixTable('automatic_del') . ' AS a
135
-    INNER JOIN ' . prefixTable('items') . ' AS i ON (i.id = a.item_id)' .
134
+    FROM ' . prefixTable('automatic_del').' AS a
135
+    INNER JOIN ' . prefixTable('items').' AS i ON (i.id = a.item_id)'.
136 136
     $sWhere.
137 137
     (string) $sOrder
138 138
 );
139 139
 $iTotal = DB::count();
140 140
 $rows = DB::query(
141 141
     'SELECT a.item_id, i.label, a.del_value, i.id_tree
142
-    FROM ' . prefixTable('automatic_del') . ' AS a
143
-    INNER JOIN ' . prefixTable('items') . ' AS i ON (i.id = a.item_id)' .
144
-        $sWhere .
142
+    FROM ' . prefixTable('automatic_del').' AS a
143
+    INNER JOIN ' . prefixTable('items').' AS i ON (i.id = a.item_id)'.
144
+        $sWhere.
145 145
         $sLimit
146 146
 );
147 147
 $iFilteredTotal = DB::count();
@@ -159,18 +159,18 @@  discard block
 block discarded – undo
159 159
     // start the line
160 160
     $sOutput .= '[';
161 161
     // Column 1
162
-    $sOutput .= '"<i class=\"fas fa-external-link-alt pointer text-primary mr-2\" onclick=\"showItemCard($(this))\" data-item-id=\"' . $record['item_id'] . '\"  data-item-tree-id=\"' . $record['id_tree'] . '\"></i>", ';
162
+    $sOutput .= '"<i class=\"fas fa-external-link-alt pointer text-primary mr-2\" onclick=\"showItemCard($(this))\" data-item-id=\"'.$record['item_id'].'\"  data-item-tree-id=\"'.$record['id_tree'].'\"></i>", ';
163 163
     // Column 2
164
-    $sOutput .= '"' . $record['label'] . '", ';
164
+    $sOutput .= '"'.$record['label'].'", ';
165 165
     // Column 3
166
-    $sOutput .= '"' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['del_value']) . '", ';
166
+    $sOutput .= '"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['del_value']).'", ';
167 167
     // Column 4
168 168
     $path = [];
169 169
     $treeDesc = $tree->getPath($record['id_tree'], true);
170 170
     foreach ($treeDesc as $t) {
171 171
         array_push($path, $t->title);
172 172
     }
173
-    $sOutput .= '"' . implode('<i class=\"fas fa-angle-right ml-1 mr-1\"></i>', $path) . '"],';
173
+    $sOutput .= '"'.implode('<i class=\"fas fa-angle-right ml-1 mr-1\"></i>', $path).'"],';
174 174
 }
175 175
 
176 176
 if ($iTotal > 0) {
@@ -183,4 +183,4 @@  discard block
 block discarded – undo
183 183
 }
184 184
 
185 185
 // finalize output
186
-echo '{"recordsTotal": ' . $iTotal . ', "recordsFiltered": ' . $iFilteredTotal . ', "data": ' . $sOutput;
186
+echo '{"recordsTotal": '.$iTotal.', "recordsFiltered": '.$iFilteredTotal.', "data": '.$sOutput;
Please login to merge, or discard this patch.
sources/identify.php 1 patch
Spacing   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -44,23 +44,23 @@  discard block
 block discarded – undo
44 44
     throw new Exception("Error file '/includes/config/tp.config.php' not exists", 1);
45 45
 }
46 46
 
47
-if (! isset($SETTINGS['cpassman_dir']) || empty($SETTINGS['cpassman_dir']) === true || $SETTINGS['cpassman_dir'] === '.') {
47
+if (!isset($SETTINGS['cpassman_dir']) || empty($SETTINGS['cpassman_dir']) === true || $SETTINGS['cpassman_dir'] === '.') {
48 48
     $SETTINGS = [];
49 49
     $SETTINGS['cpassman_dir'] = '..';
50 50
 }
51 51
 
52
-require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
53
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
54
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
52
+require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
53
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
54
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
55 55
 
56 56
 // If Debug then clean the files
57 57
 if (DEBUGLDAP === true) {
58
-    define('DEBUGLDAPFILE', $SETTINGS['path_to_files_folder'] . '/ldap.debug.txt');
58
+    define('DEBUGLDAPFILE', $SETTINGS['path_to_files_folder'].'/ldap.debug.txt');
59 59
     $fp = fopen(DEBUGLDAPFILE, 'w');
60 60
     fclose($fp);
61 61
 }
62 62
 if (DEBUGDUO === true) {
63
-    define('DEBUGDUOFILE', $SETTINGS['path_to_files_folder'] . '/duo.debug.txt');
63
+    define('DEBUGDUOFILE', $SETTINGS['path_to_files_folder'].'/duo.debug.txt');
64 64
     $fp = fopen(DEBUGDUOFILE, 'w');
65 65
     fclose($fp);
66 66
 }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 if (defined('DB_PASSWD_CLEAR') === false) {
77 77
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
78 78
 }
79
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
79
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
80 80
 if (defined('DB_PASSWD_CLEAR') === false) {
81 81
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
82 82
 }
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     // This step creates the DUO request encrypted key
96 96
 
97 97
     // load library
98
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/DuoSecurity/Duo.php';
98
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/DuoSecurity/Duo.php';
99 99
     $sig_request = Duo::signRequest(
100 100
         $SETTINGS['IKEY'],
101 101
         $SETTINGS['SKEY'],
@@ -106,16 +106,16 @@  discard block
 block discarded – undo
106 106
         debugIdentify(
107 107
             DEBUGDUO,
108 108
             DEBUGDUOFILE,
109
-            "\n\n-----\n\n" .
110
-                'sig request : ' . $post_login . "\n" .
111
-                'resp : ' . $sig_request . "\n"
109
+            "\n\n-----\n\n".
110
+                'sig request : '.$post_login."\n".
111
+                'resp : '.$sig_request."\n"
112 112
         );
113 113
     }
114 114
 
115 115
     // load csrfprotector
116
-    $csrfp_config = include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/csrfp/libs/csrfp.config.php';
116
+    $csrfp_config = include_once $SETTINGS['cpassman_dir'].'/includes/libraries/csrfp/libs/csrfp.config.php';
117 117
     // return result
118
-    echo '[{"sig_request" : "' . $sig_request . '" , "csrfp_token" : "' . $csrfp_config['CSRFP_TOKEN'] . '" , "csrfp_key" : "' . filter_var($_COOKIE[$csrfp_config['CSRFP_TOKEN']], FILTER_SANITIZE_STRING) . '"}]';
118
+    echo '[{"sig_request" : "'.$sig_request.'" , "csrfp_token" : "'.$csrfp_config['CSRFP_TOKEN'].'" , "csrfp_key" : "'.filter_var($_COOKIE[$csrfp_config['CSRFP_TOKEN']], FILTER_SANITIZE_STRING).'"}]';
119 119
 // ---
120 120
     // ---
121 121
 } elseif ($post_type === 'identify_duo_user_check') {
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
     //--------
126 126
 
127 127
     // load library
128
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/DuoSecurity/Duo.php';
128
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/DuoSecurity/Duo.php';
129 129
     $authenticated_username = Duo::verifyResponse(
130 130
         $SETTINGS['duo_ikey'],
131 131
         $SETTINGS['duo_skey'],
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
             // is user in Teampass?
141 141
             DB::queryfirstrow(
142 142
                 'SELECT id
143
-                FROM ' . prefixTable('users') . '
143
+                FROM ' . prefixTable('users').'
144 144
                 WHERE login = %s',
145 145
                 $post_login
146 146
             );
@@ -150,9 +150,9 @@  discard block
 block discarded – undo
150 150
             }
151 151
         }
152 152
 
153
-        echo '[{"authenticated_username" : "' . $authenticated_username . '"}]';
153
+        echo '[{"authenticated_username" : "'.$authenticated_username.'"}]';
154 154
     } else {
155
-        echo '[{"authenticated_username" : "' . $authenticated_username . '"}]';
155
+        echo '[{"authenticated_username" : "'.$authenticated_username.'"}]';
156 156
     }
157 157
     // ---
158 158
     // ---
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
     defineComplexity();
166 166
 
167 167
     // Load superGlobals
168
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
168
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
169 169
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
170 170
     // Prepare GET variables
171 171
     $sessionPwdAttempts = $superGlobal->get('pwd_attempts', 'SESSION');
@@ -247,19 +247,19 @@  discard block
 block discarded – undo
247 247
     if (findTpConfigFile() === false) {
248 248
         throw new Exception("Error file '/includes/config/tp.config.php' not exists", 1);
249 249
     }
250
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
251
-    include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
252
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
250
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
251
+    include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
252
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
253 253
     
254 254
     header('Content-type: text/html; charset=utf-8');
255 255
     error_reporting(E_ERROR);
256 256
 
257 257
     // Load AntiXSS
258
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php';
258
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php';
259 259
     $antiXss = new voku\helper\AntiXSS();
260 260
 
261 261
     // Load superGlobals
262
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
262
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
263 263
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
264 264
 
265 265
     // Prepare GET variables
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
     $server['PHP_AUTH_PW'] = $superGlobal->get('PHP_AUTH_PW', 'SERVER');
274 274
 
275 275
     // connect to the server
276
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
276
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
277 277
     DB::$host = DB_HOST;
278 278
     DB::$user = DB_USER;
279 279
     DB::$password = defined('DB_PASSWD_CLEAR') === false ? defuseReturnDecrypted(DB_PASSWD, $SETTINGS) : DB_PASSWD_CLEAR;
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
     DB::$ssl = DB_SSL;
284 284
     DB::$connect_options = DB_CONNECT_OPTIONS;
285 285
     // User's language loading
286
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $sessionUserLanguage . '.php';
286
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$sessionUserLanguage.'.php';
287 287
     
288 288
     // decrypt and retreive data in JSON format
289 289
     if (empty($sessionKey) === true) {
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
         if (count($superGlobal->get('user_roles', 'SESSION')) > 0) {
535 535
             $rolesList = DB::query(
536 536
                 'SELECT id, title, complexity
537
-                FROM ' . prefixTable('roles_title') . '
537
+                FROM ' . prefixTable('roles_title').'
538 538
                 WHERE id IN %li',
539 539
                 $superGlobal->get('user_roles', 'SESSION')
540 540
             );
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 
558 558
         // build complete array of roles
559 559
         $superGlobal->put('arr_roles_full', [], 'SESSION');
560
-        $rows = DB::query('SELECT id, title FROM ' . prefixTable('roles_title') . ' ORDER BY title ASC');
560
+        $rows = DB::query('SELECT id, title FROM '.prefixTable('roles_title').' ORDER BY title ASC');
561 561
         foreach ($rows as $record) {
562 562
             $superGlobal->put(
563 563
                 $record['id'],
@@ -629,10 +629,10 @@  discard block
 block discarded – undo
629 629
         $superGlobal->put('latest_items_tab', [], 'SESSION');
630 630
         $superGlobal->put('nb_roles', 0, 'SESSION');
631 631
         foreach ($superGlobal->get('latest_items', 'SESSION') as $item) {
632
-            if (! empty($item)) {
632
+            if (!empty($item)) {
633 633
                 $dataLastItems = DB::queryFirstRow(
634 634
                     'SELECT id,label,id_tree
635
-                    FROM ' . prefixTable('items') . '
635
+                    FROM ' . prefixTable('items').'
636 636
                     WHERE id=%i',
637 637
                     $item
638 638
                 );
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
                     [
642 642
                         'id' => $item,
643 643
                         'label' => $dataLastItems['label'],
644
-                        'url' => 'index.php?page=items&amp;group=' . $dataLastItems['id_tree'] . '&amp;id=' . $item,
644
+                        'url' => 'index.php?page=items&amp;group='.$dataLastItems['id_tree'].'&amp;id='.$item,
645 645
                     ],
646 646
                     'SESSION',
647 647
                     'latest_items_tab'
@@ -657,12 +657,12 @@  discard block
 block discarded – undo
657 657
         ) {
658 658
             // get all Admin users
659 659
             $receivers = '';
660
-            $rows = DB::query('SELECT email FROM ' . prefixTable('users') . " WHERE admin = %i and email != ''", 1);
660
+            $rows = DB::query('SELECT email FROM '.prefixTable('users')." WHERE admin = %i and email != ''", 1);
661 661
             foreach ($rows as $record) {
662 662
                 if (empty($receivers)) {
663 663
                     $receivers = $record['email'];
664 664
                 } else {
665
-                    $receivers = ',' . $record['email'];
665
+                    $receivers = ','.$record['email'];
666 666
                 }
667 667
             }
668 668
             // Add email to table
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
                             '#tp_time#',
679 679
                         ],
680 680
                         [
681
-                            ' ' . $superGlobal->get('login', 'SESSION') . ' (IP: ' . getClientIpServer() . ')',
681
+                            ' '.$superGlobal->get('login', 'SESSION').' (IP: '.getClientIpServer().')',
682 682
                             date($SETTINGS['date_format'], (int) $superGlobal->get('last_connection', 'SESSION')),
683 683
                             date($SETTINGS['time_format'], (int) $superGlobal->get('last_connection', 'SESSION')),
684 684
                         ],
@@ -832,7 +832,7 @@  discard block
 block discarded – undo
832 832
 {
833 833
     $rows = DB::query(
834 834
         'SELECT date
835
-        FROM ' . prefixTable('log_system') . "
835
+        FROM ' . prefixTable('log_system')."
836 836
         WHERE field_1 = %s
837 837
         AND type = 'failed_auth'
838 838
         AND label = 'password_is_not_correct'
@@ -846,7 +846,7 @@  discard block
 block discarded – undo
846 846
         foreach ($rows as $record) {
847 847
             array_push(
848 848
                 $arrAttempts,
849
-                date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date'])
849
+                date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date'])
850 850
             );
851 851
         }
852 852
     }
@@ -900,7 +900,7 @@  discard block
 block discarded – undo
900 900
     $ldapConnection
901 901
 ) : bool
902 902
 {
903
-    include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
903
+    include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
904 904
 
905 905
     if ((int) $userInfoDisabled === 1) {
906 906
         return false;
@@ -1103,44 +1103,44 @@  discard block
 block discarded – undo
1103 1103
 function authenticateThroughAD(string $username, array $userInfo, string $passwordClear, array $SETTINGS): array
1104 1104
 {
1105 1105
     // Load expected libraries
1106
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Illuminate/Contracts/Auth/Authenticatable.php';
1107
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/EnumeratesValues.php';
1108
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
1109
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/helpers.php';
1110
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php';
1111
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Contracts/Support/Jsonable.php';
1112
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Contracts/Support/Arrayable.php';
1113
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Enumerable.php';
1114
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Collection.php';
1115
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonTimeZone.php';
1116
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Units.php';
1117
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Week.php';
1118
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Timestamp.php';
1119
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Test.php';
1120
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/ObjectInitialisation.php';
1121
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Serialization.php';
1122
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/IntervalRounding.php';
1123
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Rounding.php';
1124
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Localization.php';
1125
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Options.php';
1126
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Cast.php';
1127
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mutability.php';
1128
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Modifiers.php';
1129
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mixin.php';
1130
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Macro.php';
1131
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Difference.php';
1132
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Creator.php';
1133
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Converter.php';
1134
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Comparison.php';
1135
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Boundaries.php';
1136
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Date.php';
1137
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonInterface.php';
1138
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Carbon.php';
1139
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php';
1140
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php';
1141
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php';
1142
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/HandlesConnection.php';
1143
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php';
1106
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Illuminate/Contracts/Auth/Authenticatable.php';
1107
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/EnumeratesValues.php';
1108
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
1109
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/helpers.php';
1110
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php';
1111
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Contracts/Support/Jsonable.php';
1112
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Contracts/Support/Arrayable.php';
1113
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Enumerable.php';
1114
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Collection.php';
1115
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonTimeZone.php';
1116
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Units.php';
1117
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Week.php';
1118
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Timestamp.php';
1119
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Test.php';
1120
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/ObjectInitialisation.php';
1121
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Serialization.php';
1122
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/IntervalRounding.php';
1123
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Rounding.php';
1124
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Localization.php';
1125
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Options.php';
1126
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Cast.php';
1127
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mutability.php';
1128
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Modifiers.php';
1129
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mixin.php';
1130
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Macro.php';
1131
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Difference.php';
1132
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Creator.php';
1133
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Converter.php';
1134
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Comparison.php';
1135
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Boundaries.php';
1136
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Date.php';
1137
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonInterface.php';
1138
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Carbon.php';
1139
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php';
1140
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php';
1141
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php';
1142
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/HandlesConnection.php';
1143
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php';
1144 1144
     $ad = new SplClassLoader('LdapRecord', '../includes/libraries');
1145 1145
     $ad->register();
1146 1146
 
@@ -1176,7 +1176,7 @@  discard block
 block discarded – undo
1176 1176
         // Get user info from AD
1177 1177
         // We want to isolate attribute ldap_user_attribute
1178 1178
         $userADInfos = $connection->query()
1179
-            ->where((isset($SETTINGS['ldap_user_attribute']) ===true && empty($SETTINGS['ldap_user_attribute']) === false) ? $SETTINGS['ldap_user_attribute'] : 'distinguishedname', '=', $username)
1179
+            ->where((isset($SETTINGS['ldap_user_attribute']) === true && empty($SETTINGS['ldap_user_attribute']) === false) ? $SETTINGS['ldap_user_attribute'] : 'distinguishedname', '=', $username)
1180 1180
             ->firstOrFail();
1181 1181
 
1182 1182
         // Check shadowexpire attribute - if === 1 then user disabled
@@ -1208,7 +1208,7 @@  discard block
 block discarded – undo
1208 1208
         $error = $e->getDetailedError();
1209 1209
         return [
1210 1210
             'error' => true,
1211
-            'message' => langHdl('error').' : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage(),
1211
+            'message' => langHdl('error').' : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage(),
1212 1212
 
1213 1213
         ];
1214 1214
     }
@@ -1222,7 +1222,7 @@  discard block
 block discarded – undo
1222 1222
     }
1223 1223
 
1224 1224
     // load passwordLib library
1225
-    $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1225
+    $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries');
1226 1226
     $pwdlib->register();
1227 1227
     $pwdlib = new PasswordLib\PasswordLib();
1228 1228
     $hashedPassword = $pwdlib->createPasswordHash($passwordClear);
@@ -1281,7 +1281,7 @@  discard block
 block discarded – undo
1281 1281
 function yubicoMFACheck($dataReceived, string $userInfo, array $SETTINGS): array
1282 1282
 {
1283 1283
     // Load superGlobals
1284
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1284
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1285 1285
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1286 1286
     $sessionAdmin = $superGlobal->get('user_admin', 'SESSION');
1287 1287
     $sessionUrl = $superGlobal->get('initial_url', 'SESSION');
@@ -1320,7 +1320,7 @@  discard block
 block discarded – undo
1320 1320
     }
1321 1321
 
1322 1322
     // Now check yubico validity
1323
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/Yubico/Yubico.php';
1323
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/Yubico/Yubico.php';
1324 1324
     $yubi = new Auth_Yubico($yubico_user_id, $yubico_user_key);
1325 1325
     $auth = $yubi->verify($yubico_key);
1326 1326
     //, null, null, null, 60
@@ -1372,7 +1372,7 @@  discard block
 block discarded – undo
1372 1372
             'gestionnaire' => '0',
1373 1373
             'can_manage_all_users' => '0',
1374 1374
             'personal_folder' => $SETTINGS['enable_pf_feature'] === '1' ? '1' : '0',
1375
-            'fonction_id' => (empty($retLDAP['user_info_from_ad'][0]['commonGroupsLdapVsTeampass']) === false ? $retLDAP['user_info_from_ad'][0]['commonGroupsLdapVsTeampass'] . ';' : '') . (isset($SETTINGS['ldap_new_user_role']) === true ? $SETTINGS['ldap_new_user_role'] : '0'),
1375
+            'fonction_id' => (empty($retLDAP['user_info_from_ad'][0]['commonGroupsLdapVsTeampass']) === false ? $retLDAP['user_info_from_ad'][0]['commonGroupsLdapVsTeampass'].';' : '').(isset($SETTINGS['ldap_new_user_role']) === true ? $SETTINGS['ldap_new_user_role'] : '0'),
1376 1376
             'groupes_interdits' => '',
1377 1377
             'groupes_visibles' => '',
1378 1378
             'last_pw_change' => (int) time(),
@@ -1397,7 +1397,7 @@  discard block
 block discarded – undo
1397 1397
             ]
1398 1398
         );
1399 1399
         // Rebuild tree
1400
-        $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1400
+        $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
1401 1401
         $tree->register();
1402 1402
         $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
1403 1403
         $tree->rebuild();
@@ -1428,13 +1428,13 @@  discard block
 block discarded – undo
1428 1428
         && empty($dataReceived['GACode']) === false
1429 1429
     ) {
1430 1430
         // Load superGlobals
1431
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1431
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1432 1432
         $superGlobal = new protect\SuperGlobal\SuperGlobal();
1433 1433
         $sessionAdmin = $superGlobal->get('user_admin', 'SESSION');
1434 1434
         $sessionUrl = $superGlobal->get('initial_url', 'SESSION');
1435 1435
         $sessionPwdAttempts = $superGlobal->get('pwd_attempts', 'SESSION');
1436 1436
         // load library
1437
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php';
1437
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php';
1438 1438
         // create new instance
1439 1439
         $tfa = new Authentication\TwoFactorAuth\TwoFactorAuth($SETTINGS['ga_website_name']);
1440 1440
         // Init
@@ -1457,7 +1457,7 @@  discard block
 block discarded – undo
1457 1457
             $mfaMessage = langHdl('ga_flash_qr_and_login');
1458 1458
             // generate new QR
1459 1459
             $new_2fa_qr = $tfa->getQRCodeImageAsDataUri(
1460
-                'Teampass - ' . $username,
1460
+                'Teampass - '.$username,
1461 1461
                 $userInfo['ga']
1462 1462
             );
1463 1463
             // clear temporary code from DB
@@ -1470,7 +1470,7 @@  discard block
 block discarded – undo
1470 1470
                 $userInfo['id']
1471 1471
             );
1472 1472
             $firstTime = [
1473
-                'value' => '<img src="' . $new_2fa_qr . '">',
1473
+                'value' => '<img src="'.$new_2fa_qr.'">',
1474 1474
                 'user_admin' => isset($sessionAdmin) ? (int) $sessionAdmin : '',
1475 1475
                 'initial_url' => isset($sessionUrl) === true ? $sessionUrl : '',
1476 1476
                 'pwd_attempts' => (int) $sessionPwdAttempts,
@@ -1523,8 +1523,8 @@  discard block
 block discarded – undo
1523 1523
     // Set to false
1524 1524
     $userPasswordVerified = false;
1525 1525
     // load passwordLib library
1526
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1527
-    $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1526
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1527
+    $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries');
1528 1528
     $pwdlib->register();
1529 1529
     $pwdlib = new PasswordLib\PasswordLib();
1530 1530
     // Check if old encryption used
@@ -1664,7 +1664,7 @@  discard block
 block discarded – undo
1664 1664
     // Brute force management
1665 1665
     if ($sessionPwdAttempts > 3) {
1666 1666
         // Load superGlobals
1667
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1667
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1668 1668
         $superGlobal = new protect\SuperGlobal\SuperGlobal();
1669 1669
         $superGlobal->put('next_possible_pwd_attempts', time() + 10, 'SESSION');
1670 1670
         $superGlobal->put('pwd_attempts', 0, 'SESSION');
@@ -1712,7 +1712,7 @@  discard block
 block discarded – undo
1712 1712
     // Check if user exists
1713 1713
     $userInfo = DB::queryFirstRow(
1714 1714
         'SELECT *
1715
-        FROM ' . prefixTable('users') . ' WHERE login=%s',
1715
+        FROM ' . prefixTable('users').' WHERE login=%s',
1716 1716
         $username
1717 1717
     );
1718 1718
     
Please login to merge, or discard this patch.
sources/tree.php 1 patch
Spacing   +50 added lines, -56 removed lines patch added patch discarded remove patch
@@ -42,10 +42,10 @@  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/main.functions.php';
47
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
48
-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/main.functions.php';
47
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
48
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
49 49
 
50 50
 // header
51 51
 header('Content-type: text/html; charset=utf-8');
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 }
60 60
 
61 61
 // Connect to mysql server
62
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
62
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
63 63
 if (defined('DB_PASSWD_CLEAR') === false) {
64 64
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
65 65
 }
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 DB::$connect_options = DB_CONNECT_OPTIONS;
74 74
 
75 75
 // Superglobal load
76
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
76
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
77 77
 $superGlobal = new protect\SuperGlobal\SuperGlobal();
78 78
 
79 79
 // Prepare sanitization
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 
128 128
 
129 129
 $lastFolderChange = DB::query(
130
-    'SELECT * FROM ' . prefixTable('misc') . '
130
+    'SELECT * FROM '.prefixTable('misc').'
131 131
     WHERE type = %s AND intitule = %s',
132 132
     'timestamp',
133 133
     'last_folder_change'
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
     || (isset($inputData['forceRefresh']) === true && (int) $inputData['forceRefresh'] === 1)
139 139
 ) {
140 140
     // Build tree
141
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tree/NestedTree/NestedTree.php';
141
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tree/NestedTree/NestedTree.php';
142 142
     $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
143 143
 
144 144
     if (
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
                 || (is_array($listRestrictedFoldersForItemsKeys) === true && in_array($node->id, $listRestrictedFoldersForItemsKeys) === true)
328 328
                 || in_array($node->id, $session_no_access_folders) === true)
329 329
         ) {
330
-            $nodeElements= buildNodeTreeElements(
330
+            $nodeElements = buildNodeTreeElements(
331 331
                 $node,
332 332
                 $session_user_id,
333 333
                 $session_login,
@@ -350,19 +350,19 @@  discard block
 block discarded – undo
350 350
             array_push(
351 351
                 $ret_json,
352 352
                 array(
353
-                    'id' => 'li_' . $node->id,
353
+                    'id' => 'li_'.$node->id,
354 354
                     'parent' => $nodeElements['parent'],
355
-                    'text' => '<i class="fas fa-folder mr-2"></i>'.($nodeElements['show_but_block'] === true ? '<i class="fas fa-times fa-xs text-danger mr-1"></i>' : '') . $nodeElements['text'],
355
+                    'text' => '<i class="fas fa-folder mr-2"></i>'.($nodeElements['show_but_block'] === true ? '<i class="fas fa-times fa-xs text-danger mr-1"></i>' : '').$nodeElements['text'],
356 356
                     'children' => ($nodeElements['childrenNb'] === 0 ? false : true),
357 357
                     'fa_icon' => 'folder',
358 358
                     'li_attr' => array(
359 359
                         'class' => ($nodeElements['show_but_block'] === true ? '' : 'jstreeopen'),
360
-                        'title' => 'ID [' . $node->id . '] ' . ($nodeElements['show_but_block'] === true ? langHdl('no_access') : $nodeElements['title']),
360
+                        'title' => 'ID ['.$node->id.'] '.($nodeElements['show_but_block'] === true ? langHdl('no_access') : $nodeElements['title']),
361 361
                     ),
362 362
                     'a_attr' => $nodeElements['show_but_block'] === true ? (array(
363
-                        'id' => 'fld_' . $node->id,
363
+                        'id' => 'fld_'.$node->id,
364 364
                         'class' => $nodeElements['folderClass'],
365
-                        'onclick' => 'ListerItems(' . $node->id . ', ' . $nodeElements['restricted'] . ', 0, 1)',
365
+                        'onclick' => 'ListerItems('.$node->id.', '.$nodeElements['restricted'].', 0, 1)',
366 366
                         'data-title' => $node->title,
367 367
                     )) : '',
368 368
                     'is_pf' => in_array($node->id, $session_personal_folders) === true ? 1 : 0,
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
     // get count of Items in this folder
401 401
     DB::query(
402 402
         'SELECT *
403
-        FROM ' . prefixTable('items') . '
403
+        FROM ' . prefixTable('items').'
404 404
         WHERE inactif=%i AND id_tree = %i',
405 405
         0,
406 406
         $nodeId
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
     // get info about current folder
411 411
     DB::query(
412 412
         'SELECT *
413
-        FROM ' . prefixTable('nested_tree') . '
413
+        FROM ' . prefixTable('nested_tree').'
414 414
         WHERE parent_id = %i',
415 415
         $nodeId
416 416
     );
@@ -423,8 +423,7 @@  discard block
 block discarded – undo
423 423
     } else {
424 424
         // If personal Folder, convert id into user name
425 425
         $ret['title'] = (string) $nodeTitle === (string) $userId && (int) $nodeLevel === 1 ?
426
-        $userLogin :
427
-        htmlspecialchars_decode($nodeTitle, ENT_QUOTES);
426
+        $userLogin : htmlspecialchars_decode($nodeTitle, ENT_QUOTES);
428 427
     }
429 428
 
430 429
     $ret['text'] = str_replace(
@@ -471,15 +470,15 @@  discard block
 block discarded – undo
471 470
     $text = $nodeInfos['text'];
472 471
 
473 472
     // prepare json return for current node
474
-    $parent = $node->parent_id === 0 ? '#' : 'li_' . $node->parent_id;
473
+    $parent = $node->parent_id === 0 ? '#' : 'li_'.$node->parent_id;
475 474
 
476 475
     if (in_array($node->id, $session_groupes_visibles) === true) {
477 476
         if (in_array($node->id, $session_read_only_folders) === true) {
478 477
             return array(
479
-                'text' => '<i class="far fa-eye fa-xs mr-1 ml-1"></i>' . $text
480
-                    .' <span class=\'badge badge-danger ml-2 items_count\' id=\'itcount_' . $node->id . '\'>' . $itemsNb . '</span>'
478
+                'text' => '<i class="far fa-eye fa-xs mr-1 ml-1"></i>'.$text
479
+                    .' <span class=\'badge badge-danger ml-2 items_count\' id=\'itcount_'.$node->id.'\'>'.$itemsNb.'</span>'
481 480
                     .(isKeyExistingAndEqual('tree_counters', 1, $SETTINGS) === true ?
482
-                        '/'.$nbChildrenItems .'/'.(count($nodeDescendants) - 1)
481
+                        '/'.$nbChildrenItems.'/'.(count($nodeDescendants) - 1)
483 482
                         : '')
484 483
                     .'</span>',
485 484
                 'title' => langHdl('read_only_account'),
@@ -494,16 +493,13 @@  discard block
 block discarded – undo
494 493
         
495 494
         return array(
496 495
             'text' => ($session_user_read_only === true && in_array($node->id, $session_personal_visible_groups) === false) ?
497
-                ('<i class="far fa-eye fa-xs mr-1 ml-1"></i>' . $text
498
-                .' <span class=\'badge badge-danger ml-2 items_count\' id=\'itcount_' . $node->id . '\'>' . $itemsNb . '</span>'
496
+                ('<i class="far fa-eye fa-xs mr-1 ml-1"></i>'.$text
497
+                .' <span class=\'badge badge-danger ml-2 items_count\' id=\'itcount_'.$node->id.'\'>'.$itemsNb.'</span>'
499 498
                 .(isKeyExistingAndEqual('tree_counters', 1, $SETTINGS) === true ?
500
-                    '/'.$nbChildrenItems .'/'.(count($nodeDescendants) - 1)  :
501
-                    '')
502
-                .'</span>') :
503
-                (' <span class=\'badge badge-danger ml-2 items_count\' id=\'itcount_' . $node->id . '\'>' . $itemsNb . '</span>'
499
+                    '/'.$nbChildrenItems.'/'.(count($nodeDescendants) - 1) : '')
500
+                .'</span>') : (' <span class=\'badge badge-danger ml-2 items_count\' id=\'itcount_'.$node->id.'\'>'.$itemsNb.'</span>'
504 501
                 .(isKeyExistingAndEqual('tree_counters', 1, $SETTINGS) === true ?
505
-                    '/'.$nbChildrenItems .'/'.(count($nodeDescendants) - 1)  :
506
-                    '')
502
+                    '/'.$nbChildrenItems.'/'.(count($nodeDescendants) - 1) : '')
507 503
                 .'</span>'),
508 504
             'title' => langHdl('read_only_account'),
509 505
             'restricted' => 1,
@@ -517,9 +513,8 @@  discard block
 block discarded – undo
517 513
     
518 514
     if (in_array($node->id, $listFoldersLimitedKeys) === true) {
519 515
         return array(
520
-            'text' => $text . ($session_user_read_only === true ?
521
-                '<i class="far fa-eye fa-xs mr-1 ml-1"></i>' :
522
-                '<span class="badge badge-danger ml-2 items_count" id="itcount_' . $node->id . '">' . count($session_list_folders_limited[$node->id]) . '</span>'
516
+            'text' => $text.($session_user_read_only === true ?
517
+                '<i class="far fa-eye fa-xs mr-1 ml-1"></i>' : '<span class="badge badge-danger ml-2 items_count" id="itcount_'.$node->id.'">'.count($session_list_folders_limited[$node->id]).'</span>'
523 518
             ),
524 519
             'title' => $title,
525 520
             'restricted' => 1,
@@ -533,9 +528,8 @@  discard block
 block discarded – undo
533 528
     
534 529
     if (in_array($node->id, $listRestrictedFoldersForItemsKeys) === true) {        
535 530
         return array(
536
-            'text' => $text . ($session_user_read_only === true ? 
537
-                '<i class="far fa-eye fa-xs mr-1 ml-1"></i>' :
538
-                '<span class="badge badge-danger ml-2 items_count" id="itcount_' . $node->id . '">' . count($session_list_restricted_folders_for_items[$node->id]) . '</span>'
531
+            'text' => $text.($session_user_read_only === true ? 
532
+                '<i class="far fa-eye fa-xs mr-1 ml-1"></i>' : '<span class="badge badge-danger ml-2 items_count" id="itcount_'.$node->id.'">'.count($session_list_restricted_folders_for_items[$node->id]).'</span>'
539 533
             ),
540 534
             'title' => $title,
541 535
             'restricted' => 1,
@@ -559,7 +553,7 @@  discard block
 block discarded – undo
559 553
         'title' => $title,
560 554
         'restricted' => 1,
561 555
         'folderClass' => 'folder_not_droppable',
562
-        'show_but_block' => true,   // folder is visible but not accessible by user
556
+        'show_but_block' => true, // folder is visible but not accessible by user
563 557
         'parent' => $parent,
564 558
         'childrenNb' => $childrenNb,
565 559
         'itemsNb' => $itemsNb,
@@ -648,7 +642,7 @@  discard block
 block discarded – undo
648 642
                 ) === true
649 643
             ) {
650 644
                 DB::query(
651
-                    'SELECT * FROM ' . prefixTable('items') . '
645
+                    'SELECT * FROM '.prefixTable('items').'
652 646
                     WHERE inactif=%i AND id_tree = %i',
653 647
                     0,
654 648
                     $node
@@ -737,7 +731,7 @@  discard block
 block discarded – undo
737 731
 {
738 732
     // get info about current folder
739 733
     DB::query(
740
-        'SELECT * FROM ' . prefixTable('items') . '
734
+        'SELECT * FROM '.prefixTable('items').'
741 735
         WHERE inactif=%i AND id_tree = %i',
742 736
         0,
743 737
         $completTree[$nodeId]->id
@@ -773,7 +767,7 @@  discard block
 block discarded – undo
773 767
     );
774 768
 
775 769
     // prepare json return for current node
776
-    $parent = $completTree[$nodeId]->parent_id === '0' ? '#' : 'li_' . $completTree[$nodeId]->parent_id;
770
+    $parent = $completTree[$nodeId]->parent_id === '0' ? '#' : 'li_'.$completTree[$nodeId]->parent_id;
777 771
 
778 772
     // handle displaying
779 773
     if (isKeyExistingAndEqual('show_only_accessible_folders', 1, $SETTINGS) === true) {
@@ -790,17 +784,17 @@  discard block
 block discarded – undo
790 784
         array_push(
791 785
             $ret_json,
792 786
             array(
793
-                'id' => 'li_' . $completTree[$nodeId]->id,
787
+                'id' => 'li_'.$completTree[$nodeId]->id,
794 788
                 'parent' => $last_visible_parent === -1 ? $parent : $last_visible_parent,
795 789
                 'text' => '<i class="'.$completTree[$nodeId]->fa_icon.' tree-folder mr-2" data-folder="'.$completTree[$nodeId]->fa_icon.'"  data-folder-selected="'.$completTree[$nodeId]->fa_icon_selected.'"></i>'.$text.$completTree[$nodeId]->title.$nodeData['html'],
796 790
                 'li_attr' => array(
797 791
                     'class' => 'jstreeopen',
798
-                    'title' => 'ID [' . $completTree[$nodeId]->id . '] ' . $nodeData['title'],
792
+                    'title' => 'ID ['.$completTree[$nodeId]->id.'] '.$nodeData['title'],
799 793
                 ),
800 794
                 'a_attr' => array(
801
-                    'id' => 'fld_' . $completTree[$nodeId]->id,
795
+                    'id' => 'fld_'.$completTree[$nodeId]->id,
802 796
                     'class' => $nodeData['folderClass'],
803
-                    'onclick' => 'ListerItems(' . $completTree[$nodeId]->id . ', ' . $nodeData['restricted'] . ', 0, 1)',
797
+                    'onclick' => 'ListerItems('.$completTree[$nodeId]->id.', '.$nodeData['restricted'].', 0, 1)',
804 798
                     'data-title' => $completTree[$nodeId]->title,
805 799
                 ),
806 800
                 'is_pf' => in_array($completTree[$nodeId]->id, $session_personal_folder) === true ? 1 : 0,
@@ -811,12 +805,12 @@  discard block
 block discarded – undo
811 805
         array_push(
812 806
             $ret_json,
813 807
             array(
814
-                'id' => 'li_' . $completTree[$nodeId]->id,
808
+                'id' => 'li_'.$completTree[$nodeId]->id,
815 809
                 'parent' => $last_visible_parent === -1 ? $parent : $last_visible_parent,
816 810
                 'text' => '<i class="'.$completTree[$nodeId]->fa_icon.' tree-folder mr-2" data-folder="'.$completTree[$nodeId]->fa_icon.'"  data-folder-selected="'.$completTree[$nodeId]->fa_icon_selected.'"></i>'.'<i class="fas fa-times fa-xs text-danger mr-1 ml-1"></i>'.$text.$completTree[$nodeId]->title.$nodeData['html'],
817 811
                 'li_attr' => array(
818 812
                     'class' => '',
819
-                    'title' => 'ID [' . $completTree[$nodeId]->id . '] ' . langHdl('no_access'),
813
+                    'title' => 'ID ['.$completTree[$nodeId]->id.'] '.langHdl('no_access'),
820 814
                 ),
821 815
             )
822 816
         );
@@ -882,8 +876,8 @@  discard block
 block discarded – undo
882 876
     if (in_array($nodeId, $session_groupes_visibles) === true) {
883 877
         if (in_array($nodeId, $session_read_only_folders) === true) {
884 878
             return [
885
-                'html' => '<i class="far fa-eye fa-xs mr-1 ml-1"></i><span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . $itemsNb .
886
-                    ($tree_counters === 1 ? '/'.$nbChildrenItems .'/'.(count($nodeDescendants) - 1)  : '') . '</span>',
879
+                'html' => '<i class="far fa-eye fa-xs mr-1 ml-1"></i><span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.$itemsNb.
880
+                    ($tree_counters === 1 ? '/'.$nbChildrenItems.'/'.(count($nodeDescendants) - 1) : '').'</span>',
887 881
                 'title' => langHdl('read_only_account'),
888 882
                 'restricted' => 1,
889 883
                 'folderClass' => 'folder_not_droppable',
@@ -897,8 +891,8 @@  discard block
 block discarded – undo
897 891
             && in_array($nodeId, $session_personal_visible_groups) === false
898 892
         ) {
899 893
             return [
900
-                'html' => '<i class="far fa-eye fa-xs mr-1"></i><span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . $itemsNb .
901
-                    ($tree_counters === 1 ? '/'.$nbChildrenItems .'/'.(count($nodeDescendants) - 1)  : '') . '</span>',
894
+                'html' => '<i class="far fa-eye fa-xs mr-1"></i><span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.$itemsNb.
895
+                    ($tree_counters === 1 ? '/'.$nbChildrenItems.'/'.(count($nodeDescendants) - 1) : '').'</span>',
902 896
                 'title' => $title,
903 897
                 'restricted' => 0,
904 898
                 'folderClass' => 'folder',
@@ -909,8 +903,8 @@  discard block
 block discarded – undo
909 903
         }
910 904
         
911 905
         return [
912
-            'html' => '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . $itemsNb .
913
-                ($tree_counters === 1 ? '/'.$nbChildrenItems .'/'.(count($nodeDescendants) - 1)  : '') . '</span>',
906
+            'html' => '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.$itemsNb.
907
+                ($tree_counters === 1 ? '/'.$nbChildrenItems.'/'.(count($nodeDescendants) - 1) : '').'</span>',
914 908
             'title' => $title,
915 909
             'restricted' => 0,
916 910
             'folderClass' => 'folder',
@@ -921,8 +915,8 @@  discard block
 block discarded – undo
921 915
 
922 916
     } elseif (in_array($nodeId, $listFoldersLimitedKeys) === true) {
923 917
         return [
924
-            'html' => ($session_user_read_only === true ? '<i class="far fa-eye fa-xs mr-1"></i>' : '') .
925
-                '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . count($session_list_folders_limited[$nodeId]) . '</span>',
918
+            'html' => ($session_user_read_only === true ? '<i class="far fa-eye fa-xs mr-1"></i>' : '').
919
+                '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.count($session_list_folders_limited[$nodeId]).'</span>',
926 920
             'title' => $title,
927 921
             'restricted' => 1,
928 922
             'folderClass' => 'folder',
@@ -933,8 +927,8 @@  discard block
 block discarded – undo
933 927
 
934 928
     } elseif (in_array($nodeId, $listRestrictedFoldersForItemsKeys) === true) {
935 929
         return [
936
-            'html' => $session_user_read_only === true ? '<i class="far fa-eye fa-xs mr-1"></i>' : '' .
937
-                '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . count($session_list_restricted_folders_for_items[$nodeId]) . '</span>',
930
+            'html' => $session_user_read_only === true ? '<i class="far fa-eye fa-xs mr-1"></i>' : ''.
931
+                '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.count($session_list_restricted_folders_for_items[$nodeId]).'</span>',
938 932
             'title' => $title,
939 933
             'restricted' => 1,
940 934
             'folderClass' => 'folder',
Please login to merge, or discard this patch.
sources/main.functions.php 1 patch
Spacing   +252 added lines, -254 removed lines patch added patch discarded remove patch
@@ -122,29 +122,29 @@  discard block
 block discarded – undo
122 122
  */
123 123
 function cryption(string $message, string $ascii_key, string $type, array $SETTINGS): array
124 124
 {
125
-    $ascii_key = empty($ascii_key) === true ? file_get_contents(SECUREPATH . '/teampass-seckey.txt') : $ascii_key;
125
+    $ascii_key = empty($ascii_key) === true ? file_get_contents(SECUREPATH.'/teampass-seckey.txt') : $ascii_key;
126 126
     $err = false;
127 127
     // load PhpEncryption library
128 128
     if (isset($SETTINGS['cpassman_dir']) === false || empty($SETTINGS['cpassman_dir']) === true) {
129 129
         $path = '../includes/libraries/Encryption/Encryption/';
130 130
     } else {
131
-        $path = $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/';
132
-    }
133
-
134
-    include_once $path . 'Exception/CryptoException.php';
135
-    include_once $path . 'Exception/BadFormatException.php';
136
-    include_once $path . 'Exception/EnvironmentIsBrokenException.php';
137
-    include_once $path . 'Exception/IOException.php';
138
-    include_once $path . 'Exception/WrongKeyOrModifiedCiphertextException.php';
139
-    include_once $path . 'Crypto.php';
140
-    include_once $path . 'Encoding.php';
141
-    include_once $path . 'DerivedKeys.php';
142
-    include_once $path . 'Key.php';
143
-    include_once $path . 'KeyOrPassword.php';
144
-    include_once $path . 'File.php';
145
-    include_once $path . 'RuntimeTests.php';
146
-    include_once $path . 'KeyProtectedByPassword.php';
147
-    include_once $path . 'Core.php';
131
+        $path = $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/';
132
+    }
133
+
134
+    include_once $path.'Exception/CryptoException.php';
135
+    include_once $path.'Exception/BadFormatException.php';
136
+    include_once $path.'Exception/EnvironmentIsBrokenException.php';
137
+    include_once $path.'Exception/IOException.php';
138
+    include_once $path.'Exception/WrongKeyOrModifiedCiphertextException.php';
139
+    include_once $path.'Crypto.php';
140
+    include_once $path.'Encoding.php';
141
+    include_once $path.'DerivedKeys.php';
142
+    include_once $path.'Key.php';
143
+    include_once $path.'KeyOrPassword.php';
144
+    include_once $path.'File.php';
145
+    include_once $path.'RuntimeTests.php';
146
+    include_once $path.'KeyProtectedByPassword.php';
147
+    include_once $path.'Core.php';
148 148
     
149 149
     // convert KEY
150 150
     $key = \Defuse\Crypto\Key::loadFromAsciiSafeString($ascii_key);
@@ -189,20 +189,20 @@  discard block
 block discarded – undo
189 189
         $path = '../includes/libraries/Encryption/Encryption/';
190 190
     }
191 191
 
192
-    include_once $path . 'Exception/CryptoException.php';
193
-    include_once $path . 'Exception/BadFormatException.php';
194
-    include_once $path . 'Exception/EnvironmentIsBrokenException.php';
195
-    include_once $path . 'Exception/IOException.php';
196
-    include_once $path . 'Exception/WrongKeyOrModifiedCiphertextException.php';
197
-    include_once $path . 'Crypto.php';
198
-    include_once $path . 'Encoding.php';
199
-    include_once $path . 'DerivedKeys.php';
200
-    include_once $path . 'Key.php';
201
-    include_once $path . 'KeyOrPassword.php';
202
-    include_once $path . 'File.php';
203
-    include_once $path . 'RuntimeTests.php';
204
-    include_once $path . 'KeyProtectedByPassword.php';
205
-    include_once $path . 'Core.php';
192
+    include_once $path.'Exception/CryptoException.php';
193
+    include_once $path.'Exception/BadFormatException.php';
194
+    include_once $path.'Exception/EnvironmentIsBrokenException.php';
195
+    include_once $path.'Exception/IOException.php';
196
+    include_once $path.'Exception/WrongKeyOrModifiedCiphertextException.php';
197
+    include_once $path.'Crypto.php';
198
+    include_once $path.'Encoding.php';
199
+    include_once $path.'DerivedKeys.php';
200
+    include_once $path.'Key.php';
201
+    include_once $path.'KeyOrPassword.php';
202
+    include_once $path.'File.php';
203
+    include_once $path.'RuntimeTests.php';
204
+    include_once $path.'KeyProtectedByPassword.php';
205
+    include_once $path.'Core.php';
206 206
 
207 207
     $key = \Defuse\Crypto\Key::createNewRandomKey();
208 208
     $key = $key->saveToAsciiSafeString();
@@ -227,20 +227,20 @@  discard block
 block discarded – undo
227 227
         $path = '../includes/libraries/Encryption/Encryption/';
228 228
     }
229 229
 
230
-    include_once $path . 'Exception/CryptoException.php';
231
-    include_once $path . 'Exception/BadFormatException.php';
232
-    include_once $path . 'Exception/EnvironmentIsBrokenException.php';
233
-    include_once $path . 'Exception/IOException.php';
234
-    include_once $path . 'Exception/WrongKeyOrModifiedCiphertextException.php';
235
-    include_once $path . 'Crypto.php';
236
-    include_once $path . 'Encoding.php';
237
-    include_once $path . 'DerivedKeys.php';
238
-    include_once $path . 'Key.php';
239
-    include_once $path . 'KeyOrPassword.php';
240
-    include_once $path . 'File.php';
241
-    include_once $path . 'RuntimeTests.php';
242
-    include_once $path . 'KeyProtectedByPassword.php';
243
-    include_once $path . 'Core.php';
230
+    include_once $path.'Exception/CryptoException.php';
231
+    include_once $path.'Exception/BadFormatException.php';
232
+    include_once $path.'Exception/EnvironmentIsBrokenException.php';
233
+    include_once $path.'Exception/IOException.php';
234
+    include_once $path.'Exception/WrongKeyOrModifiedCiphertextException.php';
235
+    include_once $path.'Crypto.php';
236
+    include_once $path.'Encoding.php';
237
+    include_once $path.'DerivedKeys.php';
238
+    include_once $path.'Key.php';
239
+    include_once $path.'KeyOrPassword.php';
240
+    include_once $path.'File.php';
241
+    include_once $path.'RuntimeTests.php';
242
+    include_once $path.'KeyProtectedByPassword.php';
243
+    include_once $path.'Core.php';
244 244
     
245 245
     $protected_key = \Defuse\Crypto\KeyProtectedByPassword::createRandomPasswordProtectedKey($psk);
246 246
     return $protected_key->saveToAsciiSafeString(); // save this in user table
@@ -265,20 +265,20 @@  discard block
 block discarded – undo
265 265
         $path = '../includes/libraries/Encryption/Encryption/';
266 266
     }
267 267
 
268
-    include_once $path . 'Exception/CryptoException.php';
269
-    include_once $path . 'Exception/BadFormatException.php';
270
-    include_once $path . 'Exception/EnvironmentIsBrokenException.php';
271
-    include_once $path . 'Exception/IOException.php';
272
-    include_once $path . 'Exception/WrongKeyOrModifiedCiphertextException.php';
273
-    include_once $path . 'Crypto.php';
274
-    include_once $path . 'Encoding.php';
275
-    include_once $path . 'DerivedKeys.php';
276
-    include_once $path . 'Key.php';
277
-    include_once $path . 'KeyOrPassword.php';
278
-    include_once $path . 'File.php';
279
-    include_once $path . 'RuntimeTests.php';
280
-    include_once $path . 'KeyProtectedByPassword.php';
281
-    include_once $path . 'Core.php';
268
+    include_once $path.'Exception/CryptoException.php';
269
+    include_once $path.'Exception/BadFormatException.php';
270
+    include_once $path.'Exception/EnvironmentIsBrokenException.php';
271
+    include_once $path.'Exception/IOException.php';
272
+    include_once $path.'Exception/WrongKeyOrModifiedCiphertextException.php';
273
+    include_once $path.'Crypto.php';
274
+    include_once $path.'Encoding.php';
275
+    include_once $path.'DerivedKeys.php';
276
+    include_once $path.'Key.php';
277
+    include_once $path.'KeyOrPassword.php';
278
+    include_once $path.'File.php';
279
+    include_once $path.'RuntimeTests.php';
280
+    include_once $path.'KeyProtectedByPassword.php';
281
+    include_once $path.'Core.php';
282 282
 
283 283
     try {
284 284
         $user_key = $protected_key_encoded->unlockKey($psk);
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
  */
320 320
 function trimElement($chaine, string $element): string
321 321
 {
322
-    if (! empty($chaine)) {
322
+    if (!empty($chaine)) {
323 323
         if (is_array($chaine) === true) {
324 324
             $chaine = implode(';', $chaine);
325 325
         }
@@ -367,8 +367,8 @@  discard block
 block discarded – undo
367 367
  */
368 368
 function db_error_handler(array $params): void
369 369
 {
370
-    echo 'Error: ' . $params['error'] . "<br>\n";
371
-    echo 'Query: ' . $params['query'] . "<br>\n";
370
+    echo 'Error: '.$params['error']."<br>\n";
371
+    echo 'Query: '.$params['query']."<br>\n";
372 372
     throw new Exception('Error - Query', 1);
373 373
 }
374 374
 
@@ -390,12 +390,12 @@  discard block
 block discarded – undo
390 390
     $SETTINGS
391 391
 ) {
392 392
     //load ClassLoader
393
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
393
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
394 394
     // Load superglobal
395
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
395
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
396 396
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
397 397
     //Connect to DB
398
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
398
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
399 399
     if (defined('DB_PASSWD_CLEAR') === false) {
400 400
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
401 401
     }
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
     DB::$ssl = DB_SSL;
409 409
     DB::$connect_options = DB_CONNECT_OPTIONS;
410 410
     //Build tree
411
-    $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
411
+    $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
412 412
     $tree->register();
413 413
     $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
414 414
 
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 function identAdmin($idFonctions, $SETTINGS, $tree)
454 454
 {
455 455
     // Load superglobal
456
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
456
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
457 457
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
458 458
     // Init
459 459
     $groupesVisibles = [];
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
     $globalsVisibleFolders = $superGlobal->get('groupes_visibles', 'SESSION');
473 473
     $globalsPersonalVisibleFolders = $superGlobal->get('personal_visible_groups', 'SESSION');
474 474
     // Get list of Folders
475
-    $rows = DB::query('SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', 0);
475
+    $rows = DB::query('SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', 0);
476 476
     foreach ($rows as $record) {
477 477
         array_push($groupesVisibles, $record['id']);
478 478
     }
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
     }
492 492
     // Get ID of personal folder
493 493
     $persfld = DB::queryfirstrow(
494
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE title = %s',
494
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE title = %s',
495 495
         $globalsUserId
496 496
     );
497 497
     if (empty($persfld['id']) === false) {
@@ -512,20 +512,20 @@  discard block
 block discarded – undo
512 512
     // get complete list of ROLES
513 513
     $tmp = explode(';', $idFonctions);
514 514
     $rows = DB::query(
515
-        'SELECT * FROM ' . prefixTable('roles_title') . '
515
+        'SELECT * FROM '.prefixTable('roles_title').'
516 516
         ORDER BY title ASC'
517 517
     );
518 518
     foreach ($rows as $record) {
519
-        if (! empty($record['id']) && ! in_array($record['id'], $tmp)) {
519
+        if (!empty($record['id']) && !in_array($record['id'], $tmp)) {
520 520
             array_push($tmp, $record['id']);
521 521
         }
522 522
     }
523 523
     $superGlobal->put('fonction_id', implode(';', $tmp), 'SESSION');
524 524
     $superGlobal->put('is_admin', 1, 'SESSION');
525 525
     // Check if admin has created Folders and Roles
526
-    DB::query('SELECT * FROM ' . prefixTable('nested_tree') . '');
526
+    DB::query('SELECT * FROM '.prefixTable('nested_tree').'');
527 527
     $superGlobal->put('nb_folders', DB::count(), 'SESSION');
528
-    DB::query('SELECT * FROM ' . prefixTable('roles_title'));
528
+    DB::query('SELECT * FROM '.prefixTable('roles_title'));
529 529
     $superGlobal->put('nb_roles', DB::count(), 'SESSION');
530 530
 
531 531
     return true;
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
     object $tree
572 572
 ) {
573 573
     // Load superglobal
574
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
574
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
575 575
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
576 576
     // Init
577 577
     $superGlobal->put('groupes_visibles', [], 'SESSION');
@@ -610,10 +610,10 @@  discard block
 block discarded – undo
610 610
     // Does this user is allowed to see other items
611 611
     $inc = 0;
612 612
     $rows = DB::query(
613
-        'SELECT id, id_tree FROM ' . prefixTable('items') . '
613
+        'SELECT id, id_tree FROM '.prefixTable('items').'
614 614
             WHERE restricted_to LIKE %ss AND inactif = %s'.
615 615
             (count($allowedFolders) > 0 ? ' AND id_tree NOT IN ('.implode(',', $allowedFolders).')' : ''),
616
-        $globalsUserId . ';',
616
+        $globalsUserId.';',
617 617
         '0'
618 618
     );
619 619
     foreach ($rows as $record) {
@@ -627,8 +627,8 @@  discard block
 block discarded – undo
627 627
     // Check for the users roles if some specific rights exist on items
628 628
     $rows = DB::query(
629 629
         'SELECT i.id_tree, r.item_id
630
-        FROM ' . prefixTable('items') . ' as i
631
-        INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (r.item_id=i.id)
630
+        FROM ' . prefixTable('items').' as i
631
+        INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (r.item_id=i.id)
632 632
         WHERE r.role_id IN %li AND i.id_tree <> ""
633 633
         ORDER BY i.id_tree ASC',
634 634
         $userRoles
@@ -682,16 +682,16 @@  discard block
 block discarded – undo
682 682
         'SESSION'
683 683
     );
684 684
     // Folders and Roles numbers
685
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('nested_tree') . '');
685
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('nested_tree').'');
686 686
     $superGlobal->put('nb_folders', DB::count(), 'SESSION');
687
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('roles_title'));
687
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('roles_title'));
688 688
     $superGlobal->put('nb_roles', DB::count(), 'SESSION');
689 689
     // check if change proposals on User's items
690 690
     if (isset($SETTINGS['enable_suggestion']) === true && (int) $SETTINGS['enable_suggestion'] === 1) {
691 691
         $countNewItems = DB::query(
692 692
             'SELECT COUNT(*)
693
-            FROM ' . prefixTable('items_change') . ' AS c
694
-            LEFT JOIN ' . prefixTable('log_items') . ' AS i ON (c.item_id = i.id_item)
693
+            FROM ' . prefixTable('items_change').' AS c
694
+            LEFT JOIN ' . prefixTable('log_items').' AS i ON (c.item_id = i.id_item)
695 695
             WHERE i.action = %s AND i.id_user = %i',
696 696
             'at_creation',
697 697
             $globalsUserId
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
     
720 720
     $rows = DB::query(
721 721
         'SELECT *
722
-        FROM ' . prefixTable('roles_values') . '
722
+        FROM ' . prefixTable('roles_values').'
723 723
         WHERE role_id IN %li AND type IN %ls',
724 724
         $userRoles,
725 725
         ['W', 'ND', 'NE', 'NDNE', 'R']
@@ -786,7 +786,7 @@  discard block
 block discarded – undo
786 786
     ) {
787 787
         $persoFld = DB::queryfirstrow(
788 788
             'SELECT id
789
-            FROM ' . prefixTable('nested_tree') . '
789
+            FROM ' . prefixTable('nested_tree').'
790 790
             WHERE title = %s AND personal_folder = %i'.
791 791
             (count($allowedFolders) > 0 ? ' AND id NOT IN ('.implode(',', $allowedFolders).')' : ''),
792 792
             $globalsUserId,
@@ -816,7 +816,7 @@  discard block
 block discarded – undo
816 816
     }
817 817
     $persoFlds = DB::query(
818 818
         'SELECT id
819
-        FROM ' . prefixTable('nested_tree') . '
819
+        FROM ' . prefixTable('nested_tree').'
820 820
         WHERE %l',
821 821
         $where
822 822
     );
@@ -880,9 +880,9 @@  discard block
 block discarded – undo
880 880
  */
881 881
 function cacheTableRefresh(array $SETTINGS): void
882 882
 {
883
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
883
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
884 884
     //Connect to DB
885
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
885
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
886 886
     if (defined('DB_PASSWD_CLEAR') === false) {
887 887
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
888 888
     }
@@ -899,12 +899,12 @@  discard block
 block discarded – undo
899 899
     $tree->register();
900 900
     $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
901 901
     // truncate table
902
-    DB::query('TRUNCATE TABLE ' . prefixTable('cache'));
902
+    DB::query('TRUNCATE TABLE '.prefixTable('cache'));
903 903
     // reload date
904 904
     $rows = DB::query(
905 905
         'SELECT *
906
-        FROM ' . prefixTable('items') . ' as i
907
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
906
+        FROM ' . prefixTable('items').' as i
907
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
908 908
         AND l.action = %s
909 909
         AND i.inactif = %i',
910 910
         'at_creation',
@@ -916,18 +916,18 @@  discard block
 block discarded – undo
916 916
             $tags = '';
917 917
             $itemTags = DB::query(
918 918
                 'SELECT tag
919
-                FROM ' . prefixTable('tags') . '
919
+                FROM ' . prefixTable('tags').'
920 920
                 WHERE item_id = %i AND tag != ""',
921 921
                 $record['id']
922 922
             );
923 923
             foreach ($itemTags as $itemTag) {
924
-                $tags .= $itemTag['tag'] . ' ';
924
+                $tags .= $itemTag['tag'].' ';
925 925
             }
926 926
 
927 927
             // Get renewal period
928 928
             $resNT = DB::queryfirstrow(
929 929
                 'SELECT renewal_period
930
-                FROM ' . prefixTable('nested_tree') . '
930
+                FROM ' . prefixTable('nested_tree').'
931 931
                 WHERE id = %i',
932 932
                 $record['id_tree']
933 933
             );
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
                     // Is this a User id?
941 941
                     $user = DB::queryfirstrow(
942 942
                         'SELECT id, login
943
-                        FROM ' . prefixTable('users') . '
943
+                        FROM ' . prefixTable('users').'
944 944
                         WHERE id = %i',
945 945
                         $elem->title
946 946
                     );
@@ -958,11 +958,11 @@  discard block
 block discarded – undo
958 958
                     'id' => $record['id'],
959 959
                     'label' => $record['label'],
960 960
                     'description' => $record['description'] ?? '',
961
-                    'url' => isset($record['url']) && ! empty($record['url']) ? $record['url'] : '0',
961
+                    'url' => isset($record['url']) && !empty($record['url']) ? $record['url'] : '0',
962 962
                     'tags' => $tags,
963 963
                     'id_tree' => $record['id_tree'],
964 964
                     'perso' => $record['perso'],
965
-                    'restricted_to' => isset($record['restricted_to']) && ! empty($record['restricted_to']) ? $record['restricted_to'] : '0',
965
+                    'restricted_to' => isset($record['restricted_to']) && !empty($record['restricted_to']) ? $record['restricted_to'] : '0',
966 966
                     'login' => $record['login'] ?? '',
967 967
                     'folder' => implode(' > ', $folder),
968 968
                     'author' => $record['id_user'],
@@ -984,12 +984,12 @@  discard block
 block discarded – undo
984 984
  */
985 985
 function cacheTableUpdate(array $SETTINGS, ?int $ident = null): void
986 986
 {
987
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
987
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
988 988
     // Load superglobal
989
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
989
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
990 990
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
991 991
     //Connect to DB
992
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
992
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
993 993
     if (defined('DB_PASSWD_CLEAR') === false) {
994 994
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
995 995
     }
@@ -1008,7 +1008,7 @@  discard block
 block discarded – undo
1008 1008
     // get new value from db
1009 1009
     $data = DB::queryfirstrow(
1010 1010
         'SELECT label, description, id_tree, perso, restricted_to, login, url
1011
-        FROM ' . prefixTable('items') . '
1011
+        FROM ' . prefixTable('items').'
1012 1012
         WHERE id=%i',
1013 1013
         $ident
1014 1014
     );
@@ -1016,12 +1016,12 @@  discard block
 block discarded – undo
1016 1016
     $tags = '';
1017 1017
     $itemTags = DB::query(
1018 1018
         'SELECT tag
1019
-            FROM ' . prefixTable('tags') . '
1019
+            FROM ' . prefixTable('tags').'
1020 1020
             WHERE item_id = %i AND tag != ""',
1021 1021
         $ident
1022 1022
     );
1023 1023
     foreach ($itemTags as $itemTag) {
1024
-        $tags .= $itemTag['tag'] . ' ';
1024
+        $tags .= $itemTag['tag'].' ';
1025 1025
     }
1026 1026
     // form id_tree to full foldername
1027 1027
     $folder = [];
@@ -1032,7 +1032,7 @@  discard block
 block discarded – undo
1032 1032
             // Is this a User id?
1033 1033
             $user = DB::queryfirstrow(
1034 1034
                 'SELECT id, login
1035
-                FROM ' . prefixTable('users') . '
1035
+                FROM ' . prefixTable('users').'
1036 1036
                 WHERE id = %i',
1037 1037
                 $elem->title
1038 1038
             );
@@ -1050,10 +1050,10 @@  discard block
 block discarded – undo
1050 1050
             'label' => $data['label'],
1051 1051
             'description' => $data['description'],
1052 1052
             'tags' => $tags,
1053
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
1053
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
1054 1054
             'id_tree' => $data['id_tree'],
1055 1055
             'perso' => $data['perso'],
1056
-            'restricted_to' => isset($data['restricted_to']) && ! empty($data['restricted_to']) ? $data['restricted_to'] : '0',
1056
+            'restricted_to' => isset($data['restricted_to']) && !empty($data['restricted_to']) ? $data['restricted_to'] : '0',
1057 1057
             'login' => $data['login'] ?? '',
1058 1058
             'folder' => implode(' » ', $folder),
1059 1059
             'author' => $superGlobal->get('user_id', 'SESSION'),
@@ -1073,14 +1073,14 @@  discard block
 block discarded – undo
1073 1073
  */
1074 1074
 function cacheTableAdd(array $SETTINGS, ?int $ident = null): void
1075 1075
 {
1076
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1076
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1077 1077
     // Load superglobal
1078
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1078
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1079 1079
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1080 1080
     // Get superglobals
1081 1081
     $globalsUserId = $superGlobal->get('user_id', 'SESSION');
1082 1082
     //Connect to DB
1083
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1083
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1084 1084
     if (defined('DB_PASSWD_CLEAR') === false) {
1085 1085
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1086 1086
     }
@@ -1099,8 +1099,8 @@  discard block
 block discarded – undo
1099 1099
     // get new value from db
1100 1100
     $data = DB::queryFirstRow(
1101 1101
         'SELECT i.label, i.description, i.id_tree as id_tree, i.perso, i.restricted_to, i.id, i.login, i.url, l.date
1102
-        FROM ' . prefixTable('items') . ' as i
1103
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
1102
+        FROM ' . prefixTable('items').' as i
1103
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
1104 1104
         WHERE i.id = %i
1105 1105
         AND l.action = %s',
1106 1106
         $ident,
@@ -1110,12 +1110,12 @@  discard block
 block discarded – undo
1110 1110
     $tags = '';
1111 1111
     $itemTags = DB::query(
1112 1112
         'SELECT tag
1113
-            FROM ' . prefixTable('tags') . '
1113
+            FROM ' . prefixTable('tags').'
1114 1114
             WHERE item_id = %i AND tag != ""',
1115 1115
         $ident
1116 1116
     );
1117 1117
     foreach ($itemTags as $itemTag) {
1118
-        $tags .= $itemTag['tag'] . ' ';
1118
+        $tags .= $itemTag['tag'].' ';
1119 1119
     }
1120 1120
     // form id_tree to full foldername
1121 1121
     $folder = [];
@@ -1126,7 +1126,7 @@  discard block
 block discarded – undo
1126 1126
             // Is this a User id?
1127 1127
             $user = DB::queryfirstrow(
1128 1128
                 'SELECT id, login
1129
-                FROM ' . prefixTable('users') . '
1129
+                FROM ' . prefixTable('users').'
1130 1130
                 WHERE id = %i',
1131 1131
                 $elem->title
1132 1132
             );
@@ -1145,7 +1145,7 @@  discard block
 block discarded – undo
1145 1145
             'label' => $data['label'],
1146 1146
             'description' => $data['description'],
1147 1147
             'tags' => isset($tags) && empty($tags) === false ? $tags : 'None',
1148
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
1148
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
1149 1149
             'id_tree' => $data['id_tree'],
1150 1150
             'perso' => isset($data['perso']) && empty($data['perso']) === false && $data['perso'] !== 'None' ? $data['perso'] : '0',
1151 1151
             'restricted_to' => isset($data['restricted_to']) && empty($data['restricted_to']) === false ? $data['restricted_to'] : '0',
@@ -1167,52 +1167,52 @@  discard block
 block discarded – undo
1167 1167
 function getStatisticsData(array $SETTINGS): array
1168 1168
 {
1169 1169
     DB::query(
1170
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
1170
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
1171 1171
         0
1172 1172
     );
1173 1173
     $counter_folders = DB::count();
1174 1174
     DB::query(
1175
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
1175
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
1176 1176
         1
1177 1177
     );
1178 1178
     $counter_folders_perso = DB::count();
1179 1179
     DB::query(
1180
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
1180
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
1181 1181
         0
1182 1182
     );
1183 1183
     $counter_items = DB::count();
1184 1184
         DB::query(
1185
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
1185
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
1186 1186
         1
1187 1187
     );
1188 1188
     $counter_items_perso = DB::count();
1189 1189
         DB::query(
1190
-        'SELECT id FROM ' . prefixTable('users') . ''
1190
+        'SELECT id FROM '.prefixTable('users').''
1191 1191
     );
1192 1192
     $counter_users = DB::count();
1193 1193
         DB::query(
1194
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE admin = %i',
1194
+        'SELECT id FROM '.prefixTable('users').' WHERE admin = %i',
1195 1195
         1
1196 1196
     );
1197 1197
     $admins = DB::count();
1198 1198
     DB::query(
1199
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE gestionnaire = %i',
1199
+        'SELECT id FROM '.prefixTable('users').' WHERE gestionnaire = %i',
1200 1200
         1
1201 1201
     );
1202 1202
     $managers = DB::count();
1203 1203
     DB::query(
1204
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE read_only = %i',
1204
+        'SELECT id FROM '.prefixTable('users').' WHERE read_only = %i',
1205 1205
         1
1206 1206
     );
1207 1207
     $readOnly = DB::count();
1208 1208
     // list the languages
1209 1209
     $usedLang = [];
1210 1210
     $tp_languages = DB::query(
1211
-        'SELECT name FROM ' . prefixTable('languages')
1211
+        'SELECT name FROM '.prefixTable('languages')
1212 1212
     );
1213 1213
     foreach ($tp_languages as $tp_language) {
1214 1214
         DB::query(
1215
-            'SELECT * FROM ' . prefixTable('users') . ' WHERE user_language = %s',
1215
+            'SELECT * FROM '.prefixTable('users').' WHERE user_language = %s',
1216 1216
             $tp_language['name']
1217 1217
         );
1218 1218
         $usedLang[$tp_language['name']] = round((DB::count() * 100 / $counter_users), 0);
@@ -1221,12 +1221,12 @@  discard block
 block discarded – undo
1221 1221
     // get list of ips
1222 1222
     $usedIp = [];
1223 1223
     $tp_ips = DB::query(
1224
-        'SELECT user_ip FROM ' . prefixTable('users')
1224
+        'SELECT user_ip FROM '.prefixTable('users')
1225 1225
     );
1226 1226
     foreach ($tp_ips as $ip) {
1227 1227
         if (array_key_exists($ip['user_ip'], $usedIp)) {
1228 1228
             $usedIp[$ip['user_ip']] += $usedIp[$ip['user_ip']];
1229
-        } elseif (! empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1229
+        } elseif (!empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1230 1230
             $usedIp[$ip['user_ip']] = 1;
1231 1231
         }
1232 1232
     }
@@ -1292,21 +1292,21 @@  discard block
 block discarded – undo
1292 1292
     }
1293 1293
 
1294 1294
     // Load settings
1295
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
1295
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
1296 1296
     // Load superglobal
1297
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1297
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1298 1298
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1299 1299
     // Get user language
1300
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $superGlobal->get('user_language', 'SESSION') . '.php';
1300
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$superGlobal->get('user_language', 'SESSION').'.php';
1301 1301
     // Load library
1302
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1302
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1303 1303
     // load PHPMailer
1304 1304
     $mail = new SplClassLoader('PHPMailer\PHPMailer', '../includes/libraries');
1305 1305
     $mail->register();
1306 1306
     $mail = new PHPMailer\PHPMailer\PHPMailer(true);
1307 1307
 
1308 1308
     // send to user
1309
-    $mail->setLanguage('en', $SETTINGS['cpassman_dir'] . '/includes/libraries/PHPMailer/PHPMailer/language/');
1309
+    $mail->setLanguage('en', $SETTINGS['cpassman_dir'].'/includes/libraries/PHPMailer/PHPMailer/language/');
1310 1310
     $mail->SMTPDebug = isset($SETTINGS['email_debug_level']) === true ? $SETTINGS['email_debug_level'] : 0;
1311 1311
     $mail->Port = (int) $SETTINGS['email_port'];
1312 1312
     //COULD BE USED
@@ -1413,7 +1413,7 @@  discard block
 block discarded – undo
1413 1413
         <table width="600" cellpadding="0" cellspacing="0" border="0" class="container" bgcolor="#ffffff" style="border-spacing: 0; border-bottom: 1px solid #e0e0e0; box-shadow: 0 0 3px #ddd; color: #434343; font-family: Helvetica, Verdana, sans-serif;">
1414 1414
         <tr><td class="container-padding" bgcolor="#ffffff" style="border-collapse: collapse; border-left: 1px solid #e0e0e0; background-color: #ffffff; padding-left: 30px; padding-right: 30px;">
1415 1415
         <br><div style="float:right;">' .
1416
-        $textMail .
1416
+        $textMail.
1417 1417
         '<br><br></td></tr></table>
1418 1418
     </td></tr></table>
1419 1419
     <br></body></html>';
@@ -1426,7 +1426,7 @@  discard block
 block discarded – undo
1426 1426
  */
1427 1427
 function generateKey(): string
1428 1428
 {
1429
-    return substr(md5(rand() . rand()), 0, 15);
1429
+    return substr(md5(rand().rand()), 0, 15);
1430 1430
 }
1431 1431
 
1432 1432
 /**
@@ -1497,7 +1497,7 @@  discard block
 block discarded – undo
1497 1497
 {
1498 1498
     array_walk_recursive(
1499 1499
         $array,
1500
-        static function (&$item): void {
1500
+        static function(&$item): void {
1501 1501
             if (mb_detect_encoding((string) $item, 'utf-8', true) === false) {
1502 1502
                 $item = utf8_encode($item);
1503 1503
             }
@@ -1519,7 +1519,7 @@  discard block
 block discarded – undo
1519 1519
 function prepareExchangedData($teampassDir, $data, string $type, ?string $key = null)
1520 1520
 {
1521 1521
     // Load superglobal
1522
-    include_once $teampassDir . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1522
+    include_once $teampassDir.'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1523 1523
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1524 1524
     // Get superglobals
1525 1525
     if ($key !== null) {
@@ -1530,9 +1530,9 @@  discard block
 block discarded – undo
1530 1530
     }
1531 1531
 
1532 1532
     //load ClassLoader
1533
-    include_once $teampassDir . '/sources/SplClassLoader.php';
1533
+    include_once $teampassDir.'/sources/SplClassLoader.php';
1534 1534
     //Load AES
1535
-    $aes = new SplClassLoader('Encryption\Crypt', $teampassDir . '/includes/libraries');
1535
+    $aes = new SplClassLoader('Encryption\Crypt', $teampassDir.'/includes/libraries');
1536 1536
     $aes->register();
1537 1537
     if ($type === 'encode' && is_array($data) === true) {
1538 1538
         // Ensure UTF8 format
@@ -1606,8 +1606,8 @@  discard block
 block discarded – undo
1606 1606
  */
1607 1607
 function prefixTable(string $table): string
1608 1608
 {
1609
-    $safeTable = htmlspecialchars(DB_PREFIX . $table);
1610
-    if (! empty($safeTable)) {
1609
+    $safeTable = htmlspecialchars(DB_PREFIX.$table);
1610
+    if (!empty($safeTable)) {
1611 1611
         // sanitize string
1612 1612
         return $safeTable;
1613 1613
     }
@@ -1637,13 +1637,13 @@  discard block
 block discarded – undo
1637 1637
     bool $lowercase = false,
1638 1638
     array $SETTINGS = []
1639 1639
 ): string {
1640
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1641
-    $generator = new SplClassLoader('PasswordGenerator\Generator', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1640
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1641
+    $generator = new SplClassLoader('PasswordGenerator\Generator', $SETTINGS['cpassman_dir'].'/includes/libraries');
1642 1642
     $generator->register();
1643 1643
     $generator = new PasswordGenerator\Generator\ComputerPasswordGenerator();
1644 1644
     // Is PHP7 being used?
1645 1645
     if (version_compare(PHP_VERSION, '7.0.0', '>=')) {
1646
-        $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1646
+        $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', $SETTINGS['cpassman_dir'].'/includes/libraries');
1647 1647
         $php7generator->register();
1648 1648
         $generator->setRandomGenerator(new PasswordGenerator\RandomGenerator\Php7RandomGenerator());
1649 1649
     }
@@ -1678,7 +1678,7 @@  discard block
 block discarded – undo
1678 1678
 function send_syslog($message, $host, $port, $component = 'teampass'): void
1679 1679
 {
1680 1680
     $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
1681
-    $syslog_message = '<123>' . date('M d H:i:s ') . $component . ': ' . $message;
1681
+    $syslog_message = '<123>'.date('M d H:i:s ').$component.': '.$message;
1682 1682
     socket_sendto($sock, (string) $syslog_message, strlen($syslog_message), 0, (string) $host, (int) $port);
1683 1683
     socket_close($sock);
1684 1684
 }
@@ -1702,7 +1702,7 @@  discard block
 block discarded – undo
1702 1702
     }
1703 1703
 
1704 1704
     // include librairies & connect to DB
1705
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1705
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1706 1706
     if (defined('DB_PASSWD_CLEAR') === false) {
1707 1707
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1708 1708
     }
@@ -1728,14 +1728,14 @@  discard block
 block discarded – undo
1728 1728
     if (isset($SETTINGS['syslog_enable']) === true && (int) $SETTINGS['syslog_enable'] === 1) {
1729 1729
         if ($type === 'user_mngt') {
1730 1730
             send_syslog(
1731
-                'action=' . str_replace('at_', '', $label) . ' attribute=user user=' . $who . ' userid="' . $login . '" change="' . $field_1 . '" ',
1731
+                'action='.str_replace('at_', '', $label).' attribute=user user='.$who.' userid="'.$login.'" change="'.$field_1.'" ',
1732 1732
                 $SETTINGS['syslog_host'],
1733 1733
                 $SETTINGS['syslog_port'],
1734 1734
                 'teampass'
1735 1735
             );
1736 1736
         } else {
1737 1737
             send_syslog(
1738
-                'action=' . $type . ' attribute=' . $label . ' user=' . $who . ' userid="' . $login . '" ',
1738
+                'action='.$type.' attribute='.$label.' user='.$who.' userid="'.$login.'" ',
1739 1739
                 $SETTINGS['syslog_host'],
1740 1740
                 $SETTINGS['syslog_port'],
1741 1741
                 'teampass'
@@ -1769,7 +1769,7 @@  discard block
 block discarded – undo
1769 1769
     ?string $encryption_type = null
1770 1770
 ): void {
1771 1771
     // include librairies & connect to DB
1772
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1772
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1773 1773
     if (defined('DB_PASSWD_CLEAR') === false) {
1774 1774
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1775 1775
     }
@@ -1815,7 +1815,7 @@  discard block
 block discarded – undo
1815 1815
         if (empty($item_label) === true) {
1816 1816
             $dataItem = DB::queryfirstrow(
1817 1817
                 'SELECT id, id_tree, label
1818
-                FROM ' . prefixTable('items') . '
1818
+                FROM ' . prefixTable('items').'
1819 1819
                 WHERE id = %i',
1820 1820
                 $item_id
1821 1821
             );
@@ -1823,11 +1823,11 @@  discard block
 block discarded – undo
1823 1823
         }
1824 1824
 
1825 1825
         send_syslog(
1826
-            'action=' . str_replace('at_', '', $action) .
1827
-                ' attribute=' . str_replace('at_', '', $attribute[0]) .
1828
-                ' itemno=' . $item_id .
1829
-                ' user=' . is_null($login) === true ? '' : addslashes((string) $login) .
1830
-                ' itemname="' . addslashes($item_label) . '"',
1826
+            'action='.str_replace('at_', '', $action).
1827
+                ' attribute='.str_replace('at_', '', $attribute[0]).
1828
+                ' itemno='.$item_id.
1829
+                ' user='.is_null($login) === true ? '' : addslashes((string) $login).
1830
+                ' itemname="'.addslashes($item_label).'"',
1831 1831
             $SETTINGS['syslog_host'],
1832 1832
             $SETTINGS['syslog_port'],
1833 1833
             'teampass'
@@ -1855,7 +1855,7 @@  discard block
 block discarded – undo
1855 1855
         && $action === 'at_shown'
1856 1856
     ) {
1857 1857
         // Load superglobal
1858
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1858
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1859 1859
         $superGlobal = new protect\SuperGlobal\SuperGlobal();
1860 1860
         // Get superglobals
1861 1861
         $globalsLastname = $superGlobal->get('lastname', 'SESSION');
@@ -1864,7 +1864,7 @@  discard block
 block discarded – undo
1864 1864
         // Get info about item
1865 1865
         $dataItem = DB::queryfirstrow(
1866 1866
             'SELECT id, id_tree, label
1867
-            FROM ' . prefixTable('items') . '
1867
+            FROM ' . prefixTable('items').'
1868 1868
             WHERE id = %i',
1869 1869
             $item_id
1870 1870
         );
@@ -1878,9 +1878,9 @@  discard block
 block discarded – undo
1878 1878
                 'body' => str_replace(
1879 1879
                     ['#tp_user#', '#tp_item#', '#tp_link#'],
1880 1880
                     [
1881
-                        addslashes($globalsName . ' ' . $globalsLastname),
1881
+                        addslashes($globalsName.' '.$globalsLastname),
1882 1882
                         addslashes($item_label),
1883
-                        $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $item_id,
1883
+                        $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$item_id,
1884 1884
                     ],
1885 1885
                     langHdl('email_on_open_notification_mail')
1886 1886
                 ),
@@ -1904,7 +1904,7 @@  discard block
 block discarded – undo
1904 1904
 function notifyChangesToSubscribers(int $item_id, string $label, array $changes, array $SETTINGS): void
1905 1905
 {
1906 1906
     // Load superglobal
1907
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1907
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1908 1908
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1909 1909
     // Get superglobals
1910 1910
     $globalsUserId = $superGlobal->get('user_id', 'SESSION');
@@ -1914,8 +1914,8 @@  discard block
 block discarded – undo
1914 1914
     $notification = DB::queryOneColumn(
1915 1915
         'email',
1916 1916
         'SELECT *
1917
-        FROM ' . prefixTable('notification') . ' AS n
1918
-        INNER JOIN ' . prefixTable('users') . ' AS u ON (n.user_id = u.id)
1917
+        FROM ' . prefixTable('notification').' AS n
1918
+        INNER JOIN ' . prefixTable('users').' AS u ON (n.user_id = u.id)
1919 1919
         WHERE n.item_id = %i AND n.user_id != %i',
1920 1920
         $item_id,
1921 1921
         $globalsUserId
@@ -1926,7 +1926,7 @@  discard block
 block discarded – undo
1926 1926
         // Get list of changes
1927 1927
         $htmlChanges = '<ul>';
1928 1928
         foreach ($changes as $change) {
1929
-            $htmlChanges .= '<li>' . $change . '</li>';
1929
+            $htmlChanges .= '<li>'.$change.'</li>';
1930 1930
         }
1931 1931
         $htmlChanges .= '</ul>';
1932 1932
         // send email
@@ -1959,7 +1959,7 @@  discard block
 block discarded – undo
1959 1959
 function geItemReadablePath(int $id_tree, string $label, array $SETTINGS): string
1960 1960
 {
1961 1961
     // Class loader
1962
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1962
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1963 1963
     //Load Tree
1964 1964
     $tree = new SplClassLoader('Tree\NestedTree', '../includes/libraries');
1965 1965
     $tree->register();
@@ -1968,15 +1968,15 @@  discard block
 block discarded – undo
1968 1968
     $path = '';
1969 1969
     foreach ($arbo as $elem) {
1970 1970
         if (empty($path) === true) {
1971
-            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' ';
1971
+            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' ';
1972 1972
         } else {
1973
-            $path .= '&#8594; ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1973
+            $path .= '&#8594; '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1974 1974
         }
1975 1975
     }
1976 1976
 
1977 1977
     // Build text to show user
1978 1978
     if (empty($label) === false) {
1979
-        return empty($path) === true ? addslashes($label) : addslashes($label) . ' (' . $path . ')';
1979
+        return empty($path) === true ? addslashes($label) : addslashes($label).' ('.$path.')';
1980 1980
     }
1981 1981
     return empty($path) === true ? '' : $path;
1982 1982
 }
@@ -2033,9 +2033,9 @@  discard block
 block discarded – undo
2033 2033
  */
2034 2034
 function handleConfigFile($action, $SETTINGS, $field = null, $value = null)
2035 2035
 {
2036
-    $tp_config_file = $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php';
2036
+    $tp_config_file = $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php';
2037 2037
     // include librairies & connect to DB
2038
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2038
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2039 2039
     if (defined('DB_PASSWD_CLEAR') === false) {
2040 2040
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2041 2041
     }
@@ -2050,8 +2050,8 @@  discard block
 block discarded – undo
2050 2050
     if (file_exists($tp_config_file) === false || $action === 'rebuild') {
2051 2051
         // perform a copy
2052 2052
         if (file_exists($tp_config_file)) {
2053
-            if (! copy($tp_config_file, $tp_config_file . '.' . date('Y_m_d_His', time()))) {
2054
-                return "ERROR: Could not copy file '" . $tp_config_file . "'";
2053
+            if (!copy($tp_config_file, $tp_config_file.'.'.date('Y_m_d_His', time()))) {
2054
+                return "ERROR: Could not copy file '".$tp_config_file."'";
2055 2055
             }
2056 2056
         }
2057 2057
 
@@ -2061,11 +2061,11 @@  discard block
 block discarded – undo
2061 2061
         $data[1] = "global \$SETTINGS;\n";
2062 2062
         $data[2] = "\$SETTINGS = array (\n";
2063 2063
         $rows = DB::query(
2064
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s',
2064
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s',
2065 2065
             'admin'
2066 2066
         );
2067 2067
         foreach ($rows as $record) {
2068
-            array_push($data, "    '" . $record['intitule'] . "' => '" . $record['valeur'] . "',\n");
2068
+            array_push($data, "    '".$record['intitule']."' => '".$record['valeur']."',\n");
2069 2069
         }
2070 2070
         array_push($data, ");\n");
2071 2071
         $data = array_unique($data);
@@ -2079,15 +2079,15 @@  discard block
 block discarded – undo
2079 2079
                 break;
2080 2080
             }
2081 2081
 
2082
-            if (stristr($line, "'" . $field . "' => '")) {
2083
-                $data[$inc] = "    '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n";
2082
+            if (stristr($line, "'".$field."' => '")) {
2083
+                $data[$inc] = "    '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n";
2084 2084
                 $bFound = true;
2085 2085
                 break;
2086 2086
             }
2087 2087
             ++$inc;
2088 2088
         }
2089 2089
         if ($bFound === false) {
2090
-            $data[$inc] = "    '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n);\n";
2090
+            $data[$inc] = "    '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n);\n";
2091 2091
         }
2092 2092
     }
2093 2093
 
@@ -2117,7 +2117,7 @@  discard block
 block discarded – undo
2117 2117
 {
2118 2118
     global $SETTINGS;
2119 2119
     /* LOAD CPASSMAN SETTINGS */
2120
-    if (! isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
2120
+    if (!isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
2121 2121
         $SETTINGS = [];
2122 2122
         $SETTINGS['duplicate_folder'] = 0;
2123 2123
         //by default, this is set to 0;
@@ -2127,7 +2127,7 @@  discard block
 block discarded – undo
2127 2127
         //by default, this value is set to 5;
2128 2128
         $settings = [];
2129 2129
         $rows = DB::query(
2130
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s_type OR type=%s_type2',
2130
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s_type OR type=%s_type2',
2131 2131
             [
2132 2132
                 'type' => 'admin',
2133 2133
                 'type2' => 'settings',
@@ -2159,7 +2159,7 @@  discard block
 block discarded – undo
2159 2159
     $source_cf = [];
2160 2160
     $rows = DB::QUERY(
2161 2161
         'SELECT id_category
2162
-            FROM ' . prefixTable('categories_folders') . '
2162
+            FROM ' . prefixTable('categories_folders').'
2163 2163
             WHERE id_folder = %i',
2164 2164
         $source_id
2165 2165
     );
@@ -2170,7 +2170,7 @@  discard block
 block discarded – undo
2170 2170
     $target_cf = [];
2171 2171
     $rows = DB::QUERY(
2172 2172
         'SELECT id_category
2173
-            FROM ' . prefixTable('categories_folders') . '
2173
+            FROM ' . prefixTable('categories_folders').'
2174 2174
             WHERE id_folder = %i',
2175 2175
         $target_id
2176 2176
     );
@@ -2205,9 +2205,9 @@  discard block
 block discarded – undo
2205 2205
     string $password = null
2206 2206
 ) {
2207 2207
     // Load AntiXSS
2208
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php';
2209
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php';
2210
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php';
2208
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php';
2209
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php';
2210
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php';
2211 2211
     $antiXss = new voku\helper\AntiXSS();
2212 2212
     // Protect against bad inputs
2213 2213
     if (is_array($source_file) === true || is_array($target_file) === true) {
@@ -2219,7 +2219,7 @@  discard block
 block discarded – undo
2219 2219
     $target_file = $antiXss->xss_clean($target_file);
2220 2220
     if (empty($password) === true || is_null($password) === true) {
2221 2221
         // get KEY to define password
2222
-        $ascii_key = file_get_contents(SECUREPATH . '/teampass-seckey.txt');
2222
+        $ascii_key = file_get_contents(SECUREPATH.'/teampass-seckey.txt');
2223 2223
         $password = \Defuse\Crypto\Key::loadFromAsciiSafeString($ascii_key);
2224 2224
     }
2225 2225
 
@@ -2264,15 +2264,15 @@  discard block
 block discarded – undo
2264 2264
 ) {
2265 2265
     // load PhpEncryption library
2266 2266
     $path_to_encryption = '/includes/libraries/Encryption/Encryption/';
2267
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php';
2268
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php';
2269
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php';
2270
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php';
2271
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php';
2272
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php';
2273
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php';
2274
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php';
2275
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php';
2267
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php';
2268
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php';
2269
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php';
2270
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php';
2271
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php';
2272
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php';
2273
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php';
2274
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php';
2275
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php';
2276 2276
     try {
2277 2277
         \Defuse\Crypto\File::encryptFileWithPassword(
2278 2278
             $source_file,
@@ -2309,15 +2309,15 @@  discard block
 block discarded – undo
2309 2309
 ) {
2310 2310
     // load PhpEncryption library
2311 2311
     $path_to_encryption = '/includes/libraries/Encryption/Encryption/';
2312
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php';
2313
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php';
2314
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php';
2315
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php';
2316
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php';
2317
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php';
2318
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php';
2319
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php';
2320
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php';
2312
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php';
2313
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php';
2314
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php';
2315
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php';
2316
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php';
2317
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php';
2318
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php';
2319
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php';
2320
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php';
2321 2321
     try {
2322 2322
         \Defuse\Crypto\File::decryptFileWithPassword(
2323 2323
             $source_file,
@@ -2364,9 +2364,9 @@  discard block
 block discarded – undo
2364 2364
 function fileDelete(string $file, array $SETTINGS): void
2365 2365
 {
2366 2366
     // Load AntiXSS
2367
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php';
2368
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php';
2369
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php';
2367
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php';
2368
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php';
2369
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php';
2370 2370
     $antiXss = new voku\helper\AntiXSS();
2371 2371
     $file = $antiXss->xss_clean($file);
2372 2372
     if (is_file($file)) {
@@ -2416,7 +2416,7 @@  discard block
 block discarded – undo
2416 2416
     int  $dirPerm = 0755
2417 2417
 ) {
2418 2418
     // Check if the path exists
2419
-    if (! file_exists($path)) {
2419
+    if (!file_exists($path)) {
2420 2420
         return false;
2421 2421
     }
2422 2422
 
@@ -2454,7 +2454,7 @@  discard block
 block discarded – undo
2454 2454
  */
2455 2455
 function accessToItemIsGranted(int $item_id, array $SETTINGS)
2456 2456
 {
2457
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2457
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2458 2458
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
2459 2459
     // Prepare superGlobal variables
2460 2460
     $session_groupes_visibles = $superGlobal->get('groupes_visibles', 'SESSION');
@@ -2462,7 +2462,7 @@  discard block
 block discarded – undo
2462 2462
     // Load item data
2463 2463
     $data = DB::queryFirstRow(
2464 2464
         'SELECT id_tree
2465
-        FROM ' . prefixTable('items') . '
2465
+        FROM ' . prefixTable('items').'
2466 2466
         WHERE id = %i',
2467 2467
         $item_id
2468 2468
     );
@@ -2525,7 +2525,7 @@  discard block
 block discarded – undo
2525 2525
         }
2526 2526
         $host .= substr(explode(".", $email[1])[0], -1, 1);
2527 2527
     }
2528
-    $email = $name . "@" . $host . "." . explode(".", $email[1])[1];
2528
+    $email = $name."@".$host.".".explode(".", $email[1])[1];
2529 2529
     return $email;
2530 2530
 }
2531 2531
 
@@ -2541,8 +2541,8 @@  discard block
 block discarded – undo
2541 2541
 function performDBQuery(array $SETTINGS, string $fields, string $table): array
2542 2542
 {
2543 2543
     // include librairies & connect to DB
2544
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2545
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2544
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2545
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2546 2546
     if (defined('DB_PASSWD_CLEAR') === false) {
2547 2547
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2548 2548
     }
@@ -2556,7 +2556,7 @@  discard block
 block discarded – undo
2556 2556
     DB::$connect_options = DB_CONNECT_OPTIONS;
2557 2557
     // Insert log in DB
2558 2558
     return DB::query(
2559
-        'SELECT ' . $fields . '
2559
+        'SELECT '.$fields.'
2560 2560
         FROM ' . prefixTable($table)
2561 2561
     );
2562 2562
 }
@@ -2571,11 +2571,11 @@  discard block
 block discarded – undo
2571 2571
 function formatSizeUnits(int $bytes): string
2572 2572
 {
2573 2573
     if ($bytes >= 1073741824) {
2574
-        $bytes = number_format($bytes / 1073741824, 2) . ' GB';
2574
+        $bytes = number_format($bytes / 1073741824, 2).' GB';
2575 2575
     } elseif ($bytes >= 1048576) {
2576
-        $bytes = number_format($bytes / 1048576, 2) . ' MB';
2576
+        $bytes = number_format($bytes / 1048576, 2).' MB';
2577 2577
     } elseif ($bytes >= 1024) {
2578
-        $bytes = number_format($bytes / 1024, 2) . ' KB';
2578
+        $bytes = number_format($bytes / 1024, 2).' KB';
2579 2579
     } elseif ($bytes > 1) {
2580 2580
         $bytes .= ' bytes';
2581 2581
     } elseif ($bytes === 1) {
@@ -2784,14 +2784,14 @@  discard block
 block discarded – undo
2784 2784
 
2785 2785
     // Encrypt the file content
2786 2786
     $plaintext = file_get_contents(
2787
-        filter_var($fileInPath . '/' . $fileInName, FILTER_SANITIZE_URL)
2787
+        filter_var($fileInPath.'/'.$fileInName, FILTER_SANITIZE_URL)
2788 2788
     );
2789 2789
     $ciphertext = $cipher->encrypt($plaintext);
2790 2790
     // Save new file
2791 2791
     $hash = md5($plaintext);
2792
-    $fileOut = $fileInPath . '/' . TP_FILE_PREFIX . $hash;
2792
+    $fileOut = $fileInPath.'/'.TP_FILE_PREFIX.$hash;
2793 2793
     file_put_contents($fileOut, $ciphertext);
2794
-    unlink($fileInPath . '/' . $fileInName);
2794
+    unlink($fileInPath.'/'.$fileInName);
2795 2795
     return [
2796 2796
         'fileHash' => base64_encode($hash),
2797 2797
         'objectKey' => base64_encode($objectKey),
@@ -2809,7 +2809,7 @@  discard block
 block discarded – undo
2809 2809
  */
2810 2810
 function decryptFile(string $fileName, string $filePath, string $key): string
2811 2811
 {
2812
-    if (! defined('FILE_BUFFER_SIZE')) {
2812
+    if (!defined('FILE_BUFFER_SIZE')) {
2813 2813
         define('FILE_BUFFER_SIZE', 128 * 1024);
2814 2814
     }
2815 2815
 
@@ -2828,7 +2828,7 @@  discard block
 block discarded – undo
2828 2828
     $cipher->enableContinuousBuffer();
2829 2829
     $cipher->disablePadding();
2830 2830
     // Get file content
2831
-    $ciphertext = file_get_contents($filePath . '/' . TP_FILE_PREFIX . $fileName);
2831
+    $ciphertext = file_get_contents($filePath.'/'.TP_FILE_PREFIX.$fileName);
2832 2832
     // Decrypt file content and return
2833 2833
     return base64_encode($cipher->decrypt($ciphertext));
2834 2834
 }
@@ -2882,8 +2882,8 @@  discard block
 block discarded – undo
2882 2882
     array $SETTINGS
2883 2883
 ): void {
2884 2884
     // include librairies & connect to DB
2885
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2886
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2885
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2886
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2887 2887
     if (defined('DB_PASSWD_CLEAR') === false) {
2888 2888
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2889 2889
     }
@@ -2902,7 +2902,7 @@  discard block
 block discarded – undo
2902 2902
         $post_object_id
2903 2903
     );
2904 2904
     // Superglobals
2905
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2905
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2906 2906
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
2907 2907
     // Prepare superGlobal variables
2908 2908
     $sessionPpersonaFolders = $superGlobal->get('personal_folders', 'SESSION');
@@ -2927,8 +2927,8 @@  discard block
 block discarded – undo
2927 2927
         // Create sharekey for each user
2928 2928
         $users = DB::query(
2929 2929
             'SELECT id, public_key
2930
-            FROM ' . prefixTable('users') . '
2931
-            WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '")
2930
+            FROM ' . prefixTable('users').'
2931
+            WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'")
2932 2932
             AND public_key != ""'
2933 2933
         );
2934 2934
         foreach ($users as $user) {
@@ -2958,7 +2958,7 @@  discard block
 block discarded – undo
2958 2958
 function isBase64(string $str): bool
2959 2959
 {
2960 2960
     $str = (string) trim($str);
2961
-    if (! isset($str[0])) {
2961
+    if (!isset($str[0])) {
2962 2962
         return false;
2963 2963
     }
2964 2964
 
@@ -3026,12 +3026,12 @@  discard block
 block discarded – undo
3026 3026
         ],
3027 3027
     ];
3028 3028
     // Load expected libraries
3029
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
3030
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php';
3031
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php';
3032
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php';
3033
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php';
3034
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php';
3029
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
3030
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php';
3031
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php';
3032
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php';
3033
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php';
3034
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php';
3035 3035
     $ad = new SplClassLoader('LdapRecord', '../includes/libraries');
3036 3036
     $ad->register();
3037 3037
     $connection = new Connection($config);
@@ -3040,7 +3040,7 @@  discard block
 block discarded – undo
3040 3040
         $connection->connect();
3041 3041
     } catch (\LdapRecord\Auth\BindException $e) {
3042 3042
         $error = $e->getDetailedError();
3043
-        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage();
3043
+        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage();
3044 3044
         return false;
3045 3045
     }
3046 3046
 
@@ -3053,7 +3053,7 @@  discard block
 block discarded – undo
3053 3053
         }
3054 3054
     } catch (\LdapRecord\Auth\BindException $e) {
3055 3055
         $error = $e->getDetailedError();
3056
-        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage();
3056
+        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage();
3057 3057
         return false;
3058 3058
     }
3059 3059
 
@@ -3071,8 +3071,8 @@  discard block
 block discarded – undo
3071 3071
 function deleteUserObjetsKeys(int $userId, array $SETTINGS): bool
3072 3072
 {
3073 3073
     // include librairies & connect to DB
3074
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
3075
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
3074
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
3075
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
3076 3076
     if (defined('DB_PASSWD_CLEAR') === false) {
3077 3077
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
3078 3078
     }
@@ -3132,7 +3132,7 @@  discard block
 block discarded – undo
3132 3132
         foreach (DateTimeZone::listIdentifiers() as $timezone) {
3133 3133
             $now->setTimezone(new DateTimeZone($timezone));
3134 3134
             $offsets[] = $offset = $now->getOffset();
3135
-            $timezones[$timezone] = '(' . format_GMT_offset($offset) . ') ' . format_timezone_name($timezone);
3135
+            $timezones[$timezone] = '('.format_GMT_offset($offset).') '.format_timezone_name($timezone);
3136 3136
         }
3137 3137
 
3138 3138
         array_multisort($offsets, $timezones);
@@ -3152,7 +3152,7 @@  discard block
 block discarded – undo
3152 3152
 {
3153 3153
     $hours = intval($offset / 3600);
3154 3154
     $minutes = abs(intval($offset % 3600 / 60));
3155
-    return 'GMT' . ($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
3155
+    return 'GMT'.($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
3156 3156
 }
3157 3157
 
3158 3158
 /**
@@ -3255,8 +3255,7 @@  discard block
 block discarded – undo
3255 3255
 {
3256 3256
     if (isset($array[$key]) === true
3257 3257
         && (is_int($value) === true ?
3258
-            (int) $array[$key] === $value :
3259
-            (string) $array[$key] === $value)
3258
+            (int) $array[$key] === $value : (string) $array[$key] === $value)
3260 3259
     ) {
3261 3260
         return true;
3262 3261
     }
@@ -3278,8 +3277,7 @@  discard block
 block discarded – undo
3278 3277
 {
3279 3278
     if (isset($var) === false
3280 3279
         || (is_int($value) === true ?
3281
-            (int) $var === $value :
3282
-            (string) $var === $value)
3280
+            (int) $var === $value : (string) $var === $value)
3283 3281
     ) {
3284 3282
         return true;
3285 3283
     }
@@ -3330,7 +3328,7 @@  discard block
 block discarded – undo
3330 3328
  */
3331 3329
 function isSetArrayOfValues(array $arrayOfValues): bool
3332 3330
 {
3333
-    foreach($arrayOfValues as $value) {
3331
+    foreach ($arrayOfValues as $value) {
3334 3332
         if (isset($value) === false) {
3335 3333
             return false;
3336 3334
         }
@@ -3352,7 +3350,7 @@  discard block
 block discarded – undo
3352 3350
     /*PHP8 - integer|string*/$value
3353 3351
 ) : bool
3354 3352
 {
3355
-    foreach($arrayOfVars as $variable) {
3353
+    foreach ($arrayOfVars as $variable) {
3356 3354
         if ($variable !== $value) {
3357 3355
             return false;
3358 3356
         }
@@ -3372,7 +3370,7 @@  discard block
 block discarded – undo
3372 3370
     /*PHP8 - integer|string*/$value
3373 3371
 ) : bool
3374 3372
 {
3375
-    foreach($arrayOfVars as $variable) {
3373
+    foreach ($arrayOfVars as $variable) {
3376 3374
         if ($variable === $value) {
3377 3375
             return true;
3378 3376
         }
@@ -3445,16 +3443,16 @@  discard block
 block discarded – undo
3445 3443
 ): array
3446 3444
 {
3447 3445
     // Load Sanitizer library
3448
-    require_once $path . '/includes/libraries/Illuminate/Support/Traits/Macroable.php';
3449
-    require_once $path . '/includes/libraries/Illuminate/Support/Str.php';
3450
-    require_once $path . '/includes/libraries/Illuminate/Validation/ValidationRuleParser.php';
3451
-    require_once $path . '/includes/libraries/Illuminate/Support/Arr.php';
3452
-    require_once $path . '/includes/libraries/Elegant/sanitizer/Contracts/Filter.php';
3453
-    require_once $path . '/includes/libraries/Elegant/sanitizer/Filters/Trim.php';
3454
-    require_once $path . '/includes/libraries/Elegant/sanitizer/Filters/Cast.php';
3455
-    require_once $path . '/includes/libraries/Elegant/sanitizer/Filters/EscapeHTML.php';
3456
-    require_once $path . '/includes/libraries/Elegant/sanitizer/Filters/EmptyStringToNull.php';
3457
-    require_once $path . '/includes/libraries/Elegant/sanitizer/Sanitizer.php';
3446
+    require_once $path.'/includes/libraries/Illuminate/Support/Traits/Macroable.php';
3447
+    require_once $path.'/includes/libraries/Illuminate/Support/Str.php';
3448
+    require_once $path.'/includes/libraries/Illuminate/Validation/ValidationRuleParser.php';
3449
+    require_once $path.'/includes/libraries/Illuminate/Support/Arr.php';
3450
+    require_once $path.'/includes/libraries/Elegant/sanitizer/Contracts/Filter.php';
3451
+    require_once $path.'/includes/libraries/Elegant/sanitizer/Filters/Trim.php';
3452
+    require_once $path.'/includes/libraries/Elegant/sanitizer/Filters/Cast.php';
3453
+    require_once $path.'/includes/libraries/Elegant/sanitizer/Filters/EscapeHTML.php';
3454
+    require_once $path.'/includes/libraries/Elegant/sanitizer/Filters/EmptyStringToNull.php';
3455
+    require_once $path.'/includes/libraries/Elegant/sanitizer/Sanitizer.php';
3458 3456
 
3459 3457
     // Sanitize post and get variables
3460 3458
     $sanitizer = new Elegant\sanitizer\Sanitizer($data, $filters);
Please login to merge, or discard this patch.
sources/items.queries.php 1 patch
Spacing   +298 added lines, -298 removed lines patch added patch discarded remove patch
@@ -37,12 +37,12 @@  discard block
 block discarded – undo
37 37
 }
38 38
 
39 39
 // Do checks
40
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
41
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
40
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
41
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
42 42
 if (checkUser($_SESSION['user_id'], $_SESSION['key'], 'items', $SETTINGS) === false) {
43 43
     // Not allowed page
44 44
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
45
-    include $SETTINGS['cpassman_dir'] . '/error.php';
45
+    include $SETTINGS['cpassman_dir'].'/error.php';
46 46
     exit;
47 47
 }
48 48
 
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
     date_default_timezone_set('UTC');
56 56
 }
57 57
 
58
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
59
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
58
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
59
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
60 60
 header('Content-type: text/html; charset=utf-8');
61 61
 header('Cache-Control: no-cache, must-revalidate');
62 62
 require_once 'main.functions.php';
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 }
77 77
 
78 78
 // Connect to mysql server
79
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
79
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
80 80
 if (defined('DB_PASSWD_CLEAR') === false) {
81 81
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
82 82
 }
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 DB::$connect_options = DB_CONNECT_OPTIONS;
91 91
 
92 92
 // Load Tree
93
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tree/NestedTree/NestedTree.php';
93
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tree/NestedTree/NestedTree.php';
94 94
 $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
95 95
 
96 96
 
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
                 // About special settings
328 328
                 $dataFolderSettings = DB::queryFirstRow(
329 329
                     'SELECT bloquer_creation, bloquer_modification, personal_folder
330
-                    FROM ' . prefixTable('nested_tree') . ' 
330
+                    FROM ' . prefixTable('nested_tree').' 
331 331
                     WHERE id = %i',
332 332
                     $inputData['folderId']
333 333
                 );
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
                 // Get folder complexity
345 345
                 $folderComplexity = DB::queryfirstrow(
346 346
                     'SELECT valeur
347
-                    FROM ' . prefixTable('misc') . '
347
+                    FROM ' . prefixTable('misc').'
348 348
                     WHERE type = %s AND intitule = %i',
349 349
                     'complex',
350 350
                     $inputData['folderId']
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
                 $itemExists = 0;
371 371
                 $newID = '';
372 372
                 $data = DB::queryfirstrow(
373
-                    'SELECT * FROM ' . prefixTable('items') . '
373
+                    'SELECT * FROM '.prefixTable('items').'
374 374
                     WHERE label = %s AND inactif = %i',
375 375
                     $inputData['label'],
376 376
                     0
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
                                 // should we encrypt the data
498 498
                                 $dataTmp = DB::queryFirstRow(
499 499
                                     'SELECT encrypted_data
500
-                                    FROM ' . prefixTable('categories') . '
500
+                                    FROM ' . prefixTable('categories').'
501 501
                                     WHERE id = %i',
502 502
                                     $field_data[0]
503 503
                                 );
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
                     ) {
554 554
                         DB::queryFirstRow(
555 555
                             'SELECT *
556
-                            FROM ' . prefixTable('templates') . '
556
+                            FROM ' . prefixTable('templates').'
557 557
                             WHERE item_id = %i',
558 558
                             $newID
559 559
                         );
@@ -622,11 +622,11 @@  discard block
 block discarded – undo
622 622
                     ) {
623 623
                         foreach ($post_restricted_to as $userRest) {
624 624
                             if (empty($userRest) === false) {
625
-                                $dataTmp = DB::queryfirstrow('SELECT login FROM ' . prefixTable('users') . ' WHERE id= %i', $userRest);
625
+                                $dataTmp = DB::queryfirstrow('SELECT login FROM '.prefixTable('users').' WHERE id= %i', $userRest);
626 626
                                 if (empty($listOfRestricted)) {
627 627
                                     $listOfRestricted = $dataTmp['login'];
628 628
                                 } else {
629
-                                    $listOfRestricted .= ';' . $dataTmp['login'];
629
+                                    $listOfRestricted .= ';'.$dataTmp['login'];
630 630
                                 }
631 631
                             }
632 632
                         }
@@ -640,11 +640,11 @@  discard block
 block discarded – undo
640 640
                         if (empty($data['restricted_to']) === false) {
641 641
                             foreach (explode(';', $data['restricted_to']) as $userRest) {
642 642
                                 if (empty($userRest) === false) {
643
-                                    $dataTmp = DB::queryfirstrow('SELECT login FROM ' . prefixTable('users') . ' WHERE id= ' . $userRest);
643
+                                    $dataTmp = DB::queryfirstrow('SELECT login FROM '.prefixTable('users').' WHERE id= '.$userRest);
644 644
                                     if (empty($oldRestrictionList) === true) {
645 645
                                         $oldRestrictionList = $dataTmp['login'];
646 646
                                     } else {
647
-                                        $oldRestrictionList .= ';' . $dataTmp['login'];
647
+                                        $oldRestrictionList .= ';'.$dataTmp['login'];
648 648
                                     }
649 649
                                 }
650 650
                             }
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
                     if (empty($post_uploaded_file_id) === false) {
708 708
                         $rows = DB::query(
709 709
                             'SELECT id
710
-                            FROM ' . prefixTable('files') . '
710
+                            FROM ' . prefixTable('files').'
711 711
                             WHERE id_item = %s',
712 712
                             $post_uploaded_file_id
713 713
                         );
@@ -747,14 +747,14 @@  discard block
 block discarded – undo
747 747
                                     langHdl('email_subject'),
748 748
                                     str_replace(
749 749
                                         array('#label', '#link'),
750
-                                        array($path, $SETTINGS['email_server_url'] . '/index.php?page=items&group=' . $inputData['folderId'] . '&id=' . $newID . $txt['email_body3']),
750
+                                        array($path, $SETTINGS['email_server_url'].'/index.php?page=items&group='.$inputData['folderId'].'&id='.$newID.$txt['email_body3']),
751 751
                                         langHdl('new_item_email_body')
752 752
                                     ),
753 753
                                     $emailAddress,
754 754
                                     $SETTINGS,
755 755
                                     str_replace(
756 756
                                         array('#label', '#link'),
757
-                                        array($path, $SETTINGS['email_server_url'] . '/index.php?page=items&group=' . $inputData['folderId'] . '&id=' . $newID . $txt['email_body3']),
757
+                                        array($path, $SETTINGS['email_server_url'].'/index.php?page=items&group='.$inputData['folderId'].'&id='.$newID.$txt['email_body3']),
758 758
                                         langHdl('new_item_email_body')
759 759
                                     )
760 760
                                 );
@@ -804,7 +804,7 @@  discard block
 block discarded – undo
804 804
 
805 805
             // Encrypt data to return
806 806
             echo (string) prepareExchangedData(
807
-                $SETTINGS['cpassman_dir'],$arrData,
807
+                $SETTINGS['cpassman_dir'], $arrData,
808 808
                 'encode'
809 809
             );
810 810
             break;
@@ -928,7 +928,7 @@  discard block
 block discarded – undo
928 928
                 // About special settings
929 929
                 $dataFolderSettings = DB::queryFirstRow(
930 930
                     'SELECT bloquer_creation, bloquer_modification, personal_folder, title
931
-                    FROM ' . prefixTable('nested_tree') . ' 
931
+                    FROM ' . prefixTable('nested_tree').' 
932 932
                     WHERE id = %i',
933 933
                     $inputData['folderId']
934 934
                 );
@@ -944,7 +944,7 @@  discard block
 block discarded – undo
944 944
                 // Get folder complexity
945 945
                 $folderComplexity = DB::queryfirstrow(
946 946
                     'SELECT valeur
947
-                    FROM ' . prefixTable('misc') . '
947
+                    FROM ' . prefixTable('misc').'
948 948
                     WHERE type = %s AND intitule = %i',
949 949
                     'complex',
950 950
                     $inputData['folderId']
@@ -984,8 +984,8 @@  discard block
 block discarded – undo
984 984
                 // Get all informations for this item
985 985
                 $dataItem = DB::queryfirstrow(
986 986
                     'SELECT *
987
-                    FROM ' . prefixTable('items') . ' as i
988
-                    INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
987
+                    FROM ' . prefixTable('items').' as i
988
+                    INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
989 989
                     WHERE i.id=%i AND l.action = %s',
990 990
                     $inputData['itemId'],
991 991
                     'at_creation'
@@ -995,7 +995,7 @@  discard block
 block discarded – undo
995 995
 				//db::debugmode(true);
996 996
                 DB::query(
997 997
                     'SELECT *
998
-                    FROM ' . prefixTable('sharekeys_items') . '
998
+                    FROM ' . prefixTable('sharekeys_items').'
999 999
                     WHERE object_id = %i AND user_id = %s',
1000 1000
                     $inputData['itemId'],
1001 1001
                     $_SESSION['user_id']
@@ -1044,9 +1044,9 @@  discard block
 block discarded – undo
1044 1044
                         'SELECT i.id as id, i.label as label, i.description as description, i.pw as pw, i.url as url, i.id_tree as id_tree, i.perso as perso, i.login as login, 
1045 1045
                         i.inactif as inactif, i.restricted_to as restricted_to, i.anyone_can_modify as anyone_can_modify, i.email as email, i.notification as notification,
1046 1046
                         u.login as user_login, u.email as user_email
1047
-                        FROM ' . prefixTable('items') . ' as i
1048
-                        INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id=l.id_item)
1049
-                        INNER JOIN ' . prefixTable('users') . ' as u ON (u.id=l.id_user)
1047
+                        FROM ' . prefixTable('items').' as i
1048
+                        INNER JOIN ' . prefixTable('log_items').' as l ON (i.id=l.id_item)
1049
+                        INNER JOIN ' . prefixTable('users').' as u ON (u.id=l.id_user)
1050 1050
                         WHERE i.id=%i',
1051 1051
                         $inputData['itemId']
1052 1052
                     );
@@ -1054,7 +1054,7 @@  discard block
 block discarded – undo
1054 1054
                     // Should we log a password change?
1055 1055
                     $userKey = DB::queryFirstRow(
1056 1056
                         'SELECT share_key
1057
-                        FROM ' . prefixTable('sharekeys_items') . '
1057
+                        FROM ' . prefixTable('sharekeys_items').'
1058 1058
                         WHERE user_id = %i AND object_id = %i',
1059 1059
                         $_SESSION['user_id'],
1060 1060
                         $inputData['itemId']
@@ -1113,7 +1113,7 @@  discard block
 block discarded – undo
1113 1113
                     // Get list of tags
1114 1114
                     $itemTags = DB::queryFirstColumn(
1115 1115
                         'SELECT tag
1116
-                        FROM ' . prefixTable('tags') . '
1116
+                        FROM ' . prefixTable('tags').'
1117 1117
                         WHERE item_id = %i',
1118 1118
                         $inputData['itemId']
1119 1119
                     );
@@ -1156,7 +1156,7 @@  discard block
 block discarded – undo
1156 1156
                             $_SESSION['user_id'],
1157 1157
                             'at_modification',
1158 1158
                             $_SESSION['login'],
1159
-                            'at_tag : ' . implode(' ', $itemTags) . ' => ' . $post_tags
1159
+                            'at_tag : '.implode(' ', $itemTags).' => '.$post_tags
1160 1160
                         );
1161 1161
                     }
1162 1162
 
@@ -1194,8 +1194,8 @@  discard block
 block discarded – undo
1194 1194
                                     'SELECT c.id AS id, c.title AS title, i.data AS data, i.data_iv AS data_iv,
1195 1195
                                     i.encryption_type AS encryption_type, c.encrypted_data AS encrypted_data,
1196 1196
                                     c.masked AS masked, i.id AS field_item_id
1197
-                                    FROM ' . prefixTable('categories_items') . ' AS i
1198
-                                    INNER JOIN ' . prefixTable('categories') . ' AS c ON (i.field_id=c.id)
1197
+                                    FROM ' . prefixTable('categories_items').' AS i
1198
+                                    INNER JOIN ' . prefixTable('categories').' AS c ON (i.field_id=c.id)
1199 1199
                                     WHERE i.field_id = %i AND i.item_id = %i',
1200 1200
                                     $field['id'],
1201 1201
                                     $inputData['itemId']
@@ -1209,7 +1209,7 @@  discard block
 block discarded – undo
1209 1209
                                     // Perform new query
1210 1210
                                     $dataTmpCat = DB::queryFirstRow(
1211 1211
                                         'SELECT id, title, encrypted_data, masked
1212
-                                        FROM ' . prefixTable('categories') . '
1212
+                                        FROM ' . prefixTable('categories').'
1213 1213
                                         WHERE id = %i',
1214 1214
                                         $field['id']
1215 1215
                                     );
@@ -1281,7 +1281,7 @@  discard block
 block discarded – undo
1281 1281
                                         $_SESSION['user_id'],
1282 1282
                                         'at_modification',
1283 1283
                                         $_SESSION['login'],
1284
-                                        'at_field : ' . $dataTmpCat['title'] . ' : ' . $field['value']
1284
+                                        'at_field : '.$dataTmpCat['title'].' : '.$field['value']
1285 1285
                                     );
1286 1286
                                 } else {
1287 1287
                                     // compare the old and new value
@@ -1289,7 +1289,7 @@  discard block
 block discarded – undo
1289 1289
                                         // Get user sharekey for this field
1290 1290
                                         $userKey = DB::queryFirstRow(
1291 1291
                                             'SELECT share_key
1292
-                                            FROM ' . prefixTable('sharekeys_fields') . '
1292
+                                            FROM ' . prefixTable('sharekeys_fields').'
1293 1293
                                             WHERE user_id = %i AND object_id = %i',
1294 1294
                                             $_SESSION['user_id'],
1295 1295
                                             $dataTmpCat['field_item_id']
@@ -1359,7 +1359,7 @@  discard block
 block discarded – undo
1359 1359
                                             $_SESSION['user_id'],
1360 1360
                                             'at_modification',
1361 1361
                                             $_SESSION['login'],
1362
-                                            'at_field : ' . $dataTmpCat['title'] . ' => ' . $oldVal
1362
+                                            'at_field : '.$dataTmpCat['title'].' => '.$oldVal
1363 1363
                                         );
1364 1364
                                     }
1365 1365
                                 }
@@ -1384,7 +1384,7 @@  discard block
 block discarded – undo
1384 1384
                     ) {
1385 1385
                         DB::queryFirstRow(
1386 1386
                             'SELECT *
1387
-                            FROM ' . prefixTable('templates') . '
1387
+                            FROM ' . prefixTable('templates').'
1388 1388
                             WHERE item_id = %i',
1389 1389
                             $inputData['itemId']
1390 1390
                         );
@@ -1427,7 +1427,7 @@  discard block
 block discarded – undo
1427 1427
                         // check if elem exists in Table. If not add it or update it.
1428 1428
                         DB::query(
1429 1429
                             'SELECT *
1430
-                            FROM ' . prefixTable('automatic_del') . '
1430
+                            FROM ' . prefixTable('automatic_del').'
1431 1431
                             WHERE item_id = %i',
1432 1432
                             $inputData['itemId']
1433 1433
                         );
@@ -1454,7 +1454,7 @@  discard block
 block discarded – undo
1454 1454
                                 // Store updates performed
1455 1455
                                 array_push(
1456 1456
                                     $arrayOfChanges,
1457
-                                    langHdl('automatic_deletion_engaged') . ': ' . langHdl('enabled')
1457
+                                    langHdl('automatic_deletion_engaged').': '.langHdl('enabled')
1458 1458
                                 );
1459 1459
 
1460 1460
                                 // update LOG
@@ -1497,7 +1497,7 @@  discard block
 block discarded – undo
1497 1497
                                 // Store updates performed
1498 1498
                                 array_push(
1499 1499
                                     $arrayOfChanges,
1500
-                                    langHdl('automatic_deletion_engaged') . ': ' . langHdl('disabled')
1500
+                                    langHdl('automatic_deletion_engaged').': '.langHdl('disabled')
1501 1501
                                 );
1502 1502
 
1503 1503
                                 // update LOG
@@ -1530,7 +1530,7 @@  discard block
 block discarded – undo
1530 1530
                             if (empty($userId) === false) {
1531 1531
                                 $dataTmp = DB::queryfirstrow(
1532 1532
                                     'SELECT id, name, lastname
1533
-                                    FROM ' . prefixTable('users') . '
1533
+                                    FROM ' . prefixTable('users').'
1534 1534
                                     WHERE id= %i',
1535 1535
                                     $userId
1536 1536
                                 );
@@ -1538,7 +1538,7 @@  discard block
 block discarded – undo
1538 1538
                                 // Add to array
1539 1539
                                 array_push(
1540 1540
                                     $arrayOfUsersRestriction,
1541
-                                    $dataTmp['name'] . ' ' . $dataTmp['lastname']
1541
+                                    $dataTmp['name'].' '.$dataTmp['lastname']
1542 1542
                                 );
1543 1543
                                 array_push(
1544 1544
                                     $arrayOfUsersIdRestriction,
@@ -1569,8 +1569,8 @@  discard block
 block discarded – undo
1569 1569
                         // get values before deleting them
1570 1570
                         $rows = DB::query(
1571 1571
                             'SELECT t.title, t.id AS id
1572
-                            FROM ' . prefixTable('roles_title') . ' as t
1573
-                            INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (t.id=r.role_id)
1572
+                            FROM ' . prefixTable('roles_title').' as t
1573
+                            INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (t.id=r.role_id)
1574 1574
                             WHERE r.item_id = %i
1575 1575
                             ORDER BY t.title ASC',
1576 1576
                             $inputData['itemId']
@@ -1604,7 +1604,7 @@  discard block
 block discarded – undo
1604 1604
                                 );
1605 1605
                                 $dataTmp = DB::queryfirstrow(
1606 1606
                                     'SELECT title
1607
-                                    FROM ' . prefixTable('roles_title') . '
1607
+                                    FROM ' . prefixTable('roles_title').'
1608 1608
                                     WHERE id = %i',
1609 1609
                                     $role
1610 1610
                                 );
@@ -1645,8 +1645,8 @@  discard block
 block discarded – undo
1645 1645
                             $_SESSION['user_id'],
1646 1646
                             'at_modification',
1647 1647
                             $_SESSION['login'],
1648
-                            'at_restriction : ' . (count($diffUsersRestiction) > 0 ?
1649
-                                implode(', ', $arrayOfUsersRestriction) . (count($diffRolesRestiction) > 0 ? ', ' : '') : '') . (count($diffRolesRestiction) > 0 ? implode(', ', $arrayOfRestrictionRoles) : '')
1648
+                            'at_restriction : '.(count($diffUsersRestiction) > 0 ?
1649
+                                implode(', ', $arrayOfUsersRestriction).(count($diffRolesRestiction) > 0 ? ', ' : '') : '').(count($diffRolesRestiction) > 0 ? implode(', ', $arrayOfRestrictionRoles) : '')
1650 1650
                         );
1651 1651
                     }
1652 1652
 
@@ -1666,7 +1666,7 @@  discard block
 block discarded – undo
1666 1666
                             $_SESSION['user_id'],
1667 1667
                             'at_modification',
1668 1668
                             $_SESSION['login'],
1669
-                            'at_label : ' . $data['label'] . ' => ' . $inputData['label']
1669
+                            'at_label : '.$data['label'].' => '.$inputData['label']
1670 1670
                         );
1671 1671
                     }
1672 1672
                     // LOGIN
@@ -1685,7 +1685,7 @@  discard block
 block discarded – undo
1685 1685
                             $_SESSION['user_id'],
1686 1686
                             'at_modification',
1687 1687
                             $_SESSION['login'],
1688
-                            'at_login : ' . $data['login'] . ' => ' . $post_login
1688
+                            'at_login : '.$data['login'].' => '.$post_login
1689 1689
                         );
1690 1690
                     }
1691 1691
                     // EMAIL
@@ -1704,7 +1704,7 @@  discard block
 block discarded – undo
1704 1704
                             $_SESSION['user_id'],
1705 1705
                             'at_modification',
1706 1706
                             $_SESSION['login'],
1707
-                            'at_email : ' . $data['email'] . ' => ' . $post_email
1707
+                            'at_email : '.$data['email'].' => '.$post_email
1708 1708
                         );
1709 1709
                     }
1710 1710
                     // URL
@@ -1723,7 +1723,7 @@  discard block
 block discarded – undo
1723 1723
                             $_SESSION['user_id'],
1724 1724
                             'at_modification',
1725 1725
                             $_SESSION['login'],
1726
-                            'at_url : ' . $data['url'] . ' => ' . $post_url
1726
+                            'at_url : '.$data['url'].' => '.$post_url
1727 1727
                         );
1728 1728
                     }
1729 1729
                     // DESCRIPTION
@@ -1748,7 +1748,7 @@  discard block
 block discarded – undo
1748 1748
                     // FOLDER
1749 1749
                     if ((int) $data['id_tree'] !== (int) $inputData['folderId']) {
1750 1750
                         // Get name of folders
1751
-                        $dataTmp = DB::query('SELECT title FROM ' . prefixTable('nested_tree') . ' WHERE id IN %li', array($data['id_tree'], $inputData['folderId']));
1751
+                        $dataTmp = DB::query('SELECT title FROM '.prefixTable('nested_tree').' WHERE id IN %li', array($data['id_tree'], $inputData['folderId']));
1752 1752
 
1753 1753
                         // Store updates performed
1754 1754
                         array_push(
@@ -1764,7 +1764,7 @@  discard block
 block discarded – undo
1764 1764
                             $_SESSION['user_id'],
1765 1765
                             'at_modification',
1766 1766
                             $_SESSION['login'],
1767
-                            'at_category : ' . $dataTmp[0]['title'] . ' => ' . $dataTmp[1]['title']
1767
+                            'at_category : '.$dataTmp[0]['title'].' => '.$dataTmp[1]['title']
1768 1768
                         );
1769 1769
                     }
1770 1770
                     // ANYONE_CAN_MODIFY
@@ -1772,7 +1772,7 @@  discard block
 block discarded – undo
1772 1772
                         // Store updates performed
1773 1773
                         array_push(
1774 1774
                             $arrayOfChanges,
1775
-                            langHdl('at_anyoneconmodify') . ': ' . ((int) $post_anyone_can_modify === 0 ? langHdl('disabled') : langHdl('enabled'))
1775
+                            langHdl('at_anyoneconmodify').': '.((int) $post_anyone_can_modify === 0 ? langHdl('disabled') : langHdl('enabled'))
1776 1776
                         );
1777 1777
 
1778 1778
                         // Log
@@ -1783,15 +1783,15 @@  discard block
 block discarded – undo
1783 1783
                             $_SESSION['user_id'],
1784 1784
                             'at_modification',
1785 1785
                             $_SESSION['login'],
1786
-                            'at_anyoneconmodify : ' . ((int) $post_anyone_can_modify === 0 ? 'disabled' : 'enabled')
1786
+                            'at_anyoneconmodify : '.((int) $post_anyone_can_modify === 0 ? 'disabled' : 'enabled')
1787 1787
                         );
1788 1788
                     }
1789 1789
 
1790 1790
                     // Reload new values
1791 1791
                     $dataItem = DB::queryfirstrow(
1792 1792
                         'SELECT *
1793
-                        FROM ' . prefixTable('items') . ' as i
1794
-                        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
1793
+                        FROM ' . prefixTable('items').' as i
1794
+                        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
1795 1795
                         WHERE i.id = %i AND l.action = %s',
1796 1796
                         $inputData['itemId'],
1797 1797
                         'at_creation'
@@ -1800,8 +1800,8 @@  discard block
 block discarded – undo
1800 1800
                     $history = '';
1801 1801
                     $rows = DB::query(
1802 1802
                         'SELECT l.date as date, l.action as action, l.raison as raison, u.login as login
1803
-                        FROM ' . prefixTable('log_items') . ' as l
1804
-                        LEFT JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id)
1803
+                        FROM ' . prefixTable('log_items').' as l
1804
+                        LEFT JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id)
1805 1805
                         WHERE l.action <> %s AND id_item=%s',
1806 1806
                         'at_shown',
1807 1807
                         $inputData['itemId']
@@ -1810,14 +1810,14 @@  discard block
 block discarded – undo
1810 1810
                         if ($record['raison'] === NULL) continue;
1811 1811
                         $reason = explode(':', $record['raison']);
1812 1812
                         if (count($reason) > 0) {
1813
-                            $sentence = date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) . ' - '
1814
-                                . $record['login'] . ' - ' . langHdl($record['action']) . ' - '
1815
-                                . (empty($record['raison']) === false ? (count($reason) > 1 ? langHdl(trim($reason[0])) . ' : ' . $reason[1]
1813
+                            $sentence = date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']).' - '
1814
+                                . $record['login'].' - '.langHdl($record['action']).' - '
1815
+                                . (empty($record['raison']) === false ? (count($reason) > 1 ? langHdl(trim($reason[0])).' : '.$reason[1]
1816 1816
                                     : langHdl(trim($reason[0]))) : '');
1817 1817
                             if (empty($history)) {
1818 1818
                                 $history = $sentence;
1819 1819
                             } else {
1820
-                                $history .= '<br />' . $sentence;
1820
+                                $history .= '<br />'.$sentence;
1821 1821
                             }
1822 1822
                         }
1823 1823
                     }
@@ -1948,7 +1948,7 @@  discard block
 block discarded – undo
1948 1948
             ) {
1949 1949
                 // load the original record into an array
1950 1950
                 $originalRecord = DB::queryfirstrow(
1951
-                    'SELECT * FROM ' . prefixTable('items') . '
1951
+                    'SELECT * FROM '.prefixTable('items').'
1952 1952
                     WHERE id = %i',
1953 1953
                     $inputData['itemId']
1954 1954
                 );
@@ -1968,7 +1968,7 @@  discard block
 block discarded – undo
1968 1968
 
1969 1969
                 // Load the destination folder record into an array
1970 1970
                 $dataDestination = DB::queryfirstrow(
1971
-                    'SELECT personal_folder FROM ' . prefixTable('nested_tree') . '
1971
+                    'SELECT personal_folder FROM '.prefixTable('nested_tree').'
1972 1972
                     WHERE id = %i',
1973 1973
                     $post_dest_id
1974 1974
                 );
@@ -1976,7 +1976,7 @@  discard block
 block discarded – undo
1976 1976
                 // Get the ITEM object key for the user
1977 1977
                 $userKey = DB::queryFirstRow(
1978 1978
                     'SELECT share_key
1979
-                    FROM ' . prefixTable('sharekeys_items') . '
1979
+                    FROM ' . prefixTable('sharekeys_items').'
1980 1980
                     WHERE user_id = %i AND object_id = %i',
1981 1981
                     $_SESSION['user_id'],
1982 1982
                     $inputData['itemId']
@@ -2049,7 +2049,7 @@  discard block
 block discarded – undo
2049 2049
                 // Manage Custom Fields
2050 2050
                 $rows = DB::query(
2051 2051
                     'SELECT *
2052
-                    FROM ' . prefixTable('categories_items') . '
2052
+                    FROM ' . prefixTable('categories_items').'
2053 2053
                     WHERE item_id = %i',
2054 2054
                     $inputData['itemId']
2055 2055
                 );
@@ -2097,15 +2097,15 @@  discard block
 block discarded – undo
2097 2097
                 $rows = DB::query(
2098 2098
                     'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status, f.extension AS extension,
2099 2099
                     f.size AS size, f.type AS type, s.share_key AS share_key
2100
-                    FROM ' . prefixTable('files') . ' AS f
2101
-                    INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id)
2100
+                    FROM ' . prefixTable('files').' AS f
2101
+                    INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id)
2102 2102
                     WHERE s.user_id = %i AND f.id_item = %i',
2103 2103
                     $_SESSION['user_id'],
2104 2104
                     $inputData['itemId']
2105 2105
                 );
2106 2106
                 foreach ($rows as $record) {
2107 2107
                     // Check if file still exists
2108
-                    if (file_exists($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . TP_FILE_PREFIX . base64_decode($record['file'])) === true) {
2108
+                    if (file_exists($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.TP_FILE_PREFIX.base64_decode($record['file'])) === true) {
2109 2109
                         // Step1 - decrypt the file
2110 2110
                         $fileContent = decryptFile(
2111 2111
                             $record['file'],
@@ -2114,8 +2114,8 @@  discard block
 block discarded – undo
2114 2114
                         );
2115 2115
 
2116 2116
                         // Step2 - create file
2117
-                        $newFileName = md5(time() . '_' . $record['id']) . '.' . $record['extension'];
2118
-                        $outstream = fopen($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . $newFileName, 'ab');
2117
+                        $newFileName = md5(time().'_'.$record['id']).'.'.$record['extension'];
2118
+                        $outstream = fopen($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.$newFileName, 'ab');
2119 2119
                         if ($outstream === false) {
2120 2120
                             echo prepareExchangedData(
2121 2121
     $SETTINGS['cpassman_dir'],
@@ -2166,7 +2166,7 @@  discard block
 block discarded – undo
2166 2166
 
2167 2167
                 // -------------------------
2168 2168
                 // Add specific restrictions
2169
-                $rows = DB::query('SELECT * FROM ' . prefixTable('restriction_to_roles') . ' WHERE item_id = %i', $inputData['itemId']);
2169
+                $rows = DB::query('SELECT * FROM '.prefixTable('restriction_to_roles').' WHERE item_id = %i', $inputData['itemId']);
2170 2170
                 foreach ($rows as $record) {
2171 2171
                     DB::insert(
2172 2172
                         prefixTable('restriction_to_roles'),
@@ -2178,7 +2178,7 @@  discard block
 block discarded – undo
2178 2178
                 }
2179 2179
 
2180 2180
                 // Add Tags
2181
-                $rows = DB::query('SELECT * FROM ' . prefixTable('tags') . ' WHERE item_id = %i', $inputData['itemId']);
2181
+                $rows = DB::query('SELECT * FROM '.prefixTable('tags').' WHERE item_id = %i', $inputData['itemId']);
2182 2182
                 foreach ($rows as $record) {
2183 2183
                     DB::insert(
2184 2184
                         prefixTable('tags'),
@@ -2208,7 +2208,7 @@  discard block
 block discarded – undo
2208 2208
                     $_SESSION['login']
2209 2209
                 );
2210 2210
                 // reload cache table
2211
-                include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
2211
+                include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
2212 2212
                 updateCacheTable('reload', $SETTINGS, null);
2213 2213
 
2214 2214
                 echo (string) prepareExchangedData(
@@ -2256,7 +2256,7 @@  discard block
 block discarded – undo
2256 2256
 
2257 2257
             // Decrypt and retreive data in JSON format
2258 2258
             $dataReceived = prepareExchangedData(
2259
-                $SETTINGS['cpassman_dir'],$inputData['data'],
2259
+                $SETTINGS['cpassman_dir'], $inputData['data'],
2260 2260
                 'decode'
2261 2261
             );
2262 2262
 
@@ -2282,7 +2282,7 @@  discard block
 block discarded – undo
2282 2282
             // then we can show it
2283 2283
             $item_deleted = DB::queryFirstRow(
2284 2284
                 'SELECT *
2285
-                FROM ' . prefixTable('log_items') . '
2285
+                FROM ' . prefixTable('log_items').'
2286 2286
                 WHERE id_item = %i AND action = %s
2287 2287
                 ORDER BY date DESC
2288 2288
                 LIMIT 0, 1',
@@ -2293,7 +2293,7 @@  discard block
 block discarded – undo
2293 2293
 
2294 2294
             $item_restored = DB::queryFirstRow(
2295 2295
                 'SELECT *
2296
-                FROM ' . prefixTable('log_items') . '
2296
+                FROM ' . prefixTable('log_items').'
2297 2297
                 WHERE id_item = %i AND action = %s
2298 2298
                 ORDER BY date DESC
2299 2299
                 LIMIT 0, 1',
@@ -2318,8 +2318,8 @@  discard block
 block discarded – undo
2318 2318
             // Get all informations for this item
2319 2319
             $dataItem = DB::queryfirstrow(
2320 2320
                 'SELECT *
2321
-                FROM ' . prefixTable('items') . ' as i
2322
-                INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
2321
+                FROM ' . prefixTable('items').' as i
2322
+                INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
2323 2323
                 WHERE i.id = %i AND l.action = %s',
2324 2324
                 $inputData['id'],
2325 2325
                 'at_creation'
@@ -2328,7 +2328,7 @@  discard block
 block discarded – undo
2328 2328
             // Notification
2329 2329
             DB::queryfirstrow(
2330 2330
                 'SELECT *
2331
-                FROM ' . prefixTable('notification') . '
2331
+                FROM ' . prefixTable('notification').'
2332 2332
                 WHERE item_id = %i AND user_id = %i',
2333 2333
                 $inputData['id'],
2334 2334
                 $_SESSION['user_id']
@@ -2375,13 +2375,13 @@  discard block
 block discarded – undo
2375 2375
                     && (int) $SETTINGS['enable_email_notification_on_item_shown'] === 1
2376 2376
                     && (int) $user['admin'] === 1
2377 2377
                 ) {
2378
-                    $_SESSION['listNotificationEmails'] .= $user['email'] . ',';
2378
+                    $_SESSION['listNotificationEmails'] .= $user['email'].',';
2379 2379
                 }
2380 2380
             }
2381 2381
 
2382 2382
             // manage case of API user
2383 2383
             if ($dataItem['id_user'] === API_USER_ID) {
2384
-                $arrData['author'] = 'API [' . $dataItem['description'] . ']';
2384
+                $arrData['author'] = 'API ['.$dataItem['description'].']';
2385 2385
                 $arrData['id_user'] = API_USER_ID;
2386 2386
                 $arrData['author_email'] = '';
2387 2387
                 $arrData['notification_status'] = false;
@@ -2391,7 +2391,7 @@  discard block
 block discarded – undo
2391 2391
             $tags = array();
2392 2392
             $rows = DB::query(
2393 2393
                 'SELECT tag
2394
-                FROM ' . prefixTable('tags') . '
2394
+                FROM ' . prefixTable('tags').'
2395 2395
                 WHERE item_id = %i',
2396 2396
                 $inputData['id']
2397 2397
             );
@@ -2416,7 +2416,7 @@  discard block
 block discarded – undo
2416 2416
             // Check if user has a role that is accepted
2417 2417
             $rows_tmp = DB::query(
2418 2418
                 'SELECT role_id
2419
-                FROM ' . prefixTable('restriction_to_roles') . '
2419
+                FROM ' . prefixTable('restriction_to_roles').'
2420 2420
                 WHERE item_id=%i',
2421 2421
                 $inputData['id']
2422 2422
             );
@@ -2430,7 +2430,7 @@  discard block
 block discarded – undo
2430 2430
             // Get the object key for the user
2431 2431
             $userKey = DB::queryFirstRow(
2432 2432
                 'SELECT share_key
2433
-                FROM ' . prefixTable('sharekeys_items') . '
2433
+                FROM ' . prefixTable('sharekeys_items').'
2434 2434
                 WHERE user_id = %i AND object_id = %i',
2435 2435
                 $_SESSION['user_id'],
2436 2436
                 $inputData['id']
@@ -2529,8 +2529,8 @@  discard block
 block discarded – undo
2529 2529
                     // Add restriction if item is restricted to roles
2530 2530
                     $rows = DB::query(
2531 2531
                         'SELECT t.title, t.id
2532
-                        FROM ' . prefixTable('roles_title') . ' AS t
2533
-                        INNER JOIN ' . prefixTable('restriction_to_roles') . ' AS r ON (t.id=r.role_id)
2532
+                        FROM ' . prefixTable('roles_title').' AS t
2533
+                        INNER JOIN ' . prefixTable('restriction_to_roles').' AS r ON (t.id=r.role_id)
2534 2534
                         WHERE r.item_id = %i
2535 2535
                         ORDER BY t.title ASC',
2536 2536
                         $inputData['id']
@@ -2546,8 +2546,8 @@  discard block
 block discarded – undo
2546 2546
                     $tmp = array();
2547 2547
                     $rows = DB::query(
2548 2548
                         'SELECT k.label, k.id
2549
-                        FROM ' . prefixTable('kb_items') . ' as i
2550
-                        INNER JOIN ' . prefixTable('kb') . ' as k ON (i.kb_id=k.id)
2549
+                        FROM ' . prefixTable('kb_items').' as i
2550
+                        INNER JOIN ' . prefixTable('kb').' as k ON (i.kb_id=k.id)
2551 2551
                         WHERE i.item_id = %i
2552 2552
                         ORDER BY k.label ASC',
2553 2553
                         $inputData['id']
@@ -2628,7 +2628,7 @@  discard block
 block discarded – undo
2628 2628
                     $arrCatList = array();
2629 2629
                     $rows_tmp = DB::query(
2630 2630
                         'SELECT id_category
2631
-                        FROM ' . prefixTable('categories_folders') . '
2631
+                        FROM ' . prefixTable('categories_folders').'
2632 2632
                         WHERE id_folder=%i',
2633 2633
                         $inputData['folderId']
2634 2634
                     );
@@ -2643,8 +2643,8 @@  discard block
 block discarded – undo
2643 2643
                             'SELECT i.id AS id, i.field_id AS field_id, i.data AS data, i.item_id AS item_id,
2644 2644
                             i.encryption_type AS encryption_type, c.encrypted_data, c.parent_id AS parent_id,
2645 2645
                             c.type as field_type, c.masked AS field_masked, c.role_visibility AS role_visibility
2646
-                            FROM ' . prefixTable('categories_items') . ' AS i
2647
-                            INNER JOIN ' . prefixTable('categories') . ' AS c ON (i.field_id=c.id)
2646
+                            FROM ' . prefixTable('categories_items').' AS i
2647
+                            INNER JOIN ' . prefixTable('categories').' AS c ON (i.field_id=c.id)
2648 2648
                             WHERE i.item_id=%i AND c.parent_id IN %ls',
2649 2649
                             $inputData['id'],
2650 2650
                             $arrCatList
@@ -2655,11 +2655,11 @@  discard block
 block discarded – undo
2655 2655
 							//db::debugmode(true);
2656 2656
                             $userKey = DB::queryFirstRow(
2657 2657
                                 'SELECT share_key
2658
-                                FROM ' . prefixTable('sharekeys_fields') . '
2658
+                                FROM ' . prefixTable('sharekeys_fields').'
2659 2659
                                 WHERE user_id = %i AND object_id = %i',
2660 2660
                                 $_SESSION['user_id'],
2661 2661
                                 $row['id']
2662
-                            );//db::debugmode(false);
2662
+                            ); //db::debugmode(false);
2663 2663
                             $fieldText = [];
2664 2664
                             if (DB::count() === 0) {
2665 2665
                                 // Not encrypted
@@ -2701,7 +2701,7 @@  discard block
 block discarded – undo
2701 2701
                 if (isset($SETTINGS['item_creation_templates']) && (int) $SETTINGS['item_creation_templates'] === 1) {
2702 2702
                     $rows_tmp = DB::queryfirstrow(
2703 2703
                         'SELECT category_id
2704
-                        FROM ' . prefixTable('templates') . '
2704
+                        FROM ' . prefixTable('templates').'
2705 2705
                         WHERE item_id = %i',
2706 2706
                         $inputData['id']
2707 2707
                     );
@@ -2726,7 +2726,7 @@  discard block
 block discarded – undo
2726 2726
                     // Is the Item to be deleted?
2727 2727
                     $dataDelete = DB::queryfirstrow(
2728 2728
                         'SELECT * 
2729
-                        FROM ' . prefixTable('automatic_del') . '
2729
+                        FROM ' . prefixTable('automatic_del').'
2730 2730
                         WHERE item_id = %i',
2731 2731
                         $inputData['id']
2732 2732
                     );
@@ -2808,11 +2808,11 @@  discard block
 block discarded – undo
2808 2808
                 if (empty($dataItem['restricted_to']) === false) {
2809 2809
                     foreach (explode(';', $dataItem['restricted_to']) as $userRest) {
2810 2810
                         if (empty($userRest) === false) {
2811
-                            $dataTmp = DB::queryfirstrow('SELECT login FROM ' . prefixTable('users') . ' WHERE id= ' . $userRest);
2811
+                            $dataTmp = DB::queryfirstrow('SELECT login FROM '.prefixTable('users').' WHERE id= '.$userRest);
2812 2812
                             if (empty($listOfRestricted)) {
2813 2813
                                 $listOfRestricted = $dataTmp['login'];
2814 2814
                             } else {
2815
-                                $listOfRestricted .= ';' . $dataTmp['login'];
2815
+                                $listOfRestricted .= ';'.$dataTmp['login'];
2816 2816
                             }
2817 2817
                         }
2818 2818
                     }
@@ -2875,8 +2875,8 @@  discard block
 block discarded – undo
2875 2875
             // Load item data
2876 2876
             $dataItem = DB::queryFirstRow(
2877 2877
                 'SELECT i.*, n.title AS folder_title
2878
-                FROM ' . prefixTable('items') . ' AS i
2879
-                INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (i.id_tree = n.id)
2878
+                FROM ' . prefixTable('items').' AS i
2879
+                INNER JOIN ' . prefixTable('nested_tree').' AS n ON (i.id_tree = n.id)
2880 2880
                 WHERE i.id = %i',
2881 2881
                 $inputData['id']
2882 2882
             );
@@ -2898,7 +2898,7 @@  discard block
 block discarded – undo
2898 2898
             // Check if user has a role that is accepted
2899 2899
             $rows_tmp = DB::query(
2900 2900
                 'SELECT role_id
2901
-                FROM ' . prefixTable('restriction_to_roles') . '
2901
+                FROM ' . prefixTable('restriction_to_roles').'
2902 2902
                 WHERE item_id=%i',
2903 2903
                 $inputData['id']
2904 2904
             );
@@ -2945,7 +2945,7 @@  discard block
 block discarded – undo
2945 2945
                 // launch query
2946 2946
                 $rows = DB::query(
2947 2947
                     'SELECT id, name, file, extension, size
2948
-                    FROM ' . prefixTable('files') . '
2948
+                    FROM ' . prefixTable('files').'
2949 2949
                     WHERE id_item = %i AND confirmed = 1',
2950 2950
                     $inputData['id']
2951 2951
                 );
@@ -2954,7 +2954,7 @@  discard block
 block discarded – undo
2954 2954
                         $attachments,
2955 2955
                         array(
2956 2956
                             'icon' => fileFormatImage(strtolower($record['extension'])),
2957
-                            'filename' => basename($record['name'], '.' . $record['extension']),
2957
+                            'filename' => basename($record['name'], '.'.$record['extension']),
2958 2958
                             'extension' => $record['extension'],
2959 2959
                             'size' => formatSizeUnits((int) $record['size']),
2960 2960
                             'is_image' => in_array(strtolower($record['extension']), TP_IMAGE_FILE_EXT) === true ? 1 : 0,
@@ -2980,7 +2980,7 @@  discard block
 block discarded – undo
2980 2980
                         array(
2981 2981
                             'latest_items' => implode(';', $_SESSION['latest_items']),
2982 2982
                         ),
2983
-                        'id=' . $_SESSION['user_id']
2983
+                        'id='.$_SESSION['user_id']
2984 2984
                     );
2985 2985
                 }
2986 2986
 
@@ -2989,8 +2989,8 @@  discard block
 block discarded – undo
2989 2989
                 $listOptionsForRoles = array();
2990 2990
                 $rows = DB::query(
2991 2991
                     'SELECT r.role_id AS role_id, t.title AS title
2992
-                    FROM ' . prefixTable('roles_values') . ' AS r
2993
-                    INNER JOIN ' . prefixTable('roles_title') . ' AS t ON (r.role_id = t.id)
2992
+                    FROM ' . prefixTable('roles_values').' AS r
2993
+                    INNER JOIN ' . prefixTable('roles_title').' AS t ON (r.role_id = t.id)
2994 2994
                     WHERE r.folder_id = %i',
2995 2995
                     $dataItem['id_tree']
2996 2996
                 );
@@ -3004,9 +3004,9 @@  discard block
 block discarded – undo
3004 3004
                     );
3005 3005
                     $rows2 = DB::query(
3006 3006
                         'SELECT id, login, fonction_id, email, name, lastname
3007
-                        FROM ' . prefixTable('users') . '
3007
+                        FROM ' . prefixTable('users').'
3008 3008
                         WHERE fonction_id LIKE %s',
3009
-                        '%' . $record['role_id'] . '%'
3009
+                        '%'.$record['role_id'].'%'
3010 3010
                     );
3011 3011
                     foreach ($rows2 as $record2) {
3012 3012
                         foreach (explode(';', $record2['fonction_id']) as $role) {
@@ -3019,7 +3019,7 @@  discard block
 block discarded – undo
3019 3019
                                     array(
3020 3020
                                         'id' => (int) $record2['id'],
3021 3021
                                         'login' => $record2['login'],
3022
-                                        'name' => $record2['name'] . ' ' . $record2['lastname'],
3022
+                                        'name' => $record2['name'].' '.$record2['lastname'],
3023 3023
                                         'email' => $record2['email'],
3024 3024
                                     )
3025 3025
                                 );
@@ -3038,16 +3038,16 @@  discard block
 block discarded – undo
3038 3038
                     $path = '';
3039 3039
                     foreach ($arbo as $elem) {
3040 3040
                         if (empty($path) === true) {
3041
-                            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' ';
3041
+                            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' ';
3042 3042
                         } else {
3043
-                            $path .= '&#8594; ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
3043
+                            $path .= '&#8594; '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
3044 3044
                         }
3045 3045
                     }
3046 3046
                     // Build text to show user
3047 3047
                     if (empty($path) === true) {
3048 3048
                         $path = addslashes($dataItem['label']);
3049 3049
                     } else {
3050
-                        $path = addslashes($dataItem['label']) . ' (' . $path . ')';
3050
+                        $path = addslashes($dataItem['label']).' ('.$path.')';
3051 3051
                     }
3052 3052
 
3053 3053
                     // send back infos
@@ -3061,7 +3061,7 @@  discard block
 block discarded – undo
3061 3061
                                 array(
3062 3062
                                     addslashes($_SESSION['login']),
3063 3063
                                     $path,
3064
-                                    $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $dataItem['id'],
3064
+                                    $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$dataItem['id'],
3065 3065
                                 ),
3066 3066
                                 langHdl('email_on_open_notification_mail')
3067 3067
                             ),
@@ -3072,7 +3072,7 @@  discard block
 block discarded – undo
3072 3072
                 }
3073 3073
 
3074 3074
                 // has this item a change proposal
3075
-                DB::query('SELECT * FROM ' . prefixTable('items_change') . ' WHERE item_id = %i', $inputData['id']);
3075
+                DB::query('SELECT * FROM '.prefixTable('items_change').' WHERE item_id = %i', $inputData['id']);
3076 3076
                 $returnArray['has_change_proposal'] = DB::count();
3077 3077
 
3078 3078
                 // Setting
@@ -3170,7 +3170,7 @@  discard block
 block discarded – undo
3170 3170
             // Load item data
3171 3171
             $data = DB::queryFirstRow(
3172 3172
                 'SELECT id_tree
3173
-                FROM ' . prefixTable('items') . '
3173
+                FROM ' . prefixTable('items').'
3174 3174
                 WHERE id = %i',
3175 3175
                 $inputData['itemId']
3176 3176
             );
@@ -3236,7 +3236,7 @@  discard block
 block discarded – undo
3236 3236
             }
3237 3237
             // decrypt and retreive data in JSON format
3238 3238
             $dataReceived = prepareExchangedData(
3239
-    $SETTINGS['cpassman_dir'],$inputData['data'], 'decode');
3239
+    $SETTINGS['cpassman_dir'], $inputData['data'], 'decode');
3240 3240
 
3241 3241
             // Prepare variables
3242 3242
             $title = filter_var(htmlspecialchars_decode($dataReceived['title'], ENT_QUOTES), FILTER_SANITIZE_STRING);
@@ -3244,13 +3244,13 @@  discard block
 block discarded – undo
3244 3244
 
3245 3245
             // Check if user is allowed to access this folder
3246 3246
             if (!in_array($inputData['folderId'], $_SESSION['groupes_visibles'])) {
3247
-                echo '[{"error" : "' . langHdl('error_not_allowed_to') . '"}]';
3247
+                echo '[{"error" : "'.langHdl('error_not_allowed_to').'"}]';
3248 3248
                 break;
3249 3249
             }
3250 3250
 
3251 3251
             // Check if title doesn't contains html codes
3252 3252
             if (preg_match_all('|<[^>]+>(.*)</[^>]+>|U', $title, $out)) {
3253
-                echo '[ { "error" : "' . langHdl('error_html_codes') . '" } ]';
3253
+                echo '[ { "error" : "'.langHdl('error_html_codes').'" } ]';
3254 3254
                 break;
3255 3255
             }
3256 3256
             // check that title is not numeric
@@ -3261,9 +3261,9 @@  discard block
 block discarded – undo
3261 3261
 
3262 3262
             // Check if duplicate folders name are allowed
3263 3263
             if (isset($SETTINGS['duplicate_folder']) && $SETTINGS['duplicate_folder'] === '0') {
3264
-                $data = DB::queryFirstRow('SELECT id, title FROM ' . prefixTable('nested_tree') . ' WHERE title = %s', $title);
3264
+                $data = DB::queryFirstRow('SELECT id, title FROM '.prefixTable('nested_tree').' WHERE title = %s', $title);
3265 3265
                 if (empty($data['id']) === false && $dataReceived['folder'] !== $data['id']) {
3266
-                    echo '[ { "error" : "' . langHdl('error_group_exist') . '" } ]';
3266
+                    echo '[ { "error" : "'.langHdl('error_group_exist').'" } ]';
3267 3267
                     break;
3268 3268
                 }
3269 3269
             }
@@ -3271,7 +3271,7 @@  discard block
 block discarded – undo
3271 3271
             // query on folder
3272 3272
             $data = DB::queryfirstrow(
3273 3273
                 'SELECT parent_id, personal_folder
3274
-                FROM ' . prefixTable('nested_tree') . '
3274
+                FROM ' . prefixTable('nested_tree').'
3275 3275
                 WHERE id = %i',
3276 3276
                 $inputData['folderId']
3277 3277
             );
@@ -3281,20 +3281,20 @@  discard block
 block discarded – undo
3281 3281
             if ($_SESSION['is_admin'] !== 1 && $_SESSION['user_manager'] !== 1 && $data['personal_folder'] === '0') {
3282 3282
                 $data = DB::queryfirstrow(
3283 3283
                     'SELECT valeur
3284
-                    FROM ' . prefixTable('misc') . '
3284
+                    FROM ' . prefixTable('misc').'
3285 3285
                     WHERE intitule = %i AND type = %s',
3286 3286
                     $data['parent_id'],
3287 3287
                     'complex'
3288 3288
                 );
3289 3289
                 if (intval($dataReceived['complexity']) < intval($data['valeur'])) {
3290
-                    echo '[ { "error" : "' . langHdl('error_folder_complexity_lower_than_top_folder') . ' [<b>' . TP_PW_COMPLEXITY[$data['valeur']][1] . '</b>]"} ]';
3290
+                    echo '[ { "error" : "'.langHdl('error_folder_complexity_lower_than_top_folder').' [<b>'.TP_PW_COMPLEXITY[$data['valeur']][1].'</b>]"} ]';
3291 3291
                     break;
3292 3292
                 }
3293 3293
             }
3294 3294
 
3295 3295
             // update Folders table
3296 3296
             $tmp = DB::queryFirstRow(
3297
-                'SELECT title, parent_id, personal_folder FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
3297
+                'SELECT title, parent_id, personal_folder FROM '.prefixTable('nested_tree').' WHERE id = %i',
3298 3298
                 $dataReceived['folder']
3299 3299
             );
3300 3300
             if ($tmp['parent_id'] !== 0 || $tmp['title'] !== $_SESSION['user_id'] || $tmp['personal_folder'] !== 1) {
@@ -3353,7 +3353,7 @@  discard block
 block discarded – undo
3353 3353
             }
3354 3354
             // decrypt and retreive data in JSON format
3355 3355
             $dataReceived = prepareExchangedData(
3356
-    $SETTINGS['cpassman_dir'],$inputData['data'], 'decode');
3356
+    $SETTINGS['cpassman_dir'], $inputData['data'], 'decode');
3357 3357
             $post_source_folder_id = filter_var(htmlspecialchars_decode($dataReceived['source_folder_id']), FILTER_SANITIZE_NUMBER_INT);
3358 3358
             $post_target_folder_id = filter_var(htmlspecialchars_decode($dataReceived['target_folder_id']), FILTER_SANITIZE_NUMBER_INT);
3359 3359
 
@@ -3362,42 +3362,42 @@  discard block
 block discarded – undo
3362 3362
                     in_array($post_target_folder_id, $_SESSION['groupes_visibles']) === false) && ($post_target_folder_id === '0' &&
3363 3363
                     isset($SETTINGS['can_create_root_folder']) === true && (int) $SETTINGS['can_create_root_folder'] === 1)
3364 3364
             ) {
3365
-                $returnValues = '[{"error" : "' . langHdl('error_not_allowed_to') . '"}]';
3365
+                $returnValues = '[{"error" : "'.langHdl('error_not_allowed_to').'"}]';
3366 3366
                 echo $returnValues;
3367 3367
                 break;
3368 3368
             }
3369 3369
 
3370 3370
             $tmp_source = DB::queryFirstRow(
3371 3371
                 'SELECT title, parent_id, personal_folder
3372
-                FROM ' . prefixTable('nested_tree') . '
3372
+                FROM ' . prefixTable('nested_tree').'
3373 3373
                 WHERE id = %i',
3374 3374
                 $post_source_folder_id
3375 3375
             );
3376 3376
 
3377 3377
             $tmp_target = DB::queryFirstRow(
3378 3378
                 'SELECT title, parent_id, personal_folder
3379
-                FROM ' . prefixTable('nested_tree') . '
3379
+                FROM ' . prefixTable('nested_tree').'
3380 3380
                 WHERE id = %i',
3381 3381
                 $post_target_folder_id
3382 3382
             );
3383 3383
 
3384 3384
             // check if target is not a child of source
3385 3385
             if ($tree->isChildOf($post_target_folder_id, $post_source_folder_id) === true) {
3386
-                $returnValues = '[{"error" : "' . langHdl('error_not_allowed_to') . '"}]';
3386
+                $returnValues = '[{"error" : "'.langHdl('error_not_allowed_to').'"}]';
3387 3387
                 echo $returnValues;
3388 3388
                 break;
3389 3389
             }
3390 3390
 
3391 3391
             // check if source or target folder is PF. If Yes, then cancel operation
3392 3392
             if ((int) $tmp_source['personal_folder'] === 1 || (int) $tmp_target['personal_folder'] === 1) {
3393
-                $returnValues = '[{"error" : "' . langHdl('error_not_allowed_to') . '"}]';
3393
+                $returnValues = '[{"error" : "'.langHdl('error_not_allowed_to').'"}]';
3394 3394
                 echo $returnValues;
3395 3395
                 break;
3396 3396
             }
3397 3397
 
3398 3398
             // check if source or target folder is PF. If Yes, then cancel operation
3399 3399
             if ($tmp_source['title'] === $_SESSION['user_id'] || $tmp_target['title'] === $_SESSION['user_id']) {
3400
-                $returnValues = '[{"error" : "' . langHdl('error_not_allowed_to') . '"}]';
3400
+                $returnValues = '[{"error" : "'.langHdl('error_not_allowed_to').'"}]';
3401 3401
                 echo $returnValues;
3402 3402
                 break;
3403 3403
             }
@@ -3534,7 +3534,7 @@  discard block
 block discarded – undo
3534 3534
                 foreach ($_SESSION['user_roles'] as $role) {
3535 3535
                     $roleQ = DB::queryfirstrow(
3536 3536
                         'SELECT allow_pw_change
3537
-                        FROM ' . prefixTable('roles_title') . '
3537
+                        FROM ' . prefixTable('roles_title').'
3538 3538
                         WHERE id = %i',
3539 3539
                         $role
3540 3540
                     );
@@ -3559,11 +3559,11 @@  discard block
 block discarded – undo
3559 3559
                     
3560 3560
                     foreach ($_SESSION['user_roles'] as $role) {
3561 3561
                         $access = DB::queryFirstRow(
3562
-                            'SELECT type FROM ' . prefixTable('roles_values') . ' WHERE role_id = %i AND folder_id = %i',
3562
+                            'SELECT type FROM '.prefixTable('roles_values').' WHERE role_id = %i AND folder_id = %i',
3563 3563
                             $role,
3564 3564
                             $inputData['id']
3565 3565
                         );
3566
-                        if (DB::count()>0) {
3566
+                        if (DB::count() > 0) {
3567 3567
                             if ($access['type'] === 'R') {
3568 3568
                                 array_push($arrTmp, 10);
3569 3569
                             } elseif ($access['type'] === 'W') {
@@ -3628,7 +3628,7 @@  discard block
 block discarded – undo
3628 3628
                 } else {
3629 3629
                     DB::query(
3630 3630
                         'SELECT *
3631
-                        FROM ' . prefixTable('items') . '
3631
+                        FROM ' . prefixTable('items').'
3632 3632
                         WHERE inactif = %i',
3633 3633
                         0
3634 3634
                     );
@@ -3638,7 +3638,7 @@  discard block
 block discarded – undo
3638 3638
 
3639 3639
                 // Get folder complexity
3640 3640
                 $folderComplexity = DB::queryFirstRow(
3641
-                    'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %i',
3641
+                    'SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %i',
3642 3642
                     'complex',
3643 3643
                     $inputData['id']
3644 3644
                 );
@@ -3650,7 +3650,7 @@  discard block
 block discarded – undo
3650 3650
                 if (isset($SETTINGS['item_extra_fields']) && (int) $SETTINGS['item_extra_fields'] === 1) {
3651 3651
                     $folderRow = DB::query(
3652 3652
                         'SELECT id_category
3653
-                        FROM ' . prefixTable('categories_folders') . '
3653
+                        FROM ' . prefixTable('categories_folders').'
3654 3654
                         WHERE id_folder = %i',
3655 3655
                         $inputData['id']
3656 3656
                     );
@@ -3764,13 +3764,13 @@  discard block
 block discarded – undo
3764 3764
                 // List all ITEMS
3765 3765
                 if ($folderIsPf === false) {
3766 3766
                     $where->add('i.inactif=%i', 0);
3767
-                    $where->add('l.date=%l', '(SELECT date FROM ' . prefixTable('log_items') . " WHERE action IN ('at_creation', 'at_modification') AND id_item=i.id ORDER BY date DESC LIMIT 1)");
3767
+                    $where->add('l.date=%l', '(SELECT date FROM '.prefixTable('log_items')." WHERE action IN ('at_creation', 'at_modification') AND id_item=i.id ORDER BY date DESC LIMIT 1)");
3768 3768
                     if (empty($limited_to_items) === false) {
3769 3769
                         $where->add('i.id IN %ls', explode(',', $limited_to_items));
3770 3770
                     }
3771 3771
 
3772
-                    $query_limit = ' LIMIT ' .
3773
-                        $start . ',' .
3772
+                    $query_limit = ' LIMIT '.
3773
+                        $start.','.
3774 3774
                         $post_nb_items_to_display_once;
3775 3775
                     //db::debugmode(true);
3776 3776
                     $rows = DB::query(
@@ -3781,9 +3781,9 @@  discard block
 block discarded – undo
3781 3781
                         MIN(l.action) AS log_action,
3782 3782
                         l.id_user AS log_user,
3783 3783
                         i.url AS link
3784
-                        FROM ' . prefixTable('items') . ' AS i
3785
-                        INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (i.id_tree = n.id)
3786
-                        INNER JOIN ' . prefixTable('log_items') . ' AS l ON (i.id = l.id_item)
3784
+                        FROM ' . prefixTable('items').' AS i
3785
+                        INNER JOIN ' . prefixTable('nested_tree').' AS n ON (i.id_tree = n.id)
3786
+                        INNER JOIN ' . prefixTable('log_items').' AS l ON (i.id = l.id_item)
3787 3787
                         WHERE %l
3788 3788
                         GROUP BY i.id, l.date, l.id_user, l.action
3789 3789
                         ORDER BY i.label ASC, l.date DESC' . $query_limit,
@@ -3802,9 +3802,9 @@  discard block
 block discarded – undo
3802 3802
                         MIN(l.action) AS log_action,
3803 3803
                         l.id_user AS log_user,
3804 3804
                         i.url AS link
3805
-                        FROM ' . prefixTable('items') . ' AS i
3806
-                        INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (i.id_tree = n.id)
3807
-                        INNER JOIN ' . prefixTable('log_items') . ' AS l ON (i.id = l.id_item)
3805
+                        FROM ' . prefixTable('items').' AS i
3806
+                        INNER JOIN ' . prefixTable('nested_tree').' AS n ON (i.id_tree = n.id)
3807
+                        INNER JOIN ' . prefixTable('log_items').' AS l ON (i.id = l.id_item)
3808 3808
                         WHERE %l
3809 3809
                         GROUP BY i.id, l.date, l.id_user, l.action
3810 3810
                         ORDER BY i.label ASC, l.date DESC',
@@ -3834,7 +3834,7 @@  discard block
 block discarded – undo
3834 3834
                         $item_is_restricted_to_role = false;
3835 3835
                         DB::queryfirstrow(
3836 3836
                             'SELECT role_id
3837
-                            FROM ' . prefixTable('restriction_to_roles') . '
3837
+                            FROM ' . prefixTable('restriction_to_roles').'
3838 3838
                             WHERE item_id = %i',
3839 3839
                             $record['id']
3840 3840
                         );
@@ -3846,7 +3846,7 @@  discard block
 block discarded – undo
3846 3846
                         $user_is_included_in_role = false;
3847 3847
                         DB::query(
3848 3848
                             'SELECT role_id
3849
-                            FROM ' . prefixTable('restriction_to_roles') . '
3849
+                            FROM ' . prefixTable('restriction_to_roles').'
3850 3850
                             WHERE item_id = %i AND role_id IN %ls',
3851 3851
                             $record['id'],
3852 3852
                             $_SESSION['user_roles']
@@ -4051,9 +4051,9 @@  discard block
 block discarded – undo
4051 4051
             if ((int) $start === 0) {
4052 4052
                 DB::query(
4053 4053
                     'SELECT i.id
4054
-                    FROM ' . prefixTable('items') . ' as i
4055
-                    INNER JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree = n.id)
4056
-                    INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id = l.id_item)
4054
+                    FROM ' . prefixTable('items').' as i
4055
+                    INNER JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree = n.id)
4056
+                    INNER JOIN ' . prefixTable('log_items').' as l ON (i.id = l.id_item)
4057 4057
                     WHERE %l
4058 4058
                     ORDER BY i.label ASC, l.date DESC',
4059 4059
                     $where
@@ -4095,7 +4095,7 @@  discard block
 block discarded – undo
4095 4095
 
4096 4096
             // Encrypt data to return
4097 4097
             echo (string) prepareExchangedData(
4098
-                $SETTINGS['cpassman_dir'],$returnValues, 'encode');
4098
+                $SETTINGS['cpassman_dir'], $returnValues, 'encode');
4099 4099
 
4100 4100
             break;
4101 4101
 
@@ -4116,8 +4116,8 @@  discard block
 block discarded – undo
4116 4116
             // Run query
4117 4117
             $dataItem = DB::queryfirstrow(
4118 4118
                 'SELECT i.pw AS pw, s.share_key AS share_key
4119
-                FROM ' . prefixTable('items') . ' AS i
4120
-                INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (s.object_id = i.id)
4119
+                FROM ' . prefixTable('items').' AS i
4120
+                INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (s.object_id = i.id)
4121 4121
                 WHERE user_id = %i AND i.id = %i',
4122 4122
                 $_SESSION['user_id'],
4123 4123
                 $inputData['itemId']
@@ -4160,7 +4160,7 @@  discard block
 block discarded – undo
4160 4160
             if (null !== $inputData['itemId'] && empty($inputData['itemId']) === false) {
4161 4161
                 $dataItem = DB::queryfirstrow(
4162 4162
                     'SELECT perso, anyone_can_modify
4163
-                    FROM ' . prefixTable('items') . '
4163
+                    FROM ' . prefixTable('items').'
4164 4164
                     WHERE id=%i',
4165 4165
                     $inputData['itemId']
4166 4166
                 );
@@ -4199,7 +4199,7 @@  discard block
 block discarded – undo
4199 4199
                 */
4200 4200
 
4201 4201
                 // Lock Item (if already locked), go back and warn
4202
-                $dataTmp = DB::queryFirstRow('SELECT timestamp, user_id FROM ' . prefixTable('items_edition') . ' WHERE item_id = %i', $inputData['itemId']);
4202
+                $dataTmp = DB::queryFirstRow('SELECT timestamp, user_id FROM '.prefixTable('items_edition').' WHERE item_id = %i', $inputData['itemId']);
4203 4203
 
4204 4204
                 // If token is taken for this Item and delay is passed then delete it.
4205 4205
                 if (
@@ -4210,7 +4210,7 @@  discard block
 block discarded – undo
4210 4210
                     DB::delete(prefixTable('items_edition'), 'item_id = %i', $inputData['itemId']);
4211 4211
                     //reload the previous data
4212 4212
                     $dataTmp = DB::queryFirstRow(
4213
-                        'SELECT timestamp, user_id FROM ' . prefixTable('items_edition') . ' WHERE item_id = %i',
4213
+                        'SELECT timestamp, user_id FROM '.prefixTable('items_edition').' WHERE item_id = %i',
4214 4214
                         $inputData['itemId']
4215 4215
                     );
4216 4216
                 }
@@ -4254,7 +4254,7 @@  discard block
 block discarded – undo
4254 4254
             // do query on this folder
4255 4255
             $data_this_folder = DB::queryFirstRow(
4256 4256
                 'SELECT id, personal_folder, title
4257
-                FROM ' . prefixTable('nested_tree') . '
4257
+                FROM ' . prefixTable('nested_tree').'
4258 4258
                 WHERE id = %s',
4259 4259
                 $inputData['folderId']
4260 4260
             );
@@ -4295,8 +4295,8 @@  discard block
 block discarded – undo
4295 4295
             $visibilite = '';
4296 4296
             $data = DB::queryFirstRow(
4297 4297
                 'SELECT m.valeur, n.personal_folder
4298
-                FROM ' . prefixTable('misc') . ' AS m
4299
-                INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (m.intitule = n.id)
4298
+                FROM ' . prefixTable('misc').' AS m
4299
+                INNER JOIN ' . prefixTable('nested_tree').' AS n ON (m.intitule = n.id)
4300 4300
                 WHERE type=%s AND intitule = %s',
4301 4301
                 'complex',
4302 4302
                 $inputData['folderId']
@@ -4309,8 +4309,8 @@  discard block
 block discarded – undo
4309 4309
                 // Prepare Item actual visibility (what Users/Roles can see it)
4310 4310
                 $rows = DB::query(
4311 4311
                     'SELECT t.title
4312
-                    FROM ' . prefixTable('roles_values') . ' as v
4313
-                    INNER JOIN ' . prefixTable('roles_title') . ' as t ON (v.role_id = t.id)
4312
+                    FROM ' . prefixTable('roles_values').' as v
4313
+                    INNER JOIN ' . prefixTable('roles_title').' as t ON (v.role_id = t.id)
4314 4314
                     WHERE v.folder_id = %i
4315 4315
                     GROUP BY title',
4316 4316
                     $inputData['folderId']
@@ -4319,7 +4319,7 @@  discard block
 block discarded – undo
4319 4319
                     if (empty($visibilite)) {
4320 4320
                         $visibilite = $record['title'];
4321 4321
                     } else {
4322
-                        $visibilite .= ' - ' . $record['title'];
4322
+                        $visibilite .= ' - '.$record['title'];
4323 4323
                     }
4324 4324
                 }
4325 4325
             } else {
@@ -4329,14 +4329,14 @@  discard block
 block discarded – undo
4329 4329
                 // do new query to know if current folder is pf
4330 4330
                 $data_pf = DB::queryFirstRow(
4331 4331
                     'SELECT personal_folder
4332
-                    FROM ' . prefixTable('nested_tree') . '
4332
+                    FROM ' . prefixTable('nested_tree').'
4333 4333
                     WHERE id = %s',
4334 4334
                     $inputData['folderId']
4335 4335
                 );
4336 4336
                 
4337 4337
                 $folder_is_personal = $data_pf !== null ? (int) $data_pf['personal_folder'] : 0;
4338 4338
                 
4339
-                $visibilite = $_SESSION['name'] . ' ' . $_SESSION['lastname'] . ' (' . $_SESSION['login'] . ')';
4339
+                $visibilite = $_SESSION['name'].' '.$_SESSION['lastname'].' ('.$_SESSION['login'].')';
4340 4340
             }
4341 4341
 
4342 4342
             recupDroitCreationSansComplexite($inputData['folderId']);
@@ -4346,8 +4346,8 @@  discard block
 block discarded – undo
4346 4346
             $listOptionsForRoles = array();
4347 4347
             $rows = DB::query(
4348 4348
                 'SELECT r.role_id AS role_id, t.title AS title
4349
-                FROM ' . prefixTable('roles_values') . ' AS r
4350
-                INNER JOIN ' . prefixTable('roles_title') . ' AS t ON (r.role_id = t.id)
4349
+                FROM ' . prefixTable('roles_values').' AS r
4350
+                INNER JOIN ' . prefixTable('roles_title').' AS t ON (r.role_id = t.id)
4351 4351
                 WHERE r.folder_id = %i',
4352 4352
                 $inputData['folderId']
4353 4353
             );
@@ -4361,7 +4361,7 @@  discard block
 block discarded – undo
4361 4361
                 );
4362 4362
                 $rows2 = DB::query(
4363 4363
                     'SELECT id, login, fonction_id, email, name, lastname
4364
-                    FROM ' . prefixTable('users') . '
4364
+                    FROM ' . prefixTable('users').'
4365 4365
                     WHERE admin = 0'
4366 4366
                 );
4367 4367
                 foreach ($rows2 as $record2) {
@@ -4375,7 +4375,7 @@  discard block
 block discarded – undo
4375 4375
                                 array(
4376 4376
                                     'id' => $record2['id'],
4377 4377
                                     'login' => $record2['login'],
4378
-                                    'name' => $record2['name'] . ' ' . $record2['lastname'],
4378
+                                    'name' => $record2['name'].' '.$record2['lastname'],
4379 4379
                                     'email' => $record2['email'],
4380 4380
                                 )
4381 4381
                             );
@@ -4392,13 +4392,13 @@  discard block
 block discarded – undo
4392 4392
 					//db::debugmode(true);
4393 4393
 					$access = DB::queryFirstRow(
4394 4394
 						'SELECT type
4395
-						FROM ' . prefixTable('roles_values') . '
4395
+						FROM ' . prefixTable('roles_values').'
4396 4396
 						WHERE role_id = %i AND folder_id = %i',
4397 4397
 						$role,
4398 4398
 						$inputData['folderId']
4399 4399
 					);
4400 4400
 					//db::debugmode(false);
4401
-                    if (DB::count()>0) {
4401
+                    if (DB::count() > 0) {
4402 4402
                         if ($access['type'] === 'R') {
4403 4403
                             array_push($arrTmp, 10);
4404 4404
                         } elseif ($access['type'] === 'W') {
@@ -4439,7 +4439,7 @@  discard block
 block discarded – undo
4439 4439
                 'itemAccessRight' => isset($accessLevel) === true ? $accessLevel : '',
4440 4440
             );
4441 4441
             echo (string) prepareExchangedData(
4442
-                $SETTINGS['cpassman_dir'],$returnValues, 'encode');
4442
+                $SETTINGS['cpassman_dir'], $returnValues, 'encode');
4443 4443
             break;
4444 4444
 
4445 4445
             /*
@@ -4471,7 +4471,7 @@  discard block
 block discarded – undo
4471 4471
             // Get some info before deleting
4472 4472
             $data = DB::queryFirstRow(
4473 4473
                 'SELECT name, id_item, file
4474
-                FROM ' . prefixTable('files') . '
4474
+                FROM ' . prefixTable('files').'
4475 4475
                 WHERE id = %i',
4476 4476
                 $fileId
4477 4477
             );
@@ -4479,7 +4479,7 @@  discard block
 block discarded – undo
4479 4479
             // Load item data
4480 4480
             $data_item = DB::queryFirstRow(
4481 4481
                 'SELECT id_tree
4482
-                FROM ' . prefixTable('items') . '
4482
+                FROM ' . prefixTable('items').'
4483 4483
                 WHERE id = %i',
4484 4484
                 $data['id_item']
4485 4485
             );
@@ -4510,7 +4510,7 @@  discard block
 block discarded – undo
4510 4510
                     $_SESSION['user_id'],
4511 4511
                     'at_modification',
4512 4512
                     $_SESSION['login'],
4513
-                    'at_del_file : ' . $data['name']
4513
+                    'at_del_file : '.$data['name']
4514 4514
                 );
4515 4515
 
4516 4516
                 // DElete sharekeys
@@ -4521,7 +4521,7 @@  discard block
 block discarded – undo
4521 4521
                 );
4522 4522
 
4523 4523
                 // Delete file from server
4524
-                fileDelete($SETTINGS['path_to_upload_folder'] . '/' . TP_FILE_PREFIX . base64_decode($data['file']), $SETTINGS);
4524
+                fileDelete($SETTINGS['path_to_upload_folder'].'/'.TP_FILE_PREFIX.base64_decode($data['file']), $SETTINGS);
4525 4525
             }
4526 4526
 
4527 4527
             echo (string) prepareExchangedData(
@@ -4565,12 +4565,12 @@  discard block
 block discarded – undo
4565 4565
                 // Update SESSION with this new favourite
4566 4566
                 $data = DB::queryfirstrow(
4567 4567
                     'SELECT label,id_tree
4568
-                    FROM ' . prefixTable('items') . '
4568
+                    FROM ' . prefixTable('items').'
4569 4569
                     WHERE id = ' . mysqli_real_escape_string($link, $inputData['itemId'])
4570 4570
                 );
4571 4571
                 $_SESSION['favourites_tab'][$inputData['itemId']] = array(
4572 4572
                     'label' => $data['label'],
4573
-                    'url' => 'index.php?page=items&amp;group=' . $data['id_tree'] . '&amp;id=' . $inputData['itemId'],
4573
+                    'url' => 'index.php?page=items&amp;group='.$data['id_tree'].'&amp;id='.$inputData['itemId'],
4574 4574
                 );
4575 4575
             } elseif ((int) $inputData['destination'] === 1) {
4576 4576
                 // delete from session
@@ -4642,8 +4642,8 @@  discard block
 block discarded – undo
4642 4642
             // get data about item
4643 4643
             $dataSource = DB::queryfirstrow(
4644 4644
                 'SELECT i.pw, f.personal_folder,i.id_tree, f.title,i.label
4645
-                FROM ' . prefixTable('items') . ' as i
4646
-                INNER JOIN ' . prefixTable('nested_tree') . ' as f ON (i.id_tree=f.id)
4645
+                FROM ' . prefixTable('items').' as i
4646
+                INNER JOIN ' . prefixTable('nested_tree').' as f ON (i.id_tree=f.id)
4647 4647
                 WHERE i.id=%i',
4648 4648
                 $inputData['itemId']
4649 4649
             );
@@ -4651,7 +4651,7 @@  discard block
 block discarded – undo
4651 4651
             // get data about new folder
4652 4652
             $dataDestination = DB::queryfirstrow(
4653 4653
                 'SELECT personal_folder, title
4654
-                FROM ' . prefixTable('nested_tree') . '
4654
+                FROM ' . prefixTable('nested_tree').'
4655 4655
                 WHERE id = %i',
4656 4656
                 $inputData['folderId']
4657 4657
             );
@@ -4704,7 +4704,7 @@  discard block
 block discarded – undo
4704 4704
                 // Get fields for this Item
4705 4705
                 $rows = DB::query(
4706 4706
                     'SELECT id
4707
-                    FROM ' . prefixTable('categories_items') . '
4707
+                    FROM ' . prefixTable('categories_items').'
4708 4708
                     WHERE item_id = %i',
4709 4709
                     $inputData['itemId']
4710 4710
                 );
@@ -4721,7 +4721,7 @@  discard block
 block discarded – undo
4721 4721
                 // Get FILES for this Item
4722 4722
                 $rows = DB::query(
4723 4723
                     'SELECT id
4724
-                    FROM ' . prefixTable('files') . '
4724
+                    FROM ' . prefixTable('files').'
4725 4725
                     WHERE id_item = %i',
4726 4726
                     $inputData['itemId']
4727 4727
                 );
@@ -4766,7 +4766,7 @@  discard block
 block discarded – undo
4766 4766
                 // Get the ITEM object key for the user
4767 4767
                 $userKey = DB::queryFirstRow(
4768 4768
                     'SELECT share_key
4769
-                    FROM ' . prefixTable('sharekeys_items') . '
4769
+                    FROM ' . prefixTable('sharekeys_items').'
4770 4770
                     WHERE user_id = %i AND object_id = %i',
4771 4771
                     $_SESSION['user_id'],
4772 4772
                     $inputData['itemId']
@@ -4777,8 +4777,8 @@  discard block
 block discarded – undo
4777 4777
                     // This is a public object
4778 4778
                     $users = DB::query(
4779 4779
                         'SELECT id, public_key
4780
-                        FROM ' . prefixTable('users') . '
4781
-                        WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '","' . $_SESSION['user_id'] . '")
4780
+                        FROM ' . prefixTable('users').'
4781
+                        WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'","'.$_SESSION['user_id'].'")
4782 4782
                         AND public_key != ""'
4783 4783
                     );
4784 4784
                     foreach ($users as $user) {
@@ -4798,14 +4798,14 @@  discard block
 block discarded – undo
4798 4798
                 // Get fields for this Item
4799 4799
                 $rows = DB::query(
4800 4800
                     'SELECT id
4801
-                    FROM ' . prefixTable('categories_items') . '
4801
+                    FROM ' . prefixTable('categories_items').'
4802 4802
                     WHERE item_id = %i',
4803 4803
                     $inputData['itemId']
4804 4804
                 );
4805 4805
                 foreach ($rows as $field) {
4806 4806
                     $userKey = DB::queryFirstRow(
4807 4807
                         'SELECT share_key
4808
-                        FROM ' . prefixTable('sharekeys_fields') . '
4808
+                        FROM ' . prefixTable('sharekeys_fields').'
4809 4809
                         WHERE user_id = %i AND object_id = %i',
4810 4810
                         $_SESSION['user_id'],
4811 4811
                         $field['id']
@@ -4816,8 +4816,8 @@  discard block
 block discarded – undo
4816 4816
                         // This is a public object
4817 4817
                         $users = DB::query(
4818 4818
                             'SELECT id, public_key
4819
-                            FROM ' . prefixTable('users') . '
4820
-                            WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '","' . $_SESSION['user_id'] . '")
4819
+                            FROM ' . prefixTable('users').'
4820
+                            WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'","'.$_SESSION['user_id'].'")
4821 4821
                             AND public_key != ""'
4822 4822
                         );
4823 4823
                         foreach ($users as $user) {
@@ -4838,14 +4838,14 @@  discard block
 block discarded – undo
4838 4838
                 // Get FILES for this Item
4839 4839
                 $rows = DB::query(
4840 4840
                     'SELECT id
4841
-                    FROM ' . prefixTable('files') . '
4841
+                    FROM ' . prefixTable('files').'
4842 4842
                     WHERE id_item = %i',
4843 4843
                     $inputData['itemId']
4844 4844
                 );
4845 4845
                 foreach ($rows as $attachment) {
4846 4846
                     $userKey = DB::queryFirstRow(
4847 4847
                         'SELECT share_key
4848
-                        FROM ' . prefixTable('sharekeys_files') . '
4848
+                        FROM ' . prefixTable('sharekeys_files').'
4849 4849
                         WHERE user_id = %i AND object_id = %i',
4850 4850
                         $_SESSION['user_id'],
4851 4851
                         $attachment['id']
@@ -4856,8 +4856,8 @@  discard block
 block discarded – undo
4856 4856
                         // This is a public object
4857 4857
                         $users = DB::query(
4858 4858
                             'SELECT id, public_key
4859
-                            FROM ' . prefixTable('users') . '
4860
-                            WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '","' . $_SESSION['user_id'] . '")
4859
+                            FROM ' . prefixTable('users').'
4860
+                            WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'","'.$_SESSION['user_id'].'")
4861 4861
                             AND public_key != ""'
4862 4862
                         );
4863 4863
                         foreach ($users as $user) {
@@ -4894,7 +4894,7 @@  discard block
 block discarded – undo
4894 4894
                 $_SESSION['user_id'],
4895 4895
                 'at_modification',
4896 4896
                 $_SESSION['login'],
4897
-                'at_moved : ' . $dataSource['title'] . ' -> ' . $dataDestination['title']
4897
+                'at_moved : '.$dataSource['title'].' -> '.$dataDestination['title']
4898 4898
             );
4899 4899
 
4900 4900
             $returnValues = array(
@@ -4904,7 +4904,7 @@  discard block
 block discarded – undo
4904 4904
                 'to_folder' => $inputData['folderId'],
4905 4905
             );
4906 4906
             echo (string) prepareExchangedData(
4907
-    $SETTINGS['cpassman_dir'],$returnValues, 'encode');
4907
+    $SETTINGS['cpassman_dir'], $returnValues, 'encode');
4908 4908
             break;
4909 4909
 
4910 4910
             /*
@@ -4951,8 +4951,8 @@  discard block
 block discarded – undo
4951 4951
                     // get data about item
4952 4952
                     $dataSource = DB::queryfirstrow(
4953 4953
                         'SELECT i.pw, f.personal_folder,i.id_tree, f.title,i.label
4954
-                        FROM ' . prefixTable('items') . ' as i
4955
-                        INNER JOIN ' . prefixTable('nested_tree') . ' as f ON (i.id_tree=f.id)
4954
+                        FROM ' . prefixTable('items').' as i
4955
+                        INNER JOIN ' . prefixTable('nested_tree').' as f ON (i.id_tree=f.id)
4956 4956
                         WHERE i.id=%i',
4957 4957
                         $item_id
4958 4958
                     );
@@ -4975,7 +4975,7 @@  discard block
 block discarded – undo
4975 4975
 
4976 4976
                     // get data about new folder
4977 4977
                     $dataDestination = DB::queryfirstrow(
4978
-                        'SELECT personal_folder, title FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
4978
+                        'SELECT personal_folder, title FROM '.prefixTable('nested_tree').' WHERE id = %i',
4979 4979
                         $inputData['folderId']
4980 4980
                     );
4981 4981
 
@@ -5016,7 +5016,7 @@  discard block
 block discarded – undo
5016 5016
                         // Get fields for this Item
5017 5017
                         $rows = DB::query(
5018 5018
                             'SELECT id
5019
-                            FROM ' . prefixTable('categories_items') . '
5019
+                            FROM ' . prefixTable('categories_items').'
5020 5020
                             WHERE item_id = %i',
5021 5021
                             $item_id
5022 5022
                         );
@@ -5033,7 +5033,7 @@  discard block
 block discarded – undo
5033 5033
                         // Get FILES for this Item
5034 5034
                         $rows = DB::query(
5035 5035
                             'SELECT id
5036
-                            FROM ' . prefixTable('files') . '
5036
+                            FROM ' . prefixTable('files').'
5037 5037
                             WHERE id_item = %i',
5038 5038
                             $item_id
5039 5039
                         );
@@ -5086,7 +5086,7 @@  discard block
 block discarded – undo
5086 5086
                         // Get the ITEM object key for the user
5087 5087
                         $userKey = DB::queryFirstRow(
5088 5088
                             'SELECT share_key
5089
-                            FROM ' . prefixTable('sharekeys_items') . '
5089
+                            FROM ' . prefixTable('sharekeys_items').'
5090 5090
                             WHERE user_id = %i AND object_id = %i',
5091 5091
                             $_SESSION['user_id'],
5092 5092
                             $item_id
@@ -5097,8 +5097,8 @@  discard block
 block discarded – undo
5097 5097
                             // This is a public object
5098 5098
                             $users = DB::query(
5099 5099
                                 'SELECT id, public_key
5100
-                                FROM ' . prefixTable('users') . '
5101
-                                WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '","' . $_SESSION['user_id'] . '")
5100
+                                FROM ' . prefixTable('users').'
5101
+                                WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'","'.$_SESSION['user_id'].'")
5102 5102
                                 AND public_key != ""'
5103 5103
                             );
5104 5104
                             foreach ($users as $user) {
@@ -5118,14 +5118,14 @@  discard block
 block discarded – undo
5118 5118
                         // Get fields for this Item
5119 5119
                         $rows = DB::query(
5120 5120
                             'SELECT id
5121
-                            FROM ' . prefixTable('categories_items') . '
5121
+                            FROM ' . prefixTable('categories_items').'
5122 5122
                             WHERE item_id = %i',
5123 5123
                             $item_id
5124 5124
                         );
5125 5125
                         foreach ($rows as $field) {
5126 5126
                             $userKey = DB::queryFirstRow(
5127 5127
                                 'SELECT share_key
5128
-                                FROM ' . prefixTable('sharekeys_fields') . '
5128
+                                FROM ' . prefixTable('sharekeys_fields').'
5129 5129
                                 WHERE user_id = %i AND object_id = %i',
5130 5130
                                 $_SESSION['user_id'],
5131 5131
                                 $field['id']
@@ -5136,8 +5136,8 @@  discard block
 block discarded – undo
5136 5136
                                 // This is a public object
5137 5137
                                 $users = DB::query(
5138 5138
                                     'SELECT id, public_key
5139
-                                    FROM ' . prefixTable('users') . '
5140
-                                    WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '","' . $_SESSION['user_id'] . '")
5139
+                                    FROM ' . prefixTable('users').'
5140
+                                    WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'","'.$_SESSION['user_id'].'")
5141 5141
                                     AND public_key != ""'
5142 5142
                                 );
5143 5143
                                 foreach ($users as $user) {
@@ -5158,14 +5158,14 @@  discard block
 block discarded – undo
5158 5158
                         // Get FILES for this Item
5159 5159
                         $rows = DB::query(
5160 5160
                             'SELECT id
5161
-                            FROM ' . prefixTable('files') . '
5161
+                            FROM ' . prefixTable('files').'
5162 5162
                             WHERE id_item = %i',
5163 5163
                             $item_id
5164 5164
                         );
5165 5165
                         foreach ($rows as $attachment) {
5166 5166
                             $userKey = DB::queryFirstRow(
5167 5167
                                 'SELECT share_key
5168
-                                FROM ' . prefixTable('sharekeys_files') . '
5168
+                                FROM ' . prefixTable('sharekeys_files').'
5169 5169
                                 WHERE user_id = %i AND object_id = %i',
5170 5170
                                 $_SESSION['user_id'],
5171 5171
                                 $attachment['id']
@@ -5176,8 +5176,8 @@  discard block
 block discarded – undo
5176 5176
                                 // This is a public object
5177 5177
                                 $users = DB::query(
5178 5178
                                     'SELECT id, public_key
5179
-                                    FROM ' . prefixTable('users') . '
5180
-                                    WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '","' . $_SESSION['user_id'] . '")
5179
+                                    FROM ' . prefixTable('users').'
5180
+                                    WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'","'.$_SESSION['user_id'].'")
5181 5181
                                     AND public_key != ""'
5182 5182
                                 );
5183 5183
                                 foreach ($users as $user) {
@@ -5213,13 +5213,13 @@  discard block
 block discarded – undo
5213 5213
                         $_SESSION['user_id'],
5214 5214
                         'at_modification',
5215 5215
                         $_SESSION['login'],
5216
-                        'at_moved : ' . $dataSource['title'] . ' -> ' . $dataDestination['title']
5216
+                        'at_moved : '.$dataSource['title'].' -> '.$dataDestination['title']
5217 5217
                     );
5218 5218
                 }
5219 5219
             }
5220 5220
 
5221 5221
             // reload cache table
5222
-            require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
5222
+            require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
5223 5223
             updateCacheTable('reload', $SETTINGS, null);
5224 5224
 
5225 5225
             echo (string) prepareExchangedData(
@@ -5288,7 +5288,7 @@  discard block
 block discarded – undo
5288 5288
                     // get info
5289 5289
                     $dataSource = DB::queryfirstrow(
5290 5290
                         'SELECT label, id_tree
5291
-                        FROM ' . prefixTable('items') . '
5291
+                        FROM ' . prefixTable('items').'
5292 5292
                         WHERE id=%i',
5293 5293
                         $item_id
5294 5294
                     );
@@ -5393,8 +5393,8 @@  discard block
 block discarded – undo
5393 5393
             }
5394 5394
             if ($inputData['cat'] === 'request_access_to_author') {
5395 5395
                 // Variables
5396
-                $dataAuthor = DB::queryfirstrow('SELECT email,login FROM ' . prefixTable('users') . ' WHERE id = ' . $post_content[1]);
5397
-                $dataItem = DB::queryfirstrow('SELECT label, id_tree FROM ' . prefixTable('items') . ' WHERE id = ' . $post_content[0]);
5396
+                $dataAuthor = DB::queryfirstrow('SELECT email,login FROM '.prefixTable('users').' WHERE id = '.$post_content[1]);
5397
+                $dataItem = DB::queryfirstrow('SELECT label, id_tree FROM '.prefixTable('items').' WHERE id = '.$post_content[0]);
5398 5398
 
5399 5399
                 // Get path
5400 5400
                 $path = geItemReadablePath(
@@ -5408,7 +5408,7 @@  discard block
 block discarded – undo
5408 5408
                         langHdl('email_request_access_subject'),
5409 5409
                         str_replace(
5410 5410
                             array('#tp_item_author#', '#tp_user#', '#tp_item#'),
5411
-                            array(' ' . addslashes($dataAuthor['login']), addslashes($_SESSION['login']), $path),
5411
+                            array(' '.addslashes($dataAuthor['login']), addslashes($_SESSION['login']), $path),
5412 5412
                             langHdl('email_request_access_mail')
5413 5413
                         ),
5414 5414
                         $dataAuthor['email'],
@@ -5419,7 +5419,7 @@  discard block
 block discarded – undo
5419 5419
             } elseif ($inputData['cat'] === 'share_this_item') {
5420 5420
                 $dataItem = DB::queryfirstrow(
5421 5421
                     'SELECT label,id_tree
5422
-                    FROM ' . prefixTable('items') . '
5422
+                    FROM ' . prefixTable('items').'
5423 5423
                     WHERE id= %i',
5424 5424
                     $inputData['id']
5425 5425
                 );
@@ -5443,7 +5443,7 @@  discard block
 block discarded – undo
5443 5443
                             ),
5444 5444
                             array(
5445 5445
                                 empty($SETTINGS['email_server_url']) === false ?
5446
-                                    $SETTINGS['email_server_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $inputData['id'] : $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $inputData['id'],
5446
+                                    $SETTINGS['email_server_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$inputData['id'] : $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$inputData['id'],
5447 5447
                                 addslashes($_SESSION['login']),
5448 5448
                                 addslashes($path),
5449 5449
                             ),
@@ -5479,7 +5479,7 @@  discard block
 block discarded – undo
5479 5479
             if ($inputData['notifyType'] === 'on_show') {
5480 5480
                 // Check if values already exist
5481 5481
                 $data = DB::queryfirstrow(
5482
-                    'SELECT notification FROM ' . prefixTable('items') . ' WHERE id = %i',
5482
+                    'SELECT notification FROM '.prefixTable('items').' WHERE id = %i',
5483 5483
                     $inputData['itemId']
5484 5484
                 );
5485 5485
                 $notifiedUsers = explode(';', $data['notification']);
@@ -5490,8 +5490,8 @@  discard block
 block discarded – undo
5490 5490
                         prefixTable('items'),
5491 5491
                         array(
5492 5492
                             'notification' => empty($data['notification']) ?
5493
-                                $inputData['userId'] . ';'
5494
-                                : $data['notification'] . $inputData['userId'] ,
5493
+                                $inputData['userId'].';'
5494
+                                : $data['notification'].$inputData['userId'],
5495 5495
                         ),
5496 5496
                         'id=%i',
5497 5497
                         $inputData['itemId']
@@ -5507,7 +5507,7 @@  discard block
 block discarded – undo
5507 5507
                         array(
5508 5508
                             'notification' => empty($data['notification']) ?
5509 5509
                             $inputData['userId']
5510
-                                : $data['notification'] . ';' . $inputData['userId'],
5510
+                                : $data['notification'].';'.$inputData['userId'],
5511 5511
                         ),
5512 5512
                         'id=%i',
5513 5513
                         $inputData['itemId']
@@ -5540,8 +5540,8 @@  discard block
 block discarded – undo
5540 5540
             // Get all informations for this item
5541 5541
             $dataItem = DB::queryfirstrow(
5542 5542
                 'SELECT *
5543
-                FROM ' . prefixTable('items') . ' as i
5544
-                INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
5543
+                FROM ' . prefixTable('items').' as i
5544
+                INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
5545 5545
                 WHERE i.id=%i AND l.action = %s',
5546 5546
                 $dataReceived['item_id'],
5547 5547
                 'at_creation'
@@ -5572,21 +5572,21 @@  discard block
 block discarded – undo
5572 5572
                 );
5573 5573
                 // Prepare new line
5574 5574
                 $data = DB::queryfirstrow(
5575
-                    'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i ORDER BY date DESC',
5575
+                    'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i ORDER BY date DESC',
5576 5576
                     $dataReceived['item_id']
5577 5577
                 );
5578
-                $historic = date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], $data['date']) . ' - ' . $_SESSION['login'] . ' - ' . langHdl($data['action']) . ' - ' . $data['raison'];
5578
+                $historic = date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], $data['date']).' - '.$_SESSION['login'].' - '.langHdl($data['action']).' - '.$data['raison'];
5579 5579
                 // send back
5580 5580
                 $data = array(
5581 5581
                     'error' => '',
5582
-                    'new_line' => '<br>' . addslashes($historic),
5582
+                    'new_line' => '<br>'.addslashes($historic),
5583 5583
                 );
5584 5584
                 echo (string) prepareExchangedData(
5585
-    $SETTINGS['cpassman_dir'],$data, 'encode');
5585
+    $SETTINGS['cpassman_dir'], $data, 'encode');
5586 5586
             } else {
5587 5587
                 $data = array('error' => 'something_wrong');
5588 5588
                 echo (string) prepareExchangedData(
5589
-    $SETTINGS['cpassman_dir'],$data, 'encode');
5589
+    $SETTINGS['cpassman_dir'], $data, 'encode');
5590 5590
                 break;
5591 5591
             }
5592 5592
             break;
@@ -5641,7 +5641,7 @@  discard block
 block discarded – undo
5641 5641
             }
5642 5642
 
5643 5643
             // delete all existing old otv codes
5644
-            $rows = DB::query('SELECT id FROM ' . prefixTable('otv') . ' WHERE timestamp < ' . (time() - $SETTINGS['otv_expiration_period'] * 86400));
5644
+            $rows = DB::query('SELECT id FROM '.prefixTable('otv').' WHERE timestamp < '.(time() - $SETTINGS['otv_expiration_period'] * 86400));
5645 5645
             foreach ($rows as $record) {
5646 5646
                 DB::delete(prefixTable('otv'), 'id=%i', $record['id']);
5647 5647
             }
@@ -5663,8 +5663,8 @@  discard block
 block discarded – undo
5663 5663
             // Should we log a password change?
5664 5664
             $itemQ = DB::queryFirstRow(
5665 5665
                 'SELECT s.share_key, i.pw
5666
-                FROM ' . prefixTable('items') . ' AS i
5667
-                INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (i.id = s.object_id)
5666
+                FROM ' . prefixTable('items').' AS i
5667
+                INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (i.id = s.object_id)
5668 5668
                 WHERE s.user_id = %i AND s.object_id = %i',
5669 5669
                 $_SESSION['user_id'],
5670 5670
                 $inputData['id']
@@ -5714,7 +5714,7 @@  discard block
 block discarded – undo
5714 5714
             if (isset($SETTINGS['otv_expiration_period']) === false) {
5715 5715
                 $SETTINGS['otv_expiration_period'] = 7;
5716 5716
             }
5717
-            $url = $SETTINGS['cpassman_url'] . '/index.php?otv=true&' . http_build_query($otv_session);
5717
+            $url = $SETTINGS['cpassman_url'].'/index.php?otv=true&'.http_build_query($otv_session);
5718 5718
             //$exp_date = date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], time() + (intval($SETTINGS['otv_expiration_period']) * 86400));
5719 5719
 
5720 5720
             echo json_encode(
@@ -5753,8 +5753,8 @@  discard block
 block discarded – undo
5753 5753
                 'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status,
5754 5754
                 f.extension AS extension, f.type AS type,
5755 5755
                 s.share_key AS share_key
5756
-                FROM ' . prefixTable('files') . ' AS f
5757
-                INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id)
5756
+                FROM ' . prefixTable('files').' AS f
5757
+                INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id)
5758 5758
                 WHERE s.user_id = %i AND s.object_id = %i',
5759 5759
                 $_SESSION['user_id'],
5760 5760
                 $inputData['id']
@@ -5776,7 +5776,7 @@  discard block
 block discarded – undo
5776 5776
             //$fileName = basename($file_info['name'], '.'.$file_info['extension']);
5777 5777
 
5778 5778
             // prepare image info
5779
-            $post_title = basename($file_info['name'], '.' . $file_info['extension']);
5779
+            $post_title = basename($file_info['name'], '.'.$file_info['extension']);
5780 5780
             $post_title = isBase64($post_title) === true ?
5781 5781
                 base64_decode($post_title) : $post_title;
5782 5782
             $image_code = $file_info['file'];
@@ -5794,7 +5794,7 @@  discard block
 block discarded – undo
5794 5794
     $SETTINGS['cpassman_dir'],
5795 5795
                 array(
5796 5796
                     'error' => false,
5797
-                    'filename' => $post_title . '.' . $file_info['extension'],
5797
+                    'filename' => $post_title.'.'.$file_info['extension'],
5798 5798
                     'file_type' => $file_info['type'],
5799 5799
                     'file_content' => $fileContent,
5800 5800
                 ),
@@ -5848,16 +5848,16 @@  discard block
 block discarded – undo
5848 5848
             $idFolder = $dataReceived['idFolder'];
5849 5849
 
5850 5850
             // don't check if Personal Folder
5851
-            $data = DB::queryFirstRow('SELECT title FROM ' . prefixTable('nested_tree') . ' WHERE id = %i', $idFolder);
5851
+            $data = DB::queryFirstRow('SELECT title FROM '.prefixTable('nested_tree').' WHERE id = %i', $idFolder);
5852 5852
             if ($data['title'] === $_SESSION['user_id']) {
5853 5853
                 // send data
5854
-                echo '[{"duplicate" : "' . $duplicate . '" , error" : ""}]';
5854
+                echo '[{"duplicate" : "'.$duplicate.'" , error" : ""}]';
5855 5855
             } else {
5856 5856
                 if ($inputData['option'] === 'same_folder') {
5857 5857
                     // case unique folder
5858 5858
                     DB::query(
5859 5859
                         'SELECT label
5860
-                        FROM ' . prefixTable('items') . '
5860
+                        FROM ' . prefixTable('items').'
5861 5861
                         WHERE id_tree = %i AND label = %s',
5862 5862
                         $idFolder,
5863 5863
                         $label
@@ -5869,7 +5869,7 @@  discard block
 block discarded – undo
5869 5869
                     $arrayPf = array();
5870 5870
                     if (empty($row['id']) === false) {
5871 5871
                         $rows = DB::query(
5872
-                            'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
5872
+                            'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
5873 5873
                             '1'
5874 5874
                         );
5875 5875
                         foreach ($rows as $record) {
@@ -5884,12 +5884,12 @@  discard block
 block discarded – undo
5884 5884
                     $where->add('id_tree = %i', $idFolder);
5885 5885
                     $where->add('label = %s', $label);
5886 5886
                     if (empty($arrayPf) === false) {
5887
-                        $where->add('id_tree NOT IN (' . implode(',', $arrayPf) . ')');
5887
+                        $where->add('id_tree NOT IN ('.implode(',', $arrayPf).')');
5888 5888
                     }
5889 5889
 
5890 5890
                     DB::query(
5891 5891
                         'SELECT label
5892
-                        FROM ' . prefixTable('items') . '
5892
+                        FROM ' . prefixTable('items').'
5893 5893
                         WHERE %l',
5894 5894
                         $where
5895 5895
                     );
@@ -5901,7 +5901,7 @@  discard block
 block discarded – undo
5901 5901
                 }
5902 5902
 
5903 5903
                 // send data
5904
-                echo '[{"duplicate" : "' . $duplicate . '" , "error" : ""}]';
5904
+                echo '[{"duplicate" : "'.$duplicate.'" , "error" : ""}]';
5905 5905
             }
5906 5906
             break;
5907 5907
 
@@ -5957,7 +5957,7 @@  discard block
 block discarded – undo
5957 5957
             }
5958 5958
 
5959 5959
             //Build tree
5960
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tree/NestedTree/NestedTree.php';
5960
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tree/NestedTree/NestedTree.php';
5961 5961
             $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
5962 5962
             $tree->rebuild();
5963 5963
             $folders = $tree->getDescendants();
@@ -6007,7 +6007,7 @@  discard block
 block discarded – undo
6007 6007
                             if (empty($arr_data['folders'][$inc]['path']) === true) {
6008 6008
                                 $arr_data['folders'][$inc]['path'] = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
6009 6009
                             } else {
6010
-                                $arr_data['folders'][$inc]['path'] .= ' / ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
6010
+                                $arr_data['folders'][$inc]['path'] .= ' / '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
6011 6011
                             }
6012 6012
                         }
6013 6013
 
@@ -6078,8 +6078,8 @@  discard block
 block discarded – undo
6078 6078
                     $rows_tmp = DB::query(
6079 6079
                         'SELECT c.id, c.title, c.level, c.type, c.masked, c.order, c.encrypted_data, c.role_visibility, c.is_mandatory,
6080 6080
                         f.id_category AS category_id
6081
-                        FROM ' . prefixTable('categories_folders') . ' AS f
6082
-                        INNER JOIN ' . prefixTable('categories') . ' AS c ON (f.id_category = c.parent_id)
6081
+                        FROM ' . prefixTable('categories_folders').' AS f
6082
+                        INNER JOIN ' . prefixTable('categories').' AS c ON (f.id_category = c.parent_id)
6083 6083
                         WHERE id_folder=%i',
6084 6084
                         $folder
6085 6085
                     );
@@ -6106,7 +6106,7 @@  discard block
 block discarded – undo
6106 6106
                 $valTemp = '';
6107 6107
                 $data = DB::queryFirstRow(
6108 6108
                     'SELECT valeur
6109
-                    FROM ' . prefixTable('misc') . '
6109
+                    FROM ' . prefixTable('misc').'
6110 6110
                     WHERE type = %s AND intitule=%i',
6111 6111
                     'complex',
6112 6112
                     $folder
@@ -6123,14 +6123,14 @@  discard block
 block discarded – undo
6123 6123
                 $valTemp = '';
6124 6124
                 $rows_tmp = DB::query(
6125 6125
                     'SELECT t.title
6126
-                    FROM ' . prefixTable('roles_values') . ' as v
6127
-                    INNER JOIN ' . prefixTable('roles_title') . ' as t ON (v.role_id = t.id)
6126
+                    FROM ' . prefixTable('roles_values').' as v
6127
+                    INNER JOIN ' . prefixTable('roles_title').' as t ON (v.role_id = t.id)
6128 6128
                     WHERE v.folder_id = %i
6129 6129
                     GROUP BY title',
6130 6130
                     $folder
6131 6131
                 );
6132 6132
                 foreach ($rows_tmp as $record) {
6133
-                    $valTemp .= (empty($valTemp) === true ? '' : ' - ') . $record['title'];
6133
+                    $valTemp .= (empty($valTemp) === true ? '' : ' - ').$record['title'];
6134 6134
                 }
6135 6135
                 $arr_data[$folder]['visibilityRoles'] = $valTemp;
6136 6136
             }
@@ -6156,14 +6156,14 @@  discard block
 block discarded – undo
6156 6156
             // Check KEY
6157 6157
             if ($inputData['key'] !== $_SESSION['key']) {
6158 6158
                 echo (string) prepareExchangedData(
6159
-    $SETTINGS['cpassman_dir'],array('error' => 'ERR_KEY_NOT_CORRECT'), 'encode');
6159
+    $SETTINGS['cpassman_dir'], array('error' => 'ERR_KEY_NOT_CORRECT'), 'encode');
6160 6160
                 break;
6161 6161
             }
6162 6162
 
6163 6163
             // get item info
6164 6164
             $dataItem = DB::queryFirstRow(
6165 6165
                 'SELECT *
6166
-                FROM ' . prefixTable('items') . '
6166
+                FROM ' . prefixTable('items').'
6167 6167
                 WHERE id=%i',
6168 6168
                 $inputData['itemId']
6169 6169
             );
@@ -6173,8 +6173,8 @@  discard block
 block discarded – undo
6173 6173
             $rows = DB::query(
6174 6174
                 'SELECT l.date as date, l.action as action, l.raison as raison,
6175 6175
                 u.login as login, u.avatar_thumb as avatar_thumb, u.name as name, u.lastname as lastname
6176
-                FROM ' . prefixTable('log_items') . ' as l
6177
-                LEFT JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id)
6176
+                FROM ' . prefixTable('log_items').' as l
6177
+                LEFT JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id)
6178 6178
                 WHERE id_item=%i AND action <> %s
6179 6179
                 ORDER BY date DESC',
6180 6180
                 $inputData['itemId'],
@@ -6189,7 +6189,7 @@  discard block
 block discarded – undo
6189 6189
                 
6190 6190
                 // imported via API
6191 6191
                 if (empty($record['login'])) {
6192
-                    $record['login'] = langHdl('imported_via_api') . ' [' . $record['raison'] . ']';
6192
+                    $record['login'] = langHdl('imported_via_api').' ['.$record['raison'].']';
6193 6193
                 }
6194 6194
 
6195 6195
                 if (
@@ -6200,13 +6200,13 @@  discard block
 block discarded – undo
6200 6200
                 ) {
6201 6201
                     // Prepare avatar
6202 6202
                     if (isset($record['avatar_thumb']) && empty($record['avatar_thumb']) === false) {
6203
-                        if (file_exists($SETTINGS['cpassman_dir'] . '/includes/avatars/' . $record['avatar_thumb'])) {
6204
-                            $avatar = $SETTINGS['cpassman_url'] . '/includes/avatars/' . $record['avatar_thumb'];
6203
+                        if (file_exists($SETTINGS['cpassman_dir'].'/includes/avatars/'.$record['avatar_thumb'])) {
6204
+                            $avatar = $SETTINGS['cpassman_url'].'/includes/avatars/'.$record['avatar_thumb'];
6205 6205
                         } else {
6206
-                            $avatar = $SETTINGS['cpassman_url'] . '/includes/images/photo.jpg';
6206
+                            $avatar = $SETTINGS['cpassman_url'].'/includes/images/photo.jpg';
6207 6207
                         }
6208 6208
                     } else {
6209
-                        $avatar = $SETTINGS['cpassman_url'] . '/includes/images/photo.jpg';
6209
+                        $avatar = $SETTINGS['cpassman_url'].'/includes/images/photo.jpg';
6210 6210
                     }
6211 6211
 
6212 6212
                     // Prepare action
@@ -6223,19 +6223,19 @@  discard block
 block discarded – undo
6223 6223
                         $action = langHdl($reason[0]);
6224 6224
                         if ($reason[0] === 'at_moved') {
6225 6225
                             $tmp = explode(' -> ', $reason[1]);
6226
-                            $detail = langHdl('from') . ' <span class="font-weight-light">' . $tmp[0] . '</span> ' . langHdl('to') . ' <span class="font-weight-light">' . $tmp[1] . ' </span>';
6226
+                            $detail = langHdl('from').' <span class="font-weight-light">'.$tmp[0].'</span> '.langHdl('to').' <span class="font-weight-light">'.$tmp[1].' </span>';
6227 6227
                         } elseif ($reason[0] === 'at_field') {
6228 6228
                             $tmp = explode(' => ', $reason[1]);
6229 6229
                             if (count($tmp) > 1) {
6230
-                                $detail = '<b>' . trim($tmp[0]) . '</b> | ' . langHdl('previous_value') .
6231
-                                    ': <span class="font-weight-light">' . trim($tmp[1]) . '</span>';
6230
+                                $detail = '<b>'.trim($tmp[0]).'</b> | '.langHdl('previous_value').
6231
+                                    ': <span class="font-weight-light">'.trim($tmp[1]).'</span>';
6232 6232
                             } else {
6233 6233
                                 $detail = trim($reason[1]);
6234 6234
                             }
6235 6235
                         } elseif (in_array($reason[0], array('at_restriction', 'at_email', 'at_login', 'at_label', 'at_url', 'at_tag')) === true) {
6236 6236
                             $tmp = explode(' => ', $reason[1]);
6237 6237
                             $detail = empty(trim($tmp[0])) === true ?
6238
-                                langHdl('no_previous_value') : langHdl('previous_value') . ': <span class="font-weight-light">' . $tmp[0] . ' </span>';
6238
+                                langHdl('no_previous_value') : langHdl('previous_value').': <span class="font-weight-light">'.$tmp[0].' </span>';
6239 6239
                         } elseif ($reason[0] === 'at_automatic_del') {
6240 6240
                             $detail = langHdl($reason[1]);
6241 6241
                         } elseif ($reason[0] === 'at_anyoneconmodify') {
@@ -6244,7 +6244,7 @@  discard block
 block discarded – undo
6244 6244
                             $tmp = explode(':', $reason[1]);
6245 6245
                             $tmp = explode('.', $tmp[0]);
6246 6246
                             $detail = isBase64($tmp[0]) === true ?
6247
-                                base64_decode($tmp[0]) . '.' . $tmp[1] : $tmp[0];
6247
+                                base64_decode($tmp[0]).'.'.$tmp[1] : $tmp[0];
6248 6248
                         } elseif ($reason[0] === 'at_import') {
6249 6249
                             $detail = '';
6250 6250
                         } elseif (in_array($reason[0], array('csv', 'pdf')) === true) {
@@ -6263,8 +6263,8 @@  discard block
 block discarded – undo
6263 6263
                         array(
6264 6264
                             'avatar' => $avatar,
6265 6265
                             'login' => $record['login'],
6266
-                            'name' => $record['name'] . ' ' . $record['lastname'],
6267
-                            'date' => date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']),
6266
+                            'name' => $record['name'].' '.$record['lastname'],
6267
+                            'date' => date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']),
6268 6268
                             'action' => $action,
6269 6269
                             'detail' => $detail,
6270 6270
                         )
@@ -6279,7 +6279,7 @@  discard block
 block discarded – undo
6279 6279
             
6280 6280
             // send data
6281 6281
             echo (string) prepareExchangedData(
6282
-    $SETTINGS['cpassman_dir'],$data, 'encode');
6282
+    $SETTINGS['cpassman_dir'], $data, 'encode');
6283 6283
 
6284 6284
             break;
6285 6285
 
@@ -6298,7 +6298,7 @@  discard block
 block discarded – undo
6298 6298
             }
6299 6299
             // decrypt and retrieve data in JSON format
6300 6300
             $data_received = prepareExchangedData(
6301
-    $SETTINGS['cpassman_dir'],$inputData['data'], 'decode');
6301
+    $SETTINGS['cpassman_dir'], $inputData['data'], 'decode');
6302 6302
 
6303 6303
             // prepare variables
6304 6304
             $label = htmlspecialchars_decode($data_received['label'], ENT_QUOTES);
@@ -6348,18 +6348,18 @@  discard block
 block discarded – undo
6348 6348
 
6349 6349
             // get some info to add to the notification email
6350 6350
             $resp_user = DB::queryfirstrow(
6351
-                'SELECT login FROM ' . prefixTable('users') . ' WHERE id = %i',
6351
+                'SELECT login FROM '.prefixTable('users').' WHERE id = %i',
6352 6352
                 $_SESSION['user_id']
6353 6353
             );
6354 6354
             $resp_folder = DB::queryfirstrow(
6355
-                'SELECT title FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
6355
+                'SELECT title FROM '.prefixTable('nested_tree').' WHERE id = %i',
6356 6356
                 $folder
6357 6357
             );
6358 6358
 
6359 6359
             // notify Managers
6360 6360
             $rows = DB::query(
6361 6361
                 'SELECT email
6362
-                FROM ' . prefixTable('users') . '
6362
+                FROM ' . prefixTable('users').'
6363 6363
                 WHERE `gestionnaire` = %i AND `email` IS NOT NULL',
6364 6364
                 1
6365 6365
             );
@@ -6391,14 +6391,14 @@  discard block
 block discarded – undo
6391 6391
             // Get list of users
6392 6392
             $usersList = array();
6393 6393
             $usersString = '';
6394
-            $rows = DB::query('SELECT id,login,email FROM ' . prefixTable('users') . ' ORDER BY login ASC');
6394
+            $rows = DB::query('SELECT id,login,email FROM '.prefixTable('users').' ORDER BY login ASC');
6395 6395
             foreach ($rows as $record) {
6396 6396
                 $usersList[$record['login']] = array(
6397 6397
                     'id' => $record['id'],
6398 6398
                     'login' => $record['login'],
6399 6399
                     'email' => $record['email'],
6400 6400
                 );
6401
-                $usersString .= $record['id'] . '#' . $record['login'] . ';';
6401
+                $usersString .= $record['id'].'#'.$record['login'].';';
6402 6402
             }
6403 6403
 
6404 6404
             $data = array(
@@ -6408,7 +6408,7 @@  discard block
 block discarded – undo
6408 6408
 
6409 6409
             // send data
6410 6410
             echo (string) prepareExchangedData(
6411
-    $SETTINGS['cpassman_dir'],$data, 'encode');
6411
+    $SETTINGS['cpassman_dir'], $data, 'encode');
6412 6412
             break;
6413 6413
 
6414 6414
         case 'send_request_access':
@@ -6426,7 +6426,7 @@  discard block
 block discarded – undo
6426 6426
             }
6427 6427
             // decrypt and retrieve data in JSON format
6428 6428
             $dataReceived = prepareExchangedData(
6429
-    $SETTINGS['cpassman_dir'],$inputData['data'], 'decode');
6429
+    $SETTINGS['cpassman_dir'], $inputData['data'], 'decode');
6430 6430
 
6431 6431
             // prepare variables
6432 6432
             //$post_email_body = filter_var($dataReceived['email'], FILTER_SANITIZE_STRING);
@@ -6435,7 +6435,7 @@  discard block
 block discarded – undo
6435 6435
             // Send email
6436 6436
             $dataItem = DB::queryfirstrow(
6437 6437
                 'SELECT label, id_tree
6438
-                FROM ' . prefixTable('items') . '
6438
+                FROM ' . prefixTable('items').'
6439 6439
                 WHERE id = %i',
6440 6440
                 $inputData['itemId']
6441 6441
             );
@@ -6524,7 +6524,7 @@  discard block
 block discarded – undo
6524 6524
             }
6525 6525
             // decrypt and retrieve data in JSON format
6526 6526
             $dataReceived = prepareExchangedData(
6527
-    $SETTINGS['cpassman_dir'],$inputData['data'], 'decode');
6527
+    $SETTINGS['cpassman_dir'], $inputData['data'], 'decode');
6528 6528
 
6529 6529
             // prepare variables
6530 6530
             $post_notification_status = (int) filter_var($dataReceived['notification_status'], FILTER_SANITIZE_NUMBER_INT);
@@ -6532,7 +6532,7 @@  discard block
 block discarded – undo
6532 6532
 
6533 6533
             DB::query(
6534 6534
                 'SELECT *
6535
-                FROM ' . prefixTable('notification') . '
6535
+                FROM ' . prefixTable('notification').'
6536 6536
                 WHERE item_id = %i AND user_id = %i',
6537 6537
                 $inputData['itemId'],
6538 6538
                 $_SESSION['user_id']
@@ -6569,7 +6569,7 @@  discard block
 block discarded – undo
6569 6569
 
6570 6570
             // send data
6571 6571
             echo (string) prepareExchangedData(
6572
-    $SETTINGS['cpassman_dir'],$data, 'encode');
6572
+    $SETTINGS['cpassman_dir'], $data, 'encode');
6573 6573
 
6574 6574
             break;
6575 6575
 
@@ -6592,7 +6592,7 @@  discard block
 block discarded – undo
6592 6592
             }
6593 6593
             // decrypt and retrieve data in JSON format
6594 6594
             $dataReceived = prepareExchangedData(
6595
-    $SETTINGS['cpassman_dir'],$inputData['data'], 'decode');
6595
+    $SETTINGS['cpassman_dir'], $inputData['data'], 'decode');
6596 6596
 
6597 6597
             // prepare variables
6598 6598
             $inputData['itemId'] = (int) filter_var($dataReceived['item_id'], FILTER_SANITIZE_NUMBER_INT);
@@ -6601,7 +6601,7 @@  discard block
 block discarded – undo
6601 6601
             // And related logs
6602 6602
             $rows = DB::query(
6603 6603
                 'SELECT id, file AS filename
6604
-                FROM ' . prefixTable('files') . '
6604
+                FROM ' . prefixTable('files').'
6605 6605
                 WHERE id_item = %i AND confirmed = %i',
6606 6606
                 $inputData['itemId'],
6607 6607
                 0
@@ -6615,12 +6615,12 @@  discard block
 block discarded – undo
6615 6615
                 );
6616 6616
 
6617 6617
                 // Delete file on server
6618
-                unlink($SETTINGS['path_to_upload_folder'] . '/' . TP_FILE_PREFIX . base64_decode($file['filename']));
6618
+                unlink($SETTINGS['path_to_upload_folder'].'/'.TP_FILE_PREFIX.base64_decode($file['filename']));
6619 6619
 
6620 6620
                 // Delete related logs
6621 6621
                 $logFile = DB::query(
6622 6622
                     'SELECT increment_id, raison
6623
-                    FROM ' . prefixTable('log_items') . '
6623
+                    FROM ' . prefixTable('log_items').'
6624 6624
                     WHERE id_item = %i AND id_user = %i AND action = %s AND raison LIKE "at_add_file :%"',
6625 6625
                     $inputData['itemId'],
6626 6626
                     $_SESSION['user_id'],
@@ -6645,7 +6645,7 @@  discard block
 block discarded – undo
6645 6645
 
6646 6646
             // send data
6647 6647
             echo (string) prepareExchangedData(
6648
-    $SETTINGS['cpassman_dir'],$data, 'encode');
6648
+    $SETTINGS['cpassman_dir'], $data, 'encode');
6649 6649
 
6650 6650
             break;
6651 6651
 
@@ -6668,7 +6668,7 @@  discard block
 block discarded – undo
6668 6668
             }
6669 6669
             // decrypt and retrieve data in JSON format
6670 6670
             $dataReceived = prepareExchangedData(
6671
-    $SETTINGS['cpassman_dir'],$inputData['data'], 'decode');
6671
+    $SETTINGS['cpassman_dir'], $inputData['data'], 'decode');
6672 6672
 
6673 6673
             // prepare variables
6674 6674
             $inputData['itemId'] = (int) filter_var($dataReceived['item_id'], FILTER_SANITIZE_NUMBER_INT);
@@ -6676,7 +6676,7 @@  discard block
 block discarded – undo
6676 6676
             // Confirm attachments
6677 6677
             $rows = DB::query(
6678 6678
                 'SELECT id, file AS filename
6679
-                FROM ' . prefixTable('files') . '
6679
+                FROM ' . prefixTable('files').'
6680 6680
                 WHERE id_item = %i AND confirmed = %i',
6681 6681
                 $inputData['itemId'],
6682 6682
                 0
@@ -6699,7 +6699,7 @@  discard block
 block discarded – undo
6699 6699
 
6700 6700
             // send data
6701 6701
             echo (string) prepareExchangedData(
6702
-    $SETTINGS['cpassman_dir'],$data, 'encode');
6702
+    $SETTINGS['cpassman_dir'], $data, 'encode');
6703 6703
 
6704 6704
             break;
6705 6705
     }
@@ -6714,15 +6714,15 @@  discard block
 block discarded – undo
6714 6714
         case 'autocomplete_tags':
6715 6715
             // Get a list off all existing TAGS
6716 6716
             $listOfTags = '';
6717
-            $rows = DB::query('SELECT tag FROM ' . prefixTable('tags') . ' WHERE tag LIKE %ss GROUP BY tag', $inputData['getTerm']);
6717
+            $rows = DB::query('SELECT tag FROM '.prefixTable('tags').' WHERE tag LIKE %ss GROUP BY tag', $inputData['getTerm']);
6718 6718
             foreach ($rows as $record) {
6719 6719
                 if (empty($listOfTags)) {
6720
-                    $listOfTags = '"' . $record['tag'] . '"';
6720
+                    $listOfTags = '"'.$record['tag'].'"';
6721 6721
                 } else {
6722
-                    $listOfTags .= ', "' . $record['tag'] . '"';
6722
+                    $listOfTags .= ', "'.$record['tag'].'"';
6723 6723
                 }
6724 6724
             }
6725
-            echo '[' . $listOfTags . ']';
6725
+            echo '['.$listOfTags.']';
6726 6726
             break;
6727 6727
     }
6728 6728
 }
@@ -6738,7 +6738,7 @@  discard block
 block discarded – undo
6738 6738
 {
6739 6739
     $data = DB::queryFirstRow(
6740 6740
         'SELECT bloquer_creation, bloquer_modification, personal_folder
6741
-        FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
6741
+        FROM ' . prefixTable('nested_tree').' WHERE id = %i',
6742 6742
         $groupe
6743 6743
     );
6744 6744
     // Check if it's in a personal folder. If yes, then force complexity overhead.
Please login to merge, or discard this patch.
sources/main.queries.php 1 patch
Spacing   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
 date_default_timezone_set(isset($SETTINGS['timezone']) === true ? $SETTINGS['timezone'] : 'UTC');
46 46
 
47 47
 // DO CHECKS
48
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
49
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
48
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
49
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
50 50
 $post_type = filter_input(INPUT_POST, 'type', FILTER_SANITIZE_STRING);
51 51
 if (
52 52
     isset($post_type) === true
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     && checkUser($_SESSION['user_id'], $_SESSION['key'], 'home', $SETTINGS) === false
63 63
 ) {
64 64
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
65
-    include $SETTINGS['cpassman_dir'] . '/error.php';
65
+    include $SETTINGS['cpassman_dir'].'/error.php';
66 66
     exit();
67 67
 } elseif ((isset($_SESSION['user_id']) === true
68 68
         && isset($_SESSION['key'])) === true
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     mainQuery($SETTINGS);
75 75
 } else {
76 76
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
77
-    include $SETTINGS['cpassman_dir'] . '/error.php';
77
+    include $SETTINGS['cpassman_dir'].'/error.php';
78 78
     exit();
79 79
 }
80 80
 
@@ -89,13 +89,13 @@  discard block
 block discarded – undo
89 89
 
90 90
 
91 91
     // Includes
92
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
93
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
94
-    include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
95
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
92
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
93
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
94
+    include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
95
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
96 96
 
97 97
     // Connect to mysql server
98
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
98
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
99 99
 
100 100
     DB::$host = DB_HOST;
101 101
     DB::$user = DB_USER;
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
     DB::$connect_options = DB_CONNECT_OPTIONS;
108 108
 
109 109
     // User's language loading
110
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
110
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
111 111
 
112 112
     // Prepare post variables
113 113
     $post_key = filter_input(INPUT_POST, 'key', FILTER_SANITIZE_STRING);
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
             $pwdlib = new PasswordLib\PasswordLib();
437 437
             // generate key
438 438
             $key = $pwdlib->getRandomToken(filter_input(INPUT_POST, 'size', FILTER_SANITIZE_NUMBER_INT));
439
-            return '[{"key" : "' . htmlentities($key, ENT_QUOTES) . '"}]';
439
+            return '[{"key" : "'.htmlentities($key, ENT_QUOTES).'"}]';
440 440
     }
441 441
 }
442 442
 
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
                 )
519 519
             );
520 520
 
521
-            return '[{"token" : "' . $token . '"}]';
521
+            return '[{"token" : "'.$token.'"}]';
522 522
             break;
523 523
     }
524 524
 }
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
     // get number of items
541 541
     DB::queryFirstRow(
542 542
         'SELECT increment_id
543
-        FROM ' . prefixTable('sharekeys_items') .
543
+        FROM ' . prefixTable('sharekeys_items').
544 544
         ' WHERE user_id = %i',
545 545
         $userId
546 546
     );
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
         // check if expected security level is reached
597 597
         $dataUser = DB::queryfirstrow(
598 598
             'SELECT *
599
-            FROM ' . prefixTable('users') . ' WHERE id = %i',
599
+            FROM ' . prefixTable('users').' WHERE id = %i',
600 600
             $post_user_id
601 601
         );
602 602
 
@@ -617,8 +617,8 @@  discard block
 block discarded – undo
617 617
         if (empty($dataUser['fonction_id']) === false) {
618 618
             $data = DB::queryFirstRow(
619 619
                 'SELECT complexity
620
-                FROM ' . prefixTable('roles_title') . '
621
-                WHERE id IN (' . $dataUser['fonction_id'] . ')
620
+                FROM ' . prefixTable('roles_title').'
621
+                WHERE id IN (' . $dataUser['fonction_id'].')
622 622
                 ORDER BY complexity DESC'
623 623
             );
624 624
         } else {
@@ -632,8 +632,8 @@  discard block
 block discarded – undo
632 632
                 $SETTINGS['cpassman_dir'],
633 633
                 array(
634 634
                     'error' => true,
635
-                    'message' => '<div style="margin:10px 0 10px 15px;">' . langHdl('complexity_level_not_reached') . '.<br>' .
636
-                        langHdl('expected_complexity_level') . ': <b>' . TP_PW_COMPLEXITY[$data['complexity']][1] . '</b></div>',
635
+                    'message' => '<div style="margin:10px 0 10px 15px;">'.langHdl('complexity_level_not_reached').'.<br>'.
636
+                        langHdl('expected_complexity_level').': <b>'.TP_PW_COMPLEXITY[$data['complexity']][1].'</b></div>',
637 637
                 ),
638 638
                 'encode'
639 639
             );
@@ -739,14 +739,14 @@  discard block
 block discarded – undo
739 739
         // Get data about user
740 740
         $data = DB::queryfirstrow(
741 741
             'SELECT id, email, pw
742
-            FROM ' . prefixTable('users') . '
742
+            FROM ' . prefixTable('users').'
743 743
             WHERE login = %s',
744 744
             $post_login
745 745
         );
746 746
     } else {
747 747
         $data = DB::queryfirstrow(
748 748
             'SELECT id, login, email, pw
749
-            FROM ' . prefixTable('users') . '
749
+            FROM ' . prefixTable('users').'
750 750
             WHERE id = %i',
751 751
             $post_id
752 752
         );
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
     $counter = DB::count();
757 757
 
758 758
     // load passwordLib library
759
-    $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries');
759
+    $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries');
760 760
     $pwdlib->register();
761 761
     $pwdlib = new PasswordLib\PasswordLib();
762 762
 
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
     }
806 806
     
807 807
     // generate new GA user code
808
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php';
808
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php';
809 809
     $tfa = new Authentication\TwoFactorAuth\TwoFactorAuth($SETTINGS['ga_website_name']);
810 810
     $gaSecretKey = $tfa->createSecret();
811 811
     $gaTemporaryCode = GenerateCryptKey(12, false, true, true, false, true, $SETTINGS);
@@ -845,7 +845,7 @@  discard block
 block discarded – undo
845 845
                 'email' => $data['email'],
846 846
                 'email_result' => str_replace(
847 847
                     '#email#',
848
-                    '<b>' . obfuscateEmail($data['email']) . '</b>',
848
+                    '<b>'.obfuscateEmail($data['email']).'</b>',
849 849
                     addslashes(langHdl('admin_email_result_ok'))
850 850
                 ),
851 851
             ),
@@ -862,7 +862,7 @@  discard block
 block discarded – undo
862 862
             'email' => $data['email'],
863 863
             'email_result' => str_replace(
864 864
                 '#email#',
865
-                '<b>' . obfuscateEmail($data['email']) . '</b>',
865
+                '<b>'.obfuscateEmail($data['email']).'</b>',
866 866
                 addslashes(langHdl('admin_email_result_ok'))
867 867
             ),
868 868
         ),
@@ -876,7 +876,7 @@  discard block
 block discarded – undo
876 876
 {
877 877
     if (isKeyExistingAndEqual('enable_send_email_on_user_login', 1, $SETTINGS) === true) {
878 878
         $row = DB::queryFirstRow(
879
-            'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s',
879
+            'SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s',
880 880
             'cron',
881 881
             'sending_emails'
882 882
         );
@@ -884,7 +884,7 @@  discard block
 block discarded – undo
884 884
         if ((int) (time() - $row['valeur']) >= 300 || (int) $row['valeur'] === 0) {
885 885
             $rows = DB::query(
886 886
                 'SELECT *
887
-                FROM ' . prefixTable('emails') .
887
+                FROM ' . prefixTable('emails').
888 888
                 ' WHERE status != %s',
889 889
                 'sent'
890 890
             );
@@ -990,8 +990,8 @@  discard block
 block discarded – undo
990 990
     $arr_html = array();
991 991
     $rows = DB::query(
992 992
         'SELECT i.id AS id, i.label AS label, i.id_tree AS id_tree, l.date, i.perso AS perso, i.restricted_to AS restricted
993
-        FROM ' . prefixTable('log_items') . ' AS l
994
-        RIGHT JOIN ' . prefixTable('items') . ' AS i ON (l.id_item = i.id)
993
+        FROM ' . prefixTable('log_items').' AS l
994
+        RIGHT JOIN ' . prefixTable('items').' AS i ON (l.id_item = i.id)
995 995
         WHERE l.action = %s AND l.id_user = %i
996 996
         ORDER BY l.date DESC
997 997
         LIMIT 0, 100',
@@ -1023,7 +1023,7 @@  discard block
 block discarded – undo
1023 1023
     if (isKeyExistingAndEqual('enable_suggestion', 1, $SETTINGS) === true
1024 1024
         && ((int) $_SESSION['user_admin'] === 1 || (int) $_SESSION['user_manager'] === 1)
1025 1025
     ) {
1026
-        DB::query('SELECT * FROM ' . prefixTable('suggestion'));
1026
+        DB::query('SELECT * FROM '.prefixTable('suggestion'));
1027 1027
         $nb_suggestions_waiting = DB::count();
1028 1028
     }
1029 1029
 
@@ -1057,13 +1057,13 @@  discard block
 block discarded – undo
1057 1057
             if ($data === 'stat_languages') {
1058 1058
                 $tmp = '';
1059 1059
                 foreach ($stats_data[$data] as $key => $value) {
1060
-                    $tmp .= $tmp === '' ? $key . '-' . $value : ',' . $key . '-' . $value;
1060
+                    $tmp .= $tmp === '' ? $key.'-'.$value : ','.$key.'-'.$value;
1061 1061
                 }
1062 1062
                 $statsToSend[$data] = $tmp;
1063 1063
             } elseif ($data === 'stat_country') {
1064 1064
                 $tmp = '';
1065 1065
                 foreach ($stats_data[$data] as $key => $value) {
1066
-                    $tmp .= $tmp === '' ? $key . '-' . $value : ',' . $key . '-' . $value;
1066
+                    $tmp .= $tmp === '' ? $key.'-'.$value : ','.$key.'-'.$value;
1067 1067
                 }
1068 1068
                 $statsToSend[$data] = $tmp;
1069 1069
             } else {
@@ -1138,8 +1138,8 @@  discard block
 block discarded – undo
1138 1138
                 $url_found = substr($line, 19, strlen($line) - 22);
1139 1139
                 if (empty($url_found) === false) {
1140 1140
                     $tmp = parse_url($url_found);
1141
-                    $anonym_url = $tmp['scheme'] . '://<anonym_url>' . (isset($tmp['path']) === true ? $tmp['path'] : '');
1142
-                    $line = "'cpassman_url' => '" . $anonym_url . "\n";
1141
+                    $anonym_url = $tmp['scheme'].'://<anonym_url>'.(isset($tmp['path']) === true ? $tmp['path'] : '');
1142
+                    $line = "'cpassman_url' => '".$anonym_url."\n";
1143 1143
                 } else {
1144 1144
                     $line = "'cpassman_url' => \n";
1145 1145
                 }
@@ -1169,7 +1169,7 @@  discard block
 block discarded – undo
1169 1169
     $teampass_errors = '';
1170 1170
     $rows = DB::query(
1171 1171
         'SELECT label, date AS error_date
1172
-        FROM ' . prefixTable('log_system') . "
1172
+        FROM ' . prefixTable('log_system')."
1173 1173
         WHERE `type` LIKE 'error'
1174 1174
         ORDER BY `date` DESC
1175 1175
         LIMIT 0, 10"
@@ -1177,9 +1177,9 @@  discard block
 block discarded – undo
1177 1177
     if (DB::count() > 0) {
1178 1178
         foreach ($rows as $record) {
1179 1179
             if (empty($teampass_errors) === true) {
1180
-                $teampass_errors = ' * ' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['error_date']) . ' - ' . $record['label'];
1180
+                $teampass_errors = ' * '.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['error_date']).' - '.$record['label'];
1181 1181
             } else {
1182
-                $teampass_errors .= ' * ' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['error_date']) . ' - ' . $record['label'];
1182
+                $teampass_errors .= ' * '.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['error_date']).' - '.$record['label'];
1183 1183
             }
1184 1184
         }
1185 1185
     }
@@ -1188,7 +1188,7 @@  discard block
 block discarded – undo
1188 1188
 
1189 1189
     // Now prepare text
1190 1190
     $txt = '### Page on which it happened
1191
-' . $post_data['current_page'] . '
1191
+' . $post_data['current_page'].'
1192 1192
 
1193 1193
 ### Steps to reproduce
1194 1194
 1.
@@ -1203,39 +1203,39 @@  discard block
 block discarded – undo
1203 1203
 Tell us what happens instead
1204 1204
 
1205 1205
 ### Server configuration
1206
-**Operating system**: ' . php_uname() . '
1206
+**Operating system**: ' . php_uname().'
1207 1207
 
1208
-**Web server:** ' . $_SERVER['SERVER_SOFTWARE'] . '
1208
+**Web server:** ' . $_SERVER['SERVER_SOFTWARE'].'
1209 1209
 
1210
-**Database:** ' . ($link === false ? langHdl('undefined') : mysqli_get_server_info($link)) . '
1210
+**Database:** ' . ($link === false ? langHdl('undefined') : mysqli_get_server_info($link)).'
1211 1211
 
1212
-**PHP version:** ' . PHP_VERSION . '
1212
+**PHP version:** ' . PHP_VERSION.'
1213 1213
 
1214
-**Teampass version:** ' . TP_VERSION_FULL . '
1214
+**Teampass version:** ' . TP_VERSION_FULL.'
1215 1215
 
1216 1216
 **Teampass configuration file:**
1217 1217
 ```
1218
-' . $list_of_options . '
1218
+' . $list_of_options.'
1219 1219
 ```
1220 1220
 
1221 1221
 **Updated from an older Teampass or fresh install:**
1222 1222
 
1223 1223
 ### Client configuration
1224 1224
 
1225
-**Browser:** ' . $post_data['browser_name'] . ' - ' . $post_data['browser_version'] . '
1225
+**Browser:** ' . $post_data['browser_name'].' - '.$post_data['browser_version'].'
1226 1226
 
1227
-**Operating system:** ' . $post_data['os'] . ' - ' . $post_data['os_archi'] . 'bits
1227
+**Operating system:** ' . $post_data['os'].' - '.$post_data['os_archi'].'bits
1228 1228
 
1229 1229
 ### Logs
1230 1230
 
1231 1231
 #### Web server error log
1232 1232
 ```
1233
-' . $err['message'] . ' - ' . $err['file'] . ' (' . $err['line'] . ')
1233
+' . $err['message'].' - '.$err['file'].' ('.$err['line'].')
1234 1234
 ```
1235 1235
 
1236 1236
 #### Teampass 10 last system errors
1237 1237
 ```
1238
-' . $teampass_errors . '
1238
+' . $teampass_errors.'
1239 1239
 ```
1240 1240
 
1241 1241
 #### Log from the web-browser developer console (CTRL + SHIFT + i)
@@ -1264,7 +1264,7 @@  discard block
 block discarded – undo
1264 1264
         // Check if user exists
1265 1265
         $userInfo = DB::queryFirstRow(
1266 1266
             'SELECT public_key, private_key, pw, auth_type
1267
-            FROM ' . prefixTable('users') . '
1267
+            FROM ' . prefixTable('users').'
1268 1268
             WHERE id = %i',
1269 1269
             $post_user_id
1270 1270
         );
@@ -1272,7 +1272,7 @@  discard block
 block discarded – undo
1272 1272
             // Get one item
1273 1273
             $record = DB::queryFirstRow(
1274 1274
                 'SELECT object_id
1275
-                FROM ' . prefixTable('sharekeys_items') . '
1275
+                FROM ' . prefixTable('sharekeys_items').'
1276 1276
                 WHERE user_id = %i',
1277 1277
                 $post_user_id
1278 1278
             );
@@ -1294,7 +1294,7 @@  discard block
 block discarded – undo
1294 1294
             // Get itemKey from current user
1295 1295
             $currentUserKey = DB::queryFirstRow(
1296 1296
                 'SELECT share_key, increment_id
1297
-                FROM ' . prefixTable('sharekeys_items') . '
1297
+                FROM ' . prefixTable('sharekeys_items').'
1298 1298
                 WHERE object_id = %i AND user_id = %i',
1299 1299
                 $record['object_id'],
1300 1300
                 $post_user_id
@@ -1322,7 +1322,7 @@  discard block
 block discarded – undo
1322 1322
             
1323 1323
             // Use the password check
1324 1324
             // load passwordLib library
1325
-            $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1325
+            $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries');
1326 1326
             $pwdlib->register();
1327 1327
             $pwdlib = new PasswordLib\PasswordLib();
1328 1328
             
@@ -1381,7 +1381,7 @@  discard block
 block discarded – undo
1381 1381
         // Get user info
1382 1382
         $userData = DB::queryFirstRow(
1383 1383
             'SELECT private_key
1384
-            FROM ' . prefixTable('users') . '
1384
+            FROM ' . prefixTable('users').'
1385 1385
             WHERE id = %i',
1386 1386
             $post_user_id
1387 1387
         );
@@ -1408,7 +1408,7 @@  discard block
 block discarded – undo
1408 1408
             );
1409 1409
 
1410 1410
             // Load superGlobals
1411
-            include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1411
+            include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1412 1412
             $superGlobal = new protect\SuperGlobal\SuperGlobal();
1413 1413
 
1414 1414
             $superGlobal->put('private_key', $privateKey, 'SESSION', 'user');
@@ -1448,7 +1448,7 @@  discard block
 block discarded – undo
1448 1448
         // Get user info
1449 1449
         $userData = DB::queryFirstRow(
1450 1450
             'SELECT email, auth_type, login
1451
-            FROM ' . prefixTable('users') . '
1451
+            FROM ' . prefixTable('users').'
1452 1452
             WHERE id = %i',
1453 1453
             $post_user_id
1454 1454
         );
@@ -1588,7 +1588,7 @@  discard block
 block discarded – undo
1588 1588
         // Get user info
1589 1589
         $userData = DB::queryFirstRow(
1590 1590
             'SELECT email, auth_type, login
1591
-            FROM ' . prefixTable('users') . '
1591
+            FROM ' . prefixTable('users').'
1592 1592
             WHERE id = %i',
1593 1593
             $post_user_id
1594 1594
         );
@@ -1652,13 +1652,13 @@  discard block
 block discarded – undo
1652 1652
         // Check if user exists
1653 1653
         DB::queryFirstRow(
1654 1654
             'SELECT *
1655
-            FROM ' . prefixTable('users') . '
1655
+            FROM ' . prefixTable('users').'
1656 1656
             WHERE id = %i',
1657 1657
             $post_user_id
1658 1658
         );
1659 1659
         if (DB::count() > 0) {
1660 1660
             // Include libraries
1661
-            include_once $SETTINGS['cpassman_dir'] . '/sources/aes.functions.php';
1661
+            include_once $SETTINGS['cpassman_dir'].'/sources/aes.functions.php';
1662 1662
 
1663 1663
             // CLear old sharekeys
1664 1664
             if ($post_self_change === false) {
@@ -1724,13 +1724,13 @@  discard block
 block discarded – undo
1724 1724
         // Check if user exists
1725 1725
         $userInfo = DB::queryFirstRow(
1726 1726
             'SELECT public_key
1727
-            FROM ' . prefixTable('users') . '
1727
+            FROM ' . prefixTable('users').'
1728 1728
             WHERE id = %i',
1729 1729
             $post_user_id
1730 1730
         );
1731 1731
         if (isset($userInfo['public_key']) === true) {
1732 1732
             // Include libraries
1733
-            include_once $SETTINGS['cpassman_dir'] . '/sources/aes.functions.php';
1733
+            include_once $SETTINGS['cpassman_dir'].'/sources/aes.functions.php';
1734 1734
             $return = [];
1735 1735
 
1736 1736
             // WHAT STEP TO PERFORM?
@@ -1876,15 +1876,15 @@  discard block
 block discarded – undo
1876 1876
     // Loop on items
1877 1877
     $rows = DB::query(
1878 1878
         'SELECT id, pw
1879
-        FROM ' . prefixTable('items') . '
1879
+        FROM ' . prefixTable('items').'
1880 1880
         WHERE perso = 0
1881
-        LIMIT ' . $post_start . ', ' . $post_length
1881
+        LIMIT ' . $post_start.', '.$post_length
1882 1882
     );
1883 1883
     foreach ($rows as $record) {
1884 1884
         // Get itemKey from current user
1885 1885
         $currentUserKey = DB::queryFirstRow(
1886 1886
             'SELECT share_key, increment_id
1887
-            FROM ' . prefixTable('sharekeys_items') . '
1887
+            FROM ' . prefixTable('sharekeys_items').'
1888 1888
             WHERE object_id = %i AND user_id = %i',
1889 1889
             $record['id'],
1890 1890
             $_SESSION['user_id']
@@ -1912,7 +1912,7 @@  discard block
 block discarded – undo
1912 1912
             if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
1913 1913
                 $currentUserKey = DB::queryFirstRow(
1914 1914
                     'SELECT increment_id
1915
-                    FROM ' . prefixTable('sharekeys_items') . '
1915
+                    FROM ' . prefixTable('sharekeys_items').'
1916 1916
                     WHERE object_id = %i AND user_id = %i',
1917 1917
                     $record['id'],
1918 1918
                     $post_user_id
@@ -1945,7 +1945,7 @@  discard block
 block discarded – undo
1945 1945
     // SHould we change step?
1946 1946
     DB::query(
1947 1947
         'SELECT *
1948
-        FROM ' . prefixTable('items') . '
1948
+        FROM ' . prefixTable('items').'
1949 1949
         WHERE perso = 0'
1950 1950
     );
1951 1951
 
@@ -1969,15 +1969,15 @@  discard block
 block discarded – undo
1969 1969
     // Loop on logs
1970 1970
     $rows = DB::query(
1971 1971
         'SELECT increment_id
1972
-        FROM ' . prefixTable('log_items') . '
1972
+        FROM ' . prefixTable('log_items').'
1973 1973
         WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"
1974
-        LIMIT ' . $post_start . ', ' . $post_length
1974
+        LIMIT ' . $post_start.', '.$post_length
1975 1975
     );
1976 1976
     foreach ($rows as $record) {
1977 1977
         // Get itemKey from current user
1978 1978
         $currentUserKey = DB::queryFirstRow(
1979 1979
             'SELECT share_key
1980
-            FROM ' . prefixTable('sharekeys_logs') . '
1980
+            FROM ' . prefixTable('sharekeys_logs').'
1981 1981
             WHERE object_id = %i AND user_id = %i',
1982 1982
             $record['increment_id'],
1983 1983
             $_SESSION['user_id']
@@ -2004,7 +2004,7 @@  discard block
 block discarded – undo
2004 2004
             if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
2005 2005
                 $currentUserKey = DB::queryFirstRow(
2006 2006
                     'SELECT increment_id
2007
-                    FROM ' . prefixTable('sharekeys_items') . '
2007
+                    FROM ' . prefixTable('sharekeys_items').'
2008 2008
                     WHERE object_id = %i AND user_id = %i',
2009 2009
                     $record['id'],
2010 2010
                     $post_user_id
@@ -2026,7 +2026,7 @@  discard block
 block discarded – undo
2026 2026
     // SHould we change step?
2027 2027
     DB::query(
2028 2028
         'SELECT increment_id
2029
-        FROM ' . prefixTable('log_items') . '
2029
+        FROM ' . prefixTable('log_items').'
2030 2030
         WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"'
2031 2031
     );
2032 2032
 
@@ -2050,15 +2050,15 @@  discard block
 block discarded – undo
2050 2050
     // Loop on fields
2051 2051
     $rows = DB::query(
2052 2052
         'SELECT id
2053
-        FROM ' . prefixTable('categories_items') . '
2053
+        FROM ' . prefixTable('categories_items').'
2054 2054
         WHERE encryption_type = "teampass_aes"
2055
-        LIMIT ' . $post_start . ', ' . $post_length
2055
+        LIMIT ' . $post_start.', '.$post_length
2056 2056
     );
2057 2057
     foreach ($rows as $record) {
2058 2058
         // Get itemKey from current user
2059 2059
         $currentUserKey = DB::queryFirstRow(
2060 2060
             'SELECT share_key
2061
-            FROM ' . prefixTable('sharekeys_fields') . '
2061
+            FROM ' . prefixTable('sharekeys_fields').'
2062 2062
             WHERE object_id = %i AND user_id = %i',
2063 2063
             $record['id'],
2064 2064
             $_SESSION['user_id']
@@ -2085,7 +2085,7 @@  discard block
 block discarded – undo
2085 2085
             if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
2086 2086
                 $currentUserKey = DB::queryFirstRow(
2087 2087
                     'SELECT increment_id
2088
-                    FROM ' . prefixTable('sharekeys_items') . '
2088
+                    FROM ' . prefixTable('sharekeys_items').'
2089 2089
                     WHERE object_id = %i AND user_id = %i',
2090 2090
                     $record['id'],
2091 2091
                     $post_user_id
@@ -2107,7 +2107,7 @@  discard block
 block discarded – undo
2107 2107
     // SHould we change step?
2108 2108
     DB::query(
2109 2109
         'SELECT *
2110
-        FROM ' . prefixTable('categories_items') . '
2110
+        FROM ' . prefixTable('categories_items').'
2111 2111
         WHERE encryption_type = "teampass_aes"'
2112 2112
     );
2113 2113
 
@@ -2131,14 +2131,14 @@  discard block
 block discarded – undo
2131 2131
     // Loop on suggestions
2132 2132
     $rows = DB::query(
2133 2133
         'SELECT id
2134
-        FROM ' . prefixTable('suggestion') . '
2135
-        LIMIT ' . $post_start . ', ' . $post_length
2134
+        FROM ' . prefixTable('suggestion').'
2135
+        LIMIT ' . $post_start.', '.$post_length
2136 2136
     );
2137 2137
     foreach ($rows as $record) {
2138 2138
         // Get itemKey from current user
2139 2139
         $currentUserKey = DB::queryFirstRow(
2140 2140
             'SELECT share_key
2141
-            FROM ' . prefixTable('sharekeys_suggestions') . '
2141
+            FROM ' . prefixTable('sharekeys_suggestions').'
2142 2142
             WHERE object_id = %i AND user_id = %i',
2143 2143
             $record['id'],
2144 2144
             $_SESSION['user_id']
@@ -2165,7 +2165,7 @@  discard block
 block discarded – undo
2165 2165
             if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
2166 2166
                 $currentUserKey = DB::queryFirstRow(
2167 2167
                     'SELECT increment_id
2168
-                    FROM ' . prefixTable('sharekeys_items') . '
2168
+                    FROM ' . prefixTable('sharekeys_items').'
2169 2169
                     WHERE object_id = %i AND user_id = %i',
2170 2170
                     $record['id'],
2171 2171
                     $post_user_id
@@ -2210,15 +2210,15 @@  discard block
 block discarded – undo
2210 2210
     // Loop on files
2211 2211
     $rows = DB::query(
2212 2212
         'SELECT id
2213
-        FROM ' . prefixTable('files') . '
2214
-        WHERE status = "' . TP_ENCRYPTION_NAME . '"
2215
-        LIMIT ' . $post_start . ', ' . $post_length
2213
+        FROM ' . prefixTable('files').'
2214
+        WHERE status = "' . TP_ENCRYPTION_NAME.'"
2215
+        LIMIT ' . $post_start.', '.$post_length
2216 2216
     ); //aes_encryption
2217 2217
     foreach ($rows as $record) {
2218 2218
         // Get itemKey from current user
2219 2219
         $currentUserKey = DB::queryFirstRow(
2220 2220
             'SELECT share_key
2221
-            FROM ' . prefixTable('sharekeys_files') . '
2221
+            FROM ' . prefixTable('sharekeys_files').'
2222 2222
             WHERE object_id = %i AND user_id = %i',
2223 2223
             $record['id'],
2224 2224
             $_SESSION['user_id']
@@ -2245,7 +2245,7 @@  discard block
 block discarded – undo
2245 2245
             if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
2246 2246
                 $currentUserKey = DB::queryFirstRow(
2247 2247
                     'SELECT increment_id
2248
-                    FROM ' . prefixTable('sharekeys_items') . '
2248
+                    FROM ' . prefixTable('sharekeys_items').'
2249 2249
                     WHERE object_id = %i AND user_id = %i',
2250 2250
                     $record['id'],
2251 2251
                     $post_user_id
@@ -2267,8 +2267,8 @@  discard block
 block discarded – undo
2267 2267
     // SHould we change step?
2268 2268
     DB::query(
2269 2269
         'SELECT *
2270
-        FROM ' . prefixTable('files') . '
2271
-        WHERE status = "' . TP_ENCRYPTION_NAME . '"'
2270
+        FROM ' . prefixTable('files').'
2271
+        WHERE status = "' . TP_ENCRYPTION_NAME.'"'
2272 2272
     );
2273 2273
 
2274 2274
     $next_start = (int) $post_start + (int) $post_length;
@@ -2300,16 +2300,16 @@  discard block
 block discarded – undo
2300 2300
     if (count($_SESSION['personal_folders']) > 0) {
2301 2301
         $rows = DB::query(
2302 2302
             'SELECT id, pw
2303
-            FROM ' . prefixTable('items') . '
2303
+            FROM ' . prefixTable('items').'
2304 2304
             WHERE perso = 1 AND id_tree IN %ls
2305
-            LIMIT ' . $post_start . ', ' . $post_length,
2305
+            LIMIT ' . $post_start.', '.$post_length,
2306 2306
             $_SESSION['personal_folders']
2307 2307
         );
2308 2308
         foreach ($rows as $record) {
2309 2309
             // Get itemKey from current user
2310 2310
             $currentUserKey = DB::queryFirstRow(
2311 2311
                 'SELECT share_key, increment_id
2312
-                FROM ' . prefixTable('sharekeys_items') . '
2312
+                FROM ' . prefixTable('sharekeys_items').'
2313 2313
                 WHERE object_id = %i AND user_id = %i',
2314 2314
                 $record['id'],
2315 2315
                 $_SESSION['user_id']
@@ -2336,7 +2336,7 @@  discard block
 block discarded – undo
2336 2336
                 if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
2337 2337
                     $currentUserKey = DB::queryFirstRow(
2338 2338
                         'SELECT increment_id
2339
-                        FROM ' . prefixTable('sharekeys_items') . '
2339
+                        FROM ' . prefixTable('sharekeys_items').'
2340 2340
                         WHERE object_id = %i AND user_id = %i',
2341 2341
                         $record['id'],
2342 2342
                         $post_user_id
@@ -2359,7 +2359,7 @@  discard block
 block discarded – undo
2359 2359
     // SHould we change step?
2360 2360
     DB::query(
2361 2361
         'SELECT *
2362
-        FROM ' . prefixTable('items') . '
2362
+        FROM ' . prefixTable('items').'
2363 2363
         WHERE perso = 0'
2364 2364
     );
2365 2365
 
@@ -2383,7 +2383,7 @@  discard block
 block discarded – undo
2383 2383
         // Check if user exists
2384 2384
         $userInfo = DB::queryFirstRow(
2385 2385
             'SELECT public_key, encrypted_psk
2386
-            FROM ' . prefixTable('users') . '
2386
+            FROM ' . prefixTable('users').'
2387 2387
             WHERE id = %i',
2388 2388
             $post_user_id
2389 2389
         );
@@ -2409,9 +2409,9 @@  discard block
 block discarded – undo
2409 2409
                 // Loop on persoanl items
2410 2410
                 $rows = DB::query(
2411 2411
                     'SELECT id, pw
2412
-                    FROM ' . prefixTable('items') . '
2412
+                    FROM ' . prefixTable('items').'
2413 2413
                     WHERE perso = 1 AND id_tree IN %ls
2414
-                    LIMIT ' . $post_start . ', ' . $post_length,
2414
+                    LIMIT ' . $post_start.', '.$post_length,
2415 2415
                     $_SESSION['personal_folders']
2416 2416
                 );
2417 2417
                 $countUserPersonalItems = DB::count();
@@ -2454,7 +2454,7 @@  discard block
 block discarded – undo
2454 2454
                         // Loop on files
2455 2455
                         $rows = DB::query(
2456 2456
                             'SELECT id, file
2457
-                            FROM ' . prefixTable('files') . '
2457
+                            FROM ' . prefixTable('files').'
2458 2458
                             WHERE status != %s
2459 2459
                             AND id_item = %i',
2460 2460
                             TP_ENCRYPTION_NAME,
@@ -2465,14 +2465,14 @@  discard block
 block discarded – undo
2465 2465
                             // Now decrypt the file
2466 2466
                             prepareFileWithDefuse(
2467 2467
                                 'decrypt',
2468
-                                $SETTINGS['path_to_upload_folder'] . '/' . $record2['file'],
2469
-                                $SETTINGS['path_to_upload_folder'] . '/' . $record2['file'] . '.delete',
2468
+                                $SETTINGS['path_to_upload_folder'].'/'.$record2['file'],
2469
+                                $SETTINGS['path_to_upload_folder'].'/'.$record2['file'].'.delete',
2470 2470
                                 $SETTINGS,
2471 2471
                                 $post_user_psk
2472 2472
                             );
2473 2473
 
2474 2474
                             // Encrypt the file
2475
-                            $encryptedFile = encryptFile($record2['file'] . '.delete', $SETTINGS['path_to_upload_folder']);
2475
+                            $encryptedFile = encryptFile($record2['file'].'.delete', $SETTINGS['path_to_upload_folder']);
2476 2476
 
2477 2477
                             DB::update(
2478 2478
                                 prefixTable('files'),
@@ -2495,7 +2495,7 @@  discard block
 block discarded – undo
2495 2495
                             );
2496 2496
 
2497 2497
                             // Unlink original file
2498
-                            unlink($SETTINGS['path_to_upload_folder'] . '/' . $record2['file']);
2498
+                            unlink($SETTINGS['path_to_upload_folder'].'/'.$record2['file']);
2499 2499
                         }
2500 2500
                     }
2501 2501
                 }
@@ -2567,7 +2567,7 @@  discard block
 block discarded – undo
2567 2567
         // Get user info
2568 2568
         $userData = DB::queryFirstRow(
2569 2569
             'SELECT '.$post_fields.'
2570
-            FROM ' . prefixTable('users') . '
2570
+            FROM ' . prefixTable('users').'
2571 2571
             WHERE id = %i',
2572 2572
             $post_user_id
2573 2573
         );
@@ -2613,7 +2613,7 @@  discard block
 block discarded – undo
2613 2613
         // Get user info
2614 2614
         $userData = DB::queryFirstRow(
2615 2615
             'SELECT auth_type, login, private_key
2616
-            FROM ' . prefixTable('users') . '
2616
+            FROM ' . prefixTable('users').'
2617 2617
             WHERE id = %i',
2618 2618
             $post_user_id
2619 2619
         );
@@ -2635,7 +2635,7 @@  discard block
 block discarded – undo
2635 2635
             }
2636 2636
 
2637 2637
             // Load superGlobals
2638
-            include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2638
+            include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2639 2639
             $superGlobal = new protect\SuperGlobal\SuperGlobal();
2640 2640
 
2641 2641
             if ($superGlobal->get('private_key', 'SESSION', 'user') === $privateKey) {
@@ -2669,7 +2669,7 @@  discard block
 block discarded – undo
2669 2669
                     $SETTINGS['cpassman_dir'],
2670 2670
                     array(
2671 2671
                         'error' => false,
2672
-                        'message' => langHdl('done'),'',
2672
+                        'message' => langHdl('done'), '',
2673 2673
                     ),
2674 2674
                     'encode'
2675 2675
                 );
@@ -2709,7 +2709,7 @@  discard block
 block discarded – undo
2709 2709
         // Get user info
2710 2710
         $userData = DB::queryFirstRow(
2711 2711
             'SELECT auth_type, login, private_key, special
2712
-            FROM ' . prefixTable('users') . '
2712
+            FROM ' . prefixTable('users').'
2713 2713
             WHERE id = %i',
2714 2714
             $post_user_id
2715 2715
         );
@@ -2739,7 +2739,7 @@  discard block
 block discarded – undo
2739 2739
                 );
2740 2740
 
2741 2741
                 // Load superGlobals
2742
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2742
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2743 2743
                 $superGlobal = new protect\SuperGlobal\SuperGlobal();
2744 2744
                 $superGlobal->put('private_key', $privateKey, 'SESSION', 'user');
2745 2745
 
@@ -2747,7 +2747,7 @@  discard block
 block discarded – undo
2747 2747
                     $SETTINGS['cpassman_dir'],
2748 2748
                     array(
2749 2749
                         'error' => false,
2750
-                        'message' => langHdl('done'),'',
2750
+                        'message' => langHdl('done'), '',
2751 2751
                     ),
2752 2752
                     'encode'
2753 2753
                 );
@@ -2772,14 +2772,14 @@  discard block
 block discarded – undo
2772 2772
             // Get one item
2773 2773
             $record = DB::queryFirstRow(
2774 2774
                 'SELECT id, pw
2775
-                FROM ' . prefixTable('items') . '
2775
+                FROM ' . prefixTable('items').'
2776 2776
                 WHERE perso = 0'
2777 2777
             );
2778 2778
 
2779 2779
             // Get itemKey from current user
2780 2780
             $currentUserKey = DB::queryFirstRow(
2781 2781
                 'SELECT share_key, increment_id
2782
-                FROM ' . prefixTable('sharekeys_items') . '
2782
+                FROM ' . prefixTable('sharekeys_items').'
2783 2783
                 WHERE object_id = %i AND user_id = %i',
2784 2784
                 $record['id'],
2785 2785
                 $post_user_id
@@ -2807,7 +2807,7 @@  discard block
 block discarded – undo
2807 2807
                     );
2808 2808
                     
2809 2809
                     // Load superGlobals
2810
-                    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2810
+                    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2811 2811
                     $superGlobal = new protect\SuperGlobal\SuperGlobal();
2812 2812
                     $superGlobal->put('private_key', $privateKey, 'SESSION', 'user');
2813 2813
 
@@ -2864,7 +2864,7 @@  discard block
 block discarded – undo
2864 2864
             $_SESSION['user_id']
2865 2865
         );
2866 2866
         // Return data
2867
-        return '[{"new_value":"' . $_SESSION['sessionDuration'] . '"}]';
2867
+        return '[{"new_value":"'.$_SESSION['sessionDuration'].'"}]';
2868 2868
     }
2869 2869
     
2870 2870
     return '[{"new_value":"expired"}]';
Please login to merge, or discard this patch.