Passed
Push — wip_sessions ( e5eed5...05c13e )
by Nils
05:39
created
sources/export.queries.php 1 patch
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 ) {
69 69
     // Not allowed page
70 70
     $session->set('system-error_code', ERR_NOT_ALLOWED);
71
-    include $SETTINGS['cpassman_dir'] . '/error.php';
71
+    include $SETTINGS['cpassman_dir'].'/error.php';
72 72
     exit;
73 73
 }
74 74
 
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 $antiXss = new AntiXSS();
91 91
 
92 92
 // User's language loading
93
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $session->get('user-language') . '.php';
93
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$session->get('user-language').'.php';
94 94
 
95 95
 // Prepare POST variables
96 96
 $id = filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT);
@@ -141,9 +141,9 @@  discard block
 block discarded – undo
141 141
                         'SELECT i.id as id, i.id_tree as id_tree, i.restricted_to as restricted_to, i.perso as perso,
142 142
                             i.label as label, i.description as description, i.pw as pw, i.login as login, i.url as url,
143 143
                             i.email as email,l.date as date, i.pw_iv as pw_iv,n.renewal_period as renewal_period
144
-                        FROM ' . prefixTable('items') . ' as i
145
-                        INNER JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree = n.id)
146
-                        INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id = l.id_item)
144
+                        FROM ' . prefixTable('items').' as i
145
+                        INNER JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree = n.id)
146
+                        INNER JOIN ' . prefixTable('log_items').' as l ON (i.id = l.id_item)
147 147
                         WHERE i.inactif = %i
148 148
                         AND i.id_tree= %i
149 149
                         AND (l.action = %s OR (l.action = %s AND l.raison LIKE %s))
@@ -166,8 +166,8 @@  discard block
 block discarded – undo
166 166
                                 // Run query
167 167
                                 $dataItem = DB::queryfirstrow(
168 168
                                     'SELECT i.pw AS pw, s.share_key AS share_key
169
-                                    FROM ' . prefixTable('items') . ' AS i
170
-                                    INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (s.object_id = i.id)
169
+                                    FROM ' . prefixTable('items').' AS i
170
+                                    INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (s.object_id = i.id)
171 171
                                     WHERE user_id = %i AND i.id = %i',
172 172
                                     $session->get('user-id'),
173 173
                                     $record['id']
@@ -191,8 +191,8 @@  discard block
 block discarded – undo
191 191
                                 $arr_kbs = [];
192 192
                                 $rows_kb = DB::query(
193 193
                                     'SELECT b.label, b.id
194
-                                    FROM ' . prefixTable('kb_items') . ' AS a
195
-                                    INNER JOIN ' . prefixTable('kb') . ' AS b ON (a.kb_id = b.id)
194
+                                    FROM ' . prefixTable('kb_items').' AS a
195
+                                    INNER JOIN ' . prefixTable('kb').' AS b ON (a.kb_id = b.id)
196 196
                                     WHERE a.item_id = %i',
197 197
                                     $record['id']
198 198
                                 );
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
                                 $arr_tags = [];
205 205
                                 $rows_tag = DB::query(
206 206
                                     'SELECT tag
207
-                                    FROM ' . prefixTable('tags') . '
207
+                                    FROM ' . prefixTable('tags').'
208 208
                                     WHERE item_id = %i',
209 209
                                     $record['id']
210 210
                                 );
@@ -216,18 +216,18 @@  discard block
 block discarded – undo
216 216
                                 $arr_trees = [];
217 217
                                 $rows_child_tree = DB::query(
218 218
                                     'SELECT t.id, t.title
219
-                                    FROM ' . prefixTable('nested_tree') . ' AS t
220
-                                    INNER JOIN ' . prefixTable('items') . ' AS i ON (t.id = i.id_tree)
219
+                                    FROM ' . prefixTable('nested_tree').' AS t
220
+                                    INNER JOIN ' . prefixTable('items').' AS i ON (t.id = i.id_tree)
221 221
                                     WHERE i.id = %i',
222 222
                                     $record['id']
223 223
                                 );
224 224
                                 foreach ($rows_child_tree as $rec_child_tree) {
225 225
                                     $stack = array();
226 226
                                     $parent = $rec_child_tree['id'];
227
-                                    while($parent != 0){
227
+                                    while ($parent != 0) {
228 228
                                         $rows_parent_tree = DB::query(
229 229
                                             'SELECT parent_id, title
230
-                                            FROM ' . prefixTable('nested_tree') . '
230
+                                            FROM ' . prefixTable('nested_tree').'
231 231
                                             WHERE id = %i',
232 232
                                             $parent
233 233
                                         );
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
             // Prepare variables
315 315
             $post_export_tag = filter_var($dataReceived['export_tag'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
316 316
             if (empty($post_export_tag) === false) {
317
-                DB::query('DELETE FROM ' . prefixTable('export') . ' WHERE export_tag = %s', $post_export_tag);
317
+                DB::query('DELETE FROM '.prefixTable('export').' WHERE export_tag = %s', $post_export_tag);
318 318
             }
319 319
             break;
320 320
 
@@ -364,9 +364,9 @@  discard block
 block discarded – undo
364 364
                         l.date as date, i.pw_iv as pw_iv,
365 365
                         n.renewal_period as renewal_period,
366 366
                         i.id_tree as tree_id
367
-                        FROM ' . prefixTable('items') . ' as i
368
-                        INNER JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree = n.id)
369
-                        INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id = l.id_item)
367
+                        FROM ' . prefixTable('items').' as i
368
+                        INNER JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree = n.id)
369
+                        INNER JOIN ' . prefixTable('log_items').' as l ON (i.id = l.id_item)
370 370
                         WHERE i.inactif = %i
371 371
                         AND i.id_tree= %i
372 372
                         AND (l.action = %s OR (l.action = %s AND l.raison LIKE %s))
@@ -392,8 +392,8 @@  discard block
 block discarded – undo
392 392
                             // Run query
393 393
                             $dataItem = DB::queryfirstrow(
394 394
                                 'SELECT i.pw AS pw, s.share_key AS share_key
395
-                                FROM ' . prefixTable('items') . ' AS i
396
-                                INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (s.object_id = i.id)
395
+                                FROM ' . prefixTable('items').' AS i
396
+                                INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (s.object_id = i.id)
397 397
                                 WHERE user_id = %i AND i.id = %i',
398 398
                                 $session->get('user-id'),
399 399
                                 $record['id']
@@ -417,8 +417,8 @@  discard block
 block discarded – undo
417 417
                             $arr_kbs = '';
418 418
                             $rows_kb = DB::query(
419 419
                                 'SELECT b.label, b.id
420
-                                FROM ' . prefixTable('kb_items') . ' AS a
421
-                                INNER JOIN ' . prefixTable('kb') . ' AS b ON (a.kb_id = b.id)
420
+                                FROM ' . prefixTable('kb_items').' AS a
421
+                                INNER JOIN ' . prefixTable('kb').' AS b ON (a.kb_id = b.id)
422 422
                                 WHERE a.item_id = %i',
423 423
                                 $record['id']
424 424
                             );
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
                                 if (empty($arr_kbs)) {
427 427
                                     $arr_kbs = $rec_kb['label'];
428 428
                                 } else {
429
-                                    $arr_kbs .= ' | ' . $rec_kb['label'];
429
+                                    $arr_kbs .= ' | '.$rec_kb['label'];
430 430
                                 }
431 431
                             }
432 432
 
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
                             $arr_tags = '';
435 435
                             $rows_tag = DB::query(
436 436
                                 'SELECT tag
437
-                                FROM ' . prefixTable('tags') . '
437
+                                FROM ' . prefixTable('tags').'
438 438
                                 WHERE item_id = %i',
439 439
                                 $record['id']
440 440
                             );
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
                                 if (empty($arr_tags)) {
443 443
                                     $arr_tags = $rec_tag['tag'];
444 444
                                 } else {
445
-                                    $arr_tags .= ' ' . $rec_tag['tag'];
445
+                                    $arr_tags .= ' '.$rec_tag['tag'];
446 446
                                 }
447 447
                             }
448 448
 
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
             // query
521 521
             $rows = DB::query(
522 522
                 'SELECT * 
523
-                FROM ' . prefixTable('export') . ' 
523
+                FROM ' . prefixTable('export').' 
524 524
                 WHERE export_tag = %s',
525 525
                 $dataReceived['export_tag']
526 526
             );
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
                 $prev_path = '';
533 533
 
534 534
                 //Prepare the PDF file
535
-                include $SETTINGS['cpassman_dir'] . '/vendor/tecnickcom/tcpdf/tcpdf.php';
535
+                include $SETTINGS['cpassman_dir'].'/vendor/tecnickcom/tcpdf/tcpdf.php';
536 536
 
537 537
                 $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
538 538
                 $pdf->SetProtection(array('print'), $dataReceived['pdf_password'], null);
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
 
545 545
                 // set default header data
546 546
                 $pdf->SetHeaderData(
547
-                    $SETTINGS['cpassman_dir'] . '/includes/images/teampass-logo2-home.png',
547
+                    $SETTINGS['cpassman_dir'].'/includes/images/teampass-logo2-home.png',
548 548
                     PDF_HEADER_LOGO_WIDTH,
549 549
                     'Teampass export',
550 550
                     $session->get('user-lastname')." ".$session->get('user-name').' @ '.date($SETTINGS['date_format']." ".$SETTINGS['time_format'], (int) time())
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
                 logEvents($SETTINGS, 'pdf_export', '', (string) $session->get('user-id'), $session->get('user-login'));
655 655
 
656 656
                 //clean table
657
-                DB::query('TRUNCATE TABLE ' . prefixTable('export'));
657
+                DB::query('TRUNCATE TABLE '.prefixTable('export'));
658 658
 
659 659
                 // Clean any content of the output buffer
660 660
                 ob_end_clean();
@@ -692,13 +692,13 @@  discard block
 block discarded – undo
692 692
             // step 1:
693 693
             // - prepare export file
694 694
             // - get full list of objects id to export
695
-            include $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
695
+            include $SETTINGS['cpassman_dir'].'/includes/config/include.php';
696 696
             $idsList = array();
697 697
 
698 698
             // query
699 699
             $rows = DB::query(
700 700
                 'SELECT * 
701
-                FROM ' . prefixTable('export') . ' 
701
+                FROM ' . prefixTable('export').' 
702 702
                 WHERE export_tag = %s',
703 703
                 $inputData['export_tag']
704 704
             );
@@ -735,13 +735,13 @@  discard block
 block discarded – undo
735 735
             }
736 736
             // prepare export file
737 737
             //save the file
738
-            $outstream = fopen($SETTINGS['path_to_files_folder'] . (substr($SETTINGS['path_to_files_folder'] , -1) === '/' ? '' : '/') . $inputData['filename'], 'w');
738
+            $outstream = fopen($SETTINGS['path_to_files_folder'].(substr($SETTINGS['path_to_files_folder'], -1) === '/' ? '' : '/').$inputData['filename'], 'w');
739 739
             if ($outstream === false) {
740 740
                 echo (string) prepareExchangedData(
741 741
                     [
742 742
                         'error' => true,
743 743
                         'message' => $lang->get('error_while_creating_file'),
744
-                        'detail' => $SETTINGS['path_to_files_folder'] . $inputData['filename'],
744
+                        'detail' => $SETTINGS['path_to_files_folder'].$inputData['filename'],
745 745
                     ],
746 746
                     'encode'
747 747
                 );
@@ -767,12 +767,12 @@  discard block
 block discarded – undo
767 767
     </style>
768 768
     </head>
769 769
     <body>
770
-    <input type="hidden" id="generation_date" value="' . GibberishAES::enc(/** @scrutinizer ignore-type */ (string) time(), $inputData['password']) . '" />
770
+    <input type="hidden" id="generation_date" value="' . GibberishAES::enc(/** @scrutinizer ignore-type */ (string) time(), $inputData['password']).'" />
771 771
     <div id="header">
772
-    ' . TP_TOOL_NAME . ' - Off Line mode
772
+    ' . TP_TOOL_NAME.' - Off Line mode
773 773
     </div>
774 774
     <div style="margin:10px; font-size:9px;">
775
-    <i>This page was generated by <b>' . $session->get('user-name') . ' ' . $session->get('user-lastname') . '</b>, the ' . date('Y/m/d H:i:s') . '.</i>
775
+    <i>This page was generated by <b>' . $session->get('user-name').' '.$session->get('user-lastname').'</b>, the '.date('Y/m/d H:i:s').'.</i>
776 776
     <span id="info_page" style="margin-left:20px; font-weight:bold; font-size: 14px; color:red;"></span>
777 777
     </div>
778 778
     <div id="information"></div>
@@ -783,11 +783,11 @@  discard block
 block discarded – undo
783 783
     <div>
784 784
     <table id="itemsTable">
785 785
         <thead><tr>
786
-            <th style="width:15%;">' . $lang->get('label') . '</th>
787
-            <th style="width:10%;">' . $lang->get('pw') . '</th>
788
-            <th style="width:30%;">' . $lang->get('description') . '</th>
789
-            <th style="width:5%;">' . $lang->get('user_login') . '</th>
790
-            <th style="width:20%;">' . $lang->get('url') . '</th>
786
+            <th style="width:15%;">' . $lang->get('label').'</th>
787
+            <th style="width:10%;">' . $lang->get('pw').'</th>
788
+            <th style="width:30%;">' . $lang->get('description').'</th>
789
+            <th style="width:5%;">' . $lang->get('user_login').'</th>
790
+            <th style="width:20%;">' . $lang->get('url').'</th>
791 791
         </tr></thead>
792 792
         <tbody id="itemsTable_tbody">'
793 793
             );
@@ -801,8 +801,8 @@  discard block
 block discarded – undo
801 801
                     'loop' => true,
802 802
                     'ids_list' => json_encode($idsList),
803 803
                     'ids_count' => count($idsList),
804
-                    'file_path' => $SETTINGS['path_to_files_folder'] . (substr($SETTINGS['path_to_files_folder'] , -1) === '/' ? '' : '/') . $inputData['filename'],
805
-                    'file_link' => $SETTINGS['url_to_files_folder'] . (substr($SETTINGS['path_to_files_folder'] , -1) === '/' ? '' : '/') . $inputData['filename'],
804
+                    'file_path' => $SETTINGS['path_to_files_folder'].(substr($SETTINGS['path_to_files_folder'], -1) === '/' ? '' : '/').$inputData['filename'],
805
+                    'file_link' => $SETTINGS['url_to_files_folder'].(substr($SETTINGS['path_to_files_folder'], -1) === '/' ? '' : '/').$inputData['filename'],
806 806
                     'export_tag' => $inputData['export_tag'],
807 807
                 ],
808 808
                 'encode'
@@ -842,12 +842,12 @@  discard block
 block discarded – undo
842 842
 
843 843
             $full_listing = array();
844 844
             $items_id_list = array();
845
-            include $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
845
+            include $SETTINGS['cpassman_dir'].'/includes/config/include.php';
846 846
 
847 847
             // query
848 848
             $rows = DB::query(
849 849
                 'SELECT * 
850
-                FROM ' . prefixTable('export') . ' 
850
+                FROM ' . prefixTable('export').' 
851 851
                 WHERE export_tag = %s AND item_id IN %ls',
852 852
                 $inputData['export_tag'],
853 853
                 $inputData['idsList']
@@ -861,7 +861,7 @@  discard block
 block discarded – undo
861 861
                         [
862 862
                             'error' => true,
863 863
                             'message' => $lang->get('error_while_creating_file'),
864
-                            'detail' => $SETTINGS['path_to_files_folder'] . $inputData['filename'],
864
+                            'detail' => $SETTINGS['path_to_files_folder'].$inputData['filename'],
865 865
                         ],
866 866
                         'encode'
867 867
                     );
@@ -903,13 +903,13 @@  discard block
 block discarded – undo
903 903
                         if (empty($arboHtml)) {
904 904
                             $arboHtml = $arboHtml_tmp;
905 905
                         } else {
906
-                            $arboHtml .= ' » ' . $arboHtml_tmp;
906
+                            $arboHtml .= ' » '.$arboHtml_tmp;
907 907
                         }
908 908
                     }
909 909
                     fputs(
910 910
                         $outstream,
911 911
                         '
912
-        <tr class="path"><td colspan="5">' . $arboHtml . '</td></tr>'
912
+        <tr class="path"><td colspan="5">' . $arboHtml.'</td></tr>'
913 913
                     );
914 914
                     $idTree = $record['folder_id'];
915 915
 
@@ -917,12 +917,12 @@  discard block
 block discarded – undo
917 917
                     fputs(
918 918
                         $outstream,
919 919
                         '
920
-        <tr class="' . $lineType . '">
921
-            <td>' . addslashes($record['label']) . '</td>
922
-            <td align="center"><span class="span_pw" id="span_' . $record['item_id'] . '"><a href="#" onclick="decryptme(' . $record['item_id'] . ', \'' . $encPw . '\');return false;">Decrypt </a></span><input type="hidden" id="hide_' . $record['item_id'] . '" value="' . $encPw . '" /></td>
923
-            <td>' . (empty($record['description']) === true ? '&nbsp;' : addslashes(str_replace(array(';', '<br />'), array('|', "\n\r"), stripslashes(mb_convert_encoding($record['description'], 'ISO-8859-1', 'UTF-8'))))) . '</td>
924
-            <td align="center">' . (empty($record['login']) === true ? '&nbsp;' : addslashes($record['login'])) . '</td>
925
-            <td align="center">' . (empty($record['url']) === true ? '&nbsp;' : addslashes($record['url'])) . '</td>
920
+        <tr class="' . $lineType.'">
921
+            <td>' . addslashes($record['label']).'</td>
922
+            <td align="center"><span class="span_pw" id="span_' . $record['item_id'].'"><a href="#" onclick="decryptme('.$record['item_id'].', \''.$encPw.'\');return false;">Decrypt </a></span><input type="hidden" id="hide_'.$record['item_id'].'" value="'.$encPw.'" /></td>
923
+            <td>' . (empty($record['description']) === true ? '&nbsp;' : addslashes(str_replace(array(';', '<br />'), array('|', "\n\r"), stripslashes(mb_convert_encoding($record['description'], 'ISO-8859-1', 'UTF-8'))))).'</td>
924
+            <td align="center">' . (empty($record['login']) === true ? '&nbsp;' : addslashes($record['login'])).'</td>
925
+            <td align="center">' . (empty($record['url']) === true ? '&nbsp;' : addslashes($record['url'])).'</td>
926 926
         </tr>'
927 927
                     );
928 928
                 }
@@ -971,7 +971,7 @@  discard block
 block discarded – undo
971 971
             $inputData['password'] = (string) filter_var($dataReceived['password'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
972 972
             
973 973
             // Load includes
974
-            include $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
974
+            include $SETTINGS['cpassman_dir'].'/includes/config/include.php';
975 975
 
976 976
             // read the content of the temporary file
977 977
             $handle = fopen($inputData['filename'].'.txt', 'r');
@@ -980,7 +980,7 @@  discard block
 block discarded – undo
980 980
                     [
981 981
                         'error' => true,
982 982
                         'message' => $lang->get('error_while_creating_file'),
983
-                        'detail' => $SETTINGS['path_to_files_folder'] . $inputData['filename'],
983
+                        'detail' => $SETTINGS['path_to_files_folder'].$inputData['filename'],
984 984
                     ],
985 985
                     'encode'
986 986
                 );
@@ -992,7 +992,7 @@  discard block
 block discarded – undo
992 992
                     [
993 993
                         'error' => true,
994 994
                         'message' => $lang->get('error_while_creating_file'),
995
-                        'detail' => $SETTINGS['path_to_files_folder'] . $inputData['filename'],
995
+                        'detail' => $SETTINGS['path_to_files_folder'].$inputData['filename'],
996 996
                     ],
997 997
                     'encode'
998 998
                 );
@@ -1008,9 +1008,9 @@  discard block
 block discarded – undo
1008 1008
             $chunks = explode('|#|#|', chunk_split($contents, 10000, '|#|#|'));
1009 1009
             foreach ($chunks as $chunk) {
1010 1010
                 if (empty($encrypted_text) === true) {
1011
-                    $encrypted_text = GibberishAES::enc(/** @scrutinizer ignore-type */ $chunk, $inputData['password'] );
1011
+                    $encrypted_text = GibberishAES::enc(/** @scrutinizer ignore-type */ $chunk, $inputData['password']);
1012 1012
                 } else {
1013
-                    $encrypted_text .= '|#|#|' . GibberishAES::enc(/** @scrutinizer ignore-type */ $chunk, $inputData['password'] );
1013
+                    $encrypted_text .= '|#|#|'.GibberishAES::enc(/** @scrutinizer ignore-type */ $chunk, $inputData['password']);
1014 1014
                 }
1015 1015
             }
1016 1016
 
@@ -1021,7 +1021,7 @@  discard block
 block discarded – undo
1021 1021
                     [
1022 1022
                         'error' => true,
1023 1023
                         'message' => $lang->get('error_while_creating_file'),
1024
-                        'detail' => $SETTINGS['path_to_files_folder'] . $inputData['filename'],
1024
+                        'detail' => $SETTINGS['path_to_files_folder'].$inputData['filename'],
1025 1025
                     ],
1026 1026
                     'encode'
1027 1027
                 );
@@ -1034,9 +1034,9 @@  discard block
 block discarded – undo
1034 1034
         </table></div>
1035 1035
         <input type="button" value="Hide all" onclick="hideAll()" />
1036 1036
         <div id="footer" style="text-align:center;">
1037
-            <a href="https://teampass.net/about/" target="_blank">' . TP_TOOL_NAME . '&nbsp;' . TP_VERSION . '&nbsp;' . TP_COPYRIGHT . '</a>
1037
+            <a href="https://teampass.net/about/" target="_blank">' . TP_TOOL_NAME.'&nbsp;'.TP_VERSION.'&nbsp;'.TP_COPYRIGHT.'</a>
1038 1038
         </div>
1039
-        <div id="enc_html" style="display:none;">' . $encrypted_text . '</div>
1039
+        <div id="enc_html" style="display:none;">' . $encrypted_text.'</div>
1040 1040
         </body>
1041 1041
     </html>
1042 1042
     <script type="text/javascript">
@@ -1139,12 +1139,12 @@  discard block
 block discarded – undo
1139 1139
             fclose($outstream);
1140 1140
 
1141 1141
             //clean table
1142
-            DB::query('TRUNCATE TABLE ' . prefixTable('export'));
1142
+            DB::query('TRUNCATE TABLE '.prefixTable('export'));
1143 1143
 
1144 1144
             echo (string) prepareExchangedData(
1145 1145
                 [
1146 1146
                     'error' => false,
1147
-                    'filelink' => $inputData['file_link'] ,
1147
+                    'filelink' => $inputData['file_link'],
1148 1148
                 ],
1149 1149
                 'encode'
1150 1150
             );
Please login to merge, or discard this patch.
sources/utils.queries.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@
 block discarded – undo
69 69
 ) {
70 70
     // Not allowed page
71 71
     $session->set('system-error_code', ERR_NOT_ALLOWED);
72
-    include $SETTINGS['cpassman_dir'] . '/error.php';
72
+    include $SETTINGS['cpassman_dir'].'/error.php';
73 73
     exit;
74 74
 }
75 75
 
Please login to merge, or discard this patch.
sources/favourites.queries.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@
 block discarded – undo
69 69
 ) {
70 70
     // Not allowed page
71 71
     $session->set('system-error_code', ERR_NOT_ALLOWED);
72
-    include $SETTINGS['cpassman_dir'] . '/error.php';
72
+    include $SETTINGS['cpassman_dir'].'/error.php';
73 73
     exit;
74 74
 }
75 75
 
Please login to merge, or discard this patch.
sources/items.logs.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@
 block discarded – undo
69 69
 ) {
70 70
     // Not allowed page
71 71
     $session->set('system-error_code', ERR_NOT_ALLOWED);
72
-    include $SETTINGS['cpassman_dir'] . '/error.php';
72
+    include $SETTINGS['cpassman_dir'].'/error.php';
73 73
     exit;
74 74
 }
75 75
 
Please login to merge, or discard this patch.
sources/user.logs.datatables.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@
 block discarded – undo
69 69
 ) {
70 70
     // Not allowed page
71 71
     $session->set('system-error_code', ERR_NOT_ALLOWED);
72
-    include $SETTINGS['cpassman_dir'] . '/error.php';
72
+    include $SETTINGS['cpassman_dir'].'/error.php';
73 73
     exit;
74 74
 }
75 75
 
Please login to merge, or discard this patch.
sources/ldap.queries.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 ) {
71 71
     // Not allowed page
72 72
     $session->set('system-error_code', ERR_NOT_ALLOWED);
73
-    include $SETTINGS['cpassman_dir'] . '/error.php';
73
+    include $SETTINGS['cpassman_dir'].'/error.php';
74 74
     exit;
75 75
 }
76 76
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
                     $openLdapExtra = new OpenLdapExtra();
145 145
                     break;
146 146
                 default:
147
-                    throw new Exception("Unsupported LDAP type: " . $SETTINGS['ldap_type']);
147
+                    throw new Exception("Unsupported LDAP type: ".$SETTINGS['ldap_type']);
148 148
             }
149 149
         } catch (Exception $e) {
150 150
             echo  prepareExchangedData(
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
             // 2- Get user info from AD
160 160
             // We want to isolate attribute ldap_user_attribute or mostly samAccountName
161 161
             $userADInfos = $ldapConnection->query()
162
-                ->where((isset($SETTINGS['ldap_user_attribute']) ===true && empty($SETTINGS['ldap_user_attribute']) === false) ? $SETTINGS['ldap_user_attribute'] : 'samaccountname', '=', $post_username)
162
+                ->where((isset($SETTINGS['ldap_user_attribute']) === true && empty($SETTINGS['ldap_user_attribute']) === false) ? $SETTINGS['ldap_user_attribute'] : 'samaccountname', '=', $post_username)
163 163
                 ->firstOrFail();
164 164
 
165 165
             // Is user enabled? Only ActiveDirectory
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
             echo prepareExchangedData(
183 183
                 array(
184 184
                     'error' => true,
185
-                    'message' => $lang->get('error')." - ".(isset($error) === true ? $error->getErrorCode()." - ".$error->getErrorMessage(). "<br>".$error->getDiagnosticMessage() : $e),
185
+                    'message' => $lang->get('error')." - ".(isset($error) === true ? $error->getErrorCode()." - ".$error->getErrorMessage()."<br>".$error->getDiagnosticMessage() : $e),
186 186
                 ),
187 187
                 'encode'
188 188
             );
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
             // For OpenLDAP and others, we use attribute dn
196 196
             $userAuthAttempt = $ldapConnection->auth()->attempt(
197 197
                 $SETTINGS['ldap_type'] === 'ActiveDirectory' ?
198
-                    $userADInfos['userprincipalname'][0] :  // refering to https://ldaprecord.com/docs/core/v2/authentication#basic-authentication
198
+                    $userADInfos['userprincipalname'][0] : // refering to https://ldaprecord.com/docs/core/v2/authentication#basic-authentication
199 199
                     $userADInfos['dn'],
200 200
                 $post_password
201 201
             );
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
             echo prepareExchangedData(
217 217
                 array(
218 218
                     'error' => true,
219
-                    'message' => $lang->get('error')." - ".(isset($error) === true ? $error->getErrorCode()." - ".$error->getErrorMessage(). "<br>".$error->getDiagnosticMessage() : $e),
219
+                    'message' => $lang->get('error')." - ".(isset($error) === true ? $error->getErrorCode()." - ".$error->getErrorMessage()."<br>".$error->getDiagnosticMessage() : $e),
220 220
                 ),
221 221
                 'encode'
222 222
             );
Please login to merge, or discard this patch.
includes/core/login.php 1 patch
Spacing   +35 added lines, -36 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 $lang = new Language(); 
41 41
 $get = [];
42 42
 $get['post_type'] = $request->query->get('post_type');
43
-if (isset($SETTINGS['duo']) === true && (int) $SETTINGS['duo'] === 1 && $get['post_type'] === 'duo' ) {
43
+if (isset($SETTINGS['duo']) === true && (int) $SETTINGS['duo'] === 1 && $get['post_type'] === 'duo') {
44 44
     $get['duo_state'] = $request->query->get('state');
45 45
     $get['duo_code'] = $request->query->get('duo_code');
46 46
 }
@@ -50,8 +50,7 @@  discard block
 block discarded – undo
50 50
 <div class="login-box">
51 51
     <div class="login-logo"><div style="margin:30px;">',
52 52
     isset($SETTINGS['custom_logo']) === true && empty($SETTINGS['custom_logo']) === false ?
53
-        '<img src="' . (string) $SETTINGS['custom_logo'] . '" alt="" style="text-align:center; max-width:100px;" />' :
54
-        '<img src="includes/images/teampass-logo2-login.png" alt="Teampass Logo">',
53
+        '<img src="'.(string) $SETTINGS['custom_logo'].'" alt="" style="text-align:center; max-width:100px;" />' : '<img src="includes/images/teampass-logo2-login.png" alt="Teampass Logo">',
55 54
         '
56 55
         </div>
57 56
         <div style="font-weight:bold;">
@@ -71,14 +70,14 @@  discard block
 block discarded – undo
71 70
 
72 71
         <div class="card-body login-card-body1">
73 72
             <div class="input-group has-feedback mb-2">
74
-                <div class="input-group-prepend infotip" title="' . $lang->get('login') . '">
73
+                <div class="input-group-prepend infotip" title="' . $lang->get('login').'">
75 74
                     <span class="input-group-text"><i class="fa-solid fa-user fa-fw"></i></span>
76 75
                 </div>';
77 76
 if (
78 77
     isset($SETTINGS['enable_http_request_login']) === true
79 78
     && (int) $SETTINGS['enable_http_request_login'] === 1
80 79
     && $request->server->get('PHP_AUTH_USER') !== null
81
-    && ! (isset($SETTINGS['maintenance_mode']) === true
80
+    && !(isset($SETTINGS['maintenance_mode']) === true
82 81
         && (int) $SETTINGS['maintenance_mode'] === 1)
83 82
 ) {
84 83
     if (strpos($request->server->get('PHP_AUTH_USER'), '@') !== false) {
@@ -92,32 +91,32 @@  discard block
 block discarded – undo
92 91
             <input type="text" id="login" class="form-control" placeholder="', filter_var($username, FILTER_SANITIZE_FULL_SPECIAL_CHARS), '" readonly>';
93 92
 } else {
94 93
     echo '
95
-            <input type="text" id="login" class="form-control" placeholder="' . $lang->get('index_login') . '" value="'.(null !== $session->get('user-login') && empty($session->get('user-login')) === false ? filter_var($session->get('user-login'), FILTER_SANITIZE_FULL_SPECIAL_CHARS) : '').'">';
94
+            <input type="text" id="login" class="form-control" placeholder="' . $lang->get('index_login').'" value="'.(null !== $session->get('user-login') && empty($session->get('user-login')) === false ? filter_var($session->get('user-login'), FILTER_SANITIZE_FULL_SPECIAL_CHARS) : '').'">';
96 95
 }
97 96
 
98 97
 echo '
99 98
         </div>';
100
-if (! (isset($SETTINGS['enable_http_request_login']) === true
99
+if (!(isset($SETTINGS['enable_http_request_login']) === true
101 100
     && (int) $SETTINGS['enable_http_request_login'] === 1
102 101
     && $request->server->get('PHP_AUTH_USER') !== null
103
-    && ! (isset($SETTINGS['maintenance_mode']) === true
102
+    && !(isset($SETTINGS['maintenance_mode']) === true
104 103
         && (int) $SETTINGS['maintenance_mode'] === 1))) {
105 104
     echo '
106 105
         <div class="input-group has-feedback mb-2">
107
-            <div class="input-group-prepend infotip" title="' . $lang->get('password') . '">
106
+            <div class="input-group-prepend infotip" title="' . $lang->get('password').'">
108 107
                 <span class="input-group-text"><i class="fa-solid fa-lock fa-fw"></i></span>
109 108
             </div>
110
-            <input type="password" id="pw" class="form-control submit-button" placeholder="' . $lang->get('index_password') . '">
109
+            <input type="password" id="pw" class="form-control submit-button" placeholder="' . $lang->get('index_password').'">
111 110
         </div>';
112 111
 }
113 112
 
114 113
 echo '
115 114
         <div class="input-group has-feedback mb-2">
116
-            <div class="input-group-prepend infotip" title="' . $lang->get('session_expiration_in_minutes') . '">
115
+            <div class="input-group-prepend infotip" title="' . $lang->get('session_expiration_in_minutes').'">
117 116
                 <span class="input-group-text"><i class="fa-solid fa-clock fa-fw"></i></span>
118 117
             </div>
119 118
             <input type="text" id="session_duration" class="form-control submit-button" 
120
-            placeholder="' . $lang->get('index_session_duration') .'&nbsp;(' . $lang->get('minutes') . ')" 
119
+            placeholder="' . $lang->get('index_session_duration').'&nbsp;('.$lang->get('minutes').')" 
121 120
             value="', isset($SETTINGS['default_session_expiration_time']) === true ? $SETTINGS['default_session_expiration_time'] : '', '">
122 121
         </div>';
123 122
 // 2FA auth selector
@@ -127,7 +126,7 @@  discard block
 block discarded – undo
127 126
         <input type="hidden" id="duo_state" value="', isset($get['duo_state']) === true && is_null($get['duo_state']) === false ? $get['duo_state'] : '', '">
128 127
         <div class="row mb-3 hidden" id="2fa_methods_selector">
129 128
             <div class="col-12">
130
-                <h8 class="login-box-msg">' . $lang->get('2fa_authentication_selector') . '</h8>
129
+                <h8 class="login-box-msg">' . $lang->get('2fa_authentication_selector').'</h8>
131 130
                 <div class="2fa-methods text-center mt-2">',
132 131
     isset($SETTINGS['google_authentication']) === true && (int) $SETTINGS['google_authentication'] === 1 ?
133 132
         '
@@ -161,14 +160,14 @@  discard block
 block discarded – undo
161 160
     echo '
162 161
         <div id="div-2fa-google" class="mb-3 div-2fa-method hidden">
163 162
             <div class="input-group has-feedback mb-2">
164
-                <div class="input-group-prepend infotip" title="' . $lang->get('mfa_unique_code') . '">
163
+                <div class="input-group-prepend infotip" title="' . $lang->get('mfa_unique_code').'">
165 164
                     <span class="input-group-text"><i class="fa-solid fa-key fa-fw"></i></span>
166 165
                 </div>
167
-                <input type="text" id="ga_code" class="form-control submit-button" placeholder="' . $lang->get('ga_identification_code') . '" />
166
+                <input type="text" id="ga_code" class="form-control submit-button" placeholder="' . $lang->get('ga_identification_code').'" />
168 167
                 <span class="input-group-append">
169 168
                     <button type="button" class="btn btn-info btn-flat" onclick="send_user_new_temporary_ga_code()">
170 169
                         <i class="fa-solid fa-envelope form-control-feedback pointer infotip" 
171
-                    title="' . $lang->get('i_need_to_generate_new_ga_code') . '"></i>
170
+                    title="' . $lang->get('i_need_to_generate_new_ga_code').'"></i>
172 171
                     </button>
173 172
                 </span>
174 173
             </div>
@@ -186,7 +185,7 @@  discard block
 block discarded – undo
186 185
 <script>
187 186
 var seconds = 1;
188 187
 function updateLogonButton(timeToGo){
189
-    document.getElementById("but_identify_user").value = "' . $lang->get('duration_login_attempt') . ' " + timeToGo;
188
+    document.getElementById("but_identify_user").value = "' . $lang->get('duration_login_attempt').' " + timeToGo;
190 189
 }
191 190
 $( window ).on( "load", function() {
192 191
     updateLogonButton(seconds);
@@ -195,7 +194,7 @@  discard block
 block discarded – undo
195 194
         if (seconds >= 0) {
196 195
             updateLogonButton(seconds);
197 196
         } else if(seconds === 0) {
198
-            launchIdentify("", "' . $nextUrl . '");
197
+            launchIdentify("", "' . $nextUrl.'");
199 198
         }
200 199
         updateLogonButton(seconds);
201 200
     },
@@ -216,15 +215,15 @@  discard block
 block discarded – undo
216 215
             <div class="col-8">
217 216
                 <div id="yubiko-new-key" class="alert alert-info hidden">
218 217
                     <p>
219
-                        <input type="text" size="10" id="yubico_user_id" class="form-control" placeholder="' . $lang->get('yubico_user_id') . '">
218
+                        <input type="text" size="10" id="yubico_user_id" class="form-control" placeholder="' . $lang->get('yubico_user_id').'">
220 219
                     </p>
221 220
                     <p>
222
-                    <input type="text" size="10" id="yubico_user_key" class="form-control" placeholder="' . $lang->get('yubico_user_key') . '">
221
+                    <input type="text" size="10" id="yubico_user_key" class="form-control" placeholder="' . $lang->get('yubico_user_key').'">
223 222
                     </p>
224 223
                 </div>
225
-                <input autocomplete="off" type="text" id="yubico_key" class="form-control submit-button" placeholder="' . $lang->get('press_your_yubico_key') . '">
224
+                <input autocomplete="off" type="text" id="yubico_key" class="form-control submit-button" placeholder="' . $lang->get('press_your_yubico_key').'">
226 225
                 <div class="row">
227
-                    <span class="ml-2 mt-1 font-weight-light small pointer" id="register-yubiko-key">' . $lang->get('register_new_yubiko_key') . '</span>
226
+                    <span class="ml-2 mt-1 font-weight-light small pointer" id="register-yubiko-key">' . $lang->get('register_new_yubiko_key').'</span>
228 227
                 </div>
229 228
             </div>
230 229
         </div>';
@@ -233,22 +232,22 @@  discard block
 block discarded – undo
233 232
 echo '
234 233
         <div class="row mb-3 mt-5">
235 234
             <div class="col-12">
236
-                <button id="but_identify_user" class="btn btn-primary btn-block">' . $lang->get('log_in') . '</button>
235
+                <button id="but_identify_user" class="btn btn-primary btn-block">' . $lang->get('log_in').'</button>
237 236
                 
238 237
                 <!-- In case of upgrade, the user has to provide his One Time Code -->
239 238
                 <div class="card-body user-one-time-code-card-body hidden">
240
-                    <h5 class="login-box-msg">' . $lang->get('provide_personal_one_time_code') . '</h5>
239
+                    <h5 class="login-box-msg">' . $lang->get('provide_personal_one_time_code').'</h5>
241 240
 
242 241
                     <div class="input-group has-feedback mb-2 mt-4">
243 242
                         <div class="input-group-prepend">
244 243
                             <span class="input-group-text"><i class="fa-solid fa-unlock-alt"></i></span>
245 244
                         </div>
246
-                        <input type="password" id="user-one-time-code" class="form-control" placeholder="' . $lang->get('one_time_code') . '">
245
+                        <input type="password" id="user-one-time-code" class="form-control" placeholder="' . $lang->get('one_time_code').'">
247 246
                     </div>
248 247
 
249 248
                     <div class="row mb-3">
250 249
                         <div class="col-12">
251
-                            <button id="but_confirm_otc" class="btn btn-primary btn-block">' . $lang->get('confirm') . '</button>
250
+                            <button id="but_confirm_otc" class="btn btn-primary btn-block">' . $lang->get('confirm').'</button>
252 251
                         </div>
253 252
                     </div>
254 253
                 </div>
@@ -263,10 +262,10 @@  discard block
 block discarded – undo
263 262
 // In case of password change
264 263
 echo '
265 264
     <div class="card-body confirm-password-card-body hidden">
266
-        <h5 class="login-box-msg">' . $lang->get('new_password_required') . '</h5>
265
+        <h5 class="login-box-msg">' . $lang->get('new_password_required').'</h5>
267 266
 
268 267
         <div class="alert alert-info">
269
-            <div class="text-center"><i class="icon fa fa-info"></i>' . $lang->get('password_strength') . '
268
+            <div class="text-center"><i class="icon fa fa-info"></i>' . $lang->get('password_strength').'
270 269
             <span id="confirm-password-level" class="ml-2 font-weight-bold"></span></div>
271 270
         </div>
272 271
 
@@ -276,20 +275,20 @@  discard block
 block discarded – undo
276 275
                     <div class="input-group-prepend">
277 276
                         <span class="input-group-text"><i class="fas fa-key"></i></span>
278 277
                     </div>
279
-                    <input type="password" id="current-user-password" class="form-control" placeholder="' . $lang->get('current_password') . '">
278
+                    <input type="password" id="current-user-password" class="form-control" placeholder="' . $lang->get('current_password').'">
280 279
                 </div>
281 280
             </div>
282 281
             <div class="input-group has-feedback mb-2 mt-4">
283 282
                 <div class="input-group-prepend">
284 283
                     <span class="input-group-text"><i class="fas fa-key"></i></span>
285 284
                 </div>
286
-                <input type="password" id="new-user-password" class="form-control" placeholder="' . $lang->get('index_new_pw') . '">
285
+                <input type="password" id="new-user-password" class="form-control" placeholder="' . $lang->get('index_new_pw').'">
287 286
             </div>
288 287
             <div class="input-group has-feedback mb-2">
289 288
                 <div class="input-group-prepend">
290 289
                     <span class="input-group-text"><i class="fas fa-key"></i></span>
291 290
                 </div>
292
-                <input type="password" id="new-user-password-confirm" class="form-control" placeholder="' . $lang->get('index_change_pw_confirmation') . '">
291
+                <input type="password" id="new-user-password-confirm" class="form-control" placeholder="' . $lang->get('index_change_pw_confirmation').'">
293 292
             </div>
294 293
             <div class="row mb-3">
295 294
                 <div class="col-md-12 offset-sm-4 text-center">
@@ -300,7 +299,7 @@  discard block
 block discarded – undo
300 299
             </div>
301 300
             <div class="row mb-3">
302 301
                 <div class="col-12">
303
-                    <button id="but_confirm_new_password" class="btn btn-primary btn-block">' . $lang->get('confirm') . '</button>
302
+                    <button id="but_confirm_new_password" class="btn btn-primary btn-block">' . $lang->get('confirm').'</button>
304 303
                 </div>
305 304
             </div>
306 305
         </div>
@@ -308,20 +307,20 @@  discard block
 block discarded – undo
308 307
 
309 308
     <div class="card-body hidden" id="card-user-treat-psk">
310 309
         <div class="alert alert-info">
311
-            <div class="text-center"><i class="icon fa fa-info"></i>' . $lang->get('user_has_psk_info') . '</div>
310
+            <div class="text-center"><i class="icon fa fa-info"></i>' . $lang->get('user_has_psk_info').'</div>
312 311
         </div>
313 312
         <div class="input-group has-feedback mb-2">
314 313
             <div class="input-group-prepend">
315 314
                 <span class="input-group-text"><i class="fas fa-key"></i></span>
316 315
             </div>
317
-            <input type="password" id="user-old-defuse-psk" class="form-control" placeholder="' . $lang->get('home_personal_saltkey') . '">
316
+            <input type="password" id="user-old-defuse-psk" class="form-control" placeholder="' . $lang->get('home_personal_saltkey').'">
318 317
         </div>
319 318
         <div class="row mb-3 mt-4">
320 319
             <div class="col-12">
321
-                <button id="but_confirm_defuse_psk" class="btn btn-primary btn-block">' . $lang->get('launch') . '</button>
320
+                <button id="but_confirm_defuse_psk" class="btn btn-primary btn-block">' . $lang->get('launch').'</button>
322 321
             </div>
323 322
             <div class="col-12 mt-3">
324
-                <button id="but_confirm_forgot_defuse_psk" class="btn btn-danger btn-block text-bold">' . $lang->get('i_cannot_remember') . '</button>
323
+                <button id="but_confirm_forgot_defuse_psk" class="btn btn-danger btn-block text-bold">' . $lang->get('i_cannot_remember').'</button>
325 324
             </div>
326 325
         </div>
327 326
     </div>
Please login to merge, or discard this patch.
includes/core/load.js.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
 
58 58
     $(document).ready(function() {
59
-        console.log('-- PAGE LOADED --'+$(location).attr('href').includes('?')+" -- <?php echo $session->get('key');?>");
59
+        console.log('-- PAGE LOADED --'+$(location).attr('href').includes('?')+" -- <?php echo $session->get('key'); ?>");
60 60
         if ($(location).attr('href').includes('?') === true && $(location).attr('href').includes('post_type') === false && (store.get('teampassUser') === undefined || parseInt(store.get('teampassUser').user_id) <= 0)) {
61 61
             $(location).attr('href', 'index.php?session=expired');
62 62
             return false;
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 
156 156
                             // Show passwords inputs and form
157 157
                             $('#dialog-user-change-password-info')
158
-                                .html('<i class="icon fa-solid fa-info mr-2"></i><?php echo $lang->get('user_has_to_change_password_info');?>')
158
+                                .html('<i class="icon fa-solid fa-info mr-2"></i><?php echo $lang->get('user_has_to_change_password_info'); ?>')
159 159
                                 .removeClass('hidden');
160 160
                             $('#dialog-user-change-password').removeClass('hidden');
161 161
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 
169 169
                             // Show passwords inputs and form
170 170
                             $('#dialog-ldap-user-change-password-info')
171
-                                .html('<i class="icon fa-solid fa-info mr-2"></i><?php echo $lang->get('ldap_user_has_changed_his_password');?>')
171
+                                .html('<i class="icon fa-solid fa-info mr-2"></i><?php echo $lang->get('ldap_user_has_changed_his_password'); ?>')
172 172
                                 .removeClass('hidden');
173 173
                             $('#dialog-ldap-user-change-password').removeClass('hidden');
174 174
                             
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
         /*console.log('User has to regenerate keys')
296 296
         // HIde
297 297
         $('.content-header, .content').addClass('hidden');
298
-        $('#dialog-user-temporary-code-info').html('<i class="icon fa-solid fa-info mr-2"></i><?php echo $lang->get('renecyption_expected');?>');
298
+        $('#dialog-user-temporary-code-info').html('<i class="icon fa-solid fa-info mr-2"></i><?php echo $lang->get('renecyption_expected'); ?>');
299 299
 
300 300
         // Show passwords inputs and form
301 301
         $('#dialog-user-temporary-code').removeClass('hidden');
@@ -377,13 +377,13 @@  discard block
 block discarded – undo
377 377
             {
378 378
                 if (step === 'psk') {
379 379
                     // Inform user
380
-                    $("#user-current-defuse-psk-progress").html('<b><?php echo $lang->get('encryption_keys'); ?> </b> [' + start + ' - ' + (parseInt(start) + <?php echo NUMBER_ITEMS_IN_BATCH;?>) + '] ' +
380
+                    $("#user-current-defuse-psk-progress").html('<b><?php echo $lang->get('encryption_keys'); ?> </b> [' + start + ' - ' + (parseInt(start) + <?php echo NUMBER_ITEMS_IN_BATCH; ?>) + '] ' +
381 381
                         '... <?php echo $lang->get('please_wait'); ?><i class="fa-solid fa-spinner fa-pulse ml-3 text-primary"></i>');
382 382
 
383 383
                     var data = {
384 384
                         'userPsk' : $('#user-current-defuse-psk').val(),
385 385
                             'start': start,
386
-                            'length': <?php echo NUMBER_ITEMS_IN_BATCH;?>,
386
+                            'length': <?php echo NUMBER_ITEMS_IN_BATCH; ?>,
387 387
                             'user_id': userId,
388 388
                     };
389 389
                     // Do query
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
 
461 461
                 // Show passwords inputs and form
462 462
                 $('#dialog-ldap-user-change-password-info')
463
-                    .html('<i class="icon fa-solid fa-info mr-2"></i><?php echo $lang->get('ldap_user_has_changed_his_password');?>')
463
+                    .html('<i class="icon fa-solid fa-info mr-2"></i><?php echo $lang->get('ldap_user_has_changed_his_password'); ?>')
464 464
                     .removeClass('hidden');
465 465
                 $('#dialog-ldap-user-change-password').removeClass('hidden');
466 466
 
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
                                 '</div>' +
550 550
                             '</div>' +
551 551
                         '</div>' +
552
-                        '<div class="row mt-2<?php echo isset($SETTINGS['enable_pf_feature']) === true && (int) $SETTINGS['enable_pf_feature'] === 1  ? '' : ' hidden'; ?>">' +
552
+                        '<div class="row mt-2<?php echo isset($SETTINGS['enable_pf_feature']) === true && (int) $SETTINGS['enable_pf_feature'] === 1 ? '' : ' hidden'; ?>">' +
553 553
                             '<h6><?php echo $lang->get('provide_recovery_keys'); ?></h6>' +
554 554
                             '<div class="input-group mb-2">' +
555 555
                                 '<div class="input-group-prepend">' +
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
                                 '<textarea rows="2" id="recovery-private-key" class="form-control form-item-control"></textarea>' +
565 565
                             '</div>' +
566 566
                         '</div>' +
567
-                        '<div class="row mt-2<?php echo isset($SETTINGS['enable_pf_feature']) === true && (int) $SETTINGS['enable_pf_feature'] === 1  ? '' : ' hidden'; ?>">' +
567
+                        '<div class="row mt-2<?php echo isset($SETTINGS['enable_pf_feature']) === true && (int) $SETTINGS['enable_pf_feature'] === 1 ? '' : ' hidden'; ?>">' +
568 568
                             '<div class="alert" id="confirm-no-recovery-keys-div">' +
569 569
                                 '<div class="form-check">' +
570 570
                                     '<input type="checkbox" class="form-check-input" id="confirm-no-recovery-keys">' +
@@ -1178,15 +1178,15 @@  discard block
 block discarded – undo
1178 1178
             // Prepare data
1179 1179
             var data = {
1180 1180
                 'receipt': $('#temp-user-email').val(),
1181
-                'subject': '[Teampass] <?php echo $lang->get('your_new_password');?>',
1182
-                'body': '<?php echo $lang->get('email_body_temporary_login_password');?>',
1181
+                'subject': '[Teampass] <?php echo $lang->get('your_new_password'); ?>',
1182
+                'body': '<?php echo $lang->get('email_body_temporary_login_password'); ?>',
1183 1183
                 'pre_replace' : {
1184 1184
                     '#enc_code#' : $('#temp-user-pwd').val(),
1185 1185
                 }
1186 1186
             }
1187 1187
             if (debugJavascript === true) console.log(data);
1188 1188
             // Prepare form
1189
-            $('#dialog-admin-change-user-password-info').html('<?php echo $lang->get('sending_email_message');?>');
1189
+            $('#dialog-admin-change-user-password-info').html('<?php echo $lang->get('sending_email_message'); ?>');
1190 1190
             toastr.remove();
1191 1191
             toastr.info(
1192 1192
                 '<?php echo $lang->get('in_progress'); ?><i class="fa-solid fa-circle-notch fa-spin fa-2x ml-3"></i>'
@@ -1706,7 +1706,7 @@  discard block
 block discarded – undo
1706 1706
                         '#warningModal',
1707 1707
                         '<i class="fa-solid fa-clock fa-lg warning mr-2"></i><?php echo $lang->get('index_add_one_hour'); ?>',
1708 1708
                         '<div class="form-group">' +
1709
-                        '<label for="warningModal-input" class="col-form-label"><?php echo $lang->get('extend_session_duration_by') . ' (' . $lang->get('minutes') . ')'; ?>:</label>' +
1709
+                        '<label for="warningModal-input" class="col-form-label"><?php echo $lang->get('extend_session_duration_by').' ('.$lang->get('minutes').')'; ?>:</label>' +
1710 1710
                         '<input type="number" max="'+(60*60*24)+'" class="form-control" id="warningModal-input" value="60">' +
1711 1711
                         '</div>' +
1712 1712
                         '<div class="form-text text-muted"><i class=\"fa-solid fa-info-circle mr-2\"></i><?php echo $lang->get('maximum_session_expiration_time'); ?>: '+data.max_session_duration+'</div>',
Please login to merge, or discard this patch.
scripts/background_tasks___user_keys_creation.php 1 patch
Spacing   +43 added lines, -44 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 DB::debugmode(false);
68 68
 $process_to_perform = DB::queryfirstrow(
69 69
     'SELECT *
70
-    FROM ' . prefixTable('processes') . '
70
+    FROM ' . prefixTable('processes').'
71 71
     WHERE is_in_progress = %i AND process_type = %s
72 72
     ORDER BY increment_id ASC',
73 73
     1,
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     // search for next process to handle
88 88
     $process_to_perform = DB::queryfirstrow(
89 89
         'SELECT *
90
-        FROM ' . prefixTable('processes') . '
90
+        FROM ' . prefixTable('processes').'
91 91
         WHERE is_in_progress = %i AND finished_at = "" AND process_type = %s
92 92
         ORDER BY increment_id ASC',
93 93
         0,
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
             $process_to_perform['increment_id']
106 106
         );
107 107
 
108
-        provideLog('[PROCESS][#'. $process_to_perform['increment_id'].'][START]', $SETTINGS);
108
+        provideLog('[PROCESS][#'.$process_to_perform['increment_id'].'][START]', $SETTINGS);
109 109
         handleTask(
110 110
             $process_to_perform['increment_id'],
111 111
             json_decode($process_to_perform['arguments'], true),
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 // launch a new iterative process
121 121
 $process_to_perform = DB::queryfirstrow(
122 122
     'SELECT *
123
-    FROM ' . prefixTable('processes') . '
123
+    FROM ' . prefixTable('processes').'
124 124
     WHERE is_in_progress = %i AND process_type = %s
125 125
     ORDER BY increment_id ASC',
126 126
     1,
@@ -144,11 +144,11 @@  discard block
 block discarded – undo
144 144
  */
145 145
 function handleTask(int $processId, array $ProcessArguments, array $SETTINGS): bool
146 146
 {
147
-    provideLog('[PROCESS][#'. $processId.'][START]', $SETTINGS);
147
+    provideLog('[PROCESS][#'.$processId.'][START]', $SETTINGS);
148 148
     //DB::debugmode(false);
149 149
     $task_to_perform = DB::queryfirstrow(
150 150
         'SELECT *
151
-        FROM ' . prefixTable('processes_tasks') . '
151
+        FROM ' . prefixTable('processes_tasks').'
152 152
         WHERE process_id = %i AND finished_at IS NULL
153 153
         ORDER BY increment_id ASC',
154 154
         $processId
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
         // check if a linux process is not currently on going
164 164
         // if sub_task_in_progress === 1 then exit
165 165
         if ((int) $task_to_perform['sub_task_in_progress'] === 0) {
166
-            provideLog('[TASK][#'. $task_to_perform['increment_id'].'][START]', $SETTINGS);
166
+            provideLog('[TASK][#'.$task_to_perform['increment_id'].'][START]', $SETTINGS);
167 167
 
168 168
             // handle next task
169 169
             $args = json_decode($task_to_perform['task'], true);
@@ -216,10 +216,9 @@  discard block
 block discarded – undo
216 216
             DB::update(
217 217
                 prefixTable('processes_tasks'),
218 218
                 array(
219
-                    'sub_task_in_progress' => 0,    // flag sub task is no more in prgoress
219
+                    'sub_task_in_progress' => 0, // flag sub task is no more in prgoress
220 220
                     'task' => $taskStatus['new_action'] !== $args['step'] ? 
221
-                    json_encode(["status" => "Done"]) :
222
-                    json_encode([
221
+                    json_encode(["status" => "Done"]) : json_encode([
223 222
                         "step" => $taskStatus['new_action'],
224 223
                         "index" => $taskStatus['new_index'],
225 224
                         "nb" => isset($SETTINGS['maximum_number_of_items_to_treat']) === true ? $SETTINGS['maximum_number_of_items_to_treat'] : $args['nb'],
@@ -255,7 +254,7 @@  discard block
 block discarded – undo
255 254
 
256 255
         } else {
257 256
             // Task is currently being in progress by another server process
258
-            provideLog('[TASK][#'. $task_to_perform['increment_id'].'][WARNING] Similar task already being processes', $SETTINGS);
257
+            provideLog('[TASK][#'.$task_to_perform['increment_id'].'][WARNING] Similar task already being processes', $SETTINGS);
259 258
             return false;
260 259
         }
261 260
     }
@@ -288,7 +287,7 @@  discard block
 block discarded – undo
288 287
         // Check if user exists
289 288
         $userInfo = DB::queryFirstRow(
290 289
             'SELECT public_key, private_key
291
-            FROM ' . prefixTable('users') . '
290
+            FROM ' . prefixTable('users').'
292 291
             WHERE id = %i',
293 292
             $post_user_id
294 293
         );
@@ -417,13 +416,13 @@  discard block
 block discarded – undo
417 416
 {
418 417
     $userInfo = DB::queryFirstRow(
419 418
         'SELECT pw, public_key, private_key, login, name
420
-        FROM ' . prefixTable('users') . '
419
+        FROM ' . prefixTable('users').'
421 420
         WHERE id = %i',
422 421
         $owner_id
423 422
     );
424 423
     
425 424
     // decrypt owner password
426
-    $pwd = cryption($owner_pwd, '','decrypt', $SETTINGS)['string'];
425
+    $pwd = cryption($owner_pwd, '', 'decrypt', $SETTINGS)['string'];
427 426
     provideLog('[USER][INFO] ID:'.$owner_id, $SETTINGS);
428 427
     //provideLog('[DEBUG] '.$pwd." -- ", $SETTINGS);
429 428
     // decrypt private key and send back
@@ -462,17 +461,17 @@  discard block
 block discarded – undo
462 461
     // Loop on items
463 462
     $rows = DB::query(
464 463
         'SELECT id, pw, perso
465
-        FROM ' . prefixTable('items') . '
464
+        FROM ' . prefixTable('items').'
466 465
         '.(isset($extra_arguments['only_personal_items']) === true && $extra_arguments['only_personal_items'] === 1 ? 'WHERE perso = 1' : '').'
467 466
         ORDER BY id ASC
468
-        LIMIT ' . $post_start . ', ' . $post_length
467
+        LIMIT ' . $post_start.', '.$post_length
469 468
     );
470 469
     //    WHERE perso = 0
471 470
     foreach ($rows as $record) {
472 471
         // Get itemKey from current user
473 472
         $currentUserKey = DB::queryFirstRow(
474 473
             'SELECT share_key, increment_id
475
-            FROM ' . prefixTable('sharekeys_items') . '
474
+            FROM ' . prefixTable('sharekeys_items').'
476 475
             WHERE object_id = %i AND user_id = %i',
477 476
             $record['id'],
478 477
             //$extra_arguments['owner_id']
@@ -501,7 +500,7 @@  discard block
 block discarded – undo
501 500
         
502 501
         $currentUserKey = DB::queryFirstRow(
503 502
             'SELECT increment_id
504
-            FROM ' . prefixTable('sharekeys_items') . '
503
+            FROM ' . prefixTable('sharekeys_items').'
505 504
             WHERE object_id = %i AND user_id = %i',
506 505
             $record['id'],
507 506
             $post_user_id
@@ -572,15 +571,15 @@  discard block
 block discarded – undo
572 571
     // Loop on logs
573 572
     $rows = DB::query(
574 573
         'SELECT increment_id
575
-        FROM ' . prefixTable('log_items') . '
574
+        FROM ' . prefixTable('log_items').'
576 575
         WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"
577
-        LIMIT ' . $post_start . ', ' . $post_length
576
+        LIMIT ' . $post_start.', '.$post_length
578 577
     );
579 578
     foreach ($rows as $record) {
580 579
         // Get itemKey from current user
581 580
         $currentUserKey = DB::queryFirstRow(
582 581
             'SELECT share_key
583
-            FROM ' . prefixTable('sharekeys_logs') . '
582
+            FROM ' . prefixTable('sharekeys_logs').'
584 583
             WHERE object_id = %i AND user_id = %i',
585 584
             $record['increment_id'],
586 585
             $extra_arguments['owner_id']
@@ -612,7 +611,7 @@  discard block
 block discarded – undo
612 611
             if ((int) $post_user_id !== (int) $extra_arguments['owner_id']) {
613 612
                 $currentUserKey = DB::queryFirstRow(
614 613
                     'SELECT increment_id
615
-                    FROM ' . prefixTable('sharekeys_items') . '
614
+                    FROM ' . prefixTable('sharekeys_items').'
616 615
                     WHERE object_id = %i AND user_id = %i',
617 616
                     $record['id'],
618 617
                     $post_user_id
@@ -634,7 +633,7 @@  discard block
 block discarded – undo
634 633
     // SHould we change step?
635 634
     DB::query(
636 635
         'SELECT increment_id
637
-        FROM ' . prefixTable('log_items') . '
636
+        FROM ' . prefixTable('log_items').'
638 637
         WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"'
639 638
     );
640 639
 
@@ -674,15 +673,15 @@  discard block
 block discarded – undo
674 673
     // Loop on fields
675 674
     $rows = DB::query(
676 675
         'SELECT id
677
-        FROM ' . prefixTable('categories_items') . '
676
+        FROM ' . prefixTable('categories_items').'
678 677
         WHERE encryption_type = "teampass_aes"
679
-        LIMIT ' . $post_start . ', ' . $post_length
678
+        LIMIT ' . $post_start.', '.$post_length
680 679
     );
681 680
     foreach ($rows as $record) {
682 681
         // Get itemKey from current user
683 682
         $currentUserKey = DB::queryFirstRow(
684 683
             'SELECT share_key
685
-            FROM ' . prefixTable('sharekeys_fields') . '
684
+            FROM ' . prefixTable('sharekeys_fields').'
686 685
             WHERE object_id = %i AND user_id = %i',
687 686
             $record['id'],
688 687
             $extra_arguments['owner_id']
@@ -710,7 +709,7 @@  discard block
 block discarded – undo
710 709
                 if ((int) $post_user_id !== (int) $extra_arguments['owner_id']) {
711 710
                     $currentUserKey = DB::queryFirstRow(
712 711
                         'SELECT increment_id
713
-                        FROM ' . prefixTable('sharekeys_items') . '
712
+                        FROM ' . prefixTable('sharekeys_items').'
714 713
                         WHERE object_id = %i AND user_id = %i',
715 714
                         $record['id'],
716 715
                         $post_user_id
@@ -733,7 +732,7 @@  discard block
 block discarded – undo
733 732
     // SHould we change step?
734 733
     DB::query(
735 734
         'SELECT *
736
-        FROM ' . prefixTable('categories_items') . '
735
+        FROM ' . prefixTable('categories_items').'
737 736
         WHERE encryption_type = "teampass_aes"'
738 737
     );
739 738
 
@@ -773,14 +772,14 @@  discard block
 block discarded – undo
773 772
     // Loop on suggestions
774 773
     $rows = DB::query(
775 774
         'SELECT id
776
-        FROM ' . prefixTable('suggestion') . '
777
-        LIMIT ' . $post_start . ', ' . $post_length
775
+        FROM ' . prefixTable('suggestion').'
776
+        LIMIT ' . $post_start.', '.$post_length
778 777
     );
779 778
     foreach ($rows as $record) {
780 779
         // Get itemKey from current user
781 780
         $currentUserKey = DB::queryFirstRow(
782 781
             'SELECT share_key
783
-            FROM ' . prefixTable('sharekeys_suggestions') . '
782
+            FROM ' . prefixTable('sharekeys_suggestions').'
784 783
             WHERE object_id = %i AND user_id = %i',
785 784
             $record['id'],
786 785
             $extra_arguments['owner_id']
@@ -812,7 +811,7 @@  discard block
 block discarded – undo
812 811
             if ((int) $post_user_id !== (int) $extra_arguments['owner_id']) {
813 812
                 $currentUserKey = DB::queryFirstRow(
814 813
                     'SELECT increment_id
815
-                    FROM ' . prefixTable('sharekeys_items') . '
814
+                    FROM ' . prefixTable('sharekeys_items').'
816 815
                     WHERE object_id = %i AND user_id = %i',
817 816
                     $record['id'],
818 817
                     $post_user_id
@@ -872,16 +871,16 @@  discard block
 block discarded – undo
872 871
     // Loop on files
873 872
     $rows = DB::query(
874 873
         'SELECT f.id AS id, i.perso AS perso
875
-        FROM ' . prefixTable('files') . ' AS f
876
-        INNER JOIN ' . prefixTable('items') . ' AS i ON i.id = f.id_item
877
-        WHERE f.status = "' . TP_ENCRYPTION_NAME . '"
878
-        LIMIT ' . $post_start . ', ' . $post_length
874
+        FROM ' . prefixTable('files').' AS f
875
+        INNER JOIN ' . prefixTable('items').' AS i ON i.id = f.id_item
876
+        WHERE f.status = "' . TP_ENCRYPTION_NAME.'"
877
+        LIMIT ' . $post_start.', '.$post_length
879 878
     ); //aes_encryption
880 879
     foreach ($rows as $record) {
881 880
         // Get itemKey from current user
882 881
         $currentUserKey = DB::queryFirstRow(
883 882
             'SELECT share_key, increment_id
884
-            FROM ' . prefixTable('sharekeys_files') . '
883
+            FROM ' . prefixTable('sharekeys_files').'
885 884
             WHERE object_id = %i AND user_id = %i',
886 885
             $record['id'],
887 886
             (int) $record['perso'] === 0 ? $extra_arguments['owner_id'] : $extra_arguments['new_user_id']
@@ -909,7 +908,7 @@  discard block
 block discarded – undo
909 908
 
910 909
         $currentUserKey = DB::queryFirstRow(
911 910
             'SELECT increment_id
912
-            FROM ' . prefixTable('sharekeys_files') . '
911
+            FROM ' . prefixTable('sharekeys_files').'
913 912
             WHERE object_id = %i AND user_id = %i',
914 913
             $record['id'],
915 914
             $post_user_id
@@ -971,8 +970,8 @@  discard block
 block discarded – undo
971 970
     // SHould we change step? Finished ?
972 971
     DB::query(
973 972
         'SELECT *
974
-        FROM ' . prefixTable('files') . '
975
-        WHERE status = "' . TP_ENCRYPTION_NAME . '"'
973
+        FROM ' . prefixTable('files').'
974
+        WHERE status = "' . TP_ENCRYPTION_NAME.'"'
976 975
     );
977 976
     $counter = DB::count();
978 977
     $next_start = (int) $post_start + (int) $post_length;
@@ -1038,7 +1037,7 @@  discard block
 block discarded – undo
1038 1037
     // get user info
1039 1038
     $userInfo = DB::queryFirstRow(
1040 1039
         'SELECT email, login, auth_type, special, lastname, name
1041
-        FROM ' . prefixTable('users') . '
1040
+        FROM ' . prefixTable('users').'
1042 1041
         WHERE id = %i',
1043 1042
         $extra_arguments['new_user_id']
1044 1043
     );
@@ -1052,13 +1051,13 @@  discard block
 block discarded – undo
1052 1051
         sendMailToUser(
1053 1052
             filter_var($userInfo['email'], FILTER_SANITIZE_FULL_SPECIAL_CHARS),
1054 1053
             empty($extra_arguments['email_body']) === false ? $extra_arguments['email_body'] : $lang->get('email_body_user_config_1'),
1055
-            'TEAMPASS - ' . $lang->get('login_credentials'),
1054
+            'TEAMPASS - '.$lang->get('login_credentials'),
1056 1055
             (array) filter_var_array(
1057 1056
                 [
1058
-                    '#code#' => cryption($extra_arguments['new_user_code'], '','decrypt', $SETTINGS)['string'],
1057
+                    '#code#' => cryption($extra_arguments['new_user_code'], '', 'decrypt', $SETTINGS)['string'],
1059 1058
                     '#lastname#' => isset($userInfo['name']) === true ? $userInfo['name'] : '',
1060 1059
                     '#login#' => isset($userInfo['login']) === true ? $userInfo['login'] : '',
1061
-                    '#password#' => cryption($extra_arguments['new_user_pwd'], '','decrypt', $SETTINGS)['string'],
1060
+                    '#password#' => cryption($extra_arguments['new_user_pwd'], '', 'decrypt', $SETTINGS)['string'],
1062 1061
                 ],
1063 1062
                 FILTER_SANITIZE_FULL_SPECIAL_CHARS
1064 1063
             )
Please login to merge, or discard this patch.