Passed
Branch — teampass_3.0 (974317)
by Nils
10:43
created
sources/export.queries.php 1 patch
Spacing   +78 added lines, -78 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
 }
@@ -81,12 +81,12 @@  discard block
 block discarded – undo
81 81
 DB::$encoding = DB_ENCODING;
82 82
 
83 83
 // Build tree
84
-$tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
84
+$tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
85 85
 $tree->register();
86
-$tree = new Tree\NestedTree\NestedTree($pre . 'nested_tree', 'id', 'parent_id', 'title');
86
+$tree = new Tree\NestedTree\NestedTree($pre.'nested_tree', 'id', 'parent_id', 'title');
87 87
 
88 88
 // User's language loading
89
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
89
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
90 90
 
91 91
 // Prepare POST variables
92 92
 $id = filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT);
@@ -137,9 +137,9 @@  discard block
 block discarded – undo
137 137
                         'SELECT i.id as id, i.id_tree as id_tree, i.restricted_to as restricted_to, i.perso as perso,
138 138
                             i.label as label, i.description as description, i.pw as pw, i.login as login, i.url as url,
139 139
                             i.email as email,l.date as date, i.pw_iv as pw_iv,n.renewal_period as renewal_period
140
-                        FROM ' . prefixTable('items') . ' as i
141
-                        INNER JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree = n.id)
142
-                        INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id = l.id_item)
140
+                        FROM ' . prefixTable('items').' as i
141
+                        INNER JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree = n.id)
142
+                        INNER JOIN ' . prefixTable('log_items').' as l ON (i.id = l.id_item)
143 143
                         WHERE i.inactif = %i
144 144
                         AND i.id_tree= %i
145 145
                         AND (l.action = %s OR (l.action = %s AND l.raison LIKE %s))
@@ -162,8 +162,8 @@  discard block
 block discarded – undo
162 162
                                 // Run query
163 163
                                 $dataItem = DB::queryfirstrow(
164 164
                                     'SELECT i.pw AS pw, s.share_key AS share_key
165
-                                    FROM ' . prefixTable('items') . ' AS i
166
-                                    INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (s.object_id = i.id)
165
+                                    FROM ' . prefixTable('items').' AS i
166
+                                    INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (s.object_id = i.id)
167 167
                                     WHERE user_id = %i AND i.id = %i',
168 168
                                     $_SESSION['user_id'],
169 169
                                     $record['id']
@@ -187,8 +187,8 @@  discard block
 block discarded – undo
187 187
                                 $arr_kbs = [];
188 188
                                 $rows_kb = DB::query(
189 189
                                     'SELECT b.label, b.id
190
-                                    FROM ' . prefixTable('kb_items') . ' AS a
191
-                                    INNER JOIN ' . prefixTable('kb') . ' AS b ON (a.kb_id = b.id)
190
+                                    FROM ' . prefixTable('kb_items').' AS a
191
+                                    INNER JOIN ' . prefixTable('kb').' AS b ON (a.kb_id = b.id)
192 192
                                     WHERE a.item_id = %i',
193 193
                                     $record['id']
194 194
                                 );
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
                                 $arr_tags = [];
201 201
                                 $rows_tag = DB::query(
202 202
                                     'SELECT tag
203
-                                    FROM ' . prefixTable('tags') . '
203
+                                    FROM ' . prefixTable('tags').'
204 204
                                     WHERE item_id = %i',
205 205
                                     $record['id']
206 206
                                 );
@@ -247,14 +247,14 @@  discard block
 block discarded – undo
247 247
                 $tmp .= array2csv($value);
248 248
             }
249 249
 
250
-            echo '[{"content":"' . base64_encode($tmp) . '"}]';
250
+            echo '[{"content":"'.base64_encode($tmp).'"}]';
251 251
             break;
252 252
 
253 253
             /*
254 254
          * PDF - step 1 - Prepare database
255 255
          */
256 256
         case 'initialize_export_table':
257
-            DB::query('TRUNCATE TABLE ' . prefixTable('export'));
257
+            DB::query('TRUNCATE TABLE '.prefixTable('export'));
258 258
             break;
259 259
 
260 260
             /*
@@ -298,9 +298,9 @@  discard block
 block discarded – undo
298 298
                     '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,
299 299
                         l.date as date, i.pw_iv as pw_iv,
300 300
                         n.renewal_period as renewal_period
301
-                        FROM ' . prefixTable('items') . ' as i
302
-                        INNER JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree = n.id)
303
-                        INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id = l.id_item)
301
+                        FROM ' . prefixTable('items').' as i
302
+                        INNER JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree = n.id)
303
+                        INNER JOIN ' . prefixTable('log_items').' as l ON (i.id = l.id_item)
304 304
                         WHERE i.inactif = %i
305 305
                         AND i.id_tree= %i
306 306
                         AND (l.action = %s OR (l.action = %s AND l.raison LIKE %s))
@@ -326,8 +326,8 @@  discard block
 block discarded – undo
326 326
                             // Run query
327 327
                             $dataItem = DB::queryfirstrow(
328 328
                                 'SELECT i.pw AS pw, s.share_key AS share_key
329
-                                FROM ' . prefixTable('items') . ' AS i
330
-                                INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (s.object_id = i.id)
329
+                                FROM ' . prefixTable('items').' AS i
330
+                                INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (s.object_id = i.id)
331 331
                                 WHERE user_id = %i AND i.id = %i',
332 332
                                 $_SESSION['user_id'],
333 333
                                 $record['id']
@@ -351,8 +351,8 @@  discard block
 block discarded – undo
351 351
                             $arr_kbs = '';
352 352
                             $rows_kb = DB::query(
353 353
                                 'SELECT b.label, b.id
354
-                                FROM ' . prefixTable('kb_items') . ' AS a
355
-                                INNER JOIN ' . prefixTable('kb') . ' AS b ON (a.kb_id = b.id)
354
+                                FROM ' . prefixTable('kb_items').' AS a
355
+                                INNER JOIN ' . prefixTable('kb').' AS b ON (a.kb_id = b.id)
356 356
                                 WHERE a.item_id = %i',
357 357
                                 $record['id']
358 358
                             );
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
                                 if (empty($arr_kbs)) {
361 361
                                     $arr_kbs = $rec_kb['label'];
362 362
                                 } else {
363
-                                    $arr_kbs .= ' | ' . $rec_kb['label'];
363
+                                    $arr_kbs .= ' | '.$rec_kb['label'];
364 364
                                 }
365 365
                             }
366 366
 
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
                             $arr_tags = '';
369 369
                             $rows_tag = DB::query(
370 370
                                 'SELECT tag
371
-                                FROM ' . prefixTable('tags') . '
371
+                                FROM ' . prefixTable('tags').'
372 372
                                 WHERE item_id = %i',
373 373
                                 $record['id']
374 374
                             );
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
                                 if (empty($arr_tags)) {
377 377
                                     $arr_tags = $rec_tag['tag'];
378 378
                                 } else {
379
-                                    $arr_tags .= ' ' . $rec_tag['tag'];
379
+                                    $arr_tags .= ' '.$rec_tag['tag'];
380 380
                                 }
381 381
                             }
382 382
 
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
             header('Content-type: application/pdf');
445 445
 
446 446
             // query
447
-            $rows = DB::query('SELECT * FROM ' . prefixTable('export'));
447
+            $rows = DB::query('SELECT * FROM '.prefixTable('export'));
448 448
             $counter = DB::count();
449 449
             if ($counter > 0) {
450 450
                 // print
@@ -452,8 +452,8 @@  discard block
 block discarded – undo
452 452
                 $prev_path = '';
453 453
 
454 454
                 //Prepare the PDF file
455
-                require_once($SETTINGS['cpassman_dir'] . '/includes/libraries/Pdf/tcpdf/config/tcpdf_config.php');
456
-                include $SETTINGS['cpassman_dir'] . '/includes/libraries/Pdf/tcpdf/tcpdf.php';
455
+                require_once($SETTINGS['cpassman_dir'].'/includes/libraries/Pdf/tcpdf/config/tcpdf_config.php');
456
+                include $SETTINGS['cpassman_dir'].'/includes/libraries/Pdf/tcpdf/tcpdf.php';
457 457
 
458 458
                 $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
459 459
                 $pdf->SetProtection(array('print'), $dataReceived['pdf_password'], null);
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 
466 466
                 // set default header data
467 467
                 $pdf->SetHeaderData(
468
-                    $SETTINGS['cpassman_dir'] . '/includes/images/teampass-logo2-home.png',
468
+                    $SETTINGS['cpassman_dir'].'/includes/images/teampass-logo2-home.png',
469 469
                     PDF_HEADER_LOGO_WIDTH,
470 470
                     'Teampass export',
471 471
                     $_SESSION['lastname']." ".$_SESSION['name'].' @ '.date($SETTINGS['date_format']." ".$SETTINGS['time_format'], (int) time())
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
                 logEvents($SETTINGS, 'pdf_export', '', (string) $_SESSION['user_id'], $_SESSION['login']);
570 570
 
571 571
                 //clean table
572
-                DB::query('TRUNCATE TABLE ' . prefixTable('export'));
572
+                DB::query('TRUNCATE TABLE '.prefixTable('export'));
573 573
 
574 574
                 // Send back the file in Blob
575 575
                 echo $pdf->Output(null, 'I');
@@ -581,8 +581,8 @@  discard block
 block discarded – undo
581 581
             // step 1:
582 582
             // - prepare export file
583 583
             // - get full list of objects id to export
584
-            include $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
585
-            include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/GibberishAES/GibberishAES.php';
584
+            include $SETTINGS['cpassman_dir'].'/includes/config/include.php';
585
+            include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/GibberishAES/GibberishAES.php';
586 586
             $idsList = array();
587 587
 
588 588
             foreach (explode(';', $post_ids) as $id) {
@@ -594,9 +594,9 @@  discard block
 block discarded – undo
594 594
                     // count elements to display
595 595
                     $result = DB::query(
596 596
                         'SELECT i.id AS id, i.label AS label, i.restricted_to AS restricted_to, i.perso AS perso
597
-                    FROM ' . prefixTable('items') . ' as i
598
-                    INNER JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree = n.id)
599
-                    INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id = l.id_item)
597
+                    FROM ' . prefixTable('items').' as i
598
+                    INNER JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree = n.id)
599
+                    INNER JOIN ' . prefixTable('log_items').' as l ON (i.id = l.id_item)
600 600
                     WHERE i.inactif = %i
601 601
                     AND i.id_tree= %i
602 602
                     AND (l.action = %s OR (l.action = %s AND l.raison LIKE %s))
@@ -624,9 +624,9 @@  discard block
 block discarded – undo
624 624
 
625 625
             // prepare export file
626 626
             //save the file
627
-            $html_file = '/teampass_export_' . time() . '_' . generateKey() . '.html';
627
+            $html_file = '/teampass_export_'.time().'_'.generateKey().'.html';
628 628
             //print_r($full_listing);
629
-            $outstream = fopen($SETTINGS['path_to_files_folder'] . $html_file, 'w');
629
+            $outstream = fopen($SETTINGS['path_to_files_folder'].$html_file, 'w');
630 630
             if ($outstream === false) {
631 631
                 echo '[{"error":"true"}]';
632 632
                 break;
@@ -650,12 +650,12 @@  discard block
 block discarded – undo
650 650
     </style>
651 651
     </head>
652 652
     <body>
653
-    <input type="hidden" id="generation_date" value="' . GibberishAES::enc(/** @scrutinizer ignore-type */ (string) time(), $post_pdf_password) . '" />
653
+    <input type="hidden" id="generation_date" value="' . GibberishAES::enc(/** @scrutinizer ignore-type */ (string) time(), $post_pdf_password).'" />
654 654
     <div id="header">
655
-    ' . TP_TOOL_NAME . ' - Off Line mode
655
+    ' . TP_TOOL_NAME.' - Off Line mode
656 656
     </div>
657 657
     <div style="margin:10px; font-size:9px;">
658
-    <i>This page was generated by <b>' . $_SESSION['name'] . ' ' . $_SESSION['lastname'] . '</b>, the ' . date('Y/m/d H:i:s') . '.</i>
658
+    <i>This page was generated by <b>' . $_SESSION['name'].' '.$_SESSION['lastname'].'</b>, the '.date('Y/m/d H:i:s').'.</i>
659 659
     <span id="info_page" style="margin-left:20px; font-weight:bold; font-size: 14px; color:red;"></span>
660 660
     </div>
661 661
     <div id="information"></div>
@@ -666,11 +666,11 @@  discard block
 block discarded – undo
666 666
     <div>
667 667
     <table id="itemsTable">
668 668
         <thead><tr>
669
-            <th style="width:15%;">' . $LANG['label'] . '</th>
670
-            <th style="width:10%;">' . $LANG['pw'] . '</th>
671
-            <th style="width:30%;">' . $LANG['description'] . '</th>
672
-            <th style="width:5%;">' . $LANG['user_login'] . '</th>
673
-            <th style="width:20%;">' . $LANG['url'] . '</th>
669
+            <th style="width:15%;">' . $LANG['label'].'</th>
670
+            <th style="width:10%;">' . $LANG['pw'].'</th>
671
+            <th style="width:30%;">' . $LANG['description'].'</th>
672
+            <th style="width:5%;">' . $LANG['user_login'].'</th>
673
+            <th style="width:20%;">' . $LANG['url'].'</th>
674 674
         </tr></thead>
675 675
         <tbody id="itemsTable_tbody">'
676 676
             );
@@ -695,22 +695,22 @@  discard block
 block discarded – undo
695 695
                 || in_array($post_idTree, $_SESSION['groupes_visibles']) === false
696 696
                 || (in_array($post_idTree, $_SESSION['no_access_folders']) === true)
697 697
             ) {
698
-                echo '[{"loop":"true", "number":"' . $post_number . '", "cpt":"' . $post_cpt . '", "file":"' . $post_file . '", "idsList":"' . $post_idsList . '" , "file_link":"' . $post_file_link . '"}]';
698
+                echo '[{"loop":"true", "number":"'.$post_number.'", "cpt":"'.$post_cpt.'", "file":"'.$post_file.'", "idsList":"'.$post_idsList.'" , "file_link":"'.$post_file_link.'"}]';
699 699
                 break;
700 700
             }
701 701
 
702 702
             $full_listing = array();
703 703
             $items_id_list = array();
704
-            include $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
705
-            include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/GibberishAES/GibberishAES.php';
704
+            include $SETTINGS['cpassman_dir'].'/includes/config/include.php';
705
+            include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/GibberishAES/GibberishAES.php';
706 706
 
707 707
             $rows = DB::query(
708 708
                 '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,
709 709
                 l.date as date, i.pw_iv as pw_iv,
710 710
                 n.renewal_period as renewal_period
711
-            FROM ' . prefixTable('items') . ' as i
712
-            INNER JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree = n.id)
713
-            INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id = l.id_item)
711
+            FROM ' . prefixTable('items').' as i
712
+            INNER JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree = n.id)
713
+            INNER JOIN ' . prefixTable('log_items').' as l ON (i.id = l.id_item)
714 714
             WHERE i.inactif = %i
715 715
             AND i.id_tree= %i
716 716
             AND (l.action = %s OR (l.action = %s AND l.raison LIKE %s))
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
             }
771 771
 
772 772
             //save in export file
773
-            $outstream = fopen($post_file . '.txt', 'a');
773
+            $outstream = fopen($post_file.'.txt', 'a');
774 774
             if ($outstream === false) {
775 775
                 echo '[{"error":"true"}]';
776 776
                 break;
@@ -808,13 +808,13 @@  discard block
 block discarded – undo
808 808
                         if (empty($arboHtml)) {
809 809
                             $arboHtml = $arboHtml_tmp;
810 810
                         } else {
811
-                            $arboHtml .= ' » ' . $arboHtml_tmp;
811
+                            $arboHtml .= ' » '.$arboHtml_tmp;
812 812
                         }
813 813
                     }
814 814
                     fputs(
815 815
                         $outstream,
816 816
                         '
817
-        <tr class="path"><td colspan="5">' . $arboHtml . '</td></tr>'
817
+        <tr class="path"><td colspan="5">' . $arboHtml.'</td></tr>'
818 818
                     );
819 819
                     $idTree = $elem['id_tree'];
820 820
                 }
@@ -823,12 +823,12 @@  discard block
 block discarded – undo
823 823
                 fputs(
824 824
                     $outstream,
825 825
                     '
826
-        <tr class="' . $lineType . '">
827
-            <td>' . addslashes($elem['label']) . '</td>
828
-            <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>
829
-            <td>' . $desc . '</td>
830
-            <td align="center">' . $login . '</td>
831
-            <td align="center">' . $url . '</td>
826
+        <tr class="' . $lineType.'">
827
+            <td>' . addslashes($elem['label']).'</td>
828
+            <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>
829
+            <td>' . $desc.'</td>
830
+            <td align="center">' . $login.'</td>
831
+            <td align="center">' . $url.'</td>
832 832
             </tr>'
833 833
                 );
834 834
             }
@@ -836,29 +836,29 @@  discard block
 block discarded – undo
836 836
             fclose($outstream);
837 837
 
838 838
             // send back and continue
839
-            echo '[{"loop":"true", "number":"' . $post_number . '", "cpt":"' . $post_cpt . '", "file":"' . $post_file . '", "idsList":"' . $post_idsList . '" , "file_link":"' . $post_file_link . '"}]';
839
+            echo '[{"loop":"true", "number":"'.$post_number.'", "cpt":"'.$post_cpt.'", "file":"'.$post_file.'", "idsList":"'.$post_idsList.'" , "file_link":"'.$post_file_link.'"}]';
840 840
             break;
841 841
 
842 842
             //CASE export in HTML format - Iteration loop
843 843
         case 'export_to_html_format_finalize':
844 844
             // Load includes
845
-            include $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
846
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/GibberishAES/GibberishAES.php';
845
+            include $SETTINGS['cpassman_dir'].'/includes/config/include.php';
846
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/GibberishAES/GibberishAES.php';
847 847
 
848 848
             // read the content of the temporary file
849
-            $handle = fopen($post_file . '.txt', 'r');
849
+            $handle = fopen($post_file.'.txt', 'r');
850 850
             if ($handle === false) {
851 851
                 echo '[{"error":"true"}]';
852 852
                 break;
853 853
             }
854
-            $contents = fread($handle, filesize($post_file . '.txt'));
854
+            $contents = fread($handle, filesize($post_file.'.txt'));
855 855
             if ($contents === false) {
856 856
                 echo '[{"error":"true"}]';
857 857
                 break;
858 858
             }
859 859
             fclose($handle);
860
-            if (is_file($post_file . '.txt')) {
861
-                unlink($post_file . '.txt');
860
+            if (is_file($post_file.'.txt')) {
861
+                unlink($post_file.'.txt');
862 862
             }
863 863
 
864 864
             // Encrypt its content
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
869 869
                 if (empty($encrypted_text) === true) {
870 870
                     $encrypted_text = GibberishAES::enc(/** @scrutinizer ignore-type */ $chunk, $post_pdf_password);
871 871
                 } else {
872
-                    $encrypted_text .= '|#|#|' . GibberishAES::enc(/** @scrutinizer ignore-type */ $chunk, $post_pdf_password);
872
+                    $encrypted_text .= '|#|#|'.GibberishAES::enc(/** @scrutinizer ignore-type */ $chunk, $post_pdf_password);
873 873
                 }
874 874
             }
875 875
 
@@ -886,9 +886,9 @@  discard block
 block discarded – undo
886 886
         </table></div>
887 887
         <input type="button" value="Hide all" onclick="hideAll()" />
888 888
         <div id="footer" style="text-align:center;">
889
-            <a href="https://teampass.net/about/" target="_blank" style="">' . TP_TOOL_NAME . '&nbsp;' . TP_VERSION_FULL . '&nbsp;' . TP_COPYRIGHT . '</a>
889
+            <a href="https://teampass.net/about/" target="_blank" style="">' . TP_TOOL_NAME.'&nbsp;'.TP_VERSION_FULL.'&nbsp;'.TP_COPYRIGHT.'</a>
890 890
         </div>
891
-        <div id="enc_html" style="display:none;">' . $encrypted_text . '</div>
891
+        <div id="enc_html" style="display:none;">' . $encrypted_text.'</div>
892 892
         </body>
893 893
     </html>
894 894
     <script type="text/javascript">
@@ -994,9 +994,9 @@  discard block
 block discarded – undo
994 994
 
995 995
             fclose($outstream);
996 996
 
997
-            echo '[{"text":"<a href=\'' .
998
-                $post_file_link .
999
-                '\' target=\'_blank\'>' . $LANG['pdf_download'] . '</a>"}]';
997
+            echo '[{"text":"<a href=\''.
998
+                $post_file_link.
999
+                '\' target=\'_blank\'>'.$LANG['pdf_download'].'</a>"}]';
1000 1000
             break;
1001 1001
     }
1002 1002
 }
Please login to merge, or discard this patch.
index.php 1 patch
Spacing   +82 added lines, -82 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) {
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 DB::$port = DB_PORT;
109 109
 DB::$encoding = DB_ENCODING;
110 110
 // Load Core library
111
-require_once $SETTINGS['cpassman_dir'] . '/sources/core.php';
111
+require_once $SETTINGS['cpassman_dir'].'/sources/core.php';
112 112
 // Prepare POST variables
113 113
 $post_language = filter_input(INPUT_POST, 'language', FILTER_SANITIZE_STRING);
114 114
 // Prepare superGlobal variables
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
     // case of user has change language in the login page
139 139
     $dataLanguage = DB::queryFirstRow(
140 140
         'SELECT flag, name
141
-        FROM ' . prefixTable('languages') . '
141
+        FROM ' . prefixTable('languages').'
142 142
         WHERE name = %s',
143 143
         $get['language']
144 144
     );
@@ -148,8 +148,8 @@  discard block
 block discarded – undo
148 148
     //get default language
149 149
     $dataLanguage = DB::queryFirstRow(
150 150
         'SELECT m.valeur AS valeur, l.flag AS flag
151
-        FROM ' . prefixTable('misc') . ' AS m
152
-        INNER JOIN ' . prefixTable('languages') . ' AS l ON (m.valeur = l.name)
151
+        FROM ' . prefixTable('misc').' AS m
152
+        INNER JOIN ' . prefixTable('languages').' AS l ON (m.valeur = l.name)
153 153
         WHERE m.type=%s_type AND m.intitule=%s_intitule',
154 154
         [
155 155
             'type' => 'admin',
@@ -191,23 +191,23 @@  discard block
 block discarded – undo
191 191
 
192 192
 // Load user languages files
193 193
 if (in_array($session_user_language, $languagesList) === true) {
194
-    if (file_exists($SETTINGS['cpassman_dir'] . '/includes/language/' . $session_user_language . '.php') === true) {
195
-        $_SESSION['teampass']['lang'] = include $SETTINGS['cpassman_dir'] . '/includes/language/' . $session_user_language . '.php';
194
+    if (file_exists($SETTINGS['cpassman_dir'].'/includes/language/'.$session_user_language.'.php') === true) {
195
+        $_SESSION['teampass']['lang'] = include $SETTINGS['cpassman_dir'].'/includes/language/'.$session_user_language.'.php';
196 196
     }
197 197
 } else {
198 198
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
199 199
     //not allowed page
200
-    include $SETTINGS['cpassman_dir'] . '/error.php';
200
+    include $SETTINGS['cpassman_dir'].'/error.php';
201 201
 }
202 202
 
203 203
 // load 2FA Google
204 204
 if (isset($SETTINGS['google_authentication']) === true && $SETTINGS['google_authentication'] === '1') {
205
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php';
205
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php';
206 206
 }
207 207
 
208 208
 // load 2FA Yubico
209 209
 if (isset($SETTINGS['yubico_authentication']) === true && $SETTINGS['yubico_authentication'] === '1') {
210
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/Yubico/Yubico.php';
210
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/Yubico/Yubico.php';
211 211
 }
212 212
 
213 213
 // Some template adjust
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
     <!-- Toastr -->
265 265
     <link rel="stylesheet" href="plugins/toastr/toastr.min.css" />
266 266
     <!-- favicon -->
267
-    <link rel="shortcut icon" type="image/png" href="<?php echo $SETTINGS['favicon'];?>"/>
267
+    <link rel="shortcut icon" type="image/png" href="<?php echo $SETTINGS['favicon']; ?>"/>
268 268
 </head>
269 269
 
270 270
 
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
             ),
296 296
             'SESSION'
297 297
         );
298
-        include $SETTINGS['cpassman_dir'] . '/error.php';
298
+        include $SETTINGS['cpassman_dir'].'/error.php';
299 299
     }
300 300
 } elseif (
301 301
     $session_validite_pw !== null
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
                         <div class="dropdown show">
340 340
                             <a class="btn btn-primary dropdown-toggle" href="#" data-toggle="dropdown">
341 341
                                 <?php
342
-                                    echo $session_name . '&nbsp;' . $session_lastname; ?>
342
+                                    echo $session_name.'&nbsp;'.$session_lastname; ?>
343 343
                             </a>
344 344
 
345 345
                             <div class="dropdown-menu dropdown-menu-right">
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
             <!-- Main Sidebar Container -->
378 378
             <aside class="main-sidebar sidebar-dark-primary elevation-4">
379 379
                 <!-- Brand Logo -->
380
-                <a href="<?php echo $SETTINGS['cpassman_url'] . '/index.php?page=items'; ?>" class="brand-link">
380
+                <a href="<?php echo $SETTINGS['cpassman_url'].'/index.php?page=items'; ?>" class="brand-link">
381 381
                     <img src="includes/images/teampass-logo2-home.png" alt="Teampass Logo" class="brand-image">
382 382
                     <span class="brand-text font-weight-light"><?php echo TP_TOOL_NAME; ?></span>
383 383
                 </a>
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
                         <a href="#" data-name="items" class="nav-link', $get['page'] === 'items' ? ' active' : '', '">
396 396
                         <i class="nav-icon fas fa-key"></i>
397 397
                         <p>
398
-                            ' . langHdl('pw') . '
398
+                            ' . langHdl('pw').'
399 399
                         </p>
400 400
                         </a>
401 401
                     </li>';
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
                         <a href="#" data-name="import" class="nav-link', $get['page'] === 'import' ? ' active' : '', '">
412 412
                         <i class="nav-icon fas fa-file-import"></i>
413 413
                         <p>
414
-                            ' . langHdl('import') . '
414
+                            ' . langHdl('import').'
415 415
                         </p>
416 416
                         </a>
417 417
                     </li>';
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
                         <a href="#" data-name="export" class="nav-link', $get['page'] === 'export' ? ' active' : '', '">
433 433
                         <i class="nav-icon fas fa-file-export"></i>
434 434
                         <p>
435
-                            ' . langHdl('export') . '
435
+                            ' . langHdl('export').'
436 436
                         </p>
437 437
                         </a>
438 438
                     </li>';
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
                         <a href="#" data-name="search" class="nav-link', $get['page'] === 'search' ? ' active' : '', '">
460 460
                         <i class="nav-icon fas fa-search"></i>
461 461
                         <p>
462
-                            ' . langHdl('find') . '
462
+                            ' . langHdl('find').'
463 463
                         </p>
464 464
                         </a>
465 465
                     </li>';
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
                         <a href="#" data-name="favourites" class="nav-link', $get['page'] === 'admin' ? ' favourites' : '', '">
477 477
                         <i class="nav-icon fas fa-star"></i>
478 478
                         <p>
479
-                            ' . langHdl('favorites') . '
479
+                            ' . langHdl('favorites').'
480 480
                         </p>
481 481
                         </a>
482 482
                     </li>';
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
                         <a href="#" data-name="suggestion" class="nav-link', $get['page'] === 'suggestion' ? ' active' : '', '">
507 507
                         <i class="nav-icon fas fa-lightbulb"></i>
508 508
                         <p>
509
-                            ' . langHdl('suggestion_menu') . '
509
+                            ' . langHdl('suggestion_menu').'
510 510
                         </p>
511 511
                         </a>
512 512
                     </li>';
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
                         <a href="#" data-name="admin" class="nav-link', $get['page'] === 'admin' ? ' active' : '', '">
520 520
                         <i class="nav-icon fas fa-info"></i>
521 521
                         <p>
522
-                            ' . langHdl('admin_main') . '
522
+                            ' . langHdl('admin_main').'
523 523
                         </p>
524 524
                         </a>
525 525
                     </li>
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
                         <a href="#" class="nav-link">
528 528
                             <i class="nav-icon fas fa-wrench"></i>
529 529
                             <p>
530
-                                ' . langHdl('admin_settings') . '
530
+                                ' . langHdl('admin_settings').'
531 531
                                 <i class="fas fa-angle-left right"></i>
532 532
                             </p>
533 533
                         </a>
@@ -535,55 +535,55 @@  discard block
 block discarded – undo
535 535
                             <li class="nav-item">
536 536
                                 <a href="#" data-name="options" class="nav-link', $get['page'] === 'options' ? ' active' : '', '">
537 537
                                     <i class="fas fa-check-double nav-icon"></i>
538
-                                    <p>' . langHdl('options') . '</p>
538
+                                    <p>' . langHdl('options').'</p>
539 539
                                 </a>
540 540
                             </li>
541 541
                             <li class="nav-item">
542 542
                                 <a href="#" data-name="2fa" class="nav-link', $get['page'] === '2fa' ? ' active' : '', '">
543 543
                                     <i class="fas fa-qrcode nav-icon"></i>
544
-                                    <p>' . langHdl('mfa_short') . '</p>
544
+                                    <p>' . langHdl('mfa_short').'</p>
545 545
                                 </a>
546 546
                             </li>
547 547
                             <li class="nav-item">
548 548
                                 <a href="#" data-name="api" class="nav-link', $get['page'] === 'api' ? ' active' : '', '">
549 549
                                     <i class="fas fa-cubes nav-icon"></i>
550
-                                    <p>' . langHdl('api') . '</p>
550
+                                    <p>' . langHdl('api').'</p>
551 551
                                 </a>
552 552
                             </li>
553 553
                             <li class="nav-item">
554 554
                                 <a href="#" data-name="backups" class="nav-link', $get['page'] === 'backups' ? ' active' : '', '">
555 555
                                     <i class="fas fa-database nav-icon"></i>
556
-                                    <p>' . langHdl('backups') . '</p>
556
+                                    <p>' . langHdl('backups').'</p>
557 557
                                 </a>
558 558
                             </li>
559 559
                             <li class="nav-item">
560 560
                                 <a href="#" data-name="emails" class="nav-link', $get['page'] === 'emails' ? ' active' : '', '">
561 561
                                     <i class="fas fa-envelope nav-icon"></i>
562
-                                    <p>' . langHdl('emails') . '</p>
562
+                                    <p>' . langHdl('emails').'</p>
563 563
                                 </a>
564 564
                             </li>
565 565
                             <li class="nav-item">
566 566
                                 <a href="#" data-name="fields" class="nav-link', $get['page'] === 'fields' ? ' active' : '', '">
567 567
                                     <i class="fas fa-keyboard nav-icon"></i>
568
-                                    <p>' . langHdl('fields') . '</p>
568
+                                    <p>' . langHdl('fields').'</p>
569 569
                                 </a>
570 570
                             </li>
571 571
                             <li class="nav-item">
572 572
                                 <a href="#" data-name="ldap" class="nav-link', $get['page'] === 'ldap' ? ' active' : '', '">
573 573
                                     <i class="fas fa-id-card nav-icon"></i>
574
-                                    <p>' . langHdl('ldap') . '</p>
574
+                                    <p>' . langHdl('ldap').'</p>
575 575
                                 </a>
576 576
                             </li>
577 577
                             <li class="nav-item">
578 578
                                 <a href="#" data-name="uploads" class="nav-link', $get['page'] === 'uploads' ? ' active' : '', '">
579 579
                                     <i class="fas fa-file-upload nav-icon"></i>
580
-                                    <p>' . langHdl('uploads') . '</p>
580
+                                    <p>' . langHdl('uploads').'</p>
581 581
                                 </a>
582 582
                             </li>
583 583
                             <li class="nav-item">
584 584
                                 <a href="#" data-name="statistics" class="nav-link', $get['page'] === 'statistics' ? ' active' : '', '">
585 585
                                     <i class="fas fa-chart-bar nav-icon"></i>
586
-                                    <p>' . langHdl('statistics') . '</p>
586
+                                    <p>' . langHdl('statistics').'</p>
587 587
                                 </a>
588 588
                             </li>
589 589
                         </ul>
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
                         <a href="#" data-name="actions" class="nav-link', $get['page'] === 'actions' ? ' active' : '', '">
593 593
                         <i class="nav-icon fas fa-cogs"></i>
594 594
                         <p>
595
-                            ' . langHdl('actions') . '
595
+                            ' . langHdl('actions').'
596 596
                         </p>
597 597
                         </a>
598 598
                     </li>';
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
                         <a href="#" data-name="folders" class="nav-link', $get['page'] === 'folders' ? ' active' : '', '">
609 609
                         <i class="nav-icon fas fa-folder-open"></i>
610 610
                         <p>
611
-                            ' . langHdl('folders') . '
611
+                            ' . langHdl('folders').'
612 612
                         </p>
613 613
                         </a>
614 614
                     </li>
@@ -616,7 +616,7 @@  discard block
 block discarded – undo
616 616
                         <a href="#" data-name="roles" class="nav-link', $get['page'] === 'roles' ? ' active' : '', '">
617 617
                         <i class="nav-icon fas fa-graduation-cap"></i>
618 618
                         <p>
619
-                            ' . langHdl('roles') . '
619
+                            ' . langHdl('roles').'
620 620
                         </p>
621 621
                         </a>
622 622
                     </li>
@@ -624,38 +624,38 @@  discard block
 block discarded – undo
624 624
                         <a href="#" data-name="users" class="nav-link', $get['page'] === 'users' ? ' active' : '', '">
625 625
                         <i class="nav-icon fas fa-users"></i>
626 626
                         <p>
627
-                            ' . langHdl('users') . '
627
+                            ' . langHdl('users').'
628 628
                         </p>
629 629
                         </a>
630 630
                     </li>
631 631
                     <li class="nav-item has-treeview', $menuUtilities === true ? ' menu-open' : '', '">
632 632
                         <a href="#" class="nav-link">
633 633
                         <i class="nav-icon fas fa-cubes"></i>
634
-                        <p>' . langHdl('admin_views') . '<i class="fas fa-angle-left right"></i></p>
634
+                        <p>' . langHdl('admin_views').'<i class="fas fa-angle-left right"></i></p>
635 635
                         </a>
636 636
                         <ul class="nav nav-treeview">
637 637
                           <li class="nav-item">
638 638
                             <a href="#" data-name="utilities.renewal" class="nav-link', $get['page'] === 'utilities.renewal' ? ' active' : '', '">
639 639
                               <i class="far fa-calendar-alt nav-icon"></i>
640
-                              <p>' . langHdl('renewal') . '</p>
640
+                              <p>' . langHdl('renewal').'</p>
641 641
                             </a>
642 642
                           </li>
643 643
                           <li class="nav-item">
644 644
                             <a href="#" data-name="utilities.deletion" class="nav-link', $get['page'] === 'utilities.deletion' ? ' active' : '', '">
645 645
                               <i class="fas fa-trash-alt nav-icon"></i>
646
-                              <p>' . langHdl('deletion') . '</p>
646
+                              <p>' . langHdl('deletion').'</p>
647 647
                             </a>
648 648
                           </li>
649 649
                           <li class="nav-item">
650 650
                             <a href="#" data-name="utilities.logs" class="nav-link', $get['page'] === 'utilities.logs' ? ' active' : '', '">
651 651
                               <i class="fas fa-history nav-icon"></i>
652
-                              <p>' . langHdl('logs') . '</p>
652
+                              <p>' . langHdl('logs').'</p>
653 653
                             </a>
654 654
                           </li>
655 655
                           <li class="nav-item">
656 656
                             <a href="#" data-name="utilities.database" class="nav-link', $get['page'] === 'utilities.database' ? ' active' : '', '">
657 657
                               <i class="fas fa-database nav-icon"></i>
658
-                              <p>' . langHdl('database') . '</p>
658
+                              <p>' . langHdl('database').'</p>
659 659
                             </a>
660 660
                           </li>
661 661
                         </ul>
@@ -666,10 +666,10 @@  discard block
 block discarded – undo
666 666
                     <!-- /.sidebar-menu -->
667 667
                 <div class="menu-footer">
668 668
                     <div class="" id="sidebar-footer">
669
-                        <i class="fas fa-clock-o mr-2 infotip text-info pointer" title="<?php echo langHdl('server_time') . ' ' .
670
-                            date($SETTINGS['date_format'], (int) $server['request_time']) . ' - ' .
669
+                        <i class="fas fa-clock-o mr-2 infotip text-info pointer" title="<?php echo langHdl('server_time').' '.
670
+                            date($SETTINGS['date_format'], (int) $server['request_time']).' - '.
671 671
                             date($SETTINGS['time_format'], (int) $server['request_time']); ?>"></i>
672
-                        <i class="fas fa-users mr-2 infotip text-info pointer" title="<?php echo $session_nb_users_online . ' ' . langHdl('users_online'); ?>"></i>
672
+                        <i class="fas fa-users mr-2 infotip text-info pointer" title="<?php echo $session_nb_users_online.' '.langHdl('users_online'); ?>"></i>
673 673
                         <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>
674 674
                         <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>
675 675
                         <i class="fas fa-bug infotip pointer text-info" title="<?php echo langHdl('bugs_page'); ?>" onclick="generateBugReport()"></i>
@@ -972,18 +972,18 @@  discard block
 block discarded – undo
972 972
                     } elseif ($get['page'] === 'items') {
973 973
                         // SHow page with Items
974 974
                         if ((int) $session_user_admin !== 1) {
975
-                            include $SETTINGS['cpassman_dir'] . '/pages/items.php';
975
+                            include $SETTINGS['cpassman_dir'].'/pages/items.php';
976 976
                         } elseif ((int) $session_user_admin === 1) {
977
-                            include $SETTINGS['cpassman_dir'] . '/pages/admin.php';
977
+                            include $SETTINGS['cpassman_dir'].'/pages/admin.php';
978 978
                         } else {
979 979
                             $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
980 980
                             //not allowed page
981
-                            include $SETTINGS['cpassman_dir'] . '/error.php';
981
+                            include $SETTINGS['cpassman_dir'].'/error.php';
982 982
                         }
983 983
                     } elseif (in_array($get['page'], array_keys($mngPages)) === true) {
984 984
                         // Define if user is allowed to see management pages
985 985
                         if ($session_user_admin === 1) {
986
-                            include $SETTINGS['cpassman_dir'] . '/pages/' . $mngPages[$get['page']];
986
+                            include $SETTINGS['cpassman_dir'].'/pages/'.$mngPages[$get['page']];
987 987
                         } elseif ($session_user_manager === 1 || $session_user_human_resources === 1) {
988 988
                             if ($get['page'] !== 'manage_main'
989 989
                                 && $get['page'] !== 'manage_settings'
@@ -992,15 +992,15 @@  discard block
 block discarded – undo
992 992
                             } else {
993 993
                                 $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
994 994
                                 //not allowed page
995
-                                include $SETTINGS['cpassman_dir'] . '/error.php';
995
+                                include $SETTINGS['cpassman_dir'].'/error.php';
996 996
                             }
997 997
                         } else {
998 998
                             $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
999 999
                             //not allowed page
1000
-                            include $SETTINGS['cpassman_dir'] . '/error.php';
1000
+                            include $SETTINGS['cpassman_dir'].'/error.php';
1001 1001
                         }
1002 1002
                     } elseif (empty($get['page']) === false) {
1003
-                        include $SETTINGS['cpassman_dir'] . '/pages/' . $get['page'] . '.php';
1003
+                        include $SETTINGS['cpassman_dir'].'/pages/'.$get['page'].'.php';
1004 1004
                     } else {
1005 1005
                         $_SESSION['error']['code'] = ERR_NOT_EXIST;
1006 1006
                         //page doesn't exist
@@ -1090,7 +1090,7 @@  discard block
 block discarded – undo
1090 1090
     $superGlobal->put('initialUrl', '', 'SESSION');
1091 1091
 
1092 1092
     // LOGIN form
1093
-    include $SETTINGS['cpassman_dir'] . '/includes/core/login.php';
1093
+    include $SETTINGS['cpassman_dir'].'/includes/core/login.php';
1094 1094
 }
1095 1095
 
1096 1096
     ?>
@@ -1280,61 +1280,61 @@  discard block
 block discarded – undo
1280 1280
     isset($_SESSION['CPM']) === true
1281 1281
     && isset($SETTINGS['cpassman_dir']) === true
1282 1282
 ) {
1283
-    include_once $SETTINGS['cpassman_dir'] . '/includes/core/load.js.php';
1283
+    include_once $SETTINGS['cpassman_dir'].'/includes/core/load.js.php';
1284 1284
     if ($menuAdmin === true) {
1285
-        include_once $SETTINGS['cpassman_dir'] . '/pages/admin.js.php';
1285
+        include_once $SETTINGS['cpassman_dir'].'/pages/admin.js.php';
1286 1286
         if ($get['page'] === '2fa') {
1287
-            include_once $SETTINGS['cpassman_dir'] . '/pages/2fa.js.php';
1287
+            include_once $SETTINGS['cpassman_dir'].'/pages/2fa.js.php';
1288 1288
         } elseif ($get['page'] === 'api') {
1289
-            include_once $SETTINGS['cpassman_dir'] . '/pages/api.js.php';
1289
+            include_once $SETTINGS['cpassman_dir'].'/pages/api.js.php';
1290 1290
         } elseif ($get['page'] === 'backups') {
1291
-            include_once $SETTINGS['cpassman_dir'] . '/pages/backups.js.php';
1291
+            include_once $SETTINGS['cpassman_dir'].'/pages/backups.js.php';
1292 1292
         } elseif ($get['page'] === 'emails') {
1293
-            include_once $SETTINGS['cpassman_dir'] . '/pages/emails.js.php';
1293
+            include_once $SETTINGS['cpassman_dir'].'/pages/emails.js.php';
1294 1294
         } elseif ($get['page'] === 'ldap') {
1295
-            include_once $SETTINGS['cpassman_dir'] . '/pages/ldap.js.php';
1295
+            include_once $SETTINGS['cpassman_dir'].'/pages/ldap.js.php';
1296 1296
         } elseif ($get['page'] === 'uploads') {
1297
-            include_once $SETTINGS['cpassman_dir'] . '/pages/uploads.js.php';
1297
+            include_once $SETTINGS['cpassman_dir'].'/pages/uploads.js.php';
1298 1298
         } elseif ($get['page'] === 'actions') {
1299
-            include_once $SETTINGS['cpassman_dir'] . '/pages/actions.js.php';
1299
+            include_once $SETTINGS['cpassman_dir'].'/pages/actions.js.php';
1300 1300
         } elseif ($get['page'] === 'fields') {
1301
-            include_once $SETTINGS['cpassman_dir'] . '/pages/fields.js.php';
1301
+            include_once $SETTINGS['cpassman_dir'].'/pages/fields.js.php';
1302 1302
         } elseif ($get['page'] === 'options') {
1303
-            include_once $SETTINGS['cpassman_dir'] . '/pages/options.js.php';
1303
+            include_once $SETTINGS['cpassman_dir'].'/pages/options.js.php';
1304 1304
         } elseif ($get['page'] === 'statistics') {
1305
-            include_once $SETTINGS['cpassman_dir'] . '/pages/statistics.js.php';
1305
+            include_once $SETTINGS['cpassman_dir'].'/pages/statistics.js.php';
1306 1306
         }
1307 1307
     } elseif (isset($get['page']) === true && $get['page'] !== '') {
1308 1308
         if ($get['page'] === 'items') {
1309
-            include_once $SETTINGS['cpassman_dir'] . '/pages/items.js.php';
1309
+            include_once $SETTINGS['cpassman_dir'].'/pages/items.js.php';
1310 1310
         } elseif ($get['page'] === 'import') {
1311
-            include_once $SETTINGS['cpassman_dir'] . '/pages/import.js.php';
1311
+            include_once $SETTINGS['cpassman_dir'].'/pages/import.js.php';
1312 1312
         } elseif ($get['page'] === 'export') {
1313
-            include_once $SETTINGS['cpassman_dir'] . '/pages/export.js.php';
1313
+            include_once $SETTINGS['cpassman_dir'].'/pages/export.js.php';
1314 1314
         } elseif ($get['page'] === 'offline') {
1315
-            include_once $SETTINGS['cpassman_dir'] . '/pages/offline.js.php';
1315
+            include_once $SETTINGS['cpassman_dir'].'/pages/offline.js.php';
1316 1316
         } elseif ($get['page'] === 'search') {
1317
-            include_once $SETTINGS['cpassman_dir'] . '/pages/search.js.php';
1317
+            include_once $SETTINGS['cpassman_dir'].'/pages/search.js.php';
1318 1318
         } elseif ($get['page'] === 'profile') {
1319
-            include_once $SETTINGS['cpassman_dir'] . '/pages/profile.js.php';
1319
+            include_once $SETTINGS['cpassman_dir'].'/pages/profile.js.php';
1320 1320
         } elseif ($get['page'] === 'favourites') {
1321
-            include_once $SETTINGS['cpassman_dir'] . '/pages/favorites.js.php';
1321
+            include_once $SETTINGS['cpassman_dir'].'/pages/favorites.js.php';
1322 1322
         } elseif ($get['page'] === 'folders') {
1323
-            include_once $SETTINGS['cpassman_dir'] . '/pages/folders.js.php';
1323
+            include_once $SETTINGS['cpassman_dir'].'/pages/folders.js.php';
1324 1324
         } elseif ($get['page'] === 'users') {
1325
-            include_once $SETTINGS['cpassman_dir'] . '/pages/users.js.php';
1325
+            include_once $SETTINGS['cpassman_dir'].'/pages/users.js.php';
1326 1326
         } elseif ($get['page'] === 'roles') {
1327
-            include_once $SETTINGS['cpassman_dir'] . '/pages/roles.js.php';
1327
+            include_once $SETTINGS['cpassman_dir'].'/pages/roles.js.php';
1328 1328
         } elseif ($get['page'] === 'utilities.deletion') {
1329
-            include_once $SETTINGS['cpassman_dir'] . '/pages/utilities.deletion.js.php';
1329
+            include_once $SETTINGS['cpassman_dir'].'/pages/utilities.deletion.js.php';
1330 1330
         } elseif ($get['page'] === 'utilities.logs') {
1331
-            include_once $SETTINGS['cpassman_dir'] . '/pages/utilities.logs.js.php';
1331
+            include_once $SETTINGS['cpassman_dir'].'/pages/utilities.logs.js.php';
1332 1332
         } elseif ($get['page'] === 'utilities.database') {
1333
-            include_once $SETTINGS['cpassman_dir'] . '/pages/utilities.database.js.php';
1333
+            include_once $SETTINGS['cpassman_dir'].'/pages/utilities.database.js.php';
1334 1334
         } elseif ($get['page'] === 'utilities.renewal') {
1335
-            include_once $SETTINGS['cpassman_dir'] . '/pages/utilities.renewal.js.php';
1335
+            include_once $SETTINGS['cpassman_dir'].'/pages/utilities.renewal.js.php';
1336 1336
         }
1337 1337
     } else {
1338
-        include_once $SETTINGS['cpassman_dir'] . '/includes/core/login.js.php';
1338
+        include_once $SETTINGS['cpassman_dir'].'/includes/core/login.js.php';
1339 1339
     }
1340 1340
 }
Please login to merge, or discard this patch.
sources/main.queries.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1861,7 +1861,9 @@
 block discarded – undo
1861 1861
             $record['id'],
1862 1862
             $_SESSION['user_id']
1863 1863
         );
1864
-        if (count($currentUserKey) === 0) continue;
1864
+        if (count($currentUserKey) === 0) {
1865
+            continue;
1866
+        }
1865 1867
 
1866 1868
         // Decrypt itemkey with admin key
1867 1869
         $itemKey = decryptUserObjectKey($currentUserKey['share_key'], $_SESSION['user']['private_key']);
Please login to merge, or discard this patch.
Spacing   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
 date_default_timezone_set(isset($SETTINGS['timezone']) === true ? $SETTINGS['timezone'] : 'UTC');
46 46
 
47 47
 // DO CHECKS
48
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
49
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
48
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
49
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
50 50
 $post_type = filter_input(INPUT_POST, 'type', FILTER_SANITIZE_STRING);
51 51
 if (
52 52
     isset($post_type) === true
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     && checkUser($_SESSION['user_id'], $_SESSION['key'], 'home', $SETTINGS) === false
63 63
 ) {
64 64
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
65
-    include $SETTINGS['cpassman_dir'] . '/error.php';
65
+    include $SETTINGS['cpassman_dir'].'/error.php';
66 66
     exit();
67 67
 } elseif ((isset($_SESSION['user_id']) === true
68 68
         && isset($_SESSION['key'])) === true
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     mainQuery($SETTINGS);
75 75
 } else {
76 76
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
77
-    include $SETTINGS['cpassman_dir'] . '/error.php';
77
+    include $SETTINGS['cpassman_dir'].'/error.php';
78 78
     exit();
79 79
 }
80 80
 
@@ -89,13 +89,13 @@  discard block
 block discarded – undo
89 89
 
90 90
 
91 91
     // Includes
92
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
93
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
94
-    include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
95
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
92
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
93
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
94
+    include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
95
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
96 96
 
97 97
     // Connect to mysql server
98
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
98
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
99 99
 
100 100
     DB::$host = DB_HOST;
101 101
     DB::$user = DB_USER;
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     DB::$encoding = DB_ENCODING;
106 106
 
107 107
     // User's language loading
108
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
108
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
109 109
 
110 110
     // Prepare post variables
111 111
     $post_key = filter_input(INPUT_POST, 'key', FILTER_SANITIZE_STRING);
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
             $pwdlib = new PasswordLib\PasswordLib();
234 234
             // generate key
235 235
             $key = $pwdlib->getRandomToken(filter_input(INPUT_POST, 'size', FILTER_SANITIZE_NUMBER_INT));
236
-            echo '[{"key" : "' . htmlentities($key, ENT_QUOTES) . '"}]';
236
+            echo '[{"key" : "'.htmlentities($key, ENT_QUOTES).'"}]';
237 237
             break;
238 238
 
239 239
         /*
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
                 )
263 263
             );
264 264
 
265
-            echo '[{"token" : "' . $token . '"}]';
265
+            echo '[{"token" : "'.$token.'"}]';
266 266
             break;
267 267
 
268 268
 
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
     // get number of items
533 533
     DB::queryFirstRow(
534 534
         'SELECT increment_id
535
-        FROM ' . prefixTable('sharekeys_items') .
535
+        FROM ' . prefixTable('sharekeys_items').
536 536
         ' WHERE user_id = %i',
537 537
         $userId
538 538
     );
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
         // check if expected security level is reached
587 587
         $dataUser = DB::queryfirstrow(
588 588
             'SELECT *
589
-            FROM ' . prefixTable('users') . ' WHERE id = %i',
589
+            FROM ' . prefixTable('users').' WHERE id = %i',
590 590
             $post_user_id
591 591
         );
592 592
 
@@ -607,8 +607,8 @@  discard block
 block discarded – undo
607 607
         if (empty($dataUser['fonction_id']) === false) {
608 608
             $data = DB::queryFirstRow(
609 609
                 'SELECT complexity
610
-                FROM ' . prefixTable('roles_title') . '
611
-                WHERE id IN (' . $dataUser['fonction_id'] . ')
610
+                FROM ' . prefixTable('roles_title').'
611
+                WHERE id IN (' . $dataUser['fonction_id'].')
612 612
                 ORDER BY complexity DESC'
613 613
             );
614 614
         } else {
@@ -621,8 +621,8 @@  discard block
 block discarded – undo
621 621
             return prepareExchangedData(
622 622
                 array(
623 623
                     'error' => true,
624
-                    'message' => '<div style="margin:10px 0 10px 15px;">' . langHdl('complexity_level_not_reached') . '.<br>' .
625
-                        langHdl('expected_complexity_level') . ': <b>' . TP_PW_COMPLEXITY[$data['complexity']][1] . '</b></div>',
624
+                    'message' => '<div style="margin:10px 0 10px 15px;">'.langHdl('complexity_level_not_reached').'.<br>'.
625
+                        langHdl('expected_complexity_level').': <b>'.TP_PW_COMPLEXITY[$data['complexity']][1].'</b></div>',
626 626
                 ),
627 627
                 'encode'
628 628
             );
@@ -723,14 +723,14 @@  discard block
 block discarded – undo
723 723
         // Get data about user
724 724
         $data = DB::queryfirstrow(
725 725
             'SELECT id, email, pw
726
-            FROM ' . prefixTable('users') . '
726
+            FROM ' . prefixTable('users').'
727 727
             WHERE login = %s',
728 728
             $post_login
729 729
         );
730 730
     } else {
731 731
         $data = DB::queryfirstrow(
732 732
             'SELECT id, login, email, pw
733
-            FROM ' . prefixTable('users') . '
733
+            FROM ' . prefixTable('users').'
734 734
             WHERE id = %i',
735 735
             $post_id
736 736
         );
@@ -740,7 +740,7 @@  discard block
 block discarded – undo
740 740
     $counter = DB::count();
741 741
 
742 742
     // load passwordLib library
743
-    $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries');
743
+    $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries');
744 744
     $pwdlib->register();
745 745
     $pwdlib = new PasswordLib\PasswordLib();
746 746
 
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
     }
788 788
     
789 789
     // generate new GA user code
790
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php';
790
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php';
791 791
     $tfa = new Authentication\TwoFactorAuth\TwoFactorAuth($SETTINGS['ga_website_name']);
792 792
     $gaSecretKey = $tfa->createSecret();
793 793
     $gaTemporaryCode = GenerateCryptKey(12, false, true, true, false, true, $SETTINGS);
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
                 'email' => $data['email'],
830 830
                 'email_result' => str_replace(
831 831
                     '#email#',
832
-                    '<b>' . obfuscateEmail($data['email']) . '</b>',
832
+                    '<b>'.obfuscateEmail($data['email']).'</b>',
833 833
                     addslashes(langHdl('admin_email_result_ok'))
834 834
                 ),
835 835
             ),
@@ -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
         ),
@@ -861,7 +861,7 @@  discard block
 block discarded – undo
861 861
         && (int) $SETTINGS['enable_send_email_on_user_login'] === 1
862 862
     ) {
863 863
         $row = DB::queryFirstRow(
864
-            'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s',
864
+            'SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s',
865 865
             'cron',
866 866
             'sending_emails'
867 867
         );
@@ -869,12 +869,12 @@  discard block
 block discarded – undo
869 869
         if ((int) (time() - $row['valeur']) >= 300 || (int) $row['valeur'] === 0) {
870 870
             $rows = DB::query(
871 871
                 'SELECT *
872
-                FROM ' . prefixTable('emails') .
872
+                FROM ' . prefixTable('emails').
873 873
                 ' WHERE status != %s',
874 874
                 'sent'
875 875
             );
876 876
             foreach ($rows as $record) {
877
-                echo $record['increment_id'] . " >> ";
877
+                echo $record['increment_id']." >> ";
878 878
                 // Send email
879 879
                 $ret = json_decode(
880 880
                     sendEmail(
@@ -973,8 +973,8 @@  discard block
 block discarded – undo
973 973
     $arr_html = array();
974 974
     $rows = DB::query(
975 975
         '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
976
-        FROM ' . prefixTable('log_items') . ' AS l
977
-        RIGHT JOIN ' . prefixTable('items') . ' AS i ON (l.id_item = i.id)
976
+        FROM ' . prefixTable('log_items').' AS l
977
+        RIGHT JOIN ' . prefixTable('items').' AS i ON (l.id_item = i.id)
978 978
         WHERE l.action = %s AND l.id_user = %i
979 979
         ORDER BY l.date DESC
980 980
         LIMIT 0, 100',
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
         isset($SETTINGS['enable_suggestion']) === true && (int) $SETTINGS['enable_suggestion'] === 1
1008 1008
         && ((int) $_SESSION['user_admin'] === 1 || (int) $_SESSION['user_manager'] === 1)
1009 1009
     ) {
1010
-        DB::query('SELECT * FROM ' . prefixTable('suggestion'));
1010
+        DB::query('SELECT * FROM '.prefixTable('suggestion'));
1011 1011
         $nb_suggestions_waiting = DB::count();
1012 1012
     }
1013 1013
 
@@ -1043,13 +1043,13 @@  discard block
 block discarded – undo
1043 1043
             if ($data === 'stat_languages') {
1044 1044
                 $tmp = '';
1045 1045
                 foreach ($stats_data[$data] as $key => $value) {
1046
-                    $tmp .= $tmp === '' ? $key . '-' . $value : ',' . $key . '-' . $value;
1046
+                    $tmp .= $tmp === '' ? $key.'-'.$value : ','.$key.'-'.$value;
1047 1047
                 }
1048 1048
                 $statsToSend[$data] = $tmp;
1049 1049
             } elseif ($data === 'stat_country') {
1050 1050
                 $tmp = '';
1051 1051
                 foreach ($stats_data[$data] as $key => $value) {
1052
-                    $tmp .= $tmp === '' ? $key . '-' . $value : ',' . $key . '-' . $value;
1052
+                    $tmp .= $tmp === '' ? $key.'-'.$value : ','.$key.'-'.$value;
1053 1053
                 }
1054 1054
                 $statsToSend[$data] = $tmp;
1055 1055
             } else {
@@ -1123,8 +1123,8 @@  discard block
 block discarded – undo
1123 1123
             if (strpos($line, 'cpassman_url') > 0 && empty($url_found) === true) {
1124 1124
                 $url_found = substr($line, 19, strlen($line) - 22);
1125 1125
                 $tmp = parse_url($url_found);
1126
-                $anonym_url = $tmp['scheme'] . '://<anonym_url>' . $tmp['path'];
1127
-                $line = "'cpassman_url' => '" . $anonym_url . "\n";
1126
+                $anonym_url = $tmp['scheme'].'://<anonym_url>'.$tmp['path'];
1127
+                $line = "'cpassman_url' => '".$anonym_url."\n";
1128 1128
             }
1129 1129
 
1130 1130
             // Anonymize all urls
@@ -1151,7 +1151,7 @@  discard block
 block discarded – undo
1151 1151
     $teampass_errors = '';
1152 1152
     $rows = DB::query(
1153 1153
         'SELECT label, date AS error_date
1154
-        FROM ' . prefixTable('log_system') . "
1154
+        FROM ' . prefixTable('log_system')."
1155 1155
         WHERE `type` LIKE 'error'
1156 1156
         ORDER BY `date` DESC
1157 1157
         LIMIT 0, 10"
@@ -1159,9 +1159,9 @@  discard block
 block discarded – undo
1159 1159
     if (DB::count() > 0) {
1160 1160
         foreach ($rows as $record) {
1161 1161
             if (empty($teampass_errors) === true) {
1162
-                $teampass_errors = ' * ' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['error_date']) . ' - ' . $record['label'];
1162
+                $teampass_errors = ' * '.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['error_date']).' - '.$record['label'];
1163 1163
             } else {
1164
-                $teampass_errors .= ' * ' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['error_date']) . ' - ' . $record['label'];
1164
+                $teampass_errors .= ' * '.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['error_date']).' - '.$record['label'];
1165 1165
             }
1166 1166
         }
1167 1167
     }
@@ -1170,7 +1170,7 @@  discard block
 block discarded – undo
1170 1170
 
1171 1171
     // Now prepare text
1172 1172
     $txt = '### Page on which it happened
1173
-' . $post_data['current_page'] . '
1173
+' . $post_data['current_page'].'
1174 1174
 
1175 1175
 ### Steps to reproduce
1176 1176
 1.
@@ -1185,39 +1185,39 @@  discard block
 block discarded – undo
1185 1185
 Tell us what happens instead
1186 1186
 
1187 1187
 ### Server configuration
1188
-**Operating system**: ' . php_uname() . '
1188
+**Operating system**: ' . php_uname().'
1189 1189
 
1190
-**Web server:** ' . $_SERVER['SERVER_SOFTWARE'] . '
1190
+**Web server:** ' . $_SERVER['SERVER_SOFTWARE'].'
1191 1191
 
1192
-**Database:** ' . ($link === false ? langHdl('undefined') : mysqli_get_server_info($link)) . '
1192
+**Database:** ' . ($link === false ? langHdl('undefined') : mysqli_get_server_info($link)).'
1193 1193
 
1194
-**PHP version:** ' . PHP_VERSION . '
1194
+**PHP version:** ' . PHP_VERSION.'
1195 1195
 
1196
-**Teampass version:** ' . TP_VERSION_FULL . '
1196
+**Teampass version:** ' . TP_VERSION_FULL.'
1197 1197
 
1198 1198
 **Teampass configuration file:**
1199 1199
 ```
1200
-' . $list_of_options . '
1200
+' . $list_of_options.'
1201 1201
 ```
1202 1202
 
1203 1203
 **Updated from an older Teampass or fresh install:**
1204 1204
 
1205 1205
 ### Client configuration
1206 1206
 
1207
-**Browser:** ' . $post_data['browser_name'] . ' - ' . $post_data['browser_version'] . '
1207
+**Browser:** ' . $post_data['browser_name'].' - '.$post_data['browser_version'].'
1208 1208
 
1209
-**Operating system:** ' . $post_data['os'] . ' - ' . $post_data['os_archi'] . 'bits
1209
+**Operating system:** ' . $post_data['os'].' - '.$post_data['os_archi'].'bits
1210 1210
 
1211 1211
 ### Logs
1212 1212
 
1213 1213
 #### Web server error log
1214 1214
 ```
1215
-' . $err['message'] . ' - ' . $err['file'] . ' (' . $err['line'] . ')
1215
+' . $err['message'].' - '.$err['file'].' ('.$err['line'].')
1216 1216
 ```
1217 1217
 
1218 1218
 #### Teampass 10 last system errors
1219 1219
 ```
1220
-' . $teampass_errors . '
1220
+' . $teampass_errors.'
1221 1221
 ```
1222 1222
 
1223 1223
 #### Log from the web-browser developer console (CTRL + SHIFT + i)
@@ -1245,7 +1245,7 @@  discard block
 block discarded – undo
1245 1245
         // Check if user exists
1246 1246
         $userInfo = DB::queryFirstRow(
1247 1247
             'SELECT public_key, private_key, pw, auth_type
1248
-            FROM ' . prefixTable('users') . '
1248
+            FROM ' . prefixTable('users').'
1249 1249
             WHERE id = %i',
1250 1250
             $post_user_id
1251 1251
         );
@@ -1253,14 +1253,14 @@  discard block
 block discarded – undo
1253 1253
             // Get one item
1254 1254
             $record = DB::queryFirstRow(
1255 1255
                 'SELECT id, pw
1256
-                FROM ' . prefixTable('items') . '
1256
+                FROM ' . prefixTable('items').'
1257 1257
                 WHERE perso = 0'
1258 1258
             );
1259 1259
 
1260 1260
             // Get itemKey from current user
1261 1261
             $currentUserKey = DB::queryFirstRow(
1262 1262
                 'SELECT share_key, increment_id
1263
-                FROM ' . prefixTable('sharekeys_items') . '
1263
+                FROM ' . prefixTable('sharekeys_items').'
1264 1264
                 WHERE object_id = %i AND user_id = %i',
1265 1265
                 $record['id'],
1266 1266
                 $post_user_id
@@ -1287,7 +1287,7 @@  discard block
 block discarded – undo
1287 1287
             
1288 1288
             // Use the password check
1289 1289
             // load passwordLib library
1290
-            $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1290
+            $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries');
1291 1291
             $pwdlib->register();
1292 1292
             $pwdlib = new PasswordLib\PasswordLib();
1293 1293
             
@@ -1331,7 +1331,7 @@  discard block
 block discarded – undo
1331 1331
         // Get user info
1332 1332
         $userData = DB::queryFirstRow(
1333 1333
             'SELECT private_key
1334
-            FROM ' . prefixTable('users') . '
1334
+            FROM ' . prefixTable('users').'
1335 1335
             WHERE id = %i',
1336 1336
             $post_user_id
1337 1337
         );
@@ -1358,7 +1358,7 @@  discard block
 block discarded – undo
1358 1358
             );
1359 1359
 
1360 1360
             // Load superGlobals
1361
-            include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1361
+            include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1362 1362
             $superGlobal = new protect\SuperGlobal\SuperGlobal();
1363 1363
 
1364 1364
             $superGlobal->put('private_key', $privateKey, 'SESSION', 'user');
@@ -1396,7 +1396,7 @@  discard block
 block discarded – undo
1396 1396
         // Get user info
1397 1397
         $userData = DB::queryFirstRow(
1398 1398
             'SELECT email, auth_type, login
1399
-            FROM ' . prefixTable('users') . '
1399
+            FROM ' . prefixTable('users').'
1400 1400
             WHERE id = %i',
1401 1401
             $post_user_id
1402 1402
         );
@@ -1530,7 +1530,7 @@  discard block
 block discarded – undo
1530 1530
         // Get user info
1531 1531
         $userData = DB::queryFirstRow(
1532 1532
             'SELECT email, auth_type, login
1533
-            FROM ' . prefixTable('users') . '
1533
+            FROM ' . prefixTable('users').'
1534 1534
             WHERE id = %i',
1535 1535
             $post_user_id
1536 1536
         );
@@ -1593,13 +1593,13 @@  discard block
 block discarded – undo
1593 1593
         // Check if user exists
1594 1594
         DB::queryFirstRow(
1595 1595
             'SELECT *
1596
-            FROM ' . prefixTable('users') . '
1596
+            FROM ' . prefixTable('users').'
1597 1597
             WHERE id = %i',
1598 1598
             $post_user_id
1599 1599
         );
1600 1600
         if (DB::count() > 0) {
1601 1601
             // Include libraries
1602
-            include_once $SETTINGS['cpassman_dir'] . '/sources/aes.functions.php';
1602
+            include_once $SETTINGS['cpassman_dir'].'/sources/aes.functions.php';
1603 1603
 
1604 1604
             // CLear old sharekeys
1605 1605
             if ($post_self_change === false) {
@@ -1651,13 +1651,13 @@  discard block
 block discarded – undo
1651 1651
         // Check if user exists
1652 1652
         $userInfo = DB::queryFirstRow(
1653 1653
             'SELECT public_key
1654
-            FROM ' . prefixTable('users') . '
1654
+            FROM ' . prefixTable('users').'
1655 1655
             WHERE id = %i',
1656 1656
             $post_user_id
1657 1657
         );
1658 1658
         if (DB::count() > 0) {
1659 1659
             // Include libraries
1660
-            include_once $SETTINGS['cpassman_dir'] . '/sources/aes.functions.php';
1660
+            include_once $SETTINGS['cpassman_dir'].'/sources/aes.functions.php';
1661 1661
 
1662 1662
             // WHAT STEP TO PERFORM?
1663 1663
             if ($post_action === 'step0') {
@@ -1817,15 +1817,15 @@  discard block
 block discarded – undo
1817 1817
     // Loop on items
1818 1818
     $rows = DB::query(
1819 1819
         'SELECT id, pw
1820
-        FROM ' . prefixTable('items') . '
1820
+        FROM ' . prefixTable('items').'
1821 1821
         WHERE perso = 0
1822
-        LIMIT ' . $post_start . ', ' . $post_length
1822
+        LIMIT ' . $post_start.', '.$post_length
1823 1823
     );
1824 1824
     foreach ($rows as $record) {
1825 1825
         // Get itemKey from current user
1826 1826
         $currentUserKey = DB::queryFirstRow(
1827 1827
             'SELECT share_key, increment_id
1828
-            FROM ' . prefixTable('sharekeys_items') . '
1828
+            FROM ' . prefixTable('sharekeys_items').'
1829 1829
             WHERE object_id = %i AND user_id = %i',
1830 1830
             $record['id'],
1831 1831
             $_SESSION['user_id']
@@ -1853,7 +1853,7 @@  discard block
 block discarded – undo
1853 1853
             if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
1854 1854
                 $currentUserKey = DB::queryFirstRow(
1855 1855
                     'SELECT increment_id
1856
-                    FROM ' . prefixTable('sharekeys_items') . '
1856
+                    FROM ' . prefixTable('sharekeys_items').'
1857 1857
                     WHERE object_id = %i AND user_id = %i',
1858 1858
                     $record['id'],
1859 1859
                     $post_user_id
@@ -1886,7 +1886,7 @@  discard block
 block discarded – undo
1886 1886
     // SHould we change step?
1887 1887
     DB::query(
1888 1888
         'SELECT *
1889
-        FROM ' . prefixTable('items') . '
1889
+        FROM ' . prefixTable('items').'
1890 1890
         WHERE perso = 0'
1891 1891
     );
1892 1892
 
@@ -1910,15 +1910,15 @@  discard block
 block discarded – undo
1910 1910
     // Loop on logs
1911 1911
     $rows = DB::query(
1912 1912
         'SELECT increment_id
1913
-        FROM ' . prefixTable('log_items') . '
1913
+        FROM ' . prefixTable('log_items').'
1914 1914
         WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"
1915
-        LIMIT ' . $post_start . ', ' . $post_length
1915
+        LIMIT ' . $post_start.', '.$post_length
1916 1916
     );
1917 1917
     foreach ($rows as $record) {
1918 1918
         // Get itemKey from current user
1919 1919
         $currentUserKey = DB::queryFirstRow(
1920 1920
             'SELECT share_key
1921
-            FROM ' . prefixTable('sharekeys_logs') . '
1921
+            FROM ' . prefixTable('sharekeys_logs').'
1922 1922
             WHERE object_id = %i AND user_id = %i',
1923 1923
             $record['increment_id'],
1924 1924
             $_SESSION['user_id']
@@ -1945,7 +1945,7 @@  discard block
 block discarded – undo
1945 1945
             if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
1946 1946
                 $currentUserKey = DB::queryFirstRow(
1947 1947
                     'SELECT increment_id
1948
-                    FROM ' . prefixTable('sharekeys_items') . '
1948
+                    FROM ' . prefixTable('sharekeys_items').'
1949 1949
                     WHERE object_id = %i AND user_id = %i',
1950 1950
                     $record['id'],
1951 1951
                     $post_user_id
@@ -1967,7 +1967,7 @@  discard block
 block discarded – undo
1967 1967
     // SHould we change step?
1968 1968
     DB::query(
1969 1969
         'SELECT increment_id
1970
-        FROM ' . prefixTable('log_items') . '
1970
+        FROM ' . prefixTable('log_items').'
1971 1971
         WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"'
1972 1972
     );
1973 1973
 
@@ -1991,15 +1991,15 @@  discard block
 block discarded – undo
1991 1991
     // Loop on fields
1992 1992
     $rows = DB::query(
1993 1993
         'SELECT id
1994
-        FROM ' . prefixTable('categories_items') . '
1994
+        FROM ' . prefixTable('categories_items').'
1995 1995
         WHERE encryption_type = "teampass_aes"
1996
-        LIMIT ' . $post_start . ', ' . $post_length
1996
+        LIMIT ' . $post_start.', '.$post_length
1997 1997
     );
1998 1998
     foreach ($rows as $record) {
1999 1999
         // Get itemKey from current user
2000 2000
         $currentUserKey = DB::queryFirstRow(
2001 2001
             'SELECT share_key
2002
-            FROM ' . prefixTable('sharekeys_fields') . '
2002
+            FROM ' . prefixTable('sharekeys_fields').'
2003 2003
             WHERE object_id = %i AND user_id = %i',
2004 2004
             $record['id'],
2005 2005
             $_SESSION['user_id']
@@ -2026,7 +2026,7 @@  discard block
 block discarded – undo
2026 2026
             if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
2027 2027
                 $currentUserKey = DB::queryFirstRow(
2028 2028
                     'SELECT increment_id
2029
-                    FROM ' . prefixTable('sharekeys_items') . '
2029
+                    FROM ' . prefixTable('sharekeys_items').'
2030 2030
                     WHERE object_id = %i AND user_id = %i',
2031 2031
                     $record['id'],
2032 2032
                     $post_user_id
@@ -2048,7 +2048,7 @@  discard block
 block discarded – undo
2048 2048
     // SHould we change step?
2049 2049
     DB::query(
2050 2050
         'SELECT *
2051
-        FROM ' . prefixTable('categories_items') . '
2051
+        FROM ' . prefixTable('categories_items').'
2052 2052
         WHERE encryption_type = "teampass_aes"'
2053 2053
     );
2054 2054
 
@@ -2072,14 +2072,14 @@  discard block
 block discarded – undo
2072 2072
     // Loop on suggestions
2073 2073
     $rows = DB::query(
2074 2074
         'SELECT id
2075
-        FROM ' . prefixTable('suggestion') . '
2076
-        LIMIT ' . $post_start . ', ' . $post_length
2075
+        FROM ' . prefixTable('suggestion').'
2076
+        LIMIT ' . $post_start.', '.$post_length
2077 2077
     );
2078 2078
     foreach ($rows as $record) {
2079 2079
         // Get itemKey from current user
2080 2080
         $currentUserKey = DB::queryFirstRow(
2081 2081
             'SELECT share_key
2082
-            FROM ' . prefixTable('sharekeys_suggestions') . '
2082
+            FROM ' . prefixTable('sharekeys_suggestions').'
2083 2083
             WHERE object_id = %i AND user_id = %i',
2084 2084
             $record['id'],
2085 2085
             $_SESSION['user_id']
@@ -2106,7 +2106,7 @@  discard block
 block discarded – undo
2106 2106
             if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
2107 2107
                 $currentUserKey = DB::queryFirstRow(
2108 2108
                     'SELECT increment_id
2109
-                    FROM ' . prefixTable('sharekeys_items') . '
2109
+                    FROM ' . prefixTable('sharekeys_items').'
2110 2110
                     WHERE object_id = %i AND user_id = %i',
2111 2111
                     $record['id'],
2112 2112
                     $post_user_id
@@ -2151,15 +2151,15 @@  discard block
 block discarded – undo
2151 2151
     // Loop on files
2152 2152
     $rows = DB::query(
2153 2153
         'SELECT id
2154
-        FROM ' . prefixTable('files') . '
2155
-        WHERE status = "' . TP_ENCRYPTION_NAME . '"
2156
-        LIMIT ' . $post_start . ', ' . $post_length
2154
+        FROM ' . prefixTable('files').'
2155
+        WHERE status = "' . TP_ENCRYPTION_NAME.'"
2156
+        LIMIT ' . $post_start.', '.$post_length
2157 2157
     ); //aes_encryption
2158 2158
     foreach ($rows as $record) {
2159 2159
         // Get itemKey from current user
2160 2160
         $currentUserKey = DB::queryFirstRow(
2161 2161
             'SELECT share_key
2162
-            FROM ' . prefixTable('sharekeys_files') . '
2162
+            FROM ' . prefixTable('sharekeys_files').'
2163 2163
             WHERE object_id = %i AND user_id = %i',
2164 2164
             $record['id'],
2165 2165
             $_SESSION['user_id']
@@ -2186,7 +2186,7 @@  discard block
 block discarded – undo
2186 2186
             if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
2187 2187
                 $currentUserKey = DB::queryFirstRow(
2188 2188
                     'SELECT increment_id
2189
-                    FROM ' . prefixTable('sharekeys_items') . '
2189
+                    FROM ' . prefixTable('sharekeys_items').'
2190 2190
                     WHERE object_id = %i AND user_id = %i',
2191 2191
                     $record['id'],
2192 2192
                     $post_user_id
@@ -2208,8 +2208,8 @@  discard block
 block discarded – undo
2208 2208
     // SHould we change step?
2209 2209
     DB::query(
2210 2210
         'SELECT *
2211
-        FROM ' . prefixTable('files') . '
2212
-        WHERE status = "' . TP_ENCRYPTION_NAME . '"'
2211
+        FROM ' . prefixTable('files').'
2212
+        WHERE status = "' . TP_ENCRYPTION_NAME.'"'
2213 2213
     );
2214 2214
 
2215 2215
     $next_start = (int) $post_start + (int) $post_length;
@@ -2241,16 +2241,16 @@  discard block
 block discarded – undo
2241 2241
     if (count($_SESSION['personal_folders']) > 0) {
2242 2242
         $rows = DB::query(
2243 2243
             'SELECT id, pw
2244
-            FROM ' . prefixTable('items') . '
2244
+            FROM ' . prefixTable('items').'
2245 2245
             WHERE perso = 1 AND id_tree IN %ls
2246
-            LIMIT ' . $post_start . ', ' . $post_length,
2246
+            LIMIT ' . $post_start.', '.$post_length,
2247 2247
             $_SESSION['personal_folders']
2248 2248
         );
2249 2249
         foreach ($rows as $record) {
2250 2250
             // Get itemKey from current user
2251 2251
             $currentUserKey = DB::queryFirstRow(
2252 2252
                 'SELECT share_key, increment_id
2253
-                FROM ' . prefixTable('sharekeys_items') . '
2253
+                FROM ' . prefixTable('sharekeys_items').'
2254 2254
                 WHERE object_id = %i AND user_id = %i',
2255 2255
                 $record['id'],
2256 2256
                 $_SESSION['user_id']
@@ -2277,7 +2277,7 @@  discard block
 block discarded – undo
2277 2277
                 if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
2278 2278
                     $currentUserKey = DB::queryFirstRow(
2279 2279
                         'SELECT increment_id
2280
-                        FROM ' . prefixTable('sharekeys_items') . '
2280
+                        FROM ' . prefixTable('sharekeys_items').'
2281 2281
                         WHERE object_id = %i AND user_id = %i',
2282 2282
                         $record['id'],
2283 2283
                         $post_user_id
@@ -2300,7 +2300,7 @@  discard block
 block discarded – undo
2300 2300
     // SHould we change step?
2301 2301
     DB::query(
2302 2302
         'SELECT *
2303
-        FROM ' . prefixTable('items') . '
2303
+        FROM ' . prefixTable('items').'
2304 2304
         WHERE perso = 0'
2305 2305
     );
2306 2306
 
@@ -2324,7 +2324,7 @@  discard block
 block discarded – undo
2324 2324
         // Check if user exists
2325 2325
         $userInfo = DB::queryFirstRow(
2326 2326
             'SELECT public_key, encrypted_psk
2327
-            FROM ' . prefixTable('users') . '
2327
+            FROM ' . prefixTable('users').'
2328 2328
             WHERE id = %i',
2329 2329
             $post_user_id
2330 2330
         );
@@ -2349,9 +2349,9 @@  discard block
 block discarded – undo
2349 2349
                 // Loop on persoanl items
2350 2350
                 $rows = DB::query(
2351 2351
                     'SELECT id, pw
2352
-                    FROM ' . prefixTable('items') . '
2352
+                    FROM ' . prefixTable('items').'
2353 2353
                     WHERE perso = 1 AND id_tree IN %ls
2354
-                    LIMIT ' . $post_start . ', ' . $post_length,
2354
+                    LIMIT ' . $post_start.', '.$post_length,
2355 2355
                     $_SESSION['personal_folders']
2356 2356
                 );
2357 2357
                 $countUserPersonalItems = DB::count();
@@ -2394,7 +2394,7 @@  discard block
 block discarded – undo
2394 2394
                         // Loop on files
2395 2395
                         $rows = DB::query(
2396 2396
                             'SELECT id, file
2397
-                            FROM ' . prefixTable('files') . '
2397
+                            FROM ' . prefixTable('files').'
2398 2398
                             WHERE status != %s
2399 2399
                             AND id_item = %i',
2400 2400
                             TP_ENCRYPTION_NAME,
@@ -2405,14 +2405,14 @@  discard block
 block discarded – undo
2405 2405
                             // Now decrypt the file
2406 2406
                             prepareFileWithDefuse(
2407 2407
                                 'decrypt',
2408
-                                $SETTINGS['path_to_upload_folder'] . '/' . $record2['file'],
2409
-                                $SETTINGS['path_to_upload_folder'] . '/' . $record2['file'] . '.delete',
2408
+                                $SETTINGS['path_to_upload_folder'].'/'.$record2['file'],
2409
+                                $SETTINGS['path_to_upload_folder'].'/'.$record2['file'].'.delete',
2410 2410
                                 $SETTINGS,
2411 2411
                                 $post_user_psk
2412 2412
                             );
2413 2413
 
2414 2414
                             // Encrypt the file
2415
-                            $encryptedFile = encryptFile($record2['file'] . '.delete', $SETTINGS['path_to_upload_folder']);
2415
+                            $encryptedFile = encryptFile($record2['file'].'.delete', $SETTINGS['path_to_upload_folder']);
2416 2416
 
2417 2417
                             DB::update(
2418 2418
                                 prefixTable('files'),
@@ -2435,7 +2435,7 @@  discard block
 block discarded – undo
2435 2435
                             );
2436 2436
 
2437 2437
                             // Unlink original file
2438
-                            unlink($SETTINGS['path_to_upload_folder'] . '/' . $record2['file']);
2438
+                            unlink($SETTINGS['path_to_upload_folder'].'/'.$record2['file']);
2439 2439
                         }
2440 2440
                     }
2441 2441
                 }
@@ -2504,7 +2504,7 @@  discard block
 block discarded – undo
2504 2504
         // Get user info
2505 2505
         $userData = DB::queryFirstRow(
2506 2506
             'SELECT '.$post_fields.'
2507
-            FROM ' . prefixTable('users') . '
2507
+            FROM ' . prefixTable('users').'
2508 2508
             WHERE id = %i',
2509 2509
             $post_user_id
2510 2510
         );
@@ -2539,7 +2539,7 @@  discard block
 block discarded – undo
2539 2539
         // Get user info
2540 2540
         $userData = DB::queryFirstRow(
2541 2541
             'SELECT auth_type, login, private_key
2542
-            FROM ' . prefixTable('users') . '
2542
+            FROM ' . prefixTable('users').'
2543 2543
             WHERE id = %i',
2544 2544
             $post_user_id
2545 2545
         );
@@ -2550,7 +2550,7 @@  discard block
 block discarded – undo
2550 2550
             $privateKey = decryptPrivateKey($post_current_pwd, $userData['private_key']);
2551 2551
 
2552 2552
             // Load superGlobals
2553
-            include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2553
+            include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2554 2554
             $superGlobal = new protect\SuperGlobal\SuperGlobal();
2555 2555
 
2556 2556
             if ($superGlobal->get('private_key', 'SESSION', 'user') === $privateKey) {
@@ -2583,7 +2583,7 @@  discard block
 block discarded – undo
2583 2583
                 return prepareExchangedData(
2584 2584
                     array(
2585 2585
                         'error' => false,
2586
-                        'message' => langHdl('done'),'',
2586
+                        'message' => langHdl('done'), '',
2587 2587
                     ),
2588 2588
                     'encode'
2589 2589
                 );
@@ -2621,7 +2621,7 @@  discard block
 block discarded – undo
2621 2621
         // Get user info
2622 2622
         $userData = DB::queryFirstRow(
2623 2623
             'SELECT auth_type, login, private_key, special
2624
-            FROM ' . prefixTable('users') . '
2624
+            FROM ' . prefixTable('users').'
2625 2625
             WHERE id = %i',
2626 2626
             $post_user_id
2627 2627
         );
@@ -2651,14 +2651,14 @@  discard block
 block discarded – undo
2651 2651
                 );
2652 2652
 
2653 2653
                 // Load superGlobals
2654
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2654
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2655 2655
                 $superGlobal = new protect\SuperGlobal\SuperGlobal();
2656 2656
                 $superGlobal->put('private_key', $privateKey, 'SESSION', 'user');
2657 2657
 
2658 2658
                 return prepareExchangedData(
2659 2659
                     array(
2660 2660
                         'error' => false,
2661
-                        'message' => langHdl('done'),'',
2661
+                        'message' => langHdl('done'), '',
2662 2662
                     ),
2663 2663
                     'encode'
2664 2664
                 );
@@ -2682,14 +2682,14 @@  discard block
 block discarded – undo
2682 2682
             // Get one item
2683 2683
             $record = DB::queryFirstRow(
2684 2684
                 'SELECT id, pw
2685
-                FROM ' . prefixTable('items') . '
2685
+                FROM ' . prefixTable('items').'
2686 2686
                 WHERE perso = 0'
2687 2687
             );
2688 2688
 
2689 2689
             // Get itemKey from current user
2690 2690
             $currentUserKey = DB::queryFirstRow(
2691 2691
                 'SELECT share_key, increment_id
2692
-                FROM ' . prefixTable('sharekeys_items') . '
2692
+                FROM ' . prefixTable('sharekeys_items').'
2693 2693
                 WHERE object_id = %i AND user_id = %i',
2694 2694
                 $record['id'],
2695 2695
                 $post_user_id
@@ -2717,7 +2717,7 @@  discard block
 block discarded – undo
2717 2717
                     );
2718 2718
                     
2719 2719
                     // Load superGlobals
2720
-                    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2720
+                    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2721 2721
                     $superGlobal = new protect\SuperGlobal\SuperGlobal();
2722 2722
                     $superGlobal->put('private_key', $privateKey, 'SESSION', 'user');
2723 2723
 
@@ -2771,7 +2771,7 @@  discard block
 block discarded – undo
2771 2771
             $_SESSION['user_id']
2772 2772
         );
2773 2773
         // Return data
2774
-        return '[{"new_value":"' . $_SESSION['sessionDuration'] . '"}]';
2774
+        return '[{"new_value":"'.$_SESSION['sessionDuration'].'"}]';
2775 2775
     }
2776 2776
     
2777 2777
     return '[{"new_value":"expired"}]';
Please login to merge, or discard this patch.
sources/core.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -50,22 +50,22 @@  discard block
 block discarded – undo
50 50
     // Load AntiXSS
51 51
     include_once '../includes/libraries/voku/helper/AntiXSS.php';
52 52
     $antiXss = new voku\helper\AntiXSS();
53
-    if (! headers_sent()) {    //If headers not sent yet... then do php redirect
54
-        header('Location: ' . $antiXss->xss_clean($url));
53
+    if (!headers_sent()) {    //If headers not sent yet... then do php redirect
54
+        header('Location: '.$antiXss->xss_clean($url));
55 55
         exit;
56 56
     }
57 57
 
58 58
     //If headers are sent... do java redirect... if java disabled, do html redirect.
59 59
     echo '<script type="text/javascript">';
60
-    echo 'window.location.href="' . $antiXss->xss_clean($url) . '";';
60
+    echo 'window.location.href="'.$antiXss->xss_clean($url).'";';
61 61
     echo '</script>';
62 62
     echo '<noscript>';
63
-    echo '<meta http-equiv="refresh" content="0;url=' . $antiXss->xss_clean($url) . '" />';
63
+    echo '<meta http-equiv="refresh" content="0;url='.$antiXss->xss_clean($url).'" />';
64 64
     echo '</noscript>';
65 65
 }
66 66
 
67 67
 // Include files
68
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
68
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
69 69
 $superGlobal = new protect\SuperGlobal\SuperGlobal();
70 70
 // Prepare GET variables
71 71
 $server = [];
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     && isset($SETTINGS['enable_sts']) === true
89 89
     && (int) $SETTINGS['enable_sts'] === 1
90 90
 ) {
91
-    redirect('https://' . $server['http_host'] . $server['request_uri']);
91
+    redirect('https://'.$server['http_host'].$server['request_uri']);
92 92
 }
93 93
 
94 94
 // Load pwComplexity
@@ -113,11 +113,11 @@  discard block
 block discarded – undo
113 113
 // LOAD CPASSMAN SETTINGS
114 114
 if (
115 115
     isset($SETTINGS['cpassman_dir']) === true
116
-    && is_dir($SETTINGS['cpassman_dir'] . '/install') === true
116
+    && is_dir($SETTINGS['cpassman_dir'].'/install') === true
117 117
 ) {
118 118
     // Should we delete folder INSTALL?
119 119
     $row = DB::queryFirstRow(
120
-        'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type=%s AND intitule=%s',
120
+        'SELECT valeur FROM '.prefixTable('misc').' WHERE type=%s AND intitule=%s',
121 121
         'install',
122 122
         'clear_install_folder'
123 123
     );
@@ -135,11 +135,11 @@  discard block
 block discarded – undo
135 135
             if ($directories !== false) {
136 136
                 $files = array_diff($directories, ['.', '..']);
137 137
                 foreach ($files as $file) {
138
-                    if (is_dir($dir . '/' . $file)) {
139
-                        delTree($dir . '/' . $file);
138
+                    if (is_dir($dir.'/'.$file)) {
139
+                        delTree($dir.'/'.$file);
140 140
                     } else {
141 141
                         try {
142
-                            unlink($dir . '/' . $file);
142
+                            unlink($dir.'/'.$file);
143 143
                         } catch (Exception $e) {
144 144
                             // do nothing... php will ignore and continue
145 145
                         }
@@ -152,13 +152,13 @@  discard block
 block discarded – undo
152 152
             }
153 153
         }
154 154
 
155
-        if (is_dir($SETTINGS['cpassman_dir'] . '/install')) {
155
+        if (is_dir($SETTINGS['cpassman_dir'].'/install')) {
156 156
             // Set the permissions on the install directory and delete
157 157
             // is server Windows or Linux?
158 158
             if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
159
-                recursiveChmod($SETTINGS['cpassman_dir'] . '/install', 0755, 0440);
159
+                recursiveChmod($SETTINGS['cpassman_dir'].'/install', 0755, 0440);
160 160
             }
161
-            delTree($SETTINGS['cpassman_dir'] . '/install');
161
+            delTree($SETTINGS['cpassman_dir'].'/install');
162 162
         }
163 163
 
164 164
         // Delete temporary install table
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 // Load Languages stuff
177 177
 if (isset($languagesList) === false) {
178 178
     $languagesList = [];
179
-    $rows = DB::query('SELECT * FROM ' . prefixTable('languages') . ' GROUP BY name, label, code, flag, id ORDER BY name ASC');
179
+    $rows = DB::query('SELECT * FROM '.prefixTable('languages').' GROUP BY name, label, code, flag, id ORDER BY name ASC');
180 180
     foreach ($rows as $record) {
181 181
         array_push($languagesList, $record['name']);
182 182
         if (isset($_SESSION['user_language']) && $record['name'] === $_SESSION['user_language']) {
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 // CHECK IF SESSION EXISTS AND IF SESSION IS VALID
235 235
 if (empty($_SESSION['sessionDuration']) === false) {
236 236
     $dataSession = DB::queryFirstRow(
237
-        'SELECT key_tempo FROM ' . prefixTable('users') . ' WHERE id=%i',
237
+        'SELECT key_tempo FROM '.prefixTable('users').' WHERE id=%i',
238 238
         $_SESSION['user_id']
239 239
     );
240 240
 } else {
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
     && (isset($_SESSION['user_admin']) === true && $_SESSION['user_admin'] === 1)
299 299
 ) {
300 300
     $row = DB::queryFirstRow(
301
-        'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type=%s_type AND intitule=%s_intitule',
301
+        'SELECT valeur FROM '.prefixTable('misc').' WHERE type=%s_type AND intitule=%s_intitule',
302 302
         [
303 303
             'type' => 'admin',
304 304
             'intitule' => 'cpassman_version',
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 
359 359
         syslog(
360 360
             LOG_WARNING,
361
-            'Unlog user: ' . date('Y/m/d H:i:s') . " {$server['remote_addr']} ({$server['http_user_agent']})"
361
+            'Unlog user: '.date('Y/m/d H:i:s')." {$server['remote_addr']} ({$server['http_user_agent']})"
362 362
         );
363 363
         // erase session table
364 364
         $_SESSION = [];
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
 if (isset($_SESSION['user_id']) === true && empty($_SESSION['user_id']) === false) {
410 410
     // query on user
411 411
     $data = DB::queryfirstrow(
412
-        'SELECT login, admin, gestionnaire, can_manage_all_users, groupes_visibles, groupes_interdits, fonction_id, last_connexion FROM ' . prefixTable('users') . ' WHERE id=%i',
412
+        'SELECT login, admin, gestionnaire, can_manage_all_users, groupes_visibles, groupes_interdits, fonction_id, last_connexion FROM '.prefixTable('users').' WHERE id=%i',
413 413
         $_SESSION['user_id']
414 414
     );
415 415
     //Check if user has been deleted or unlogged
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
     $_SESSION['item_fields'] = [];
491 491
     $rows = DB::query(
492 492
         'SELECT *
493
-            FROM ' . prefixTable('categories') . '
493
+            FROM ' . prefixTable('categories').'
494 494
             WHERE level=%i',
495 495
         '0'
496 496
     );
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
         // get each field
500 500
         $rows2 = DB::query(
501 501
             'SELECT *
502
-            FROM ' . prefixTable('categories') . '
502
+            FROM ' . prefixTable('categories').'
503 503
             WHERE parent_id=%i
504 504
             ORDER BY `order` ASC',
505 505
             $record['id']
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
 if (
577 577
     isset($SETTINGS['roles_allowed_to_print']) === true
578 578
     && isset($_SESSION['user_roles']) === true
579
-    && (! isset($_SESSION['temporary']['user_can_printout']) || empty($_SESSION['temporary']['user_can_printout']))
579
+    && (!isset($_SESSION['temporary']['user_can_printout']) || empty($_SESSION['temporary']['user_can_printout']))
580 580
 ) {
581 581
     foreach (explode(';', $SETTINGS['roles_allowed_to_print']) as $role) {
582 582
         if (in_array($role, $_SESSION['user_roles']) === true) {
@@ -586,5 +586,5 @@  discard block
 block discarded – undo
586 586
 }
587 587
 
588 588
 /* CHECK NUMBER OF USER ONLINE */
589
-DB::query('SELECT * FROM ' . prefixTable('users') . ' WHERE timestamp>=%i', time() - 600);
589
+DB::query('SELECT * FROM '.prefixTable('users').' WHERE timestamp>=%i', time() - 600);
590 590
 $_SESSION['nb_users_online'] = DB::count();
Please login to merge, or discard this patch.
sources/admin.queries.php 1 patch
Spacing   +189 added lines, -189 removed lines patch added patch discarded remove patch
@@ -46,25 +46,25 @@  discard block
 block discarded – undo
46 46
 }
47 47
 
48 48
 /* do checks */
49
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
50
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
49
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
50
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
51 51
 if (!checkUser($_SESSION['user_id'], $_SESSION['key'], 'options', $SETTINGS)) {
52 52
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
53
-    include $SETTINGS['cpassman_dir'] . '/error.php';
53
+    include $SETTINGS['cpassman_dir'].'/error.php';
54 54
     exit;
55 55
 }
56 56
 
57
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
58
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
59
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php';
57
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
58
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
59
+require_once $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php';
60 60
 
61 61
 header('Content-type: text/html; charset=utf-8');
62 62
 header('Cache-Control: no-cache, no-store, must-revalidate');
63 63
 
64
-require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
64
+require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
65 65
 
66 66
 // connect to the server
67
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
67
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
68 68
 if (defined('DB_PASSWD_CLEAR') === false) {
69 69
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
70 70
 }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
                         array(
118 118
                             'http' => array(
119 119
                                 'ignore_errors' => true,
120
-                                'proxy' => $SETTINGS['proxy_ip'] . ':' . $SETTINGS['proxy_port'],
120
+                                'proxy' => $SETTINGS['proxy_ip'].':'.$SETTINGS['proxy_port'],
121 121
                             ),
122 122
                         )
123 123
                     );
@@ -136,16 +136,16 @@  discard block
 block discarded – undo
136 136
                     $json_array = json_decode($json, true);
137 137
 
138 138
                     // About version
139
-                    $text .= '<li><u>' . $LANG['your_version'] . '</u> : ' . TP_VERSION_FULL;
139
+                    $text .= '<li><u>'.$LANG['your_version'].'</u> : '.TP_VERSION_FULL;
140 140
                     if (floatval(TP_VERSION_FULL) < floatval($json_array['info']['version'])) {
141
-                        $text .= '&nbsp;&nbsp;<b>' . $LANG['please_update'] . '</b>';
141
+                        $text .= '&nbsp;&nbsp;<b>'.$LANG['please_update'].'</b>';
142 142
                     }
143 143
                     $text .= '</li>';
144 144
 
145 145
                     // Libraries
146 146
                     $text .= '<li><u>Libraries</u> :</li>';
147 147
                     foreach ($json_array['libraries'] as $key => $val) {
148
-                        $text .= "<li>&nbsp;<span class='fa fa-caret-right'></span>&nbsp;" . $key . " (<a href='" . $val . "' target='_blank'>" . $val . '</a>)</li>';
148
+                        $text .= "<li>&nbsp;<span class='fa fa-caret-right'></span>&nbsp;".$key." (<a href='".$val."' target='_blank'>".$val.'</a>)</li>';
149 149
                     }
150 150
                 }
151 151
             } else {
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
         }
157 157
         $text .= '</ul>';
158 158
 
159
-        echo '[{"error":"' . $error . '" , "output":"' . str_replace(array("\n", "\t", "\r"), '', $text) . '"}]';
159
+        echo '[{"error":"'.$error.'" , "output":"'.str_replace(array("\n", "\t", "\r"), '', $text).'"}]';
160 160
         break;
161 161
 
162 162
         //##########################################################
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
         //get through all users
189 189
         $rows = DB::query(
190 190
             'SELECT id, login, email
191
-            FROM ' . prefixTable('users') . '
191
+            FROM ' . prefixTable('users').'
192 192
             ORDER BY login ASC'
193 193
         );
194 194
         foreach ($rows as $record) {
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
             //if folder doesn't exist then create it
206 206
             $data = DB::queryfirstrow(
207 207
                 'SELECT id
208
-                FROM ' . prefixTable('nested_tree') . '
208
+                FROM ' . prefixTable('nested_tree').'
209 209
                 WHERE title = %s AND parent_id = %i',
210 210
                 $record['id'],
211 211
                 0
@@ -267,8 +267,8 @@  discard block
 block discarded – undo
267 267
         echo prepareExchangedData(
268 268
             array(
269 269
                 'error' => false,
270
-                'message' => langHdl('last_execution') . ' ' .
271
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
270
+                'message' => langHdl('last_execution').' '.
271
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
272 272
                     '<i class="fas fa-check text-success ml-2"></i>',
273 273
             ),
274 274
             'encode'
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
         }
303 303
 
304 304
         //Libraries call
305
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
305
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
306 306
 
307 307
         //init
308 308
         $foldersIds = array();
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
             }
317 317
         }
318 318
 
319
-        $items = DB::query('SELECT id,label FROM ' . prefixTable('items') . ' WHERE id_tree NOT IN %li', $foldersIds);
319
+        $items = DB::query('SELECT id,label FROM '.prefixTable('items').' WHERE id_tree NOT IN %li', $foldersIds);
320 320
         foreach ($items as $item) {
321 321
             //Delete item
322 322
             DB::DELETE(prefixTable('items'), 'id = %i', $item['id']);
@@ -337,12 +337,12 @@  discard block
 block discarded – undo
337 337
         // delete orphan items
338 338
         $rows = DB::query(
339 339
             'SELECT id
340
-            FROM ' . prefixTable('items') . '
340
+            FROM ' . prefixTable('items').'
341 341
             ORDER BY id ASC'
342 342
         );
343 343
         foreach ($rows as $item) {
344 344
             DB::query(
345
-                'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i AND action = %s',
345
+                'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i AND action = %s',
346 346
                 $item['id'],
347 347
                 'at_creation'
348 348
             );
@@ -372,11 +372,11 @@  discard block
 block discarded – undo
372 372
         echo prepareExchangedData(
373 373
             array(
374 374
                 'error' => false,
375
-                'message' => langHdl('last_execution') . ' ' .
376
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
375
+                'message' => langHdl('last_execution').' '.
376
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
377 377
                     '<i class="fas fa-check text-success ml-2 mr-3"></i>
378 378
                     <i class="fas fa-chevron-right mr-2"></i>' .
379
-                    $nbItemsDeleted . ' ' . langHdl('deleted_items'),
379
+                    $nbItemsDeleted.' '.langHdl('deleted_items'),
380 380
             ),
381 381
             'encode'
382 382
         );
@@ -408,21 +408,21 @@  discard block
 block discarded – undo
408 408
             break;
409 409
         }
410 410
 
411
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
411
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
412 412
         $return = '';
413 413
 
414 414
         //Get all tables
415 415
         $tables = array();
416 416
         $result = DB::query('SHOW TABLES');
417 417
         foreach ($result as $row) {
418
-            $tables[] = $row['Tables_in_' . $database];
418
+            $tables[] = $row['Tables_in_'.$database];
419 419
         }
420 420
 
421 421
         //cycle through
422 422
         foreach ($tables as $table) {
423 423
             if (defined('DB_PREFIX') || substr_count($table, DB_PREFIX) > 0) {
424 424
                 // Do query
425
-                $result = DB::queryRaw('SELECT * FROM ' . $table);
425
+                $result = DB::queryRaw('SELECT * FROM '.$table);
426 426
                 DB::queryRaw(
427 427
                     'SELECT *
428 428
                     FROM INFORMATION_SCHEMA.COLUMNS
@@ -434,19 +434,19 @@  discard block
 block discarded – undo
434 434
                 $numFields = DB::count();
435 435
 
436 436
                 // prepare a drop table
437
-                $return .= 'DROP TABLE ' . $table . ';';
438
-                $row2 = DB::queryfirstrow('SHOW CREATE TABLE ' . $table);
439
-                $return .= "\n\n" . $row2['Create Table'] . ";\n\n";
437
+                $return .= 'DROP TABLE '.$table.';';
438
+                $row2 = DB::queryfirstrow('SHOW CREATE TABLE '.$table);
439
+                $return .= "\n\n".$row2['Create Table'].";\n\n";
440 440
 
441 441
                 //prepare all fields and datas
442 442
                 for ($i = 0; $i < $numFields; ++$i) {
443 443
                     while ($row = $result->fetch_row()) {
444
-                        $return .= 'INSERT INTO ' . $table . ' VALUES(';
444
+                        $return .= 'INSERT INTO '.$table.' VALUES(';
445 445
                         for ($j = 0; $j < $numFields; ++$j) {
446 446
                             $row[$j] = addslashes($row[$j]);
447 447
                             $row[$j] = preg_replace("/\n/", '\\n', $row[$j]);
448 448
                             if (isset($row[$j])) {
449
-                                $return .= '"' . $row[$j] . '"';
449
+                                $return .= '"'.$row[$j].'"';
450 450
                             } else {
451 451
                                 $return .= 'NULL';
452 452
                             }
@@ -466,8 +466,8 @@  discard block
 block discarded – undo
466 466
             $token = GenerateCryptKey(20, false, true, true, false, true, $SETTINGS);
467 467
 
468 468
             //save file
469
-            $filename = time() . '-' . $token . '.sql';
470
-            $handle = fopen($SETTINGS['path_to_files_folder'] . '/' . $filename, 'w+');
469
+            $filename = time().'-'.$token.'.sql';
470
+            $handle = fopen($SETTINGS['path_to_files_folder'].'/'.$filename, 'w+');
471 471
             if ($handle !== false) {
472 472
                 //write file
473 473
                 fwrite($handle, $return);
@@ -479,17 +479,17 @@  discard block
 block discarded – undo
479 479
                 // Encrypt the file
480 480
                 prepareFileWithDefuse(
481 481
                     'encrypt',
482
-                    $SETTINGS['path_to_files_folder'] . '/' . $filename,
483
-                    $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
482
+                    $SETTINGS['path_to_files_folder'].'/'.$filename,
483
+                    $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
484 484
                     $SETTINGS,
485 485
                     $post_option
486 486
                 );
487 487
 
488 488
                 // Do clean
489
-                unlink($SETTINGS['path_to_files_folder'] . '/' . $filename);
489
+                unlink($SETTINGS['path_to_files_folder'].'/'.$filename);
490 490
                 rename(
491
-                    $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
492
-                    $SETTINGS['path_to_files_folder'] . '/' . $filename
491
+                    $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
492
+                    $SETTINGS['path_to_files_folder'].'/'.$filename
493 493
                 );
494 494
             }
495 495
 
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
             //update LOG
500 500
             logEvents($SETTINGS, 'admin_action', 'dataBase backup', (string) $_SESSION['user_id'], $_SESSION['login']);
501 501
 
502
-            echo '[{"result":"db_backup" , "href":"sources/downloadFile.php?name=' . urlencode($filename) . '&sub=files&file=' . $filename . '&type=sql&key=' . $_SESSION['key'] . '&key_tmp=' . $_SESSION['key_tmp'] . '&pathIsFiles=1"}]';
502
+            echo '[{"result":"db_backup" , "href":"sources/downloadFile.php?name='.urlencode($filename).'&sub=files&file='.$filename.'&type=sql&key='.$_SESSION['key'].'&key_tmp='.$_SESSION['key_tmp'].'&pathIsFiles=1"}]';
503 503
         }
504 504
         break;
505 505
 
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
             );
529 529
             break;
530 530
         }
531
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
531
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
532 532
 
533 533
         $dataPost = explode('&', $post_option);
534 534
         $file = htmlspecialchars($dataPost[0]);
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
         // Get filename from database
538 538
         $data = DB::queryFirstRow(
539 539
             'SELECT valeur
540
-            FROM ' . prefixTable('misc') . '
540
+            FROM ' . prefixTable('misc').'
541 541
             WHERE increment_id = %i',
542 542
             $file
543 543
         );
@@ -556,22 +556,22 @@  discard block
 block discarded – undo
556 556
             // Decrypt the file
557 557
             $ret = prepareFileWithDefuse(
558 558
                 'decrypt',
559
-                $SETTINGS['path_to_files_folder'] . '/' . $file,
560
-                $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $file,
559
+                $SETTINGS['path_to_files_folder'].'/'.$file,
560
+                $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$file,
561 561
                 $SETTINGS,
562 562
                 $key
563 563
             );
564 564
 
565 565
             if (empty($ret) === false) {
566
-                echo '[{"result":"db_restore" , "message":"' . $ret . '"}]';
566
+                echo '[{"result":"db_restore" , "message":"'.$ret.'"}]';
567 567
                 break;
568 568
             }
569 569
 
570 570
             // Do clean
571
-            fileDelete($SETTINGS['path_to_files_folder'] . '/' . $file, $SETTINGS);
572
-            $file = $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $file;
571
+            fileDelete($SETTINGS['path_to_files_folder'].'/'.$file, $SETTINGS);
572
+            $file = $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$file;
573 573
         } else {
574
-            $file = $SETTINGS['path_to_files_folder'] . '/' . $file;
574
+            $file = $SETTINGS['path_to_files_folder'].'/'.$file;
575 575
         }
576 576
 
577 577
         //read sql file
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
         fclose($handle);
589 589
 
590 590
         //delete file
591
-        unlink($SETTINGS['path_to_files_folder'] . '/' . $file);
591
+        unlink($SETTINGS['path_to_files_folder'].'/'.$file);
592 592
 
593 593
         //Show done
594 594
         echo '[{"result":"db_restore" , "message":""}]';
@@ -626,8 +626,8 @@  discard block
 block discarded – undo
626 626
             foreach ($table as $i => $tablename) {
627 627
                 if (substr_count($tablename, DB_PREFIX) > 0) {
628 628
                     // launch optimization quieries
629
-                    DB::query('ANALYZE TABLE `' . $tablename . '`');
630
-                    DB::query('OPTIMIZE TABLE `' . $tablename . '`');
629
+                    DB::query('ANALYZE TABLE `'.$tablename.'`');
630
+                    DB::query('OPTIMIZE TABLE `'.$tablename.'`');
631 631
                 }
632 632
             }
633 633
         }
@@ -635,12 +635,12 @@  discard block
 block discarded – undo
635 635
         //Clean up LOG_ITEMS table
636 636
         $rows = DB::query(
637 637
             'SELECT id
638
-            FROM ' . prefixTable('items') . '
638
+            FROM ' . prefixTable('items').'
639 639
             ORDER BY id ASC'
640 640
         );
641 641
         foreach ($rows as $item) {
642 642
             DB::query(
643
-                'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i AND action = %s',
643
+                'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i AND action = %s',
644 644
                 $item['id'],
645 645
                 'at_creation'
646 646
             );
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
             if ($counter === 0) {
649 649
                 //Create new at_creation entry
650 650
                 $rowTmp = DB::queryFirstRow(
651
-                    'SELECT date, id_user FROM ' . prefixTable('log_items') . ' WHERE id_item=%i ORDER BY date ASC',
651
+                    'SELECT date, id_user FROM '.prefixTable('log_items').' WHERE id_item=%i ORDER BY date ASC',
652 652
                     $item['id']
653 653
                 );
654 654
                 DB::insert(
@@ -678,8 +678,8 @@  discard block
 block discarded – undo
678 678
         echo prepareExchangedData(
679 679
             array(
680 680
                 'error' => false,
681
-                'message' => langHdl('last_execution') . ' ' .
682
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
681
+                'message' => langHdl('last_execution').' '.
682
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
683 683
                     '<i class="fas fa-check text-success ml-2"></i>',
684 684
             ),
685 685
             'encode'
@@ -712,14 +712,14 @@  discard block
 block discarded – undo
712 712
             break;
713 713
         }
714 714
 
715
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
715
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
716 716
 
717 717
         //read folder
718 718
         if (is_dir($SETTINGS['path_to_files_folder']) === false) {
719 719
             echo prepareExchangedData(
720 720
                 array(
721 721
                     'error' => true,
722
-                    'message' => langHdl('file_folder_not_accessible') . ": " . $SETTINGS['path_to_files_folder'],
722
+                    'message' => langHdl('file_folder_not_accessible').": ".$SETTINGS['path_to_files_folder'],
723 723
                 ),
724 724
                 'encode'
725 725
             );
@@ -731,8 +731,8 @@  discard block
 block discarded – undo
731 731
             //delete file FILES
732 732
             while (false !== ($f = readdir($dir))) {
733 733
                 if ($f !== '.' && $f !== '..' && $f !== '.htaccess') {
734
-                    if (file_exists($dir . $f) && ((time() - filectime($dir . $f)) > 604800)) {
735
-                        fileDelete($dir . '/' . $f, $SETTINGS);
734
+                    if (file_exists($dir.$f) && ((time() - filectime($dir.$f)) > 604800)) {
735
+                        fileDelete($dir.'/'.$f, $SETTINGS);
736 736
                     }
737 737
                 }
738 738
             }
@@ -746,7 +746,7 @@  discard block
 block discarded – undo
746 746
             echo prepareExchangedData(
747 747
                 array(
748 748
                     'error' => true,
749
-                    'message' => langHdl('file_folder_not_accessible') . ": " . $SETTINGS['path_to_upload_folder'],
749
+                    'message' => langHdl('file_folder_not_accessible').": ".$SETTINGS['path_to_upload_folder'],
750 750
                 ),
751 751
                 'encode'
752 752
             );
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
             while (false !== ($f = readdir($dir))) {
761 761
                 if ($f !== '.' && $f !== '..') {
762 762
                     if (strpos($f, '_delete.') > 0) {
763
-                        fileDelete($SETTINGS['path_to_upload_folder'] . '/' . $f, $SETTINGS);
763
+                        fileDelete($SETTINGS['path_to_upload_folder'].'/'.$f, $SETTINGS);
764 764
                     }
765 765
                 }
766 766
             }
@@ -782,11 +782,11 @@  discard block
 block discarded – undo
782 782
         echo prepareExchangedData(
783 783
             array(
784 784
                 'error' => false,
785
-                'message' => langHdl('last_execution') . ' ' .
786
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
785
+                'message' => langHdl('last_execution').' '.
786
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
787 787
                     '<i class="fas fa-check text-success ml-2 mr-3"></i>
788 788
                     <i class="fas fa-chevron-right mr-2"></i>' .
789
-                    $nbItemsDeleted . ' ' . langHdl('deleted_items'),
789
+                    $nbItemsDeleted.' '.langHdl('deleted_items'),
790 790
             ),
791 791
             'encode'
792 792
         );
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
             break;
820 820
         }
821 821
 
822
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
822
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
823 823
         updateCacheTable('reload', $SETTINGS, NULL);
824 824
 
825 825
         // Log
@@ -835,8 +835,8 @@  discard block
 block discarded – undo
835 835
         echo prepareExchangedData(
836 836
             [
837 837
                 'error' => false,
838
-                'message' => langHdl('last_execution') . ' ' .
839
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
838
+                'message' => langHdl('last_execution').' '.
839
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
840 840
                     '<i class="fas fa-check text-success mr-2"></i>',
841 841
             ],
842 842
             'encode'
@@ -871,7 +871,7 @@  discard block
 block discarded – undo
871 871
         }
872 872
 
873 873
         // Perform
874
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
874
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
875 875
         $ret = handleConfigFile('rebuild', $SETTINGS);
876 876
 
877 877
         // Log
@@ -898,8 +898,8 @@  discard block
 block discarded – undo
898 898
         echo prepareExchangedData(
899 899
             array(
900 900
                 'error' => false,
901
-                'message' => langHdl('last_execution') . ' ' .
902
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
901
+                'message' => langHdl('last_execution').' '.
902
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
903 903
                     '<i class="fas fa-check text-success ml-2"></i>',
904 904
             ),
905 905
             'encode'
@@ -939,33 +939,33 @@  discard block
 block discarded – undo
939 939
         $filename = $post_option;
940 940
         $tp_settings = [];
941 941
         //get backups infos
942
-        $rows = DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s', 'admin');
942
+        $rows = DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s', 'admin');
943 943
         foreach ($rows as $record) {
944 944
             $tp_settings[$record['intitule']] = $record['valeur'];
945 945
         }
946 946
 
947 947
         // check if backup file is in DB.
948 948
         // If YES then it is encrypted with DEFUSE
949
-        $bck = DB::queryFirstRow('SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'backup', 'filename');
949
+        $bck = DB::queryFirstRow('SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'backup', 'filename');
950 950
 
951 951
         //read file
952 952
         $return = '';
953
-        $Fnm = $tp_settings['bck_script_path'] . '/' . $filename . '.sql';
953
+        $Fnm = $tp_settings['bck_script_path'].'/'.$filename.'.sql';
954 954
         if (file_exists($Fnm)) {
955 955
             if (!empty($bck) && $bck['valeur'] === $filename) {
956 956
                 $err = '';
957 957
 
958 958
                 // it means that file is DEFUSE encrypted
959
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Crypto.php';
960
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/DerivedKeys.php';
961
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/KeyOrPassword.php';
962
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/File.php';
963
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Core.php';
959
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Crypto.php';
960
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/DerivedKeys.php';
961
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/KeyOrPassword.php';
962
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/File.php';
963
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Core.php';
964 964
 
965 965
                 try {
966 966
                     \Defuse\Crypto\File::decryptFileWithPassword(
967
-                        $SETTINGS['bck_script_path'] . '/' . $post_option . '.sql',
968
-                        $SETTINGS['bck_script_path'] . '/' . str_replace('encrypted', 'clear', $filename) . '.sql',
967
+                        $SETTINGS['bck_script_path'].'/'.$post_option.'.sql',
968
+                        $SETTINGS['bck_script_path'].'/'.str_replace('encrypted', 'clear', $filename).'.sql',
969 969
                         base64_decode($SETTINGS['bck_script_key'])
970 970
                     );
971 971
                 } catch (Defuse\Crypto\Exception\WrongKeyOrModifiedCiphertextException $ex) {
@@ -973,7 +973,7 @@  discard block
 block discarded – undo
973 973
                 }
974 974
 
975 975
                 if (!empty($err)) {
976
-                    echo '[{ "result":"backup_decrypt_fails" , "msg":"' . $err . '"}]';
976
+                    echo '[{ "result":"backup_decrypt_fails" , "msg":"'.$err.'"}]';
977 977
                     break;
978 978
                 }
979 979
             } else {
@@ -995,19 +995,19 @@  discard block
 block discarded – undo
995 995
                 );
996 996
 
997 997
                 //save the file
998
-                $handle = fopen($tp_settings['bck_script_path'] . '/' . $filename . '.clear.sql', 'w+');
998
+                $handle = fopen($tp_settings['bck_script_path'].'/'.$filename.'.clear.sql', 'w+');
999 999
                 if ($handle !== false) {
1000 1000
                     fwrite($handle, $return);
1001 1001
                     fclose($handle);
1002 1002
                 }
1003 1003
             }
1004 1004
             $result = 'backup_decrypt_success';
1005
-            $msg = $tp_settings['bck_script_path'] . '/' . $filename . '.clear.sql';
1005
+            $msg = $tp_settings['bck_script_path'].'/'.$filename.'.clear.sql';
1006 1006
         } else {
1007 1007
             $result = 'backup_decrypt_fails';
1008
-            $msg = 'File not found: ' . $Fnm;
1008
+            $msg = 'File not found: '.$Fnm;
1009 1009
         }
1010
-        echo '[{ "result":"' . $result . '" , "msg":"' . $msg . '"}]';
1010
+        echo '[{ "result":"'.$result.'" , "msg":"'.$msg.'"}]';
1011 1011
         break;
1012 1012
 
1013 1013
         /*
@@ -1041,22 +1041,22 @@  discard block
 block discarded – undo
1041 1041
         require_once 'main.functions.php';
1042 1042
 
1043 1043
         // store old sk
1044
-        $_SESSION['reencrypt_old_salt'] = file_get_contents(SECUREPATH . '/teampass-seckey.txt');
1044
+        $_SESSION['reencrypt_old_salt'] = file_get_contents(SECUREPATH.'/teampass-seckey.txt');
1045 1045
 
1046 1046
         // generate new saltkey
1047
-        $old_sk_filename = SECUREPATH . '/teampass-seckey.txt.' . date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))) . '.' . time();
1047
+        $old_sk_filename = SECUREPATH.'/teampass-seckey.txt.'.date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))).'.'.time();
1048 1048
         copy(
1049
-            SECUREPATH . '/teampass-seckey.txt',
1049
+            SECUREPATH.'/teampass-seckey.txt',
1050 1050
             $old_sk_filename
1051 1051
         );
1052 1052
         $new_key = defuse_generate_key();
1053 1053
         file_put_contents(
1054
-            SECUREPATH . '/teampass-seckey.txt',
1054
+            SECUREPATH.'/teampass-seckey.txt',
1055 1055
             $new_key
1056 1056
         );
1057 1057
 
1058 1058
         // store new sk
1059
-        $_SESSION['reencrypt_new_salt'] = file_get_contents(SECUREPATH . '/teampass-seckey.txt');
1059
+        $_SESSION['reencrypt_new_salt'] = file_get_contents(SECUREPATH.'/teampass-seckey.txt');
1060 1060
 
1061 1061
         //put tool in maintenance.
1062 1062
         DB::update(
@@ -1072,13 +1072,13 @@  discard block
 block discarded – undo
1072 1072
         logEvents($SETTINGS, 'system', 'change_salt_key', (string) $_SESSION['user_id'], $_SESSION['login']);
1073 1073
 
1074 1074
         // get number of items to change
1075
-        DB::query('SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i', 0);
1075
+        DB::query('SELECT id FROM '.prefixTable('items').' WHERE perso = %i', 0);
1076 1076
         $nb_of_items = DB::count();
1077 1077
 
1078 1078
         // create backup table
1079
-        DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
1079
+        DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup'));
1080 1080
         DB::query(
1081
-            'CREATE TABLE `' . prefixTable('sk_reencrypt_backup') . '` (
1081
+            'CREATE TABLE `'.prefixTable('sk_reencrypt_backup').'` (
1082 1082
             `id` int(12) NOT null AUTO_INCREMENT,
1083 1083
             `current_table` varchar(100) NOT NULL,
1084 1084
             `current_field` varchar(500) NOT NULL,
@@ -1106,7 +1106,7 @@  discard block
 block discarded – undo
1106 1106
         );
1107 1107
 
1108 1108
         // delete previous backup files
1109
-        $files = glob($SETTINGS['path_to_upload_folder'] . '/*'); // get all file names
1109
+        $files = glob($SETTINGS['path_to_upload_folder'].'/*'); // get all file names
1110 1110
         foreach ($files as $file) { // iterate files
1111 1111
             if (is_file($file)) {
1112 1112
                 $file_parts = pathinfo($file);
@@ -1188,7 +1188,7 @@  discard block
 block discarded – undo
1188 1188
                 echo prepareExchangedData(
1189 1189
                     array(
1190 1190
                         'error' => true,
1191
-                        'message' => 'Input `' . $objects[0] . '` is not allowed',
1191
+                        'message' => 'Input `'.$objects[0].'` is not allowed',
1192 1192
                         'nbOfItems' => '',
1193 1193
                         'nextAction' => '',
1194 1194
                     ),
@@ -1201,9 +1201,9 @@  discard block
 block discarded – undo
1201 1201
                 //change all encrypted data in Items (passwords)
1202 1202
                 $rows = DB::query(
1203 1203
                     'SELECT id, pw, pw_iv
1204
-                    FROM ' . prefixTable('items') . '
1204
+                    FROM ' . prefixTable('items').'
1205 1205
                     WHERE perso = %s
1206
-                    LIMIT ' . $post_start . ', ' . $post_length,
1206
+                    LIMIT ' . $post_start.', '.$post_length,
1207 1207
                     '0'
1208 1208
                 );
1209 1209
                 foreach ($rows as $record) {
@@ -1215,7 +1215,7 @@  discard block
 block discarded – undo
1215 1215
                             'current_field' => 'pw',
1216 1216
                             'value_id' => $record['id'],
1217 1217
                             'value' => $record['pw'],
1218
-                            'current_sql' => 'UPDATE ' . prefixTable('items') . " SET pw = '" . $record['pw'] . "' WHERE id = '" . $record['id'] . "';",
1218
+                            'current_sql' => 'UPDATE '.prefixTable('items')." SET pw = '".$record['pw']."' WHERE id = '".$record['id']."';",
1219 1219
                             'value2' => 'none',
1220 1220
                             'result' => 'none',
1221 1221
                         )
@@ -1264,9 +1264,9 @@  discard block
 block discarded – undo
1264 1264
                 //change all encrypted data in Logs (passwords)
1265 1265
                 $rows = DB::query(
1266 1266
                     'SELECT raison, increment_id
1267
-                    FROM ' . prefixTable('log_items') . "
1267
+                    FROM ' . prefixTable('log_items')."
1268 1268
                     WHERE action = %s AND raison LIKE 'at_pw :%'
1269
-                    LIMIT " . $post_start . ', ' . $post_length,
1269
+                    LIMIT " . $post_start.', '.$post_length,
1270 1270
                     'at_modification'
1271 1271
                 );
1272 1272
                 foreach ($rows as $record) {
@@ -1278,7 +1278,7 @@  discard block
 block discarded – undo
1278 1278
                             'current_field' => 'raison',
1279 1279
                             'value_id' => $record['increment_id'],
1280 1280
                             'value' => $record['raison'],
1281
-                            'current_sql' => 'UPDATE ' . prefixTable('log_items') . " SET raison = '" . $record['raison'] . "' WHERE increment_id = '" . $record['increment_id'] . "';",
1281
+                            'current_sql' => 'UPDATE '.prefixTable('log_items')." SET raison = '".$record['raison']."' WHERE increment_id = '".$record['increment_id']."';",
1282 1282
                             'value2' => 'none',
1283 1283
                             'result' => 'none',
1284 1284
                         )
@@ -1306,7 +1306,7 @@  discard block
 block discarded – undo
1306 1306
                         DB::update(
1307 1307
                             prefixTable('log_items'),
1308 1308
                             array(
1309
-                                'raison' => 'at_pw :' . $encrypt['string'],
1309
+                                'raison' => 'at_pw :'.$encrypt['string'],
1310 1310
                                 'encryption_type' => 'defuse',
1311 1311
                             ),
1312 1312
                             'increment_id = %i',
@@ -1331,8 +1331,8 @@  discard block
 block discarded – undo
1331 1331
                 //change all encrypted data in CATEGORIES (passwords)
1332 1332
                 $rows = DB::query(
1333 1333
                     'SELECT id, data
1334
-                    FROM ' . prefixTable('categories_items') . '
1335
-                    LIMIT ' . $post_start . ', ' . $post_length
1334
+                    FROM ' . prefixTable('categories_items').'
1335
+                    LIMIT ' . $post_start.', '.$post_length
1336 1336
                 );
1337 1337
                 foreach ($rows as $record) {
1338 1338
                     // backup data
@@ -1343,7 +1343,7 @@  discard block
 block discarded – undo
1343 1343
                             'current_field' => 'data',
1344 1344
                             'value_id' => $record['id'],
1345 1345
                             'value' => $record['data'],
1346
-                            'current_sql' => 'UPDATE ' . prefixTable('categories_items') . " SET data = '" . $record['data'] . "' WHERE id = '" . $record['id'] . "';",
1346
+                            'current_sql' => 'UPDATE '.prefixTable('categories_items')." SET data = '".$record['data']."' WHERE id = '".$record['id']."';",
1347 1347
                             'value2' => 'none',
1348 1348
                             'result' => 'none',
1349 1349
                         )
@@ -1391,9 +1391,9 @@  discard block
 block discarded – undo
1391 1391
                 // Change all encrypted data in FILES (passwords)
1392 1392
                 $rows = DB::query(
1393 1393
                     'SELECT id, file, status
1394
-                    FROM ' . prefixTable('files') . "
1394
+                    FROM ' . prefixTable('files')."
1395 1395
                     WHERE status = 'encrypted'
1396
-                    LIMIT " . $post_start . ', ' . $post_length
1396
+                    LIMIT " . $post_start.', '.$post_length
1397 1397
                 );
1398 1398
                 foreach ($rows as $record) {
1399 1399
                     // backup data
@@ -1411,20 +1411,20 @@  discard block
 block discarded – undo
1411 1411
                     );
1412 1412
                     $newID = DB::insertId();
1413 1413
 
1414
-                    if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['file'])) {
1414
+                    if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['file'])) {
1415 1415
                         // make a copy of file
1416 1416
                         if (!copy(
1417
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
1418
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '.copy'
1417
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
1418
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'.copy'
1419 1419
                         )) {
1420 1420
                             $error = 'Copy not possible';
1421 1421
                             exit;
1422 1422
                         } else {
1423 1423
                             // prepare a bck of file (that will not be deleted)
1424
-                            $backup_filename = $record['file'] . '.bck-change-sk.' . time();
1424
+                            $backup_filename = $record['file'].'.bck-change-sk.'.time();
1425 1425
                             copy(
1426
-                                $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
1427
-                                $SETTINGS['path_to_upload_folder'] . '/' . $backup_filename
1426
+                                $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
1427
+                                $SETTINGS['path_to_upload_folder'].'/'.$backup_filename
1428 1428
                             );
1429 1429
                         }
1430 1430
 
@@ -1432,24 +1432,24 @@  discard block
 block discarded – undo
1432 1432
                         // STEP1 - Do decryption
1433 1433
                         prepareFileWithDefuse(
1434 1434
                             'decrypt',
1435
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
1436
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted',
1435
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
1436
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted',
1437 1437
                             $SETTINGS
1438 1438
                         );
1439 1439
 
1440 1440
                         // Do cleanup of files
1441
-                        unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['file']);
1441
+                        unlink($SETTINGS['path_to_upload_folder'].'/'.$record['file']);
1442 1442
 
1443 1443
                         // STEP2 - Do encryption
1444 1444
                         prepareFileWithDefuse(
1445 1445
                             'encryp',
1446
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted',
1447
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
1446
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted',
1447
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
1448 1448
                             $SETTINGS
1449 1449
                         );
1450 1450
 
1451 1451
                         // Do cleanup of files
1452
-                        unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted');
1452
+                        unlink($SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted');
1453 1453
 
1454 1454
                         // Update backup table
1455 1455
                         DB::update(
@@ -1475,13 +1475,13 @@  discard block
 block discarded – undo
1475 1475
                 // do some things for new object
1476 1476
                 if (isset($objects[0])) {
1477 1477
                     if ($objects[0] === 'logs') {
1478
-                        DB::query('SELECT increment_id FROM ' . prefixTable('log_items') . " WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
1478
+                        DB::query('SELECT increment_id FROM '.prefixTable('log_items')." WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
1479 1479
                     } elseif ($objects[0] === 'files') {
1480
-                        DB::query('SELECT id FROM ' . prefixTable('files'));
1480
+                        DB::query('SELECT id FROM '.prefixTable('files'));
1481 1481
                     } elseif ($objects[0] === 'categories') {
1482
-                        DB::query('SELECT id FROM ' . prefixTable('categories_items'));
1482
+                        DB::query('SELECT id FROM '.prefixTable('categories_items'));
1483 1483
                     } elseif ($objects[0] === 'custfields') {
1484
-                        DB::query('SELECT raison FROM ' . prefixTable('log_items') . " WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
1484
+                        DB::query('SELECT raison FROM '.prefixTable('log_items')." WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
1485 1485
                     }
1486 1486
                     $nb_of_items = DB::count();
1487 1487
                 } else {
@@ -1600,12 +1600,12 @@  discard block
 block discarded – undo
1600 1600
                 );
1601 1601
             } elseif ($record['current_table'] === 'files') {
1602 1602
                 // restore backup file
1603
-                if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value'])) {
1604
-                    unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['value']);
1605
-                    if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value2'])) {
1603
+                if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value'])) {
1604
+                    unlink($SETTINGS['path_to_upload_folder'].'/'.$record['value']);
1605
+                    if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value2'])) {
1606 1606
                         rename(
1607
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['value2'],
1608
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['value']
1607
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['value2'],
1608
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['value']
1609 1609
                         );
1610 1610
                     }
1611 1611
                 }
@@ -1616,15 +1616,15 @@  discard block
 block discarded – undo
1616 1616
 
1617 1617
         // restore saltkey file
1618 1618
         if (file_exists($previous_saltkey_filename)) {
1619
-            unlink(SECUREPATH . '/teampass-seckey.txt');
1619
+            unlink(SECUREPATH.'/teampass-seckey.txt');
1620 1620
             rename(
1621 1621
                 $previous_saltkey_filename,
1622
-                SECUREPATH . '/teampass-seckey.txt'
1622
+                SECUREPATH.'/teampass-seckey.txt'
1623 1623
             );
1624 1624
         }
1625 1625
 
1626 1626
         // drop table
1627
-        DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
1627
+        DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup'));
1628 1628
 
1629 1629
         // Send back
1630 1630
         echo prepareExchangedData(
@@ -1667,17 +1667,17 @@  discard block
 block discarded – undo
1667 1667
         // delete files
1668 1668
         $rows = DB::query(
1669 1669
             'SELECT value, value2
1670
-            FROM ' . prefixTable('sk_reencrypt_backup') . "
1670
+            FROM ' . prefixTable('sk_reencrypt_backup')."
1671 1671
             WHERE current_table = 'files'"
1672 1672
         );
1673 1673
         foreach ($rows as $record) {
1674
-            if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value2'])) {
1675
-                unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['value2']);
1674
+            if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value2'])) {
1675
+                unlink($SETTINGS['path_to_upload_folder'].'/'.$record['value2']);
1676 1676
             }
1677 1677
         }
1678 1678
 
1679 1679
         // drop table
1680
-        DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
1680
+        DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup'));
1681 1681
 
1682 1682
         echo '[{"status":"done"}]';
1683 1683
         break;
@@ -1709,7 +1709,7 @@  discard block
 block discarded – undo
1709 1709
             );
1710 1710
             break;
1711 1711
         } else {
1712
-            require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1712
+            require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1713 1713
 
1714 1714
             //send email
1715 1715
             sendEmail(
@@ -1745,11 +1745,11 @@  discard block
 block discarded – undo
1745 1745
             break;
1746 1746
         }
1747 1747
 
1748
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1748
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1749 1749
 
1750 1750
         $rows = DB::query(
1751 1751
             'SELECT *
1752
-            FROM ' . prefixTable('emails') . '
1752
+            FROM ' . prefixTable('emails').'
1753 1753
             WHERE status = %s OR status = %s',
1754 1754
             'not_sent',
1755 1755
             ''
@@ -1834,9 +1834,9 @@  discard block
 block discarded – undo
1834 1834
             break;
1835 1835
         }
1836 1836
 
1837
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1837
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1838 1838
 
1839
-        $rows = DB::query('SELECT * FROM ' . prefixTable('emails') . ' WHERE status = %s OR status = %s', 'not_sent', '');
1839
+        $rows = DB::query('SELECT * FROM '.prefixTable('emails').' WHERE status = %s OR status = %s', 'not_sent', '');
1840 1840
         foreach ($rows as $record) {
1841 1841
             //send email
1842 1842
             $ret = json_decode(
@@ -1904,7 +1904,7 @@  discard block
 block discarded – undo
1904 1904
             break;
1905 1905
         }
1906 1906
 
1907
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1907
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1908 1908
 
1909 1909
         // init
1910 1910
         $filesList = array();
@@ -1917,7 +1917,7 @@  discard block
 block discarded – undo
1917 1917
                 FROM ' . prefixTable('files')
1918 1918
             );
1919 1919
             foreach ($rows as $record) {
1920
-                if (is_file($SETTINGS['path_to_upload_folder'] . '/' . $record['file'])) {
1920
+                if (is_file($SETTINGS['path_to_upload_folder'].'/'.$record['file'])) {
1921 1921
                     $addFile = false;
1922 1922
                     if (($post_option === 'attachments-decrypt' && $record['status'] === 'encrypted')
1923 1923
                         || ($post_option === 'attachments-encrypt' && $record['status'] === 'clear')
@@ -1982,8 +1982,8 @@  discard block
 block discarded – undo
1982 1982
         $post_list = filter_var_array($post_list, FILTER_SANITIZE_STRING);
1983 1983
         $post_counter = filter_var($post_counter, FILTER_SANITIZE_NUMBER_INT);
1984 1984
 
1985
-        include $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
1986
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1985
+        include $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
1986
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1987 1987
 
1988 1988
         $cpt = 0;
1989 1989
         $continu = true;
@@ -1991,15 +1991,15 @@  discard block
 block discarded – undo
1991 1991
         $message = '';
1992 1992
 
1993 1993
         // load PhpEncryption library
1994
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Crypto.php';
1995
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Encoding.php';
1996
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/DerivedKeys.php';
1997
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Key.php';
1998
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/KeyOrPassword.php';
1999
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/File.php';
2000
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/RuntimeTests.php';
2001
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/KeyProtectedByPassword.php';
2002
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Core.php';
1994
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Crypto.php';
1995
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Encoding.php';
1996
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/DerivedKeys.php';
1997
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Key.php';
1998
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/KeyOrPassword.php';
1999
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/File.php';
2000
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/RuntimeTests.php';
2001
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/KeyProtectedByPassword.php';
2002
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Core.php';
2003 2003
 
2004 2004
         // treat 10 files
2005 2005
         foreach ($post_list as $file) {
@@ -2007,35 +2007,35 @@  discard block
 block discarded – undo
2007 2007
                 // Get file name
2008 2008
                 $file_info = DB::queryfirstrow(
2009 2009
                     'SELECT file
2010
-                    FROM ' . prefixTable('files') . '
2010
+                    FROM ' . prefixTable('files').'
2011 2011
                     WHERE id = %i',
2012 2012
                     $file
2013 2013
                 );
2014 2014
 
2015 2015
                 // skip file is Coherancey not respected
2016
-                if (is_file($SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'])) {
2016
+                if (is_file($SETTINGS['path_to_upload_folder'].'/'.$file_info['file'])) {
2017 2017
                     // Case where we want to decrypt
2018 2018
                     if ($post_option === 'decrypt') {
2019 2019
                         prepareFileWithDefuse(
2020 2020
                             'decrypt',
2021
-                            $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'],
2022
-                            $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
2021
+                            $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'],
2022
+                            $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
2023 2023
                             $SETTINGS
2024 2024
                         );
2025 2025
                         // Case where we want to encrypt
2026 2026
                     } elseif ($post_option === 'encrypt') {
2027 2027
                         prepareFileWithDefuse(
2028 2028
                             'encrypt',
2029
-                            $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'],
2030
-                            $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
2029
+                            $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'],
2030
+                            $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
2031 2031
                             $SETTINGS
2032 2032
                         );
2033 2033
                     }
2034 2034
                     // Do file cleanup
2035
-                    fileDelete($SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'], $SETTINGS);
2035
+                    fileDelete($SETTINGS['path_to_upload_folder'].'/'.$file_info['file'], $SETTINGS);
2036 2036
                     rename(
2037
-                        $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
2038
-                        $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file']
2037
+                        $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
2038
+                        $SETTINGS['path_to_upload_folder'].'/'.$file_info['file']
2039 2039
                     );
2040 2040
 
2041 2041
                     // store in DB
@@ -2070,8 +2070,8 @@  discard block
 block discarded – undo
2070 2070
                 $post_option === 'attachments-decrypt' ? 'clear' : 'encrypted'
2071 2071
             );
2072 2072
 
2073
-            $message = langHdl('last_execution') . ' ' .
2074
-                date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
2073
+            $message = langHdl('last_execution').' '.
2074
+                date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
2075 2075
                 '<i class="fas fa-check text-success ml-2 mr-3"></i>';
2076 2076
         }
2077 2077
 
@@ -2157,7 +2157,7 @@  discard block
 block discarded – undo
2157 2157
             $post_id = filter_var($dataReceived['id'], FILTER_SANITIZE_STRING);
2158 2158
 
2159 2159
             DB::query(
2160
-                'DELETE FROM ' . prefixTable('api') . ' WHERE id = %i',
2160
+                'DELETE FROM '.prefixTable('api').' WHERE id = %i',
2161 2161
                 $post_id
2162 2162
             );
2163 2163
         }
@@ -2249,7 +2249,7 @@  discard block
 block discarded – undo
2249 2249
             // Delete existing key
2250 2250
         } elseif (null !== $post_action && $post_action === 'delete') {
2251 2251
             $post_id = filter_var($dataReceived['id'], FILTER_SANITIZE_STRING);
2252
-            DB::query('DELETE FROM ' . prefixTable('api') . ' WHERE id=%i', $post_id);
2252
+            DB::query('DELETE FROM '.prefixTable('api').' WHERE id=%i', $post_id);
2253 2253
         }
2254 2254
 
2255 2255
         echo prepareExchangedData(
@@ -2264,7 +2264,7 @@  discard block
 block discarded – undo
2264 2264
 
2265 2265
     case 'save_api_status':
2266 2266
         // Do query
2267
-        DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'api');
2267
+        DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'api');
2268 2268
         $counter = DB::count();
2269 2269
         if ($counter === 0) {
2270 2270
             DB::insert(
@@ -2290,7 +2290,7 @@  discard block
 block discarded – undo
2290 2290
         break;
2291 2291
 
2292 2292
     case 'save_duo_status':
2293
-        DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'duo');
2293
+        DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'duo');
2294 2294
         $counter = DB::count();
2295 2295
         if ($counter === 0) {
2296 2296
             DB::insert(
@@ -2333,7 +2333,7 @@  discard block
 block discarded – undo
2333 2333
         foreach ($dataReceived as $key => $value) {
2334 2334
             DB::query(
2335 2335
                 'SELECT * 
2336
-                FROM ' . prefixTable('misc') . '
2336
+                FROM ' . prefixTable('misc').'
2337 2337
                 WHERE type = %s AND intitule = %s',
2338 2338
                 'admin',
2339 2339
                 $key
@@ -2401,7 +2401,7 @@  discard block
 block discarded – undo
2401 2401
         } else {
2402 2402
             $tmp = 1;
2403 2403
         }
2404
-        DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'google_authentication');
2404
+        DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'google_authentication');
2405 2405
         $counter = DB::count();
2406 2406
         if ($counter === 0) {
2407 2407
             DB::insert(
@@ -2427,7 +2427,7 @@  discard block
 block discarded – undo
2427 2427
 
2428 2428
         // ga_website_name
2429 2429
         if (is_null($dataReceived['ga_website_name']) === false) {
2430
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'ga_website_name');
2430
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'ga_website_name');
2431 2431
             $counter = DB::count();
2432 2432
             if ($counter === 0) {
2433 2433
                 DB::insert(
@@ -2458,7 +2458,7 @@  discard block
 block discarded – undo
2458 2458
         }
2459 2459
 
2460 2460
         // send data
2461
-        echo '[{"result" : "' . addslashes($LANG['done']) . '" , "error" : ""}]';
2461
+        echo '[{"result" : "'.addslashes($LANG['done']).'" , "error" : ""}]';
2462 2462
         break;
2463 2463
 
2464 2464
     case 'save_agses_options':
@@ -2481,7 +2481,7 @@  discard block
 block discarded – undo
2481 2481
 
2482 2482
         // agses_hosted_url
2483 2483
         if (!is_null($dataReceived['agses_hosted_url'])) {
2484
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_url');
2484
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_url');
2485 2485
             $counter = DB::count();
2486 2486
             if ($counter === 0) {
2487 2487
                 DB::insert(
@@ -2510,7 +2510,7 @@  discard block
 block discarded – undo
2510 2510
 
2511 2511
         // agses_hosted_id
2512 2512
         if (!is_null($dataReceived['agses_hosted_id'])) {
2513
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_id');
2513
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_id');
2514 2514
             $counter = DB::count();
2515 2515
             if ($counter === 0) {
2516 2516
                 DB::insert(
@@ -2539,7 +2539,7 @@  discard block
 block discarded – undo
2539 2539
 
2540 2540
         // agses_hosted_apikey
2541 2541
         if (!is_null($dataReceived['agses_hosted_apikey'])) {
2542
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_apikey');
2542
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_apikey');
2543 2543
             $counter = DB::count();
2544 2544
             if ($counter === 0) {
2545 2545
                 DB::insert(
@@ -2567,7 +2567,7 @@  discard block
 block discarded – undo
2567 2567
         }
2568 2568
 
2569 2569
         // send data
2570
-        echo '[{"result" : "' . addslashes($LANG['done']) . '" , "error" : ""}]';
2570
+        echo '[{"result" : "'.addslashes($LANG['done']).'" , "error" : ""}]';
2571 2571
         break;
2572 2572
 
2573 2573
     case 'save_option_change':
@@ -2603,7 +2603,7 @@  discard block
 block discarded – undo
2603 2603
 
2604 2604
         // Check if setting is already in DB. If NO then insert, if YES then update.
2605 2605
         $data = DB::query(
2606
-            'SELECT * FROM ' . prefixTable('misc') . '
2606
+            'SELECT * FROM '.prefixTable('misc').'
2607 2607
             WHERE type = %s AND intitule = %s',
2608 2608
             $type,
2609 2609
             $dataReceived['field']
@@ -2625,7 +2625,7 @@  discard block
 block discarded – undo
2625 2625
                     array(
2626 2626
                         'valeur' => time(),
2627 2627
                         'type' => $type,
2628
-                        'intitule' => $dataReceived['field'] . '_time',
2628
+                        'intitule' => $dataReceived['field'].'_time',
2629 2629
                     )
2630 2630
                 );
2631 2631
             }
@@ -2643,10 +2643,10 @@  discard block
 block discarded – undo
2643 2643
             if ($dataReceived['field'] === 'send_stats') {
2644 2644
                 // Check if previous time exists, if not them insert this value in DB
2645 2645
                 DB::query(
2646
-                    'SELECT * FROM ' . prefixTable('misc') . '
2646
+                    'SELECT * FROM '.prefixTable('misc').'
2647 2647
                     WHERE type = %s AND intitule = %s',
2648 2648
                     $type,
2649
-                    $dataReceived['field'] . '_time'
2649
+                    $dataReceived['field'].'_time'
2650 2650
                 );
2651 2651
                 $counter = DB::count();
2652 2652
                 if ($counter === 0) {
@@ -2655,7 +2655,7 @@  discard block
 block discarded – undo
2655 2655
                         array(
2656 2656
                             'valeur' => 0,
2657 2657
                             'type' => $type,
2658
-                            'intitule' => $dataReceived['field'] . '_time',
2658
+                            'intitule' => $dataReceived['field'].'_time',
2659 2659
                         )
2660 2660
                     );
2661 2661
                 } else {
@@ -2675,13 +2675,13 @@  discard block
 block discarded – undo
2675 2675
         // special Cases
2676 2676
         if ($dataReceived['field'] === 'cpassman_url') {
2677 2677
             // update also jsUrl for CSFP protection
2678
-            $jsUrl = $dataReceived['value'] . '/includes/libraries/csrfp/js/csrfprotector.js';
2678
+            $jsUrl = $dataReceived['value'].'/includes/libraries/csrfp/js/csrfprotector.js';
2679 2679
             $csrfp_file = '../includes/libraries/csrfp/libs/csrfp.config.php';
2680 2680
             $data = file_get_contents($csrfp_file);
2681 2681
             $posJsUrl = strpos($data, '"jsUrl" => "');
2682 2682
             $posEndLine = strpos($data, '",', $posJsUrl);
2683 2683
             $line = substr($data, $posJsUrl, ($posEndLine - $posJsUrl + 2));
2684
-            $newdata = str_replace($line, '"jsUrl" => "' . filter_var($jsUrl, FILTER_SANITIZE_STRING) . '",', $data);
2684
+            $newdata = str_replace($line, '"jsUrl" => "'.filter_var($jsUrl, FILTER_SANITIZE_STRING).'",', $data);
2685 2685
             file_put_contents($csrfp_file, $newdata);
2686 2686
         } elseif ($dataReceived['field'] === 'restricted_to_input' && $dataReceived['value'] === '0') {
2687 2687
             DB::update(
@@ -2705,7 +2705,7 @@  discard block
 block discarded – undo
2705 2705
         echo prepareExchangedData(
2706 2706
             array(
2707 2707
                 'error' => false,
2708
-                'misc' => $counter . ' ; ' . $SETTINGS[$dataReceived['field']],
2708
+                'misc' => $counter.' ; '.$SETTINGS[$dataReceived['field']],
2709 2709
             ),
2710 2710
             'encode'
2711 2711
         );
@@ -2747,7 +2747,7 @@  discard block
 block discarded – undo
2747 2747
 
2748 2748
         // send statistics
2749 2749
         if (null !== $post_status) {
2750
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'send_stats');
2750
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'send_stats');
2751 2751
             $counter = DB::count();
2752 2752
             if ($counter === 0) {
2753 2753
                 DB::insert(
@@ -2779,7 +2779,7 @@  discard block
 block discarded – undo
2779 2779
 
2780 2780
         // send statistics items
2781 2781
         if (null !== $post_list) {
2782
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'send_statistics_items');
2782
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'send_statistics_items');
2783 2783
             $counter = DB::count();
2784 2784
             if ($counter === 0) {
2785 2785
                 DB::insert(
@@ -2826,7 +2826,7 @@  discard block
 block discarded – undo
2826 2826
             break;
2827 2827
         }
2828 2828
 
2829
-        if (DB::query("SHOW TABLES LIKE '" . prefixTable('sk_reencrypt_backup') . "'")) {
2829
+        if (DB::query("SHOW TABLES LIKE '".prefixTable('sk_reencrypt_backup')."'")) {
2830 2830
             if (DB::count() === 1) {
2831 2831
                 echo 1;
2832 2832
             } else {
@@ -2864,7 +2864,7 @@  discard block
 block discarded – undo
2864 2864
 
2865 2865
         $rows = DB::query(
2866 2866
             'SELECT id, title
2867
-                FROM ' . prefixTable('roles_title') . '
2867
+                FROM ' . prefixTable('roles_title').'
2868 2868
                 ORDER BY title ASC'
2869 2869
         );
2870 2870
         foreach ($rows as $record) {
Please login to merge, or discard this patch.
sources/folders.queries.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -37,12 +37,12 @@  discard block
 block discarded – undo
37 37
 }
38 38
 
39 39
 // Do checks
40
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
41
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
40
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
41
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
42 42
 if (checkUser($_SESSION['user_id'], $_SESSION['key'], 'folders', $SETTINGS) === false) {
43 43
     // Not allowed page
44 44
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
45
-    include $SETTINGS['cpassman_dir'] . '/error.php';
45
+    include $SETTINGS['cpassman_dir'].'/error.php';
46 46
     exit();
47 47
 }
48 48
 
@@ -55,14 +55,14 @@  discard block
 block discarded – undo
55 55
     date_default_timezone_set('UTC');
56 56
 }
57 57
 
58
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
58
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
59 59
 header('Content-type: text/html; charset=utf-8');
60
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
61
-require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
62
-require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
60
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
61
+require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
62
+require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
63 63
 
64 64
 // Connect to mysql server
65
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
65
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
66 66
 if (defined('DB_PASSWD_CLEAR') === false) {
67 67
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
68 68
 }
@@ -132,14 +132,14 @@  discard block
 block discarded – undo
132 132
                     && $t->personal_folder == 0
133 133
                 ) {
134 134
                     // get $t->parent_id
135
-                    $data = DB::queryFirstRow('SELECT title FROM ' . prefixTable('nested_tree') . ' WHERE id = %i', $t->parent_id);
135
+                    $data = DB::queryFirstRow('SELECT title FROM '.prefixTable('nested_tree').' WHERE id = %i', $t->parent_id);
136 136
                     if ($t->nlevel == 1) {
137 137
                         $data['title'] = langHdl('root');
138 138
                     }
139 139
 
140 140
                     // get rights on this folder
141 141
                     $arrayRights = array();
142
-                    $rows = DB::query('SELECT fonction_id  FROM ' . prefixTable('rights') . ' WHERE authorized=%i AND tree_id = %i', 1, $t->id);
142
+                    $rows = DB::query('SELECT fonction_id  FROM '.prefixTable('rights').' WHERE authorized=%i AND tree_id = %i', 1, $t->id);
143 143
                     foreach ($rows as $record) {
144 144
                         array_push($arrayRights, $record['fonction_id']);
145 145
                     }
@@ -156,8 +156,8 @@  discard block
 block discarded – undo
156 156
                     $node_data = DB::queryFirstRow(
157 157
                         'SELECT m.valeur AS valeur, n.renewal_period AS renewal_period,
158 158
                         n.bloquer_creation AS bloquer_creation, n.bloquer_modification AS bloquer_modification
159
-                        FROM ' . prefixTable('misc') . ' AS m,
160
-                        ' . prefixTable('nested_tree') . ' AS n
159
+                        FROM ' . prefixTable('misc').' AS m,
160
+                        ' . prefixTable('nested_tree').' AS n
161 161
                         WHERE m.type=%s AND m.intitule = n.id AND m.intitule = %i',
162 162
                         'complex',
163 163
                         $t->id
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
                     //col7
191 191
                     $data7 = DB::queryFirstRow(
192 192
                         'SELECT bloquer_creation,bloquer_modification
193
-                        FROM ' . prefixTable('nested_tree') . '
193
+                        FROM ' . prefixTable('nested_tree').'
194 194
                         WHERE id = %i',
195 195
                         intval($t->id)
196 196
                     );
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
             // Get info about this folder
326 326
             $dataFolder = DB::queryfirstrow(
327 327
                 'SELECT *
328
-                FROM ' . prefixTable('nested_tree') . '
328
+                FROM ' . prefixTable('nested_tree').'
329 329
                 WHERE id = %i',
330 330
                 $post_folder_id
331 331
             );
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
             //check if parent folder is personal
362 362
             $dataParent = DB::queryfirstrow(
363 363
                 'SELECT personal_folder, bloquer_creation, bloquer_modification
364
-                FROM ' . prefixTable('nested_tree') . '
364
+                FROM ' . prefixTable('nested_tree').'
365 365
                 WHERE id = %i',
366 366
                 $post_parent_id
367 367
             );
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
                     // get complexity level for this folder
391 391
                     $data = DB::queryfirstrow(
392 392
                         'SELECT valeur
393
-                        FROM ' . prefixTable('misc') . '
393
+                        FROM ' . prefixTable('misc').'
394 394
                         WHERE intitule = %i AND type = %s',
395 395
                         $post_parent_id,
396 396
                         'complex'
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
                             array(
402 402
                                 'error' => true,
403 403
                                 'message' => langHdl('error_folder_complexity_lower_than_top_folder')
404
-                                    . ' [<b>' . TP_PW_COMPLEXITY[$data['valeur']][1] . '</b>]',
404
+                                    . ' [<b>'.TP_PW_COMPLEXITY[$data['valeur']][1].'</b>]',
405 405
                             ),
406 406
                             'encode'
407 407
                         );
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
             ) {
555 555
                 DB::query(
556 556
                     'SELECT *
557
-                    FROM ' . prefixTable('nested_tree') . '
557
+                    FROM ' . prefixTable('nested_tree').'
558 558
                     WHERE title = %s',
559 559
                     $post_title
560 560
                 );
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
             //check if parent folder is personal
575 575
             $data = DB::queryfirstrow(
576 576
                 'SELECT personal_folder, bloquer_creation, bloquer_modification
577
-                FROM ' . prefixTable('nested_tree') . '
577
+                FROM ' . prefixTable('nested_tree').'
578 578
                 WHERE id = %i',
579 579
                 $post_parent_id
580 580
             );
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
                     // get complexity level for this folder
604 604
                     $data = DB::queryfirstrow(
605 605
                         'SELECT valeur
606
-                        FROM ' . prefixTable('misc') . '
606
+                        FROM ' . prefixTable('misc').'
607 607
                         WHERE intitule = %i AND type = %s',
608 608
                         $post_parent_id,
609 609
                         'complex'
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
                             array(
614 614
                                 'error' => true,
615 615
                                 'message' => langHdl('error_folder_complexity_lower_than_top_folder')
616
-                                    . ' [<b>' . TP_PW_COMPLEXITY[$data['valeur']][1] . '</b>]',
616
+                                    . ' [<b>'.TP_PW_COMPLEXITY[$data['valeur']][1].'</b>]',
617 617
                             ),
618 618
                             'encode'
619 619
                         );
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
                     && (int) $SETTINGS['subfolder_rights_as_parent'] === 1
688 688
                 ) {
689 689
                     //If it is a subfolder, then give access to it for all roles that allows the parent folder
690
-                    $rows = DB::query('SELECT role_id, type FROM ' . prefixTable('roles_values') . ' WHERE folder_id = %i', $post_parent_id);
690
+                    $rows = DB::query('SELECT role_id, type FROM '.prefixTable('roles_values').' WHERE folder_id = %i', $post_parent_id);
691 691
                     foreach ($rows as $record) {
692 692
                         //add access to this subfolder
693 693
                         DB::insert(
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
                 }
703 703
 
704 704
                 // if parent folder has Custom Fields Categories then add to this child one too
705
-                $rows = DB::query('SELECT id_category FROM ' . prefixTable('categories_folders') . ' WHERE id_folder = %i', $post_parent_id);
705
+                $rows = DB::query('SELECT id_category FROM '.prefixTable('categories_folders').' WHERE id_folder = %i', $post_parent_id);
706 706
                 foreach ($rows as $record) {
707 707
                     //add CF Category to this subfolder
708 708
                     DB::insert(
@@ -779,17 +779,17 @@  discard block
 block discarded – undo
779 779
                                 prefixTable('misc'),
780 780
                                 array(
781 781
                                     'type' => 'folder_deleted',
782
-                                    'intitule' => 'f' . $folder->id,
783
-                                    'valeur' => $folder->id . ', ' . $folder->parent_id . ', ' .
784
-                                        $folder->title . ', ' . $folder->nleft . ', ' . $folder->nright . ', ' .
785
-                                        $folder->nlevel . ', 0, 0, 0, 0',
782
+                                    'intitule' => 'f'.$folder->id,
783
+                                    'valeur' => $folder->id.', '.$folder->parent_id.', '.
784
+                                        $folder->title.', '.$folder->nleft.', '.$folder->nright.', '.
785
+                                        $folder->nlevel.', 0, 0, 0, 0',
786 786
                                 )
787 787
                             );
788 788
                             //array for delete folder
789 789
                             $folderForDel[] = $folder->id;
790 790
 
791 791
                             //delete items & logs
792
-                            $items = DB::query('SELECT id FROM ' . prefixTable('items') . ' WHERE id_tree=%i', $folder->id);
792
+                            $items = DB::query('SELECT id FROM '.prefixTable('items').' WHERE id_tree=%i', $folder->id);
793 793
                             foreach ($items as $item) {
794 794
                                 DB::update(
795 795
                                     prefixTable('items'),
@@ -846,7 +846,7 @@  discard block
 block discarded – undo
846 846
             $tree->rebuild();
847 847
 
848 848
             // reload cache table
849
-            include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
849
+            include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
850 850
             updateCacheTable('reload', $SETTINGS, null);
851 851
 
852 852
             echo prepareExchangedData(
@@ -932,7 +932,7 @@  discard block
 block discarded – undo
932 932
                 // get complexity of current node
933 933
                 $nodeComplexity = DB::queryfirstrow(
934 934
                     'SELECT valeur
935
-                    FROM ' . prefixTable('misc') . '
935
+                    FROM ' . prefixTable('misc').'
936 936
                     WHERE intitule = %i AND type= %s',
937 937
                     $nodeInfo->id,
938 938
                     'complex'
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
                 // If it is a subfolder, then give access to it for all roles that allows the parent folder
1008 1008
                 $rows = DB::query(
1009 1009
                     'SELECT role_id, type
1010
-                    FROM ' . prefixTable('roles_values') . '
1010
+                    FROM ' . prefixTable('roles_values').'
1011 1011
                     WHERE folder_id = %i',
1012 1012
                     $parentId
1013 1013
                 );
@@ -1015,7 +1015,7 @@  discard block
 block discarded – undo
1015 1015
                     // Add access to this subfolder after checking that it is not already set
1016 1016
                     DB::query(
1017 1017
                         'SELECT *
1018
-                        FROM ' . prefixTable('roles_values') . '
1018
+                        FROM ' . prefixTable('roles_values').'
1019 1019
                         WHERE folder_id = %i AND role_id = %i',
1020 1020
                         $newFolderId,
1021 1021
                         $record['role_id']
@@ -1035,7 +1035,7 @@  discard block
 block discarded – undo
1035 1035
                 // if parent folder has Custom Fields Categories then add to this child one too
1036 1036
                 $rows = DB::query(
1037 1037
                     'SELECT id_category
1038
-                    FROM ' . prefixTable('categories_folders') . '
1038
+                    FROM ' . prefixTable('categories_folders').'
1039 1039
                     WHERE id_folder = %i',
1040 1040
                     $nodeInfo->id
1041 1041
                 );
@@ -1054,7 +1054,7 @@  discard block
 block discarded – undo
1054 1054
 
1055 1055
                 $rows = DB::query(
1056 1056
                     'SELECT *
1057
-                    FROM ' . prefixTable('items') . '
1057
+                    FROM ' . prefixTable('items').'
1058 1058
                     WHERE id_tree = %i',
1059 1059
                     $nodeInfo->id
1060 1060
                 );
@@ -1063,7 +1063,7 @@  discard block
 block discarded – undo
1063 1063
                     // if it is then don't copy it
1064 1064
                     $item_deleted = DB::queryFirstRow(
1065 1065
                         'SELECT *
1066
-                        FROM ' . prefixTable('log_items') . '
1066
+                        FROM ' . prefixTable('log_items').'
1067 1067
                         WHERE id_item = %i AND action = %s
1068 1068
                         ORDER BY date DESC
1069 1069
                         LIMIT 0, 1',
@@ -1074,7 +1074,7 @@  discard block
 block discarded – undo
1074 1074
 
1075 1075
                     $item_restored = DB::queryFirstRow(
1076 1076
                         'SELECT *
1077
-                        FROM ' . prefixTable('log_items') . '
1077
+                        FROM ' . prefixTable('log_items').'
1078 1078
                         WHERE id_item = %i AND action = %s
1079 1079
                         ORDER BY date DESC
1080 1080
                         LIMIT 0, 1',
@@ -1089,7 +1089,7 @@  discard block
 block discarded – undo
1089 1089
                         // Get the ITEM object key for the user
1090 1090
                         $userKey = DB::queryFirstRow(
1091 1091
                             'SELECT share_key
1092
-                            FROM ' . prefixTable('sharekeys_items') . '
1092
+                            FROM ' . prefixTable('sharekeys_items').'
1093 1093
                             WHERE user_id = %i AND object_id = %i',
1094 1094
                             $_SESSION['user_id'],
1095 1095
                             $record['id']
@@ -1163,7 +1163,7 @@  discard block
 block discarded – undo
1163 1163
                         // Manage Custom Fields
1164 1164
                         $categories = DB::query(
1165 1165
                             'SELECT *
1166
-                            FROM ' . prefixTable('categories_items') . '
1166
+                            FROM ' . prefixTable('categories_items').'
1167 1167
                             WHERE item_id = %i',
1168 1168
                             $record['id']
1169 1169
                         );
@@ -1211,15 +1211,15 @@  discard block
 block discarded – undo
1211 1211
                         $files = DB::query(
1212 1212
                             'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status, f.extension AS extension,
1213 1213
                             f.size AS size, f.type AS type, s.share_key AS share_key
1214
-                            FROM ' . prefixTable('files') . ' AS f
1215
-                            INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id)
1214
+                            FROM ' . prefixTable('files').' AS f
1215
+                            INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id)
1216 1216
                             WHERE s.user_id = %i AND f.id_item = %i',
1217 1217
                             $_SESSION['user_id'],
1218 1218
                             $record['id']
1219 1219
                         );
1220 1220
                         foreach ($files as $file) {
1221 1221
                             // Check if file still exists
1222
-                            if (file_exists($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . TP_FILE_PREFIX . base64_decode($file['file'])) === true) {
1222
+                            if (file_exists($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.TP_FILE_PREFIX.base64_decode($file['file'])) === true) {
1223 1223
                                 // Step1 - decrypt the file
1224 1224
                                 $fileContent = decryptFile(
1225 1225
                                     $file['file'],
@@ -1228,9 +1228,9 @@  discard block
 block discarded – undo
1228 1228
                                 );
1229 1229
 
1230 1230
                                 // Step2 - create file
1231
-                                $newFileName = md5(time() . '_' . $file['id']) . '.' . $file['extension'];
1231
+                                $newFileName = md5(time().'_'.$file['id']).'.'.$file['extension'];
1232 1232
 
1233
-                                $outstream = fopen($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . $newFileName, 'ab');
1233
+                                $outstream = fopen($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.$newFileName, 'ab');
1234 1234
                                 if ($outstream === false) {
1235 1235
                                     echo prepareExchangedData(
1236 1236
                                         array(
@@ -1305,7 +1305,7 @@  discard block
 block discarded – undo
1305 1305
             $tree->rebuild();
1306 1306
 
1307 1307
             // reload cache table
1308
-            include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1308
+            include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1309 1309
             updateCacheTable('reload', $SETTINGS, NULL);
1310 1310
 
1311 1311
             $data = array(
@@ -1367,7 +1367,7 @@  discard block
 block discarded – undo
1367 1367
                     // Get path
1368 1368
                     $text = '';
1369 1369
                     foreach ($tree->getPath($folder->id, false) as $fld) {
1370
-                        $text .= empty($text) === true ? '     [<i>' . $fld->title : ' > ' . $fld->title;
1370
+                        $text .= empty($text) === true ? '     [<i>'.$fld->title : ' > '.$fld->title;
1371 1371
                     }
1372 1372
 
1373 1373
                     // Save array
@@ -1377,7 +1377,7 @@  discard block
 block discarded – undo
1377 1377
                             'id' => (int) $folder->id,
1378 1378
                             'label' => $folder->title,
1379 1379
                             'level' => $folder->nlevel,
1380
-                            'path' => empty($text) === true ? '' : $text . '</i>]'
1380
+                            'path' => empty($text) === true ? '' : $text.'</i>]'
1381 1381
                         )
1382 1382
                     );
1383 1383
                 }
Please login to merge, or discard this patch.
sources/tree.php 1 patch
Spacing   +47 added lines, -51 removed lines patch added patch discarded remove patch
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
 }
43 43
 
44 44
 // includes
45
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
46
-require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
47
-require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
48
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
49
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
45
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
46
+require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
47
+require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
48
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
49
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
50 50
 
51 51
 // header
52 52
 header('Content-type: text/html; charset=utf-8');
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 }
61 61
 
62 62
 // Connect to mysql server
63
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
63
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
64 64
 if (defined('DB_PASSWD_CLEAR') === false) {
65 65
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
66 66
 }
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 DB::$encoding = DB_ENCODING;
73 73
 
74 74
 // Superglobal load
75
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
75
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
76 76
 $superGlobal = new protect\SuperGlobal\SuperGlobal();
77 77
 $get = [];
78 78
 $get['user_tree_structure'] = $superGlobal->get('user_tree_structure', 'GET');
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 $session['personal_visible_groups'] = $superGlobal->get('personal_visible_groups', 'SESSION');
93 93
 
94 94
 $lastFolderChange = DB::query(
95
-    'SELECT * FROM ' . prefixTable('misc') . '
95
+    'SELECT * FROM '.prefixTable('misc').'
96 96
     WHERE type = %s AND intitule = %s',
97 97
     'timestamp',
98 98
     'last_folder_change'
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
     || (isset($get['force_refresh']) === true && (int) $get['force_refresh'] === 1)
104 104
 ) {
105 105
     // Build tree
106
-    $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
106
+    $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
107 107
     $tree->register();
108 108
     $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
109 109
 
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
     $SETTINGS
214 214
 ) {
215 215
     // Load library
216
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
216
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
217 217
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
218 218
 
219 219
     // Prepare superGlobal variables
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
                 // get count of Items in this folder
268 268
                 DB::query(
269 269
                     'SELECT *
270
-                    FROM ' . prefixTable('items') . '
270
+                    FROM ' . prefixTable('items').'
271 271
                     WHERE inactif=%i AND id_tree = %i',
272 272
                     0,
273 273
                     $node->id
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
                 // get info about current folder
278 278
                 DB::query(
279 279
                     'SELECT *
280
-                    FROM ' . prefixTable('nested_tree') . '
280
+                    FROM ' . prefixTable('nested_tree').'
281 281
                     WHERE parent_id = %i',
282 282
                     $node->id
283 283
                 );
@@ -285,11 +285,10 @@  discard block
 block discarded – undo
285 285
 
286 286
                 // If personal Folder, convert id into user name
287 287
                 $node->title = $node->title === $session_user_id && (int) $node->nlevel === 1 ?
288
-                    $session_login :
289
-                    ($node->title === null ? '' : htmlspecialchars_decode($node->title, ENT_QUOTES));
288
+                    $session_login : ($node->title === null ? '' : htmlspecialchars_decode($node->title, ENT_QUOTES));
290 289
 
291 290
                 // prepare json return for current node
292
-                $parent = $node->parent_id === 0 ? '#' : 'li_' . $node->parent_id;
291
+                $parent = $node->parent_id === 0 ? '#' : 'li_'.$node->parent_id;
293 292
 
294 293
                 // special case for READ-ONLY folder
295 294
                 $title = $session_user_read_only === true && in_array($node->id, $session_personal_folders) === false ? langHdl('read_only_account') : $title;
@@ -299,33 +298,30 @@  discard block
 block discarded – undo
299 298
 
300 299
                 if (in_array($node->id, $session_groupes_visibles)) {
301 300
                     if (in_array($node->id, $session_read_only_folders)) {
302
-                        $text = "<i class='far fa-eye fa-xs mr-1'></i>" . $text;
301
+                        $text = "<i class='far fa-eye fa-xs mr-1'></i>".$text;
303 302
                         $title = langHdl('read_only_account');
304 303
                         $restricted = 1;
305 304
                         $folderClass = 'folder_not_droppable';
306 305
                     } elseif ($session_user_read_only === true && !in_array($node->id, $session_personal_visible_groups)) {
307
-                        $text = "<i class='far fa-eye fa-xs mr-1'></i>" . $text;
306
+                        $text = "<i class='far fa-eye fa-xs mr-1'></i>".$text;
308 307
                     }
309 308
                     $text .=
310
-                        ' <span class=\'badge badge-danger ml-2 items_count\' id=\'itcount_' . $node->id . '\'>' . $itemsNb . '</span>'
309
+                        ' <span class=\'badge badge-danger ml-2 items_count\' id=\'itcount_'.$node->id.'\'>'.$itemsNb.'</span>'
311 310
                         .(isset($SETTINGS['tree_counters']) && $SETTINGS['tree_counters'] === 1 ?
312
-                            '/'.$nbChildrenItems .'/'.(count($nodeDescendants) - 1)  :
313
-                            '')
311
+                            '/'.$nbChildrenItems.'/'.(count($nodeDescendants) - 1) : '')
314 312
                         .'</span>';
315 313
                 } elseif (in_array($node->id, $listFoldersLimitedKeys)) {
316 314
                     $restricted = 1;
317 315
                     $text .= 
318 316
                         $session_user_read_only === true ?
319
-                            "<i class='far fa-eye fa-xs mr-1'></i>" :
320
-                            '<span class="badge badge-danger ml-2 items_count" id="itcount_' . $node->id . '">' . count($session_list_folders_limited[$node->id]) . '</span>';
317
+                            "<i class='far fa-eye fa-xs mr-1'></i>" : '<span class="badge badge-danger ml-2 items_count" id="itcount_'.$node->id.'">'.count($session_list_folders_limited[$node->id]).'</span>';
321 318
                 } elseif (in_array($node->id, $listRestrictedFoldersForItemsKeys)) {
322 319
                     $restricted = 1;
323 320
                     if ($session_user_read_only === true) {
324
-                        $text = "<i class='far fa-eye fa-xs mr-1'></i>" . $text;
321
+                        $text = "<i class='far fa-eye fa-xs mr-1'></i>".$text;
325 322
                     }
326 323
                     $text .= $session_user_read_only === true ? 
327
-                        "<i class='far fa-eye fa-xs mr-1'></i>" :
328
-                        '<span class="badge badge-danger ml-2 items_count" id="itcount_' . $node->id . '">' . count($session_list_restricted_folders_for_items[$node->id]) . '</span>';
324
+                        "<i class='far fa-eye fa-xs mr-1'></i>" : '<span class="badge badge-danger ml-2 items_count" id="itcount_'.$node->id.'">'.count($session_list_restricted_folders_for_items[$node->id]).'</span>';
329 325
                 } else {
330 326
                     $restricted = 1;
331 327
                     $folderClass = 'folder_not_droppable';
@@ -351,18 +347,18 @@  discard block
 block discarded – undo
351 347
                     array_push(
352 348
                         $ret_json,
353 349
                         array(
354
-                            'id' => 'li_' . $node->id,
350
+                            'id' => 'li_'.$node->id,
355 351
                             'parent' => $parent,
356 352
                             'text' => $text,
357 353
                             'children' => $childrenNb === 0 ? false : true,
358 354
                             'li_attr' => array(
359 355
                                 'class' => 'jstreeopen',
360
-                                'title' => 'ID [' . $node->id . '] ' . $title,
356
+                                'title' => 'ID ['.$node->id.'] '.$title,
361 357
                             ),
362 358
                             'a_attr' => array(
363
-                                'id' => 'fld_' . $node->id,
359
+                                'id' => 'fld_'.$node->id,
364 360
                                 'class' => $folderClass,
365
-                                'onclick' => 'ListerItems(' . $node->id . ', ' . $restricted . ', 0, 1)',
361
+                                'onclick' => 'ListerItems('.$node->id.', '.$restricted.', 0, 1)',
366 362
                                 'data-title' => $node->title,
367 363
                             ),
368 364
                         )
@@ -371,13 +367,13 @@  discard block
 block discarded – undo
371 367
                     array_push(
372 368
                         $ret_json,
373 369
                         array(
374
-                            'id' => 'li_' . $node->id,
370
+                            'id' => 'li_'.$node->id,
375 371
                             'parent' =>  $parent,
376 372
                             'children' => $childrenNb === 0 ? false : true,
377
-                            'text' => '<i class="fas fa-times fa-xs text-danger mr-1"></i>' . $text,
373
+                            'text' => '<i class="fas fa-times fa-xs text-danger mr-1"></i>'.$text,
378 374
                             'li_attr' => array(
379 375
                                 'class' => '',
380
-                                'title' => 'ID [' . $node->id . '] ' . langHdl('no_access'),
376
+                                'title' => 'ID ['.$node->id.'] '.langHdl('no_access'),
381 377
                             ),
382 378
                         )
383 379
                     );
@@ -470,7 +466,7 @@  discard block
 block discarded – undo
470 466
                 ) === true
471 467
             ) {
472 468
                 DB::query(
473
-                    'SELECT * FROM ' . prefixTable('items') . '
469
+                    'SELECT * FROM '.prefixTable('items').'
474 470
                     WHERE inactif=%i AND id_tree = %i',
475 471
                     0,
476 472
                     $node
@@ -557,7 +553,7 @@  discard block
 block discarded – undo
557 553
 {
558 554
     // get info about current folder
559 555
     DB::query(
560
-        'SELECT * FROM ' . prefixTable('items') . '
556
+        'SELECT * FROM '.prefixTable('items').'
561 557
         WHERE inactif=%i AND id_tree = %i',
562 558
         0,
563 559
         $completTree[$nodeId]->id
@@ -658,7 +654,7 @@  discard block
 block discarded – undo
658 654
     */
659 655
 
660 656
     // prepare json return for current node
661
-    $parent = $completTree[$nodeId]->parent_id === '0' ? '#' : 'li_' . $completTree[$nodeId]->parent_id;
657
+    $parent = $completTree[$nodeId]->parent_id === '0' ? '#' : 'li_'.$completTree[$nodeId]->parent_id;
662 658
 
663 659
     // handle displaying
664 660
     if (
@@ -678,17 +674,17 @@  discard block
 block discarded – undo
678 674
         array_push(
679 675
             $ret_json,
680 676
             array(
681
-                'id' => 'li_' . $completTree[$nodeId]->id,
677
+                'id' => 'li_'.$completTree[$nodeId]->id,
682 678
                 'parent' => $last_visible_parent === -1 ? $parent : $last_visible_parent,
683 679
                 'text' => $text.$completTree[$nodeId]->title.$nodeData['html'],
684 680
                 'li_attr' => array(
685 681
                     'class' => 'jstreeopen',
686
-                    'title' => 'ID [' . $completTree[$nodeId]->id . '] ' . $nodeData['title'],
682
+                    'title' => 'ID ['.$completTree[$nodeId]->id.'] '.$nodeData['title'],
687 683
                 ),
688 684
                 'a_attr' => array(
689
-                    'id' => 'fld_' . $completTree[$nodeId]->id,
685
+                    'id' => 'fld_'.$completTree[$nodeId]->id,
690 686
                     'class' => $nodeData['folderClass'],
691
-                    'onclick' => 'ListerItems(' . $completTree[$nodeId]->id . ', ' . $nodeData['restricted'] . ', 0, 1)',
687
+                    'onclick' => 'ListerItems('.$completTree[$nodeId]->id.', '.$nodeData['restricted'].', 0, 1)',
692 688
                     'data-title' => $completTree[$nodeId]->title,
693 689
                 ),
694 690
             )
@@ -697,12 +693,12 @@  discard block
 block discarded – undo
697 693
         array_push(
698 694
             $ret_json,
699 695
             array(
700
-                'id' => 'li_' . $completTree[$nodeId]->id,
696
+                'id' => 'li_'.$completTree[$nodeId]->id,
701 697
                 'parent' => $last_visible_parent === -1 ? $parent : $last_visible_parent,
702 698
                 'text' => '<i class="fas fa-times fa-xs text-danger mr-1"></i>'.$text.$completTree[$nodeId]->title.$nodeData['html'],
703 699
                 'li_attr' => array(
704 700
                     'class' => '',
705
-                    'title' => 'ID [' . $completTree[$nodeId]->id . '] ' . langHdl('no_access'),
701
+                    'title' => 'ID ['.$completTree[$nodeId]->id.'] '.langHdl('no_access'),
706 702
                 ),
707 703
             )
708 704
         );
@@ -765,8 +761,8 @@  discard block
 block discarded – undo
765 761
     if (in_array($nodeId, $session_groupes_visibles) === true) {
766 762
         if (in_array($nodeId, $session_read_only_folders) === true) {
767 763
             return [
768
-                'html' => '<i class="far fa-eye fa-xs mr-1"></i><span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . $itemsNb .
769
-                    ($tree_counters === 1 ? '/'.$nbChildrenItems .'/'.(count($nodeDescendants) - 1)  : '') . '</span>',
764
+                'html' => '<i class="far fa-eye fa-xs mr-1"></i><span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.$itemsNb.
765
+                    ($tree_counters === 1 ? '/'.$nbChildrenItems.'/'.(count($nodeDescendants) - 1) : '').'</span>',
770 766
                 'title' => langHdl('read_only_account'),
771 767
                 'restricted' => 1,
772 768
                 'folderClass' => 'folder_not_droppable',
@@ -780,8 +776,8 @@  discard block
 block discarded – undo
780 776
             && in_array($nodeId, $session_personal_visible_groups) === false
781 777
         ) {
782 778
             return [
783
-                'html' => '<i class="far fa-eye fa-xs mr-1"></i><span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . $itemsNb .
784
-                    ($tree_counters === 1 ? '/'.$nbChildrenItems .'/'.(count($nodeDescendants) - 1)  : '') . '</span>',
779
+                'html' => '<i class="far fa-eye fa-xs mr-1"></i><span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.$itemsNb.
780
+                    ($tree_counters === 1 ? '/'.$nbChildrenItems.'/'.(count($nodeDescendants) - 1) : '').'</span>',
785 781
                 'title' => $title,
786 782
                 'restricted' => 0,
787 783
                 'folderClass' => 'folder',
@@ -791,8 +787,8 @@  discard block
 block discarded – undo
791 787
         }
792 788
         
793 789
         return [
794
-            'html' => '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . $itemsNb .
795
-                ($tree_counters === 1 ? '/'.$nbChildrenItems .'/'.(count($nodeDescendants) - 1)  : '') . '</span>',
790
+            'html' => '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.$itemsNb.
791
+                ($tree_counters === 1 ? '/'.$nbChildrenItems.'/'.(count($nodeDescendants) - 1) : '').'</span>',
796 792
             'title' => $title,
797 793
             'restricted' => 0,
798 794
             'folderClass' => 'folder',
@@ -803,8 +799,8 @@  discard block
 block discarded – undo
803 799
     
804 800
     if (in_array($nodeId, $listFoldersLimitedKeys) === true) {
805 801
         return [
806
-            'html' => ($session_user_read_only === true ? '<i class="far fa-eye fa-xs mr-1"></i>' : '') .
807
-                '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . count($session_list_folders_limited[$nodeId]) . '</span>',
802
+            'html' => ($session_user_read_only === true ? '<i class="far fa-eye fa-xs mr-1"></i>' : '').
803
+                '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.count($session_list_folders_limited[$nodeId]).'</span>',
808 804
             'title' => $title,
809 805
             'restricted' => 1,
810 806
             'folderClass' => 'folder',
@@ -815,8 +811,8 @@  discard block
 block discarded – undo
815 811
     
816 812
     if (in_array($nodeId, $listRestrictedFoldersForItemsKeys) === true) {
817 813
         return [
818
-            'html' => $session_user_read_only === true ? '<i class="far fa-eye fa-xs mr-1"></i>' : '' .
819
-                '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . count($session_list_restricted_folders_for_items[$nodeId]) . '</span>',
814
+            'html' => $session_user_read_only === true ? '<i class="far fa-eye fa-xs mr-1"></i>' : ''.
815
+                '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.count($session_list_restricted_folders_for_items[$nodeId]).'</span>',
820 816
             'title' => $title,
821 817
             'restricted' => 1,
822 818
             'folderClass' => 'folder',
Please login to merge, or discard this patch.
sources/main.functions.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -133,16 +133,16 @@  discard block
 block discarded – undo
133 133
 
134 134
     // Check if class already exists
135 135
     if (!class_exists('Defuse\Crypto\Crypto', false)) {
136
-		include_once $path . 'Crypto.php';
137
-		include_once $path . 'Encoding.php';
138
-		include_once $path . 'DerivedKeys.php';
139
-		include_once $path . 'Key.php';
140
-		include_once $path . 'KeyOrPassword.php';
141
-		include_once $path . 'File.php';
142
-		include_once $path . 'RuntimeTests.php';
143
-		include_once $path . 'KeyProtectedByPassword.php';
144
-		include_once $path . 'Core.php';
145
-	}
136
+        include_once $path . 'Crypto.php';
137
+        include_once $path . 'Encoding.php';
138
+        include_once $path . 'DerivedKeys.php';
139
+        include_once $path . 'Key.php';
140
+        include_once $path . 'KeyOrPassword.php';
141
+        include_once $path . 'File.php';
142
+        include_once $path . 'RuntimeTests.php';
143
+        include_once $path . 'KeyProtectedByPassword.php';
144
+        include_once $path . 'Core.php';
145
+    }
146 146
     
147 147
     // convert KEY
148 148
     $key = \Defuse\Crypto\Key::loadFromAsciiSafeString($ascii_key);
@@ -2236,7 +2236,7 @@  discard block
 block discarded – undo
2236 2236
  * <tt>exec("find ".$path." -type d -exec chmod 755 {} \;");</tt>
2237 2237
  *
2238 2238
  * @author Jeppe Toustrup (tenzer at tenzer dot dk)
2239
-  *
2239
+ *
2240 2240
  * @param string $path      An either relative or absolute path to a file or directory which should be processed.
2241 2241
  * @param int    $filePerm The permissions any found files should get.
2242 2242
  * @param int    $dirPerm  The permissions any found folder should get.
Please login to merge, or discard this patch.
Spacing   +215 added lines, -215 removed lines patch added patch discarded remove patch
@@ -122,26 +122,26 @@  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/';
131
+        $path = $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/';
132 132
     }
133 133
 
134 134
     // Check if class already exists
135 135
     if (!class_exists('Defuse\Crypto\Crypto', false)) {
136
-		include_once $path . 'Crypto.php';
137
-		include_once $path . 'Encoding.php';
138
-		include_once $path . 'DerivedKeys.php';
139
-		include_once $path . 'Key.php';
140
-		include_once $path . 'KeyOrPassword.php';
141
-		include_once $path . 'File.php';
142
-		include_once $path . 'RuntimeTests.php';
143
-		include_once $path . 'KeyProtectedByPassword.php';
144
-		include_once $path . 'Core.php';
136
+		include_once $path.'Crypto.php';
137
+		include_once $path.'Encoding.php';
138
+		include_once $path.'DerivedKeys.php';
139
+		include_once $path.'Key.php';
140
+		include_once $path.'KeyOrPassword.php';
141
+		include_once $path.'File.php';
142
+		include_once $path.'RuntimeTests.php';
143
+		include_once $path.'KeyProtectedByPassword.php';
144
+		include_once $path.'Core.php';
145 145
 	}
146 146
     
147 147
     // convert KEY
@@ -187,15 +187,15 @@  discard block
 block discarded – undo
187 187
         $path = '../includes/libraries/Encryption/Encryption/';
188 188
     }
189 189
 
190
-    include_once $path . 'Crypto.php';
191
-    include_once $path . 'Encoding.php';
192
-    include_once $path . 'DerivedKeys.php';
193
-    include_once $path . 'Key.php';
194
-    include_once $path . 'KeyOrPassword.php';
195
-    include_once $path . 'File.php';
196
-    include_once $path . 'RuntimeTests.php';
197
-    include_once $path . 'KeyProtectedByPassword.php';
198
-    include_once $path . 'Core.php';
190
+    include_once $path.'Crypto.php';
191
+    include_once $path.'Encoding.php';
192
+    include_once $path.'DerivedKeys.php';
193
+    include_once $path.'Key.php';
194
+    include_once $path.'KeyOrPassword.php';
195
+    include_once $path.'File.php';
196
+    include_once $path.'RuntimeTests.php';
197
+    include_once $path.'KeyProtectedByPassword.php';
198
+    include_once $path.'Core.php';
199 199
     $key = \Defuse\Crypto\Key::createNewRandomKey();
200 200
     $key = $key->saveToAsciiSafeString();
201 201
     return $key;
@@ -217,15 +217,15 @@  discard block
 block discarded – undo
217 217
         $path = '../includes/libraries/Encryption/Encryption/';
218 218
     }
219 219
 
220
-    include_once $path . 'Crypto.php';
221
-    include_once $path . 'Encoding.php';
222
-    include_once $path . 'DerivedKeys.php';
223
-    include_once $path . 'Key.php';
224
-    include_once $path . 'KeyOrPassword.php';
225
-    include_once $path . 'File.php';
226
-    include_once $path . 'RuntimeTests.php';
227
-    include_once $path . 'KeyProtectedByPassword.php';
228
-    include_once $path . 'Core.php';
220
+    include_once $path.'Crypto.php';
221
+    include_once $path.'Encoding.php';
222
+    include_once $path.'DerivedKeys.php';
223
+    include_once $path.'Key.php';
224
+    include_once $path.'KeyOrPassword.php';
225
+    include_once $path.'File.php';
226
+    include_once $path.'RuntimeTests.php';
227
+    include_once $path.'KeyProtectedByPassword.php';
228
+    include_once $path.'Core.php';
229 229
     $protected_key = \Defuse\Crypto\KeyProtectedByPassword::createRandomPasswordProtectedKey($psk);
230 230
     return $protected_key->saveToAsciiSafeString(); // save this in user table
231 231
 }
@@ -247,15 +247,15 @@  discard block
 block discarded – undo
247 247
         $path = '../includes/libraries/Encryption/Encryption/';
248 248
     }
249 249
 
250
-    include_once $path . 'Crypto.php';
251
-    include_once $path . 'Encoding.php';
252
-    include_once $path . 'DerivedKeys.php';
253
-    include_once $path . 'Key.php';
254
-    include_once $path . 'KeyOrPassword.php';
255
-    include_once $path . 'File.php';
256
-    include_once $path . 'RuntimeTests.php';
257
-    include_once $path . 'KeyProtectedByPassword.php';
258
-    include_once $path . 'Core.php';
250
+    include_once $path.'Crypto.php';
251
+    include_once $path.'Encoding.php';
252
+    include_once $path.'DerivedKeys.php';
253
+    include_once $path.'Key.php';
254
+    include_once $path.'KeyOrPassword.php';
255
+    include_once $path.'File.php';
256
+    include_once $path.'RuntimeTests.php';
257
+    include_once $path.'KeyProtectedByPassword.php';
258
+    include_once $path.'Core.php';
259 259
     try {
260 260
         $protected_key = \Defuse\Crypto\KeyProtectedByPassword::loadFromAsciiSafeString($protected_key_encoded);
261 261
         $user_key = $protected_key->unlockKey($psk);
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
  */
295 295
 function trimElement($chaine, string $element): string
296 296
 {
297
-    if (! empty($chaine)) {
297
+    if (!empty($chaine)) {
298 298
         if (is_array($chaine) === true) {
299 299
             $chaine = implode(';', $chaine);
300 300
         }
@@ -340,8 +340,8 @@  discard block
 block discarded – undo
340 340
  */
341 341
 function db_error_handler(array $params): void
342 342
 {
343
-    echo 'Error: ' . $params['error'] . "<br>\n";
344
-    echo 'Query: ' . $params['query'] . "<br>\n";
343
+    echo 'Error: '.$params['error']."<br>\n";
344
+    echo 'Query: '.$params['query']."<br>\n";
345 345
     throw new Exception('Error - Query', 1);
346 346
 }
347 347
 
@@ -363,12 +363,12 @@  discard block
 block discarded – undo
363 363
     $SETTINGS
364 364
 ) {
365 365
     //load ClassLoader
366
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
366
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
367 367
     // Load superglobal
368
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
368
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
369 369
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
370 370
     //Connect to DB
371
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
371
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
372 372
     if (defined('DB_PASSWD_CLEAR') === false) {
373 373
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
374 374
     }
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
     DB::$port = DB_PORT;
380 380
     DB::$encoding = DB_ENCODING;
381 381
     //Build tree
382
-    $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
382
+    $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
383 383
     $tree->register();
384 384
     $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
385 385
     // Check if user is ADMINISTRATOR
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 function identAdmin($idFonctions, $SETTINGS, $tree)
423 423
 {
424 424
     // Load superglobal
425
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
425
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
426 426
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
427 427
     // Init
428 428
     $groupesVisibles = [];
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
     $globalsVisibleFolders = $superGlobal->get('groupes_visibles', 'SESSION');
442 442
     $globalsPersonalVisibleFolders = $superGlobal->get('personal_visible_groups', 'SESSION');
443 443
     // Get list of Folders
444
-    $rows = DB::query('SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', 0);
444
+    $rows = DB::query('SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', 0);
445 445
     foreach ($rows as $record) {
446 446
         array_push($groupesVisibles, $record['id']);
447 447
     }
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
     }
461 461
     // Get ID of personal folder
462 462
     $persfld = DB::queryfirstrow(
463
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE title = %s',
463
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE title = %s',
464 464
         $globalsUserId
465 465
     );
466 466
     if (empty($persfld['id']) === false) {
@@ -481,20 +481,20 @@  discard block
 block discarded – undo
481 481
     // get complete list of ROLES
482 482
     $tmp = explode(';', $idFonctions);
483 483
     $rows = DB::query(
484
-        'SELECT * FROM ' . prefixTable('roles_title') . '
484
+        'SELECT * FROM '.prefixTable('roles_title').'
485 485
         ORDER BY title ASC'
486 486
     );
487 487
     foreach ($rows as $record) {
488
-        if (! empty($record['id']) && ! in_array($record['id'], $tmp)) {
488
+        if (!empty($record['id']) && !in_array($record['id'], $tmp)) {
489 489
             array_push($tmp, $record['id']);
490 490
         }
491 491
     }
492 492
     $superGlobal->put('fonction_id', implode(';', $tmp), 'SESSION');
493 493
     $superGlobal->put('is_admin', 1, 'SESSION');
494 494
     // Check if admin has created Folders and Roles
495
-    DB::query('SELECT * FROM ' . prefixTable('nested_tree') . '');
495
+    DB::query('SELECT * FROM '.prefixTable('nested_tree').'');
496 496
     $superGlobal->put('nb_folders', DB::count(), 'SESSION');
497
-    DB::query('SELECT * FROM ' . prefixTable('roles_title'));
497
+    DB::query('SELECT * FROM '.prefixTable('roles_title'));
498 498
     $superGlobal->put('nb_roles', DB::count(), 'SESSION');
499 499
 }
500 500
 
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
     object $tree
537 537
 ) {
538 538
     // Load superglobal
539
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
539
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
540 540
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
541 541
     // Init
542 542
     $superGlobal->put('groupes_visibles', [], 'SESSION');
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
     // Get list of folders depending on Roles
565 565
     $rows = DB::query(
566 566
         'SELECT *
567
-        FROM ' . prefixTable('roles_values') . '
567
+        FROM ' . prefixTable('roles_values').'
568 568
         WHERE role_id IN %li AND type IN %ls',
569 569
         $userRoles,
570 570
         ['W', 'ND', 'NE', 'NDNE', 'R']
@@ -589,10 +589,10 @@  discard block
 block discarded – undo
589 589
     // Does this user is allowed to see other items
590 590
     $inc = 0;
591 591
     $rows = DB::query(
592
-        'SELECT id, id_tree FROM ' . prefixTable('items') . '
592
+        'SELECT id, id_tree FROM '.prefixTable('items').'
593 593
             WHERE restricted_to LIKE %ss AND inactif = %s'.
594 594
             (count($allowedFolders) > 0 ? ' AND id_tree NOT IN ('.implode(',', $allowedFolders).')' : ''),
595
-        $globalsUserId . ';',
595
+        $globalsUserId.';',
596 596
         '0'
597 597
     );
598 598
     foreach ($rows as $record) {
@@ -606,8 +606,8 @@  discard block
 block discarded – undo
606 606
     // Check for the users roles if some specific rights exist on items
607 607
     $rows = DB::query(
608 608
         'SELECT i.id_tree, r.item_id
609
-        FROM ' . prefixTable('items') . ' as i
610
-        INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (r.item_id=i.id)
609
+        FROM ' . prefixTable('items').' as i
610
+        INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (r.item_id=i.id)
611 611
         WHERE r.role_id IN %li AND i.id_tree <> ""
612 612
         ORDER BY i.id_tree ASC',
613 613
         $userRoles
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
     ) {
629 629
         $persoFld = DB::queryfirstrow(
630 630
             'SELECT id
631
-            FROM ' . prefixTable('nested_tree') . '
631
+            FROM ' . prefixTable('nested_tree').'
632 632
             WHERE title = %s AND personal_folder = %i'.
633 633
             (count($allowedFolders) > 0 ? ' AND id NOT IN ('.implode(',', $allowedFolders).')' : ''),
634 634
             $globalsUserId,
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
     }
663 663
     $persoFlds = DB::query(
664 664
         'SELECT id
665
-        FROM ' . prefixTable('nested_tree') . '
665
+        FROM ' . prefixTable('nested_tree').'
666 666
         WHERE %l',
667 667
         $where
668 668
     );
@@ -704,16 +704,16 @@  discard block
 block discarded – undo
704 704
         'SESSION'
705 705
     );
706 706
     // Folders and Roles numbers
707
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('nested_tree') . '');
707
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('nested_tree').'');
708 708
     $superGlobal->put('nb_folders', DB::count(), 'SESSION');
709
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('roles_title'));
709
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('roles_title'));
710 710
     $superGlobal->put('nb_roles', DB::count(), 'SESSION');
711 711
     // check if change proposals on User's items
712 712
     if (isset($SETTINGS['enable_suggestion']) === true && (int) $SETTINGS['enable_suggestion'] === 1) {
713 713
         DB::query(
714 714
             'SELECT *
715
-            FROM ' . prefixTable('items_change') . ' AS c
716
-            LEFT JOIN ' . prefixTable('log_items') . ' AS i ON (c.item_id = i.id_item)
715
+            FROM ' . prefixTable('items_change').' AS c
716
+            LEFT JOIN ' . prefixTable('log_items').' AS i ON (c.item_id = i.id_item)
717 717
             WHERE i.action = %s AND i.id_user = %i',
718 718
             'at_creation',
719 719
             $globalsUserId
@@ -757,9 +757,9 @@  discard block
 block discarded – undo
757 757
  */
758 758
 function cacheTableRefresh(array $SETTINGS): void
759 759
 {
760
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
760
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
761 761
     //Connect to DB
762
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
762
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
763 763
     if (defined('DB_PASSWD_CLEAR') === false) {
764 764
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
765 765
     }
@@ -774,12 +774,12 @@  discard block
 block discarded – undo
774 774
     $tree->register();
775 775
     $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
776 776
     // truncate table
777
-    DB::query('TRUNCATE TABLE ' . prefixTable('cache'));
777
+    DB::query('TRUNCATE TABLE '.prefixTable('cache'));
778 778
     // reload date
779 779
     $rows = DB::query(
780 780
         'SELECT *
781
-        FROM ' . prefixTable('items') . ' as i
782
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
781
+        FROM ' . prefixTable('items').' as i
782
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
783 783
         AND l.action = %s
784 784
         AND i.inactif = %i',
785 785
         'at_creation',
@@ -791,18 +791,18 @@  discard block
 block discarded – undo
791 791
             $tags = '';
792 792
             $itemTags = DB::query(
793 793
                 'SELECT tag
794
-                            FROM ' . prefixTable('tags') . '
794
+                            FROM ' . prefixTable('tags').'
795 795
                             WHERE item_id = %i AND tag != ""',
796 796
                 $record['id']
797 797
             );
798 798
             foreach ($itemTags as $itemTag) {
799
-                $tags .= $itemTag['tag'] . ' ';
799
+                $tags .= $itemTag['tag'].' ';
800 800
             }
801 801
 
802 802
             // Get renewal period
803 803
             $resNT = DB::queryfirstrow(
804 804
                 'SELECT renewal_period
805
-                FROM ' . prefixTable('nested_tree') . '
805
+                FROM ' . prefixTable('nested_tree').'
806 806
                 WHERE id = %i',
807 807
                 $record['id_tree']
808 808
             );
@@ -815,7 +815,7 @@  discard block
 block discarded – undo
815 815
                     // Is this a User id?
816 816
                     $user = DB::queryfirstrow(
817 817
                         'SELECT id, login
818
-                        FROM ' . prefixTable('users') . '
818
+                        FROM ' . prefixTable('users').'
819 819
                         WHERE id = %i',
820 820
                         $elem->title
821 821
                     );
@@ -833,11 +833,11 @@  discard block
 block discarded – undo
833 833
                     'id' => $record['id'],
834 834
                     'label' => $record['label'],
835 835
                     'description' => $record['description'] ?? '',
836
-                    'url' => isset($record['url']) && ! empty($record['url']) ? $record['url'] : '0',
836
+                    'url' => isset($record['url']) && !empty($record['url']) ? $record['url'] : '0',
837 837
                     'tags' => $tags,
838 838
                     'id_tree' => $record['id_tree'],
839 839
                     'perso' => $record['perso'],
840
-                    'restricted_to' => isset($record['restricted_to']) && ! empty($record['restricted_to']) ? $record['restricted_to'] : '0',
840
+                    'restricted_to' => isset($record['restricted_to']) && !empty($record['restricted_to']) ? $record['restricted_to'] : '0',
841 841
                     'login' => $record['login'] ?? '',
842 842
                     'folder' => implode(' > ', $folder),
843 843
                     'author' => $record['id_user'],
@@ -857,12 +857,12 @@  discard block
 block discarded – undo
857 857
  */
858 858
 function cacheTableUpdate(array $SETTINGS, ?int $ident = null): void
859 859
 {
860
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
860
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
861 861
     // Load superglobal
862
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
862
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
863 863
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
864 864
     //Connect to DB
865
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
865
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
866 866
     if (defined('DB_PASSWD_CLEAR') === false) {
867 867
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
868 868
     }
@@ -879,7 +879,7 @@  discard block
 block discarded – undo
879 879
     // get new value from db
880 880
     $data = DB::queryfirstrow(
881 881
         'SELECT label, description, id_tree, perso, restricted_to, login, url
882
-        FROM ' . prefixTable('items') . '
882
+        FROM ' . prefixTable('items').'
883 883
         WHERE id=%i',
884 884
         $ident
885 885
     );
@@ -887,12 +887,12 @@  discard block
 block discarded – undo
887 887
     $tags = '';
888 888
     $itemTags = DB::query(
889 889
         'SELECT tag
890
-            FROM ' . prefixTable('tags') . '
890
+            FROM ' . prefixTable('tags').'
891 891
             WHERE item_id = %i AND tag != ""',
892 892
         $ident
893 893
     );
894 894
     foreach ($itemTags as $itemTag) {
895
-        $tags .= $itemTag['tag'] . ' ';
895
+        $tags .= $itemTag['tag'].' ';
896 896
     }
897 897
     // form id_tree to full foldername
898 898
     $folder = [];
@@ -903,7 +903,7 @@  discard block
 block discarded – undo
903 903
             // Is this a User id?
904 904
             $user = DB::queryfirstrow(
905 905
                 'SELECT id, login
906
-                FROM ' . prefixTable('users') . '
906
+                FROM ' . prefixTable('users').'
907 907
                 WHERE id = %i',
908 908
                 $elem->title
909 909
             );
@@ -921,10 +921,10 @@  discard block
 block discarded – undo
921 921
             'label' => $data['label'],
922 922
             'description' => $data['description'],
923 923
             'tags' => $tags,
924
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
924
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
925 925
             'id_tree' => $data['id_tree'],
926 926
             'perso' => $data['perso'],
927
-            'restricted_to' => isset($data['restricted_to']) && ! empty($data['restricted_to']) ? $data['restricted_to'] : '0',
927
+            'restricted_to' => isset($data['restricted_to']) && !empty($data['restricted_to']) ? $data['restricted_to'] : '0',
928 928
             'login' => $data['login'] ?? '',
929 929
             'folder' => implode(' » ', $folder),
930 930
             'author' => $superGlobal->get('user_id', 'SESSION'),
@@ -942,14 +942,14 @@  discard block
 block discarded – undo
942 942
  */
943 943
 function cacheTableAdd(array $SETTINGS, ?int $ident = null): void
944 944
 {
945
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
945
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
946 946
     // Load superglobal
947
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
947
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
948 948
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
949 949
     // Get superglobals
950 950
     $globalsUserId = $superGlobal->get('user_id', 'SESSION');
951 951
     //Connect to DB
952
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
952
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
953 953
     if (defined('DB_PASSWD_CLEAR') === false) {
954 954
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
955 955
     }
@@ -966,8 +966,8 @@  discard block
 block discarded – undo
966 966
     // get new value from db
967 967
     $data = DB::queryFirstRow(
968 968
         'SELECT i.label, i.description, i.id_tree as id_tree, i.perso, i.restricted_to, i.id, i.login, i.url, l.date
969
-        FROM ' . prefixTable('items') . ' as i
970
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
969
+        FROM ' . prefixTable('items').' as i
970
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
971 971
         WHERE i.id = %i
972 972
         AND l.action = %s',
973 973
         $ident,
@@ -977,12 +977,12 @@  discard block
 block discarded – undo
977 977
     $tags = '';
978 978
     $itemTags = DB::query(
979 979
         'SELECT tag
980
-            FROM ' . prefixTable('tags') . '
980
+            FROM ' . prefixTable('tags').'
981 981
             WHERE item_id = %i AND tag != ""',
982 982
         $ident
983 983
     );
984 984
     foreach ($itemTags as $itemTag) {
985
-        $tags .= $itemTag['tag'] . ' ';
985
+        $tags .= $itemTag['tag'].' ';
986 986
     }
987 987
     // form id_tree to full foldername
988 988
     $folder = [];
@@ -993,7 +993,7 @@  discard block
 block discarded – undo
993 993
             // Is this a User id?
994 994
             $user = DB::queryfirstrow(
995 995
                 'SELECT id, login
996
-                FROM ' . prefixTable('users') . '
996
+                FROM ' . prefixTable('users').'
997 997
                 WHERE id = %i',
998 998
                 $elem->title
999 999
             );
@@ -1012,7 +1012,7 @@  discard block
 block discarded – undo
1012 1012
             'label' => $data['label'],
1013 1013
             'description' => $data['description'],
1014 1014
             'tags' => isset($tags) && empty($tags) === false ? $tags : 'None',
1015
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
1015
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
1016 1016
             'id_tree' => $data['id_tree'],
1017 1017
             'perso' => isset($data['perso']) && empty($data['perso']) === false && $data['perso'] !== 'None' ? $data['perso'] : '0',
1018 1018
             'restricted_to' => isset($data['restricted_to']) && empty($data['restricted_to']) === false ? $data['restricted_to'] : '0',
@@ -1034,52 +1034,52 @@  discard block
 block discarded – undo
1034 1034
 function getStatisticsData(array $SETTINGS): array
1035 1035
 {
1036 1036
     DB::query(
1037
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
1037
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
1038 1038
         0
1039 1039
     );
1040 1040
     $counter_folders = DB::count();
1041 1041
     DB::query(
1042
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
1042
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
1043 1043
         1
1044 1044
     );
1045 1045
     $counter_folders_perso = DB::count();
1046 1046
     DB::query(
1047
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
1047
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
1048 1048
         0
1049 1049
     );
1050 1050
     $counter_items = DB::count();
1051 1051
         DB::query(
1052
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
1052
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
1053 1053
         1
1054 1054
     );
1055 1055
     $counter_items_perso = DB::count();
1056 1056
         DB::query(
1057
-        'SELECT id FROM ' . prefixTable('users') . ''
1057
+        'SELECT id FROM '.prefixTable('users').''
1058 1058
     );
1059 1059
     $counter_users = DB::count();
1060 1060
         DB::query(
1061
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE admin = %i',
1061
+        'SELECT id FROM '.prefixTable('users').' WHERE admin = %i',
1062 1062
         1
1063 1063
     );
1064 1064
     $admins = DB::count();
1065 1065
     DB::query(
1066
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE gestionnaire = %i',
1066
+        'SELECT id FROM '.prefixTable('users').' WHERE gestionnaire = %i',
1067 1067
         1
1068 1068
     );
1069 1069
     $managers = DB::count();
1070 1070
     DB::query(
1071
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE read_only = %i',
1071
+        'SELECT id FROM '.prefixTable('users').' WHERE read_only = %i',
1072 1072
         1
1073 1073
     );
1074 1074
     $readOnly = DB::count();
1075 1075
     // list the languages
1076 1076
     $usedLang = [];
1077 1077
     $tp_languages = DB::query(
1078
-        'SELECT name FROM ' . prefixTable('languages')
1078
+        'SELECT name FROM '.prefixTable('languages')
1079 1079
     );
1080 1080
     foreach ($tp_languages as $tp_language) {
1081 1081
         DB::query(
1082
-            'SELECT * FROM ' . prefixTable('users') . ' WHERE user_language = %s',
1082
+            'SELECT * FROM '.prefixTable('users').' WHERE user_language = %s',
1083 1083
             $tp_language['name']
1084 1084
         );
1085 1085
         $usedLang[$tp_language['name']] = round((DB::count() * 100 / $counter_users), 0);
@@ -1088,12 +1088,12 @@  discard block
 block discarded – undo
1088 1088
     // get list of ips
1089 1089
     $usedIp = [];
1090 1090
     $tp_ips = DB::query(
1091
-        'SELECT user_ip FROM ' . prefixTable('users')
1091
+        'SELECT user_ip FROM '.prefixTable('users')
1092 1092
     );
1093 1093
     foreach ($tp_ips as $ip) {
1094 1094
         if (array_key_exists($ip['user_ip'], $usedIp)) {
1095 1095
             $usedIp[$ip['user_ip']] += $usedIp[$ip['user_ip']];
1096
-        } elseif (! empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1096
+        } elseif (!empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1097 1097
             $usedIp[$ip['user_ip']] = 1;
1098 1098
         }
1099 1099
     }
@@ -1159,21 +1159,21 @@  discard block
 block discarded – undo
1159 1159
     }
1160 1160
 
1161 1161
     // Load settings
1162
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
1162
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
1163 1163
     // Load superglobal
1164
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1164
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1165 1165
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1166 1166
     // Get user language
1167
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $superGlobal->get('user_language', 'SESSION') . '.php';
1167
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$superGlobal->get('user_language', 'SESSION').'.php';
1168 1168
     // Load library
1169
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1169
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1170 1170
     // load PHPMailer
1171 1171
     $mail = new SplClassLoader('PHPMailer\PHPMailer', '../includes/libraries');
1172 1172
     $mail->register();
1173 1173
     $mail = new PHPMailer\PHPMailer\PHPMailer(true);
1174 1174
     try {
1175 1175
         // send to user
1176
-        $mail->setLanguage('en', $SETTINGS['cpassman_dir'] . '/includes/libraries/PHPMailer/PHPMailer/language/');
1176
+        $mail->setLanguage('en', $SETTINGS['cpassman_dir'].'/includes/libraries/PHPMailer/PHPMailer/language/');
1177 1177
         $mail->SMTPDebug = 0;
1178 1178
         //value 1 can be used to debug - 4 for debuging connections
1179 1179
         $mail->Port = $SETTINGS['email_port'];
@@ -1265,7 +1265,7 @@  discard block
 block discarded – undo
1265 1265
         <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;">
1266 1266
         <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;">
1267 1267
         <br><div style="float:right;">' .
1268
-        $textMail .
1268
+        $textMail.
1269 1269
         '<br><br></td></tr></table>
1270 1270
     </td></tr></table>
1271 1271
     <br></body></html>';
@@ -1276,7 +1276,7 @@  discard block
 block discarded – undo
1276 1276
  */
1277 1277
 function generateKey(): string
1278 1278
 {
1279
-    return substr(md5(rand() . rand()), 0, 15);
1279
+    return substr(md5(rand().rand()), 0, 15);
1280 1280
 }
1281 1281
 
1282 1282
 /**
@@ -1347,7 +1347,7 @@  discard block
 block discarded – undo
1347 1347
 {
1348 1348
     array_walk_recursive(
1349 1349
         $array,
1350
-        static function (&$item): void {
1350
+        static function(&$item): void {
1351 1351
             if (mb_detect_encoding((string) $item, 'utf-8', true) === false) {
1352 1352
                 $item = utf8_encode($item);
1353 1353
             }
@@ -1382,7 +1382,7 @@  discard block
 block discarded – undo
1382 1382
     }
1383 1383
 
1384 1384
     // Load superglobal
1385
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1385
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1386 1386
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1387 1387
     // Get superglobals
1388 1388
     if ($key !== null) {
@@ -1393,9 +1393,9 @@  discard block
 block discarded – undo
1393 1393
     }
1394 1394
 
1395 1395
     //load ClassLoader
1396
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1396
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1397 1397
     //Load AES
1398
-    $aes = new SplClassLoader('Encryption\Crypt', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1398
+    $aes = new SplClassLoader('Encryption\Crypt', $SETTINGS['cpassman_dir'].'/includes/libraries');
1399 1399
     $aes->register();
1400 1400
     if ($type === 'encode' && is_array($data) === true) {
1401 1401
         // Ensure UTF8 format
@@ -1482,8 +1482,8 @@  discard block
 block discarded – undo
1482 1482
  */
1483 1483
 function prefixTable(string $table): string
1484 1484
 {
1485
-    $safeTable = htmlspecialchars(DB_PREFIX . $table);
1486
-    if (! empty($safeTable)) {
1485
+    $safeTable = htmlspecialchars(DB_PREFIX.$table);
1486
+    if (!empty($safeTable)) {
1487 1487
         // sanitize string
1488 1488
         return $safeTable;
1489 1489
     }
@@ -1511,13 +1511,13 @@  discard block
 block discarded – undo
1511 1511
     bool $lowercase = false,
1512 1512
     array $SETTINGS = []
1513 1513
 ): string {
1514
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1515
-    $generator = new SplClassLoader('PasswordGenerator\Generator', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1514
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1515
+    $generator = new SplClassLoader('PasswordGenerator\Generator', $SETTINGS['cpassman_dir'].'/includes/libraries');
1516 1516
     $generator->register();
1517 1517
     $generator = new PasswordGenerator\Generator\ComputerPasswordGenerator();
1518 1518
     // Is PHP7 being used?
1519 1519
     if (version_compare(PHP_VERSION, '7.0.0', '>=')) {
1520
-        $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1520
+        $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', $SETTINGS['cpassman_dir'].'/includes/libraries');
1521 1521
         $php7generator->register();
1522 1522
         $generator->setRandomGenerator(new PasswordGenerator\RandomGenerator\Php7RandomGenerator());
1523 1523
     }
@@ -1547,7 +1547,7 @@  discard block
 block discarded – undo
1547 1547
 function send_syslog($message, $host, $port, $component = 'teampass'): void
1548 1548
 {
1549 1549
     $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
1550
-    $syslog_message = '<123>' . date('M d H:i:s ') . $component . ': ' . $message;
1550
+    $syslog_message = '<123>'.date('M d H:i:s ').$component.': '.$message;
1551 1551
     socket_sendto($sock, $syslog_message, strlen($syslog_message), 0, $host, $port);
1552 1552
     socket_close($sock);
1553 1553
 }
@@ -1569,7 +1569,7 @@  discard block
 block discarded – undo
1569 1569
     }
1570 1570
 
1571 1571
     // include librairies & connect to DB
1572
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1572
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1573 1573
     if (defined('DB_PASSWD_CLEAR') === false) {
1574 1574
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1575 1575
     }
@@ -1593,14 +1593,14 @@  discard block
 block discarded – undo
1593 1593
     if (isset($SETTINGS['syslog_enable']) === true && (int) $SETTINGS['syslog_enable'] === 1) {
1594 1594
         if ($type === 'user_mngt') {
1595 1595
             send_syslog(
1596
-                'action=' . str_replace('at_', '', $label) . ' attribute=user user=' . $who . ' userid="' . $login . '" change="' . $field_1 . '" ',
1596
+                'action='.str_replace('at_', '', $label).' attribute=user user='.$who.' userid="'.$login.'" change="'.$field_1.'" ',
1597 1597
                 $SETTINGS['syslog_host'],
1598 1598
                 $SETTINGS['syslog_port'],
1599 1599
                 'teampass'
1600 1600
             );
1601 1601
         } else {
1602 1602
             send_syslog(
1603
-                'action=' . $type . ' attribute=' . $label . ' user=' . $who . ' userid="' . $login . '" ',
1603
+                'action='.$type.' attribute='.$label.' user='.$who.' userid="'.$login.'" ',
1604 1604
                 $SETTINGS['syslog_host'],
1605 1605
                 $SETTINGS['syslog_port'],
1606 1606
                 'teampass'
@@ -1632,7 +1632,7 @@  discard block
 block discarded – undo
1632 1632
     ?string $encryption_type = null
1633 1633
 ): void {
1634 1634
     // include librairies & connect to DB
1635
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1635
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1636 1636
     if (defined('DB_PASSWD_CLEAR') === false) {
1637 1637
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1638 1638
     }
@@ -1676,7 +1676,7 @@  discard block
 block discarded – undo
1676 1676
         if (empty($item_label) === true) {
1677 1677
             $dataItem = DB::queryfirstrow(
1678 1678
                 'SELECT id, id_tree, label
1679
-                FROM ' . prefixTable('items') . '
1679
+                FROM ' . prefixTable('items').'
1680 1680
                 WHERE id = %i',
1681 1681
                 $item_id
1682 1682
             );
@@ -1684,11 +1684,11 @@  discard block
 block discarded – undo
1684 1684
         }
1685 1685
 
1686 1686
         send_syslog(
1687
-            'action=' . str_replace('at_', '', $action) .
1688
-                ' attribute=' . str_replace('at_', '', $attribute[0]) .
1689
-                ' itemno=' . $item_id .
1690
-                ' user=' . is_null($login) === true ? '' : addslashes((string) $login) .
1691
-                ' itemname="' . addslashes($item_label) . '"',
1687
+            'action='.str_replace('at_', '', $action).
1688
+                ' attribute='.str_replace('at_', '', $attribute[0]).
1689
+                ' itemno='.$item_id.
1690
+                ' user='.is_null($login) === true ? '' : addslashes((string) $login).
1691
+                ' itemname="'.addslashes($item_label).'"',
1692 1692
             $SETTINGS['syslog_host'],
1693 1693
             $SETTINGS['syslog_port'],
1694 1694
             'teampass'
@@ -1714,7 +1714,7 @@  discard block
 block discarded – undo
1714 1714
         && $action === 'at_shown'
1715 1715
     ) {
1716 1716
         // Load superglobal
1717
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1717
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1718 1718
         $superGlobal = new protect\SuperGlobal\SuperGlobal();
1719 1719
         // Get superglobals
1720 1720
         $globalsLastname = $superGlobal->get('lastname', 'SESSION');
@@ -1723,7 +1723,7 @@  discard block
 block discarded – undo
1723 1723
         // Get info about item
1724 1724
         $dataItem = DB::queryfirstrow(
1725 1725
             'SELECT id, id_tree, label
1726
-            FROM ' . prefixTable('items') . '
1726
+            FROM ' . prefixTable('items').'
1727 1727
             WHERE id = %i',
1728 1728
             $item_id
1729 1729
         );
@@ -1737,9 +1737,9 @@  discard block
 block discarded – undo
1737 1737
                 'body' => str_replace(
1738 1738
                     ['#tp_user#', '#tp_item#', '#tp_link#'],
1739 1739
                     [
1740
-                        addslashes($globalsName . ' ' . $globalsLastname),
1740
+                        addslashes($globalsName.' '.$globalsLastname),
1741 1741
                         addslashes($item_label),
1742
-                        $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $item_id,
1742
+                        $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$item_id,
1743 1743
                     ],
1744 1744
                     langHdl('email_on_open_notification_mail')
1745 1745
                 ),
@@ -1761,7 +1761,7 @@  discard block
 block discarded – undo
1761 1761
 function notifyChangesToSubscribers(int $item_id, string $label, array $changes, array $SETTINGS): void
1762 1762
 {
1763 1763
     // Load superglobal
1764
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1764
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1765 1765
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1766 1766
     // Get superglobals
1767 1767
     $globalsUserId = $superGlobal->get('user_id', 'SESSION');
@@ -1771,8 +1771,8 @@  discard block
 block discarded – undo
1771 1771
     $notification = DB::queryOneColumn(
1772 1772
         'email',
1773 1773
         'SELECT *
1774
-        FROM ' . prefixTable('notification') . ' AS n
1775
-        INNER JOIN ' . prefixTable('users') . ' AS u ON (n.user_id = u.id)
1774
+        FROM ' . prefixTable('notification').' AS n
1775
+        INNER JOIN ' . prefixTable('users').' AS u ON (n.user_id = u.id)
1776 1776
         WHERE n.item_id = %i AND n.user_id != %i',
1777 1777
         $item_id,
1778 1778
         $globalsUserId
@@ -1783,7 +1783,7 @@  discard block
 block discarded – undo
1783 1783
         // Get list of changes
1784 1784
         $htmlChanges = '<ul>';
1785 1785
         foreach ($changes as $change) {
1786
-            $htmlChanges .= '<li>' . $change . '</li>';
1786
+            $htmlChanges .= '<li>'.$change.'</li>';
1787 1787
         }
1788 1788
         $htmlChanges .= '</ul>';
1789 1789
         // send email
@@ -1814,7 +1814,7 @@  discard block
 block discarded – undo
1814 1814
 function geItemReadablePath(int $id_tree, string $label, array $SETTINGS): string
1815 1815
 {
1816 1816
     // Class loader
1817
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1817
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1818 1818
     //Load Tree
1819 1819
     $tree = new SplClassLoader('Tree\NestedTree', '../includes/libraries');
1820 1820
     $tree->register();
@@ -1823,15 +1823,15 @@  discard block
 block discarded – undo
1823 1823
     $path = '';
1824 1824
     foreach ($arbo as $elem) {
1825 1825
         if (empty($path) === true) {
1826
-            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' ';
1826
+            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' ';
1827 1827
         } else {
1828
-            $path .= '&#8594; ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1828
+            $path .= '&#8594; '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1829 1829
         }
1830 1830
     }
1831 1831
 
1832 1832
     // Build text to show user
1833 1833
     if (empty($label) === false) {
1834
-        return empty($path) === true ? addslashes($label) : addslashes($label) . ' (' . $path . ')';
1834
+        return empty($path) === true ? addslashes($label) : addslashes($label).' ('.$path.')';
1835 1835
     }
1836 1836
     return empty($path) === true ? '' : $path;
1837 1837
 }
@@ -1886,9 +1886,9 @@  discard block
 block discarded – undo
1886 1886
  */
1887 1887
 function handleConfigFile($action, $SETTINGS, $field = null, $value = null)
1888 1888
 {
1889
-    $tp_config_file = $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php';
1889
+    $tp_config_file = $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php';
1890 1890
     // include librairies & connect to DB
1891
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1891
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1892 1892
     if (defined('DB_PASSWD_CLEAR') === false) {
1893 1893
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1894 1894
     }
@@ -1901,8 +1901,8 @@  discard block
 block discarded – undo
1901 1901
     if (file_exists($tp_config_file) === false || $action === 'rebuild') {
1902 1902
         // perform a copy
1903 1903
         if (file_exists($tp_config_file)) {
1904
-            if (! copy($tp_config_file, $tp_config_file . '.' . date('Y_m_d_His', time()))) {
1905
-                return "ERROR: Could not copy file '" . $tp_config_file . "'";
1904
+            if (!copy($tp_config_file, $tp_config_file.'.'.date('Y_m_d_His', time()))) {
1905
+                return "ERROR: Could not copy file '".$tp_config_file."'";
1906 1906
             }
1907 1907
         }
1908 1908
 
@@ -1912,11 +1912,11 @@  discard block
 block discarded – undo
1912 1912
         $data[1] = "global \$SETTINGS;\n";
1913 1913
         $data[2] = "\$SETTINGS = array (\n";
1914 1914
         $rows = DB::query(
1915
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s',
1915
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s',
1916 1916
             'admin'
1917 1917
         );
1918 1918
         foreach ($rows as $record) {
1919
-            array_push($data, "    '" . $record['intitule'] . "' => '" . $record['valeur'] . "',\n");
1919
+            array_push($data, "    '".$record['intitule']."' => '".$record['valeur']."',\n");
1920 1920
         }
1921 1921
         array_push($data, ");\n");
1922 1922
         $data = array_unique($data);
@@ -1930,15 +1930,15 @@  discard block
 block discarded – undo
1930 1930
                 break;
1931 1931
             }
1932 1932
 
1933
-            if (stristr($line, "'" . $field . "' => '")) {
1934
-                $data[$inc] = "    '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n";
1933
+            if (stristr($line, "'".$field."' => '")) {
1934
+                $data[$inc] = "    '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n";
1935 1935
                 $bFound = true;
1936 1936
                 break;
1937 1937
             }
1938 1938
             ++$inc;
1939 1939
         }
1940 1940
         if ($bFound === false) {
1941
-            $data[$inc] = "    '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n);\n";
1941
+            $data[$inc] = "    '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n);\n";
1942 1942
         }
1943 1943
     }
1944 1944
 
@@ -1964,7 +1964,7 @@  discard block
 block discarded – undo
1964 1964
 {
1965 1965
     global $SETTINGS;
1966 1966
     /* LOAD CPASSMAN SETTINGS */
1967
-    if (! isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
1967
+    if (!isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
1968 1968
         $SETTINGS = [];
1969 1969
         $SETTINGS['duplicate_folder'] = 0;
1970 1970
         //by default, this is set to 0;
@@ -1974,7 +1974,7 @@  discard block
 block discarded – undo
1974 1974
         //by default, this value is set to 5;
1975 1975
         $settings = [];
1976 1976
         $rows = DB::query(
1977
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s_type OR type=%s_type2',
1977
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s_type OR type=%s_type2',
1978 1978
             [
1979 1979
                 'type' => 'admin',
1980 1980
                 'type2' => 'settings',
@@ -2001,7 +2001,7 @@  discard block
 block discarded – undo
2001 2001
     $source_cf = [];
2002 2002
     $rows = DB::QUERY(
2003 2003
         'SELECT id_category
2004
-            FROM ' . prefixTable('categories_folders') . '
2004
+            FROM ' . prefixTable('categories_folders').'
2005 2005
             WHERE id_folder = %i',
2006 2006
         $source_id
2007 2007
     );
@@ -2012,7 +2012,7 @@  discard block
 block discarded – undo
2012 2012
     $target_cf = [];
2013 2013
     $rows = DB::QUERY(
2014 2014
         'SELECT id_category
2015
-            FROM ' . prefixTable('categories_folders') . '
2015
+            FROM ' . prefixTable('categories_folders').'
2016 2016
             WHERE id_folder = %i',
2017 2017
         $target_id
2018 2018
     );
@@ -2047,9 +2047,9 @@  discard block
 block discarded – undo
2047 2047
     $password = null
2048 2048
 ) {
2049 2049
     // Load AntiXSS
2050
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php';
2051
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php';
2052
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php';
2050
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php';
2051
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php';
2052
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php';
2053 2053
     $antiXss = new voku\helper\AntiXSS();
2054 2054
     // Protect against bad inputs
2055 2055
     if (is_array($source_file) === true || is_array($target_file) === true) {
@@ -2061,7 +2061,7 @@  discard block
 block discarded – undo
2061 2061
     $target_file = $antiXss->xss_clean($target_file);
2062 2062
     if (empty($password) === true || is_null($password) === true) {
2063 2063
         // get KEY to define password
2064
-        $ascii_key = file_get_contents(SECUREPATH . '/teampass-seckey.txt');
2064
+        $ascii_key = file_get_contents(SECUREPATH.'/teampass-seckey.txt');
2065 2065
         $password = \Defuse\Crypto\Key::loadFromAsciiSafeString($ascii_key);
2066 2066
     }
2067 2067
 
@@ -2106,15 +2106,15 @@  discard block
 block discarded – undo
2106 2106
 ) {
2107 2107
     // load PhpEncryption library
2108 2108
     $path_to_encryption = '/includes/libraries/Encryption/Encryption/';
2109
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php';
2110
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php';
2111
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php';
2112
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php';
2113
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php';
2114
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php';
2115
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php';
2116
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php';
2117
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php';
2109
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php';
2110
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php';
2111
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php';
2112
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php';
2113
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php';
2114
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php';
2115
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php';
2116
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php';
2117
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php';
2118 2118
     try {
2119 2119
         \Defuse\Crypto\File::encryptFileWithPassword(
2120 2120
             $source_file,
@@ -2151,15 +2151,15 @@  discard block
 block discarded – undo
2151 2151
 ) {
2152 2152
     // load PhpEncryption library
2153 2153
     $path_to_encryption = '/includes/libraries/Encryption/Encryption/';
2154
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php';
2155
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php';
2156
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php';
2157
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php';
2158
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php';
2159
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php';
2160
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php';
2161
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php';
2162
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php';
2154
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php';
2155
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php';
2156
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php';
2157
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php';
2158
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php';
2159
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php';
2160
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php';
2161
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php';
2162
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php';
2163 2163
     try {
2164 2164
         \Defuse\Crypto\File::decryptFileWithPassword(
2165 2165
             $source_file,
@@ -2204,9 +2204,9 @@  discard block
 block discarded – undo
2204 2204
 function fileDelete(string $file, array $SETTINGS): void
2205 2205
 {
2206 2206
     // Load AntiXSS
2207
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php';
2208
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php';
2209
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php';
2207
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php';
2208
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php';
2209
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php';
2210 2210
     $antiXss = new voku\helper\AntiXSS();
2211 2211
     $file = $antiXss->xss_clean($file);
2212 2212
     if (is_file($file)) {
@@ -2250,7 +2250,7 @@  discard block
 block discarded – undo
2250 2250
 
2251 2251
 function recursiveChmod($path, $filePerm = 0644, $dirPerm = 0755) {
2252 2252
     // Check if the path exists
2253
-    if (! file_exists($path)) {
2253
+    if (!file_exists($path)) {
2254 2254
         return false;
2255 2255
     }
2256 2256
 
@@ -2285,7 +2285,7 @@  discard block
 block discarded – undo
2285 2285
  */
2286 2286
 function accessToItemIsGranted(int $item_id, $SETTINGS)
2287 2287
 {
2288
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2288
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2289 2289
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
2290 2290
     // Prepare superGlobal variables
2291 2291
     $session_groupes_visibles = $superGlobal->get('groupes_visibles', 'SESSION');
@@ -2293,7 +2293,7 @@  discard block
 block discarded – undo
2293 2293
     // Load item data
2294 2294
     $data = DB::queryFirstRow(
2295 2295
         'SELECT id_tree
2296
-        FROM ' . prefixTable('items') . '
2296
+        FROM ' . prefixTable('items').'
2297 2297
         WHERE id = %i',
2298 2298
         $item_id
2299 2299
     );
@@ -2366,8 +2366,8 @@  discard block
 block discarded – undo
2366 2366
 function performDBQuery(array $SETTINGS, string $fields, string $table): array
2367 2367
 {
2368 2368
     // include librairies & connect to DB
2369
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2370
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2369
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2370
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2371 2371
     if (defined('DB_PASSWD_CLEAR') === false) {
2372 2372
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2373 2373
     }
@@ -2379,7 +2379,7 @@  discard block
 block discarded – undo
2379 2379
     DB::$encoding = DB_ENCODING;
2380 2380
     // Insert log in DB
2381 2381
     return DB::query(
2382
-        'SELECT ' . $fields . '
2382
+        'SELECT '.$fields.'
2383 2383
         FROM ' . prefixTable($table)
2384 2384
     );
2385 2385
 }
@@ -2392,11 +2392,11 @@  discard block
 block discarded – undo
2392 2392
 function formatSizeUnits(int $bytes): string
2393 2393
 {
2394 2394
     if ($bytes >= 1073741824) {
2395
-        $bytes = number_format($bytes / 1073741824, 2) . ' GB';
2395
+        $bytes = number_format($bytes / 1073741824, 2).' GB';
2396 2396
     } elseif ($bytes >= 1048576) {
2397
-        $bytes = number_format($bytes / 1048576, 2) . ' MB';
2397
+        $bytes = number_format($bytes / 1048576, 2).' MB';
2398 2398
     } elseif ($bytes >= 1024) {
2399
-        $bytes = number_format($bytes / 1024, 2) . ' KB';
2399
+        $bytes = number_format($bytes / 1024, 2).' KB';
2400 2400
     } elseif ($bytes > 1) {
2401 2401
         $bytes .= ' bytes';
2402 2402
     } elseif ($bytes === 1) {
@@ -2587,14 +2587,14 @@  discard block
 block discarded – undo
2587 2587
 
2588 2588
     // Encrypt the file content
2589 2589
     $plaintext = file_get_contents(
2590
-        filter_var($fileInPath . '/' . $fileInName, FILTER_SANITIZE_URL)
2590
+        filter_var($fileInPath.'/'.$fileInName, FILTER_SANITIZE_URL)
2591 2591
     );
2592 2592
     $ciphertext = $cipher->encrypt($plaintext);
2593 2593
     // Save new file
2594 2594
     $hash = md5($plaintext);
2595
-    $fileOut = $fileInPath . '/' . TP_FILE_PREFIX . $hash;
2595
+    $fileOut = $fileInPath.'/'.TP_FILE_PREFIX.$hash;
2596 2596
     file_put_contents($fileOut, $ciphertext);
2597
-    unlink($fileInPath . '/' . $fileInName);
2597
+    unlink($fileInPath.'/'.$fileInName);
2598 2598
     return [
2599 2599
         'fileHash' => base64_encode($hash),
2600 2600
         'objectKey' => base64_encode($objectKey),
@@ -2610,7 +2610,7 @@  discard block
 block discarded – undo
2610 2610
  */
2611 2611
 function decryptFile(string $fileName, string $filePath, string $key): string
2612 2612
 {
2613
-    if (! defined('FILE_BUFFER_SIZE')) {
2613
+    if (!defined('FILE_BUFFER_SIZE')) {
2614 2614
         define('FILE_BUFFER_SIZE', 128 * 1024);
2615 2615
     }
2616 2616
 
@@ -2629,7 +2629,7 @@  discard block
 block discarded – undo
2629 2629
     $cipher->enableContinuousBuffer();
2630 2630
     $cipher->disablePadding();
2631 2631
     // Get file content
2632
-    $ciphertext = file_get_contents($filePath . '/' . TP_FILE_PREFIX . $fileName);
2632
+    $ciphertext = file_get_contents($filePath.'/'.TP_FILE_PREFIX.$fileName);
2633 2633
     // Decrypt file content and return
2634 2634
     return base64_encode($cipher->decrypt($ciphertext));
2635 2635
 }
@@ -2679,8 +2679,8 @@  discard block
 block discarded – undo
2679 2679
     array $SETTINGS
2680 2680
 ): void {
2681 2681
     // include librairies & connect to DB
2682
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2683
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2682
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2683
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2684 2684
     if (defined('DB_PASSWD_CLEAR') === false) {
2685 2685
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2686 2686
     }
@@ -2697,7 +2697,7 @@  discard block
 block discarded – undo
2697 2697
         $post_object_id
2698 2698
     );
2699 2699
     // Superglobals
2700
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2700
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2701 2701
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
2702 2702
     // Prepare superGlobal variables
2703 2703
     $sessionPpersonaFolders = $superGlobal->get('personal_folders', 'SESSION');
@@ -2722,8 +2722,8 @@  discard block
 block discarded – undo
2722 2722
         // Create sharekey for each user
2723 2723
         $users = DB::query(
2724 2724
             'SELECT id, public_key
2725
-            FROM ' . prefixTable('users') . '
2726
-            WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '")
2725
+            FROM ' . prefixTable('users').'
2726
+            WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'")
2727 2727
             AND public_key != ""'
2728 2728
         );
2729 2729
         foreach ($users as $user) {
@@ -2751,7 +2751,7 @@  discard block
 block discarded – undo
2751 2751
 function isBase64(string $str): bool
2752 2752
 {
2753 2753
     $str = (string) trim($str);
2754
-    if (! isset($str[0])) {
2754
+    if (!isset($str[0])) {
2755 2755
         return false;
2756 2756
     }
2757 2757
 
@@ -2819,13 +2819,13 @@  discard block
 block discarded – undo
2819 2819
         ],
2820 2820
     ];
2821 2821
     // Load expected libraries
2822
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
2823
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php';
2824
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php';
2825
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php';
2826
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php';
2827
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapBase.php';
2828
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php';
2822
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
2823
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php';
2824
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php';
2825
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php';
2826
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php';
2827
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapBase.php';
2828
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php';
2829 2829
     $ad = new SplClassLoader('LdapRecord', '../includes/libraries');
2830 2830
     $ad->register();
2831 2831
     $connection = new Connection($config);
@@ -2834,7 +2834,7 @@  discard block
 block discarded – undo
2834 2834
         $connection->connect();
2835 2835
     } catch (\LdapRecord\Auth\BindException $e) {
2836 2836
         $error = $e->getDetailedError();
2837
-        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage();
2837
+        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage();
2838 2838
         return false;
2839 2839
     }
2840 2840
 
@@ -2843,7 +2843,7 @@  discard block
 block discarded – undo
2843 2843
         $connection->auth()->attempt($SETTINGS['ldap_user_attribute'].'='.$login.','.$SETTINGS['ldap_bdn'], $password, $stayAuthenticated = true);
2844 2844
     } catch (\LdapRecord\Auth\BindException $e) {
2845 2845
         $error = $e->getDetailedError();
2846
-        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage();
2846
+        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage();
2847 2847
         return false;
2848 2848
     }
2849 2849
 
@@ -2861,8 +2861,8 @@  discard block
 block discarded – undo
2861 2861
 function deleteUserObjetsKeys(int $userId, array $SETTINGS): bool
2862 2862
 {
2863 2863
     // include librairies & connect to DB
2864
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2865
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2864
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2865
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2866 2866
     if (defined('DB_PASSWD_CLEAR') === false) {
2867 2867
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2868 2868
     }
@@ -2920,7 +2920,7 @@  discard block
 block discarded – undo
2920 2920
         foreach (DateTimeZone::listIdentifiers() as $timezone) {
2921 2921
             $now->setTimezone(new DateTimeZone($timezone));
2922 2922
             $offsets[] = $offset = $now->getOffset();
2923
-            $timezones[$timezone] = '(' . format_GMT_offset($offset) . ') ' . format_timezone_name($timezone);
2923
+            $timezones[$timezone] = '('.format_GMT_offset($offset).') '.format_timezone_name($timezone);
2924 2924
         }
2925 2925
 
2926 2926
         array_multisort($offsets, $timezones);
@@ -2940,7 +2940,7 @@  discard block
 block discarded – undo
2940 2940
 {
2941 2941
     $hours = intval($offset / 3600);
2942 2942
     $minutes = abs(intval($offset % 3600 / 60));
2943
-    return 'GMT' . ($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
2943
+    return 'GMT'.($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
2944 2944
 }
2945 2945
 
2946 2946
 /**
Please login to merge, or discard this patch.
sources/users.queries.php 1 patch
Spacing   +141 added lines, -141 removed lines patch added patch discarded remove patch
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
 }
48 48
 
49 49
 /* do checks */
50
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
51
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
50
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
51
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
52 52
 $isprofileupdate = filter_input(INPUT_POST, 'isprofileupdate', FILTER_SANITIZE_STRING);
53 53
 if (
54 54
     checkUser($_SESSION['user_id'], $_SESSION['key'], 'profile', $SETTINGS) === false
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
         || $isprofileupdate === false
60 60
     ) {
61 61
         $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
62
-        include $SETTINGS['cpassman_dir'] . '/error.php';
62
+        include $SETTINGS['cpassman_dir'].'/error.php';
63 63
         exit();
64 64
     } else {
65 65
         // Do special check to allow user to change attributes of his profile
@@ -68,20 +68,20 @@  discard block
 block discarded – undo
68 68
             || checkUser($_SESSION['user_id'], $_SESSION['key'], 'profile', $SETTINGS) === false
69 69
         ) {
70 70
             $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
71
-            include $SETTINGS['cpassman_dir'] . '/error.php';
71
+            include $SETTINGS['cpassman_dir'].'/error.php';
72 72
             exit();
73 73
         }
74 74
     }
75 75
 }
76 76
 
77
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
77
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
78 78
 header('Content-type: text/html; charset=utf-8');
79
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
80
-require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
81
-require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
79
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
80
+require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
81
+require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
82 82
 
83 83
 // Connect to mysql server
84
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
84
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
85 85
 if (defined('DB_PASSWD_CLEAR') === false) {
86 86
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
87 87
 }
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
             // Prepare variables
131 131
             $login = filter_var($dataReceived['login'], FILTER_SANITIZE_STRING);
132 132
             $email = filter_var($dataReceived['email'], FILTER_SANITIZE_EMAIL);
133
-            $password = '';//filter_var($dataReceived['pw'], FILTER_SANITIZE_STRING);
133
+            $password = ''; //filter_var($dataReceived['pw'], FILTER_SANITIZE_STRING);
134 134
             $lastname = filter_var($dataReceived['lastname'], FILTER_SANITIZE_STRING);
135 135
             $name = filter_var($dataReceived['name'], FILTER_SANITIZE_STRING);
136 136
             $is_admin = filter_var($dataReceived['admin'], FILTER_SANITIZE_NUMBER_INT);
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
             // Check if user already exists
160 160
             $data = DB::query(
161 161
                 'SELECT id, fonction_id, groupes_interdits, groupes_visibles
162
-                FROM ' . prefixTable('users') . '
162
+                FROM ' . prefixTable('users').'
163 163
                 WHERE login = %s',
164 164
                 $login
165 165
             );
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 
390 390
             // Get info about user to delete
391 391
             $data_user = DB::queryfirstrow(
392
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
392
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
393 393
                 WHERE id = %i',
394 394
                 $post_id
395 395
             );
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
                 );
409 409
                 // delete personal folder and subfolders
410 410
                 $data = DB::queryfirstrow(
411
-                    'SELECT id FROM ' . prefixTable('nested_tree') . '
411
+                    'SELECT id FROM '.prefixTable('nested_tree').'
412 412
                     WHERE title = %s AND personal_folder = %i',
413 413
                     $post_id,
414 414
                     '1'
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
                         DB::delete(prefixTable('nested_tree'), 'id = %i AND personal_folder = %i', $folder->id, '1');
422 422
                         // delete items & logs
423 423
                         $items = DB::query(
424
-                            'SELECT id FROM ' . prefixTable('items') . '
424
+                            'SELECT id FROM '.prefixTable('items').'
425 425
                             WHERE id_tree=%i AND perso = %i',
426 426
                             $folder->id,
427 427
                             '1'
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
 
479 479
             // Get info about user to delete
480 480
             $data_user = DB::queryfirstrow(
481
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
481
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
482 482
                 WHERE id = %i',
483 483
                 $post_id
484 484
             );
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 
521 521
             // Get info about user to delete
522 522
             $data_user = DB::queryfirstrow(
523
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
523
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
524 524
                 WHERE id = %i',
525 525
                 $post_id
526 526
             );
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
             // Get info about user to delete
564 564
             $data_user = DB::queryfirstrow(
565 565
                 'SELECT admin, isAdministratedByRole, can_manage_all_users, gestionnaire
566
-                FROM ' . prefixTable('users') . '
566
+                FROM ' . prefixTable('users').'
567 567
                 WHERE id = %i',
568 568
                 $post_id
569 569
             );
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
 
608 608
             // Get info about user to delete
609 609
             $data_user = DB::queryfirstrow(
610
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
610
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
611 611
                 WHERE id = %i',
612 612
                 $post_id
613 613
             );
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
             // Get info about user to delete
651 651
             $data_user = DB::queryfirstrow(
652 652
                 'SELECT admin, isAdministratedByRole, gestionnaire
653
-                FROM ' . prefixTable('users') . '
653
+                FROM ' . prefixTable('users').'
654 654
                 WHERE id = %i',
655 655
                 $post_id
656 656
             );
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
             // Get info about user to delete
694 694
             $data_user = DB::queryfirstrow(
695 695
                 'SELECT admin, isAdministratedByRole, gestionnaire
696
-                FROM ' . prefixTable('users') . '
696
+                FROM ' . prefixTable('users').'
697 697
                 WHERE id = %i',
698 698
                 $post_id
699 699
             );
@@ -733,7 +733,7 @@  discard block
 block discarded – undo
733 733
             // Get info about user to delete
734 734
             $data_user = DB::queryfirstrow(
735 735
                 'SELECT admin, isAdministratedByRole, gestionnaire
736
-                FROM ' . prefixTable('users') . '
736
+                FROM ' . prefixTable('users').'
737 737
                 WHERE id = %i',
738 738
                 $post_id
739 739
             );
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
             $return = array();
773 773
             // Check if folder exists
774 774
             $data = DB::query(
775
-                'SELECT * FROM ' . prefixTable('nested_tree') . '
775
+                'SELECT * FROM '.prefixTable('nested_tree').'
776 776
                 WHERE title = %s AND parent_id = %i',
777 777
                 filter_input(INPUT_POST, 'domain', FILTER_SANITIZE_STRING),
778 778
                 '0'
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
             }
786 786
             // Check if role exists
787 787
             $data = DB::query(
788
-                'SELECT * FROM ' . prefixTable('roles_title') . '
788
+                'SELECT * FROM '.prefixTable('roles_title').'
789 789
                 WHERE title = %s',
790 790
                 filter_input(INPUT_POST, 'domain', FILTER_SANITIZE_STRING)
791 791
             );
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
         case 'user_log_items':
806 806
             $nb_pages = 1;
807 807
             $logs = $sql_filter = '';
808
-            $pages = '<table style=\'border-top:1px solid #969696;\'><tr><td>' . langHdl('pages') . '&nbsp;:&nbsp;</td>';
808
+            $pages = '<table style=\'border-top:1px solid #969696;\'><tr><td>'.langHdl('pages').'&nbsp;:&nbsp;</td>';
809 809
 
810 810
             // Prepare POST variables
811 811
             $post_nb_items_by_page = filter_input(INPUT_POST, 'nb_items_by_page', FILTER_SANITIZE_NUMBER_INT);
@@ -817,14 +817,14 @@  discard block
 block discarded – undo
817 817
                     && !empty(filter_input(INPUT_POST, 'filter', FILTER_SANITIZE_STRING))
818 818
                     && filter_input(INPUT_POST, 'filter', FILTER_SANITIZE_STRING) !== 'all'
819 819
                 ) {
820
-                    $sql_filter = " AND l.action = '" . filter_input(INPUT_POST, 'filter', FILTER_SANITIZE_STRING) . "'";
820
+                    $sql_filter = " AND l.action = '".filter_input(INPUT_POST, 'filter', FILTER_SANITIZE_STRING)."'";
821 821
                 }
822 822
                 // get number of pages
823 823
                 DB::query(
824 824
                     'SELECT *
825
-                    FROM ' . prefixTable('log_items') . ' as l
826
-                    INNER JOIN ' . prefixTable('items') . ' as i ON (l.id_item=i.id)
827
-                    INNER JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id)
825
+                    FROM ' . prefixTable('log_items').' as l
826
+                    INNER JOIN ' . prefixTable('items').' as i ON (l.id_item=i.id)
827
+                    INNER JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id)
828 828
                     WHERE l.id_user = %i ' . $sql_filter,
829 829
                     filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT)
830 830
                 );
@@ -842,19 +842,19 @@  discard block
 block discarded – undo
842 842
                 // launch query
843 843
                 $rows = DB::query(
844 844
                     'SELECT l.date as date, u.login as login, i.label as label, l.action as action
845
-                    FROM ' . prefixTable('log_items') . ' as l
846
-                    INNER JOIN ' . prefixTable('items') . ' as i ON (l.id_item=i.id)
847
-                    INNER JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id)
848
-                    WHERE l.id_user = %i ' . $sql_filter . '
845
+                    FROM ' . prefixTable('log_items').' as l
846
+                    INNER JOIN ' . prefixTable('items').' as i ON (l.id_item=i.id)
847
+                    INNER JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id)
848
+                    WHERE l.id_user = %i ' . $sql_filter.'
849 849
                     ORDER BY date DESC
850
-                    LIMIT ' . intval($start) . ',' . intval($post_nb_items_by_page),
850
+                    LIMIT ' . intval($start).','.intval($post_nb_items_by_page),
851 851
                     filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT)
852 852
                 );
853 853
             } else {
854 854
                 // get number of pages
855 855
                 DB::query(
856 856
                     'SELECT *
857
-                    FROM ' . prefixTable('log_system') . '
857
+                    FROM ' . prefixTable('log_system').'
858 858
                     WHERE type = %s AND field_1=%i',
859 859
                     'user_mngt',
860 860
                     filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT)
@@ -873,7 +873,7 @@  discard block
 block discarded – undo
873 873
                 // launch query
874 874
                 $rows = DB::query(
875 875
                     'SELECT *
876
-                    FROM ' . prefixTable('log_system') . '
876
+                    FROM ' . prefixTable('log_system').'
877 877
                     WHERE type = %s AND field_1 = %i
878 878
                     ORDER BY date DESC
879 879
                     LIMIT %i, %i',
@@ -887,7 +887,7 @@  discard block
 block discarded – undo
887 887
             if (isset($counter) && $counter != 0) {
888 888
                 $nb_pages = ceil($counter / intval($post_nb_items_by_page));
889 889
                 for ($i = 1; $i <= $nb_pages; ++$i) {
890
-                    $pages .= '<td onclick=\'displayLogs(' . $i . ',\"' . $post_scope . '\")\'><span style=\'cursor:pointer;' . (filter_input(INPUT_POST, 'page', FILTER_SANITIZE_NUMBER_INT) === $i ? 'font-weight:bold;font-size:18px;\'>' . $i : '\'>' . $i) . '</span></td>';
890
+                    $pages .= '<td onclick=\'displayLogs('.$i.',\"'.$post_scope.'\")\'><span style=\'cursor:pointer;'.(filter_input(INPUT_POST, 'page', FILTER_SANITIZE_NUMBER_INT) === $i ? 'font-weight:bold;font-size:18px;\'>'.$i : '\'>'.$i).'</span></td>';
891 891
                 }
892 892
             }
893 893
             $pages .= '</tr></table>';
@@ -896,7 +896,7 @@  discard block
 block discarded – undo
896 896
                     if ($post_scope === 'user_mngt') {
897 897
                         $user = DB::queryfirstrow(
898 898
                             'SELECT login
899
-                            from ' . prefixTable('users') . '
899
+                            from ' . prefixTable('users').'
900 900
                             WHERE id=%i',
901 901
                             $record['qui']
902 902
                         );
@@ -906,7 +906,7 @@  discard block
 block discarded – undo
906 906
                         if ($tmp[0] == 'at_user_initial_pwd_changed') {
907 907
                             $label = langHdl('log_user_initial_pwd_changed');
908 908
                         } elseif ($tmp[0] == 'at_user_email_changed') {
909
-                            $label = langHdl('log_user_email_changed') . $tmp[1];
909
+                            $label = langHdl('log_user_email_changed').$tmp[1];
910 910
                         } elseif ($tmp[0] == 'at_user_added') {
911 911
                             $label = langHdl('log_user_created');
912 912
                         } elseif ($tmp[0] == 'at_user_locked') {
@@ -917,14 +917,14 @@  discard block
 block discarded – undo
917 917
                             $label = langHdl('log_user_pwd_changed');
918 918
                         }
919 919
                         // prepare log
920
-                        $logs .= '<tr><td>' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) . '</td><td align=\"center\">' . $label . '</td><td align=\"center\">' . $user['login'] . '</td><td align=\"center\"></td></tr>';
920
+                        $logs .= '<tr><td>'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']).'</td><td align=\"center\">'.$label.'</td><td align=\"center\">'.$user['login'].'</td><td align=\"center\"></td></tr>';
921 921
                     } else {
922
-                        $logs .= '<tr><td>' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) . '</td><td align=\"center\">' . str_replace('"', '\"', $record['label']) . '</td><td align=\"center\">' . $record['login'] . '</td><td align=\"center\">' . langHdl($record['action']) . '</td></tr>';
922
+                        $logs .= '<tr><td>'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']).'</td><td align=\"center\">'.str_replace('"', '\"', $record['label']).'</td><td align=\"center\">'.$record['login'].'</td><td align=\"center\">'.langHdl($record['action']).'</td></tr>';
923 923
                     }
924 924
                 }
925 925
             }
926 926
 
927
-            echo '[ { "table_logs": "' . ($logs) . '", "pages": "' . ($pages) . '", "error" : "no" } ]';
927
+            echo '[ { "table_logs": "'.($logs).'", "pages": "'.($pages).'", "error" : "no" } ]';
928 928
             break;
929 929
 
930 930
             /*
@@ -949,7 +949,7 @@  discard block
 block discarded – undo
949 949
             } else {
950 950
                 // Get folder id for Admin
951 951
                 $admin_folder = DB::queryFirstRow(
952
-                    'SELECT id FROM ' . prefixTable('nested_tree') . '
952
+                    'SELECT id FROM '.prefixTable('nested_tree').'
953 953
                     WHERE title = %i AND personal_folder = %i',
954 954
                     intval($_SESSION['user_id']),
955 955
                     '1'
@@ -960,15 +960,15 @@  discard block
 block discarded – undo
960 960
                     // Get each Items in PF
961 961
                     $rows = DB::query(
962 962
                         'SELECT i.pw, i.label, l.id_user
963
-                        FROM ' . prefixTable('items') . ' as i
964
-                        LEFT JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item=i.id)
963
+                        FROM ' . prefixTable('items').' as i
964
+                        LEFT JOIN ' . prefixTable('log_items').' as l ON (l.id_item=i.id)
965 965
                         WHERE l.action = %s AND i.perso=%i AND i.id_tree=%i',
966 966
                         'at_creation',
967 967
                         '1',
968 968
                         intval($folder->id)
969 969
                     );
970 970
                     foreach ($rows as $record) {
971
-                        echo $record['label'] . ' - ';
971
+                        echo $record['label'].' - ';
972 972
                         // Change user
973 973
                         DB::update(
974 974
                             prefixTable('log_items'),
@@ -1003,7 +1003,7 @@  discard block
 block discarded – undo
1003 1003
             // Get info about user to delete
1004 1004
             $data_user = DB::queryfirstrow(
1005 1005
                 'SELECT admin, isAdministratedByRole, gestionnaire
1006
-                FROM ' . prefixTable('users') . '
1006
+                FROM ' . prefixTable('users').'
1007 1007
                 WHERE id = %i',
1008 1008
                 $post_user_id
1009 1009
             );
@@ -1040,7 +1040,7 @@  discard block
 block discarded – undo
1040 1040
 
1041 1041
             // Do
1042 1042
             $rows = DB::query(
1043
-                'SELECT id FROM ' . prefixTable('users') . '
1043
+                'SELECT id FROM '.prefixTable('users').'
1044 1044
                 WHERE timestamp != %s AND admin != %i',
1045 1045
                 '',
1046 1046
                 '1'
@@ -1049,7 +1049,7 @@  discard block
 block discarded – undo
1049 1049
                 // Get info about user to delete
1050 1050
                 $data_user = DB::queryfirstrow(
1051 1051
                     'SELECT admin, isAdministratedByRole, gestionnaire
1052
-                    FROM ' . prefixTable('users') . '
1052
+                    FROM ' . prefixTable('users').'
1053 1053
                     WHERE id = %i',
1054 1054
                     $record['id']
1055 1055
                 );
@@ -1103,7 +1103,7 @@  discard block
 block discarded – undo
1103 1103
             // Get info about user
1104 1104
             $rowUser = DB::queryfirstrow(
1105 1105
                 'SELECT *
1106
-                FROM ' . prefixTable('users') . '
1106
+                FROM ' . prefixTable('users').'
1107 1107
                 WHERE id = %i',
1108 1108
                 $post_id
1109 1109
             );
@@ -1121,7 +1121,7 @@  discard block
 block discarded – undo
1121 1121
                 $arrFldAllowed = array();
1122 1122
 
1123 1123
                 //Build tree
1124
-                $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1124
+                $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
1125 1125
                 $tree->register();
1126 1126
                 $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
1127 1127
 
@@ -1132,7 +1132,7 @@  discard block
 block discarded – undo
1132 1132
                 // array of roles for actual user
1133 1133
                 $my_functions = explode(';', $_SESSION['fonction_id']);
1134 1134
 
1135
-                $rows = DB::query('SELECT id,title,creator_id FROM ' . prefixTable('roles_title'));
1135
+                $rows = DB::query('SELECT id,title,creator_id FROM '.prefixTable('roles_title'));
1136 1136
                 foreach ($rows as $record) {
1137 1137
                     if (
1138 1138
                         (int) $_SESSION['is_admin'] === 1
@@ -1168,7 +1168,7 @@  discard block
 block discarded – undo
1168 1168
                 $rolesList = array();
1169 1169
                 $managedBy = array();
1170 1170
                 $selected = '';
1171
-                $rows = DB::query('SELECT id,title FROM ' . prefixTable('roles_title') . ' ORDER BY title ASC');
1171
+                $rows = DB::query('SELECT id,title FROM '.prefixTable('roles_title').' ORDER BY title ASC');
1172 1172
                 foreach ($rows as $reccord) {
1173 1173
                     $rolesList[$reccord['id']] = array('id' => $reccord['id'], 'title' => $reccord['title']);
1174 1174
                 }
@@ -1199,7 +1199,7 @@  discard block
 block discarded – undo
1199 1199
                         array_push(
1200 1200
                             $managedBy,
1201 1201
                             array(
1202
-                                'title' => langHdl('managers_of') . ' ' . $fonction['title'],
1202
+                                'title' => langHdl('managers_of').' '.$fonction['title'],
1203 1203
                                 'id' => $fonction['id'],
1204 1204
                                 'selected' => $selected,
1205 1205
                             )
@@ -1281,9 +1281,9 @@  discard block
 block discarded – undo
1281 1281
 
1282 1282
                 // get USER STATUS
1283 1283
                 if ($rowUser['disabled'] == 1) {
1284
-                    $arrData['info'] = langHdl('user_info_locked') . '<br><input type="checkbox" value="unlock" name="1" class="chk">&nbsp;<label for="1">' . langHdl('user_info_unlock_question') . '</label><br><input type="checkbox"  value="delete" id="account_delete" class="chk mr-2" name="2" onclick="confirmDeletion()">label for="2">' . langHdl('user_info_delete_question') . '</label>';
1284
+                    $arrData['info'] = langHdl('user_info_locked').'<br><input type="checkbox" value="unlock" name="1" class="chk">&nbsp;<label for="1">'.langHdl('user_info_unlock_question').'</label><br><input type="checkbox"  value="delete" id="account_delete" class="chk mr-2" name="2" onclick="confirmDeletion()">label for="2">'.langHdl('user_info_delete_question').'</label>';
1285 1285
                 } else {
1286
-                    $arrData['info'] = langHdl('user_info_active') . '<br><input type="checkbox" value="lock" class="chk">&nbsp;' . langHdl('user_info_lock_question');
1286
+                    $arrData['info'] = langHdl('user_info_active').'<br><input type="checkbox" value="lock" class="chk">&nbsp;'.langHdl('user_info_lock_question');
1287 1287
                 }
1288 1288
 
1289 1289
                 $arrData['error'] = false;
@@ -1375,7 +1375,7 @@  discard block
 block discarded – undo
1375 1375
                 // count number of admins
1376 1376
                 $users = DB::query(
1377 1377
                     'SELECT id
1378
-                    FROM ' . prefixTable('users') . '
1378
+                    FROM ' . prefixTable('users').'
1379 1379
                     WHERE admin = 1 AND email != "" AND pw != ""'
1380 1380
                 );
1381 1381
                 if (DB::count() === 1) {
@@ -1461,7 +1461,7 @@  discard block
 block discarded – undo
1461 1461
 
1462 1462
             // Get info about user to delete
1463 1463
             $data_user = DB::queryfirstrow(
1464
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
1464
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
1465 1465
                 WHERE id = %i',
1466 1466
                 $post_id
1467 1467
             );
@@ -1482,7 +1482,7 @@  discard block
 block discarded – undo
1482 1482
                     );
1483 1483
                     // delete personal folder and subfolders
1484 1484
                     $data = DB::queryfirstrow(
1485
-                        'SELECT id FROM ' . prefixTable('nested_tree') . '
1485
+                        'SELECT id FROM '.prefixTable('nested_tree').'
1486 1486
                         WHERE title = %s AND personal_folder = %i',
1487 1487
                         $post_id,
1488 1488
                         '1'
@@ -1495,7 +1495,7 @@  discard block
 block discarded – undo
1495 1495
                             DB::delete(prefixTable('nested_tree'), 'id = %i AND personal_folder = %i', $folder->id, '1');
1496 1496
                             // delete items & logs
1497 1497
                             $items = DB::query(
1498
-                                'SELECT id FROM ' . prefixTable('items') . '
1498
+                                'SELECT id FROM '.prefixTable('items').'
1499 1499
                                 WHERE id_tree=%i AND perso = %i',
1500 1500
                                 $folder->id,
1501 1501
                                 '1'
@@ -1516,7 +1516,7 @@  discard block
 block discarded – undo
1516 1516
                 } else {
1517 1517
                     // Get old data about user
1518 1518
                     $oldData = DB::queryfirstrow(
1519
-                        'SELECT * FROM ' . prefixTable('users') . '
1519
+                        'SELECT * FROM '.prefixTable('users').'
1520 1520
                         WHERE id = %i',
1521 1521
                         $post_id
1522 1522
                     );
@@ -1546,7 +1546,7 @@  discard block
 block discarded – undo
1546 1546
 
1547 1547
                     // update LOG
1548 1548
                     if ($oldData['email'] !== $post_email) {
1549
-                        logEvents($SETTINGS, 'user_mngt', 'at_user_email_changed:' . $oldData['email'], (string) $_SESSION['user_id'], $_SESSION['login'], $post_id);
1549
+                        logEvents($SETTINGS, 'user_mngt', 'at_user_email_changed:'.$oldData['email'], (string) $_SESSION['user_id'], $_SESSION['login'], $post_id);
1550 1550
                     }
1551 1551
                 }
1552 1552
                 echo prepareExchangedData(
@@ -1601,7 +1601,7 @@  discard block
 block discarded – undo
1601 1601
 
1602 1602
             // Get info about user to delete
1603 1603
             $data_user = DB::queryfirstrow(
1604
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
1604
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
1605 1605
                 WHERE id = %i',
1606 1606
                 $post_id
1607 1607
             );
@@ -1651,7 +1651,7 @@  discard block
 block discarded – undo
1651 1651
             }
1652 1652
 
1653 1653
             DB::queryfirstrow(
1654
-                'SELECT * FROM ' . prefixTable('users') . '
1654
+                'SELECT * FROM '.prefixTable('users').'
1655 1655
                 WHERE login = %s',
1656 1656
                 filter_input(INPUT_POST, 'login', FILTER_SANITIZE_STRING)
1657 1657
             );
@@ -1700,14 +1700,14 @@  discard block
 block discarded – undo
1700 1700
             $arrData = array();
1701 1701
 
1702 1702
             //Build tree
1703
-            $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1703
+            $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
1704 1704
             $tree->register();
1705 1705
             $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
1706 1706
 
1707 1707
             // get User info
1708 1708
             $rowUser = DB::queryFirstRow(
1709 1709
                 'SELECT login, name, lastname, email, disabled, fonction_id, groupes_interdits, groupes_visibles, isAdministratedByRole, avatar_thumb
1710
-                FROM ' . prefixTable('users') . '
1710
+                FROM ' . prefixTable('users').'
1711 1711
                 WHERE id = %i',
1712 1712
                 $post_id
1713 1713
             );
@@ -1725,7 +1725,7 @@  discard block
 block discarded – undo
1725 1725
                 // refine folders based upon roles
1726 1726
                 $rows = DB::query(
1727 1727
                     'SELECT folder_id, type
1728
-                    FROM ' . prefixTable('roles_values') . '
1728
+                    FROM ' . prefixTable('roles_values').'
1729 1729
                     WHERE role_id IN %ls
1730 1730
                     ORDER BY folder_id ASC',
1731 1731
                     $arrData['functions']
@@ -1754,7 +1754,7 @@  discard block
 block discarded – undo
1754 1754
                             // get folder name
1755 1755
                             $row = DB::queryFirstRow(
1756 1756
                                 'SELECT title, nlevel, id
1757
-                                FROM ' . prefixTable('nested_tree') . '
1757
+                                FROM ' . prefixTable('nested_tree').'
1758 1758
                                 WHERE id = %i',
1759 1759
                                 $fld['id']
1760 1760
                             );
@@ -1767,34 +1767,34 @@  discard block
 block discarded – undo
1767 1767
 
1768 1768
                             // manage right icon
1769 1769
                             if ($fld['type'] == 'W') {
1770
-                                $label = '<i class="fas fa-indent infotip text-success mr-2" title="' . langHdl('write') . '"></i>' .
1771
-                                    '<i class="fas fa-edit infotip text-success mr-2" title="' . langHdl('edit') . '"></i>' .
1772
-                                    '<i class="fas fa-eraser infotip text-success" title="' . langHdl('delete') . '"></i>';
1770
+                                $label = '<i class="fas fa-indent infotip text-success mr-2" title="'.langHdl('write').'"></i>'.
1771
+                                    '<i class="fas fa-edit infotip text-success mr-2" title="'.langHdl('edit').'"></i>'.
1772
+                                    '<i class="fas fa-eraser infotip text-success" title="'.langHdl('delete').'"></i>';
1773 1773
                             } elseif ($fld['type'] == 'ND') {
1774
-                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . langHdl('write') . '"></i>' .
1775
-                                    '<i class="fas fa-edit infotip text-success mr-2" title="' . langHdl('edit') . '"></i>' .
1776
-                                    '<i class="fas fa-eraser infotip text-danger" title="' . langHdl('no_delete') . '"></i>';
1774
+                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.langHdl('write').'"></i>'.
1775
+                                    '<i class="fas fa-edit infotip text-success mr-2" title="'.langHdl('edit').'"></i>'.
1776
+                                    '<i class="fas fa-eraser infotip text-danger" title="'.langHdl('no_delete').'"></i>';
1777 1777
                             } elseif ($fld['type'] == 'NE') {
1778
-                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . langHdl('write') . '"></i>' .
1779
-                                    '<i class="fas fa-edit infotip text-danger mr-2" title="' . langHdl('no_edit') . '"></i>' .
1780
-                                    '<i class="fas fa-eraser infotip text-success" title="' . langHdl('delete') . '"></i>';
1778
+                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.langHdl('write').'"></i>'.
1779
+                                    '<i class="fas fa-edit infotip text-danger mr-2" title="'.langHdl('no_edit').'"></i>'.
1780
+                                    '<i class="fas fa-eraser infotip text-success" title="'.langHdl('delete').'"></i>';
1781 1781
                             } elseif ($fld['type'] == 'NDNE') {
1782
-                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . langHdl('write') . '"></i>' .
1783
-                                    '<i class="fas fa-edit infotip text-danger mr-2" title="' . langHdl('no_edit') . '"></i>' .
1784
-                                    '<i class="fas fa-eraser infotip text-danger" title="' . langHdl('no_delete') . '"></i>';
1782
+                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.langHdl('write').'"></i>'.
1783
+                                    '<i class="fas fa-edit infotip text-danger mr-2" title="'.langHdl('no_edit').'"></i>'.
1784
+                                    '<i class="fas fa-eraser infotip text-danger" title="'.langHdl('no_delete').'"></i>';
1785 1785
                             } else {
1786
-                                $label = '<i class="fas fa-eye infotip text-info mr-2" title="' . langHdl('read') . '"></i>';
1786
+                                $label = '<i class="fas fa-eye infotip text-info mr-2" title="'.langHdl('read').'"></i>';
1787 1787
                             }
1788 1788
 
1789
-                            $html .= '<tr><td>' . $ident . $row['title'] .
1790
-                                ' <small>[' . $row['id'] . ']</small></td><td>' . $label . '</td></tr>';
1789
+                            $html .= '<tr><td>'.$ident.$row['title'].
1790
+                                ' <small>['.$row['id'].']</small></td><td>'.$label.'</td></tr>';
1791 1791
                             break;
1792 1792
                         }
1793 1793
                     }
1794 1794
                 }
1795 1795
 
1796
-                $html_full = '<table id="table-folders" class="table table-bordered table-striped dt-responsive nowrap" style="width:100%"><tbody>' .
1797
-                    $html . '</tbody></table>';
1796
+                $html_full = '<table id="table-folders" class="table table-bordered table-striped dt-responsive nowrap" style="width:100%"><tbody>'.
1797
+                    $html.'</tbody></table>';
1798 1798
             } else {
1799 1799
                 $html_full = '';
1800 1800
             }
@@ -1840,7 +1840,7 @@  discard block
 block discarded – undo
1840 1840
             if ((int) $_SESSION['is_admin'] === 0 && (int) $_SESSION['user_can_manage_all_users'] === 0) {
1841 1841
                 $rows = DB::query(
1842 1842
                     'SELECT *
1843
-                    FROM ' . prefixTable('users') . '
1843
+                    FROM ' . prefixTable('users').'
1844 1844
                     WHERE admin = %i AND isAdministratedByRole IN %ls',
1845 1845
                     '0',
1846 1846
                     array_filter($_SESSION['user_roles'])
@@ -1848,7 +1848,7 @@  discard block
 block discarded – undo
1848 1848
             } else {
1849 1849
                 $rows = DB::query(
1850 1850
                     'SELECT *
1851
-                    FROM ' . prefixTable('users') . '
1851
+                    FROM ' . prefixTable('users').'
1852 1852
                     WHERE admin = %i',
1853 1853
                     '0'
1854 1854
                 );
@@ -1860,7 +1860,7 @@  discard block
 block discarded – undo
1860 1860
                 $groupIds = [];
1861 1861
                 foreach (explode(';', $record['fonction_id']) as $group) {
1862 1862
                     $tmp = DB::queryfirstrow(
1863
-                        'SELECT id, title FROM ' . prefixTable('roles_title') . '
1863
+                        'SELECT id, title FROM '.prefixTable('roles_title').'
1864 1864
                         WHERE id = %i',
1865 1865
                         $group
1866 1866
                     );
@@ -1872,7 +1872,7 @@  discard block
 block discarded – undo
1872 1872
 
1873 1873
                 // Get managed_by
1874 1874
                 $managedBy = DB::queryfirstrow(
1875
-                    'SELECT id, title FROM ' . prefixTable('roles_title') . '
1875
+                    'SELECT id, title FROM '.prefixTable('roles_title').'
1876 1876
                     WHERE id = %i',
1877 1877
                     $record['isAdministratedByRole']
1878 1878
                 );
@@ -1882,7 +1882,7 @@  discard block
 block discarded – undo
1882 1882
                 $foldersAllowedIds = [];
1883 1883
                 foreach (explode(';', $record['groupes_visibles']) as $role) {
1884 1884
                     $tmp = DB::queryfirstrow(
1885
-                        'SELECT id, title FROM ' . prefixTable('nested_tree') . '
1885
+                        'SELECT id, title FROM '.prefixTable('nested_tree').'
1886 1886
                         WHERE id = %i',
1887 1887
                         $role
1888 1888
                     );
@@ -1895,7 +1895,7 @@  discard block
 block discarded – undo
1895 1895
                 $foldersForbiddenIds = [];
1896 1896
                 foreach (explode(';', $record['groupes_interdits']) as $role) {
1897 1897
                     $tmp = DB::queryfirstrow(
1898
-                        'SELECT id, title FROM ' . prefixTable('nested_tree') . '
1898
+                        'SELECT id, title FROM '.prefixTable('nested_tree').'
1899 1899
                         WHERE id = %i',
1900 1900
                         $role
1901 1901
                     );
@@ -1913,7 +1913,7 @@  discard block
 block discarded – undo
1913 1913
                         'login' => $record['login'],
1914 1914
                         'groups' => implode(', ', $groups),
1915 1915
                         'groupIds' => $groupIds,
1916
-                        'managedBy' => $managedBy=== null ? langHdl('administrator') : $managedBy['title'],
1916
+                        'managedBy' => $managedBy === null ? langHdl('administrator') : $managedBy['title'],
1917 1917
                         'managedById' => $managedBy === null ? 0 : $managedBy['id'],
1918 1918
                         'foldersAllowed' => implode(', ', $foldersAllowed),
1919 1919
                         'foldersAllowedIds' => $foldersAllowedIds,
@@ -1991,7 +1991,7 @@  discard block
 block discarded – undo
1991 1991
 
1992 1992
             // Get info about user
1993 1993
             $data_user = DB::queryfirstrow(
1994
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
1994
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
1995 1995
                 WHERE id = %i',
1996 1996
                 $post_source_id
1997 1997
             );
@@ -2151,14 +2151,14 @@  discard block
 block discarded – undo
2151 2151
             if (empty($post_context) === false && $post_context === 'add_one_role_to_user') {
2152 2152
                 $data_user = DB::queryfirstrow(
2153 2153
                     'SELECT fonction_id
2154
-                    FROM ' . prefixTable('users') . '
2154
+                    FROM ' . prefixTable('users').'
2155 2155
                     WHERE id = %i',
2156 2156
                     $post_user_id
2157 2157
                 );
2158 2158
 
2159 2159
                 if ($data_user) {
2160 2160
                     // Ensure array is unique
2161
-                    $post_new_value = str_replace(',', ';', $data_user['fonction_id']) . ';' . $post_new_value;
2161
+                    $post_new_value = str_replace(',', ';', $data_user['fonction_id']).';'.$post_new_value;
2162 2162
                     $post_new_value = implode(';', array_unique(explode(';', $post_new_value)));
2163 2163
                 } else {
2164 2164
                     // User not found
@@ -2213,7 +2213,7 @@  discard block
 block discarded – undo
2213 2213
             if (filter_input(INPUT_POST, 'step', FILTER_SANITIZE_STRING) === 'refresh') {
2214 2214
                 $record = DB::queryFirstRow(
2215 2215
                     'SELECT user_ip_lastdate
2216
-                    FROM ' . prefixTable('users') . '
2216
+                    FROM ' . prefixTable('users').'
2217 2217
                     WHERE id = %i',
2218 2218
                     $_SESSION['user_id']
2219 2219
                 );
@@ -2305,38 +2305,38 @@  discard block
 block discarded – undo
2305 2305
             ];
2306 2306
 
2307 2307
             // Load expected libraries
2308
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
2309
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php';
2310
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Symfony/contracts/Translation/TranslatorInterface.php';
2311
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonTimeZone.php';
2312
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Units.php';
2313
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Week.php';
2314
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Timestamp.php';
2315
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Test.php';
2316
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/ObjectInitialisation.php';
2317
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Serialization.php';
2318
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/IntervalRounding.php';
2319
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Rounding.php';
2320
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Localization.php';
2321
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Options.php';
2322
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Cast.php';
2323
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mutability.php';
2324
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Modifiers.php';
2325
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mixin.php';
2326
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Macro.php';
2327
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Difference.php';
2328
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Creator.php';
2329
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Converter.php';
2330
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Comparison.php';
2331
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Boundaries.php';
2332
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Date.php';
2333
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonInterface.php';
2334
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Carbon.php';
2335
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php';
2336
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php';
2337
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php';
2338
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapBase.php';
2339
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php';
2308
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
2309
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php';
2310
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Symfony/contracts/Translation/TranslatorInterface.php';
2311
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonTimeZone.php';
2312
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Units.php';
2313
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Week.php';
2314
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Timestamp.php';
2315
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Test.php';
2316
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/ObjectInitialisation.php';
2317
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Serialization.php';
2318
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/IntervalRounding.php';
2319
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Rounding.php';
2320
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Localization.php';
2321
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Options.php';
2322
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Cast.php';
2323
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mutability.php';
2324
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Modifiers.php';
2325
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mixin.php';
2326
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Macro.php';
2327
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Difference.php';
2328
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Creator.php';
2329
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Converter.php';
2330
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Comparison.php';
2331
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Boundaries.php';
2332
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Date.php';
2333
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonInterface.php';
2334
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Carbon.php';
2335
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php';
2336
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php';
2337
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php';
2338
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapBase.php';
2339
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php';
2340 2340
 
2341 2341
             $ad = new SplClassLoader('LdapRecord', '../includes/libraries');
2342 2342
             $ad->register();
@@ -2352,7 +2352,7 @@  discard block
 block discarded – undo
2352 2352
                 echo prepareExchangedData(
2353 2353
                     array(
2354 2354
                         'error' => true,
2355
-                        'message' => "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage(). "<br>".$error->getDiagnosticMessage(),
2355
+                        'message' => "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage()."<br>".$error->getDiagnosticMessage(),
2356 2356
                     ),
2357 2357
                     'encode'
2358 2358
                 );
@@ -2372,10 +2372,10 @@  discard block
 block discarded – undo
2372 2372
                 ['objectclass', '=', 'inetorgperson'],
2373 2373
             ])->get();
2374 2374
             
2375
-            foreach($users as $i => $adUser) {
2375
+            foreach ($users as $i => $adUser) {
2376 2376
 
2377 2377
                 // Build the list of all groups in AD
2378
-                foreach($adUser['memberof'] as $j => $adUserGroup) {
2378
+                foreach ($adUser['memberof'] as $j => $adUserGroup) {
2379 2379
                     if (empty($adUserGroup) === false && $j !== "count") {
2380 2380
                         $adGroup = substr($adUserGroup, 3, strpos($adUserGroup, ',') - 3);
2381 2381
                         if (in_array($adGroup, $adRoles) === false && empty($adGroup) === false) {
@@ -2390,7 +2390,7 @@  discard block
 block discarded – undo
2390 2390
                     // Get his ID
2391 2391
                     DB::queryfirstrow(
2392 2392
                         'SELECT id, fonction_id, auth_type
2393
-                        FROM ' . prefixTable('users') . '
2393
+                        FROM ' . prefixTable('users').'
2394 2394
                         WHERE login = %s',
2395 2395
                         $userLogin
2396 2396
                     );
@@ -2425,7 +2425,7 @@  discard block
 block discarded – undo
2425 2425
             }
2426 2426
 
2427 2427
             // Get all groups in Teampass
2428
-            $rows = DB::query('SELECT id,title FROM ' . prefixTable('roles_title'));
2428
+            $rows = DB::query('SELECT id,title FROM '.prefixTable('roles_title'));
2429 2429
             foreach ($rows as $record) {
2430 2430
                 array_push(
2431 2431
                     $teampassRoles,
@@ -2491,7 +2491,7 @@  discard block
 block discarded – undo
2491 2491
             // Check if user already exists
2492 2492
             $data = DB::query(
2493 2493
                 'SELECT id, fonction_id, groupes_interdits, groupes_visibles
2494
-                FROM ' . prefixTable('users') . '
2494
+                FROM ' . prefixTable('users').'
2495 2495
                 WHERE login = %s',
2496 2496
                 $post_login
2497 2497
             );
@@ -2595,7 +2595,7 @@  discard block
 block discarded – undo
2595 2595
                 );
2596 2596
 
2597 2597
                 // Rebuild tree
2598
-                $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
2598
+                $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
2599 2599
                 $tree->register();
2600 2600
                 $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
2601 2601
                 $tree->rebuild();
@@ -2663,7 +2663,7 @@  discard block
 block discarded – undo
2663 2663
             // Check if user already exists
2664 2664
             DB::query(
2665 2665
                 'SELECT id
2666
-                FROM ' . prefixTable('users') . '
2666
+                FROM ' . prefixTable('users').'
2667 2667
                 WHERE id = %i',
2668 2668
                 $post_id
2669 2669
             );
@@ -2739,7 +2739,7 @@  discard block
 block discarded – undo
2739 2739
             // Check if user already exists
2740 2740
             $userInfo = DB::queryfirstrow(
2741 2741
                 'SELECT id, private_key, public_key
2742
-                FROM ' . prefixTable('users') . '
2742
+                FROM ' . prefixTable('users').'
2743 2743
                 WHERE id = %i',
2744 2744
                 $post_userid
2745 2745
             );
@@ -2774,7 +2774,7 @@  discard block
 block discarded – undo
2774 2774
             if (count($_SESSION['personal_folders']) > 0) {
2775 2775
                 DB::query(
2776 2776
                     'SELECT id
2777
-                    FROM ' . prefixTable('items') . '
2777
+                    FROM ' . prefixTable('items').'
2778 2778
                     WHERE id_tree IN %ls',
2779 2779
                     $_SESSION['personal_folders']
2780 2780
                 );
@@ -2852,7 +2852,7 @@  discard block
 block discarded – undo
2852 2852
             // Check if user already exists
2853 2853
             DB::query(
2854 2854
                 'SELECT id
2855
-                FROM ' . prefixTable('users') . '
2855
+                FROM ' . prefixTable('users').'
2856 2856
                 WHERE id = %i',
2857 2857
                 $post_id
2858 2858
             );
@@ -2946,7 +2946,7 @@  discard block
 block discarded – undo
2946 2946
 
2947 2947
     // Get info about user
2948 2948
     $data_user = DB::queryfirstrow(
2949
-        'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
2949
+        'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
2950 2950
         WHERE id = %i',
2951 2951
         $value[1]
2952 2952
     );
@@ -2979,7 +2979,7 @@  discard block
 block discarded – undo
2979 2979
             logEvents(
2980 2980
                 $SETTINGS,
2981 2981
                 'user_mngt',
2982
-                'at_user_new_' . $value[0] . ':' . $value[1],
2982
+                'at_user_new_'.$value[0].':'.$value[1],
2983 2983
                 (string) $_SESSION['user_id'],
2984 2984
                 $_SESSION['login'],
2985 2985
                 filter_input(INPUT_POST, 'id', FILTER_SANITIZE_STRING)
@@ -3011,7 +3011,7 @@  discard block
 block discarded – undo
3011 3011
 
3012 3012
     // Get info about user
3013 3013
     $data_user = DB::queryfirstrow(
3014
-        'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
3014
+        'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
3015 3015
         WHERE id = %i',
3016 3016
         $value[1]
3017 3017
     );
Please login to merge, or discard this patch.