Completed
Push — master ( 8da2eb...bc09ea )
by Nils
01:25 queued 59s
created
sources/identify.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
     $sessionPwdAttempts = $session->get('pwd_attempts');
148 148
     $sessionUrl = $session->get('user-initial_url');
149 149
     $server = [];
150
-    $server['PHP_AUTH_USER'] =  $request->getUser();
150
+    $server['PHP_AUTH_USER'] = $request->getUser();
151 151
     $server['PHP_AUTH_PW'] = $request->getPassword();
152 152
     
153 153
     // decrypt and retreive data in JSON format
@@ -162,18 +162,18 @@  discard block
 block discarded – undo
162 162
     }
163 163
 
164 164
     // Check if Duo auth is in progress and pass the pw and login back to the standard login process
165
-    if(
165
+    if (
166 166
         isKeyExistingAndEqual('duo', 1, $SETTINGS) === true
167 167
         && $dataReceived['user_2fa_selection'] === 'duo'
168 168
         && $session->get('user-duo_status') === 'IN_PROGRESS'
169 169
         && !empty($dataReceived['duo_state'])
170
-    ){
170
+    ) {
171 171
         $key = hash('sha256', $dataReceived['duo_state']);
172 172
         $iv = substr(hash('sha256', $dataReceived['duo_state']), 0, 16);
173 173
         $duo_data_dec = openssl_decrypt(base64_decode($session->get('user-duo_data')), 'AES-256-CBC', $key, 0, $iv);
174 174
         // Clear the data from the Duo process to continue clean with the standard login process
175
-        $session->set('user-duo_data','');
176
-        if($duo_data_dec === false) {
175
+        $session->set('user-duo_data', '');
176
+        if ($duo_data_dec === false) {
177 177
             // Add failed authentication log
178 178
             addFailedAuthentication(filter_var($dataReceived['login'], FILTER_SANITIZE_FULL_SPECIAL_CHARS), getClientIpServer());
179 179
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
         $dataReceived['login'] = $duo_data['duo_login'];
192 192
     }
193 193
 
194
-    if(isset($dataReceived['pw']) === false || isset($dataReceived['login']) === false) {
194
+    if (isset($dataReceived['pw']) === false || isset($dataReceived['login']) === false) {
195 195
         echo json_encode([
196 196
             'data' => prepareExchangedData(
197 197
                 [
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
         }
537 537
         // Append with roles from AD groups
538 538
         if (is_null($userInfo['roles_from_ad_groups']) === false) {
539
-            $userInfo['fonction_id'] = empty($userInfo['fonction_id'])  === true ? $userInfo['roles_from_ad_groups'] : $userInfo['fonction_id']. ';' . $userInfo['roles_from_ad_groups'];
539
+            $userInfo['fonction_id'] = empty($userInfo['fonction_id']) === true ? $userInfo['roles_from_ad_groups'] : $userInfo['fonction_id'].';'.$userInfo['roles_from_ad_groups'];
540 540
         }
541 541
         // store
542 542
         $session->set('user-roles', $userInfo['fonction_id']);
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
         if (count($session->get('user-roles_array')) > 0) {
549 549
             $rolesList = DB::query(
550 550
                 'SELECT id, title, complexity
551
-                FROM ' . prefixTable('roles_title') . '
551
+                FROM ' . prefixTable('roles_title').'
552 552
                 WHERE id IN %li',
553 553
                 $session->get('user-roles_array')
554 554
             );
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
             if ($adjustPermissions) {
595 595
                 $session->set('user-admin', (int) $userInfo['admin']);
596 596
                 $session->set('user-manager', (int) $userInfo['gestionnaire']);
597
-                $session->set('user-can_manage_all_users',(int)  $userInfo['can_manage_all_users']);
597
+                $session->set('user-can_manage_all_users', (int) $userInfo['can_manage_all_users']);
598 598
                 $session->set('user-read_only', (int) $userInfo['read_only']);
599 599
                 DB::update(
600 600
                     prefixTable('users'),
@@ -665,10 +665,10 @@  discard block
 block discarded – undo
665 665
         $session->set('user-latest_items_tab', []);
666 666
         $session->set('user-nb_roles', 0);
667 667
         foreach ($session->get('user-latest_items') as $item) {
668
-            if (! empty($item)) {
668
+            if (!empty($item)) {
669 669
                 $dataLastItems = DB::queryFirstRow(
670 670
                     'SELECT id,label,id_tree
671
-                    FROM ' . prefixTable('items') . '
671
+                    FROM ' . prefixTable('items').'
672 672
                     WHERE id=%i',
673 673
                     $item
674 674
                 );
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
                     [
678 678
                         'id' => $item,
679 679
                         'label' => $dataLastItems['label'],
680
-                        'url' => 'index.php?page=items&group=' . $dataLastItems['id_tree'] . '&id=' . $item,
680
+                        'url' => 'index.php?page=items&group='.$dataLastItems['id_tree'].'&id='.$item,
681 681
                     ],
682 682
                     'add'
683 683
                 );
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
         // Get cahce tree info
688 688
         $cacheTreeData = DB::queryFirstRow(
689 689
             'SELECT visible_folders
690
-            FROM ' . prefixTable('cache_tree') . '
690
+            FROM ' . prefixTable('cache_tree').'
691 691
             WHERE user_id=%i',
692 692
             (int) $session->get('user-id')
693 693
         );
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
             && (int) $sessionAdmin !== 1
720 720
         ) {
721 721
             // get all Admin users
722
-            $val = DB::queryFirstRow('SELECT email FROM ' . prefixTable('users') . " WHERE admin = %i and email != ''", 1);
722
+            $val = DB::queryFirstRow('SELECT email FROM '.prefixTable('users')." WHERE admin = %i and email != ''", 1);
723 723
             if (DB::count() > 0) {
724 724
                 // Add email to table
725 725
                 prepareSendingEmail(
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
                             '#tp_time#',
732 732
                         ],
733 733
                         [
734
-                            ' ' . $session->get('user-login') . ' (IP: ' . getClientIpServer() . ')',
734
+                            ' '.$session->get('user-login').' (IP: '.getClientIpServer().')',
735 735
                             date($SETTINGS['date_format'], (int) $session->get('user-last_connection')),
736 736
                             date($SETTINGS['time_format'], (int) $session->get('user-last_connection')),
737 737
                         ],
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
 {
843 843
     $rows = DB::query(
844 844
         'SELECT date
845
-        FROM ' . prefixTable('log_system') . "
845
+        FROM ' . prefixTable('log_system')."
846 846
         WHERE field_1 = %s
847 847
         AND type = 'failed_auth'
848 848
         AND label = 'password_is_not_correct'
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
         foreach ($rows as $record) {
857 857
             array_push(
858 858
                 $arrAttempts,
859
-                date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date'])
859
+                date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date'])
860 860
             );
861 861
         }
862 862
     }
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
     $ldapConnection
892 892
 ) : bool
893 893
 {
894
-    include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
894
+    include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
895 895
 
896 896
     if ((int) $userInfoDisabled === 1) {
897 897
         return false;
@@ -1086,7 +1086,7 @@  discard block
 block discarded – undo
1086 1086
     } catch (Exception $e) {
1087 1087
         return [
1088 1088
             'error' => true,
1089
-            'message' => "Error: " . $e->getMessage(),
1089
+            'message' => "Error: ".$e->getMessage(),
1090 1090
         ];
1091 1091
     }
1092 1092
 }
@@ -1117,7 +1117,7 @@  discard block
 block discarded – undo
1117 1117
                 'type' => 'OpenLDAP'
1118 1118
             ];
1119 1119
         default:
1120
-            throw new Exception("Unsupported LDAP type: " . $SETTINGS['ldap_type']);
1120
+            throw new Exception("Unsupported LDAP type: ".$SETTINGS['ldap_type']);
1121 1121
     }
1122 1122
 }
1123 1123
 
@@ -1254,7 +1254,7 @@  discard block
 block discarded – undo
1254 1254
         );
1255 1255
     }
1256 1256
     
1257
-    throw new Exception("Unsupported LDAP type: " . $ldapHandler['type']);
1257
+    throw new Exception("Unsupported LDAP type: ".$ldapHandler['type']);
1258 1258
 }
1259 1259
 
1260 1260
 /**
@@ -1271,12 +1271,12 @@  discard block
 block discarded – undo
1271 1271
     if (isset($SETTINGS['enable_ad_users_with_ad_groups']) === true && (int) $SETTINGS['enable_ad_users_with_ad_groups'] === 1) {
1272 1272
         // Get user groups from AD
1273 1273
         $user_ad_groups = [];
1274
-        foreach($groups as $group) {
1274
+        foreach ($groups as $group) {
1275 1275
             //print_r($group);
1276 1276
             // get relation role id for AD group
1277 1277
             $role = DB::queryFirstRow(
1278 1278
                 'SELECT lgr.role_id
1279
-                FROM ' . prefixTable('ldap_groups_roles') . ' AS lgr
1279
+                FROM ' . prefixTable('ldap_groups_roles').' AS lgr
1280 1280
                 WHERE lgr.ldap_group_id = %s',
1281 1281
                 $group
1282 1282
             );
@@ -1407,7 +1407,7 @@  discard block
 block discarded – undo
1407 1407
             // Check if exists in DB
1408 1408
             $groupData = DB::queryFirstRow(
1409 1409
                 'SELECT id
1410
-                FROM ' . prefixTable('roles_title') . '
1410
+                FROM ' . prefixTable('roles_title').'
1411 1411
                 WHERE title = %s',
1412 1412
                 $group["displayName"]
1413 1413
             );
@@ -1537,7 +1537,7 @@  discard block
 block discarded – undo
1537 1537
             
1538 1538
             // generate new QR
1539 1539
             $new_2fa_qr = $tfa->getQRCodeImageAsDataUri(
1540
-                'Teampass - ' . $username,
1540
+                'Teampass - '.$username,
1541 1541
                 $userInfo['ga']
1542 1542
             );
1543 1543
             // clear temporary code from DB
@@ -1550,7 +1550,7 @@  discard block
 block discarded – undo
1550 1550
                 $userInfo['id']
1551 1551
             );
1552 1552
             $firstTime = [
1553
-                'value' => '<img src="' . $new_2fa_qr . '">',
1553
+                'value' => '<img src="'.$new_2fa_qr.'">',
1554 1554
                 'user_admin' => isset($sessionAdmin) ? (int) $sessionAdmin : '',
1555 1555
                 'initial_url' => isset($sessionUrl) === true ? $sessionUrl : '',
1556 1556
                 'pwd_attempts' => (int) $sessionPwdAttempts,
@@ -1706,7 +1706,7 @@  discard block
 block discarded – undo
1706 1706
         }*/
1707 1707
         return [
1708 1708
             'error' => true,
1709
-            'message' => $duo_error . $lang->get('duo_error_check_config'),
1709
+            'message' => $duo_error.$lang->get('duo_error_check_config'),
1710 1710
             'pwd_attempts' => (int) $sessionPwdAttempts,
1711 1711
             'debug_message' => $e->getMessage(),
1712 1712
             'proceedIdentification' => false,
@@ -1722,7 +1722,7 @@  discard block
 block discarded – undo
1722 1722
         } catch (DuoException $e) {
1723 1723
             return [
1724 1724
                 'error' => true,
1725
-                'message' => $duo_error . $lang->get('duo_error_url'),
1725
+                'message' => $duo_error.$lang->get('duo_error_url'),
1726 1726
                 'pwd_attempts' => (int) $sessionPwdAttempts,
1727 1727
                 'debug_message' => $e->getMessage(),
1728 1728
                 'proceedIdentification' => false,
@@ -1730,7 +1730,7 @@  discard block
 block discarded – undo
1730 1730
         }
1731 1731
         
1732 1732
         // Somethimes Duo return success but fail to return a URL, double check if the URL has been created
1733
-        if (!empty($duo_redirect_url) && filter_var($duo_redirect_url,FILTER_SANITIZE_URL)) {
1733
+        if (!empty($duo_redirect_url) && filter_var($duo_redirect_url, FILTER_SANITIZE_URL)) {
1734 1734
             // Since Duo Universal requires a redirect, let's store some info when the user get's back after completing the Duo prompt
1735 1735
             $key = hash('sha256', $duo_state);
1736 1736
             $iv = substr(hash('sha256', $duo_state), 0, 16);
@@ -1758,7 +1758,7 @@  discard block
 block discarded – undo
1758 1758
         } else {
1759 1759
             return [
1760 1760
                 'error' => true,
1761
-                'message' => $duo_error . $lang->get('duo_error_url'),
1761
+                'message' => $duo_error.$lang->get('duo_error_url'),
1762 1762
                 'pwd_attempts' => (int) $sessionPwdAttempts,
1763 1763
                 'proceedIdentification' => false,
1764 1764
             ];
@@ -1779,8 +1779,8 @@  discard block
 block discarded – undo
1779 1779
         // return the response (which should be the user name)
1780 1780
         if ($decoded_token['preferred_username'] === $username) {
1781 1781
             $session->set('user-duo_status', 'COMPLET');
1782
-            $session->set('user-duo_state','');
1783
-            $session->set('user-duo_data','');
1782
+            $session->set('user-duo_state', '');
1783
+            $session->set('user-duo_data', '');
1784 1784
             $session->set('user-login', $username);
1785 1785
 
1786 1786
             return [
@@ -1791,9 +1791,9 @@  discard block
 block discarded – undo
1791 1791
             ];
1792 1792
         } else {
1793 1793
             // Something wrong, username from the original Duo request is different than the one received now
1794
-            $session->set('user-duo_status','');
1795
-            $session->set('user-duo_state','');
1796
-            $session->set('user-duo_data','');
1794
+            $session->set('user-duo_status', '');
1795
+            $session->set('user-duo_state', '');
1796
+            $session->set('user-duo_data', '');
1797 1797
 
1798 1798
             return [
1799 1799
                 'error' => true,
@@ -1804,9 +1804,9 @@  discard block
 block discarded – undo
1804 1804
         }
1805 1805
     }
1806 1806
     // If we are here something wrong
1807
-    $session->set('user-duo_status','');
1808
-    $session->set('user-duo_state','');
1809
-    $session->set('user-duo_data','');
1807
+    $session->set('user-duo_status', '');
1808
+    $session->set('user-duo_state', '');
1809
+    $session->set('user-duo_data', '');
1810 1810
     return [
1811 1811
         'error' => true,
1812 1812
         'message' => $lang->get('duo_login_mismatch'),
@@ -1918,7 +1918,7 @@  discard block
 block discarded – undo
1918 1918
         // Check for existing lock
1919 1919
         $unlock_at = DB::queryFirstField(
1920 1920
             'SELECT MAX(unlock_at)
1921
-             FROM ' . prefixTable('auth_failures') . '
1921
+             FROM ' . prefixTable('auth_failures').'
1922 1922
              WHERE unlock_at > %s
1923 1923
              AND ((source = %s AND value = %s) OR (source = %s AND value = %s))',
1924 1924
             date('Y-m-d H:i:s', time()),
@@ -1940,8 +1940,8 @@  discard block
 block discarded – undo
1940 1940
         // Get user info from DB
1941 1941
         $data = DB::queryFirstRow(
1942 1942
             'SELECT u.*, a.value AS api_key
1943
-            FROM ' . prefixTable('users') . ' AS u
1944
-            LEFT JOIN ' . prefixTable('api') . ' AS a ON (u.id = a.user_id)
1943
+            FROM ' . prefixTable('users').' AS u
1944
+            LEFT JOIN ' . prefixTable('api').' AS a ON (u.id = a.user_id)
1945 1945
             WHERE login = %s AND deleted_at IS NULL',
1946 1946
             $login
1947 1947
         );
@@ -2061,7 +2061,7 @@  discard block
 block discarded – undo
2061 2061
             'array' => [
2062 2062
                 'value' => 'bruteforce_wait',
2063 2063
                 'error' => true,
2064
-                'message' => $lang->get('bruteforce_wait') . (string) $e->getMessage(),
2064
+                'message' => $lang->get('bruteforce_wait').(string) $e->getMessage(),
2065 2065
             ]
2066 2066
         ];
2067 2067
     }
@@ -2478,15 +2478,15 @@  discard block
 block discarded – undo
2478 2478
 
2479 2479
             if ($ret['error'] !== false) {
2480 2480
                 logEvents($SETTINGS, 'failed_auth', 'bad_duo_mfa', '', stripslashes($username), stripslashes($username));
2481
-                $session->set('user-duo_status','');
2482
-                $session->set('user-duo_state','');
2483
-                $session->set('user-duo_data','');
2481
+                $session->set('user-duo_status', '');
2482
+                $session->set('user-duo_state', '');
2483
+                $session->set('user-duo_data', '');
2484 2484
                 return [
2485 2485
                     'error' => true,
2486 2486
                     'mfaData' => $ret,
2487 2487
                     'mfaQRCodeInfos' => false,
2488 2488
                 ];
2489
-            } else if ($ret['duo_url_ready'] === true){
2489
+            } else if ($ret['duo_url_ready'] === true) {
2490 2490
                 return [
2491 2491
                     'error' => false,
2492 2492
                     'mfaData' => $ret,
@@ -2550,7 +2550,7 @@  discard block
 block discarded – undo
2550 2550
     // Count failed attempts from this source
2551 2551
     $count = DB::queryFirstField(
2552 2552
         'SELECT COUNT(*)
2553
-        FROM ' . prefixTable('auth_failures') . '
2553
+        FROM ' . prefixTable('auth_failures').'
2554 2554
         WHERE source = %s AND value = %s',
2555 2555
         $source,
2556 2556
         $value
Please login to merge, or discard this patch.
sources/tree.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 ) {
65 65
     // Not allowed page
66 66
     $session->set('system-error_code', ERR_NOT_ALLOWED);
67
-    include $SETTINGS['cpassman_dir'] . '/error.php';
67
+    include $SETTINGS['cpassman_dir'].'/error.php';
68 68
     exit;
69 69
 }
70 70
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 );
126 126
 
127 127
 $lastFolderChange = DB::queryFirstRow(
128
-    'SELECT valeur FROM ' . prefixTable('misc') . '
128
+    'SELECT valeur FROM '.prefixTable('misc').'
129 129
     WHERE type = %s AND intitule = %s',
130 130
     'timestamp',
131 131
     'last_folder_change'
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
         $nbItemsInSubfolders = (int) $node->nb_items_in_subfolders;
347 347
         $nbItemsInFolder = (int) $node->nb_items_in_folder;
348 348
         $nbSubfolders = (int) $node->nb_subfolders;
349
-        break;  // Get out as soon as we find a valid node.
349
+        break; // Get out as soon as we find a valid node.
350 350
     }
351 351
     
352 352
     if ($displayThisNode === true) {
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
         foreach ($currentNode->children as $child) {
459 459
             recursiveTree(
460 460
                 (int) $child,
461
-                $tree->getNode($child),// get node info for this child
461
+                $tree->getNode($child), // get node info for this child
462 462
                 /** @scrutinizer ignore-type */ $tree,
463 463
                 $listFoldersLimitedKeys,
464 464
                 $listRestrictedFoldersForItemsKeys,
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
     $lang = new Language($session->get('user-language') ?? 'english');
506 506
 
507 507
     // prepare json return for current node
508
-    $parent = $currentNode->parent_id === '0' ? '#' : 'li_' . $currentNode->parent_id;
508
+    $parent = $currentNode->parent_id === '0' ? '#' : 'li_'.$currentNode->parent_id;
509 509
 
510 510
     // handle displaying
511 511
     if (isKeyExistingAndEqual('show_only_accessible_folders', 1, $SETTINGS) === true) {
@@ -522,17 +522,17 @@  discard block
 block discarded – undo
522 522
         array_push(
523 523
             $ret_json,
524 524
             array(
525
-                'id' => 'li_' . $nodeId,
525
+                'id' => 'li_'.$nodeId,
526 526
                 'parent' => $last_visible_parent === -1 ? $parent : $last_visible_parent,
527 527
                 'text' => '<i class="'.$currentNode->fa_icon.' tree-folder mr-2" data-folder="'.$currentNode->fa_icon.'"  data-folder-selected="'.$currentNode->fa_icon_selected.'"></i>'.$text.htmlspecialchars($currentNode->title).$nodeData['html'],
528 528
                 'li_attr' => array(
529 529
                     'class' => 'jstreeopen',
530
-                    'title' => 'ID [' . $nodeId . '] ' . $nodeData['title'],
530
+                    'title' => 'ID ['.$nodeId.'] '.$nodeData['title'],
531 531
                 ),
532 532
                 'a_attr' => array(
533
-                    'id' => 'fld_' . $nodeId,
533
+                    'id' => 'fld_'.$nodeId,
534 534
                     'class' => $nodeData['folderClass'],
535
-                    'onclick' => 'ListerItems(' . $nodeId . ', ' . $nodeData['restricted'] . ', 0, 1)',
535
+                    'onclick' => 'ListerItems('.$nodeId.', '.$nodeData['restricted'].', 0, 1)',
536 536
                     'data-title' => htmlspecialchars($currentNode->title),
537 537
                 ),
538 538
                 'is_pf' => in_array($nodeId, $inputData['personalFolders']) === true ? 1 : 0,
@@ -548,12 +548,12 @@  discard block
 block discarded – undo
548 548
         array_push(
549 549
             $ret_json,
550 550
             array(
551
-                'id' => 'li_' . $nodeId,
551
+                'id' => 'li_'.$nodeId,
552 552
                 'parent' => $last_visible_parent === -1 ? $parent : $last_visible_parent,
553 553
                 'text' => '<i class="'.$currentNode->fa_icon.' tree-folder mr-2" data-folder="'.$currentNode->fa_icon.'"  data-folder-selected="'.$currentNode->fa_icon_selected.'"></i>'.'<i class="fas fa-times fa-xs text-danger mr-1 ml-1"></i>'.$text.htmlspecialchars($currentNode->title).$nodeData['html'],
554 554
                 'li_attr' => array(
555 555
                     'class' => '',
556
-                    'title' => 'ID [' . $nodeId . '] ' . $lang->get('no_access'),
556
+                    'title' => 'ID ['.$nodeId.'] '.$lang->get('no_access'),
557 557
                 ),
558 558
             )
559 559
         );
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
         if (in_array($nodeId, $session_read_only_folders) === true) {
614 614
             return [
615 615
                 'html' => '<i class="far fa-eye fa-xs mr-1 ml-1"></i>'.
616
-                    ($tree_counters === 1 ? '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . $nbItemsInFolder .'/'.$nbItemsInSubfolders .'/'.$nbSubfolders. '</span>'  : ''),
616
+                    ($tree_counters === 1 ? '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.$nbItemsInFolder.'/'.$nbItemsInSubfolders.'/'.$nbSubfolders.'</span>' : ''),
617 617
                 'title' => $lang->get('read_only_account'),
618 618
                 'restricted' => 1,
619 619
                 'folderClass' => 'folder_not_droppable',
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
         ) {
629 629
             return [
630 630
                 'html' => '<i class="far fa-eye fa-xs mr-1"></i>'.
631
-                    ($tree_counters === 1 ? '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . $nbItemsInFolder .'/'.$nbItemsInSubfolders .'/'.$nbSubfolders. '</span>'  : ''),
631
+                    ($tree_counters === 1 ? '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.$nbItemsInFolder.'/'.$nbItemsInSubfolders.'/'.$nbSubfolders.'</span>' : ''),
632 632
                 'title' => $lang->get('read_only_account'),
633 633
                 'restricted' => 0,
634 634
                 'folderClass' => 'folder',
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
         }
640 640
         
641 641
         return [
642
-            'html' => ($tree_counters === 1 ? '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . $nbItemsInFolder .'/'.$nbItemsInSubfolders .'/'.$nbSubfolders. '</span>'  : ''),
642
+            'html' => ($tree_counters === 1 ? '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.$nbItemsInFolder.'/'.$nbItemsInSubfolders.'/'.$nbSubfolders.'</span>' : ''),
643 643
             'title' => '',
644 644
             'restricted' => 0,
645 645
             'folderClass' => 'folder',
@@ -650,8 +650,8 @@  discard block
 block discarded – undo
650 650
 
651 651
     } elseif (in_array($nodeId, $listFoldersLimitedKeys) === true) {
652 652
         return [
653
-            'html' => ($session_user_read_only === true ? '<i class="far fa-eye fa-xs mr-1"></i>' : '') .
654
-                ($tree_counters === 1 ? '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . count($session_list_folders_limited[$nodeId]) . '</span>' : ''),
653
+            'html' => ($session_user_read_only === true ? '<i class="far fa-eye fa-xs mr-1"></i>' : '').
654
+                ($tree_counters === 1 ? '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.count($session_list_folders_limited[$nodeId]).'</span>' : ''),
655 655
             'title' => '',
656 656
             'restricted' => 1,
657 657
             'folderClass' => 'folder',
@@ -662,8 +662,8 @@  discard block
 block discarded – undo
662 662
 
663 663
     } elseif (in_array($nodeId, $listRestrictedFoldersForItemsKeys) === true) {
664 664
         return [
665
-            'html' => $session_user_read_only === true ? '<i class="far fa-eye fa-xs mr-1"></i>' : '' .
666
-                '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . count($session_list_restricted_folders_for_items[$nodeId]) . '</span>',
665
+            'html' => $session_user_read_only === true ? '<i class="far fa-eye fa-xs mr-1"></i>' : ''.
666
+                '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.count($session_list_restricted_folders_for_items[$nodeId]).'</span>',
667 667
             'title' => '',
668 668
             'restricted' => 1,
669 669
             'folderClass' => 'folder',
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
     // Does this user has a tree cache
774 774
     $userCacheTree = DB::queryFirstRow(
775 775
         'SELECT data
776
-        FROM ' . prefixTable('cache_tree') . '
776
+        FROM ' . prefixTable('cache_tree').'
777 777
         WHERE user_id = %i',
778 778
         $userId
779 779
     );
Please login to merge, or discard this patch.
sources/downloadFile.php 1 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
 
@@ -118,19 +118,19 @@  discard block
 block discarded – undo
118 118
 $get_filename = str_replace('"', '\"', $get_filename);
119 119
 
120 120
 // Use Content-Disposition header with double quotes around filename
121
-header('Content-Disposition: attachment; filename="' . rawurldecode($get_filename) . '"');
121
+header('Content-Disposition: attachment; filename="'.rawurldecode($get_filename).'"');
122 122
 header('Content-Type: application/octet-stream');
123 123
 header('Cache-Control: must-revalidate, no-cache, no-store');
124 124
 header('Expires: 0');
125 125
 if (null !== $request->query->get('pathIsFiles') && (int) $get_pathIsFiles === 1) {
126
-    readfile($SETTINGS['path_to_files_folder'] . '/' . basename($get_filename));
126
+    readfile($SETTINGS['path_to_files_folder'].'/'.basename($get_filename));
127 127
 } else {
128 128
     // get file key
129 129
     $file_info = DB::queryFirstRow(
130 130
         'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status, f.extension AS extension,
131 131
         s.share_key AS share_key
132
-        FROM ' . prefixTable('files') . ' AS f
133
-        INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id)
132
+        FROM ' . prefixTable('files').' AS f
133
+        INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id)
134 134
         WHERE s.user_id = %i AND s.object_id = %i',
135 135
         $session->get('user-id'),
136 136
         $get_fileid
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
         // if not encrypted
150 150
         $file_info = DB::queryFirstRow(
151 151
             'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status, f.extension AS extension
152
-            FROM ' . prefixTable('files') . ' AS f
152
+            FROM ' . prefixTable('files').' AS f
153 153
             WHERE f.id = %i',
154 154
             $get_fileid
155 155
         );
@@ -159,25 +159,25 @@  discard block
 block discarded – undo
159 159
     // Set the filename of the download
160 160
     $filename = basename($file_info['name'], '.'.$file_info['extension']);
161 161
     $filename = isBase64($filename) === true ? base64_decode($filename) : $filename;
162
-    $filename = $filename . '.' . $file_info['extension'];
162
+    $filename = $filename.'.'.$file_info['extension'];
163 163
     // Get the full path to the file to be downloaded
164
-    if (file_exists($SETTINGS['path_to_upload_folder'] . '/' .TP_FILE_PREFIX . $file_info['file'])) {
165
-        $filePath = $SETTINGS['path_to_upload_folder'] . '/' . TP_FILE_PREFIX . $file_info['file'];
164
+    if (file_exists($SETTINGS['path_to_upload_folder'].'/'.TP_FILE_PREFIX.$file_info['file'])) {
165
+        $filePath = $SETTINGS['path_to_upload_folder'].'/'.TP_FILE_PREFIX.$file_info['file'];
166 166
     } else {
167
-        $filePath = $SETTINGS['path_to_upload_folder'] . '/' . TP_FILE_PREFIX . base64_decode($file_info['file']);
167
+        $filePath = $SETTINGS['path_to_upload_folder'].'/'.TP_FILE_PREFIX.base64_decode($file_info['file']);
168 168
     }
169 169
     $filePath = realpath($filePath);
170 170
 
171
-    if (WIP === true) error_log('downloadFile.php: filePath: ' . $filePath." - ");
171
+    if (WIP === true) error_log('downloadFile.php: filePath: '.$filePath." - ");
172 172
 
173 173
     if ($filePath && is_readable($filePath) && strpos($filePath, realpath($SETTINGS['path_to_upload_folder'])) === 0) {
174 174
         header('Content-Description: File Transfer');
175 175
         header('Content-Type: application/octet-stream');
176
-        header('Content-Disposition: attachment; filename="' . basename($filename) . '"');
176
+        header('Content-Disposition: attachment; filename="'.basename($filename).'"');
177 177
         header('Expires: 0');
178 178
         header('Cache-Control: must-revalidate');
179 179
         header('Pragma: public');
180
-        header('Content-Length: ' . filesize($filePath));
180
+        header('Content-Length: '.filesize($filePath));
181 181
         flush(); // Clear system output buffer
182 182
         if (empty($fileContent) === true) {
183 183
             // deepcode ignore PT: File and path are secured directly inside the function decryptFile()
Please login to merge, or discard this patch.
sources/logs.datatables.php 1 patch
Spacing   +23 added lines, -24 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
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
     
169 169
     // Output
170 170
     $sOutput = '{';
171
-    $sOutput .= '"sEcho": '. $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
171
+    $sOutput .= '"sEcho": '.$request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
172 172
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
173 173
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
174 174
     $sOutput .= '"aaData": ';
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 
242 242
     // Output
243 243
     $sOutput = '{';
244
-    $sOutput .= '"sEcho": '. $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
244
+    $sOutput .= '"sEcho": '.$request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
245 245
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
246 246
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
247 247
     $sOutput .= '"aaData": ';
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 
315 315
     // Output
316 316
     $sOutput = '{';
317
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
317
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
318 318
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
319 319
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
320 320
     $sOutput .= '"aaData": ';
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 
388 388
     // Output
389 389
     $sOutput = '{';
390
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
390
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
391 391
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
392 392
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
393 393
     $sOutput .= '"aaData": [ ';
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
 
491 491
     // Output
492 492
     $sOutput = '{';
493
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
493
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
494 494
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
495 495
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
496 496
     $sOutput .= '"aaData": [ ';
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
         $iTotal = 0;
573 573
     }
574 574
     $sOutput = '{';
575
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
575
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
576 576
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
577 577
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
578 578
     $sOutput .= '"aaData": ';
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
 
649 649
     // Output
650 650
     $sOutput = '{';
651
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
651
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
652 652
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
653 653
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
654 654
     $sOutput .= '"aaData": ';
@@ -717,7 +717,7 @@  discard block
 block discarded – undo
717 717
 
718 718
     // Output
719 719
     $sOutput = '{';
720
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
720
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
721 721
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
722 722
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
723 723
     $sOutput .= '"aaData": ';
@@ -790,7 +790,7 @@  discard block
 block discarded – undo
790 790
 
791 791
     // Output
792 792
     $sOutput = '{';
793
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
793
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
794 794
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
795 795
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
796 796
     $sOutput .= '"aaData": ';
@@ -867,7 +867,7 @@  discard block
 block discarded – undo
867 867
             FROM '.prefixTable('background_tasks').' AS p 
868 868
             LEFT JOIN '.prefixTable('users').' AS u ON %l
869 869
             WHERE %l ORDER BY %l %l LIMIT %i, %i';
870
-    $params = ['u.id = json_extract(p.arguments, "$[0]")',$sWhere, $orderColumn, $orderDirection, $sLimitStart, $sLimitLength];
870
+    $params = ['u.id = json_extract(p.arguments, "$[0]")', $sWhere, $orderColumn, $orderDirection, $sLimitStart, $sLimitLength];
871 871
 
872 872
     // Get the records
873 873
     $rows = DB::query($sql, ...$params);
@@ -875,7 +875,7 @@  discard block
 block discarded – undo
875 875
 
876 876
     // Output
877 877
     $sOutput = '{';
878
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
878
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
879 879
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
880 880
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
881 881
     $sOutput .= '"aaData": ';
@@ -890,7 +890,7 @@  discard block
 block discarded – undo
890 890
         //col1
891 891
         $sOutput .= '"<span data-done=\"'.$record['is_in_progress'].'\" data-type=\"'.$record['process_type'].'\" data-process-id=\"'.$record['increment_id'].'\"></span>", ';
892 892
         //col2
893
-        $sOutput .= '"'.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['created_at']).'", ';
893
+        $sOutput .= '"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['created_at']).'", ';
894 894
         //col3
895 895
         //$sOutput .= '"'.($record['updated_at'] === '' ? '-' : date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['updated_at'])).'", ';
896 896
         $sOutput .= '"<div class=\"progress mt-2\"><div class=\"progress-bar\" style=\"width: '.$subtaskProgress.'\">'.$subtaskProgress.'</div></div>", ';
@@ -900,7 +900,7 @@  discard block
 block discarded – undo
900 900
         // col5
901 901
         if (in_array($record['process_type'], array('create_user_keys', 'item_copy')) === true) {
902 902
             $data_user = DB::queryFirstRow(
903
-                'SELECT name, lastname FROM ' . prefixTable('users') . '
903
+                'SELECT name, lastname FROM '.prefixTable('users').'
904 904
                 WHERE id = %i',
905 905
                 json_decode($record['arguments'], true)['new_user_id']
906 906
             );
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
     FROM '.prefixTable('background_tasks').' AS p 
957 957
     LEFT JOIN '.prefixTable('users').' AS u ON %l
958 958
     WHERE %l ORDER BY %l %l LIMIT %i, %i';
959
-    $params = ['u.id = json_extract(p.arguments, "$[0]")',$sWhere, $orderColumn, $orderDirection, $sLimitStart, $sLimitLength];
959
+    $params = ['u.id = json_extract(p.arguments, "$[0]")', $sWhere, $orderColumn, $orderDirection, $sLimitStart, $sLimitLength];
960 960
 
961 961
     // Get the records
962 962
     $rows = DB::query($sql, ...$params);
@@ -964,7 +964,7 @@  discard block
 block discarded – undo
964 964
 
965 965
     // Output
966 966
     $sOutput = '{';
967
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
967
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
968 968
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
969 969
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
970 970
     $sOutput .= '"aaData": ';
@@ -980,13 +980,12 @@  discard block
 block discarded – undo
980 980
         //col1
981 981
         $sOutput .= '"", ';
982 982
         //col2
983
-        $sOutput .= '"'.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['created_at']).'", ';
983
+        $sOutput .= '"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['created_at']).'", ';
984 984
         //col3
985 985
         $sOutput .= is_null($record['started_at']) === false ?
986
-            ('"'.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['started_at']).'", ') :
987
-                ('"'.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['created_at']).'", ');
986
+            ('"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['started_at']).'", ') : ('"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['created_at']).'", ');
988 987
         //col4
989
-        $sOutput .= '"'.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['finished_at']).'", ';
988
+        $sOutput .= '"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['finished_at']).'", ';
990 989
         // col7
991 990
         $sOutput .= '"'.gmdate('H:i:s', (int) $record['finished_at'] - (is_null($record['started_at']) === false ? (int) $record['started_at'] : (int) $record['created_at'])).'",';
992 991
         //col5
@@ -1005,7 +1004,7 @@  discard block
 block discarded – undo
1005 1004
         $newUserId = array_key_exists('new_user_id', $arguments) ? $arguments['new_user_id'] : null;
1006 1005
         if ($record['process_type'] === 'create_user_keys' && is_null($newUserId) === false && empty($newUserId) === false) {
1007 1006
             $data_user = DB::queryFirstRow(
1008
-                'SELECT name, lastname, login FROM ' . prefixTable('users') . '
1007
+                'SELECT name, lastname, login FROM '.prefixTable('users').'
1009 1008
                 WHERE id = %i',
1010 1009
                 $newUserId
1011 1010
             );
@@ -1021,7 +1020,7 @@  discard block
 block discarded – undo
1021 1020
         } elseif ($record['process_type'] === 'user_build_cache_tree') {
1022 1021
             $user = json_decode($record['arguments'], true)['user_id'];
1023 1022
             $data_user = DB::queryFirstRow(
1024
-                'SELECT name, lastname, login FROM ' . prefixTable('users') . '
1023
+                'SELECT name, lastname, login FROM '.prefixTable('users').'
1025 1024
                 WHERE id = %i',
1026 1025
                 $user
1027 1026
             );
@@ -1055,7 +1054,7 @@  discard block
 block discarded – undo
1055 1054
 {
1056 1055
     $subtasks = DB::query(
1057 1056
         'SELECT *
1058
-        FROM ' . prefixTable('background_subtasks') . '
1057
+        FROM ' . prefixTable('background_subtasks').'
1059 1058
         WHERE task_id = %i',
1060 1059
         $id
1061 1060
     );
@@ -1071,5 +1070,5 @@  discard block
 block discarded – undo
1071 1070
         $i++;
1072 1071
     }
1073 1072
 
1074
-    return ($finished_nb !== 0 ? pourcentage($finished_nb, $nb, 100) : 0) .'%';
1073
+    return ($finished_nb !== 0 ? pourcentage($finished_nb, $nb, 100) : 0).'%';
1075 1074
 }
1076 1075
\ No newline at end of file
Please login to merge, or discard this patch.
sources/backups.queries.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 ) {
78 78
     // Not allowed page
79 79
     $session->set('system-error_code', ERR_NOT_ALLOWED);
80
-    include $SETTINGS['cpassman_dir'] . '/error.php';
80
+    include $SETTINGS['cpassman_dir'].'/error.php';
81 81
     exit;
82 82
 }
83 83
 
@@ -138,21 +138,21 @@  discard block
 block discarded – undo
138 138
             // Prepare variables
139 139
             $post_key = filter_var($dataReceived['encryptionKey'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
140 140
 
141
-            require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
141
+            require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
142 142
             $return = '';
143 143
 
144 144
             //Get all tables
145 145
             $tables = array();
146 146
             $result = DB::query('SHOW TABLES');
147 147
             foreach ($result as $row) {
148
-                $tables[] = $row['Tables_in_' . DB_NAME];
148
+                $tables[] = $row['Tables_in_'.DB_NAME];
149 149
             }
150 150
 
151 151
             //cycle through
152 152
             foreach ($tables as $table) {
153 153
                 if (empty($pre) || substr_count($table, $pre) > 0) {
154 154
                     // Do query
155
-                    $result = DB::query('SELECT * FROM ' . $table);
155
+                    $result = DB::query('SELECT * FROM '.$table);
156 156
                     DB::query(
157 157
                         'SELECT *
158 158
                         FROM INFORMATION_SCHEMA.COLUMNS
@@ -164,17 +164,17 @@  discard block
 block discarded – undo
164 164
                     $numFields = DB::count();
165 165
 
166 166
                     // prepare a drop table
167
-                    $return .= 'DROP TABLE ' . $table . ';';
168
-                    $row2 = DB::queryFirstRow('SHOW CREATE TABLE ' . $table);
169
-                    $return .= "\n\n" . $row2['Create Table'] . ";\n\n";
167
+                    $return .= 'DROP TABLE '.$table.';';
168
+                    $row2 = DB::queryFirstRow('SHOW CREATE TABLE '.$table);
169
+                    $return .= "\n\n".$row2['Create Table'].";\n\n";
170 170
 
171 171
                     //prepare all fields and datas
172 172
                     for ($i = 0; $i < $numFields; ++$i) {
173 173
                         while ($row = $result->fetch_row()) {
174
-                            $return .= 'INSERT INTO ' . $table . ' VALUES(';
174
+                            $return .= 'INSERT INTO '.$table.' VALUES(';
175 175
                             for ($j = 0; $j < $numFields; ++$j) {
176 176
                                 // Manage NULL values
177
-                                $value = $row[$j] === null ? 'NULL' : '"' . addslashes(preg_replace("/\n/", '\\n', $row[$j])) . '"';                    
177
+                                $value = $row[$j] === null ? 'NULL' : '"'.addslashes(preg_replace("/\n/", '\\n', $row[$j])).'"';                    
178 178
                                 $return .= $value;
179 179
                                 if ($j < ($numFields - 1)) {
180 180
                                     $return .= ',';
@@ -192,8 +192,8 @@  discard block
 block discarded – undo
192 192
                 $token = GenerateCryptKey(20, false, true, true, false, true);
193 193
 
194 194
                 //save file
195
-                $filename = time() . '-' . $token . '.sql';
196
-                $handle = fopen($SETTINGS['path_to_files_folder'] . '/' . $filename, 'w+');
195
+                $filename = time().'-'.$token.'.sql';
196
+                $handle = fopen($SETTINGS['path_to_files_folder'].'/'.$filename, 'w+');
197 197
                 if ($handle !== false) {
198 198
                     //write file
199 199
                     fwrite($handle, $return);
@@ -205,16 +205,16 @@  discard block
 block discarded – undo
205 205
                     // Encrypt the file
206 206
                     prepareFileWithDefuse(
207 207
                         'encrypt',
208
-                        $SETTINGS['path_to_files_folder'] . '/' . $filename,
209
-                        $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
208
+                        $SETTINGS['path_to_files_folder'].'/'.$filename,
209
+                        $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
210 210
                         $post_key
211 211
                     );
212 212
 
213 213
                     // Do clean
214
-                    unlink($SETTINGS['path_to_files_folder'] . '/' . $filename);
214
+                    unlink($SETTINGS['path_to_files_folder'].'/'.$filename);
215 215
                     rename(
216
-                        $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
217
-                        $SETTINGS['path_to_files_folder'] . '/' . $filename
216
+                        $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
217
+                        $SETTINGS['path_to_files_folder'].'/'.$filename
218 218
                     );
219 219
                 }
220 220
 
@@ -234,9 +234,9 @@  discard block
 block discarded – undo
234 234
                     array(
235 235
                         'error' => false,
236 236
                         'message' => '',
237
-                        'download' => 'sources/downloadFile.php?name=' . urlencode($filename) .
238
-                            '&sub=files&file=' . $filename . '&type=sql&key=' . $session->get('key') . '&key_tmp=' .
239
-                            $session->get('user-key_tmp') . '&pathIsFiles=1',
237
+                        'download' => 'sources/downloadFile.php?name='.urlencode($filename).
238
+                            '&sub=files&file='.$filename.'&type=sql&key='.$session->get('key').'&key_tmp='.
239
+                            $session->get('user-key_tmp').'&pathIsFiles=1',
240 240
                     ),
241 241
                     'encode'
242 242
                 );
@@ -303,13 +303,13 @@  discard block
 block discarded – undo
303 303
             
304 304
             if (WIP === true) error_log('DEBUG: Offset -> '.$post_offset.'/'.$post_totalSize.' | File -> '.$post_clearFilename.' | key -> '.$post_key);
305 305
 
306
-            include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
306
+            include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
307 307
 
308 308
             if (empty($post_clearFilename) === true) {
309 309
                 // Get filename from database
310 310
                 $data = DB::queryFirstRow(
311 311
                     'SELECT valeur
312
-                    FROM ' . prefixTable('misc') . '
312
+                    FROM ' . prefixTable('misc').'
313 313
                     WHERE increment_id = %i',
314 314
                     $post_backupFile
315 315
                 );
@@ -329,8 +329,8 @@  discard block
 block discarded – undo
329 329
                     
330 330
                     $ret = prepareFileWithDefuse(
331 331
                         'decrypt',
332
-                        $SETTINGS['path_to_files_folder'] . '/' . $post_backupFile,
333
-                        $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $post_backupFile,
332
+                        $SETTINGS['path_to_files_folder'].'/'.$post_backupFile,
333
+                        $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$post_backupFile,
334 334
                         $post_key
335 335
                     );
336 336
                     
@@ -346,8 +346,8 @@  discard block
 block discarded – undo
346 346
                     }
347 347
 
348 348
                     // Do clean
349
-                    fileDelete($SETTINGS['path_to_files_folder'] . '/' . $post_backupFile, $SETTINGS);
350
-                    $post_backupFile = $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $post_backupFile;
349
+                    fileDelete($SETTINGS['path_to_files_folder'].'/'.$post_backupFile, $SETTINGS);
350
+                    $post_backupFile = $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$post_backupFile;
351 351
                 } else {
352 352
                     echo prepareExchangedData(
353 353
                         array(
Please login to merge, or discard this patch.
sources/export.queries.php 1 patch
Spacing   +64 added lines, -64 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
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 $antiXss = new AntiXSS();
101 101
 
102 102
 // User's language loading
103
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $session->get('user-language') . '.php';
103
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$session->get('user-language').'.php';
104 104
 
105 105
 // Prepare POST variables
106 106
 $id = filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT);
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
                         'SELECT i.id as id, i.id_tree as id_tree, i.restricted_to as restricted_to, i.perso as perso,
152 152
                             i.label as label, i.description as description, i.pw as pw, i.login as login, i.url as url,
153 153
                             i.email as email,l.date as date, i.pw_iv as pw_iv,n.renewal_period as renewal_period
154
-                        FROM ' . prefixTable('items') . ' as i
155
-                        INNER JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree = n.id)
156
-                        INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id = l.id_item)
154
+                        FROM ' . prefixTable('items').' as i
155
+                        INNER JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree = n.id)
156
+                        INNER JOIN ' . prefixTable('log_items').' as l ON (i.id = l.id_item)
157 157
                         WHERE i.inactif = %i
158 158
                         AND i.id_tree= %i
159 159
                         AND (l.action = %s OR (l.action = %s AND l.raison LIKE %s))
@@ -176,8 +176,8 @@  discard block
 block discarded – undo
176 176
                                 // Run query
177 177
                                 $dataItem = DB::queryFirstRow(
178 178
                                     'SELECT i.pw AS pw, s.share_key AS share_key
179
-                                    FROM ' . prefixTable('items') . ' AS i
180
-                                    INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (s.object_id = i.id)
179
+                                    FROM ' . prefixTable('items').' AS i
180
+                                    INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (s.object_id = i.id)
181 181
                                     WHERE user_id = %i AND i.id = %i',
182 182
                                     $session->get('user-id'),
183 183
                                     $record['id']
@@ -201,8 +201,8 @@  discard block
 block discarded – undo
201 201
                                 $arr_kbs = [];
202 202
                                 $rows_kb = DB::query(
203 203
                                     'SELECT b.label, b.id
204
-                                    FROM ' . prefixTable('kb_items') . ' AS a
205
-                                    INNER JOIN ' . prefixTable('kb') . ' AS b ON (a.kb_id = b.id)
204
+                                    FROM ' . prefixTable('kb_items').' AS a
205
+                                    INNER JOIN ' . prefixTable('kb').' AS b ON (a.kb_id = b.id)
206 206
                                     WHERE a.item_id = %i',
207 207
                                     $record['id']
208 208
                                 );
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
                                 $arr_tags = [];
215 215
                                 $rows_tag = DB::query(
216 216
                                     'SELECT tag
217
-                                    FROM ' . prefixTable('tags') . '
217
+                                    FROM ' . prefixTable('tags').'
218 218
                                     WHERE item_id = %i',
219 219
                                     $record['id']
220 220
                                 );
@@ -226,18 +226,18 @@  discard block
 block discarded – undo
226 226
                                 $arr_trees = [];
227 227
                                 $rows_child_tree = DB::query(
228 228
                                     'SELECT t.id, t.title
229
-                                    FROM ' . prefixTable('nested_tree') . ' AS t
230
-                                    INNER JOIN ' . prefixTable('items') . ' AS i ON (t.id = i.id_tree)
229
+                                    FROM ' . prefixTable('nested_tree').' AS t
230
+                                    INNER JOIN ' . prefixTable('items').' AS i ON (t.id = i.id_tree)
231 231
                                     WHERE i.id = %i',
232 232
                                     $record['id']
233 233
                                 );
234 234
                                 foreach ($rows_child_tree as $rec_child_tree) {
235 235
                                     $stack = array();
236 236
                                     $parent = $rec_child_tree['id'];
237
-                                    while($parent != 0){
237
+                                    while ($parent != 0) {
238 238
                                         $rows_parent_tree = DB::query(
239 239
                                             'SELECT parent_id, title
240
-                                            FROM ' . prefixTable('nested_tree') . '
240
+                                            FROM ' . prefixTable('nested_tree').'
241 241
                                             WHERE id = %i',
242 242
                                             $parent
243 243
                                         );
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
             // Prepare variables
325 325
             $post_export_tag = filter_var($dataReceived['export_tag'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
326 326
             if (empty($post_export_tag) === false) {
327
-                DB::query('DELETE FROM ' . prefixTable('export') . ' WHERE export_tag = %s', $post_export_tag);
327
+                DB::query('DELETE FROM '.prefixTable('export').' WHERE export_tag = %s', $post_export_tag);
328 328
             }
329 329
             break;
330 330
 
@@ -374,9 +374,9 @@  discard block
 block discarded – undo
374 374
                         l.date as date, i.pw_iv as pw_iv,
375 375
                         n.renewal_period as renewal_period,
376 376
                         i.id_tree as tree_id
377
-                        FROM ' . prefixTable('items') . ' as i
378
-                        INNER JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree = n.id)
379
-                        INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id = l.id_item)
377
+                        FROM ' . prefixTable('items').' as i
378
+                        INNER JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree = n.id)
379
+                        INNER JOIN ' . prefixTable('log_items').' as l ON (i.id = l.id_item)
380 380
                         WHERE i.inactif = %i
381 381
                         AND i.id_tree= %i
382 382
                         AND (l.action = %s OR (l.action = %s AND l.raison LIKE %s))
@@ -402,8 +402,8 @@  discard block
 block discarded – undo
402 402
                             // Run query
403 403
                             $dataItem = DB::queryFirstRow(
404 404
                                 'SELECT i.pw AS pw, s.share_key AS share_key
405
-                                FROM ' . prefixTable('items') . ' AS i
406
-                                INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (s.object_id = i.id)
405
+                                FROM ' . prefixTable('items').' AS i
406
+                                INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (s.object_id = i.id)
407 407
                                 WHERE user_id = %i AND i.id = %i',
408 408
                                 $session->get('user-id'),
409 409
                                 $record['id']
@@ -427,8 +427,8 @@  discard block
 block discarded – undo
427 427
                             $arr_kbs = '';
428 428
                             $rows_kb = DB::query(
429 429
                                 'SELECT b.label, b.id
430
-                                FROM ' . prefixTable('kb_items') . ' AS a
431
-                                INNER JOIN ' . prefixTable('kb') . ' AS b ON (a.kb_id = b.id)
430
+                                FROM ' . prefixTable('kb_items').' AS a
431
+                                INNER JOIN ' . prefixTable('kb').' AS b ON (a.kb_id = b.id)
432 432
                                 WHERE a.item_id = %i',
433 433
                                 $record['id']
434 434
                             );
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
                                 if (empty($arr_kbs)) {
437 437
                                     $arr_kbs = $rec_kb['label'];
438 438
                                 } else {
439
-                                    $arr_kbs .= ' | ' . $rec_kb['label'];
439
+                                    $arr_kbs .= ' | '.$rec_kb['label'];
440 440
                                 }
441 441
                             }
442 442
 
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
                             $arr_tags = '';
445 445
                             $rows_tag = DB::query(
446 446
                                 'SELECT tag
447
-                                FROM ' . prefixTable('tags') . '
447
+                                FROM ' . prefixTable('tags').'
448 448
                                 WHERE item_id = %i',
449 449
                                 $record['id']
450 450
                             );
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
                                 if (empty($arr_tags)) {
453 453
                                     $arr_tags = $rec_tag['tag'];
454 454
                                 } else {
455
-                                    $arr_tags .= ' ' . $rec_tag['tag'];
455
+                                    $arr_tags .= ' '.$rec_tag['tag'];
456 456
                                 }
457 457
                             }
458 458
 
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
             // query
531 531
             $rows = DB::query(
532 532
                 'SELECT * 
533
-                FROM ' . prefixTable('export') . ' 
533
+                FROM ' . prefixTable('export').' 
534 534
                 WHERE export_tag = %s',
535 535
                 $dataReceived['export_tag']
536 536
             );
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
                 $prev_path = '';
543 543
 
544 544
                 //Prepare the PDF file
545
-                include $SETTINGS['cpassman_dir'] . '/vendor/tecnickcom/tcpdf/tcpdf.php';
545
+                include $SETTINGS['cpassman_dir'].'/vendor/tecnickcom/tcpdf/tcpdf.php';
546 546
 
547 547
                 $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
548 548
                 $pdf->SetProtection(array('print'), $dataReceived['pdf_password'], null);
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
 
555 555
                 // set default header data
556 556
                 $pdf->SetHeaderData(
557
-                    $SETTINGS['cpassman_dir'] . '/includes/images/teampass-logo2-home.png',
557
+                    $SETTINGS['cpassman_dir'].'/includes/images/teampass-logo2-home.png',
558 558
                     PDF_HEADER_LOGO_WIDTH,
559 559
                     'Teampass export',
560 560
                     $session->get('user-lastname')." ".$session->get('user-name').' @ '.date($SETTINGS['date_format']." ".$SETTINGS['time_format'], (int) time())
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
                 logEvents($SETTINGS, 'pdf_export', '', (string) $session->get('user-id'), $session->get('user-login'));
665 665
 
666 666
                 //clean table
667
-                DB::query('TRUNCATE TABLE ' . prefixTable('export'));
667
+                DB::query('TRUNCATE TABLE '.prefixTable('export'));
668 668
 
669 669
                 // Clean any content of the output buffer
670 670
                 ob_end_clean();
@@ -702,13 +702,13 @@  discard block
 block discarded – undo
702 702
             // step 1:
703 703
             // - prepare export file
704 704
             // - get full list of objects id to export
705
-            include $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
705
+            include $SETTINGS['cpassman_dir'].'/includes/config/include.php';
706 706
             $idsList = array();
707 707
 
708 708
             // query
709 709
             $rows = DB::query(
710 710
                 'SELECT * 
711
-                FROM ' . prefixTable('export') . ' 
711
+                FROM ' . prefixTable('export').' 
712 712
                 WHERE export_tag = %s',
713 713
                 $inputData['export_tag']
714 714
             );
@@ -745,13 +745,13 @@  discard block
 block discarded – undo
745 745
             }
746 746
             // prepare export file
747 747
             //save the file
748
-            $outstream = fopen($SETTINGS['path_to_files_folder'] . (substr($SETTINGS['path_to_files_folder'] , -1) === '/' ? '' : '/') . $inputData['filename'], 'w');
748
+            $outstream = fopen($SETTINGS['path_to_files_folder'].(substr($SETTINGS['path_to_files_folder'], -1) === '/' ? '' : '/').$inputData['filename'], 'w');
749 749
             if ($outstream === false) {
750 750
                 echo (string) prepareExchangedData(
751 751
                     [
752 752
                         'error' => true,
753 753
                         'message' => $lang->get('error_while_creating_file'),
754
-                        'detail' => $SETTINGS['path_to_files_folder'] . $inputData['filename'],
754
+                        'detail' => $SETTINGS['path_to_files_folder'].$inputData['filename'],
755 755
                     ],
756 756
                     'encode'
757 757
                 );
@@ -777,12 +777,12 @@  discard block
 block discarded – undo
777 777
     </style>
778 778
     </head>
779 779
     <body>
780
-    <input type="hidden" id="generation_date" value="' . GibberishAES::enc(/** @scrutinizer ignore-type */ (string) time(), $inputData['password']) . '" />
780
+    <input type="hidden" id="generation_date" value="' . GibberishAES::enc(/** @scrutinizer ignore-type */ (string) time(), $inputData['password']).'" />
781 781
     <div id="header">
782
-    ' . TP_TOOL_NAME . ' - Off Line mode
782
+    ' . TP_TOOL_NAME.' - Off Line mode
783 783
     </div>
784 784
     <div style="margin:10px; font-size:9px;">
785
-    <i>This page was generated by <b>' . $session->get('user-name') . ' ' . $session->get('user-lastname') . '</b>, the ' . date('Y/m/d H:i:s') . '.</i>
785
+    <i>This page was generated by <b>' . $session->get('user-name').' '.$session->get('user-lastname').'</b>, the '.date('Y/m/d H:i:s').'.</i>
786 786
     <span id="info_page" style="margin-left:20px; font-weight:bold; font-size: 14px; color:red;"></span>
787 787
     </div>
788 788
     <div id="information"></div>
@@ -793,11 +793,11 @@  discard block
 block discarded – undo
793 793
     <div>
794 794
     <table id="itemsTable">
795 795
         <thead><tr>
796
-            <th style="width:15%;">' . $lang->get('label') . '</th>
797
-            <th style="width:10%;">' . $lang->get('pw') . '</th>
798
-            <th style="width:30%;">' . $lang->get('description') . '</th>
799
-            <th style="width:5%;">' . $lang->get('user_login') . '</th>
800
-            <th style="width:20%;">' . $lang->get('url') . '</th>
796
+            <th style="width:15%;">' . $lang->get('label').'</th>
797
+            <th style="width:10%;">' . $lang->get('pw').'</th>
798
+            <th style="width:30%;">' . $lang->get('description').'</th>
799
+            <th style="width:5%;">' . $lang->get('user_login').'</th>
800
+            <th style="width:20%;">' . $lang->get('url').'</th>
801 801
         </tr></thead>
802 802
         <tbody id="itemsTable_tbody">'
803 803
             );
@@ -811,8 +811,8 @@  discard block
 block discarded – undo
811 811
                     'loop' => true,
812 812
                     'ids_list' => json_encode($idsList),
813 813
                     'ids_count' => count($idsList),
814
-                    'file_path' => $SETTINGS['path_to_files_folder'] . (substr($SETTINGS['path_to_files_folder'] , -1) === '/' ? '' : '/') . $inputData['filename'],
815
-                    'file_link' => $SETTINGS['url_to_files_folder'] . (substr($SETTINGS['path_to_files_folder'] , -1) === '/' ? '' : '/') . $inputData['filename'],
814
+                    'file_path' => $SETTINGS['path_to_files_folder'].(substr($SETTINGS['path_to_files_folder'], -1) === '/' ? '' : '/').$inputData['filename'],
815
+                    'file_link' => $SETTINGS['url_to_files_folder'].(substr($SETTINGS['path_to_files_folder'], -1) === '/' ? '' : '/').$inputData['filename'],
816 816
                     'export_tag' => $inputData['export_tag'],
817 817
                 ],
818 818
                 'encode'
@@ -851,12 +851,12 @@  discard block
 block discarded – undo
851 851
             $full_listing = array();
852 852
             $items_id_list = array();
853 853
             $outstream = '';
854
-            include $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
854
+            include $SETTINGS['cpassman_dir'].'/includes/config/include.php';
855 855
 
856 856
             // query
857 857
             $rows = DB::query(
858 858
                 'SELECT * 
859
-                FROM ' . prefixTable('export') . ' 
859
+                FROM ' . prefixTable('export').' 
860 860
                 WHERE export_tag = %s AND item_id IN %ls',
861 861
                 $inputData['export_tag'],
862 862
                 $inputData['idsList']
@@ -870,7 +870,7 @@  discard block
 block discarded – undo
870 870
                         [
871 871
                             'error' => true,
872 872
                             'message' => $lang->get('error_while_creating_file'),
873
-                            'detail' => $SETTINGS['path_to_files_folder'] . $inputData['filename'],
873
+                            'detail' => $SETTINGS['path_to_files_folder'].$inputData['filename'],
874 874
                         ],
875 875
                         'encode'
876 876
                     );
@@ -912,13 +912,13 @@  discard block
 block discarded – undo
912 912
                         if (empty($arboHtml)) {
913 913
                             $arboHtml = $arboHtml_tmp;
914 914
                         } else {
915
-                            $arboHtml .= ' » ' . $arboHtml_tmp;
915
+                            $arboHtml .= ' » '.$arboHtml_tmp;
916 916
                         }
917 917
                     }
918 918
                     fputs(
919 919
                         $outstream,
920 920
                         '
921
-        <tr class="path"><td colspan="5">' . $arboHtml . '</td></tr>'
921
+        <tr class="path"><td colspan="5">' . $arboHtml.'</td></tr>'
922 922
                     );
923 923
                     $idTree = $record['folder_id'];
924 924
 
@@ -926,12 +926,12 @@  discard block
 block discarded – undo
926 926
                     fputs(
927 927
                         $outstream,
928 928
                         '
929
-        <tr class="' . $lineType . '">
930
-            <td>' . addslashes($record['label']) . '</td>
931
-            <td align="center"><span class="span_pw" id="span_' . $record['item_id'] . '"><a href="#" onclick="decryptme(' . $record['item_id'] . ', \'' . $encPw . '\');return false;">Decrypt </a></span><input type="hidden" id="hide_' . $record['item_id'] . '" value="' . $encPw . '" /></td>
932
-            <td>' . (empty($record['description']) === true ? '&nbsp;' : addslashes(str_replace(array(';', '<br />'), array('|', "\n\r"), stripslashes(mb_convert_encoding($record['description'], 'ISO-8859-1', 'UTF-8'))))) . '</td>
933
-            <td align="center">' . (empty($record['login']) === true ? '&nbsp;' : addslashes($record['login'])) . '</td>
934
-            <td align="center">' . (empty($record['url']) === true ? '&nbsp;' : addslashes($record['url'])) . '</td>
929
+        <tr class="' . $lineType.'">
930
+            <td>' . addslashes($record['label']).'</td>
931
+            <td align="center"><span class="span_pw" id="span_' . $record['item_id'].'"><a href="#" onclick="decryptme('.$record['item_id'].', \''.$encPw.'\');return false;">Decrypt </a></span><input type="hidden" id="hide_'.$record['item_id'].'" value="'.$encPw.'" /></td>
932
+            <td>' . (empty($record['description']) === true ? '&nbsp;' : addslashes(str_replace(array(';', '<br />'), array('|', "\n\r"), stripslashes(mb_convert_encoding($record['description'], 'ISO-8859-1', 'UTF-8'))))).'</td>
933
+            <td align="center">' . (empty($record['login']) === true ? '&nbsp;' : addslashes($record['login'])).'</td>
934
+            <td align="center">' . (empty($record['url']) === true ? '&nbsp;' : addslashes($record['url'])).'</td>
935 935
         </tr>'
936 936
                     );
937 937
                 }
@@ -980,7 +980,7 @@  discard block
 block discarded – undo
980 980
             $inputData['password'] = (string) filter_var($dataReceived['password'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
981 981
             
982 982
             // Load includes
983
-            include $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
983
+            include $SETTINGS['cpassman_dir'].'/includes/config/include.php';
984 984
 
985 985
             // read the content of the temporary file
986 986
             $handle = fopen($inputData['filename'].'.txt', 'r');
@@ -989,7 +989,7 @@  discard block
 block discarded – undo
989 989
                     [
990 990
                         'error' => true,
991 991
                         'message' => $lang->get('error_while_creating_file'),
992
-                        'detail' => $SETTINGS['path_to_files_folder'] . $inputData['filename'],
992
+                        'detail' => $SETTINGS['path_to_files_folder'].$inputData['filename'],
993 993
                     ],
994 994
                     'encode'
995 995
                 );
@@ -1001,7 +1001,7 @@  discard block
 block discarded – undo
1001 1001
                     [
1002 1002
                         'error' => true,
1003 1003
                         'message' => $lang->get('error_while_creating_file'),
1004
-                        'detail' => $SETTINGS['path_to_files_folder'] . $inputData['filename'],
1004
+                        'detail' => $SETTINGS['path_to_files_folder'].$inputData['filename'],
1005 1005
                     ],
1006 1006
                     'encode'
1007 1007
                 );
@@ -1017,9 +1017,9 @@  discard block
 block discarded – undo
1017 1017
             $chunks = explode('|#|#|', chunk_split($contents, 10000, '|#|#|'));
1018 1018
             foreach ($chunks as $chunk) {
1019 1019
                 if (empty($encrypted_text) === true) {
1020
-                    $encrypted_text = GibberishAES::enc(/** @scrutinizer ignore-type */ $chunk, $inputData['password'] );
1020
+                    $encrypted_text = GibberishAES::enc(/** @scrutinizer ignore-type */ $chunk, $inputData['password']);
1021 1021
                 } else {
1022
-                    $encrypted_text .= '|#|#|' . GibberishAES::enc(/** @scrutinizer ignore-type */ $chunk, $inputData['password'] );
1022
+                    $encrypted_text .= '|#|#|'.GibberishAES::enc(/** @scrutinizer ignore-type */ $chunk, $inputData['password']);
1023 1023
                 }
1024 1024
             }
1025 1025
 
@@ -1030,7 +1030,7 @@  discard block
 block discarded – undo
1030 1030
                     [
1031 1031
                         'error' => true,
1032 1032
                         'message' => $lang->get('error_while_creating_file'),
1033
-                        'detail' => $SETTINGS['path_to_files_folder'] . $inputData['filename'],
1033
+                        'detail' => $SETTINGS['path_to_files_folder'].$inputData['filename'],
1034 1034
                     ],
1035 1035
                     'encode'
1036 1036
                 );
@@ -1043,9 +1043,9 @@  discard block
 block discarded – undo
1043 1043
         </table></div>
1044 1044
         <input type="button" value="Hide all" onclick="hideAll()" />
1045 1045
         <div id="footer" style="text-align:center;">
1046
-            <a href="https://teampass.net/about/" target="_blank">' . TP_TOOL_NAME . '&nbsp;' . TP_VERSION . '&nbsp;' . TP_COPYRIGHT . '</a>
1046
+            <a href="https://teampass.net/about/" target="_blank">' . TP_TOOL_NAME.'&nbsp;'.TP_VERSION.'&nbsp;'.TP_COPYRIGHT.'</a>
1047 1047
         </div>
1048
-        <div id="enc_html" style="display:none;">' . $encrypted_text . '</div>
1048
+        <div id="enc_html" style="display:none;">' . $encrypted_text.'</div>
1049 1049
         </body>
1050 1050
     </html>
1051 1051
     <script type="text/javascript">
@@ -1148,12 +1148,12 @@  discard block
 block discarded – undo
1148 1148
             fclose($outstream);
1149 1149
 
1150 1150
             //clean table
1151
-            DB::query('TRUNCATE TABLE ' . prefixTable('export'));
1151
+            DB::query('TRUNCATE TABLE '.prefixTable('export'));
1152 1152
 
1153 1153
             echo (string) prepareExchangedData(
1154 1154
                 [
1155 1155
                     'error' => false,
1156
-                    'filelink' => $inputData['file_link'] ,
1156
+                    'filelink' => $inputData['file_link'],
1157 1157
                 ],
1158 1158
                 'encode'
1159 1159
             );
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
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 ) {
78 78
     // Not allowed page
79 79
     $session->set('system-error_code', ERR_NOT_ALLOWED);
80
-    include $SETTINGS['cpassman_dir'] . '/error.php';
80
+    include $SETTINGS['cpassman_dir'].'/error.php';
81 81
     exit;
82 82
 }
83 83
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
             $arrFolders = array();
129 129
             $rows = DB::query(
130 130
                 'SELECT valeur, intitule
131
-                FROM ' . prefixTable('misc') . '
131
+                FROM ' . prefixTable('misc').'
132 132
                 WHERE type  = %s',
133 133
                 'folder_deleted'
134 134
             );
@@ -150,10 +150,10 @@  discard block
 block discarded – undo
150 150
                 'SELECT u.login as login, u.name as name, u.lastname as lastname,
151 151
                 i.id as id, i.label as label,
152 152
                 i.id_tree as id_tree, l.date as date, n.title as folder_title
153
-                FROM ' . prefixTable('log_items') . ' as l
154
-                INNER JOIN ' . prefixTable('items') . ' as i ON (l.id_item=i.id)
155
-                LEFT JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id)
156
-                LEFT JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree=n.id)
153
+                FROM ' . prefixTable('log_items').' as l
154
+                INNER JOIN ' . prefixTable('items').' as i ON (l.id_item=i.id)
155
+                LEFT JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id)
156
+                LEFT JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree=n.id)
157 157
                 WHERE i.inactif = %i
158 158
                 AND l.action = %s',
159 159
                 1,
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
                             'label' => $record['label'],
176 176
                             'date' => date($SETTINGS['date_format'], (int) $record['date']),
177 177
                             'login' => $record['login'],
178
-                            'name' => $record['name'] . ' ' . $record['lastname'],
178
+                            'name' => $record['name'].' '.$record['lastname'],
179 179
                             'folder_label' => $record['folder_title'],
180 180
                             'folder_deleted' => $thisFolder,
181 181
                         )
@@ -233,10 +233,10 @@  discard block
 block discarded – undo
233 233
             foreach ($post_folders as $folderId) {
234 234
                 $data = DB::queryFirstRow(
235 235
                     'SELECT valeur
236
-                    FROM ' . prefixTable('misc') . "
236
+                    FROM ' . prefixTable('misc')."
237 237
                     WHERE type = 'folder_deleted'
238 238
                     AND intitule = %s",
239
-                    'f' . $folderId
239
+                    'f'.$folderId
240 240
                 );
241 241
                 if ((int) $data['valeur'] !== 0) {
242 242
                     $folderData = explode(', ', $data['valeur']);
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
                         prefixTable('misc'),
264 264
                         'type = %s AND intitule = %s',
265 265
                         'folder_deleted',
266
-                        'f' . $folderId
266
+                        'f'.$folderId
267 267
                     );
268 268
 
269 269
                     // Restore all items in this folder
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
                     // Get list of all items in thos folder
280 280
                     $items = DB::query(
281 281
                         'SELECT id
282
-                        FROM ' . prefixTable('items') . '
282
+                        FROM ' . prefixTable('items').'
283 283
                         WHERE id_tree = %i',
284 284
                         $folderId
285 285
                     );
@@ -368,10 +368,10 @@  discard block
 block discarded – undo
368 368
             foreach ($post_folders as $folderId) {
369 369
                 $data = DB::queryFirstRow(
370 370
                     'SELECT valeur
371
-                    FROM ' . prefixTable('misc') . "
371
+                    FROM ' . prefixTable('misc')."
372 372
                     WHERE type = 'folder_deleted'
373 373
                     AND intitule = %s",
374
-                    'f' . $folderId
374
+                    'f'.$folderId
375 375
                 );
376 376
                 if ((int) $data['valeur'] !== 0) {
377 377
                     $exploded = explode(',', $data['valeur']);
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
                         prefixTable('misc'),
383 383
                         'type = %s AND intitule = %s',
384 384
                         'folder_deleted',
385
-                        'f' . $folderData[0]
385
+                        'f'.$folderData[0]
386 386
                     );
387 387
 
388 388
                     // Delete all items in this folder
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
                     // Get list of all items in thos folder
397 397
                     $items = DB::query(
398 398
                         'SELECT id
399
-                        FROM ' . prefixTable('items') . '
399
+                        FROM ' . prefixTable('items').'
400 400
                         WHERE id_tree = %i',
401 401
                         $folderData[0]
402 402
                     );
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
                         // Delete all fields
414 414
                         $fields = DB::query(
415 415
                             'SELECT id
416
-                            FROM ' . prefixTable('categories_items') . '
416
+                            FROM ' . prefixTable('categories_items').'
417 417
                             WHERE item_id = %i',
418 418
                             $folderData[0]
419 419
                         );
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
                         // Delete all files
434 434
                         $files = DB::query(
435 435
                             'SELECT id
436
-                            FROM ' . prefixTable('files') . '
436
+                            FROM ' . prefixTable('files').'
437 437
                             WHERE id_item = %i',
438 438
                             $folderData[0]
439 439
                         );
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
                 // Delete sharekey fields
491 491
                 $itemFields = DB::query(
492 492
                     'SELECT id
493
-                    FROM ' . prefixTable('categories_items') . '
493
+                    FROM ' . prefixTable('categories_items').'
494 494
                     WHERE item_id = %i',
495 495
                     $itemId
496 496
                 );
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
                 // Delete sharekey files
506 506
                 $itemFiles = DB::query(
507 507
                     'SELECT id
508
-                    FROM ' . prefixTable('files') . '
508
+                    FROM ' . prefixTable('files').'
509 509
                     WHERE id_item = %i',
510 510
                     $itemId
511 511
                 );
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
             ) {
583 583
                 if ($post_log_type === 'items') {
584 584
                     DB::query(
585
-                        'SELECT * FROM ' . prefixTable('log_items') . '
585
+                        'SELECT * FROM '.prefixTable('log_items').'
586 586
                         WHERE (date BETWEEN %i AND %i)'
587 587
                         . ($post_filter_action === 'all' ? '' : ' AND action = "'.$post_filter_action.'"')
588 588
                         . ((int) $post_filter_user === -1 ? '' : ' AND id_user = '.(int) $post_filter_user),
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
                 } elseif ($post_log_type === 'connections') {
603 603
                     //db::debugmode(true);
604 604
                     DB::query(
605
-                        'SELECT * FROM ' . prefixTable('log_system') . '
605
+                        'SELECT * FROM '.prefixTable('log_system').'
606 606
                         WHERE type=%s '
607 607
                         . 'AND (date BETWEEN %i AND %i)'
608 608
                         . ($post_filter_action === 'all' ? '' : ' AND action = '.$post_filter_action)
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
                     );
626 626
                 } elseif ($post_log_type === 'errors') {
627 627
                     DB::query(
628
-                        'SELECT * FROM ' . prefixTable('log_system') . ' WHERE type=%s ' .
628
+                        'SELECT * FROM '.prefixTable('log_system').' WHERE type=%s '.
629 629
                             'AND (date BETWEEN %i AND %i)',
630 630
                         'error',
631 631
                         $post_date_from,
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
                     );
643 643
                 } elseif ($post_log_type === 'copy') {
644 644
                     DB::query(
645
-                        'SELECT * FROM ' . prefixTable('log_items') . ' WHERE action=%s ' .
645
+                        'SELECT * FROM '.prefixTable('log_items').' WHERE action=%s '.
646 646
                             'AND (date BETWEEN %i AND %i)',
647 647
                         'at_copy',
648 648
                         $post_date_from,
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
                     );
660 660
                 } elseif ($post_log_type === 'admin') {
661 661
                     DB::query(
662
-                        'SELECT * FROM ' . prefixTable('log_system') . ' WHERE type=%s ' .
662
+                        'SELECT * FROM '.prefixTable('log_system').' WHERE type=%s '.
663 663
                             'AND (date BETWEEN %i AND %i)',
664 664
                         'admin_action',
665 665
                         $post_date_from,
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
                     );
677 677
                 } elseif ($post_log_type === 'failed') {
678 678
                     DB::query(
679
-                        'SELECT * FROM ' . prefixTable('log_system') . ' WHERE type=%s ' .
679
+                        'SELECT * FROM '.prefixTable('log_system').' WHERE type=%s '.
680 680
                             'AND (date BETWEEN %i AND %i)',
681 681
                         'failed_auth',
682 682
                         $post_date_from,
@@ -747,19 +747,19 @@  discard block
 block discarded – undo
747 747
             // Get info about task
748 748
             $taskInfo = DB::queryFirstRow(
749 749
                 'SELECT p.process_type as process_type
750
-                FROM ' . prefixTable('background_tasks') . ' as p
750
+                FROM ' . prefixTable('background_tasks').' as p
751 751
                 WHERE p.increment_id = %i',
752 752
                 $post_id
753 753
             );
754 754
             if ($taskInfo !== null) {
755 755
                 // delete task
756 756
                 DB::query(
757
-                    'DELETE FROM ' . prefixTable('background_subtasks') . '
757
+                    'DELETE FROM '.prefixTable('background_subtasks').'
758 758
                     WHERE task_id = %i',
759 759
                     $post_id
760 760
                 );
761 761
                 DB::query(
762
-                    'DELETE FROM ' . prefixTable('background_tasks') . '
762
+                    'DELETE FROM '.prefixTable('background_tasks').'
763 763
                     WHERE increment_id = %i',
764 764
                     $post_id
765 765
                 );
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
                         ->setDayOfMonth('*')
827 827
                         ->setMonths('*')
828 828
                         ->setDayOfWeek('*')
829
-                        ->setTaskCommandLine($phpBinaryPath . ' ' . $SETTINGS['cpassman_dir'] . '/sources/scheduler.php')
829
+                        ->setTaskCommandLine($phpBinaryPath.' '.$SETTINGS['cpassman_dir'].'/sources/scheduler.php')
830 830
                         ->setComments('Teampass scheduler');
831 831
                     
832 832
                     $crontabRepository->addJob($crontabJob);
Please login to merge, or discard this patch.
sources/core.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -58,16 +58,16 @@  discard block
 block discarded – undo
58 58
 {
59 59
     // Load AntiXSS
60 60
     $antiXss = new AntiXSS();
61
-    if (! headers_sent()) {    //If headers not sent yet... then do php redirect
62
-        header('Location: ' . $antiXss->xss_clean($url));
61
+    if (!headers_sent()) {    //If headers not sent yet... then do php redirect
62
+        header('Location: '.$antiXss->xss_clean($url));
63 63
     }
64 64
 
65 65
     //If headers are sent... do java redirect... if java disabled, do html redirect.
66 66
     echo '<script type="text/javascript">';
67
-    echo 'window.location.href="' . $antiXss->xss_clean($url) . '";';
67
+    echo 'window.location.href="'.$antiXss->xss_clean($url).'";';
68 68
     echo '</script>';
69 69
     echo '<noscript>';
70
-    echo '<meta http-equiv="refresh" content="0;url=' . $antiXss->xss_clean($url) . '" />';
70
+    echo '<meta http-equiv="refresh" content="0;url='.$antiXss->xss_clean($url).'" />';
71 71
     echo '</noscript>';
72 72
 }
73 73
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
     && isset($SETTINGS['enable_sts']) === true
94 94
     && (int) $SETTINGS['enable_sts'] === 1
95 95
 ) {
96
-    teampassRedirect('https://' . $server['http_host'] . $server['request_uri']);
96
+    teampassRedirect('https://'.$server['http_host'].$server['request_uri']);
97 97
 }
98 98
 
99 99
 // Load pwComplexity
@@ -114,11 +114,11 @@  discard block
 block discarded – undo
114 114
 // LOAD CPASSMAN SETTINGS
115 115
 if (
116 116
     isset($SETTINGS['cpassman_dir']) === true
117
-    && is_dir($SETTINGS['cpassman_dir'] . '/install') === true
117
+    && is_dir($SETTINGS['cpassman_dir'].'/install') === true
118 118
 ) {
119 119
     // Should we delete folder INSTALL?
120 120
     $row = DB::queryFirstRow(
121
-        'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type=%s AND intitule=%s',
121
+        'SELECT valeur FROM '.prefixTable('misc').' WHERE type=%s AND intitule=%s',
122 122
         'install',
123 123
         'clear_install_folder'
124 124
     );
@@ -136,11 +136,11 @@  discard block
 block discarded – undo
136 136
             if ($directories !== false) {
137 137
                 $files = array_diff($directories, ['.', '..']);
138 138
                 foreach ($files as $file) {
139
-                    if (is_dir($dir . '/' . $file)) {
140
-                        delTree($dir . '/' . $file);
139
+                    if (is_dir($dir.'/'.$file)) {
140
+                        delTree($dir.'/'.$file);
141 141
                     } else {
142 142
                         try {
143
-                            unlink($dir . '/' . $file);
143
+                            unlink($dir.'/'.$file);
144 144
                         } catch (Exception $e) {
145 145
                             // do nothing... php will ignore and continue
146 146
                         }
@@ -154,13 +154,13 @@  discard block
 block discarded – undo
154 154
             return false;
155 155
         }
156 156
 
157
-        if (is_dir($SETTINGS['cpassman_dir'] . '/install')) {
157
+        if (is_dir($SETTINGS['cpassman_dir'].'/install')) {
158 158
             // Set the permissions on the install directory and delete
159 159
             // is server Windows or Linux?
160 160
             if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
161
-                recursiveChmod($SETTINGS['cpassman_dir'] . '/install', 0755, 0440);
161
+                recursiveChmod($SETTINGS['cpassman_dir'].'/install', 0755, 0440);
162 162
             }
163
-            delTree($SETTINGS['cpassman_dir'] . '/install');
163
+            delTree($SETTINGS['cpassman_dir'].'/install');
164 164
         }
165 165
 
166 166
         // Delete temporary install table
@@ -178,10 +178,10 @@  discard block
 block discarded – undo
178 178
 // Load Languages stuff
179 179
 if (isset($languagesList) === false) {
180 180
     $languagesList = [];
181
-    $rows = DB::query('SELECT * FROM ' . prefixTable('languages') . ' GROUP BY name, label, code, flag, id ORDER BY name ASC');
181
+    $rows = DB::query('SELECT * FROM '.prefixTable('languages').' GROUP BY name, label, code, flag, id ORDER BY name ASC');
182 182
     foreach ($rows as $record) {
183 183
         array_push($languagesList, $record['name']);
184
-        if ($session->get('user-language') === $record['name'] ) {
184
+        if ($session->get('user-language') === $record['name']) {
185 185
             $session->set('user-language_flag', $record['flag']);
186 186
             $session->set('user-language_code', $record['code']);
187 187
             //$session->set('user-language_label', $record['label']);
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 // CHECK IF SESSION EXISTS AND IF SESSION IS VALID
239 239
 if (empty($session->get('user-session_duration')) === false) {
240 240
     $dataSession = DB::queryFirstRow(
241
-        'SELECT key_tempo FROM ' . prefixTable('users') . ' WHERE id=%i',
241
+        'SELECT key_tempo FROM '.prefixTable('users').' WHERE id=%i',
242 242
         $session->get('user-id')
243 243
     );
244 244
 } else {
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
     && ($session->has('user-admin') && $session->get('user-admin') && null !== $session->get('user-admin') && $session->get('user-admin') === 1)
294 294
 ) {
295 295
     $row = DB::queryFirstRow(
296
-        'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type=%s_type AND intitule=%s_intitule',
296
+        'SELECT valeur FROM '.prefixTable('misc').' WHERE type=%s_type AND intitule=%s_intitule',
297 297
         [
298 298
             'type' => 'admin',
299 299
             'intitule' => 'teampass_version',
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 
335 335
         syslog(
336 336
             LOG_WARNING,
337
-            'Unlog user: ' . date('Y/m/d H:i:s') . " {$server['remote_addr']} ({$server['http_user_agent']})"
337
+            'Unlog user: '.date('Y/m/d H:i:s')." {$server['remote_addr']} ({$server['http_user_agent']})"
338 338
         );
339 339
         // erase session table
340 340
         $session->invalidate();
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 if ($session->has('user-timezone') && null !== $session->get('user-id') && empty($session->get('user-id')) === false) {
389 389
     // query on user
390 390
     $data = DB::queryFirstRow(
391
-        'SELECT login, admin, gestionnaire, can_manage_all_users, groupes_visibles, groupes_interdits, fonction_id, last_connexion, roles_from_ad_groups, auth_type, last_pw_change FROM ' . prefixTable('users') . ' WHERE id=%i',
391
+        'SELECT login, admin, gestionnaire, can_manage_all_users, groupes_visibles, groupes_interdits, fonction_id, last_connexion, roles_from_ad_groups, auth_type, last_pw_change FROM '.prefixTable('users').' WHERE id=%i',
392 392
         $session->get('user-id')
393 393
     );
394 394
     //Check if user has been deleted or unlogged
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
             $data['groupes_visibles'],
436 436
             $data['groupes_interdits'],
437 437
             $data['admin'],
438
-            is_null($data['roles_from_ad_groups']) === true ? $data['fonction_id'] : (empty($data['roles_from_ad_groups']) === true ? $data['fonction_id'] : $data['fonction_id'] . ';' . $data['roles_from_ad_groups']),
438
+            is_null($data['roles_from_ad_groups']) === true ? $data['fonction_id'] : (empty($data['roles_from_ad_groups']) === true ? $data['fonction_id'] : $data['fonction_id'].';'.$data['roles_from_ad_groups']),
439 439
             $SETTINGS
440 440
         );
441 441
         if ($session->has('user-can_create_root_folder') && (int) $session->get('user-can_create_root_folder') && null !== $session->get('user-can_create_root_folder') && (int) $session->get('user-can_create_root_folder') === 1) {
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
     $session->set('system-item_fields', []);
471 471
     $rows = DB::query(
472 472
         'SELECT *
473
-            FROM ' . prefixTable('categories') . '
473
+            FROM ' . prefixTable('categories').'
474 474
             WHERE level=%i',
475 475
         '0'
476 476
     );
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
         // get each field
480 480
         $rows2 = DB::query(
481 481
             'SELECT *
482
-            FROM ' . prefixTable('categories') . '
482
+            FROM ' . prefixTable('categories').'
483 483
             WHERE parent_id=%i
484 484
             ORDER BY `order` ASC',
485 485
             $record['id']
@@ -566,5 +566,5 @@  discard block
 block discarded – undo
566 566
 }
567 567
 
568 568
 /* CHECK NUMBER OF USER ONLINE */
569
-DB::query('SELECT * FROM ' . prefixTable('users') . ' WHERE timestamp>=%i', time() - 600);
569
+DB::query('SELECT * FROM '.prefixTable('users').' WHERE timestamp>=%i', time() - 600);
570 570
 $session->set('system-nb_users_online', DB::count());
Please login to merge, or discard this patch.
sources/find.queries.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 ) {
74 74
     // Not allowed page
75 75
     $session->set('system-error_code', ERR_NOT_ALLOWED);
76
-    include $SETTINGS['cpassman_dir'] . '/error.php';
76
+    include $SETTINGS['cpassman_dir'].'/error.php';
77 77
     exit;
78 78
 }
79 79
 
@@ -92,12 +92,12 @@  discard block
 block discarded – undo
92 92
 if (null === $session->get('user-accessible_folders')
93 93
     || empty($session->get('user-accessible_folders')) === true
94 94
 ) {
95
-    echo '{"sEcho": ' . $request->query->filter('sEcho', FILTER_SANITIZE_NUMBER_INT) . ' ,"iTotalRecords": "0", "iTotalDisplayRecords": "0", "aaData": [] }';
95
+    echo '{"sEcho": '.$request->query->filter('sEcho', FILTER_SANITIZE_NUMBER_INT).' ,"iTotalRecords": "0", "iTotalDisplayRecords": "0", "aaData": [] }';
96 96
     exit;
97 97
 }
98 98
 
99 99
 //Columns name
100
-$aColumns = ['c.id', 'c.label', 'c.login', 'c.description', 'c.tags', 'c.id_tree', 'c.folder', 'c.login', 'c.url', 'ci.data'];//
100
+$aColumns = ['c.id', 'c.label', 'c.login', 'c.description', 'c.tags', 'c.id_tree', 'c.folder', 'c.login', 'c.url', 'ci.data']; //
101 101
 $aSortTypes = ['ASC', 'DESC'];
102 102
 //init SQL variables
103 103
 $sOrder = $sLimit = $sWhere = '';
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 
118 118
 //Get current user "personal folder" ID
119 119
 $row = DB::query(
120
-    'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE title = %i',
120
+    'SELECT id FROM '.prefixTable('nested_tree').' WHERE title = %i',
121 121
     intval($session->get('user-id'))
122 122
 );
123 123
 //get list of personal folders
@@ -126,20 +126,20 @@  discard block
 block discarded – undo
126 126
 $listPf = '';
127 127
 if (empty($row['id']) === false) {
128 128
     $rows = DB::query(
129
-        'SELECT id FROM ' . prefixTable('nested_tree') . '
129
+        'SELECT id FROM '.prefixTable('nested_tree').'
130 130
         WHERE personal_folder = 1 AND NOT parent_id = %i AND NOT title = %i',
131 131
         filter_var($row['id'], FILTER_SANITIZE_NUMBER_INT),
132 132
         filter_var($session->get('user-id'), FILTER_SANITIZE_NUMBER_INT)
133 133
     );
134 134
     foreach ($rows as $record) {
135
-        if (! in_array($record['id'], $arrayPf)) {
135
+        if (!in_array($record['id'], $arrayPf)) {
136 136
             //build an array of personal folders ids
137 137
             array_push($arrayPf, $record['id']);
138 138
             //build also a string with those ids
139 139
             if (empty($listPf)) {
140 140
                 $listPf = $record['id'];
141 141
             } else {
142
-                $listPf .= ', ' . $record['id'];
142
+                $listPf .= ', '.$record['id'];
143 143
             }
144 144
         }
145 145
     }
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 //Paging
150 150
 $sLimit = '';
151 151
 if (null !== $request->query->get('start') && $request->query->get('length') !== '-1') {
152
-    $sLimit = 'LIMIT ' . $request->query->filter('start', null, FILTER_SANITIZE_NUMBER_INT) . ', ' . $request->query->filter('length', null, FILTER_SANITIZE_NUMBER_INT) . '';
152
+    $sLimit = 'LIMIT '.$request->query->filter('start', null, FILTER_SANITIZE_NUMBER_INT).', '.$request->query->filter('length', null, FILTER_SANITIZE_NUMBER_INT).'';
153 153
 }
154 154
 
155 155
 //Ordering
@@ -163,8 +163,8 @@  discard block
 block discarded – undo
163 163
     }
164 164
     $sOrder = 'ORDER BY  ';
165 165
     if ($orderParam[0]['column'] >= 0) {
166
-        $sOrder .= '' . $aColumns[filter_var($orderParam[0]['column'], FILTER_SANITIZE_NUMBER_INT)] . ' '
167
-                . filter_var($orderParam[0]['dir'], FILTER_SANITIZE_FULL_SPECIAL_CHARS) . ', ';
166
+        $sOrder .= ''.$aColumns[filter_var($orderParam[0]['column'], FILTER_SANITIZE_NUMBER_INT)].' '
167
+                . filter_var($orderParam[0]['dir'], FILTER_SANITIZE_FULL_SPECIAL_CHARS).', ';
168 168
     }
169 169
 
170 170
     $sOrder = substr_replace($sOrder, '', -2);
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
         $sOrder = '';
173 173
     }
174 174
 } else {
175
-    $sOrder = 'ORDER BY ' . $aColumns[1] . ' ASC';
175
+    $sOrder = 'ORDER BY '.$aColumns[1].' ASC';
176 176
 }
177 177
 
178 178
 // Define criteria
@@ -196,9 +196,9 @@  discard block
 block discarded – undo
196 196
 if (empty($search_criteria) === false) {
197 197
     $sWhere .= ' AND (';
198 198
     for ($i = 0; $i < count($aColumns); ++$i) {
199
-        $sWhere .= $aColumns[$i] . ' LIKE %ss_' . $i . ' OR ';
199
+        $sWhere .= $aColumns[$i].' LIKE %ss_'.$i.' OR ';
200 200
     }
201
-    $sWhere = substr_replace((string) $sWhere, '', -3) . ') ';
201
+    $sWhere = substr_replace((string) $sWhere, '', -3).') ';
202 202
     $crit = [
203 203
         'idtree' => array_unique($folders),
204 204
         '0' => $search_criteria,
@@ -235,16 +235,16 @@  discard block
 block discarded – undo
235 235
 
236 236
 // Do NOT show the items in PERSONAL FOLDERS
237 237
 if (empty($listPf) === false) {
238
-    $sWhere = 'WHERE ' . $sWhere . ' AND c.id_tree NOT IN %ls_pf ';
238
+    $sWhere = 'WHERE '.$sWhere.' AND c.id_tree NOT IN %ls_pf ';
239 239
 } else {
240
-    $sWhere = 'WHERE ' . $sWhere;
240
+    $sWhere = 'WHERE '.$sWhere;
241 241
 }
242 242
 
243 243
 // Do queries
244 244
 DB::query(
245 245
     "SELECT c.id
246
-    FROM " . prefixTable('cache') . " AS c
247
-    LEFT JOIN " . prefixTable('categories_items') . " AS ci ON (ci.item_id = c.id)
246
+    FROM " . prefixTable('cache')." AS c
247
+    LEFT JOIN " . prefixTable('categories_items')." AS ci ON (ci.item_id = c.id)
248 248
     {$sWhere}
249 249
     {$sOrder}",
250 250
     $crit
@@ -252,9 +252,9 @@  discard block
 block discarded – undo
252 252
 $iTotal = DB::count();
253 253
 $rows = DB::query(
254 254
     "SELECT c.*, ci.data, i.item_key
255
-    FROM " . prefixTable('cache') . " AS c
256
-    LEFT JOIN " . prefixTable('categories_items') . " AS ci ON (ci.item_id = c.id)
257
-    INNER JOIN " . prefixTable('items') . " AS i ON (i.id = c.id)
255
+    FROM " . prefixTable('cache')." AS c
256
+    LEFT JOIN " . prefixTable('categories_items')." AS ci ON (ci.item_id = c.id)
257
+    INNER JOIN " . prefixTable('items')." AS i ON (i.id = c.id)
258 258
     {$sWhere}
259 259
     {$sOrder}
260 260
     {$sLimit}",
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 if (null === $request->query->get('type')) {
280 280
     $sOutput = '{';
281 281
     if (null !== $request->query->get('draw')) {
282
-        $sOutput .= '"draw": ' . $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
282
+        $sOutput .= '"draw": '.$request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
283 283
     }
284 284
     $sOutput .= '"data": [';
285 285
     $sOutputConst = '';
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
             foreach (explode(';', $session->get('user-roles')) as $role) {
297 297
                 //db::debugmode(true);
298 298
                 $access = DB::queryFirstRow(
299
-                    'SELECT type FROM ' . prefixTable('roles_values') . ' WHERE role_id = %i AND folder_id = %i',
299
+                    'SELECT type FROM '.prefixTable('roles_values').' WHERE role_id = %i AND folder_id = %i',
300 300
                     $role,
301 301
                     $record['id_tree']
302 302
                 );
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
             }
317 317
             $accessLevel = count($arrTmp) > 0 ? min($arrTmp) : $accessLevel;
318 318
             if ($accessLevel === 0) {
319
-                $checkbox = '<input type=\"checkbox\" value=\"0\" class=\"mass_op_cb\" data-id=\"' . $record['id'] . '\">';
319
+                $checkbox = '<input type=\"checkbox\" value=\"0\" class=\"mass_op_cb\" data-id=\"'.$record['id'].'\">';
320 320
             }
321 321
 
322 322
             if ((int) $accessLevel === 0) {
@@ -356,22 +356,22 @@  discard block
 block discarded – undo
356 356
             if (empty($restrictedTo)) {
357 357
                 $restrictedTo = $session->get('user-id');
358 358
             } else {
359
-                $restrictedTo .= ',' . $session->get('user-id');
359
+                $restrictedTo .= ','.$session->get('user-id');
360 360
             }
361 361
         }
362 362
         
363 363
         //col1
364
-        $sOutputItem .= '"<i class=\"fa fa-external-link-alt infotip mr-2\" title=\"' . $lang->get('open_url_link') . '\" onClick=\"window.location.href=&#039;index.php?page=items&amp;group=' . $record['id_tree'] . '&amp;id=' . $record['id'] . '&#039;\" style=\"cursor:pointer;\"></i>' .
365
-        '<i class=\"fa fa-eye infotip mr-2 item-detail\" title=\"' . stripslashes($lang->get('see_item_title')) . '\" data-id=\"' . $record['id'] . '\" data-perso=\"' . $record['perso'] . '\" data-tree-id=\"' . $record['id_tree'] . '\" data-expired=\"' . $expired . '\" data-restricted-to=\"' . $restrictedTo . '\" data-rights=\"' . $right . '\" style=\"cursor:pointer;\"></i>' . $checkbox . '",' ;
364
+        $sOutputItem .= '"<i class=\"fa fa-external-link-alt infotip mr-2\" title=\"'.$lang->get('open_url_link').'\" onClick=\"window.location.href=&#039;index.php?page=items&amp;group='.$record['id_tree'].'&amp;id='.$record['id'].'&#039;\" style=\"cursor:pointer;\"></i>'.
365
+        '<i class=\"fa fa-eye infotip mr-2 item-detail\" title=\"'.stripslashes($lang->get('see_item_title')).'\" data-id=\"'.$record['id'].'\" data-perso=\"'.$record['perso'].'\" data-tree-id=\"'.$record['id_tree'].'\" data-expired=\"'.$expired.'\" data-restricted-to=\"'.$restrictedTo.'\" data-rights=\"'.$right.'\" style=\"cursor:pointer;\"></i>'.$checkbox.'",';
366 366
         //col2
367
-        $sOutputItem .= '"'.base64_encode('<span id=\"item_label-' . $record['id'] . '\">' . (str_replace("\\", "&#92;", (string) $record['label'])) . '</span>').'", ';   // replace backslash #3015
367
+        $sOutputItem .= '"'.base64_encode('<span id=\"item_label-'.$record['id'].'\">'.(str_replace("\\", "&#92;", (string) $record['label'])).'</span>').'", '; // replace backslash #3015
368 368
         //col3
369
-        $sOutputItem .= '"' . base64_encode(str_replace('&amp;', '&', htmlspecialchars(stripslashes((string) $record['login']), ENT_QUOTES))) . '", ';
369
+        $sOutputItem .= '"'.base64_encode(str_replace('&amp;', '&', htmlspecialchars(stripslashes((string) $record['login']), ENT_QUOTES))).'", ';
370 370
         //col4
371 371
         //get restriction from ROles
372 372
         $restrictedToRole = false;
373 373
         $rTmp = DB::queryFirstColumn(
374
-            'SELECT role_id FROM ' . prefixTable('restriction_to_roles') . ' WHERE item_id = %i',
374
+            'SELECT role_id FROM '.prefixTable('restriction_to_roles').' WHERE item_id = %i',
375 375
             $record['id']
376 376
         );
377 377
         // We considere here that if user has at least one group similar to the object ones
@@ -389,14 +389,14 @@  discard block
 block discarded – undo
389 389
         } else {
390 390
             $txt = str_replace(['\n', '<br />', '\\'], [' ', ' ', '', ' '], strip_tags($record['description']));
391 391
             if (strlen($txt) > 50) {
392
-                $sOutputItem .= '"' . base64_encode(substr(stripslashes(preg_replace('~/<[\/]{0,1}[^>]*>\//|[ \t]/~', '', $txt)), 0, 50)) . '", ';
392
+                $sOutputItem .= '"'.base64_encode(substr(stripslashes(preg_replace('~/<[\/]{0,1}[^>]*>\//|[ \t]/~', '', $txt)), 0, 50)).'", ';
393 393
             } else {
394
-                $sOutputItem .= '"' . base64_encode(stripslashes(preg_replace('~/<[^>]*>|[ \t]/~', '', $txt))) . '", ';
394
+                $sOutputItem .= '"'.base64_encode(stripslashes(preg_replace('~/<[^>]*>|[ \t]/~', '', $txt))).'", ';
395 395
             }
396 396
         }
397 397
 
398 398
         //col5 - TAGS
399
-        $sOutputItem .= '"' . base64_encode(htmlspecialchars(stripslashes((string) $record['tags']), ENT_QUOTES)) . '", ';
399
+        $sOutputItem .= '"'.base64_encode(htmlspecialchars(stripslashes((string) $record['tags']), ENT_QUOTES)).'", ';
400 400
         // col6 - URL
401 401
         if ($record['url'] !== '0') {
402 402
             $sOutputItem .= '"'.htmlspecialchars(filter_var($record['url'], FILTER_SANITIZE_URL)).'", ';
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
         }
406 406
 
407 407
         //col7 - Prepare the Treegrid
408
-        $sOutputItem .= '"' . base64_encode(stripslashes((string) $record['folder'])) . '"';
408
+        $sOutputItem .= '"'.base64_encode(stripslashes((string) $record['folder'])).'"';
409 409
         //Finish the line
410 410
         //$sOutputItem .= '], ';
411 411
         if ($getItemInList === true) {
@@ -414,17 +414,17 @@  discard block
 block discarded – undo
414 414
             --$iTotal;
415 415
         }
416 416
     }
417
-    if (! empty($sOutputConst)) {
417
+    if (!empty($sOutputConst)) {
418 418
         $sOutput .= substr_replace($sOutputConst, '', -2);
419 419
     }
420 420
     $sOutput .= '], ';
421
-    $sOutput .= '"recordsTotal": ' . $iTotal . ', ';
422
-    $sOutput .= '"recordsFiltered": ' . $iTotal . ' }';
421
+    $sOutput .= '"recordsTotal": '.$iTotal.', ';
422
+    $sOutput .= '"recordsFiltered": '.$iTotal.' }';
423 423
     // file deepcode ignore XSS: data is secured
424 424
     echo ($sOutput);
425 425
 } elseif (null !== $request->query->get('type') && ($request->query->get('type') === 'search_for_items' || $request->query->get('type') === 'search_for_items_with_tags')) {
426 426
     include_once 'main.functions.php';
427
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $session->get('user-language') . '.php';
427
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$session->get('user-language').'.php';
428 428
 
429 429
     $totalItems = $request->query->filter('totalItems', null, FILTER_SANITIZE_NUMBER_INT);
430 430
 
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
         $arr_data[$record['id']]['tree_id'] = (int) $record['id_tree'];
436 436
         $arr_data[$record['id']]['label'] = (string) $record['label'];
437 437
         $arr_data[$record['id']]['desc'] = (string) strip_tags(explode('<br>', $record['description'])[0]);
438
-        $arr_data[$record['id']]['folder'] = (string)$record['folder'];
438
+        $arr_data[$record['id']]['folder'] = (string) $record['folder'];
439 439
         $arr_data[$record['id']]['login'] = (string) strtr($record['login'], '"', '&quot;');
440 440
         $arr_data[$record['id']]['item_key'] = (string) $record['item_key'];
441 441
         $arr_data[$record['id']]['link'] = (string) $record['url'] !== '0' && empty($record['url']) === false ? filter_var($record['url'], FILTER_SANITIZE_URL) : '';
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 
449 449
         // Anyone can modify?
450 450
         $tmp = DB::queryFirstRow(
451
-            'SELECT anyone_can_modify FROM ' . prefixTable('items') . ' WHERE id = %i',
451
+            'SELECT anyone_can_modify FROM '.prefixTable('items').' WHERE id = %i',
452 452
             $record['id']
453 453
         );
454 454
         if (count($tmp) > 0) {
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
         // => récupérer un tableau contenant les roles associés à cet ID (a partir table restriction_to_roles)
480 480
         $user_is_included_in_role = 0;
481 481
         $roles = DB::query(
482
-            'SELECT role_id FROM ' . prefixTable('restriction_to_roles') . ' WHERE item_id=%i',
482
+            'SELECT role_id FROM '.prefixTable('restriction_to_roles').' WHERE item_id=%i',
483 483
             $record['id']
484 484
         );
485 485
         if (count($roles) > 0) {
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
             if (empty($restrictedTo)) {
503 503
                 $restrictedTo = $session->get('user-id');
504 504
             } else {
505
-                $restrictedTo .= ',' . $session->get('user-id');
505
+                $restrictedTo .= ','.$session->get('user-id');
506 506
             }
507 507
         }
508 508
 
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
             $arrTmp = [];
601 601
             foreach (explode(';', $session->get('user-roles')) as $role) {
602 602
                 $access = DB::queryFirstRow(
603
-                    'SELECT type FROM ' . prefixTable('roles_values') . ' WHERE role_id = %i AND folder_id = %i',
603
+                    'SELECT type FROM '.prefixTable('roles_values').' WHERE role_id = %i AND folder_id = %i',
604 604
                     $role,
605 605
                     $record['id_tree']
606 606
                 );
@@ -651,8 +651,8 @@  discard block
 block discarded – undo
651 651
         ) {
652 652
             $data_item = DB::queryFirstRow(
653 653
                 'SELECT i.pw AS pw, s.share_key AS share_key
654
-                FROM ' . prefixTable('items') . ' AS i
655
-                INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (s.object_id = i.id)
654
+                FROM ' . prefixTable('items').' AS i
655
+                INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (s.object_id = i.id)
656 656
                 WHERE i.id = %i AND s.user_id = %i',
657 657
                 $record['id'],
658 658
                 $session->get('user-id')
Please login to merge, or discard this patch.