Passed
Pull Request — master (#4388)
by Evertton
05:56
created
includes/core/otv.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         filter_input(INPUT_GET, 'code', FILTER_SANITIZE_FULL_SPECIAL_CHARS)
87 87
     );
88 88
     
89
-    if (DB::count() > 0  && (int) $data['timestamp'] === (int) filter_input(INPUT_GET, 'stamp', FILTER_VALIDATE_INT)) {
89
+    if (DB::count() > 0 && (int) $data['timestamp'] === (int) filter_input(INPUT_GET, 'stamp', FILTER_VALIDATE_INT)) {
90 90
         // otv is too old
91 91
         if ($data['time_limit'] < time() || ($data['views'] + 1) > $data['max_views']) {
92 92
             $html = '<div class="text-center text-danger">
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
                 <tr><th>URL:</th><td>'.$url.'</td></tr>
191 191
                 </table></div>
192 192
                 <p class="mt-3 text-info"><i class="fas fa-info mr-2"></i>Copy carefully the data you need.<br>This page is visible until <b>'.
193
-                date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $dataItem['time_limit']).'</b> OR <b>'.($dataItem['max_views'] - ($dataItem['views']+1)).' more time(s)</b>.</div>
193
+                date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $dataItem['time_limit']).'</b> OR <b>'.($dataItem['max_views'] - ($dataItem['views'] + 1)).' more time(s)</b>.</div>
194 194
                 </div>';
195 195
             // log
196 196
             logItems(
Please login to merge, or discard this patch.
sources/items.queries.php 2 patches
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1045,7 +1045,9 @@  discard block
 block discarded – undo
1045 1045
             $session->get('user-id')
1046 1046
         );
1047 1047
         if (DB::count() === 0) {
1048
-            if (LOG_TO_SERVER === true) error_log('TEAMPASS | user '.$session->get('user-id').' has no sharekey for item '.$inputData['itemId']);
1048
+            if (LOG_TO_SERVER === true) {
1049
+                error_log('TEAMPASS | user '.$session->get('user-id').' has no sharekey for item '.$inputData['itemId']);
1050
+            }
1049 1051
             echo (string) prepareExchangedData(
1050 1052
                 array(
1051 1053
                     'error' => true,
@@ -1164,7 +1166,9 @@  discard block
 block discarded – undo
1164 1166
                 );
1165 1167
 
1166 1168
                 // Create a task to create sharekeys for users
1167
-                if (WIP=== true) error_log('createTaskForItem - new password for this item - '.$post_password ." -- ". $pw);
1169
+                if (WIP=== true) {
1170
+                    error_log('createTaskForItem - new password for this item - '.$post_password ." -- ". $pw);
1171
+                }
1168 1172
                 $tasksToBePerformed = ['item_password'];
1169 1173
                 /*createTaskForItem(
1170 1174
                     'item_update_create_keys',
@@ -1489,7 +1493,9 @@  discard block
 block discarded – undo
1489 1493
 
1490 1494
             // create a task for all fields updated
1491 1495
             if ($encryptionTaskIsRequested === true) {
1492
-                if (WIP === true) error_log('createTaskForItem - '.print_r($tasksToBePerformed, true));
1496
+                if (WIP === true) {
1497
+                    error_log('createTaskForItem - '.print_r($tasksToBePerformed, true));
1498
+                }
1493 1499
                 createTaskForItem(
1494 1500
                     'item_update_create_keys',
1495 1501
                     $tasksToBePerformed,
@@ -1996,7 +2002,9 @@  discard block
 block discarded – undo
1996 2002
                 $inputData['itemId']
1997 2003
             );
1998 2004
             foreach ($rows as $record) {
1999
-                if ($record['raison'] === NULL) continue;
2005
+                if ($record['raison'] === NULL) {
2006
+                    continue;
2007
+                }
2000 2008
                 $reason = explode(':', $record['raison']);
2001 2009
                 if (count($reason) > 0) {
2002 2010
                     $sentence = date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) . ' - '
@@ -4586,7 +4594,9 @@  discard block
 block discarded – undo
4586 4594
                 $inputData['itemId']
4587 4595
             );
4588 4596
             
4589
-            if (WIP === true) error_log('Existing edition locks: '.DB::count());
4597
+            if (WIP === true) {
4598
+                error_log('Existing edition locks: '.DB::count());
4599
+            }
4590 4600
 
4591 4601
             // Check if item has no edition lock
4592 4602
             if ((int) DB::count() > 0 ) {
@@ -4599,7 +4609,9 @@  discard block
 block discarded – undo
4599 4609
                 } else {
4600 4610
                     $delay = EDITION_LOCK_PERIOD; // One day delay
4601 4611
                 }
4602
-                if (WIP === true) error_log('delay: ' . $delay);
4612
+                if (WIP === true) {
4613
+                    error_log('delay: ' . $delay);
4614
+                }
4603 4615
 
4604 4616
                 // We remove old edition locks if delay is expired meaning more than 1 day long
4605 4617
                 if (round(abs(time() - $dataTmp['timestamp']),0) > $delay) {
@@ -4607,7 +4619,9 @@  discard block
 block discarded – undo
4607 4619
                     // In this case, delete edition lock and possible ongoing processes
4608 4620
                     // and continue editing this time
4609 4621
                     // We coonsidere if the most recent item is still locked then all other locks can be removed
4610
-                    if (WIP === true)  error_log('Delay is expired, removing old locks');
4622
+                    if (WIP === true) {
4623
+                        error_log('Delay is expired, removing old locks');
4624
+                    }
4611 4625
                     foreach ($dataItemEditionLocks as $itemEditionLock) {
4612 4626
                         // delete lock
4613 4627
                         DB::delete(
Please login to merge, or discard this patch.
Spacing   +300 added lines, -301 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 ) {
80 80
     // Not allowed page
81 81
     $session->set('system-error_code', ERR_NOT_ALLOWED);
82
-    include $SETTINGS['cpassman_dir'] . '/error.php';
82
+    include $SETTINGS['cpassman_dir'].'/error.php';
83 83
     exit;
84 84
 }
85 85
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     date_default_timezone_set('UTC');
105 105
 }
106 106
 
107
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $session->get('user-language') . '.php';
107
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$session->get('user-language').'.php';
108 108
 header('Content-type: text/html; charset=utf-8');
109 109
 header('Cache-Control: no-cache, must-revalidate');
110 110
 
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
             // About special settings
355 355
             $dataFolderSettings = DB::queryFirstRow(
356 356
                 'SELECT bloquer_creation, bloquer_modification, personal_folder
357
-                FROM ' . prefixTable('nested_tree') . ' 
357
+                FROM ' . prefixTable('nested_tree').' 
358 358
                 WHERE id = %i',
359 359
                 $inputData['folderId']
360 360
             );
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
             // Get folder complexity
372 372
             $folderComplexity = DB::queryfirstrow(
373 373
                 'SELECT valeur
374
-                FROM ' . prefixTable('misc') . '
374
+                FROM ' . prefixTable('misc').'
375 375
                 WHERE type = %s AND intitule = %i',
376 376
                 'complex',
377 377
                 $inputData['folderId']
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
             $itemExists = 0;
397 397
             $newID = '';
398 398
             $data = DB::queryfirstrow(
399
-                'SELECT * FROM ' . prefixTable('items') . '
399
+                'SELECT * FROM '.prefixTable('items').'
400 400
                 WHERE label = %s AND inactif = %i',
401 401
                 $inputData['label'],
402 402
                 0
@@ -480,8 +480,8 @@  discard block
 block discarded – undo
480 480
                     (int) $inputData['folderId'],
481 481
                     (int) $newID,
482 482
                     $cryptedStuff['objectKey'],
483
-                    true,   // only for the item creator
484
-                    false,  // no delete all
483
+                    true, // only for the item creator
484
+                    false, // no delete all
485 485
                 );
486 486
 
487 487
                 // update fields
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
                             // should we encrypt the data
495 495
                             $dataTmp = DB::queryFirstRow(
496 496
                                 'SELECT encrypted_data
497
-                                FROM ' . prefixTable('categories') . '
497
+                                FROM ' . prefixTable('categories').'
498 498
                                 WHERE id = %i',
499 499
                                 $field['id']
500 500
                             );
@@ -524,8 +524,8 @@  discard block
 block discarded – undo
524 524
                                     (int) $inputData['folderId'],
525 525
                                     (int) $newObjectId,
526 526
                                     $cryptedStuff['objectKey'],
527
-                                    true,   // only for the item creator
528
-                                    false,  // no delete all
527
+                                    true, // only for the item creator
528
+                                    false, // no delete all
529 529
                                 );
530 530
 
531 531
                                 array_push(
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
                 ) {
563 563
                     DB::queryFirstRow(
564 564
                         'SELECT *
565
-                        FROM ' . prefixTable('templates') . '
565
+                        FROM ' . prefixTable('templates').'
566 566
                         WHERE item_id = %i',
567 567
                         $newID
568 568
                     );
@@ -631,11 +631,11 @@  discard block
 block discarded – undo
631 631
                 ) {
632 632
                     foreach ($post_restricted_to as $userRest) {
633 633
                         if (empty($userRest) === false) {
634
-                            $dataTmp = DB::queryfirstrow('SELECT login FROM ' . prefixTable('users') . ' WHERE id= %i', $userRest);
634
+                            $dataTmp = DB::queryfirstrow('SELECT login FROM '.prefixTable('users').' WHERE id= %i', $userRest);
635 635
                             if (empty($listOfRestricted)) {
636 636
                                 $listOfRestricted = $dataTmp['login'];
637 637
                             } else {
638
-                                $listOfRestricted .= ';' . $dataTmp['login'];
638
+                                $listOfRestricted .= ';'.$dataTmp['login'];
639 639
                             }
640 640
                         }
641 641
                     }
@@ -649,11 +649,11 @@  discard block
 block discarded – undo
649 649
                     if (empty($data['restricted_to']) === false) {
650 650
                         foreach (explode(';', $data['restricted_to']) as $userRest) {
651 651
                             if (empty($userRest) === false) {
652
-                                $dataTmp = DB::queryfirstrow('SELECT login FROM ' . prefixTable('users') . ' WHERE id= ' . $userRest);
652
+                                $dataTmp = DB::queryfirstrow('SELECT login FROM '.prefixTable('users').' WHERE id= '.$userRest);
653 653
                                 if (empty($oldRestrictionList) === true) {
654 654
                                     $oldRestrictionList = $dataTmp['login'];
655 655
                                 } else {
656
-                                    $oldRestrictionList .= ';' . $dataTmp['login'];
656
+                                    $oldRestrictionList .= ';'.$dataTmp['login'];
657 657
                                 }
658 658
                             }
659 659
                         }
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
                 if (empty($post_uploaded_file_id) === false) {
717 717
                     $rows = DB::query(
718 718
                         'SELECT id
719
-                        FROM ' . prefixTable('files') . '
719
+                        FROM ' . prefixTable('files').'
720 720
                         WHERE id_item = %s',
721 721
                         $post_uploaded_file_id
722 722
                     );
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
                                     $lang->get('email_subject_item_updated'),
773 773
                                     str_replace(
774 774
                                         array('#label', '#link'),
775
-                                            array($path, $SETTINGS['email_server_url'] . '/index.php?page=items&group=' . $inputData['folderId'] . '&id=' . $newID . $txt['email_body3']),
775
+                                            array($path, $SETTINGS['email_server_url'].'/index.php?page=items&group='.$inputData['folderId'].'&id='.$newID.$txt['email_body3']),
776 776
                                             $lang->get('new_item_email_body')
777 777
                                     ),
778 778
                                     $emailAddress,
@@ -876,11 +876,11 @@  discard block
 block discarded – undo
876 876
         // Prepare variables
877 877
         $itemInfos = array();
878 878
         $inputData['label'] = isset($dataReceived['label']) && is_string($dataReceived['label']) ? filter_var($dataReceived['label'], FILTER_SANITIZE_FULL_SPECIAL_CHARS) : '';
879
-        $post_url = isset($dataReceived['url'])=== true ? filter_var(htmlspecialchars_decode($dataReceived['url']), FILTER_SANITIZE_URL) : '';
879
+        $post_url = isset($dataReceived['url']) === true ? filter_var(htmlspecialchars_decode($dataReceived['url']), FILTER_SANITIZE_URL) : '';
880 880
         $post_password = $original_pw = isset($dataReceived['pw']) && is_string($dataReceived['pw']) ? htmlspecialchars_decode($dataReceived['pw']) : '';
881 881
         $post_login = isset($dataReceived['login']) && is_string($dataReceived['login']) ? filter_var(htmlspecialchars_decode($dataReceived['login']), FILTER_SANITIZE_FULL_SPECIAL_CHARS) : '';
882
-        $post_tags = isset($dataReceived['tags'])=== true ? htmlspecialchars_decode($dataReceived['tags']) : '';
883
-        $post_email = isset($dataReceived['email'])=== true ? filter_var(htmlspecialchars_decode($dataReceived['email']), FILTER_SANITIZE_EMAIL) : '';
882
+        $post_tags = isset($dataReceived['tags']) === true ? htmlspecialchars_decode($dataReceived['tags']) : '';
883
+        $post_email = isset($dataReceived['email']) === true ? filter_var(htmlspecialchars_decode($dataReceived['email']), FILTER_SANITIZE_EMAIL) : '';
884 884
         $post_template_id = (int) filter_var($dataReceived['template_id'], FILTER_SANITIZE_NUMBER_INT);
885 885
         $inputData['itemId'] = (int) filter_var($dataReceived['id'], FILTER_SANITIZE_NUMBER_INT);
886 886
         $post_anyone_can_modify = (int) filter_var($dataReceived['anyone_can_modify'], FILTER_SANITIZE_NUMBER_INT);
@@ -911,8 +911,7 @@  discard block
 block discarded – undo
911 911
         $post_to_be_deleted_after_date = isset($dataReceived['to_be_deleted_after_date']) === true ? filter_var(
912 912
                 $dataReceived['to_be_deleted_after_date'],
913 913
                 FILTER_SANITIZE_FULL_SPECIAL_CHARS
914
-            ) :
915
-            '';
914
+            ) : '';
916 915
         $post_fields = (filter_var_array(
917 916
             $dataReceived['fields'],
918 917
             FILTER_SANITIZE_FULL_SPECIAL_CHARS
@@ -972,7 +971,7 @@  discard block
 block discarded – undo
972 971
         // About special settings
973 972
         $dataFolderSettings = DB::queryFirstRow(
974 973
             'SELECT bloquer_creation, bloquer_modification, personal_folder, title
975
-            FROM ' . prefixTable('nested_tree') . ' 
974
+            FROM ' . prefixTable('nested_tree').' 
976 975
             WHERE id = %i',
977 976
             $inputData['folderId']
978 977
         );
@@ -988,7 +987,7 @@  discard block
 block discarded – undo
988 987
         // Get folder complexity
989 988
         $folderComplexity = DB::queryfirstrow(
990 989
             'SELECT valeur
991
-            FROM ' . prefixTable('misc') . '
990
+            FROM ' . prefixTable('misc').'
992 991
             WHERE type = %s AND intitule = %i',
993 992
             'complex',
994 993
             $inputData['folderId']
@@ -1033,8 +1032,8 @@  discard block
 block discarded – undo
1033 1032
         // Get all informations for this item
1034 1033
         $dataItem = DB::queryfirstrow(
1035 1034
             'SELECT *
1036
-            FROM ' . prefixTable('items') . ' as i
1037
-            INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
1035
+            FROM ' . prefixTable('items').' as i
1036
+            INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
1038 1037
             WHERE i.id=%i AND l.action = %s',
1039 1038
             $inputData['itemId'],
1040 1039
             'at_creation'
@@ -1083,7 +1082,7 @@  discard block
 block discarded – undo
1083 1082
         //db::debugmode(true);
1084 1083
         DB::query(
1085 1084
             'SELECT *
1086
-            FROM ' . prefixTable('sharekeys_items') . '
1085
+            FROM ' . prefixTable('sharekeys_items').'
1087 1086
             WHERE object_id = %i AND user_id = %s',
1088 1087
             $inputData['itemId'],
1089 1088
             $session->get('user-id')
@@ -1133,9 +1132,9 @@  discard block
 block discarded – undo
1133 1132
                 'SELECT i.id as id, i.label as label, i.description as description, i.pw as pw, i.url as url, i.id_tree as id_tree, i.perso as perso, i.login as login, 
1134 1133
                 i.inactif as inactif, i.restricted_to as restricted_to, i.anyone_can_modify as anyone_can_modify, i.email as email, i.notification as notification,
1135 1134
                 u.login as user_login, u.email as user_email
1136
-                FROM ' . prefixTable('items') . ' as i
1137
-                INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id=l.id_item)
1138
-                INNER JOIN ' . prefixTable('users') . ' as u ON (u.id=l.id_user)
1135
+                FROM ' . prefixTable('items').' as i
1136
+                INNER JOIN ' . prefixTable('log_items').' as l ON (i.id=l.id_item)
1137
+                INNER JOIN ' . prefixTable('users').' as u ON (u.id=l.id_user)
1139 1138
                 WHERE i.id=%i',
1140 1139
                 $inputData['itemId']
1141 1140
             );
@@ -1143,7 +1142,7 @@  discard block
 block discarded – undo
1143 1142
             // Should we log a password change?
1144 1143
             $userKey = DB::queryFirstRow(
1145 1144
                 'SELECT share_key
1146
-                FROM ' . prefixTable('sharekeys_items') . '
1145
+                FROM ' . prefixTable('sharekeys_items').'
1147 1146
                 WHERE user_id = %i AND object_id = %i',
1148 1147
                 $session->get('user-id'),
1149 1148
                 $inputData['itemId']
@@ -1203,12 +1202,12 @@  discard block
 block discarded – undo
1203 1202
                     (int) $inputData['folderId'],
1204 1203
                     (int) $inputData['itemId'],
1205 1204
                     $encrypted_password_key,
1206
-                    true,   // only for the item creator
1207
-                    true,   // delete all
1205
+                    true, // only for the item creator
1206
+                    true, // delete all
1208 1207
                 );
1209 1208
 
1210 1209
                 // Create a task to create sharekeys for users
1211
-                if (WIP=== true) error_log('createTaskForItem - new password for this item - '.$post_password ." -- ". $pw);
1210
+                if (WIP === true) error_log('createTaskForItem - new password for this item - '.$post_password." -- ".$pw);
1212 1211
                 $tasksToBePerformed = ['item_password'];
1213 1212
                 /*createTaskForItem(
1214 1213
                     'item_update_create_keys',
@@ -1227,7 +1226,7 @@  discard block
 block discarded – undo
1227 1226
             // Get list of tags
1228 1227
             $itemTags = DB::queryFirstColumn(
1229 1228
                 'SELECT tag
1230
-                FROM ' . prefixTable('tags') . '
1229
+                FROM ' . prefixTable('tags').'
1231 1230
                 WHERE item_id = %i',
1232 1231
                 $inputData['itemId']
1233 1232
             );
@@ -1273,7 +1272,7 @@  discard block
 block discarded – undo
1273 1272
                     $session->get('user-id'),
1274 1273
                     'at_modification',
1275 1274
                     $session->get('user-login'),
1276
-                    'at_tag : ' . implode(' ', $itemTags) . ' => ' . $post_tags
1275
+                    'at_tag : '.implode(' ', $itemTags).' => '.$post_tags
1277 1276
                 );
1278 1277
             }
1279 1278
 
@@ -1313,8 +1312,8 @@  discard block
 block discarded – undo
1313 1312
                             'SELECT c.id AS id, c.title AS title, i.data AS data, i.data_iv AS data_iv,
1314 1313
                             i.encryption_type AS encryption_type, c.encrypted_data AS encrypted_data,
1315 1314
                             c.masked AS masked, i.id AS field_item_id
1316
-                            FROM ' . prefixTable('categories_items') . ' AS i
1317
-                            INNER JOIN ' . prefixTable('categories') . ' AS c ON (i.field_id=c.id)
1315
+                            FROM ' . prefixTable('categories_items').' AS i
1316
+                            INNER JOIN ' . prefixTable('categories').' AS c ON (i.field_id=c.id)
1318 1317
                             WHERE i.field_id = %i AND i.item_id = %i',
1319 1318
                             $field['id'],
1320 1319
                             $inputData['itemId']
@@ -1330,7 +1329,7 @@  discard block
 block discarded – undo
1330 1329
                             // Perform new query
1331 1330
                             $dataTmpCat = DB::queryFirstRow(
1332 1331
                                 'SELECT id, title, encrypted_data, masked
1333
-                                FROM ' . prefixTable('categories') . '
1332
+                                FROM ' . prefixTable('categories').'
1334 1333
                                 WHERE id = %i',
1335 1334
                                 $field['id']
1336 1335
                             );
@@ -1361,8 +1360,8 @@  discard block
 block discarded – undo
1361 1360
                                     (int) $inputData['folderId'],
1362 1361
                                     (int) $newId,
1363 1362
                                     $cryptedStuff['objectKey'],
1364
-                                    true,   // only for the item creator
1365
-                                    true,   // delete all
1363
+                                    true, // only for the item creator
1364
+                                    true, // delete all
1366 1365
                                 );
1367 1366
 
1368 1367
                                 // update value
@@ -1410,7 +1409,7 @@  discard block
 block discarded – undo
1410 1409
                                 $session->get('user-id'),
1411 1410
                                 'at_modification',
1412 1411
                                 $session->get('user-login'),
1413
-                                'at_field : ' . $dataTmpCat['title'] . ' : ' . $field['value']
1412
+                                'at_field : '.$dataTmpCat['title'].' : '.$field['value']
1414 1413
                             );
1415 1414
                         } else {
1416 1415
                             // Case where the field already exists
@@ -1419,7 +1418,7 @@  discard block
 block discarded – undo
1419 1418
                                 // Get user sharekey for this field
1420 1419
                                 $userKey = DB::queryFirstRow(
1421 1420
                                     'SELECT share_key
1422
-                                    FROM ' . prefixTable('sharekeys_fields') . '
1421
+                                    FROM ' . prefixTable('sharekeys_fields').'
1423 1422
                                     WHERE user_id = %i AND object_id = %i',
1424 1423
                                     $session->get('user-id'),
1425 1424
                                     $dataTmpCat['field_item_id']
@@ -1459,8 +1458,8 @@  discard block
 block discarded – undo
1459 1458
                                         (int) $inputData['folderId'],
1460 1459
                                         (int) $dataTmpCat['field_item_id'],
1461 1460
                                         $cryptedStuff['objectKey'],
1462
-                                        true,   // only for the item creator
1463
-                                        true,   // delete all
1461
+                                        true, // only for the item creator
1462
+                                        true, // delete all
1464 1463
                                     );
1465 1464
 
1466 1465
                                     array_push(
@@ -1500,7 +1499,7 @@  discard block
 block discarded – undo
1500 1499
                                     $session->get('user-id'),
1501 1500
                                     'at_modification',
1502 1501
                                     $session->get('user-login'),
1503
-                                    'at_field : ' . $dataTmpCat['title'] . ' => ' . $oldVal
1502
+                                    'at_field : '.$dataTmpCat['title'].' => '.$oldVal
1504 1503
                                 );
1505 1504
                             }
1506 1505
                         }
@@ -1555,7 +1554,7 @@  discard block
 block discarded – undo
1555 1554
             ) {
1556 1555
                 DB::queryFirstRow(
1557 1556
                     'SELECT *
1558
-                    FROM ' . prefixTable('templates') . '
1557
+                    FROM ' . prefixTable('templates').'
1559 1558
                     WHERE item_id = %i',
1560 1559
                     $inputData['itemId']
1561 1560
                 );
@@ -1598,7 +1597,7 @@  discard block
 block discarded – undo
1598 1597
                 // check if elem exists in Table. If not add it or update it.
1599 1598
                 DB::query(
1600 1599
                     'SELECT *
1601
-                    FROM ' . prefixTable('automatic_del') . '
1600
+                    FROM ' . prefixTable('automatic_del').'
1602 1601
                     WHERE item_id = %i',
1603 1602
                     $inputData['itemId']
1604 1603
                 );
@@ -1625,7 +1624,7 @@  discard block
 block discarded – undo
1625 1624
                         // Store updates performed
1626 1625
                         array_push(
1627 1626
                             $arrayOfChanges,
1628
-                            $lang->get('automatic_deletion_engaged') . ': ' . $lang->get('enabled')
1627
+                            $lang->get('automatic_deletion_engaged').': '.$lang->get('enabled')
1629 1628
                         );
1630 1629
 
1631 1630
                         // update LOG
@@ -1668,7 +1667,7 @@  discard block
 block discarded – undo
1668 1667
                         // Store updates performed
1669 1668
                         array_push(
1670 1669
                             $arrayOfChanges,
1671
-                            $lang->get('automatic_deletion_engaged') . ': ' . $lang->get('disabled')
1670
+                            $lang->get('automatic_deletion_engaged').': '.$lang->get('disabled')
1672 1671
                         );
1673 1672
 
1674 1673
                         // update LOG
@@ -1701,7 +1700,7 @@  discard block
 block discarded – undo
1701 1700
                     if (empty($userId) === false) {
1702 1701
                         $dataTmp = DB::queryfirstrow(
1703 1702
                             'SELECT id, name, lastname
1704
-                            FROM ' . prefixTable('users') . '
1703
+                            FROM ' . prefixTable('users').'
1705 1704
                             WHERE id= %i',
1706 1705
                             $userId
1707 1706
                         );
@@ -1709,7 +1708,7 @@  discard block
 block discarded – undo
1709 1708
                         // Add to array
1710 1709
                         array_push(
1711 1710
                             $arrayOfUsersRestriction,
1712
-                            $dataTmp['name'] . ' ' . $dataTmp['lastname']
1711
+                            $dataTmp['name'].' '.$dataTmp['lastname']
1713 1712
                         );
1714 1713
                         array_push(
1715 1714
                             $arrayOfUsersIdRestriction,
@@ -1740,8 +1739,8 @@  discard block
 block discarded – undo
1740 1739
                 // get values before deleting them
1741 1740
                 $rows = DB::query(
1742 1741
                     'SELECT t.title, t.id AS id
1743
-                    FROM ' . prefixTable('roles_title') . ' as t
1744
-                    INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (t.id=r.role_id)
1742
+                    FROM ' . prefixTable('roles_title').' as t
1743
+                    INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (t.id=r.role_id)
1745 1744
                     WHERE r.item_id = %i
1746 1745
                     ORDER BY t.title ASC',
1747 1746
                     $inputData['itemId']
@@ -1775,7 +1774,7 @@  discard block
 block discarded – undo
1775 1774
                         );
1776 1775
                         $dataTmp = DB::queryfirstrow(
1777 1776
                             'SELECT title
1778
-                            FROM ' . prefixTable('roles_title') . '
1777
+                            FROM ' . prefixTable('roles_title').'
1779 1778
                             WHERE id = %i',
1780 1779
                             $role
1781 1780
                         );
@@ -1803,7 +1802,7 @@  discard block
 block discarded – undo
1803 1802
             // Get current status
1804 1803
             $otpStatus = DB::queryFirstRow(
1805 1804
                 'SELECT enabled as otp_is_enabled
1806
-                FROM ' . prefixTable('items_otp') . '
1805
+                FROM ' . prefixTable('items_otp').'
1807 1806
                 WHERE item_id = %i',
1808 1807
                 $inputData['itemId']
1809 1808
             );
@@ -1834,7 +1833,7 @@  discard block
 block discarded – undo
1834 1833
                     $session->get('user-id'),
1835 1834
                     'at_modification',
1836 1835
                     $session->get('user-login'),
1837
-                    'at_otp_status:' . ((int) $post_otp_is_enabled === 0 ? 'disabled' : 'enabled')
1836
+                    'at_otp_status:'.((int) $post_otp_is_enabled === 0 ? 'disabled' : 'enabled')
1838 1837
                 );
1839 1838
             } elseif (DB::count() === 0 && empty($post_otp_secret) === false) {
1840 1839
                 // Create the entry in items_otp table
@@ -1878,8 +1877,8 @@  discard block
 block discarded – undo
1878 1877
                     $session->get('user-id'),
1879 1878
                     'at_modification',
1880 1879
                     $session->get('user-login'),
1881
-                    'at_restriction : ' . (count($diffUsersRestiction) > 0 ?
1882
-                        implode(', ', $arrayOfUsersRestriction) . (count($diffRolesRestiction) > 0 ? ', ' : '') : '') . (count($diffRolesRestiction) > 0 ? implode(', ', $arrayOfRestrictionRoles) : '')
1880
+                    'at_restriction : '.(count($diffUsersRestiction) > 0 ?
1881
+                        implode(', ', $arrayOfUsersRestriction).(count($diffRolesRestiction) > 0 ? ', ' : '') : '').(count($diffRolesRestiction) > 0 ? implode(', ', $arrayOfRestrictionRoles) : '')
1883 1882
                 );
1884 1883
             }
1885 1884
 
@@ -1899,7 +1898,7 @@  discard block
 block discarded – undo
1899 1898
                     $session->get('user-id'),
1900 1899
                     'at_modification',
1901 1900
                     $session->get('user-login'),
1902
-                    'at_label : ' . $data['label'] . ' => ' . $inputData['label']
1901
+                    'at_label : '.$data['label'].' => '.$inputData['label']
1903 1902
                 );
1904 1903
             }
1905 1904
             // LOGIN
@@ -1918,7 +1917,7 @@  discard block
 block discarded – undo
1918 1917
                     $session->get('user-id'),
1919 1918
                     'at_modification',
1920 1919
                     $session->get('user-login'),
1921
-                    'at_login : ' . $data['login'] . ' => ' . $post_login
1920
+                    'at_login : '.$data['login'].' => '.$post_login
1922 1921
                 );
1923 1922
             }
1924 1923
             // EMAIL
@@ -1937,7 +1936,7 @@  discard block
 block discarded – undo
1937 1936
                     $session->get('user-id'),
1938 1937
                     'at_modification',
1939 1938
                     $session->get('user-login'),
1940
-                    'at_email : ' . $data['email'] . ' => ' . $post_email
1939
+                    'at_email : '.$data['email'].' => '.$post_email
1941 1940
                 );
1942 1941
             }
1943 1942
             // URL
@@ -1956,7 +1955,7 @@  discard block
 block discarded – undo
1956 1955
                     $session->get('user-id'),
1957 1956
                     'at_modification',
1958 1957
                     $session->get('user-login'),
1959
-                    'at_url : ' . $data['url'] . ' => ' . $post_url
1958
+                    'at_url : '.$data['url'].' => '.$post_url
1960 1959
                 );
1961 1960
             }
1962 1961
             // DESCRIPTION
@@ -1982,7 +1981,7 @@  discard block
 block discarded – undo
1982 1981
             // FOLDER
1983 1982
             if ((int) $data['id_tree'] !== (int) $inputData['folderId']) {
1984 1983
                 // Get name of folders
1985
-                $dataTmp = DB::query('SELECT title FROM ' . prefixTable('nested_tree') . ' WHERE id IN %li', array($data['id_tree'], $inputData['folderId']));
1984
+                $dataTmp = DB::query('SELECT title FROM '.prefixTable('nested_tree').' WHERE id IN %li', array($data['id_tree'], $inputData['folderId']));
1986 1985
 
1987 1986
                 // Store updates performed
1988 1987
                 array_push(
@@ -1998,7 +1997,7 @@  discard block
 block discarded – undo
1998 1997
                     $session->get('user-id'),
1999 1998
                     'at_modification',
2000 1999
                     $session->get('user-login'),
2001
-                    'at_category : ' . $dataTmp[0]['title'] . ' => ' . $dataTmp[1]['title']
2000
+                    'at_category : '.$dataTmp[0]['title'].' => '.$dataTmp[1]['title']
2002 2001
                 );
2003 2002
             }
2004 2003
             // ANYONE_CAN_MODIFY
@@ -2006,7 +2005,7 @@  discard block
 block discarded – undo
2006 2005
                 // Store updates performed
2007 2006
                 array_push(
2008 2007
                     $arrayOfChanges,
2009
-                    $lang->get('at_anyoneconmodify') . ': ' . ((int) $post_anyone_can_modify === 0 ? $lang->get('disabled') : $lang->get('enabled'))
2008
+                    $lang->get('at_anyoneconmodify').': '.((int) $post_anyone_can_modify === 0 ? $lang->get('disabled') : $lang->get('enabled'))
2010 2009
                 );
2011 2010
 
2012 2011
                 // Log
@@ -2017,15 +2016,15 @@  discard block
 block discarded – undo
2017 2016
                     $session->get('user-id'),
2018 2017
                     'at_modification',
2019 2018
                     $session->get('user-login'),
2020
-                    'at_anyoneconmodify : ' . ((int) $post_anyone_can_modify === 0 ? 'disabled' : 'enabled')
2019
+                    'at_anyoneconmodify : '.((int) $post_anyone_can_modify === 0 ? 'disabled' : 'enabled')
2021 2020
                 );
2022 2021
             }
2023 2022
 
2024 2023
             // Reload new values
2025 2024
             $dataItem = DB::queryfirstrow(
2026 2025
                 'SELECT *
2027
-                FROM ' . prefixTable('items') . ' as i
2028
-                INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
2026
+                FROM ' . prefixTable('items').' as i
2027
+                INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
2029 2028
                 WHERE i.id = %i AND l.action = %s',
2030 2029
                 $inputData['itemId'],
2031 2030
                 'at_creation'
@@ -2034,8 +2033,8 @@  discard block
 block discarded – undo
2034 2033
             $history = '';
2035 2034
             $rows = DB::query(
2036 2035
                 'SELECT l.date as date, l.action as action, l.raison as raison, u.login as login
2037
-                FROM ' . prefixTable('log_items') . ' as l
2038
-                LEFT JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id)
2036
+                FROM ' . prefixTable('log_items').' as l
2037
+                LEFT JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id)
2039 2038
                 WHERE l.action <> %s AND id_item=%s',
2040 2039
                 'at_shown',
2041 2040
                 $inputData['itemId']
@@ -2044,14 +2043,14 @@  discard block
 block discarded – undo
2044 2043
                 if ($record['raison'] === NULL) continue;
2045 2044
                 $reason = explode(':', $record['raison']);
2046 2045
                 if (count($reason) > 0) {
2047
-                    $sentence = date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) . ' - '
2048
-                        . $record['login'] . ' - ' . $lang->get($record['action']) . ' - '
2049
-                        . (empty($record['raison']) === false ? (count($reason) > 1 ? $lang->get(trim($reason[0])) . ' : ' . $reason[1]
2046
+                    $sentence = date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']).' - '
2047
+                        . $record['login'].' - '.$lang->get($record['action']).' - '
2048
+                        . (empty($record['raison']) === false ? (count($reason) > 1 ? $lang->get(trim($reason[0])).' : '.$reason[1]
2050 2049
                             : $lang->get(trim($reason[0]))) : '');
2051 2050
                     if (empty($history)) {
2052 2051
                         $history = $sentence;
2053 2052
                     } else {
2054
-                        $history .= '<br />' . $sentence;
2053
+                        $history .= '<br />'.$sentence;
2055 2054
                     }
2056 2055
                 }
2057 2056
             }
@@ -2187,7 +2186,7 @@  discard block
 block discarded – undo
2187 2186
         ) {
2188 2187
             // load the original record into an array
2189 2188
             $originalRecord = DB::queryfirstrow(
2190
-                'SELECT * FROM ' . prefixTable('items') . '
2189
+                'SELECT * FROM '.prefixTable('items').'
2191 2190
                 WHERE id = %i',
2192 2191
                 $inputData['itemId']
2193 2192
             );
@@ -2206,7 +2205,7 @@  discard block
 block discarded – undo
2206 2205
 
2207 2206
             // Load the destination folder record into an array
2208 2207
             $dataDestination = DB::queryfirstrow(
2209
-                'SELECT personal_folder FROM ' . prefixTable('nested_tree') . '
2208
+                'SELECT personal_folder FROM '.prefixTable('nested_tree').'
2210 2209
                 WHERE id = %i',
2211 2210
                 $post_dest_id
2212 2211
             );
@@ -2214,7 +2213,7 @@  discard block
 block discarded – undo
2214 2213
             // Get the ITEM object key for the user
2215 2214
             $userKey = DB::queryFirstRow(
2216 2215
                 'SELECT share_key
2217
-                FROM ' . prefixTable('sharekeys_items') . '
2216
+                FROM ' . prefixTable('sharekeys_items').'
2218 2217
                 WHERE user_id = %i AND object_id = %i',
2219 2218
                 $session->get('user-id'),
2220 2219
                 $inputData['itemId']
@@ -2291,8 +2290,8 @@  discard block
 block discarded – undo
2291 2290
             // Manage Custom Fields
2292 2291
             $rows = DB::query(
2293 2292
                 'SELECT ci.id AS id, ci.data AS data, ci.field_id AS field_id, c.encrypted_data AS encrypted_data
2294
-                FROM ' . prefixTable('categories_items') . ' AS ci
2295
-                INNER JOIN ' . prefixTable('categories') . ' AS c ON (c.id = ci.field_id)
2293
+                FROM ' . prefixTable('categories_items').' AS ci
2294
+                INNER JOIN ' . prefixTable('categories').' AS c ON (c.id = ci.field_id)
2296 2295
                 WHERE ci.item_id = %i',
2297 2296
                 $inputData['itemId']
2298 2297
             );
@@ -2304,7 +2303,7 @@  discard block
 block discarded – undo
2304 2303
                     // Get user key
2305 2304
                     $userKey = DB::queryFirstRow(
2306 2305
                         'SELECT share_key
2307
-                        FROM ' . prefixTable('sharekeys_fields') . '
2306
+                        FROM ' . prefixTable('sharekeys_fields').'
2308 2307
                         WHERE user_id = %i AND object_id = %i',
2309 2308
                         $session->get('user-id'),
2310 2309
                         $field['id']
@@ -2372,15 +2371,15 @@  discard block
 block discarded – undo
2372 2371
             $rows = DB::query(
2373 2372
                 'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status, f.extension AS extension,
2374 2373
                 f.size AS size, f.type AS type, s.share_key AS share_key
2375
-                FROM ' . prefixTable('files') . ' AS f
2376
-                INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id)
2374
+                FROM ' . prefixTable('files').' AS f
2375
+                INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id)
2377 2376
                 WHERE s.user_id = %i AND f.id_item = %i',
2378 2377
                 $session->get('user-id'),
2379 2378
                 $inputData['itemId']
2380 2379
             );
2381 2380
             foreach ($rows as $record) {
2382 2381
                 // Check if file still exists
2383
-                if (file_exists($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . TP_FILE_PREFIX . base64_decode($record['file'])) === true) {
2382
+                if (file_exists($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.TP_FILE_PREFIX.base64_decode($record['file'])) === true) {
2384 2383
                     // Step1 - decrypt the file
2385 2384
                     // deepcode ignore PT: path is sanitized inside decryptFile()
2386 2385
                     $fileContent = decryptFile(
@@ -2391,8 +2390,8 @@  discard block
 block discarded – undo
2391 2390
 
2392 2391
                     // Step2 - create file
2393 2392
                     // deepcode ignore InsecureHash: md5 is used jonly for file name in order to get a hashed value in database
2394
-                    $newFileName = md5(time() . '_' . $record['id']) . '.' . $record['extension'];
2395
-                    $outstream = fopen($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . $newFileName, 'ab');
2393
+                    $newFileName = md5(time().'_'.$record['id']).'.'.$record['extension'];
2394
+                    $outstream = fopen($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.$newFileName, 'ab');
2396 2395
                     if ($outstream === false) {
2397 2396
                         echo prepareExchangedData(
2398 2397
                             array(
@@ -2467,7 +2466,7 @@  discard block
 block discarded – undo
2467 2466
 
2468 2467
             // -------------------------
2469 2468
             // Add specific restrictions
2470
-            $rows = DB::query('SELECT * FROM ' . prefixTable('restriction_to_roles') . ' WHERE item_id = %i', $inputData['itemId']);
2469
+            $rows = DB::query('SELECT * FROM '.prefixTable('restriction_to_roles').' WHERE item_id = %i', $inputData['itemId']);
2471 2470
             foreach ($rows as $record) {
2472 2471
                 DB::insert(
2473 2472
                     prefixTable('restriction_to_roles'),
@@ -2479,7 +2478,7 @@  discard block
 block discarded – undo
2479 2478
             }
2480 2479
 
2481 2480
             // Add Tags
2482
-            $rows = DB::query('SELECT * FROM ' . prefixTable('tags') . ' WHERE item_id = %i', $inputData['itemId']);
2481
+            $rows = DB::query('SELECT * FROM '.prefixTable('tags').' WHERE item_id = %i', $inputData['itemId']);
2483 2482
             foreach ($rows as $record) {
2484 2483
                 DB::insert(
2485 2484
                     prefixTable('tags'),
@@ -2580,7 +2579,7 @@  discard block
 block discarded – undo
2580 2579
         // then we can show it
2581 2580
         $item_deleted = DB::queryFirstRow(
2582 2581
             'SELECT *
2583
-            FROM ' . prefixTable('log_items') . '
2582
+            FROM ' . prefixTable('log_items').'
2584 2583
             WHERE id_item = %i AND action = %s
2585 2584
             ORDER BY date DESC
2586 2585
             LIMIT 0, 1',
@@ -2591,7 +2590,7 @@  discard block
 block discarded – undo
2591 2590
 
2592 2591
         $item_restored = DB::queryFirstRow(
2593 2592
             'SELECT *
2594
-            FROM ' . prefixTable('log_items') . '
2593
+            FROM ' . prefixTable('log_items').'
2595 2594
             WHERE id_item = %i AND action = %s
2596 2595
             ORDER BY date DESC
2597 2596
             LIMIT 0, 1',
@@ -2615,8 +2614,8 @@  discard block
 block discarded – undo
2615 2614
         // Get all informations for this item
2616 2615
         $dataItem = DB::queryfirstrow(
2617 2616
             'SELECT *
2618
-            FROM ' . prefixTable('items') . ' as i
2619
-            INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
2617
+            FROM ' . prefixTable('items').' as i
2618
+            INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
2620 2619
             WHERE i.id = %i AND l.action = %s',
2621 2620
             $inputData['id'],
2622 2621
             'at_creation'
@@ -2625,7 +2624,7 @@  discard block
 block discarded – undo
2625 2624
         // Notification
2626 2625
         DB::queryfirstrow(
2627 2626
             'SELECT *
2628
-            FROM ' . prefixTable('notification') . '
2627
+            FROM ' . prefixTable('notification').'
2629 2628
             WHERE item_id = %i AND user_id = %i',
2630 2629
             $inputData['id'],
2631 2630
             $session->get('user-id')
@@ -2668,7 +2667,7 @@  discard block
 block discarded – undo
2668 2667
 
2669 2668
         // manage case of API user
2670 2669
         if ($dataItem['id_user'] === API_USER_ID) {
2671
-            $arrData['author'] = 'API [' . $dataItem['description'] . ']';
2670
+            $arrData['author'] = 'API ['.$dataItem['description'].']';
2672 2671
             $arrData['id_user'] = API_USER_ID;
2673 2672
             $arrData['author_email'] = '';
2674 2673
             $arrData['notification_status'] = false;
@@ -2678,7 +2677,7 @@  discard block
 block discarded – undo
2678 2677
         $tags = array();
2679 2678
         $rows = DB::query(
2680 2679
             'SELECT tag
2681
-            FROM ' . prefixTable('tags') . '
2680
+            FROM ' . prefixTable('tags').'
2682 2681
             WHERE item_id = %i',
2683 2682
             $inputData['id']
2684 2683
         );
@@ -2703,7 +2702,7 @@  discard block
 block discarded – undo
2703 2702
         // Check if user has a role that is accepted
2704 2703
         $rows_tmp = DB::query(
2705 2704
             'SELECT role_id
2706
-            FROM ' . prefixTable('restriction_to_roles') . '
2705
+            FROM ' . prefixTable('restriction_to_roles').'
2707 2706
             WHERE item_id=%i',
2708 2707
             $inputData['id']
2709 2708
         );
@@ -2717,7 +2716,7 @@  discard block
 block discarded – undo
2717 2716
         // Get the object key for the user
2718 2717
         $userKey = DB::queryFirstRow(
2719 2718
             'SELECT share_key
2720
-            FROM ' . prefixTable('sharekeys_items') . '
2719
+            FROM ' . prefixTable('sharekeys_items').'
2721 2720
             WHERE user_id = %i AND object_id = %i',
2722 2721
             $session->get('user-id'),
2723 2722
             $inputData['id']
@@ -2827,8 +2826,8 @@  discard block
 block discarded – undo
2827 2826
                 // Add restriction if item is restricted to roles
2828 2827
                 $rows = DB::query(
2829 2828
                     'SELECT t.title, t.id
2830
-                    FROM ' . prefixTable('roles_title') . ' AS t
2831
-                    INNER JOIN ' . prefixTable('restriction_to_roles') . ' AS r ON (t.id=r.role_id)
2829
+                    FROM ' . prefixTable('roles_title').' AS t
2830
+                    INNER JOIN ' . prefixTable('restriction_to_roles').' AS r ON (t.id=r.role_id)
2832 2831
                     WHERE r.item_id = %i
2833 2832
                     ORDER BY t.title ASC',
2834 2833
                     $inputData['id']
@@ -2844,8 +2843,8 @@  discard block
 block discarded – undo
2844 2843
                 $tmp = array();
2845 2844
                 $rows = DB::query(
2846 2845
                     'SELECT k.label, k.id
2847
-                    FROM ' . prefixTable('kb_items') . ' as i
2848
-                    INNER JOIN ' . prefixTable('kb') . ' as k ON (i.kb_id=k.id)
2846
+                    FROM ' . prefixTable('kb_items').' as i
2847
+                    INNER JOIN ' . prefixTable('kb').' as k ON (i.kb_id=k.id)
2849 2848
                     WHERE i.item_id = %i
2850 2849
                     ORDER BY k.label ASC',
2851 2850
                     $inputData['id']
@@ -2928,7 +2927,7 @@  discard block
 block discarded – undo
2928 2927
                 $arrCatList = array();
2929 2928
                 $rows_tmp = DB::query(
2930 2929
                     'SELECT id_category
2931
-                    FROM ' . prefixTable('categories_folders') . '
2930
+                    FROM ' . prefixTable('categories_folders').'
2932 2931
                     WHERE id_folder=%i',
2933 2932
                     $inputData['folderId']
2934 2933
                 );
@@ -2943,8 +2942,8 @@  discard block
 block discarded – undo
2943 2942
                         'SELECT i.id AS id, i.field_id AS field_id, i.data AS data, i.item_id AS item_id,
2944 2943
                         i.encryption_type AS encryption_type, c.encrypted_data AS encrypted_data, c.parent_id AS parent_id,
2945 2944
                         c.type as field_type, c.masked AS field_masked, c.role_visibility AS role_visibility
2946
-                        FROM ' . prefixTable('categories_items') . ' AS i
2947
-                        INNER JOIN ' . prefixTable('categories') . ' AS c ON (i.field_id=c.id)
2945
+                        FROM ' . prefixTable('categories_items').' AS i
2946
+                        INNER JOIN ' . prefixTable('categories').' AS c ON (i.field_id=c.id)
2948 2947
                         WHERE i.item_id=%i AND c.parent_id IN %ls',
2949 2948
                         $inputData['id'],
2950 2949
                         $arrCatList
@@ -2955,7 +2954,7 @@  discard block
 block discarded – undo
2955 2954
                         //db::debugmode(true);
2956 2955
                         $userKey = DB::queryFirstRow(
2957 2956
                             'SELECT share_key
2958
-                            FROM ' . prefixTable('sharekeys_fields') . '
2957
+                            FROM ' . prefixTable('sharekeys_fields').'
2959 2958
                             WHERE user_id = %i AND object_id = %i',
2960 2959
                             $session->get('user-id'),
2961 2960
                             $row['id']
@@ -2973,7 +2972,7 @@  discard block
 block discarded – undo
2973 2972
                         } else if (DB::count() === 0 && (int) $row['encrypted_data'] === 0) {
2974 2973
                             // Data is not encrypted in DB
2975 2974
                             $fieldText = [
2976
-                                'string' => $row['data'],//#3945 - isBase64($row['data']) === true ? base64_decode($row['data']) : 
2975
+                                'string' => $row['data'], //#3945 - isBase64($row['data']) === true ? base64_decode($row['data']) : 
2977 2976
                                 'encrypted' => false,
2978 2977
                                 'error' => false,
2979 2978
                             ];
@@ -3018,7 +3017,7 @@  discard block
 block discarded – undo
3018 3017
             if (isset($SETTINGS['item_creation_templates']) && (int) $SETTINGS['item_creation_templates'] === 1) {
3019 3018
                 $rows_tmp = DB::queryfirstrow(
3020 3019
                     'SELECT category_id
3021
-                    FROM ' . prefixTable('templates') . '
3020
+                    FROM ' . prefixTable('templates').'
3022 3021
                     WHERE item_id = %i',
3023 3022
                     $inputData['id']
3024 3023
                 );
@@ -3035,7 +3034,7 @@  discard block
 block discarded – undo
3035 3034
             // Evaluate if item is ready for all users
3036 3035
             $rows_tmp = DB::queryfirstrow(
3037 3036
                 'SELECT finished_at
3038
-                FROM ' . prefixTable('background_tasks') . '
3037
+                FROM ' . prefixTable('background_tasks').'
3039 3038
                 WHERE item_id = %i',
3040 3039
                 $inputData['id']
3041 3040
             );
@@ -3052,7 +3051,7 @@  discard block
 block discarded – undo
3052 3051
                 // Is the Item to be deleted?
3053 3052
                 $dataDelete = DB::queryfirstrow(
3054 3053
                     'SELECT * 
3055
-                    FROM ' . prefixTable('automatic_del') . '
3054
+                    FROM ' . prefixTable('automatic_del').'
3056 3055
                     WHERE item_id = %i',
3057 3056
                     $inputData['id']
3058 3057
                 );
@@ -3131,11 +3130,11 @@  discard block
 block discarded – undo
3131 3130
             if (empty($dataItem['restricted_to']) === false) {
3132 3131
                 foreach (explode(';', $dataItem['restricted_to']) as $userRest) {
3133 3132
                     if (empty($userRest) === false) {
3134
-                        $dataTmp = DB::queryfirstrow('SELECT login FROM ' . prefixTable('users') . ' WHERE id= ' . $userRest);
3133
+                        $dataTmp = DB::queryfirstrow('SELECT login FROM '.prefixTable('users').' WHERE id= '.$userRest);
3135 3134
                         if (empty($listOfRestricted)) {
3136 3135
                             $listOfRestricted = $dataTmp['login'];
3137 3136
                         } else {
3138
-                            $listOfRestricted .= ';' . $dataTmp['login'];
3137
+                            $listOfRestricted .= ';'.$dataTmp['login'];
3139 3138
                         }
3140 3139
                     }
3141 3140
                 }
@@ -3209,9 +3208,9 @@  discard block
 block discarded – undo
3209 3208
         // Load item data
3210 3209
         $dataItem = DB::queryFirstRow(
3211 3210
             'SELECT i.*, n.title AS folder_title, o.enabled AS otp_for_item_enabled, o.phone_number AS otp_phone_number, o.secret AS otp_secret
3212
-            FROM ' . prefixTable('items') . ' AS i
3213
-            INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (i.id_tree = n.id)
3214
-            INNER JOIN ' . prefixTable('items_otp') . ' AS o ON (o.item_id = i.id)
3211
+            FROM ' . prefixTable('items').' AS i
3212
+            INNER JOIN ' . prefixTable('nested_tree').' AS n ON (i.id_tree = n.id)
3213
+            INNER JOIN ' . prefixTable('items_otp').' AS o ON (o.item_id = i.id)
3215 3214
             WHERE i.id = %i',
3216 3215
             $inputData['id']
3217 3216
         );
@@ -3233,7 +3232,7 @@  discard block
 block discarded – undo
3233 3232
         // Check if user has a role that is accepted
3234 3233
         $rows_tmp = DB::query(
3235 3234
             'SELECT role_id
3236
-            FROM ' . prefixTable('restriction_to_roles') . '
3235
+            FROM ' . prefixTable('restriction_to_roles').'
3237 3236
             WHERE item_id=%i',
3238 3237
             $inputData['id']
3239 3238
         );
@@ -3265,12 +3264,12 @@  discard block
 block discarded – undo
3265 3264
             // launch query
3266 3265
             $rows = DB::query(
3267 3266
                 'SELECT id, name, file, extension, size
3268
-                FROM ' . prefixTable('files') . '
3267
+                FROM ' . prefixTable('files').'
3269 3268
                 WHERE id_item = %i AND confirmed = 1',
3270 3269
                 $inputData['id']
3271 3270
             );
3272 3271
             foreach ($rows as $record) {
3273
-                $filename = basename($record['name'], '.' . $record['extension']);
3272
+                $filename = basename($record['name'], '.'.$record['extension']);
3274 3273
                 $filename = isBase64($filename) === true ? base64_decode($filename) : $filename;
3275 3274
 
3276 3275
                 array_push(
@@ -3283,7 +3282,7 @@  discard block
 block discarded – undo
3283 3282
                         'is_image' => in_array(strtolower($record['extension']), TP_IMAGE_FILE_EXT) === true ? 1 : 0,
3284 3283
                         'id' => $record['id'],
3285 3284
                         'key' => $session->get('user-key_tmp'),
3286
-                        'internalFilename' => basename($record['name'], '.' . $record['extension']),
3285
+                        'internalFilename' => basename($record['name'], '.'.$record['extension']),
3287 3286
                     )
3288 3287
                 );
3289 3288
             }
@@ -3321,7 +3320,7 @@  discard block
 block discarded – undo
3321 3320
                     array(
3322 3321
                         'latest_items' => implode(';', $session->get('user-latest_items')),
3323 3322
                     ),
3324
-                    'id=' . $session->get('user-id')
3323
+                    'id='.$session->get('user-id')
3325 3324
                 );
3326 3325
             }
3327 3326
 
@@ -3330,8 +3329,8 @@  discard block
 block discarded – undo
3330 3329
             $listOptionsForRoles = array();
3331 3330
             $rows = DB::query(
3332 3331
                 'SELECT r.role_id AS role_id, t.title AS title
3333
-                FROM ' . prefixTable('roles_values') . ' AS r
3334
-                INNER JOIN ' . prefixTable('roles_title') . ' AS t ON (r.role_id = t.id)
3332
+                FROM ' . prefixTable('roles_values').' AS r
3333
+                INNER JOIN ' . prefixTable('roles_title').' AS t ON (r.role_id = t.id)
3335 3334
                 WHERE r.folder_id = %i',
3336 3335
                 $dataItem['id_tree']
3337 3336
             );
@@ -3345,9 +3344,9 @@  discard block
 block discarded – undo
3345 3344
                 );
3346 3345
                 $rows2 = DB::query(
3347 3346
                     'SELECT id, login, fonction_id, email, name, lastname
3348
-                    FROM ' . prefixTable('users') . '
3347
+                    FROM ' . prefixTable('users').'
3349 3348
                     WHERE fonction_id LIKE %s',
3350
-                    '%' . $record['role_id'] . '%'
3349
+                    '%'.$record['role_id'].'%'
3351 3350
                 );
3352 3351
                 foreach ($rows2 as $record2) {
3353 3352
                     foreach (explode(';', $record2['fonction_id']) as $role) {
@@ -3360,7 +3359,7 @@  discard block
 block discarded – undo
3360 3359
                                 array(
3361 3360
                                     'id' => (int) $record2['id'],
3362 3361
                                     'login' => $record2['login'],
3363
-                                    'name' => $record2['name'] . ' ' . $record2['lastname'],
3362
+                                    'name' => $record2['name'].' '.$record2['lastname'],
3364 3363
                                     'email' => $record2['email'],
3365 3364
                                 )
3366 3365
                             );
@@ -3379,16 +3378,16 @@  discard block
 block discarded – undo
3379 3378
                 $path = '';
3380 3379
                 foreach ($arbo as $elem) {
3381 3380
                     if (empty($path) === true) {
3382
-                        $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' ';
3381
+                        $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' ';
3383 3382
                     } else {
3384
-                        $path .= '&#8594; ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
3383
+                        $path .= '&#8594; '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
3385 3384
                     }
3386 3385
                 }
3387 3386
                 // Build text to show user
3388 3387
                 if (empty($path) === true) {
3389 3388
                     $path = addslashes($dataItem['label']);
3390 3389
                 } else {
3391
-                    $path = addslashes($dataItem['label']) . ' (' . $path . ')';
3390
+                    $path = addslashes($dataItem['label']).' ('.$path.')';
3392 3391
                 }
3393 3392
 
3394 3393
                 // Add Admins to notification list if expected
@@ -3411,7 +3410,7 @@  discard block
 block discarded – undo
3411 3410
                         array(
3412 3411
                             addslashes($session->get('user-login')),
3413 3412
                             $path,
3414
-                            $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $dataItem['id'],
3413
+                            $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$dataItem['id'],
3415 3414
                         ),
3416 3415
                         $lang->get('email_on_open_notification_mail')
3417 3416
                     ),
@@ -3421,7 +3420,7 @@  discard block
 block discarded – undo
3421 3420
             }
3422 3421
 
3423 3422
             // has this item a change proposal
3424
-            DB::query('SELECT * FROM ' . prefixTable('items_change') . ' WHERE item_id = %i', $inputData['id']);
3423
+            DB::query('SELECT * FROM '.prefixTable('items_change').' WHERE item_id = %i', $inputData['id']);
3425 3424
             $returnArray['has_change_proposal'] = DB::count();
3426 3425
 
3427 3426
             // Setting
@@ -3432,7 +3431,7 @@  discard block
 block discarded – undo
3432 3431
             if (isset($SETTINGS['otv_is_enabled']) === true && (int) $SETTINGS['otv_is_enabled'] === 1) {
3433 3432
                 DB::query(
3434 3433
                     'SELECT *
3435
-                    FROM ' . prefixTable('otv') . '
3434
+                    FROM ' . prefixTable('otv').'
3436 3435
                     WHERE item_id = %i
3437 3436
                     AND time_limit > %i',
3438 3437
                     $inputData['id'],
@@ -3532,7 +3531,7 @@  discard block
 block discarded – undo
3532 3531
         // Load item data
3533 3532
         $data = DB::queryFirstRow(
3534 3533
             'SELECT id_tree, id, label
3535
-            FROM ' . prefixTable('items') . '
3534
+            FROM ' . prefixTable('items').'
3536 3535
             WHERE id = %i OR item_key = %s',
3537 3536
             $inputData['itemId'],
3538 3537
             $inputData['itemKey']
@@ -3623,7 +3622,7 @@  discard block
 block discarded – undo
3623 3622
         // Load item data
3624 3623
         $dataItem = DB::queryFirstRow(
3625 3624
             'SELECT secret, enabled
3626
-            FROM ' . prefixTable('items_otp') . '
3625
+            FROM ' . prefixTable('items_otp').'
3627 3626
             WHERE item_id = %i',
3628 3627
             $inputData['id']
3629 3628
         );
@@ -3705,13 +3704,13 @@  discard block
 block discarded – undo
3705 3704
 
3706 3705
         // Check if user is allowed to access this folder
3707 3706
         if (!in_array($inputData['folderId'], $session->get('user-accessible_folders'))) {
3708
-            echo '[{"error" : "' . $lang->get('error_not_allowed_to') . '"}]';
3707
+            echo '[{"error" : "'.$lang->get('error_not_allowed_to').'"}]';
3709 3708
             break;
3710 3709
         }
3711 3710
 
3712 3711
         // Check if title doesn't contains html codes
3713 3712
         if (preg_match_all('|<[^>]+>(.*)</[^>]+>|U', $title, $out)) {
3714
-            echo '[ { "error" : "' . $lang->get('error_html_codes') . '" } ]';
3713
+            echo '[ { "error" : "'.$lang->get('error_html_codes').'" } ]';
3715 3714
             break;
3716 3715
         }
3717 3716
         // check that title is not numeric
@@ -3722,9 +3721,9 @@  discard block
 block discarded – undo
3722 3721
 
3723 3722
         // Check if duplicate folders name are allowed
3724 3723
         if (isset($SETTINGS['duplicate_folder']) && $SETTINGS['duplicate_folder'] === '0') {
3725
-            $data = DB::queryFirstRow('SELECT id, title FROM ' . prefixTable('nested_tree') . ' WHERE title = %s', $title);
3724
+            $data = DB::queryFirstRow('SELECT id, title FROM '.prefixTable('nested_tree').' WHERE title = %s', $title);
3726 3725
             if (empty($data['id']) === false && $dataReceived['folder'] !== $data['id']) {
3727
-                echo '[ { "error" : "' . $lang->get('error_group_exist') . '" } ]';
3726
+                echo '[ { "error" : "'.$lang->get('error_group_exist').'" } ]';
3728 3727
                 break;
3729 3728
             }
3730 3729
         }
@@ -3732,7 +3731,7 @@  discard block
 block discarded – undo
3732 3731
         // query on folder
3733 3732
         $data = DB::queryfirstrow(
3734 3733
             'SELECT parent_id, personal_folder
3735
-            FROM ' . prefixTable('nested_tree') . '
3734
+            FROM ' . prefixTable('nested_tree').'
3736 3735
             WHERE id = %i',
3737 3736
             $inputData['folderId']
3738 3737
         );
@@ -3742,20 +3741,20 @@  discard block
 block discarded – undo
3742 3741
         if ($session->get('user-admin') !== 1 && $session->get('user-manager') !== 1 && $data['personal_folder'] === '0') {
3743 3742
             $data = DB::queryfirstrow(
3744 3743
                 'SELECT valeur
3745
-                FROM ' . prefixTable('misc') . '
3744
+                FROM ' . prefixTable('misc').'
3746 3745
                 WHERE intitule = %i AND type = %s',
3747 3746
                 $data['parent_id'],
3748 3747
                 'complex'
3749 3748
             );
3750 3749
             if (intval($dataReceived['complexity']) < intval($data['valeur'])) {
3751
-                echo '[ { "error" : "' . $lang->get('error_folder_complexity_lower_than_top_folder') . ' [<b>' . TP_PW_COMPLEXITY[$data['valeur']][1] . '</b>]"} ]';
3750
+                echo '[ { "error" : "'.$lang->get('error_folder_complexity_lower_than_top_folder').' [<b>'.TP_PW_COMPLEXITY[$data['valeur']][1].'</b>]"} ]';
3752 3751
                 break;
3753 3752
             }
3754 3753
         }
3755 3754
 
3756 3755
         // update Folders table
3757 3756
         $tmp = DB::queryFirstRow(
3758
-            'SELECT title, parent_id, personal_folder FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
3757
+            'SELECT title, parent_id, personal_folder FROM '.prefixTable('nested_tree').' WHERE id = %i',
3759 3758
             $dataReceived['folder']
3760 3759
         );
3761 3760
         if ($tmp['parent_id'] !== 0 || $tmp['title'] !== $session->get('user-id') || $tmp['personal_folder'] !== 1) {
@@ -3824,42 +3823,42 @@  discard block
 block discarded – undo
3824 3823
                 in_array($post_target_folder_id, $session->get('user-accessible_folders')) === false) && ($post_target_folder_id === '0' &&
3825 3824
                 isset($SETTINGS['can_create_root_folder']) === true && (int) $SETTINGS['can_create_root_folder'] === 1)
3826 3825
         ) {
3827
-            $returnValues = '[{"error" : "' . $lang->get('error_not_allowed_to') . '"}]';
3826
+            $returnValues = '[{"error" : "'.$lang->get('error_not_allowed_to').'"}]';
3828 3827
             echo $returnValues;
3829 3828
             break;
3830 3829
         }
3831 3830
 
3832 3831
         $tmp_source = DB::queryFirstRow(
3833 3832
             'SELECT title, parent_id, personal_folder
3834
-            FROM ' . prefixTable('nested_tree') . '
3833
+            FROM ' . prefixTable('nested_tree').'
3835 3834
             WHERE id = %i',
3836 3835
             $post_source_folder_id
3837 3836
         );
3838 3837
 
3839 3838
         $tmp_target = DB::queryFirstRow(
3840 3839
             'SELECT title, parent_id, personal_folder
3841
-            FROM ' . prefixTable('nested_tree') . '
3840
+            FROM ' . prefixTable('nested_tree').'
3842 3841
             WHERE id = %i',
3843 3842
             $post_target_folder_id
3844 3843
         );
3845 3844
 
3846 3845
         // check if target is not a child of source
3847 3846
         if ($tree->isChildOf($post_target_folder_id, $post_source_folder_id) === true) {
3848
-            $returnValues = '[{"error" : "' . $lang->get('error_not_allowed_to') . '"}]';
3847
+            $returnValues = '[{"error" : "'.$lang->get('error_not_allowed_to').'"}]';
3849 3848
             echo $returnValues;
3850 3849
             break;
3851 3850
         }
3852 3851
 
3853 3852
         // check if source or target folder is PF. If Yes, then cancel operation
3854 3853
         if ((int) $tmp_source['personal_folder'] === 1 || (int) $tmp_target['personal_folder'] === 1) {
3855
-            $returnValues = '[{"error" : "' . $lang->get('error_not_allowed_to') . '"}]';
3854
+            $returnValues = '[{"error" : "'.$lang->get('error_not_allowed_to').'"}]';
3856 3855
             echo $returnValues;
3857 3856
             break;
3858 3857
         }
3859 3858
 
3860 3859
         // check if source or target folder is PF. If Yes, then cancel operation
3861 3860
         if ($tmp_source['title'] === $session->get('user-id') || $tmp_target['title'] === $session->get('user-id')) {
3862
-            $returnValues = '[{"error" : "' . $lang->get('error_not_allowed_to') . '"}]';
3861
+            $returnValues = '[{"error" : "'.$lang->get('error_not_allowed_to').'"}]';
3863 3862
             echo $returnValues;
3864 3863
             break;
3865 3864
         }
@@ -3980,7 +3979,7 @@  discard block
 block discarded – undo
3980 3979
             $uniqueLoadData['path'] = $arr_arbo;
3981 3980
 
3982 3981
             // store last folder accessed in cookie
3983
-            $arr_cookie_options = array (
3982
+            $arr_cookie_options = array(
3984 3983
                 'expires' => time() + TP_ONE_DAY_SECONDS * 5,
3985 3984
                 'path' => '/', 
3986 3985
                 'secure' => true,
@@ -3995,7 +3994,7 @@  discard block
 block discarded – undo
3995 3994
             foreach ($session->get('user-roles_array') as $role) {
3996 3995
                 $roleQ = DB::queryfirstrow(
3997 3996
                     'SELECT allow_pw_change
3998
-                    FROM ' . prefixTable('roles_title') . '
3997
+                    FROM ' . prefixTable('roles_title').'
3999 3998
                     WHERE id = %i',
4000 3999
                     $role
4001 4000
                 );
@@ -4026,11 +4025,11 @@  discard block
 block discarded – undo
4026 4025
                 
4027 4026
                 foreach ($session->get('user-roles_array') as $role) {
4028 4027
                     $access = DB::queryFirstRow(
4029
-                        'SELECT type FROM ' . prefixTable('roles_values') . ' WHERE role_id = %i AND folder_id = %i',
4028
+                        'SELECT type FROM '.prefixTable('roles_values').' WHERE role_id = %i AND folder_id = %i',
4030 4029
                         $role,
4031 4030
                         $inputData['id']
4032 4031
                     );
4033
-                    if (DB::count()>0) {
4032
+                    if (DB::count() > 0) {
4034 4033
                         if ($access['type'] === 'R') {
4035 4034
                             array_push($arrTmp, 10);
4036 4035
                         } elseif ($access['type'] === 'W') {
@@ -4088,7 +4087,7 @@  discard block
 block discarded – undo
4088 4087
             } else {
4089 4088
                 DB::query(
4090 4089
                     'SELECT *
4091
-                    FROM ' . prefixTable('items') . '
4090
+                    FROM ' . prefixTable('items').'
4092 4091
                     WHERE inactif = %i',
4093 4092
                     0
4094 4093
                 );
@@ -4098,7 +4097,7 @@  discard block
 block discarded – undo
4098 4097
 
4099 4098
             // Get folder complexity
4100 4099
             $folderComplexity = DB::queryFirstRow(
4101
-                'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %i',
4100
+                'SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %i',
4102 4101
                 'complex',
4103 4102
                 $inputData['id']
4104 4103
             );
@@ -4110,7 +4109,7 @@  discard block
 block discarded – undo
4110 4109
             if (isset($SETTINGS['item_extra_fields']) && (int) $SETTINGS['item_extra_fields'] === 1) {
4111 4110
                 $folderRow = DB::query(
4112 4111
                     'SELECT id_category
4113
-                    FROM ' . prefixTable('categories_folders') . '
4112
+                    FROM ' . prefixTable('categories_folders').'
4114 4113
                     WHERE id_folder = %i',
4115 4114
                     $inputData['id']
4116 4115
                 );
@@ -4225,13 +4224,13 @@  discard block
 block discarded – undo
4225 4224
             // List all ITEMS
4226 4225
             if ($folderIsPf === false) {
4227 4226
                 $where->add('i.inactif=%i', 0);
4228
-                $where->add('l.date=%l', '(SELECT date FROM ' . prefixTable('log_items') . " WHERE action IN ('at_creation', 'at_modification') AND id_item=i.id ORDER BY date DESC LIMIT 1)");
4227
+                $where->add('l.date=%l', '(SELECT date FROM '.prefixTable('log_items')." WHERE action IN ('at_creation', 'at_modification') AND id_item=i.id ORDER BY date DESC LIMIT 1)");
4229 4228
                 if (empty($limited_to_items) === false) {
4230 4229
                     $where->add('i.id IN %ls', explode(',', $limited_to_items));
4231 4230
                 }
4232 4231
 
4233
-                $query_limit = ' LIMIT ' .
4234
-                    $start . ',' .
4232
+                $query_limit = ' LIMIT '.
4233
+                    $start.','.
4235 4234
                     $post_nb_items_to_display_once;
4236 4235
                 //db::debugmode(true);
4237 4236
                 $rows = DB::query(
@@ -4243,9 +4242,9 @@  discard block
 block discarded – undo
4243 4242
                     l.id_user AS log_user,
4244 4243
                     i.url AS link,
4245 4244
                     i.email AS email
4246
-                    FROM ' . prefixTable('items') . ' AS i
4247
-                    INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (i.id_tree = n.id)
4248
-                    INNER JOIN ' . prefixTable('log_items') . ' AS l ON (i.id = l.id_item)
4245
+                    FROM ' . prefixTable('items').' AS i
4246
+                    INNER JOIN ' . prefixTable('nested_tree').' AS n ON (i.id_tree = n.id)
4247
+                    INNER JOIN ' . prefixTable('log_items').' AS l ON (i.id = l.id_item)
4249 4248
                     WHERE %l
4250 4249
                     GROUP BY i.id, l.date, l.id_user, l.action
4251 4250
                     ORDER BY i.label ASC, l.date DESC' . $query_limit,
@@ -4265,9 +4264,9 @@  discard block
 block discarded – undo
4265 4264
                     l.id_user AS log_user,
4266 4265
                     i.url AS link,
4267 4266
                     i.email AS email
4268
-                    FROM ' . prefixTable('items') . ' AS i
4269
-                    INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (i.id_tree = n.id)
4270
-                    INNER JOIN ' . prefixTable('log_items') . ' AS l ON (i.id = l.id_item)
4267
+                    FROM ' . prefixTable('items').' AS i
4268
+                    INNER JOIN ' . prefixTable('nested_tree').' AS n ON (i.id_tree = n.id)
4269
+                    INNER JOIN ' . prefixTable('log_items').' AS l ON (i.id = l.id_item)
4271 4270
                     WHERE %l
4272 4271
                     GROUP BY i.id, l.date, l.id_user, l.action
4273 4272
                     ORDER BY i.label ASC, l.date DESC',
@@ -4298,7 +4297,7 @@  discard block
 block discarded – undo
4298 4297
                     $item_is_restricted_to_role = false;
4299 4298
                     DB::queryfirstrow(
4300 4299
                         'SELECT role_id
4301
-                        FROM ' . prefixTable('restriction_to_roles') . '
4300
+                        FROM ' . prefixTable('restriction_to_roles').'
4302 4301
                         WHERE item_id = %i',
4303 4302
                         $record['id']
4304 4303
                     );
@@ -4310,7 +4309,7 @@  discard block
 block discarded – undo
4310 4309
                     $user_is_included_in_role = false;
4311 4310
                     DB::query(
4312 4311
                         'SELECT role_id
4313
-                        FROM ' . prefixTable('restriction_to_roles') . '
4312
+                        FROM ' . prefixTable('restriction_to_roles').'
4314 4313
                         WHERE item_id = %i AND role_id IN %ls',
4315 4314
                         $record['id'],
4316 4315
                         $session->get('user-roles_array')
@@ -4517,9 +4516,9 @@  discard block
 block discarded – undo
4517 4516
         if ((int) $start === 0) {
4518 4517
             DB::query(
4519 4518
                 'SELECT i.id
4520
-                FROM ' . prefixTable('items') . ' as i
4521
-                INNER JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree = n.id)
4522
-                INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id = l.id_item)
4519
+                FROM ' . prefixTable('items').' as i
4520
+                INNER JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree = n.id)
4521
+                INNER JOIN ' . prefixTable('log_items').' as l ON (i.id = l.id_item)
4523 4522
                 WHERE %l
4524 4523
                 ORDER BY i.label ASC, l.date DESC',
4525 4524
                 $where
@@ -4583,8 +4582,8 @@  discard block
 block discarded – undo
4583 4582
         // Run query
4584 4583
         $dataItem = DB::queryfirstrow(
4585 4584
             'SELECT i.pw AS pw, s.share_key AS share_key
4586
-            FROM ' . prefixTable('items') . ' AS i
4587
-            INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (s.object_id = i.id)
4585
+            FROM ' . prefixTable('items').' AS i
4586
+            INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (s.object_id = i.id)
4588 4587
             WHERE user_id = %i AND i.item_key = %s',
4589 4588
             $session->get('user-id'),
4590 4589
             $inputData['itemKey']
@@ -4635,7 +4634,7 @@  discard block
 block discarded – undo
4635 4634
             // get if existing edition lock
4636 4635
             $dataItemEditionLocks = DB::query(
4637 4636
                 'SELECT timestamp, user_id
4638
-                FROM ' . prefixTable('items_edition') . '
4637
+                FROM ' . prefixTable('items_edition').'
4639 4638
                 WHERE item_id = %i 
4640 4639
                 ORDER BY increment_id DESC',
4641 4640
                 $inputData['itemId']
@@ -4644,7 +4643,7 @@  discard block
 block discarded – undo
4644 4643
             if (WIP === true) error_log('Existing edition locks: '.DB::count());
4645 4644
 
4646 4645
             // Check if item has no edition lock
4647
-            if ((int) DB::count() > 0 ) {
4646
+            if ((int) DB::count() > 0) {
4648 4647
                 // get last edition lock
4649 4648
                 $dataLastItemEditionLock = $dataItemEditionLocks[0];
4650 4649
 
@@ -4654,10 +4653,10 @@  discard block
 block discarded – undo
4654 4653
                 } else {
4655 4654
                     $delay = EDITION_LOCK_PERIOD; // One day delay
4656 4655
                 }
4657
-                if (WIP === true) error_log('delay: ' . $delay);
4656
+                if (WIP === true) error_log('delay: '.$delay);
4658 4657
 
4659 4658
                 // We remove old edition locks if delay is expired meaning more than 1 day long
4660
-                if (round(abs(time() - $dataTmp['timestamp']),0) > $delay) {
4659
+                if (round(abs(time() - $dataTmp['timestamp']), 0) > $delay) {
4661 4660
                     // Case where time is expired
4662 4661
                     // In this case, delete edition lock and possible ongoing processes
4663 4662
                     // and continue editing this time
@@ -4674,7 +4673,7 @@  discard block
 block discarded – undo
4674 4673
                         // Get process Id
4675 4674
                         $processDetail = DB::queryFirstRow(
4676 4675
                             'SELECT increment_id
4677
-                            FROM ' . prefixTable('background_tasks') . '
4676
+                            FROM ' . prefixTable('background_tasks').'
4678 4677
                             WHERE item_id = %i AND finished_at = ""',
4679 4678
                             $inputData['itemId']
4680 4679
                         );
@@ -4692,7 +4691,7 @@  discard block
 block discarded – undo
4692 4691
                     // get if existing process ongoing for this item
4693 4692
                     $dataItemProcessOngoing = DB::queryFirstRow(
4694 4693
                         'SELECT JSON_EXTRACT(arguments, "$.all_users_except_id") AS all_users_except_id
4695
-                        FROM ' . prefixTable('background_tasks') . '
4694
+                        FROM ' . prefixTable('background_tasks').'
4696 4695
                         WHERE item_id = %i AND finished_at = ""
4697 4696
                         ORDER BY increment_id DESC',
4698 4697
                         $inputData['itemId']
@@ -4719,7 +4718,7 @@  discard block
 block discarded – undo
4719 4718
                         );
4720 4719
                         break;
4721 4720
                     }
4722
-                } elseif (round(abs(time() - $dataTmp['timestamp']),0) <= $delay) {
4721
+                } elseif (round(abs(time() - $dataTmp['timestamp']), 0) <= $delay) {
4723 4722
                     // Case where edition lock is already taken by another user
4724 4723
                     // Then no edition is possible
4725 4724
                     $returnValues = array(
@@ -4748,7 +4747,7 @@  discard block
 block discarded – undo
4748 4747
         // do query on this folder
4749 4748
         $data_this_folder = DB::queryFirstRow(
4750 4749
             'SELECT id, personal_folder, title
4751
-            FROM ' . prefixTable('nested_tree') . '
4750
+            FROM ' . prefixTable('nested_tree').'
4752 4751
             WHERE id = %s',
4753 4752
             $inputData['folderId']
4754 4753
         );
@@ -4788,8 +4787,8 @@  discard block
 block discarded – undo
4788 4787
         $visibilite = '';
4789 4788
         $data = DB::queryFirstRow(
4790 4789
             'SELECT m.valeur, n.personal_folder
4791
-            FROM ' . prefixTable('misc') . ' AS m
4792
-            INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (m.intitule = n.id)
4790
+            FROM ' . prefixTable('misc').' AS m
4791
+            INNER JOIN ' . prefixTable('nested_tree').' AS n ON (m.intitule = n.id)
4793 4792
             WHERE type=%s AND intitule = %s',
4794 4793
             'complex',
4795 4794
             $inputData['folderId']
@@ -4802,8 +4801,8 @@  discard block
 block discarded – undo
4802 4801
             // Prepare Item actual visibility (what Users/Roles can see it)
4803 4802
             $rows = DB::query(
4804 4803
                 'SELECT t.title
4805
-                FROM ' . prefixTable('roles_values') . ' as v
4806
-                INNER JOIN ' . prefixTable('roles_title') . ' as t ON (v.role_id = t.id)
4804
+                FROM ' . prefixTable('roles_values').' as v
4805
+                INNER JOIN ' . prefixTable('roles_title').' as t ON (v.role_id = t.id)
4807 4806
                 WHERE v.folder_id = %i
4808 4807
                 GROUP BY title',
4809 4808
                 $inputData['folderId']
@@ -4812,7 +4811,7 @@  discard block
 block discarded – undo
4812 4811
                 if (empty($visibilite)) {
4813 4812
                     $visibilite = $record['title'];
4814 4813
                 } else {
4815
-                    $visibilite .= ' - ' . $record['title'];
4814
+                    $visibilite .= ' - '.$record['title'];
4816 4815
                 }
4817 4816
             }
4818 4817
         } else {
@@ -4822,14 +4821,14 @@  discard block
 block discarded – undo
4822 4821
             // do new query to know if current folder is pf
4823 4822
             $data_pf = DB::queryFirstRow(
4824 4823
                 'SELECT personal_folder
4825
-                FROM ' . prefixTable('nested_tree') . '
4824
+                FROM ' . prefixTable('nested_tree').'
4826 4825
                 WHERE id = %s',
4827 4826
                 $inputData['folderId']
4828 4827
             );
4829 4828
             
4830 4829
             $folder_is_personal = $data_pf !== null ? (int) $data_pf['personal_folder'] : 0;
4831 4830
             
4832
-            $visibilite = $session->get('user-name') . ' ' . $session->get('user-lastname') . ' (' . $session->get('user-login') . ')';
4831
+            $visibilite = $session->get('user-name').' '.$session->get('user-lastname').' ('.$session->get('user-login').')';
4833 4832
         }
4834 4833
 
4835 4834
         recupDroitCreationSansComplexite($inputData['folderId']);
@@ -4839,8 +4838,8 @@  discard block
 block discarded – undo
4839 4838
         $listOptionsForRoles = array();
4840 4839
         $rows = DB::query(
4841 4840
             'SELECT r.role_id AS role_id, t.title AS title
4842
-            FROM ' . prefixTable('roles_values') . ' AS r
4843
-            INNER JOIN ' . prefixTable('roles_title') . ' AS t ON (r.role_id = t.id)
4841
+            FROM ' . prefixTable('roles_values').' AS r
4842
+            INNER JOIN ' . prefixTable('roles_title').' AS t ON (r.role_id = t.id)
4844 4843
             WHERE r.folder_id = %i',
4845 4844
             $inputData['folderId']
4846 4845
         );
@@ -4854,7 +4853,7 @@  discard block
 block discarded – undo
4854 4853
             );
4855 4854
             $rows2 = DB::query(
4856 4855
                 'SELECT id, login, fonction_id, email, name, lastname
4857
-                FROM ' . prefixTable('users') . '
4856
+                FROM ' . prefixTable('users').'
4858 4857
                 WHERE admin = 0 AND fonction_id is not null'
4859 4858
             );
4860 4859
             foreach ($rows2 as $record2) {
@@ -4868,7 +4867,7 @@  discard block
 block discarded – undo
4868 4867
                             array(
4869 4868
                                 'id' => $record2['id'],
4870 4869
                                 'login' => $record2['login'],
4871
-                                'name' => $record2['name'] . ' ' . $record2['lastname'],
4870
+                                'name' => $record2['name'].' '.$record2['lastname'],
4872 4871
                                 'email' => $record2['email'],
4873 4872
                             )
4874 4873
                         );
@@ -4885,13 +4884,13 @@  discard block
 block discarded – undo
4885 4884
                 //db::debugmode(true);
4886 4885
                 $access = DB::queryFirstRow(
4887 4886
                     'SELECT type
4888
-                    FROM ' . prefixTable('roles_values') . '
4887
+                    FROM ' . prefixTable('roles_values').'
4889 4888
                     WHERE role_id = %i AND folder_id = %i',
4890 4889
                     $role,
4891 4890
                     $inputData['folderId']
4892 4891
                 );
4893 4892
                 //db::debugmode(false);
4894
-                if (DB::count()>0) {
4893
+                if (DB::count() > 0) {
4895 4894
                     if ($access['type'] === 'R') {
4896 4895
                         array_push($arrTmp, 10);
4897 4896
                     } elseif ($access['type'] === 'W') {
@@ -4996,7 +4995,7 @@  discard block
 block discarded – undo
4996 4995
         // Get some info before deleting
4997 4996
         $data = DB::queryFirstRow(
4998 4997
             'SELECT name, id_item, file
4999
-            FROM ' . prefixTable('files') . '
4998
+            FROM ' . prefixTable('files').'
5000 4999
             WHERE id = %i',
5001 5000
             $fileId
5002 5001
         );
@@ -5004,7 +5003,7 @@  discard block
 block discarded – undo
5004 5003
         // Load item data
5005 5004
         $data_item = DB::queryFirstRow(
5006 5005
             'SELECT id_tree
5007
-            FROM ' . prefixTable('items') . '
5006
+            FROM ' . prefixTable('items').'
5008 5007
             WHERE id = %i',
5009 5008
             $data['id_item']
5010 5009
         );
@@ -5034,7 +5033,7 @@  discard block
 block discarded – undo
5034 5033
                 $session->get('user-id'),
5035 5034
                 'at_modification',
5036 5035
                 $session->get('user-login'),
5037
-                'at_del_file : ' . $data['name']
5036
+                'at_del_file : '.$data['name']
5038 5037
             );
5039 5038
 
5040 5039
             // DElete sharekeys
@@ -5045,7 +5044,7 @@  discard block
 block discarded – undo
5045 5044
             );
5046 5045
 
5047 5046
             // Delete file from server
5048
-            $fileToDelete = $SETTINGS['path_to_upload_folder'] . '/' . TP_FILE_PREFIX . base64_decode($data['file']);
5047
+            $fileToDelete = $SETTINGS['path_to_upload_folder'].'/'.TP_FILE_PREFIX.base64_decode($data['file']);
5049 5048
             $fileToDelete = realpath($fileToDelete);
5050 5049
             if ($fileToDelete && strpos($fileToDelete, $SETTINGS['path_to_upload_folder']) === 0) {
5051 5050
                 fileDelete($fileToDelete, $SETTINGS);
@@ -5099,7 +5098,7 @@  discard block
 block discarded – undo
5099 5098
             // Update SESSION with this new favourite
5100 5099
             $data = DB::queryfirstrow(
5101 5100
                 'SELECT label,id_tree
5102
-                FROM ' . prefixTable('items') . '
5101
+                FROM ' . prefixTable('items').'
5103 5102
                 WHERE id = %i',
5104 5103
                 $inputData['itemId']
5105 5104
             );
@@ -5108,7 +5107,7 @@  discard block
 block discarded – undo
5108 5107
                 [
5109 5108
                     $inputData['itemId'] => [
5110 5109
                         'label' => $data['label'],
5111
-                        'url' => 'index.php?page=items&amp;group=' . $data['id_tree'] . '&amp;id=' . $inputData['itemId'],
5110
+                        'url' => 'index.php?page=items&amp;group='.$data['id_tree'].'&amp;id='.$inputData['itemId'],
5112 5111
                     ],
5113 5112
                 ],
5114 5113
                 'add'
@@ -5177,8 +5176,8 @@  discard block
 block discarded – undo
5177 5176
         // get data about item
5178 5177
         $dataSource = DB::queryfirstrow(
5179 5178
             'SELECT i.pw, f.personal_folder,i.id_tree, f.title,i.label
5180
-            FROM ' . prefixTable('items') . ' as i
5181
-            INNER JOIN ' . prefixTable('nested_tree') . ' as f ON (i.id_tree=f.id)
5179
+            FROM ' . prefixTable('items').' as i
5180
+            INNER JOIN ' . prefixTable('nested_tree').' as f ON (i.id_tree=f.id)
5182 5181
             WHERE i.id=%i',
5183 5182
             $inputData['itemId']
5184 5183
         );
@@ -5222,7 +5221,7 @@  discard block
 block discarded – undo
5222 5221
         // get data about new folder
5223 5222
         $dataDestination = DB::queryfirstrow(
5224 5223
             'SELECT personal_folder, title
5225
-            FROM ' . prefixTable('nested_tree') . '
5224
+            FROM ' . prefixTable('nested_tree').'
5226 5225
             WHERE id = %i',
5227 5226
             $inputData['folderId']
5228 5227
         );
@@ -5275,7 +5274,7 @@  discard block
 block discarded – undo
5275 5274
             // Get fields for this Item
5276 5275
             $rows = DB::query(
5277 5276
                 'SELECT id
5278
-                FROM ' . prefixTable('categories_items') . '
5277
+                FROM ' . prefixTable('categories_items').'
5279 5278
                 WHERE item_id = %i',
5280 5279
                 $inputData['itemId']
5281 5280
             );
@@ -5292,7 +5291,7 @@  discard block
 block discarded – undo
5292 5291
             // Get FILES for this Item
5293 5292
             $rows = DB::query(
5294 5293
                 'SELECT id
5295
-                FROM ' . prefixTable('files') . '
5294
+                FROM ' . prefixTable('files').'
5296 5295
                 WHERE id_item = %i',
5297 5296
                 $inputData['itemId']
5298 5297
             );
@@ -5339,7 +5338,7 @@  discard block
 block discarded – undo
5339 5338
             // Get the ITEM object key for the user
5340 5339
             $userKey = DB::queryFirstRow(
5341 5340
                 'SELECT share_key
5342
-                FROM ' . prefixTable('sharekeys_items') . '
5341
+                FROM ' . prefixTable('sharekeys_items').'
5343 5342
                 WHERE user_id = %i AND object_id = %i',
5344 5343
                 $session->get('user-id'),
5345 5344
                 $inputData['itemId']
@@ -5350,8 +5349,8 @@  discard block
 block discarded – undo
5350 5349
                 // This is a public object
5351 5350
                 $users = DB::query(
5352 5351
                     'SELECT id, public_key
5353
-                    FROM ' . prefixTable('users') . '
5354
-                    WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '","' . $session->get('user-id') . '")
5352
+                    FROM ' . prefixTable('users').'
5353
+                    WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'","'.$session->get('user-id').'")
5355 5354
                     AND public_key != ""'
5356 5355
                 );
5357 5356
                 foreach ($users as $user) {
@@ -5371,14 +5370,14 @@  discard block
 block discarded – undo
5371 5370
             // Get fields for this Item
5372 5371
             $rows = DB::query(
5373 5372
                 'SELECT id
5374
-                FROM ' . prefixTable('categories_items') . '
5373
+                FROM ' . prefixTable('categories_items').'
5375 5374
                 WHERE item_id = %i',
5376 5375
                 $inputData['itemId']
5377 5376
             );
5378 5377
             foreach ($rows as $field) {
5379 5378
                 $userKey = DB::queryFirstRow(
5380 5379
                     'SELECT share_key
5381
-                    FROM ' . prefixTable('sharekeys_fields') . '
5380
+                    FROM ' . prefixTable('sharekeys_fields').'
5382 5381
                     WHERE user_id = %i AND object_id = %i',
5383 5382
                     $session->get('user-id'),
5384 5383
                     $field['id']
@@ -5389,8 +5388,8 @@  discard block
 block discarded – undo
5389 5388
                     // This is a public object
5390 5389
                     $users = DB::query(
5391 5390
                         'SELECT id, public_key
5392
-                        FROM ' . prefixTable('users') . '
5393
-                        WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '","' . $session->get('user-id') . '")
5391
+                        FROM ' . prefixTable('users').'
5392
+                        WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'","'.$session->get('user-id').'")
5394 5393
                         AND public_key != ""'
5395 5394
                     );
5396 5395
                     foreach ($users as $user) {
@@ -5411,14 +5410,14 @@  discard block
 block discarded – undo
5411 5410
             // Get FILES for this Item
5412 5411
             $rows = DB::query(
5413 5412
                 'SELECT id
5414
-                FROM ' . prefixTable('files') . '
5413
+                FROM ' . prefixTable('files').'
5415 5414
                 WHERE id_item = %i',
5416 5415
                 $inputData['itemId']
5417 5416
             );
5418 5417
             foreach ($rows as $attachment) {
5419 5418
                 $userKey = DB::queryFirstRow(
5420 5419
                     'SELECT share_key
5421
-                    FROM ' . prefixTable('sharekeys_files') . '
5420
+                    FROM ' . prefixTable('sharekeys_files').'
5422 5421
                     WHERE user_id = %i AND object_id = %i',
5423 5422
                     $session->get('user-id'),
5424 5423
                     $attachment['id']
@@ -5429,8 +5428,8 @@  discard block
 block discarded – undo
5429 5428
                     // This is a public object
5430 5429
                     $users = DB::query(
5431 5430
                         'SELECT id, public_key
5432
-                        FROM ' . prefixTable('users') . '
5433
-                        WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '","' . $session->get('user-id') . '")
5431
+                        FROM ' . prefixTable('users').'
5432
+                        WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'","'.$session->get('user-id').'")
5434 5433
                         AND public_key != ""'
5435 5434
                     );
5436 5435
                     foreach ($users as $user) {
@@ -5468,7 +5467,7 @@  discard block
 block discarded – undo
5468 5467
             $session->get('user-id'),
5469 5468
             'at_modification',
5470 5469
             $session->get('user-login'),
5471
-            'at_moved : ' . $dataSource['title'] . ' -> ' . $dataDestination['title']
5470
+            'at_moved : '.$dataSource['title'].' -> '.$dataDestination['title']
5472 5471
         );
5473 5472
 
5474 5473
         // Update cache table
@@ -5527,8 +5526,8 @@  discard block
 block discarded – undo
5527 5526
                 // get data about item
5528 5527
                 $dataSource = DB::queryfirstrow(
5529 5528
                     'SELECT i.pw, f.personal_folder,i.id_tree, f.title,i.label
5530
-                    FROM ' . prefixTable('items') . ' as i
5531
-                    INNER JOIN ' . prefixTable('nested_tree') . ' as f ON (i.id_tree=f.id)
5529
+                    FROM ' . prefixTable('items').' as i
5530
+                    INNER JOIN ' . prefixTable('nested_tree').' as f ON (i.id_tree=f.id)
5532 5531
                     WHERE i.id=%i',
5533 5532
                     $item_id
5534 5533
                 );
@@ -5550,7 +5549,7 @@  discard block
 block discarded – undo
5550 5549
 
5551 5550
                 // get data about new folder
5552 5551
                 $dataDestination = DB::queryfirstrow(
5553
-                    'SELECT personal_folder, title FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
5552
+                    'SELECT personal_folder, title FROM '.prefixTable('nested_tree').' WHERE id = %i',
5554 5553
                     $inputData['folderId']
5555 5554
                 );
5556 5555
 
@@ -5592,7 +5591,7 @@  discard block
 block discarded – undo
5592 5591
                     // Get fields for this Item
5593 5592
                     $rows = DB::query(
5594 5593
                         'SELECT id
5595
-                        FROM ' . prefixTable('categories_items') . '
5594
+                        FROM ' . prefixTable('categories_items').'
5596 5595
                         WHERE item_id = %i',
5597 5596
                         $item_id
5598 5597
                     );
@@ -5609,7 +5608,7 @@  discard block
 block discarded – undo
5609 5608
                     // Get FILES for this Item
5610 5609
                     $rows = DB::query(
5611 5610
                         'SELECT id
5612
-                        FROM ' . prefixTable('files') . '
5611
+                        FROM ' . prefixTable('files').'
5613 5612
                         WHERE id_item = %i',
5614 5613
                         $item_id
5615 5614
                     );
@@ -5664,7 +5663,7 @@  discard block
 block discarded – undo
5664 5663
                     // Get the ITEM object key for the user
5665 5664
                     $userKey = DB::queryFirstRow(
5666 5665
                         'SELECT share_key
5667
-                        FROM ' . prefixTable('sharekeys_items') . '
5666
+                        FROM ' . prefixTable('sharekeys_items').'
5668 5667
                         WHERE user_id = %i AND object_id = %i',
5669 5668
                         $session->get('user-id'),
5670 5669
                         $item_id
@@ -5675,8 +5674,8 @@  discard block
 block discarded – undo
5675 5674
                         // This is a public object
5676 5675
                         $users = DB::query(
5677 5676
                             'SELECT id, public_key
5678
-                            FROM ' . prefixTable('users') . '
5679
-                            WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '","' . $session->get('user-id') . '")
5677
+                            FROM ' . prefixTable('users').'
5678
+                            WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'","'.$session->get('user-id').'")
5680 5679
                             AND public_key != ""'
5681 5680
                         );
5682 5681
                         foreach ($users as $user) {
@@ -5696,14 +5695,14 @@  discard block
 block discarded – undo
5696 5695
                     // Get fields for this Item
5697 5696
                     $rows = DB::query(
5698 5697
                         'SELECT id
5699
-                        FROM ' . prefixTable('categories_items') . '
5698
+                        FROM ' . prefixTable('categories_items').'
5700 5699
                         WHERE item_id = %i',
5701 5700
                         $item_id
5702 5701
                     );
5703 5702
                     foreach ($rows as $field) {
5704 5703
                         $userKey = DB::queryFirstRow(
5705 5704
                             'SELECT share_key
5706
-                            FROM ' . prefixTable('sharekeys_fields') . '
5705
+                            FROM ' . prefixTable('sharekeys_fields').'
5707 5706
                             WHERE user_id = %i AND object_id = %i',
5708 5707
                             $session->get('user-id'),
5709 5708
                             $field['id']
@@ -5714,8 +5713,8 @@  discard block
 block discarded – undo
5714 5713
                             // This is a public object
5715 5714
                             $users = DB::query(
5716 5715
                                 'SELECT id, public_key
5717
-                                FROM ' . prefixTable('users') . '
5718
-                                WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '","' . $session->get('user-id') . '")
5716
+                                FROM ' . prefixTable('users').'
5717
+                                WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'","'.$session->get('user-id').'")
5719 5718
                                 AND public_key != ""'
5720 5719
                             );
5721 5720
                             foreach ($users as $user) {
@@ -5736,14 +5735,14 @@  discard block
 block discarded – undo
5736 5735
                     // Get FILES for this Item
5737 5736
                     $rows = DB::query(
5738 5737
                         'SELECT id
5739
-                        FROM ' . prefixTable('files') . '
5738
+                        FROM ' . prefixTable('files').'
5740 5739
                         WHERE id_item = %i',
5741 5740
                         $item_id
5742 5741
                     );
5743 5742
                     foreach ($rows as $attachment) {
5744 5743
                         $userKey = DB::queryFirstRow(
5745 5744
                             'SELECT share_key
5746
-                            FROM ' . prefixTable('sharekeys_files') . '
5745
+                            FROM ' . prefixTable('sharekeys_files').'
5747 5746
                             WHERE user_id = %i AND object_id = %i',
5748 5747
                             $session->get('user-id'),
5749 5748
                             $attachment['id']
@@ -5754,8 +5753,8 @@  discard block
 block discarded – undo
5754 5753
                             // This is a public object
5755 5754
                             $users = DB::query(
5756 5755
                                 'SELECT id, public_key
5757
-                                FROM ' . prefixTable('users') . '
5758
-                                WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '","' . $session->get('user-id') . '")
5756
+                                FROM ' . prefixTable('users').'
5757
+                                WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'","'.$session->get('user-id').'")
5759 5758
                                 AND public_key != ""'
5760 5759
                             );
5761 5760
                             foreach ($users as $user) {
@@ -5792,13 +5791,13 @@  discard block
 block discarded – undo
5792 5791
                     $session->get('user-id'),
5793 5792
                     'at_modification',
5794 5793
                     $session->get('user-login'),
5795
-                    'at_moved : ' . $dataSource['title'] . ' -> ' . $dataDestination['title']
5794
+                    'at_moved : '.$dataSource['title'].' -> '.$dataDestination['title']
5796 5795
                 );
5797 5796
             }
5798 5797
         }
5799 5798
 
5800 5799
         // reload cache table
5801
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
5800
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
5802 5801
         updateCacheTable('reload', null);
5803 5802
 
5804 5803
         echo (string) prepareExchangedData(
@@ -5862,7 +5861,7 @@  discard block
 block discarded – undo
5862 5861
                 // get info
5863 5862
                 $dataSource = DB::queryfirstrow(
5864 5863
                     'SELECT label, id_tree
5865
-                    FROM ' . prefixTable('items') . '
5864
+                    FROM ' . prefixTable('items').'
5866 5865
                     WHERE id=%i',
5867 5866
                     $item_id
5868 5867
                 );
@@ -5961,8 +5960,8 @@  discard block
 block discarded – undo
5961 5960
         }
5962 5961
         if ($inputData['cat'] === 'request_access_to_author') {
5963 5962
             // Variables
5964
-            $dataAuthor = DB::queryfirstrow('SELECT email,login FROM ' . prefixTable('users') . ' WHERE id = ' . $post_content[1]);
5965
-            $dataItem = DB::queryfirstrow('SELECT label, id_tree FROM ' . prefixTable('items') . ' WHERE id = ' . $post_content[0]);
5963
+            $dataAuthor = DB::queryfirstrow('SELECT email,login FROM '.prefixTable('users').' WHERE id = '.$post_content[1]);
5964
+            $dataItem = DB::queryfirstrow('SELECT label, id_tree FROM '.prefixTable('items').' WHERE id = '.$post_content[0]);
5966 5965
 
5967 5966
             // Get path
5968 5967
             $path = geItemReadablePath(
@@ -5976,7 +5975,7 @@  discard block
 block discarded – undo
5976 5975
                 $lang->get('email_request_access_subject'),
5977 5976
                 str_replace(
5978 5977
                     array('#tp_item_author#', '#tp_user#', '#tp_item#'),
5979
-                    array(' ' . addslashes($dataAuthor['login']), addslashes($session->get('user-login')), $path),
5978
+                    array(' '.addslashes($dataAuthor['login']), addslashes($session->get('user-login')), $path),
5980 5979
                     $lang->get('email_request_access_mail')
5981 5980
                 ),
5982 5981
                 $dataAuthor['email'],
@@ -5985,7 +5984,7 @@  discard block
 block discarded – undo
5985 5984
         } elseif ($inputData['cat'] === 'share_this_item') {
5986 5985
             $dataItem = DB::queryfirstrow(
5987 5986
                 'SELECT label,id_tree
5988
-                FROM ' . prefixTable('items') . '
5987
+                FROM ' . prefixTable('items').'
5989 5988
                 WHERE id= %i',
5990 5989
                 $inputData['id']
5991 5990
             );
@@ -6008,7 +6007,7 @@  discard block
 block discarded – undo
6008 6007
                     ),
6009 6008
                     array(
6010 6009
                         empty($SETTINGS['email_server_url']) === false ?
6011
-                            $SETTINGS['email_server_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $inputData['id'] : $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $inputData['id'],
6010
+                            $SETTINGS['email_server_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$inputData['id'] : $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$inputData['id'],
6012 6011
                         addslashes($session->get('user-login')),
6013 6012
                         addslashes($path),
6014 6013
                     ),
@@ -6108,8 +6107,8 @@  discard block
 block discarded – undo
6108 6107
         // Get all informations for this item
6109 6108
         $dataItem = DB::queryfirstrow(
6110 6109
             'SELECT *
6111
-            FROM ' . prefixTable('items') . ' as i
6112
-            INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
6110
+            FROM ' . prefixTable('items').' as i
6111
+            INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
6113 6112
             WHERE i.id=%i AND l.action = %s',
6114 6113
             $item_id,
6115 6114
             'at_creation'
@@ -6138,18 +6137,18 @@  discard block
 block discarded – undo
6138 6137
                 $session->get('user-login'),
6139 6138
                 htmlspecialchars_decode($label, ENT_QUOTES),
6140 6139
                 null,
6141
-                (string) dateToStamp($date.' '.$time, $SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'])
6140
+                (string) dateToStamp($date.' '.$time, $SETTINGS['date_format'].' '.$SETTINGS['time_format'])
6142 6141
             );
6143 6142
             // Prepare new line
6144 6143
             $data = DB::queryfirstrow(
6145
-                'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i ORDER BY date DESC',
6144
+                'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i ORDER BY date DESC',
6146 6145
                 $item_id
6147 6146
             );
6148
-            $historic = date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $data['date']) . ' - ' . $session->get('user-login') . ' - ' . $lang->get($data['action']) . ' - ' . $data['raison'];
6147
+            $historic = date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $data['date']).' - '.$session->get('user-login').' - '.$lang->get($data['action']).' - '.$data['raison'];
6149 6148
             // send back
6150 6149
             $data = array(
6151 6150
                 'error' => '',
6152
-                'new_line' => '<br>' . addslashes($historic),
6151
+                'new_line' => '<br>'.addslashes($historic),
6153 6152
             );
6154 6153
             echo (string) prepareExchangedData(
6155 6154
                 $data,
@@ -6221,7 +6220,7 @@  discard block
 block discarded – undo
6221 6220
         );
6222 6221
 
6223 6222
         // delete all existing old otv codes
6224
-        $rows = DB::query('SELECT id FROM ' . prefixTable('otv') . ' WHERE time_limit < ' . time());
6223
+        $rows = DB::query('SELECT id FROM '.prefixTable('otv').' WHERE time_limit < '.time());
6225 6224
         foreach ($rows as $record) {
6226 6225
             DB::delete(prefixTable('otv'), 'id=%i', $record['id']);
6227 6226
         }
@@ -6243,8 +6242,8 @@  discard block
 block discarded – undo
6243 6242
         // Should we log a password change?
6244 6243
         $itemQ = DB::queryFirstRow(
6245 6244
             'SELECT s.share_key, i.pw
6246
-            FROM ' . prefixTable('items') . ' AS i
6247
-            INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (i.id = s.object_id)
6245
+            FROM ' . prefixTable('items').' AS i
6246
+            INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (i.id = s.object_id)
6248 6247
             WHERE s.user_id = %i AND s.object_id = %i',
6249 6248
             $session->get('user-id'),
6250 6249
             $dataReceived['id']
@@ -6299,7 +6298,7 @@  discard block
 block discarded – undo
6299 6298
         if (isset($SETTINGS['otv_expiration_period']) === false) {
6300 6299
             $SETTINGS['otv_expiration_period'] = 7;
6301 6300
         }
6302
-        $url = $SETTINGS['cpassman_url'] . '/index.php?' . http_build_query($otv_session);
6301
+        $url = $SETTINGS['cpassman_url'].'/index.php?'.http_build_query($otv_session);
6303 6302
 
6304 6303
         echo json_encode(
6305 6304
             array(
@@ -6330,7 +6329,7 @@  discard block
 block discarded – undo
6330 6329
         // get parameters from original link
6331 6330
         $url = $dataReceived['original_link'];
6332 6331
         $parts = parse_url($url);
6333
-        if(isset($parts['query'])){
6332
+        if (isset($parts['query'])) {
6334 6333
             parse_str($parts['query'], $orignal_link_parameters);
6335 6334
         } else {
6336 6335
             $orignal_link_parameters = array();
@@ -6361,13 +6360,13 @@  discard block
 block discarded – undo
6361 6360
             $domain_scheme = parse_url($SETTINGS['cpassman_url'], PHP_URL_SCHEME);
6362 6361
             $domain_host = parse_url($SETTINGS['cpassman_url'], PHP_URL_HOST);
6363 6362
             if (str_contains($domain_host, 'www.') === true) {
6364
-                $domain_host = (string) $SETTINGS['otv_subdomain'] . '.' . substr($domain_host, 4);
6363
+                $domain_host = (string) $SETTINGS['otv_subdomain'].'.'.substr($domain_host, 4);
6365 6364
             } else {
6366
-                $domain_host = (string) $SETTINGS['otv_subdomain'] . '.' . $domain_host;
6365
+                $domain_host = (string) $SETTINGS['otv_subdomain'].'.'.$domain_host;
6367 6366
             }
6368
-            $url = $domain_scheme.'://'.$domain_host . '/index.php?'.http_build_query($otv_session);
6367
+            $url = $domain_scheme.'://'.$domain_host.'/index.php?'.http_build_query($otv_session);
6369 6368
         } else {
6370
-            $url = $SETTINGS['cpassman_url'] . '/index.php?'.http_build_query($otv_session);
6369
+            $url = $SETTINGS['cpassman_url'].'/index.php?'.http_build_query($otv_session);
6371 6370
         }
6372 6371
 
6373 6372
         echo (string) prepareExchangedData(
@@ -6402,8 +6401,8 @@  discard block
 block discarded – undo
6402 6401
             'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status,
6403 6402
             f.extension AS extension, f.type AS type,
6404 6403
             s.share_key AS share_key
6405
-            FROM ' . prefixTable('files') . ' AS f
6406
-            INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id)
6404
+            FROM ' . prefixTable('files').' AS f
6405
+            INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id)
6407 6406
             WHERE s.user_id = %i AND s.object_id = %i',
6408 6407
             $session->get('user-id'),
6409 6408
             $inputData['id']
@@ -6424,7 +6423,7 @@  discard block
 block discarded – undo
6424 6423
         //$fileName = basename($file_info['name'], '.'.$file_info['extension']);
6425 6424
 
6426 6425
         // prepare image info
6427
-        $post_title = basename($file_info['name'], '.' . $file_info['extension']);
6426
+        $post_title = basename($file_info['name'], '.'.$file_info['extension']);
6428 6427
         $post_title = isBase64($post_title) === true ? base64_decode($post_title) : $post_title;
6429 6428
         
6430 6429
         // Get image content
@@ -6439,7 +6438,7 @@  discard block
 block discarded – undo
6439 6438
         echo (string) prepareExchangedData(
6440 6439
             array(
6441 6440
                 'error' => false,
6442
-                'filename' => $post_title . '.' . $file_info['extension'],
6441
+                'filename' => $post_title.'.'.$file_info['extension'],
6443 6442
                 'file_type' => $file_info['type'],
6444 6443
                 'file_content' => $fileContent,
6445 6444
             ),
@@ -6492,16 +6491,16 @@  discard block
 block discarded – undo
6492 6491
         $idFolder = $dataReceived['idFolder'];
6493 6492
 
6494 6493
         // don't check if Personal Folder
6495
-        $data = DB::queryFirstRow('SELECT title FROM ' . prefixTable('nested_tree') . ' WHERE id = %i', $idFolder);
6494
+        $data = DB::queryFirstRow('SELECT title FROM '.prefixTable('nested_tree').' WHERE id = %i', $idFolder);
6496 6495
         if ($data['title'] === $session->get('user-id')) {
6497 6496
             // send data
6498
-            echo '[{"duplicate" : "' . $duplicate . '" , error" : ""}]';
6497
+            echo '[{"duplicate" : "'.$duplicate.'" , error" : ""}]';
6499 6498
         } else {
6500 6499
             if ($inputData['option'] === 'same_folder') {
6501 6500
                 // case unique folder
6502 6501
                 DB::query(
6503 6502
                     'SELECT label
6504
-                    FROM ' . prefixTable('items') . '
6503
+                    FROM ' . prefixTable('items').'
6505 6504
                     WHERE id_tree = %i AND label = %s',
6506 6505
                     $idFolder,
6507 6506
                     $label
@@ -6513,7 +6512,7 @@  discard block
 block discarded – undo
6513 6512
                 $arrayPf = array();
6514 6513
                 if (empty($row['id']) === false) {
6515 6514
                     $rows = DB::query(
6516
-                        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
6515
+                        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
6517 6516
                         '1'
6518 6517
                     );
6519 6518
                     foreach ($rows as $record) {
@@ -6528,12 +6527,12 @@  discard block
 block discarded – undo
6528 6527
                 $where->add('id_tree = %i', $idFolder);
6529 6528
                 $where->add('label = %s', $label);
6530 6529
                 if (empty($arrayPf) === false) {
6531
-                    $where->add('id_tree NOT IN (' . implode(',', $arrayPf) . ')');
6530
+                    $where->add('id_tree NOT IN ('.implode(',', $arrayPf).')');
6532 6531
                 }
6533 6532
 
6534 6533
                 DB::query(
6535 6534
                     'SELECT label
6536
-                    FROM ' . prefixTable('items') . '
6535
+                    FROM ' . prefixTable('items').'
6537 6536
                     WHERE %l',
6538 6537
                     $where
6539 6538
                 );
@@ -6545,7 +6544,7 @@  discard block
 block discarded – undo
6545 6544
             }
6546 6545
 
6547 6546
             // send data
6548
-            echo '[{"duplicate" : "' . $duplicate . '" , "error" : ""}]';
6547
+            echo '[{"duplicate" : "'.$duplicate.'" , "error" : ""}]';
6549 6548
         }
6550 6549
         break;
6551 6550
 
@@ -6655,7 +6654,7 @@  discard block
 block discarded – undo
6655 6654
                     $arbo = $tree->getPath($folder->id, false);
6656 6655
                     $path = '';
6657 6656
                     foreach ($arbo as $elem) {
6658
-                        $path = (empty($path) ? '' : $path . ' / ') . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
6657
+                        $path = (empty($path) ? '' : $path.' / ').htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
6659 6658
                     }
6660 6659
 
6661 6660
                     // Build array
@@ -6724,7 +6723,7 @@  discard block
 block discarded – undo
6724 6723
         if (is_array($foldersArray) === true && $inputData['data'] !== '[null]') {
6725 6724
             $rows = DB::query(
6726 6725
                 'SELECT id, categories
6727
-                FROM ' . prefixTable('nested_tree') . '
6726
+                FROM ' . prefixTable('nested_tree').'
6728 6727
                 WHERE id IN (%l)',
6729 6728
                 implode(',', $foldersArray)
6730 6729
             );
@@ -6766,7 +6765,7 @@  discard block
 block discarded – undo
6766 6765
         // get item info
6767 6766
         $dataItem = DB::queryFirstRow(
6768 6767
             'SELECT *
6769
-            FROM ' . prefixTable('items') . '
6768
+            FROM ' . prefixTable('items').'
6770 6769
             WHERE id=%i',
6771 6770
             $inputData['itemId']
6772 6771
         );
@@ -6778,8 +6777,8 @@  discard block
 block discarded – undo
6778 6777
             'SELECT l.date as date, l.action as action, l.raison as raison,
6779 6778
                 u.login as login, u.avatar_thumb as avatar_thumb, u.name as name, u.lastname as lastname,
6780 6779
                 l.old_value as old_value
6781
-            FROM ' . prefixTable('log_items') . ' as l
6782
-            INNER JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id)
6780
+            FROM ' . prefixTable('log_items').' as l
6781
+            INNER JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id)
6783 6782
             WHERE id_item=%i AND l.action NOT IN (%l)
6784 6783
             ORDER BY date DESC',
6785 6784
             $inputData['itemId'],
@@ -6794,18 +6793,18 @@  discard block
 block discarded – undo
6794 6793
             
6795 6794
             // imported via API
6796 6795
             if (empty($record['login']) === true) {
6797
-                $record['login'] = $lang->get('imported_via_api') . ' [' . $record['raison'] . ']';
6796
+                $record['login'] = $lang->get('imported_via_api').' ['.$record['raison'].']';
6798 6797
             }
6799 6798
             
6800 6799
             // Prepare avatar
6801 6800
             if (isset($record['avatar_thumb']) && empty($record['avatar_thumb']) === false) {
6802
-                if (file_exists($SETTINGS['cpassman_dir'] . '/includes/avatars/' . $record['avatar_thumb'])) {
6803
-                    $avatar = $SETTINGS['cpassman_url'] . '/includes/avatars/' . $record['avatar_thumb'];
6801
+                if (file_exists($SETTINGS['cpassman_dir'].'/includes/avatars/'.$record['avatar_thumb'])) {
6802
+                    $avatar = $SETTINGS['cpassman_url'].'/includes/avatars/'.$record['avatar_thumb'];
6804 6803
                 } else {
6805
-                    $avatar = $SETTINGS['cpassman_url'] . '/includes/images/photo.jpg';
6804
+                    $avatar = $SETTINGS['cpassman_url'].'/includes/images/photo.jpg';
6806 6805
                 }
6807 6806
             } else {
6808
-                $avatar = $SETTINGS['cpassman_url'] . '/includes/images/photo.jpg';
6807
+                $avatar = $SETTINGS['cpassman_url'].'/includes/images/photo.jpg';
6809 6808
             }
6810 6809
 
6811 6810
             // Prepare action
@@ -6825,7 +6824,7 @@  discard block
 block discarded – undo
6825 6824
                         $previous_passwords, 
6826 6825
                         [
6827 6826
                             'password' => htmlentities($previous_pwd['string']),
6828
-                            'date' => date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']),
6827
+                            'date' => date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']),
6829 6828
                         ]
6830 6829
                     );
6831 6830
                 }
@@ -6838,19 +6837,19 @@  discard block
 block discarded – undo
6838 6837
                 $action = $lang->get($reason[0]);
6839 6838
                 if ($reason[0] === 'at_moved') {
6840 6839
                     $tmp = explode(' -> ', $reason[1]);
6841
-                    $detail = $lang->get('from') . ' <span class="font-weight-light">' . $tmp[0] . '</span> ' . $lang->get('to') . ' <span class="font-weight-light">' . $tmp[1] . ' </span>';
6840
+                    $detail = $lang->get('from').' <span class="font-weight-light">'.$tmp[0].'</span> '.$lang->get('to').' <span class="font-weight-light">'.$tmp[1].' </span>';
6842 6841
                 } elseif ($reason[0] === 'at_field') {
6843 6842
                     $tmp = explode(' => ', $reason[1]);
6844 6843
                     if (count($tmp) > 1) {
6845
-                        $detail = '<b>' . trim($tmp[0]) . '</b> | ' . $lang->get('previous_value') .
6846
-                            ': <span class="font-weight-light">' . trim($tmp[1]) . '</span>';
6844
+                        $detail = '<b>'.trim($tmp[0]).'</b> | '.$lang->get('previous_value').
6845
+                            ': <span class="font-weight-light">'.trim($tmp[1]).'</span>';
6847 6846
                     } else {
6848 6847
                         $detail = trim($reason[1]);
6849 6848
                     }
6850 6849
                 } elseif (in_array($reason[0], array('at_restriction', 'at_email', 'at_login', 'at_label', 'at_url', 'at_tag')) === true) {
6851 6850
                     $tmp = explode(' => ', $reason[1]);
6852 6851
                     $detail = empty(trim($tmp[0])) === true ?
6853
-                        $lang->get('no_previous_value') : $lang->get('previous_value') . ': <span class="font-weight-light">' . $tmp[0] . ' </span>';
6852
+                        $lang->get('no_previous_value') : $lang->get('previous_value').': <span class="font-weight-light">'.$tmp[0].' </span>';
6854 6853
                 } elseif ($reason[0] === 'at_automatic_del') {
6855 6854
                     $detail = $lang->get($reason[1]);
6856 6855
                 } elseif ($reason[0] === 'at_anyoneconmodify' || $reason[0] === 'at_otp_status') {
@@ -6859,7 +6858,7 @@  discard block
 block discarded – undo
6859 6858
                     $tmp = explode(':', $reason[1]);
6860 6859
                     $tmp = explode('.', $tmp[0]);
6861 6860
                     $detail = isBase64($tmp[0]) === true ?
6862
-                        base64_decode($tmp[0]) . '.' . $tmp[1] : $tmp[0];
6861
+                        base64_decode($tmp[0]).'.'.$tmp[1] : $tmp[0];
6863 6862
                 } elseif ($reason[0] === 'at_import') {
6864 6863
                     $detail = '';
6865 6864
                 } elseif (in_array($reason[0], array('csv', 'pdf')) === true) {
@@ -6878,8 +6877,8 @@  discard block
 block discarded – undo
6878 6877
                 array(
6879 6878
                     'avatar' => $avatar,
6880 6879
                     'login' => $record['login'],
6881
-                    'name' => $record['name'] . ' ' . $record['lastname'],
6882
-                    'date' => date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']),
6880
+                    'name' => $record['name'].' '.$record['lastname'],
6881
+                    'date' => date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']),
6883 6882
                     'action' => $action,
6884 6883
                     'detail' => $detail,
6885 6884
                 )
@@ -6968,11 +6967,11 @@  discard block
 block discarded – undo
6968 6967
 
6969 6968
         // get some info to add to the notification email
6970 6969
         $resp_user = DB::queryfirstrow(
6971
-            'SELECT login FROM ' . prefixTable('users') . ' WHERE id = %i',
6970
+            'SELECT login FROM '.prefixTable('users').' WHERE id = %i',
6972 6971
             $session->get('user-id')
6973 6972
         );
6974 6973
         $resp_folder = DB::queryfirstrow(
6975
-            'SELECT title FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
6974
+            'SELECT title FROM '.prefixTable('nested_tree').' WHERE id = %i',
6976 6975
             $folder
6977 6976
         );
6978 6977
 
@@ -6981,7 +6980,7 @@  discard block
 block discarded – undo
6981 6980
         $emailService = new EmailService();
6982 6981
         $rows = DB::query(
6983 6982
             'SELECT email
6984
-            FROM ' . prefixTable('users') . '
6983
+            FROM ' . prefixTable('users').'
6985 6984
             WHERE `gestionnaire` = %i AND `email` IS NOT NULL',
6986 6985
             1
6987 6986
         );
@@ -7012,14 +7011,14 @@  discard block
 block discarded – undo
7012 7011
         // Get list of users
7013 7012
         $usersList = array();
7014 7013
         $usersString = '';
7015
-        $rows = DB::query('SELECT id,login,email FROM ' . prefixTable('users') . ' ORDER BY login ASC');
7014
+        $rows = DB::query('SELECT id,login,email FROM '.prefixTable('users').' ORDER BY login ASC');
7016 7015
         foreach ($rows as $record) {
7017 7016
             $usersList[$record['login']] = array(
7018 7017
                 'id' => $record['id'],
7019 7018
                 'login' => $record['login'],
7020 7019
                 'email' => $record['email'],
7021 7020
             );
7022
-            $usersString .= $record['id'] . '#' . $record['login'] . ';';
7021
+            $usersString .= $record['id'].'#'.$record['login'].';';
7023 7022
         }
7024 7023
 
7025 7024
         $data = array(
@@ -7059,7 +7058,7 @@  discard block
 block discarded – undo
7059 7058
         // Send email
7060 7059
         $dataItem = DB::queryfirstrow(
7061 7060
             'SELECT label, id_tree
7062
-            FROM ' . prefixTable('items') . '
7061
+            FROM ' . prefixTable('items').'
7063 7062
             WHERE id = %i',
7064 7063
             $inputData['itemId']
7065 7064
         );
@@ -7113,7 +7112,7 @@  discard block
 block discarded – undo
7113 7112
 
7114 7113
         DB::query(
7115 7114
             'SELECT *
7116
-            FROM ' . prefixTable('notification') . '
7115
+            FROM ' . prefixTable('notification').'
7117 7116
             WHERE item_id = %i AND user_id = %i',
7118 7117
             $inputData['itemId'],
7119 7118
             $session->get('user-id')
@@ -7185,7 +7184,7 @@  discard block
 block discarded – undo
7185 7184
         // And related logs
7186 7185
         $rows = DB::query(
7187 7186
             'SELECT id, file AS filename
7188
-            FROM ' . prefixTable('files') . '
7187
+            FROM ' . prefixTable('files').'
7189 7188
             WHERE id_item = %i AND confirmed = %i',
7190 7189
             $inputData['itemId'],
7191 7190
             0
@@ -7199,12 +7198,12 @@  discard block
 block discarded – undo
7199 7198
             );
7200 7199
 
7201 7200
             // Delete file on server
7202
-            unlink($SETTINGS['path_to_upload_folder'] . '/' . TP_FILE_PREFIX . base64_decode($file['filename']));
7201
+            unlink($SETTINGS['path_to_upload_folder'].'/'.TP_FILE_PREFIX.base64_decode($file['filename']));
7203 7202
 
7204 7203
             // Delete related logs
7205 7204
             $logFile = DB::query(
7206 7205
                 'SELECT increment_id, raison
7207
-                FROM ' . prefixTable('log_items') . '
7206
+                FROM ' . prefixTable('log_items').'
7208 7207
                 WHERE id_item = %i AND id_user = %i AND action = %s AND raison LIKE "at_add_file :%"',
7209 7208
                 $inputData['itemId'],
7210 7209
                 $session->get('user-id'),
@@ -7263,7 +7262,7 @@  discard block
 block discarded – undo
7263 7262
         // Confirm attachments
7264 7263
         $rows = DB::query(
7265 7264
             'SELECT id, file AS filename
7266
-            FROM ' . prefixTable('files') . '
7265
+            FROM ' . prefixTable('files').'
7267 7266
             WHERE id_item = %i AND confirmed = %i',
7268 7267
             $inputData['itemId'],
7269 7268
             0
@@ -7349,15 +7348,15 @@  discard block
 block discarded – undo
7349 7348
         case 'autocomplete_tags':
7350 7349
             // Get a list off all existing TAGS
7351 7350
             $listOfTags = '';
7352
-            $rows = DB::query('SELECT tag FROM ' . prefixTable('tags') . ' WHERE tag LIKE %ss GROUP BY tag', $inputData['getTerm']);
7351
+            $rows = DB::query('SELECT tag FROM '.prefixTable('tags').' WHERE tag LIKE %ss GROUP BY tag', $inputData['getTerm']);
7353 7352
             foreach ($rows as $record) {
7354 7353
                 if (empty($listOfTags)) {
7355
-                    $listOfTags = '"' . $record['tag'] . '"';
7354
+                    $listOfTags = '"'.$record['tag'].'"';
7356 7355
                 } else {
7357
-                    $listOfTags .= ', "' . $record['tag'] . '"';
7356
+                    $listOfTags .= ', "'.$record['tag'].'"';
7358 7357
                 }
7359 7358
             }
7360
-            echo '[' . $listOfTags . ']';
7359
+            echo '['.$listOfTags.']';
7361 7360
             break;
7362 7361
     }
7363 7362
 }
@@ -7373,7 +7372,7 @@  discard block
 block discarded – undo
7373 7372
 {
7374 7373
     $data = DB::queryFirstRow(
7375 7374
         'SELECT bloquer_creation, bloquer_modification, personal_folder
7376
-        FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
7375
+        FROM ' . prefixTable('nested_tree').' WHERE id = %i',
7377 7376
         $groupe
7378 7377
     );
7379 7378
     // Check if it's in a personal folder. If yes, then force complexity overhead.
@@ -7472,7 +7471,7 @@  discard block
 block discarded – undo
7472 7471
     global $SETTINGS;
7473 7472
 
7474 7473
     // Retrieve the current lock information for the item
7475
-    $itemLockInfo = DB::queryFirstRow('SELECT timestamp, user_id FROM ' . prefixTable('items_edition') . ' WHERE item_id = %i', $itemId);
7474
+    $itemLockInfo = DB::queryFirstRow('SELECT timestamp, user_id FROM '.prefixTable('items_edition').' WHERE item_id = %i', $itemId);
7476 7475
 
7477 7476
     // Check if the item is locked by another user
7478 7477
     if ($itemLockInfo && $itemLockInfo['user_id'] !== $userId) {
@@ -7491,7 +7490,7 @@  discard block
 block discarded – undo
7491 7490
     
7492 7491
     // Check if there's an ongoing background encryption process for the item
7493 7492
     $ongoingProcess = DB::queryFirstRow(
7494
-        'SELECT 1 FROM ' . prefixTable('background_tasks') . ' WHERE item_id = %i AND finished_at = "" LIMIT 1', 
7493
+        'SELECT 1 FROM '.prefixTable('background_tasks').' WHERE item_id = %i AND finished_at = "" LIMIT 1', 
7495 7494
         $itemId
7496 7495
     );
7497 7496
 
@@ -7509,7 +7508,7 @@  discard block
 block discarded – undo
7509 7508
 function getUserVisibleFolders(int $userId): array
7510 7509
 {
7511 7510
     // Query to retrieve visible folders for the user
7512
-    $data = DB::queryFirstRow('SELECT visible_folders FROM ' . prefixTable('cache_tree') . ' WHERE user_id = %i', $userId);
7511
+    $data = DB::queryFirstRow('SELECT visible_folders FROM '.prefixTable('cache_tree').' WHERE user_id = %i', $userId);
7513 7512
     
7514 7513
     // Decode JSON data into an array; return an empty array if the data is invalid
7515 7514
     return json_decode($data['visible_folders'], true) ?? [];
@@ -7533,7 +7532,7 @@  discard block
 block discarded – undo
7533 7532
 
7534 7533
     // Query the access rights for the given roles and folder
7535 7534
     $accessTypes = DB::queryFirstColumn(
7536
-        'SELECT type FROM ' . prefixTable('roles_values') . ' WHERE role_id IN %ls AND folder_id = %i', 
7535
+        'SELECT type FROM '.prefixTable('roles_values').' WHERE role_id IN %ls AND folder_id = %i', 
7537 7536
         $roles, 
7538 7537
         $treeId
7539 7538
     );
Please login to merge, or discard this patch.
pages/users.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('users') === false) {
67 67
     // Not allowed page
68 68
     $session->set('system-error_code', ERR_NOT_ALLOWED);
69
-    include $SETTINGS['cpassman_dir'] . '/error.php';
69
+    include $SETTINGS['cpassman_dir'].'/error.php';
70 70
     exit;
71 71
 }
72 72
 
@@ -89,24 +89,24 @@  discard block
 block discarded – undo
89 89
 // If administrator then all roles are shown
90 90
 // else only the Roles the users is associated to.
91 91
 if ((int) $session->get('user-admin') === 1) {
92
-    $optionsManagedBy .= '<option value="0">' . $lang->get('administrators_only') . '</option>';
92
+    $optionsManagedBy .= '<option value="0">'.$lang->get('administrators_only').'</option>';
93 93
 }
94 94
 
95 95
 $rows = DB::query(
96 96
     'SELECT id, title, creator_id
97
-    FROM ' . prefixTable('roles_title') . '
97
+    FROM ' . prefixTable('roles_title').'
98 98
     ORDER BY title ASC'
99 99
 );
100 100
 foreach ($rows as $record) {
101 101
     if ((int) $session->get('user-admin') === 1 || in_array($record['id'], $session->get('user-roles_array')) === true) {
102
-        $optionsManagedBy .= '<option value="' . $record['id'] . '">' . $lang->get('managers_of') . ' ' . addslashes($record['title']) . '</option>';
102
+        $optionsManagedBy .= '<option value="'.$record['id'].'">'.$lang->get('managers_of').' '.addslashes($record['title']).'</option>';
103 103
     }
104 104
     if (
105 105
         (int) $session->get('user-admin') === 1
106 106
         || (((int) $session->get('user-manager') === 1 || (int) $session->get('user-can_manage_all_users') === 1)
107 107
             && (in_array($record['id'], $userRoles) === true) || (int) $record['creator_id'] === (int) $session->get('user-id'))
108 108
     ) {
109
-        $optionsRoles .= '<option value="' . $record['id'] . '">' . addslashes($record['title']) . '</option>';
109
+        $optionsRoles .= '<option value="'.$record['id'].'">'.addslashes($record['title']).'</option>';
110 110
     }
111 111
 }
112 112
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
         for ($y = 1; $y < $t->nlevel; ++$y) {
122 122
             $ident .= '&nbsp;&nbsp;';
123 123
         }
124
-        $foldersList .= '<option value="' . $t->id . '">' . $ident . htmlspecialchars($t->title, ENT_COMPAT, 'UTF-8') . '</option>';
124
+        $foldersList .= '<option value="'.$t->id.'">'.$ident.htmlspecialchars($t->title, ENT_COMPAT, 'UTF-8').'</option>';
125 125
     }
126 126
 }
127 127
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
                         </button><?php
159 159
                                     echo isset($SETTINGS['ldap_mode']) === true && (int) $SETTINGS['ldap_mode'] === 1 && (int) $session->get('user-admin') === 1 ?
160 160
                                         '<button type="button" class="btn btn-primary btn-sm tp-action mr-2" data-action="ldap-sync">
161
-                            <i class="fa-solid fa-address-card mr-2"></i>' . $lang->get('ldap_synchronization') . '
161
+                            <i class="fa-solid fa-address-card mr-2"></i>' . $lang->get('ldap_synchronization').'
162 162
                         </button>' : '';
163 163
                                     ?>
164 164
                     </h3>
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 
167 167
                 <!-- /.card-header -->
168 168
                 <div class="card-body form" id="users-list">
169
-                    <label><input type="checkbox" id="warnings_display" class="tp-action pointer" data-action="refresh"><span class="ml-2 pointer"><?php echo $lang->get('display_warning_icons');?></span></label>
169
+                    <label><input type="checkbox" id="warnings_display" class="tp-action pointer" data-action="refresh"><span class="ml-2 pointer"><?php echo $lang->get('display_warning_icons'); ?></span></label>
170 170
                     <table id="table-users" class="table table-striped nowrap table-responsive-sm">
171 171
                         <thead>
172 172
                             <tr>
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
                                             <?php
232 232
                                             foreach (TP_PW_COMPLEXITY as $entry) {
233 233
                                                 echo '
234
-                                            <option value="' . $entry[0] . '">' . addslashes($entry[1]) . '</option>';
234
+                                            <option value="' . $entry[0].'">'.addslashes($entry[1]).'</option>';
235 235
                                             }
236 236
                                             ?>
237 237
                                         </select>
Please login to merge, or discard this patch.
scripts/background_tasks___items_handler_subtask.php 2 patches
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -74,7 +74,9 @@  discard block
 block discarded – undo
74 74
 if ($args['step'] === 'create_users_files_key') {
75 75
     // Loop on all files for this item
76 76
     // and encrypt them for each user
77
-    if (WIP === true) provideLog('[DEBUG] '.print_r($args['files_keys'], true), $SETTINGS);
77
+    if (WIP === true) {
78
+        provideLog('[DEBUG] '.print_r($args['files_keys'], true), $SETTINGS);
79
+    }
78 80
     foreach($args['files_keys'] as $file) {
79 81
         storeUsersShareKey(
80 82
             prefixTable('sharekeys_items'),
@@ -91,7 +93,9 @@  discard block
 block discarded – undo
91 93
 } elseif ($args['step'] === 'create_users_fields_key') {
92 94
     // Loop on all encrypted fields for this item
93 95
     // and encrypt them for each user
94
-    if (WIP === true) provideLog('[DEBUG] '.print_r($args, true), $SETTINGS);
96
+    if (WIP === true) {
97
+        provideLog('[DEBUG] '.print_r($args, true), $SETTINGS);
98
+    }
95 99
     foreach($args['fields_keys'] as $field) {
96 100
         storeUsersShareKey(
97 101
             prefixTable('sharekeys_fields'),
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
 $subtask = DB::queryfirstrow(
58 58
     'SELECT *
59
-    FROM ' . prefixTable('background_subtasks') . '
59
+    FROM ' . prefixTable('background_subtasks').'
60 60
     WHERE process_id = %i AND finished_at IS NULL
61 61
     ORDER BY increment_id ASC',
62 62
     (int) $request->request->get('subTask')
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 
65 65
 list($taskArguments) = DB::queryFirstField(
66 66
     'SELECT arguments
67
-    FROM ' . prefixTable('background_tasks') . '
67
+    FROM ' . prefixTable('background_tasks').'
68 68
     WHERE increment_id = %i',
69 69
     $subtask['process_id']
70 70
 );
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
     // Loop on all files for this item
76 76
     // and encrypt them for each user
77 77
     if (WIP === true) provideLog('[DEBUG] '.print_r($args['files_keys'], true), $SETTINGS);
78
-    foreach($args['files_keys'] as $file) {
78
+    foreach ($args['files_keys'] as $file) {
79 79
         storeUsersShareKey(
80 80
             prefixTable('sharekeys_items'),
81 81
             0,
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
     // Loop on all encrypted fields for this item
93 93
     // and encrypt them for each user
94 94
     if (WIP === true) provideLog('[DEBUG] '.print_r($args, true), $SETTINGS);
95
-    foreach($args['fields_keys'] as $field) {
95
+    foreach ($args['fields_keys'] as $field) {
96 96
         storeUsersShareKey(
97 97
             prefixTable('sharekeys_fields'),
98 98
             0,
Please login to merge, or discard this patch.
sources/downloadFile.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -149,7 +149,9 @@
 block discarded – undo
149 149
     }
150 150
     $filePath = realpath($filePath);
151 151
 
152
-    if (WIP === true) error_log('downloadFile.php: filePath: ' . $filePath." - ");
152
+    if (WIP === true) {
153
+        error_log('downloadFile.php: filePath: ' . $filePath." - ");
154
+    }
153 155
 
154 156
     if ($filePath && is_readable($filePath) && strpos($filePath, realpath($SETTINGS['path_to_upload_folder'])) === 0) {
155 157
         header('Content-Description: File Transfer');
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 ) {
77 77
     // Not allowed page
78 78
     $session->set('system-error_code', ERR_NOT_ALLOWED);
79
-    include $SETTINGS['cpassman_dir'] . '/error.php';
79
+    include $SETTINGS['cpassman_dir'].'/error.php';
80 80
     exit;
81 81
 }
82 82
 
@@ -100,19 +100,19 @@  discard block
 block discarded – undo
100 100
 $get_filename = str_replace(array("\r", "\n"), '', $get_filename);
101 101
 
102 102
 // prepare Encryption class calls
103
-header('Content-disposition: attachment; filename=' . rawurldecode(basename($get_filename)));
103
+header('Content-disposition: attachment; filename='.rawurldecode(basename($get_filename)));
104 104
 header('Content-Type: application/octet-stream');
105 105
 header('Cache-Control: must-revalidate, no-cache, no-store');
106 106
 header('Expires: 0');
107 107
 if (null !== $request->query->get('pathIsFiles') && (int) $get_pathIsFiles === 1) {
108
-    readfile($SETTINGS['path_to_files_folder'] . '/' . basename($get_filename));
108
+    readfile($SETTINGS['path_to_files_folder'].'/'.basename($get_filename));
109 109
 } else {
110 110
     // get file key
111 111
     $file_info = DB::queryfirstrow(
112 112
         'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status, f.extension AS extension,
113 113
         s.share_key AS share_key
114
-        FROM ' . prefixTable('files') . ' AS f
115
-        INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id)
114
+        FROM ' . prefixTable('files').' AS f
115
+        INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id)
116 116
         WHERE s.user_id = %i AND s.object_id = %i',
117 117
         $session->get('user-id'),
118 118
         $get_fileid
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
         // if not encrypted
132 132
         $file_info = DB::queryfirstrow(
133 133
             'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status, f.extension AS extension
134
-            FROM ' . prefixTable('files') . ' AS f
134
+            FROM ' . prefixTable('files').' AS f
135 135
             WHERE f.id = %i',
136 136
             $get_fileid
137 137
         );
@@ -141,25 +141,25 @@  discard block
 block discarded – undo
141 141
     // Set the filename of the download
142 142
     $filename = basename($file_info['name'], '.'.$file_info['extension']);
143 143
     $filename = isBase64($filename) === true ? base64_decode($filename) : $filename;
144
-    $filename = $filename . '.' . $file_info['extension'];
144
+    $filename = $filename.'.'.$file_info['extension'];
145 145
     // Get the full path to the file to be downloaded
146
-    if (file_exists($SETTINGS['path_to_upload_folder'] . '/' .TP_FILE_PREFIX . $file_info['file'])) {
147
-        $filePath = $SETTINGS['path_to_upload_folder'] . '/' . TP_FILE_PREFIX . $file_info['file'];
146
+    if (file_exists($SETTINGS['path_to_upload_folder'].'/'.TP_FILE_PREFIX.$file_info['file'])) {
147
+        $filePath = $SETTINGS['path_to_upload_folder'].'/'.TP_FILE_PREFIX.$file_info['file'];
148 148
     } else {
149
-        $filePath = $SETTINGS['path_to_upload_folder'] . '/' . TP_FILE_PREFIX . base64_decode($file_info['file']);
149
+        $filePath = $SETTINGS['path_to_upload_folder'].'/'.TP_FILE_PREFIX.base64_decode($file_info['file']);
150 150
     }
151 151
     $filePath = realpath($filePath);
152 152
 
153
-    if (WIP === true) error_log('downloadFile.php: filePath: ' . $filePath." - ");
153
+    if (WIP === true) error_log('downloadFile.php: filePath: '.$filePath." - ");
154 154
 
155 155
     if ($filePath && is_readable($filePath) && strpos($filePath, realpath($SETTINGS['path_to_upload_folder'])) === 0) {
156 156
         header('Content-Description: File Transfer');
157 157
         header('Content-Type: application/octet-stream');
158
-        header('Content-Disposition: attachment; filename="' . basename($filename) . '"');
158
+        header('Content-Disposition: attachment; filename="'.basename($filename).'"');
159 159
         header('Expires: 0');
160 160
         header('Cache-Control: must-revalidate');
161 161
         header('Pragma: public');
162
-        header('Content-Length: ' . filesize($filePath));
162
+        header('Content-Length: '.filesize($filePath));
163 163
         flush(); // Clear system output buffer
164 164
         if (empty($fileContent) === true) {
165 165
             // deepcode ignore PT: File and path are secured directly inside the function decryptFile()
Please login to merge, or discard this patch.
scripts/background_tasks___functions.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -103,10 +103,10 @@  discard block
 block discarded – undo
103 103
  */
104 104
 function provideLog(string $message, array $SETTINGS)
105 105
 {
106
-    error_log((string) date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], time()) . ' - '.$message);
106
+    error_log((string) date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], time()).' - '.$message);
107 107
 }
108 108
 
109
-function performVisibleFoldersHtmlUpdate (int $user_id)
109
+function performVisibleFoldersHtmlUpdate(int $user_id)
110 110
 {
111 111
     $html = [];
112 112
 
@@ -116,10 +116,10 @@  discard block
 block discarded – undo
116 116
 
117 117
     // get current folders visible for user
118 118
     $cache_tree = DB::queryFirstRow(
119
-        'SELECT increment_id, data FROM ' . prefixTable('cache_tree') . ' WHERE user_id = %i',
119
+        'SELECT increment_id, data FROM '.prefixTable('cache_tree').' WHERE user_id = %i',
120 120
         $user_id
121 121
     );
122
-    $folders = json_decode($cache_tree['data'], true);//print_r($folders);
122
+    $folders = json_decode($cache_tree['data'], true); //print_r($folders);
123 123
     foreach ($folders as $folder) {
124 124
         $idFolder = (int) explode("li_", $folder['id'])[1];
125 125
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 
133 133
         // get folder info
134 134
         $folder = DB::queryFirstRow(
135
-            'SELECT title, parent_id, personal_folder FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
135
+            'SELECT title, parent_id, personal_folder FROM '.prefixTable('nested_tree').' WHERE id = %i',
136 136
             $idFolder
137 137
         );
138 138
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 function subTaskStatus($taskId)
168 168
 {
169 169
     $subTasks = DB::query(
170
-        'SELECT * FROM ' . prefixTable('background_subtasks') . ' WHERE task_id = %i',
170
+        'SELECT * FROM '.prefixTable('background_subtasks').' WHERE task_id = %i',
171 171
         $taskId
172 172
     );
173 173
 
Please login to merge, or discard this patch.
sources/tasks.queries.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 ) {
79 79
     // Not allowed page
80 80
     $session->set('system-error_code', ERR_NOT_ALLOWED);
81
-    include $SETTINGS['cpassman_dir'] . '/error.php';
81
+    include $SETTINGS['cpassman_dir'].'/error.php';
82 82
     exit;
83 83
 }
84 84
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
     // get exec from processes table
164 164
     $rows = DB::query(
165 165
         'SELECT max(finished_at), process_type
166
-        FROM ' . prefixTable('background_tasks') . '
166
+        FROM ' . prefixTable('background_tasks').'
167 167
         GROUP BY process_type'
168 168
     );
169 169
     foreach ($rows as $row) {
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
     // get exec from background_tasks_log table
180 180
     $rows = DB::query(
181 181
         'SELECT MAX(finished_at) AS max_finished_at, job AS process_type 
182
-        FROM ' . prefixTable('background_tasks_logs') . '
182
+        FROM ' . prefixTable('background_tasks_logs').'
183 183
         WHERE finished_at >= UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 7 DAY))
184 184
         GROUP BY process_type'
185 185
     );
Please login to merge, or discard this patch.
sources/utilities.queries.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 ) {
80 80
     // Not allowed page
81 81
     $session->set('system-error_code', ERR_NOT_ALLOWED);
82
-    include $SETTINGS['cpassman_dir'] . '/error.php';
82
+    include $SETTINGS['cpassman_dir'].'/error.php';
83 83
     exit;
84 84
 }
85 85
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
             $arrFolders = array();
131 131
             $rows = DB::query(
132 132
                 'SELECT valeur, intitule
133
-                FROM ' . prefixTable('misc') . '
133
+                FROM ' . prefixTable('misc').'
134 134
                 WHERE type  = %s',
135 135
                 'folder_deleted'
136 136
             );
@@ -152,10 +152,10 @@  discard block
 block discarded – undo
152 152
                 'SELECT u.login as login, u.name as name, u.lastname as lastname,
153 153
                 i.id as id, i.label as label,
154 154
                 i.id_tree as id_tree, l.date as date, n.title as folder_title
155
-                FROM ' . prefixTable('log_items') . ' as l
156
-                INNER JOIN ' . prefixTable('items') . ' as i ON (l.id_item=i.id)
157
-                LEFT JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id)
158
-                LEFT JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree=n.id)
155
+                FROM ' . prefixTable('log_items').' as l
156
+                INNER JOIN ' . prefixTable('items').' as i ON (l.id_item=i.id)
157
+                LEFT JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id)
158
+                LEFT JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree=n.id)
159 159
                 WHERE i.inactif = %i
160 160
                 AND l.action = %s',
161 161
                 1,
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
                             'label' => $record['label'],
178 178
                             'date' => date($SETTINGS['date_format'], (int) $record['date']),
179 179
                             'login' => $record['login'],
180
-                            'name' => $record['name'] . ' ' . $record['lastname'],
180
+                            'name' => $record['name'].' '.$record['lastname'],
181 181
                             'folder_label' => $record['folder_title'],
182 182
                             'folder_deleted' => $thisFolder,
183 183
                         )
@@ -235,10 +235,10 @@  discard block
 block discarded – undo
235 235
             foreach ($post_folders as $folderId) {
236 236
                 $data = DB::queryfirstrow(
237 237
                     'SELECT valeur
238
-                    FROM ' . prefixTable('misc') . "
238
+                    FROM ' . prefixTable('misc')."
239 239
                     WHERE type = 'folder_deleted'
240 240
                     AND intitule = %s",
241
-                    'f' . $folderId
241
+                    'f'.$folderId
242 242
                 );
243 243
                 if ((int) $data['valeur'] !== 0) {
244 244
                     $folderData = explode(', ', $data['valeur']);
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
                         prefixTable('misc'),
266 266
                         'type = %s AND intitule = %s',
267 267
                         'folder_deleted',
268
-                        'f' . $folderId
268
+                        'f'.$folderId
269 269
                     );
270 270
 
271 271
                     // Restore all items in this folder
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
                     // Get list of all items in thos folder
282 282
                     $items = DB::query(
283 283
                         'SELECT id
284
-                        FROM ' . prefixTable('items') . '
284
+                        FROM ' . prefixTable('items').'
285 285
                         WHERE id_tree = %i',
286 286
                         $folderId
287 287
                     );
@@ -370,10 +370,10 @@  discard block
 block discarded – undo
370 370
             foreach ($post_folders as $folderId) {
371 371
                 $data = DB::queryfirstrow(
372 372
                     'SELECT valeur
373
-                    FROM ' . prefixTable('misc') . "
373
+                    FROM ' . prefixTable('misc')."
374 374
                     WHERE type = 'folder_deleted'
375 375
                     AND intitule = %s",
376
-                    'f' . $folderId
376
+                    'f'.$folderId
377 377
                 );
378 378
                 if ((int) $data['valeur'] !== 0) {
379 379
                     $exploded = explode(',', $data['valeur']);
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
                         prefixTable('misc'),
385 385
                         'type = %s AND intitule = %s',
386 386
                         'folder_deleted',
387
-                        'f' . $folderData[0]
387
+                        'f'.$folderData[0]
388 388
                     );
389 389
 
390 390
                     // Delete all items in this folder
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
                     // Get list of all items in thos folder
399 399
                     $items = DB::query(
400 400
                         'SELECT id
401
-                        FROM ' . prefixTable('items') . '
401
+                        FROM ' . prefixTable('items').'
402 402
                         WHERE id_tree = %i',
403 403
                         $folderData[0]
404 404
                     );
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
                         // Delete all fields
416 416
                         $fields = DB::query(
417 417
                             'SELECT id
418
-                            FROM ' . prefixTable('categories_items') . '
418
+                            FROM ' . prefixTable('categories_items').'
419 419
                             WHERE item_id = %i',
420 420
                             $folderData[0]
421 421
                         );
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
                         // Delete all files
436 436
                         $files = DB::query(
437 437
                             'SELECT id
438
-                            FROM ' . prefixTable('files') . '
438
+                            FROM ' . prefixTable('files').'
439 439
                             WHERE id_item = %i',
440 440
                             $folderData[0]
441 441
                         );
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
                 // Delete sharekey fields
493 493
                 $itemFields = DB::query(
494 494
                     'SELECT id
495
-                    FROM ' . prefixTable('categories_items') . '
495
+                    FROM ' . prefixTable('categories_items').'
496 496
                     WHERE item_id = %i',
497 497
                     $itemId
498 498
                 );
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
                 // Delete sharekey files
508 508
                 $itemFiles = DB::query(
509 509
                     'SELECT id
510
-                    FROM ' . prefixTable('files') . '
510
+                    FROM ' . prefixTable('files').'
511 511
                     WHERE id_item = %i',
512 512
                     $itemId
513 513
                 );
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
             ) {
585 585
                 if ($post_log_type === 'items') {
586 586
                     DB::query(
587
-                        'SELECT * FROM ' . prefixTable('log_items') . '
587
+                        'SELECT * FROM '.prefixTable('log_items').'
588 588
                         WHERE (date BETWEEN %i AND %i)'
589 589
                         . ($post_filter_action === 'all' ? '' : ' AND action = "'.$post_filter_action.'"')
590 590
                         . ((int) $post_filter_user === -1 ? '' : ' AND id_user = '.(int) $post_filter_user),
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
                 } elseif ($post_log_type === 'connections') {
605 605
                     //db::debugmode(true);
606 606
                     DB::query(
607
-                        'SELECT * FROM ' . prefixTable('log_system') . '
607
+                        'SELECT * FROM '.prefixTable('log_system').'
608 608
                         WHERE type=%s '
609 609
                         . 'AND (date BETWEEN %i AND %i)'
610 610
                         . ($post_filter_action === 'all' ? '' : ' AND action = '.$post_filter_action)
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
                     );
628 628
                 } elseif ($post_log_type === 'errors') {
629 629
                     DB::query(
630
-                        'SELECT * FROM ' . prefixTable('log_system') . ' WHERE type=%s ' .
630
+                        'SELECT * FROM '.prefixTable('log_system').' WHERE type=%s '.
631 631
                             'AND (date BETWEEN %i AND %i)',
632 632
                         'error',
633 633
                         $post_date_from,
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
                     );
645 645
                 } elseif ($post_log_type === 'copy') {
646 646
                     DB::query(
647
-                        'SELECT * FROM ' . prefixTable('log_items') . ' WHERE action=%s ' .
647
+                        'SELECT * FROM '.prefixTable('log_items').' WHERE action=%s '.
648 648
                             'AND (date BETWEEN %i AND %i)',
649 649
                         'at_copy',
650 650
                         $post_date_from,
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
                     );
662 662
                 } elseif ($post_log_type === 'admin') {
663 663
                     DB::query(
664
-                        'SELECT * FROM ' . prefixTable('log_system') . ' WHERE type=%s ' .
664
+                        'SELECT * FROM '.prefixTable('log_system').' WHERE type=%s '.
665 665
                             'AND (date BETWEEN %i AND %i)',
666 666
                         'admin_action',
667 667
                         $post_date_from,
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
                     );
679 679
                 } elseif ($post_log_type === 'failed') {
680 680
                     DB::query(
681
-                        'SELECT * FROM ' . prefixTable('log_system') . ' WHERE type=%s ' .
681
+                        'SELECT * FROM '.prefixTable('log_system').' WHERE type=%s '.
682 682
                             'AND (date BETWEEN %i AND %i)',
683 683
                         'failed_auth',
684 684
                         $post_date_from,
@@ -749,19 +749,19 @@  discard block
 block discarded – undo
749 749
             // Get info about task
750 750
             $taskInfo = DB::queryfirstrow(
751 751
                 'SELECT p.process_type as process_type
752
-                FROM ' . prefixTable('background_tasks') . ' as p
752
+                FROM ' . prefixTable('background_tasks').' as p
753 753
                 WHERE p.increment_id = %i',
754 754
                 $post_id
755 755
             );
756 756
             if ($taskInfo !== null) {
757 757
                 // delete task
758 758
                 DB::query(
759
-                    'DELETE FROM ' . prefixTable('background_subtasks') . '
759
+                    'DELETE FROM '.prefixTable('background_subtasks').'
760 760
                     WHERE task_id = %i',
761 761
                     $post_id
762 762
                 );
763 763
                 DB::query(
764
-                    'DELETE FROM ' . prefixTable('background_tasks') . '
764
+                    'DELETE FROM '.prefixTable('background_tasks').'
765 765
                     WHERE increment_id = %i',
766 766
                     $post_id
767 767
                 );
@@ -828,7 +828,7 @@  discard block
 block discarded – undo
828 828
                         ->setDayOfMonth('*')
829 829
                         ->setMonths('*')
830 830
                         ->setDayOfWeek('*')
831
-                        ->setTaskCommandLine($phpBinaryPath . ' ' . $SETTINGS['cpassman_dir'] . '/sources/scheduler.php')
831
+                        ->setTaskCommandLine($phpBinaryPath.' '.$SETTINGS['cpassman_dir'].'/sources/scheduler.php')
832 832
                         ->setComments('Teampass scheduler');
833 833
                     
834 834
                     $crontabRepository->addJob($crontabJob);
Please login to merge, or discard this patch.
sources/logs.datatables.php 1 patch
Spacing   +66 added lines, -67 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 ) {
79 79
     // Not allowed page
80 80
     $session->set('system-error_code', ERR_NOT_ALLOWED);
81
-    include $SETTINGS['cpassman_dir'] . '/error.php';
81
+    include $SETTINGS['cpassman_dir'].'/error.php';
82 82
     exit;
83 83
 }
84 84
 
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
 
128 128
             $columnIndex = filter_var($order['column'], FILTER_SANITIZE_NUMBER_INT);
129 129
             $dir = filter_var($order['dir'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
130
-            $sOrder = 'ORDER BY ' . $aColumns[$columnIndex] . ' ' . $dir . ' ';
130
+            $sOrder = 'ORDER BY '.$aColumns[$columnIndex].' '.$dir.' ';
131 131
         } else {
132
-            $sOrder = 'ORDER BY ' . $aColumns[0] . ' DESC';
132
+            $sOrder = 'ORDER BY '.$aColumns[0].' DESC';
133 133
         }
134 134
     }
135 135
 
@@ -140,9 +140,9 @@  discard block
 block discarded – undo
140 140
         if ($searchValue !== '') {
141 141
             $sWhere .= ' AND (';
142 142
             foreach ($aColumns as $column) {
143
-                $sWhere .= $column . " LIKE '%" . $searchValue . "%' OR ";
143
+                $sWhere .= $column." LIKE '%".$searchValue."%' OR ";
144 144
             }
145
-            $sWhere = substr_replace($sWhere, '', -3) . ')';
145
+            $sWhere = substr_replace($sWhere, '', -3).')';
146 146
         }
147 147
     }
148 148
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
            * Output
168 168
         */
169 169
     $sOutput = '{';
170
-    $sOutput .= '"sEcho": '. $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
170
+    $sOutput .= '"sEcho": '.$request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
171 171
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
172 172
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
173 173
     $sOutput .= '"aaData": ';
@@ -206,9 +206,9 @@  discard block
 block discarded – undo
206 206
 
207 207
         $columnIndex = filter_var($order['column'], FILTER_SANITIZE_NUMBER_INT);
208 208
         $dir = filter_var($order['dir'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
209
-        $sOrder = 'ORDER BY ' . $aColumns[$columnIndex] . ' ' . $dir . ' ';
209
+        $sOrder = 'ORDER BY '.$aColumns[$columnIndex].' '.$dir.' ';
210 210
     } else {
211
-        $sOrder = 'ORDER BY ' . $aColumns[0] . ' DESC';
211
+        $sOrder = 'ORDER BY '.$aColumns[0].' DESC';
212 212
     }
213 213
 
214 214
     // Filtering
@@ -217,9 +217,9 @@  discard block
 block discarded – undo
217 217
     if ($sSearch !== '') {
218 218
         $sWhere .= ' AND (';
219 219
         foreach ($aColumns as $i => $column) {
220
-            $sWhere .= $column . " LIKE '%". filter_var($sSearch, FILTER_SANITIZE_FULL_SPECIAL_CHARS) . "%' OR ";
220
+            $sWhere .= $column." LIKE '%".filter_var($sSearch, FILTER_SANITIZE_FULL_SPECIAL_CHARS)."%' OR ";
221 221
         }
222
-        $sWhere = substr_replace($sWhere, '', -3) . ')';
222
+        $sWhere = substr_replace($sWhere, '', -3).')';
223 223
     }
224 224
 
225 225
     $iTotal = DB::queryFirstField(
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
     $iFilteredTotal = DB::count();
243 243
     // Output
244 244
     $sOutput = '{';
245
-    $sOutput .= '"sEcho": '. $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
245
+    $sOutput .= '"sEcho": '.$request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
246 246
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
247 247
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
248 248
     $sOutput .= '"aaData": ';
@@ -281,9 +281,9 @@  discard block
 block discarded – undo
281 281
 
282 282
         $columnIndex = filter_var($order['column'], FILTER_SANITIZE_NUMBER_INT);
283 283
         $dir = filter_var($order['dir'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
284
-        $sOrder = 'ORDER BY ' . $aColumns[$columnIndex] . ' ' . $dir . ' ';
284
+        $sOrder = 'ORDER BY '.$aColumns[$columnIndex].' '.$dir.' ';
285 285
     } else {
286
-        $sOrder = 'ORDER BY ' . $aColumns[0] . ' DESC';
286
+        $sOrder = 'ORDER BY '.$aColumns[0].' DESC';
287 287
     }
288 288
 
289 289
     // Filtering
@@ -292,9 +292,9 @@  discard block
 block discarded – undo
292 292
     if ($searchValue !== '') {
293 293
         $sWhere .= ' AND (';
294 294
         foreach ($aColumns as $column) {
295
-            $sWhere .= $column . " LIKE '%" . filter_var($searchValue, FILTER_SANITIZE_FULL_SPECIAL_CHARS) . "%' OR ";
295
+            $sWhere .= $column." LIKE '%".filter_var($searchValue, FILTER_SANITIZE_FULL_SPECIAL_CHARS)."%' OR ";
296 296
         }
297
-        $sWhere = substr_replace($sWhere, '', -3) . ')';
297
+        $sWhere = substr_replace($sWhere, '', -3).')';
298 298
     }
299 299
 
300 300
     $iTotal = DB::queryFirstField(
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
     $iFilteredTotal = DB::count();
318 318
     // Output
319 319
     $sOutput = '{';
320
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
320
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
321 321
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
322 322
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
323 323
     $sOutput .= '"aaData": ';
@@ -356,9 +356,9 @@  discard block
 block discarded – undo
356 356
         
357 357
         $columnIndex = filter_var($order['column'], FILTER_SANITIZE_NUMBER_INT);
358 358
         $dir = filter_var($order['dir'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
359
-        $sOrder = 'ORDER BY ' . $aColumns[$columnIndex] . ' ' . $dir . ' ';
359
+        $sOrder = 'ORDER BY '.$aColumns[$columnIndex].' '.$dir.' ';
360 360
     } else {
361
-        $sOrder = 'ORDER BY ' . $aColumns[0] . ' DESC';
361
+        $sOrder = 'ORDER BY '.$aColumns[0].' DESC';
362 362
     }
363 363
 
364 364
     // Filtering
@@ -367,9 +367,9 @@  discard block
 block discarded – undo
367 367
     if ($searchValue !== '') {
368 368
         $sWhere .= ' AND (';
369 369
         foreach ($aColumns as $column) {
370
-            $sWhere .= $column . " LIKE '%" . filter_var($searchValue, FILTER_SANITIZE_FULL_SPECIAL_CHARS) . "%' OR ";
370
+            $sWhere .= $column." LIKE '%".filter_var($searchValue, FILTER_SANITIZE_FULL_SPECIAL_CHARS)."%' OR ";
371 371
         }
372
-        $sWhere = substr_replace($sWhere, '', -3) . ')';
372
+        $sWhere = substr_replace($sWhere, '', -3).')';
373 373
     }
374 374
 
375 375
     $iTotal = DB::queryFirstField(
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
          * Output
392 392
         */
393 393
     $sOutput = '{';
394
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
394
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
395 395
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
396 396
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
397 397
     $sOutput .= '"aaData": [ ';
@@ -459,9 +459,9 @@  discard block
 block discarded – undo
459 459
 
460 460
         $columnIndex = filter_var($order['column'], FILTER_SANITIZE_NUMBER_INT);
461 461
         $dir = filter_var($order['dir'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
462
-        $sOrder = 'ORDER BY ' . $aColumns[$columnIndex] . ' ' . $dir . ' ';
462
+        $sOrder = 'ORDER BY '.$aColumns[$columnIndex].' '.$dir.' ';
463 463
     } else {
464
-        $sOrder = 'ORDER BY ' . $aColumns[0] . ' DESC';
464
+        $sOrder = 'ORDER BY '.$aColumns[0].' DESC';
465 465
     }
466 466
 
467 467
     // Filtering
@@ -471,12 +471,12 @@  discard block
 block discarded – undo
471 471
     if ($searchValue !== '') {
472 472
         $sWhere .= ' WHERE (';
473 473
         if (isset($search['column']) && $search['column'] !== 'all') {
474
-            $sWhere .= $search['column'] . " LIKE '%" . filter_var($searchValue, FILTER_SANITIZE_FULL_SPECIAL_CHARS) . "%') ";
474
+            $sWhere .= $search['column']." LIKE '%".filter_var($searchValue, FILTER_SANITIZE_FULL_SPECIAL_CHARS)."%') ";
475 475
         } else {
476 476
             foreach ($aColumns as $column) {
477
-                $sWhere .= $column . " LIKE '%" . filter_var($searchValue, FILTER_SANITIZE_FULL_SPECIAL_CHARS) . "%' OR ";
477
+                $sWhere .= $column." LIKE '%".filter_var($searchValue, FILTER_SANITIZE_FULL_SPECIAL_CHARS)."%' OR ";
478 478
             }
479
-            $sWhere = substr($sWhere, 0, -3) . ') ';
479
+            $sWhere = substr($sWhere, 0, -3).') ';
480 480
         }
481 481
     }
482 482
     
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
     $iFilteredTotal = DB::count();
506 506
     // Output
507 507
     $sOutput = '{';
508
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
508
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
509 509
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
510 510
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
511 511
     $sOutput .= '"aaData": [ ';
@@ -554,9 +554,9 @@  discard block
 block discarded – undo
554 554
 
555 555
         $columnIndex = filter_var($order['column'], FILTER_SANITIZE_NUMBER_INT);
556 556
         $dir = filter_var($order['dir'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
557
-        $sOrder = 'ORDER BY ' . $aColumns[$columnIndex] . ' ' . $dir . ' ';
557
+        $sOrder = 'ORDER BY '.$aColumns[$columnIndex].' '.$dir.' ';
558 558
     } else {
559
-        $sOrder = 'ORDER BY ' . $aColumns[0] . ' DESC';
559
+        $sOrder = 'ORDER BY '.$aColumns[0].' DESC';
560 560
     }
561 561
 
562 562
     // Filtering
@@ -565,9 +565,9 @@  discard block
 block discarded – undo
565 565
     if ($searchValue !== '') {
566 566
         $sWhere .= ' AND (';
567 567
         foreach ($aColumns as $column) {
568
-            $sWhere .= $column . " LIKE '%" . filter_var($searchValue, FILTER_SANITIZE_FULL_SPECIAL_CHARS) . "%' OR ";
568
+            $sWhere .= $column." LIKE '%".filter_var($searchValue, FILTER_SANITIZE_FULL_SPECIAL_CHARS)."%' OR ";
569 569
         }
570
-        $sWhere = substr_replace($sWhere, '', -3) . ')';
570
+        $sWhere = substr_replace($sWhere, '', -3).')';
571 571
     }
572 572
 
573 573
     $iTotal = DB::queryFirstField(
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
         $iTotal = 0;
589 589
     }
590 590
     $sOutput = '{';
591
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
591
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
592 592
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
593 593
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
594 594
     $sOutput .= '"aaData": ';
@@ -630,9 +630,9 @@  discard block
 block discarded – undo
630 630
 
631 631
         $columnIndex = filter_var($order['column'], FILTER_SANITIZE_NUMBER_INT);
632 632
         $dir = filter_var($order['dir'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
633
-        $sOrder = 'ORDER BY ' . $aColumns[$columnIndex] . ' ' . $dir . ' ';
633
+        $sOrder = 'ORDER BY '.$aColumns[$columnIndex].' '.$dir.' ';
634 634
     } else {
635
-        $sOrder = 'ORDER BY ' . $aColumns[0] . ' DESC';
635
+        $sOrder = 'ORDER BY '.$aColumns[0].' DESC';
636 636
     }
637 637
 
638 638
     // Filtering
@@ -641,9 +641,9 @@  discard block
 block discarded – undo
641 641
     if ($searchValue !== '') {
642 642
         $sWhere .= ' AND (';
643 643
         foreach ($aColumns as $column) {
644
-            $sWhere .= $column . " LIKE '%" . filter_var($searchValue, FILTER_SANITIZE_FULL_SPECIAL_CHARS) . "%' OR ";
644
+            $sWhere .= $column." LIKE '%".filter_var($searchValue, FILTER_SANITIZE_FULL_SPECIAL_CHARS)."%' OR ";
645 645
         }
646
-        $sWhere = substr_replace($sWhere, '', -3) . ')';
646
+        $sWhere = substr_replace($sWhere, '', -3).')';
647 647
     }
648 648
 
649 649
     $iTotal = DB::queryFirstField(
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
     $iFilteredTotal = DB::count();
666 666
     // Output
667 667
     $sOutput = '{';
668
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
668
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
669 669
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
670 670
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
671 671
     $sOutput .= '"aaData": ';
@@ -702,9 +702,9 @@  discard block
 block discarded – undo
702 702
 
703 703
         $columnIndex = filter_var($order['column'], FILTER_SANITIZE_NUMBER_INT);
704 704
         $dir = filter_var($order['dir'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
705
-        $sOrder = 'ORDER BY ' . $aColumns[$columnIndex] . ' ' . $dir . ' ';
705
+        $sOrder = 'ORDER BY '.$aColumns[$columnIndex].' '.$dir.' ';
706 706
     } else {
707
-        $sOrder = 'ORDER BY ' . $aColumns[0] . ' DESC';
707
+        $sOrder = 'ORDER BY '.$aColumns[0].' DESC';
708 708
     }
709 709
 
710 710
     // Filtering
@@ -713,9 +713,9 @@  discard block
 block discarded – undo
713 713
     if ($searchValue !== '') {
714 714
         $sWhere = ' WHERE (';
715 715
         foreach ($aColumns as $column) {
716
-            $sWhere .= $column . " LIKE '%" . filter_var($searchValue, FILTER_SANITIZE_FULL_SPECIAL_CHARS) . "%' OR ";
716
+            $sWhere .= $column." LIKE '%".filter_var($searchValue, FILTER_SANITIZE_FULL_SPECIAL_CHARS)."%' OR ";
717 717
         }
718
-        $sWhere = substr_replace($sWhere, '', -3) . ')';
718
+        $sWhere = substr_replace($sWhere, '', -3).')';
719 719
     }
720 720
 
721 721
     $iTotal = DB::queryFirstField(
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
     $iFilteredTotal = DB::count();
739 739
     // Output
740 740
     $sOutput = '{';
741
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
741
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
742 742
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
743 743
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
744 744
     $sOutput .= '"aaData": ';
@@ -780,9 +780,9 @@  discard block
 block discarded – undo
780 780
 
781 781
         $columnIndex = filter_var($order['column'], FILTER_SANITIZE_NUMBER_INT);
782 782
         $dir = filter_var($order['dir'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
783
-        $sOrder = 'ORDER BY ' . $aColumns[$columnIndex] . ' ' . $dir . ' ';
783
+        $sOrder = 'ORDER BY '.$aColumns[$columnIndex].' '.$dir.' ';
784 784
     } else {
785
-        $sOrder = 'ORDER BY ' . $aColumns[0] . ' DESC';
785
+        $sOrder = 'ORDER BY '.$aColumns[0].' DESC';
786 786
     }
787 787
 
788 788
     // Where clause
@@ -791,9 +791,9 @@  discard block
 block discarded – undo
791 791
     if ($searchValue !== '') {
792 792
         $sWhere .= ' AND (';
793 793
         foreach ($aColumns as $column) {
794
-            $sWhere .= $column . " LIKE '%" . filter_var($searchValue, FILTER_SANITIZE_FULL_SPECIAL_CHARS) . "%' OR ";
794
+            $sWhere .= $column." LIKE '%".filter_var($searchValue, FILTER_SANITIZE_FULL_SPECIAL_CHARS)."%' OR ";
795 795
         }
796
-        $sWhere = substr_replace($sWhere, '', -3) . ') ';
796
+        $sWhere = substr_replace($sWhere, '', -3).') ';
797 797
     }
798 798
     $sWhere .= ') ';
799 799
     $iTotal = DB::queryFirstField(
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
     $iFilteredTotal = DB::count();
812 812
     // Output
813 813
     $sOutput = '{';
814
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
814
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
815 815
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
816 816
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
817 817
     $sOutput .= '"aaData": ';
@@ -860,9 +860,9 @@  discard block
 block discarded – undo
860 860
 
861 861
         $columnIndex = filter_var($order['column'], FILTER_SANITIZE_NUMBER_INT);
862 862
         $dir = filter_var($order['dir'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
863
-        $sOrder = 'ORDER BY ' . $aColumns[$columnIndex] . ' ' . $dir . ' ';
863
+        $sOrder = 'ORDER BY '.$aColumns[$columnIndex].' '.$dir.' ';
864 864
     } else {
865
-        $sOrder = 'ORDER BY ' . $aColumns[0] . ' DESC';
865
+        $sOrder = 'ORDER BY '.$aColumns[0].' DESC';
866 866
     }
867 867
 
868 868
     // Where clause
@@ -871,9 +871,9 @@  discard block
 block discarded – undo
871 871
     if ($searchValue !== '') {
872 872
         $sWhere .= ' AND (';
873 873
         foreach ($aColumns as $column) {
874
-            $sWhere .= $column . " LIKE '%" . filter_var($searchValue, FILTER_SANITIZE_FULL_SPECIAL_CHARS) . "%' OR ";
874
+            $sWhere .= $column." LIKE '%".filter_var($searchValue, FILTER_SANITIZE_FULL_SPECIAL_CHARS)."%' OR ";
875 875
         }
876
-        $sWhere = substr_replace($sWhere, '', -3) . ')';
876
+        $sWhere = substr_replace($sWhere, '', -3).')';
877 877
     }
878 878
     $sWhere .= ') ';
879 879
     DB::debugmode(false);
@@ -894,7 +894,7 @@  discard block
 block discarded – undo
894 894
     $iFilteredTotal = DB::count();
895 895
     // Output
896 896
     $sOutput = '{';
897
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
897
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
898 898
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
899 899
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
900 900
     $sOutput .= '"aaData": ';
@@ -909,7 +909,7 @@  discard block
 block discarded – undo
909 909
         //col1
910 910
         $sOutput .= '"<span data-done=\"'.$record['is_in_progress'].'\" data-type=\"'.$record['process_type'].'\" data-process-id=\"'.$record['increment_id'].'\"></span>", ';
911 911
         //col2
912
-        $sOutput .= '"'.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['created_at']).'", ';
912
+        $sOutput .= '"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['created_at']).'", ';
913 913
         //col3
914 914
         //$sOutput .= '"'.($record['updated_at'] === '' ? '-' : date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['updated_at'])).'", ';
915 915
         $sOutput .= '"<div class=\"progress mt-2\"><div class=\"progress-bar\" style=\"width: '.$subtaskProgress.'\">'.$subtaskProgress.'</div></div>", ';
@@ -919,7 +919,7 @@  discard block
 block discarded – undo
919 919
         // col5
920 920
         if (in_array($record['process_type'], array('create_user_keys', 'item_copy')) === true) {
921 921
             $data_user = DB::queryfirstrow(
922
-                'SELECT name, lastname FROM ' . prefixTable('users') . '
922
+                'SELECT name, lastname FROM '.prefixTable('users').'
923 923
                 WHERE id = %i',
924 924
                 json_decode($record['arguments'], true)['new_user_id']
925 925
             );
@@ -951,9 +951,9 @@  discard block
 block discarded – undo
951 951
 
952 952
         $columnIndex = filter_var($order['column'], FILTER_SANITIZE_NUMBER_INT);
953 953
         $dir = filter_var($order['dir'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
954
-        $sOrder = 'ORDER BY ' . $aColumns[$columnIndex] . ' ' . $dir . ' ';
954
+        $sOrder = 'ORDER BY '.$aColumns[$columnIndex].' '.$dir.' ';
955 955
     } else {
956
-        $sOrder = 'ORDER BY ' . $aColumns[0] . ' DESC';
956
+        $sOrder = 'ORDER BY '.$aColumns[0].' DESC';
957 957
     }
958 958
 
959 959
     // Where clause
@@ -962,9 +962,9 @@  discard block
 block discarded – undo
962 962
     if ($searchValue !== '') {
963 963
         $sWhere .= ' AND (';
964 964
         foreach ($aColumns as $column) {
965
-            $sWhere .= $column . " LIKE '%" . filter_var($searchValue, FILTER_SANITIZE_FULL_SPECIAL_CHARS) . "%' OR ";
965
+            $sWhere .= $column." LIKE '%".filter_var($searchValue, FILTER_SANITIZE_FULL_SPECIAL_CHARS)."%' OR ";
966 966
         }
967
-        $sWhere = substr_replace($sWhere, '', -3) . ')';
967
+        $sWhere = substr_replace($sWhere, '', -3).')';
968 968
     }
969 969
     $sWhere .= ') ';
970 970
     
@@ -987,7 +987,7 @@  discard block
 block discarded – undo
987 987
     $iFilteredTotal = DB::count();
988 988
     // Output
989 989
     $sOutput = '{';
990
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
990
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
991 991
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
992 992
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
993 993
     $sOutput .= '"aaData": ';
@@ -1003,13 +1003,12 @@  discard block
 block discarded – undo
1003 1003
         //col1
1004 1004
         $sOutput .= '"", ';
1005 1005
         //col2
1006
-        $sOutput .= '"'.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['created_at']).'", ';
1006
+        $sOutput .= '"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['created_at']).'", ';
1007 1007
         //col3
1008 1008
         $sOutput .= is_null($record['started_at']) === false ?
1009
-            ('"'.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['started_at']).'", ') :
1010
-                ('"'.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['created_at']).'", ');
1009
+            ('"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['started_at']).'", ') : ('"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['created_at']).'", ');
1011 1010
         //col4
1012
-        $sOutput .= '"'.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['finished_at']).'", ';
1011
+        $sOutput .= '"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['finished_at']).'", ';
1013 1012
         // col7
1014 1013
         $sOutput .= '"'.gmdate('H:i:s', (int) $record['finished_at'] - (is_null($record['started_at']) === false ? (int) $record['started_at'] : (int) $record['created_at'])).'",';
1015 1014
         //col5
@@ -1028,7 +1027,7 @@  discard block
 block discarded – undo
1028 1027
         $newUserId = array_key_exists('new_user_id', $arguments) ? $arguments['new_user_id'] : null;
1029 1028
         if ($record['process_type'] === 'create_user_keys' && is_null($newUserId) === false && empty($newUserId) === false) {
1030 1029
             $data_user = DB::queryfirstrow(
1031
-                'SELECT name, lastname, login FROM ' . prefixTable('users') . '
1030
+                'SELECT name, lastname, login FROM '.prefixTable('users').'
1032 1031
                 WHERE id = %i',
1033 1032
                 $newUserId
1034 1033
             );
@@ -1044,7 +1043,7 @@  discard block
 block discarded – undo
1044 1043
         } elseif ($record['process_type'] === 'user_build_cache_tree') {
1045 1044
             $user = json_decode($record['arguments'], true)['user_id'];
1046 1045
             $data_user = DB::queryfirstrow(
1047
-                'SELECT name, lastname, login FROM ' . prefixTable('users') . '
1046
+                'SELECT name, lastname, login FROM '.prefixTable('users').'
1048 1047
                 WHERE id = %i',
1049 1048
                 $user
1050 1049
             );
@@ -1078,7 +1077,7 @@  discard block
 block discarded – undo
1078 1077
 {
1079 1078
     $subtasks = DB::query(
1080 1079
         'SELECT *
1081
-        FROM ' . prefixTable('background_subtasks') . '
1080
+        FROM ' . prefixTable('background_subtasks').'
1082 1081
         WHERE task_id = %i',
1083 1082
         $id
1084 1083
     );
@@ -1094,5 +1093,5 @@  discard block
 block discarded – undo
1094 1093
         $i++;
1095 1094
     }
1096 1095
 
1097
-    return ($finished_nb !== 0 ? pourcentage($finished_nb, $nb, 100) : 0) .'%';
1096
+    return ($finished_nb !== 0 ? pourcentage($finished_nb, $nb, 100) : 0).'%';
1098 1097
 }
1099 1098
\ No newline at end of file
Please login to merge, or discard this patch.