Completed
Push — master ( 8da2eb...bc09ea )
by Nils
01:25 queued 59s
created
sources/backups.queries.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -301,7 +301,9 @@
 block discarded – undo
301 301
                 break;
302 302
             }
303 303
             
304
-            if (WIP === true) error_log('DEBUG: Offset -> '.$post_offset.'/'.$post_totalSize.' | File -> '.$post_clearFilename.' | key -> '.$post_key);
304
+            if (WIP === true) {
305
+                error_log('DEBUG: Offset -> '.$post_offset.'/'.$post_totalSize.' | File -> '.$post_clearFilename.' | key -> '.$post_key);
306
+            }
305 307
 
306 308
             include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
307 309
 
Please login to merge, or discard this 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.
self-unlock.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 use Symfony\Component\HttpFoundation\Request as SymfonyRequest;
34 34
 
35 35
 // Load functions
36
-require_once __DIR__. '/includes/config/include.php';
36
+require_once __DIR__.'/includes/config/include.php';
37 37
 require_once __DIR__.'/sources/main.functions.php';
38 38
 
39 39
 // init
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
 // Check for existing lock
54 54
 $result = DB::queryFirstField(
55 55
     'SELECT 1
56
-     FROM ' . prefixTable('auth_failures') . '
56
+     FROM ' . prefixTable('auth_failures').'
57 57
      WHERE unlock_at = (
58 58
         SELECT MAX(unlock_at)
59
-        FROM ' . prefixTable('auth_failures') . '
59
+        FROM ' . prefixTable('auth_failures').'
60 60
         WHERE unlock_at > %s
61 61
         AND source = %s AND value = %s)
62 62
      AND unlock_code = %s',
Please login to merge, or discard this patch.
sources/identify.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2663,7 +2663,7 @@
 block discarded – undo
2663 2663
             'SELECT email, name
2664 2664
              FROM '.prefixTable('users').'
2665 2665
              WHERE login = %s',
2666
-             $value
2666
+                $value
2667 2667
         );
2668 2668
 
2669 2669
         // No valid email address for user
Please login to merge, or discard this patch.
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2401,7 +2401,9 @@  discard block
 block discarded – undo
2401 2401
         // Complete $userInfo
2402 2402
         $userInfo['has_been_created'] = 1;
2403 2403
 
2404
-        if (WIP === true) error_log("--- USER CREATED ---");
2404
+        if (WIP === true) {
2405
+            error_log("--- USER CREATED ---");
2406
+        }
2405 2407
 
2406 2408
         return [
2407 2409
             'error' => false,
@@ -2437,7 +2439,9 @@  discard block
 block discarded – undo
2437 2439
         }
2438 2440
 
2439 2441
         // Oauth2 user already exists and authenticated
2440
-        if (WIP === true) error_log("--- USER AUTHENTICATED ---");
2442
+        if (WIP === true) {
2443
+            error_log("--- USER AUTHENTICATED ---");
2444
+        }
2441 2445
         $userInfo['has_been_created'] = 0;
2442 2446
 
2443 2447
         $passwordManager = new PasswordManager();
@@ -2667,8 +2671,9 @@  discard block
 block discarded – undo
2667 2671
         );
2668 2672
 
2669 2673
         // No valid email address for user
2670
-        if (!$userInfos || !filter_var($userInfos['email'], FILTER_VALIDATE_EMAIL))
2671
-            return;
2674
+        if (!$userInfos || !filter_var($userInfos['email'], FILTER_VALIDATE_EMAIL)) {
2675
+                    return;
2676
+        }
2672 2677
 
2673 2678
         $unlock_url = $SETTINGS['cpassman_url'].'/self-unlock.php?login='.$value.'&otp='.$unlock_code;
2674 2679
 
Please login to merge, or discard this 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&amp;group=' . $dataLastItems['id_tree'] . '&amp;id=' . $item,
680
+                        'url' => 'index.php?page=items&amp;group='.$dataLastItems['id_tree'].'&amp;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/users.datatable.php 1 patch
Spacing   +15 added lines, -17 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
     if (isset($order['column']) && preg_match('#^(asc|desc)$#i', $order['dir'])) {
129 129
         $columnIndex = filter_var($order['column'], FILTER_SANITIZE_NUMBER_INT);
130 130
         $dir = filter_var($order['dir'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
131
-        $sOrder .= $aColumns[$columnIndex] . ' ' . $dir . ', ';
131
+        $sOrder .= $aColumns[$columnIndex].' '.$dir.', ';
132 132
     }
133 133
 
134 134
     $sOrder = substr_replace($sOrder, '', -2);
@@ -152,15 +152,15 @@  discard block
 block discarded – undo
152 152
 
153 153
 if ($letter !== '' && $letter !== 'None') {
154 154
     $sWhere .= ' AND (';
155
-    $sWhere .= $aColumns[1] . " LIKE '" . $letter . "%' OR ";
156
-    $sWhere .= $aColumns[2] . " LIKE '" . $letter . "%' OR ";
157
-    $sWhere .= $aColumns[3] . " LIKE '" . $letter . "%' ";
155
+    $sWhere .= $aColumns[1]." LIKE '".$letter."%' OR ";
156
+    $sWhere .= $aColumns[2]." LIKE '".$letter."%' OR ";
157
+    $sWhere .= $aColumns[3]." LIKE '".$letter."%' ";
158 158
     $sWhere .= ')';
159 159
 } elseif ($searchValue !== '') {
160 160
     $sWhere .= ' AND (';
161
-    $sWhere .= $aColumns[1] . " LIKE '" . $searchValue . "%' OR ";
162
-    $sWhere .= $aColumns[2] . " LIKE '" . $searchValue . "%' OR ";
163
-    $sWhere .= $aColumns[3] . " LIKE '" . $searchValue . "%' ";
161
+    $sWhere .= $aColumns[1]." LIKE '".$searchValue."%' OR ";
162
+    $sWhere .= $aColumns[2]." LIKE '".$searchValue."%' OR ";
163
+    $sWhere .= $aColumns[3]." LIKE '".$searchValue."%' ";
164 164
     $sWhere .= ')';
165 165
 }
166 166
 
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
         // Check for existing lock
248 248
         $unlock_at = DB::queryFirstField(
249 249
             'SELECT MAX(unlock_at)
250
-             FROM ' . prefixTable('auth_failures') . '
250
+             FROM ' . prefixTable('auth_failures').'
251 251
              WHERE unlock_at > %s AND source = %s AND value = %s',
252 252
             date('Y-m-d H:i:s', time()),
253 253
             'login',
@@ -256,33 +256,31 @@  discard block
 block discarded – undo
256 256
 
257 257
         // Get some infos about user
258 258
         $userDisplayInfos = 
259
-            (isset($userDate['date']) ? '<i class=\"fas fa-calendar-day infotip text-info ml-2\" title=\"'.$lang->get('creation_date').': '.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $userDate['date']).'\"></i>' : '')
259
+            (isset($userDate['date']) ? '<i class=\"fas fa-calendar-day infotip text-info ml-2\" title=\"'.$lang->get('creation_date').': '.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $userDate['date']).'\"></i>' : '')
260 260
             .
261 261
             ((int) $record['last_connexion'] > 0 ? '<i class=\"far fa-clock infotip text-info ml-2\" title=\"'.$lang->get('index_last_seen').": ".
262
-            date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['last_connexion']).'\"></i>' : '')
262
+            date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['last_connexion']).'\"></i>' : '')
263 263
             .
264 264
             ((int) $record['user_ip'] > 0 ? '<i class=\"fas fa-street-view infotip text-info ml-1\" title=\"'.$lang->get('ip').": ".($record['user_ip']).'\"></i>' : '')
265 265
             .
266 266
             ($record['auth_type'] === 'ldap' ? '<i class=\"far fa-address-book infotip text-warning ml-1\" title=\"'.$lang->get('managed_through_ad').'\"></i>' : '')
267 267
             .
268 268
             ((in_array($record['id'], [OTV_USER_ID, TP_USER_ID, SSH_USER_ID, API_USER_ID]) === false && (int) $record['admin'] !== 1 && ((int) $SETTINGS['duo'] === 1 || (int) $SETTINGS['google_authentication'] === 1)) ?
269
-                ((int) $record['mfa_enabled'] === 1 ? '' : '<i class=\"fa-solid fa-fingerprint infotip ml-1\" style=\"color:Tomato\" title=\"'.$lang->get('mfa_disabled_for_user').'\"></i>') :
270
-                ''
269
+                ((int) $record['mfa_enabled'] === 1 ? '' : '<i class=\"fa-solid fa-fingerprint infotip ml-1\" style=\"color:Tomato\" title=\"'.$lang->get('mfa_disabled_for_user').'\"></i>') : ''
271 270
                 )
272 271
             .
273 272
             (($unlock_at) ? '<i class=\"fas fa-solid text-red fa-lock infotip text-info ml-1\" title=\"'.$lang->get('bruteforce_unlock_at').$unlock_at.'\"></i>' : '');
274 273
         if ($request->query->filter('display_warnings', '', FILTER_VALIDATE_BOOLEAN) === true) {
275 274
             $userDisplayInfos .= '<br>'.
276 275
                 ((in_array($record['id'], [OTV_USER_ID, TP_USER_ID, SSH_USER_ID, API_USER_ID]) === false && (int) $record['admin'] !== 1 && is_null($record['keys_recovery_time']) === true) ? 
277
-                    '<i class=\"fa-solid fa-download infotip ml-1\" style=\"color:Tomato\" title=\"'.$lang->get('recovery_keys_not_downloaded').'\"></i>' :
278
-                    ''
276
+                    '<i class=\"fa-solid fa-download infotip ml-1\" style=\"color:Tomato\" title=\"'.$lang->get('recovery_keys_not_downloaded').'\"></i>' : ''
279 277
                 ).
280 278
                 ((in_array($record['id'], [OTV_USER_ID, TP_USER_ID, SSH_USER_ID, API_USER_ID]) === false && (int) $record['pw_passwordlib'] === 1) ? '<i class=\"fa-solid fa-person-walking-luggage infotip ml-1\" style=\"color:Tomato\" title=\"Old password encryption. Shall login to initialize.\"></i>' : '');
281 279
         }
282 280
 
283 281
         $sOutput .= '["<span data-id=\"'.$record['id'].'\" data-fullname=\"'.
284
-            (empty($record['name']) === false ? htmlentities($record['name'], ENT_QUOTES|ENT_SUBSTITUTE|ENT_DISALLOWED) : '').' '.
285
-            (empty($record['lastname']) === false ? htmlentities($record['lastname'], ENT_QUOTES|ENT_SUBSTITUTE|ENT_DISALLOWED) : '').
282
+            (empty($record['name']) === false ? htmlentities($record['name'], ENT_QUOTES | ENT_SUBSTITUTE | ENT_DISALLOWED) : '').' '.
283
+            (empty($record['lastname']) === false ? htmlentities($record['lastname'], ENT_QUOTES | ENT_SUBSTITUTE | ENT_DISALLOWED) : '').
286 284
             '\" data-auth-type=\"'.$record['auth_type'].'\" data-special=\"'.$record['special'].'\" data-mfa-enabled=\"'.$record['mfa_enabled'].'\" data-otp-provided=\"'.(isset($record['otp_provided']) === true ? $record['otp_provided'] : '').'\"></span>", ';
287 285
         //col2
288 286
         $sOutput .= '"'.
Please login to merge, or discard this patch.
scripts/background_tasks___items_handler.php 2 patches
Braces   +15 added lines, -6 removed lines patch added patch discarded remove patch
@@ -83,7 +83,9 @@  discard block
 block discarded – undo
83 83
 
84 84
 if (DB::count() > 0) {
85 85
     // handle tasks inside this process
86
-    if (WIP === true) error_log("Process in progress: ".$process_to_perform['increment_id']);
86
+    if (WIP === true) {
87
+        error_log("Process in progress: ".$process_to_perform['increment_id']);
88
+    }
87 89
     handleTask(
88 90
         $process_to_perform['increment_id'],
89 91
         json_decode($process_to_perform['arguments'], true),
@@ -100,7 +102,9 @@  discard block
 block discarded – undo
100 102
     );
101 103
     
102 104
     if (DB::count() > 0) {
103
-        if (WIP === true) error_log("New process ta start: ".$process_to_perform['increment_id']);
105
+        if (WIP === true) {
106
+            error_log("New process ta start: ".$process_to_perform['increment_id']);
107
+        }
104 108
         // update DB - started_at
105 109
         DB::update(
106 110
             prefixTable('background_tasks'),
@@ -153,8 +157,9 @@  discard block
 block discarded – undo
153 157
         );
154 158
 
155 159
         // No more tasks, exit
156
-        if ($process_to_perform !== 1)
157
-            break;
160
+        if ($process_to_perform !== 1) {
161
+                    break;
162
+        }
158 163
 
159 164
         // Run next task
160 165
         $process = new Symfony\Component\Process\Process([
@@ -331,7 +336,9 @@  discard block
 block discarded – undo
331 336
     if ($args['step'] === 'create_users_files_key') {
332 337
         // Loop on all files for this item
333 338
         // and encrypt them for each user
334
-        if (WIP === true) provideLog('[DEBUG] '.print_r($args['files_keys'], true), $SETTINGS);
339
+        if (WIP === true) {
340
+            provideLog('[DEBUG] '.print_r($args['files_keys'], true), $SETTINGS);
341
+        }
335 342
         foreach($args['files_keys'] as $file) {
336 343
             storeUsersShareKey(
337 344
                 prefixTable('sharekeys_items'),
@@ -347,7 +354,9 @@  discard block
 block discarded – undo
347 354
     } elseif ($args['step'] === 'create_users_fields_key') {
348 355
         // Loop on all encrypted fields for this item
349 356
         // and encrypt them for each user
350
-        if (WIP === true) provideLog('[DEBUG] '.print_r($args, true), $SETTINGS);
357
+        if (WIP === true) {
358
+            provideLog('[DEBUG] '.print_r($args, true), $SETTINGS);
359
+        }
351 360
         foreach($args['fields_keys'] as $field) {
352 361
             storeUsersShareKey(
353 362
                 prefixTable('sharekeys_fields'),
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 DB::debugmode(false);
76 76
 $process_to_perform = DB::queryFirstRow(
77 77
     'SELECT *
78
-    FROM ' . prefixTable('background_tasks') . '
78
+    FROM ' . prefixTable('background_tasks').'
79 79
     WHERE is_in_progress = %i AND process_type IN ("item_copy", "new_item", "update_item", "item_update_create_keys")
80 80
     ORDER BY increment_id ASC',
81 81
     1
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
     // search for next process to handle
94 94
     $process_to_perform = DB::queryFirstRow(
95 95
         'SELECT *
96
-        FROM ' . prefixTable('background_tasks') . '
96
+        FROM ' . prefixTable('background_tasks').'
97 97
         WHERE is_in_progress = %i AND (finished_at = "" OR finished_at IS NULL) AND process_type IN ("item_copy", "new_item", "update_item", "item_update_create_keys")
98 98
         ORDER BY increment_id ASC',
99 99
         0
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
             $process_to_perform['increment_id']
112 112
         );
113 113
 
114
-        provideLog('[PROCESS][#'. $process_to_perform['increment_id'].'][START]', $SETTINGS);
114
+        provideLog('[PROCESS][#'.$process_to_perform['increment_id'].'][START]', $SETTINGS);
115 115
         handleTask(
116 116
             $process_to_perform['increment_id'],
117 117
             json_decode($process_to_perform['arguments'], true),
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
         // Search if there are remaining tasks
147 147
         $process_to_perform = DB::queryFirstField(
148 148
             'SELECT 1
149
-            FROM ' . prefixTable('background_tasks') . '
149
+            FROM ' . prefixTable('background_tasks').'
150 150
             WHERE is_in_progress = %i AND process_type IN (
151 151
                 "item_copy",
152 152
                 "new_item",
@@ -185,10 +185,10 @@  discard block
 block discarded – undo
185 185
  */
186 186
 function handleTask(int $processId, array $ProcessArguments, array $SETTINGS, int $itemId = null): bool
187 187
 {
188
-    provideLog('[PROCESS][#'. $processId.'][START]', $SETTINGS);
188
+    provideLog('[PROCESS][#'.$processId.'][START]', $SETTINGS);
189 189
     $task_to_perform = DB::queryFirstRow(
190 190
         'SELECT *
191
-        FROM ' . prefixTable('background_subtasks') . '
191
+        FROM ' . prefixTable('background_subtasks').'
192 192
         WHERE task_id = %i AND finished_at IS NULL
193 193
         ORDER BY increment_id ASC',
194 194
         $processId
@@ -202,13 +202,13 @@  discard block
 block discarded – undo
202 202
         // if sub_task_in_progress === 1 then exit
203 203
         if ((int) $task_to_perform['sub_task_in_progress'] !== 0) {
204 204
             // Task is currently being in progress by another server process
205
-            provideLog('[TASK][#'. $task_to_perform['increment_id'].'][WARNING] Similar task already being processes', $SETTINGS);
205
+            provideLog('[TASK][#'.$task_to_perform['increment_id'].'][WARNING] Similar task already being processes', $SETTINGS);
206 206
             return false;
207 207
         }
208 208
 
209 209
         // handle next task
210 210
         $args = json_decode($task_to_perform['task'], true);
211
-        provideLog('[TASK][#'. $task_to_perform['increment_id'].'][START]Task '.$args['step'], $SETTINGS);
211
+        provideLog('[TASK][#'.$task_to_perform['increment_id'].'][START]Task '.$args['step'], $SETTINGS);
212 212
 
213 213
         // flag as in progress
214 214
         DB::update(
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
         DB::update(
251 251
             prefixTable('background_subtasks'),
252 252
             array(
253
-                'sub_task_in_progress' => 0,    // flag sub task is no more in prgoress
253
+                'sub_task_in_progress' => 0, // flag sub task is no more in prgoress
254 254
                 'task' => json_encode(["status" => "Done"]),
255 255
                 'is_in_progress' => -1,
256 256
                 'finished_at' => time(),
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
         // are all tasks done?
266 266
         DB::query(
267 267
             'SELECT *
268
-            FROM ' . prefixTable('background_subtasks') . '
268
+            FROM ' . prefixTable('background_subtasks').'
269 269
             WHERE task_id = %i AND finished_at IS NULL',
270 270
             $processId
271 271
         );
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
         // Loop on all files for this item
338 338
         // and encrypt them for each user
339 339
         if (WIP === true) provideLog('[DEBUG] '.print_r($args['files_keys'], true), $SETTINGS);
340
-        foreach($args['files_keys'] as $file) {
340
+        foreach ($args['files_keys'] as $file) {
341 341
             storeUsersShareKey(
342 342
                 prefixTable('sharekeys_items'),
343 343
                 0,
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
         // Loop on all encrypted fields for this item
354 354
         // and encrypt them for each user
355 355
         if (WIP === true) provideLog('[DEBUG] '.print_r($args, true), $SETTINGS);
356
-        foreach($args['fields_keys'] as $field) {
356
+        foreach ($args['fields_keys'] as $field) {
357 357
             storeUsersShareKey(
358 358
                 prefixTable('sharekeys_fields'),
359 359
                 0,
@@ -405,6 +405,6 @@  discard block
 block discarded – undo
405 405
     DB::query(
406 406
         'DELETE FROM '.prefixTable('items_edition').'
407 407
         WHERE timestamp < %i',
408
-        ($SETTINGS['delay_item_edition'] > 0) ? time() - ($SETTINGS['delay_item_edition']*60) : time() - EDITION_LOCK_PERIOD
408
+        ($SETTINGS['delay_item_edition'] > 0) ? time() - ($SETTINGS['delay_item_edition'] * 60) : time() - EDITION_LOCK_PERIOD
409 409
     );
410 410
 }
Please login to merge, or discard this patch.
sources/upload.files.php 1 patch
Spacing   +33 added lines, -33 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
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
     } else {
131 131
         // check if token is expired
132 132
         $data = DB::queryFirstRow(
133
-            'SELECT end_timestamp FROM ' . prefixTable('tokens') . ' WHERE user_id = %i AND token = %s',
133
+            'SELECT end_timestamp FROM '.prefixTable('tokens').' WHERE user_id = %i AND token = %s',
134 134
             $session->get('user-id'),
135 135
             $post_user_token
136 136
         );
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 
155 155
 // HTTP headers for no cache etc
156 156
 header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
157
-header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
157
+header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
158 158
 header('Cache-Control: no-store, no-cache, must-revalidate');
159 159
 header('Cache-Control: post-check=0, pre-check=0', false);
160 160
 
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
     }
167 167
 
168 168
     // Set directory used to store file
169
-    $targetDir = realpath($SETTINGS['cpassman_dir'] . '/includes/avatars');
169
+    $targetDir = realpath($SETTINGS['cpassman_dir'].'/includes/avatars');
170 170
 } else {
171 171
     $targetDir = realpath($SETTINGS['path_to_files_folder']);
172 172
 }
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
     $file_name = preg_replace('/[^a-zA-Z0-9-_\.]/', '', strtolower(basename($file->getClientOriginalName())));
220 220
     
221 221
     if (strlen($file_name) == 0 || strlen($file_name) > $MAX_FILENAME_LENGTH) {
222
-        error_log('Invalid file name: ' . $file_name . '.');
222
+        error_log('Invalid file name: '.$file_name.'.');
223 223
         echo handleUploadError('Invalid file name provided.');
224 224
         return false;
225 225
     }
@@ -233,13 +233,13 @@  discard block
 block discarded – undo
233 233
             $ext = strtolower($ext);
234 234
         } else {
235 235
             // Case where the file extension is not a string
236
-            error_log('Invalid file name: ' . $file_name . '.');
236
+            error_log('Invalid file name: '.$file_name.'.');
237 237
             echo handleUploadError('Invalid file extension.');
238 238
             return false;
239 239
         }
240 240
     } else {
241 241
         // Case where the file name is not a string
242
-        error_log('Invalid file name: ' . $file_name . '.');
242
+        error_log('Invalid file name: '.$file_name.'.');
243 243
         echo handleUploadError('Invalid file.');
244 244
         return false;
245 245
     }
@@ -247,8 +247,8 @@  discard block
 block discarded – undo
247 247
     // Validate against a list of allowed extensions
248 248
     $allowed_extensions = explode(
249 249
         ',',
250
-        $SETTINGS['upload_docext'] . ',' . $SETTINGS['upload_imagesext'] .
251
-            ',' . $SETTINGS['upload_pkgext'] . ',' . $SETTINGS['upload_otherext']
250
+        $SETTINGS['upload_docext'].','.$SETTINGS['upload_imagesext'].
251
+            ','.$SETTINGS['upload_pkgext'].','.$SETTINGS['upload_otherext']
252 252
     );
253 253
     if (
254 254
         !in_array($ext, $allowed_extensions) 
@@ -267,25 +267,25 @@  discard block
 block discarded – undo
267 267
 
268 268
 // is destination folder writable
269 269
 if (is_writable($SETTINGS['path_to_files_folder']) === false) {
270
-    echo handleUploadError('Not enough permissions on folder ' . $SETTINGS['path_to_files_folder'] . '.');
270
+    echo handleUploadError('Not enough permissions on folder '.$SETTINGS['path_to_files_folder'].'.');
271 271
     return false;
272 272
 }
273 273
 
274 274
 // Make sure the fileName is unique but only if chunking is disabled
275
-if ($chunks < 2 && file_exists($targetDir . DIRECTORY_SEPARATOR . $fileName)) {
275
+if ($chunks < 2 && file_exists($targetDir.DIRECTORY_SEPARATOR.$fileName)) {
276 276
     // $ext is guaranteed to be a string due to prior checks
277 277
     $fileNameA = substr($fileName, 0, strlen(/** @scrutinizer ignore-type */$ext));
278 278
     $fileNameB = substr($fileName, strlen(/** @scrutinizer ignore-type */$ext));
279 279
 
280 280
     $count = 1;
281
-    while (file_exists($targetDir . DIRECTORY_SEPARATOR . $fileNameA . '_' . $count . $fileNameB)) {
281
+    while (file_exists($targetDir.DIRECTORY_SEPARATOR.$fileNameA.'_'.$count.$fileNameB)) {
282 282
         ++$count;
283 283
     }
284 284
 
285
-    $fileName = $fileNameA . '_' . $count . $fileNameB;
285
+    $fileName = $fileNameA.'_'.$count.$fileNameB;
286 286
 }
287 287
 
288
-$filePath = $targetDir . DIRECTORY_SEPARATOR . $fileName;
288
+$filePath = $targetDir.DIRECTORY_SEPARATOR.$fileName;
289 289
 
290 290
 // Create target dir
291 291
 if (!file_exists($targetDir)) {
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 // Remove old temp files
300 300
 if ($cleanupTargetDir && is_dir($targetDir) && ($dir = opendir($targetDir))) {
301 301
     while (($fileClean = readdir($dir)) !== false) {
302
-        $tmpfilePath = $targetDir . DIRECTORY_SEPARATOR . $fileClean;
302
+        $tmpfilePath = $targetDir.DIRECTORY_SEPARATOR.$fileClean;
303 303
 
304 304
         // Remove temp file if it is older than the max age and is not the current file
305 305
         if (
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 
314 314
     closedir($dir);
315 315
 } else {
316
-    echo handleUploadError('Not enough permissions on folder ' . $SETTINGS['path_to_files_folder'] . '.');
316
+    echo handleUploadError('Not enough permissions on folder '.$SETTINGS['path_to_files_folder'].'.');
317 317
     return false;
318 318
 }
319 319
 
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 
354 354
                 // Safe destination folder
355 355
                 $uploadDir = realpath($SETTINGS['path_to_upload_folder']);
356
-                $destinationPath = $uploadDir . DIRECTORY_SEPARATOR . $fileName;
356
+                $destinationPath = $uploadDir.DIRECTORY_SEPARATOR.$fileName;
357 357
                 
358 358
                 if (move_uploaded_file($tmpFilePath, $destinationPath)) {
359 359
                     // Open the moved file in read mode
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
             return false;
395 395
         }
396 396
     } else {
397
-        echo handleUploadError('Failed to move uploaded file to ' . $SETTINGS['path_to_files_folder'] . '.');
397
+        echo handleUploadError('Failed to move uploaded file to '.$SETTINGS['path_to_files_folder'].'.');
398 398
         return false;
399 399
     }
400 400
 } else {
@@ -410,14 +410,14 @@  discard block
 block discarded – undo
410 410
                 fwrite($out, $buff);
411 411
             }
412 412
         } else {
413
-            echo handleUploadError('Failed to open input stream ' . $SETTINGS['path_to_files_folder'] . '.');
413
+            echo handleUploadError('Failed to open input stream '.$SETTINGS['path_to_files_folder'].'.');
414 414
             return false;
415 415
         }
416 416
 
417 417
         fclose($in);
418 418
         fclose($out);
419 419
     } else {
420
-        echo handleUploadError('Failed to open output stream ' . $SETTINGS['path_to_files_folder'] . '.');
420
+        echo handleUploadError('Failed to open output stream '.$SETTINGS['path_to_files_folder'].'.');
421 421
         return false;
422 422
     }
423 423
 }
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 ) {
451 451
     rename(
452 452
         $filePath,
453
-        $targetDir . DIRECTORY_SEPARATOR . $newFileName
453
+        $targetDir.DIRECTORY_SEPARATOR.$newFileName
454 454
     );
455 455
 
456 456
     // Add in DB
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
 ) {
480 480
     rename(
481 481
         $filePath,
482
-        $targetDir . DIRECTORY_SEPARATOR . $newFileName
482
+        $targetDir.DIRECTORY_SEPARATOR.$newFileName
483 483
     );
484 484
 
485 485
     // Add in DB
@@ -512,13 +512,13 @@  discard block
 block discarded – undo
512 512
     // rename the file
513 513
     rename(
514 514
         $filePath,
515
-        $targetDir . DIRECTORY_SEPARATOR . $newFileName . '.' . $ext
515
+        $targetDir.DIRECTORY_SEPARATOR.$newFileName.'.'.$ext
516 516
     );
517 517
 
518 518
     // make thumbnail
519 519
     $ret = makeThumbnail(
520
-        $targetDir . DIRECTORY_SEPARATOR . $newFileName . '.' . $ext,
521
-        $targetDir . DIRECTORY_SEPARATOR . $newFileName . '_thumb' . '.' . $ext,
520
+        $targetDir.DIRECTORY_SEPARATOR.$newFileName.'.'.$ext,
521
+        $targetDir.DIRECTORY_SEPARATOR.$newFileName.'_thumb'.'.'.$ext,
522 522
         40
523 523
     );
524 524
 
@@ -530,21 +530,21 @@  discard block
 block discarded – undo
530 530
     }
531 531
 
532 532
     // get current avatar and delete it
533
-    $data = DB::queryFirstRow('SELECT avatar, avatar_thumb FROM ' . prefixTable('users') . ' WHERE id=%i', $session->get('user-id'));
534
-    fileDelete($targetDir . DIRECTORY_SEPARATOR . $data['avatar'], $SETTINGS);
535
-    fileDelete($targetDir . DIRECTORY_SEPARATOR . $data['avatar_thumb'], $SETTINGS);
533
+    $data = DB::queryFirstRow('SELECT avatar, avatar_thumb FROM '.prefixTable('users').' WHERE id=%i', $session->get('user-id'));
534
+    fileDelete($targetDir.DIRECTORY_SEPARATOR.$data['avatar'], $SETTINGS);
535
+    fileDelete($targetDir.DIRECTORY_SEPARATOR.$data['avatar_thumb'], $SETTINGS);
536 536
 
537 537
     // store in DB the new avatar
538 538
     DB::query(
539
-        'UPDATE ' . prefixTable('users') . "
540
-        SET avatar='" . $newFileName . '.' . $ext . "', avatar_thumb='" . $newFileName . '_thumb' . '.' . $ext . "'
539
+        'UPDATE '.prefixTable('users')."
540
+        SET avatar='" . $newFileName.'.'.$ext."', avatar_thumb='".$newFileName.'_thumb'.'.'.$ext."'
541 541
         WHERE id=%i",
542 542
         $session->get('user-id')
543 543
     );
544 544
 
545 545
     // store in session
546
-    $session->set('user-avatar', $newFileName . '.' . $ext);
547
-    $session->set('user-avatar_thumb', $newFileName . '_thumb' . '.' . $ext);
546
+    $session->set('user-avatar', $newFileName.'.'.$ext);
547
+    $session->set('user-avatar_thumb', $newFileName.'_thumb'.'.'.$ext);
548 548
 
549 549
     // return info
550 550
     echo prepareExchangedData(
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
 ) {
564 564
     rename(
565 565
         $filePath,
566
-        $targetDir . DIRECTORY_SEPARATOR . $newFileName
566
+        $targetDir.DIRECTORY_SEPARATOR.$newFileName
567 567
     );
568 568
 
569 569
     // Add in DB
Please login to merge, or discard this patch.
pages/profile.js.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('profile') === false) {
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
 ?>
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
     })
98 98
 
99 99
     // Select user properties
100
-    $('#profile-user-language option[value=<?php echo $session->get('user-language');?>').attr('selected','selected');
100
+    $('#profile-user-language option[value=<?php echo $session->get('user-language'); ?>').attr('selected','selected');
101 101
 
102 102
 
103 103
     // AVATAR IMPORT
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 
296 296
                     // reload page in case of language change
297 297
                     if ($('#profile-user-language').val()
298
-                        && $('#profile-user-language').val().toLowerCase() !== '<?php echo $session->get('user-language');?>') {
298
+                        && $('#profile-user-language').val().toLowerCase() !== '<?php echo $session->get('user-language'); ?>') {
299 299
                         // prepare reload
300 300
                         $(this).delay(3000).queue(function() {
301 301
                             document.location.href = "index.php?page=profile";
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
                         // Inform user
307 307
                         toastr.remove();
308 308
                         toastr.info(
309
-                            '<?php echo $lang->get('alert_page_will_reload') . ' ... ' . $lang->get('please_wait'); ?>',
309
+                            '<?php echo $lang->get('alert_page_will_reload').' ... '.$lang->get('please_wait'); ?>',
310 310
                             '', {
311 311
                                 timeOut: 3000,
312 312
                                 progressBar: true
@@ -410,27 +410,27 @@  discard block
 block discarded – undo
410 410
         "defaultText": "<?php echo $lang->get('index_pw_level_txt'); ?>",
411 411
         "ratings": [
412 412
             {
413
-                "minScore": <?php echo TP_PW_STRENGTH_1;?>,
413
+                "minScore": <?php echo TP_PW_STRENGTH_1; ?>,
414 414
                 "className": "meterWarn",
415 415
                 "text": "<?php echo $lang->get('complex_level1'); ?>"
416 416
             },
417 417
             {
418
-                "minScore": <?php echo TP_PW_STRENGTH_2;?>,
418
+                "minScore": <?php echo TP_PW_STRENGTH_2; ?>,
419 419
                 "className": "meterWarn",
420 420
                 "text": "<?php echo $lang->get('complex_level2'); ?>"
421 421
             },
422 422
             {
423
-                "minScore": <?php echo TP_PW_STRENGTH_3;?>,
423
+                "minScore": <?php echo TP_PW_STRENGTH_3; ?>,
424 424
                 "className": "meterGood",
425 425
                 "text": "<?php echo $lang->get('complex_level3'); ?>"
426 426
             },
427 427
             {
428
-                "minScore": <?php echo TP_PW_STRENGTH_4;?>,
428
+                "minScore": <?php echo TP_PW_STRENGTH_4; ?>,
429 429
                 "className": "meterGood",
430 430
                 "text": "<?php echo $lang->get('complex_level4'); ?>"
431 431
             },
432 432
             {
433
-                "minScore": <?php echo TP_PW_STRENGTH_5;?>,
433
+                "minScore": <?php echo TP_PW_STRENGTH_5; ?>,
434 434
                 "className": "meterExcel",
435 435
                 "text": "<?php echo $lang->get('complex_level5'); ?>"
436 436
             }
@@ -523,27 +523,27 @@  discard block
 block discarded – undo
523 523
         "defaultText": "<?php echo $lang->get('index_pw_level_txt'); ?>",
524 524
         "ratings": [
525 525
             {
526
-                "minScore": <?php echo TP_PW_STRENGTH_1;?>,
526
+                "minScore": <?php echo TP_PW_STRENGTH_1; ?>,
527 527
                 "className": "meterWarn",
528 528
                 "text": "<?php echo $lang->get('complex_level1'); ?>"
529 529
             },
530 530
             {
531
-                "minScore": <?php echo TP_PW_STRENGTH_2;?>,
531
+                "minScore": <?php echo TP_PW_STRENGTH_2; ?>,
532 532
                 "className": "meterWarn",
533 533
                 "text": "<?php echo $lang->get('complex_level2'); ?>"
534 534
             },
535 535
             {
536
-                "minScore": <?php echo TP_PW_STRENGTH_3;?>,
536
+                "minScore": <?php echo TP_PW_STRENGTH_3; ?>,
537 537
                 "className": "meterGood",
538 538
                 "text": "<?php echo $lang->get('complex_level3'); ?>"
539 539
             },
540 540
             {
541
-                "minScore": <?php echo TP_PW_STRENGTH_4;?>,
541
+                "minScore": <?php echo TP_PW_STRENGTH_4; ?>,
542 542
                 "className": "meterGood",
543 543
                 "text": "<?php echo $lang->get('complex_level4'); ?>"
544 544
             },
545 545
             {
546
-                "minScore": <?php echo TP_PW_STRENGTH_5;?>,
546
+                "minScore": <?php echo TP_PW_STRENGTH_5; ?>,
547 547
                 "className": "meterExcel",
548 548
                 "text": "<?php echo $lang->get('complex_level5'); ?>"
549 549
             }
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
         }
560 560
     });
561 561
 
562
-    $('#profile-keys_download-date').text('<?php echo null === $session->get('user-keys_recovery_time') ? $lang->get('none') : date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $session->get('user-keys_recovery_time')); ?>');
562
+    $('#profile-keys_download-date').text('<?php echo null === $session->get('user-keys_recovery_time') ? $lang->get('none') : date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $session->get('user-keys_recovery_time')); ?>');
563 563
 
564 564
     $("#open-dialog-keys-download").on('click', function(event) {
565 565
         event.preventDefault();
Please login to merge, or discard this patch.
pages/items.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('items') === false) {
70 70
     // Not allowed page
71 71
     $session->set('system-error_code', ERR_NOT_ALLOWED);
72
-    include $SETTINGS['cpassman_dir'] . '/error.php';
72
+    include $SETTINGS['cpassman_dir'].'/error.php';
73 73
     exit;
74 74
 }
75 75
 // Define Timezone
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 
91 91
 // Get list of users
92 92
 $usersList = [];
93
-$rows = DB::query('SELECT id,login,email FROM ' . prefixTable('users') . ' ORDER BY login ASC');
93
+$rows = DB::query('SELECT id,login,email FROM '.prefixTable('users').' ORDER BY login ASC');
94 94
 foreach ($rows as $record) {
95 95
     $usersList[$record['login']] = [
96 96
         'id' => $record['id'],
@@ -101,16 +101,16 @@  discard block
 block discarded – undo
101 101
 // Get list of roles
102 102
 $arrRoles = [];
103 103
 $listRoles = '';
104
-$rows = DB::query('SELECT id,title FROM ' . prefixTable('roles_title') . ' ORDER BY title ASC');
104
+$rows = DB::query('SELECT id,title FROM '.prefixTable('roles_title').' ORDER BY title ASC');
105 105
 foreach ($rows as $reccord) {
106 106
     $arrRoles[$reccord['title']] = [
107 107
         'id' => $reccord['id'],
108 108
         'title' => $reccord['title'],
109 109
     ];
110 110
     if (empty($listRoles)) {
111
-        $listRoles = $reccord['id'] . '#' . $reccord['title'];
111
+        $listRoles = $reccord['id'].'#'.$reccord['title'];
112 112
     } else {
113
-        $listRoles .= ';' . $reccord['id'] . '#' . $reccord['title'];
113
+        $listRoles .= ';'.$reccord['id'].'#'.$reccord['title'];
114 114
     }
115 115
 }
116 116
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
                         <li class="nav-item"><a class="nav-link" href="#tab_3" data-toggle="tab"><i class="fa-solid fa-archive mr-2"></i><?php echo $lang->get('attachments'); ?></a></li>
186 186
                         <?php
187 187
                         echo isset($SETTINGS['item_extra_fields']) === true && (int) $SETTINGS['item_extra_fields'] === 1 ? '
188
-                            <li class="nav-item"><a class="nav-link" href="#tab_4" data-toggle="tab"><i class="fa-solid fa-cubes mr-2"></i>' . $lang->get('fields') . '</a></li>' : '';
188
+                            <li class="nav-item"><a class="nav-link" href="#tab_4" data-toggle="tab"><i class="fa-solid fa-cubes mr-2"></i>' . $lang->get('fields').'</a></li>' : '';
189 189
                         ?>
190 190
                     </ul>
191 191
                 </div><!-- /.card-header -->
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
                                                 <?php
255 255
                                                 for ($i = 4; $i <= $SETTINGS['pwd_maximum_length']; ++$i) {
256 256
                                                     echo '
257
-                                                <option>' . $i . '</option>';
257
+                                                <option>' . $i.'</option>';
258 258
                                                 }
259 259
                                                 ?>
260 260
                                             </select>
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
                                     <span class="ml-2 col-md-1 clear-me-html" id="form-item-icon-show"></span>
285 285
                                 </div>
286 286
                                 <small class='form-text text-muted'>
287
-                                    <?php echo $lang->get('fontawesome_icon_tip'); ?><a href="<?php echo FONTAWESOME_URL;?>" target="_blank"><i class="fa-solid fa-external-link-alt ml-1"></i></a>
287
+                                    <?php echo $lang->get('fontawesome_icon_tip'); ?><a href="<?php echo FONTAWESOME_URL; ?>" target="_blank"><i class="fa-solid fa-external-link-alt ml-1"></i></a>
288 288
                                 </small>
289 289
                             </div>
290 290
 
@@ -472,39 +472,39 @@  discard block
 block discarded – undo
472 472
                             <div class="tab-pane" id="tab_4">
473 473
                                 <div id="form-item-field" class="hidden">
474 474
                                     <?php
475
-                                        $session_item_fields = $session->get('system-item_fields');//print_r($session_item_fields);
475
+                                        $session_item_fields = $session->get('system-item_fields'); //print_r($session_item_fields);
476 476
                                         if (isset($session_item_fields) === true) {
477 477
                                             foreach ($session_item_fields as $category) {
478 478
                                                 //print_r($category);
479 479
                                                 echo '
480
-                                            <div class="callout callout-info form-item-category hidden" id="form-item-category-' . $category['id'] . '">
481
-                                                <h5>' . $category['title'] . '</h5>
480
+                                            <div class="callout callout-info form-item-category hidden" id="form-item-category-' . $category['id'].'">
481
+                                                <h5>' . $category['title'].'</h5>
482 482
                                                 <p>';
483 483
                                                 foreach ($category['fields'] as $field) {
484 484
                                                     if ($field['type'] === 'textarea') {
485 485
                                                         echo '
486
-                                                    <div class="form-group mb-3 form-item-field" id="form-item-field-' . $field['id'] . '" data-field-id="' . $field['id'] . '">
486
+                                                    <div class="form-group mb-3 form-item-field" id="form-item-field-' . $field['id'].'" data-field-id="'.$field['id'].'">
487 487
                                                         <label>' . $field['title'],
488 488
                                                             $field['is_mandatory'] === '1' ?
489
-                                                                '<span class="fa-solid fa-fire text-danger ml-1 infotip" title="' . $lang->get('is_mandatory') . '"></span>' : '',
489
+                                                                '<span class="fa-solid fa-fire text-danger ml-1 infotip" title="'.$lang->get('is_mandatory').'"></span>' : '',
490 490
                                                             '</label>
491
-                                                        <textarea class="form-control form-item-control form-item-field-custom" rows="2" data-field-name="' . $field['id'] . '" data-field-mandatory="' . $field['is_mandatory'] . '" data-field-regex="' . $field['regex'] . '" data-change-ongoing="0"></textarea>
491
+                                                        <textarea class="form-control form-item-control form-item-field-custom" rows="2" data-field-name="' . $field['id'].'" data-field-mandatory="'.$field['is_mandatory'].'" data-field-regex="'.$field['regex'].'" data-change-ongoing="0"></textarea>
492 492
                                                     </div>';
493 493
                                                     } else {
494 494
                                                         echo '
495
-                                                    <div class="input-group mb-3 form-item-field" id="form-item-field-' . $field['id'] . '" data-field-id="' . $field['id'] . '">
495
+                                                    <div class="input-group mb-3 form-item-field" id="form-item-field-' . $field['id'].'" data-field-id="'.$field['id'].'">
496 496
                                                         <div class="input-group-prepend">
497 497
                                                             <span class="input-group-text">' . $field['title'],
498 498
                                                             $field['is_mandatory'] === '1' ?
499
-                                                                '<span class="fa-solid fa-fire text-danger ml-1 infotip" title="' . $lang->get('is_mandatory') . '"></span>' : '',
499
+                                                                '<span class="fa-solid fa-fire text-danger ml-1 infotip" title="'.$lang->get('is_mandatory').'"></span>' : '',
500 500
                                                             '</span>
501 501
                                                         </div>
502
-                                                        <input type="' . $field['type'] . '" class="form-control form-item-control form-item-field-custom" data-field-name="' . $field['id'] . '" data-field-mandatory="' . $field['is_mandatory'] . '" data-field-regex="' . $field['regex'] . '" data-change-ongoing="0">
502
+                                                        <input type="' . $field['type'].'" class="form-control form-item-control form-item-field-custom" data-field-name="'.$field['id'].'" data-field-mandatory="'.$field['is_mandatory'].'" data-field-regex="'.$field['regex'].'" data-change-ongoing="0">
503 503
                                                     </div>';
504 504
                                                     }
505 505
                                                     if (!empty($field['regex'])) {
506 506
                                                         echo '
507
-                                                    <div>Regex: '. $field['regex'] .'</div>
507
+                                                    <div>Regex: '. $field['regex'].'</div>
508 508
                                                         ';
509 509
                                                     }
510 510
                                                 }
@@ -515,8 +515,8 @@  discard block
 block discarded – undo
515 515
                                                 ) {
516 516
                                                     echo '
517 517
                                                     <div class="form-check icheck-blue">
518
-                                                        <input type="checkbox" class="form-check-input form-check-input-template form-item-control flat-blue" data-category-id="' . $category['id'] . '" data-change-ongoing="0" data-field-name="template" id="template_' . $category['id'] . '">
519
-                                                        <label class="form-check-label ml-3" for="template_' . $category['id'] . '">' . $lang->get('main_template') . '</label>
518
+                                                        <input type="checkbox" class="form-check-input form-check-input-template form-item-control flat-blue" data-category-id="' . $category['id'].'" data-change-ongoing="0" data-field-name="template" id="template_'.$category['id'].'">
519
+                                                        <label class="form-check-label ml-3" for="template_' . $category['id'].'">'.$lang->get('main_template').'</label>
520 520
                                                     </div>';
521 521
                                                 }
522 522
                                                 echo '
@@ -526,8 +526,8 @@  discard block
 block discarded – undo
526 526
                                         } else {
527 527
                                             echo
528 528
                                             '<div class="alert alert-info">
529
-                                                <h5><i class="icon fa fa-info mr-3"></i>' . $lang->get('information') . '</h5>
530
-                                                ' . $lang->get('no_fields') . '
529
+                                                <h5><i class="icon fa fa-info mr-3"></i>' . $lang->get('information').'</h5>
530
+                                                ' . $lang->get('no_fields').'
531 531
                                             </div>';
532 532
                                         } ?>
533 533
                                 </div>
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
                         <p><?php
669 669
                             echo str_replace(
670 670
         ['##otv_expiration_period##', '. '],
671
-        ['<span class="text-bold text-primary">' . $SETTINGS['otv_expiration_period'] . '</span>', '<br>'],
671
+        ['<span class="text-bold text-primary">'.$SETTINGS['otv_expiration_period'].'</span>', '<br>'],
672 672
         $lang->get('otv_message')
673 673
     );
674 674
                             ?></p>
@@ -686,9 +686,9 @@  discard block
 block discarded – undo
686 686
 
687 687
                     <div class="row">
688 688
                         <div class="form-group col-4">
689
-                            <label for="form-item-otv-days"><i class="fa-regular fa-calendar-days mr-2"></i><?php echo $lang->get('number_of_days'); ?> (<?php echo $lang->get('maximum').': '.$SETTINGS['otv_expiration_period'];?>)</label>
689
+                            <label for="form-item-otv-days"><i class="fa-regular fa-calendar-days mr-2"></i><?php echo $lang->get('number_of_days'); ?> (<?php echo $lang->get('maximum').': '.$SETTINGS['otv_expiration_period']; ?>)</label>
690 690
                             <div class="input-group mb-3">
691
-                                <input type="number" class="form-control clear-me-val" id="form-item-otv-days" min="0" max="<?php echo $SETTINGS['otv_expiration_period'];?>" value="<?php echo $SETTINGS['otv_expiration_period'];?>">
691
+                                <input type="number" class="form-control clear-me-val" id="form-item-otv-days" min="0" max="<?php echo $SETTINGS['otv_expiration_period']; ?>" value="<?php echo $SETTINGS['otv_expiration_period']; ?>">
692 692
                             </div>
693 693
                         </div>
694 694
 
@@ -776,7 +776,7 @@  discard block
 block discarded – undo
776 776
                             <select class="form-control form-folder-control select2" style="width:100%;" id="form-folder-add-complexicity" required>
777 777
                                 <?php
778 778
                                 foreach (TP_PW_COMPLEXITY as $key => $value) {
779
-                                    echo '<option value="' . $key . '">' . $value[1] . '</option>';
779
+                                    echo '<option value="'.$key.'">'.$value[1].'</option>';
780 780
                                 }
781 781
                                 ?>
782 782
                             </select>
@@ -794,14 +794,14 @@  discard block
 block discarded – undo
794 794
                             <label><?php echo $lang->get('icon'); ?></label>
795 795
                             <input type="text" class="form-control form-folder-control" id="form-folder-add-icon">
796 796
                             <small class='form-text text-muted'>
797
-                                <?php echo $lang->get('fontawesome_icon_tip'); ?><a href="<?php echo FONTAWESOME_URL;?>" target="_blank"><i class="fa-solid fa-external-link-alt ml-1"></i></a>
797
+                                <?php echo $lang->get('fontawesome_icon_tip'); ?><a href="<?php echo FONTAWESOME_URL; ?>" target="_blank"><i class="fa-solid fa-external-link-alt ml-1"></i></a>
798 798
                             </small>
799 799
                         </div>
800 800
                         <div class="form-group">
801 801
                             <label><?php echo $lang->get('icon_on_selection'); ?></label>
802 802
                             <input type="text" class="form-control form-folder-control" id="form-folder-add-icon-selected">
803 803
                             <small class='form-text text-muted'>
804
-                                <?php echo $lang->get('fontawesome_icon_tip'); ?><a href="<?php echo FONTAWESOME_URL;?>" target="_blank"><i class="fa-solid fa-external-link-alt ml-1"></i></a>
804
+                                <?php echo $lang->get('fontawesome_icon_tip'); ?><a href="<?php echo FONTAWESOME_URL; ?>" target="_blank"><i class="fa-solid fa-external-link-alt ml-1"></i></a>
805 805
                             </small>
806 806
                         </div>
807 807
                     </div>
@@ -1212,18 +1212,18 @@  discard block
 block discarded – undo
1212 1212
                                 <?php
1213 1213
                                     foreach ($session_item_fields as $elem) {
1214 1214
                                         echo '
1215
-                                <div class="callout callout-info card-item-category hidden" id="card-item-category-' . $elem['id'] . '">
1216
-                                    <h5>' . $elem['title'] . '</h5>
1215
+                                <div class="callout callout-info card-item-category hidden" id="card-item-category-' . $elem['id'].'">
1216
+                                    <h5>' . $elem['title'].'</h5>
1217 1217
                                     <p>
1218 1218
                                         <ul class="list-group list-group-unbordered mb-3">';
1219 1219
                                         foreach ($elem['fields'] as $field) {
1220 1220
                                             echo '
1221
-                                            <li class="list-group-item card-item-field hidden" id="card-item-field-' . $field['id'] . '">
1222
-                                                <span id="card-item-field-title-' . $field['id'] . '"><b>' . $field['title'] . '</b></span>
1223
-                                                <button type="button" class="float-right btn btn-secondary btn-sm ml-1 btn-copy-clipboard-clear"  data-clipboard-target="card-item-field-value-' . $field['id'] . '">
1221
+                                            <li class="list-group-item card-item-field hidden" id="card-item-field-' . $field['id'].'">
1222
+                                                <span id="card-item-field-title-' . $field['id'].'"><b>'.$field['title'].'</b></span>
1223
+                                                <button type="button" class="float-right btn btn-secondary btn-sm ml-1 btn-copy-clipboard-clear"  data-clipboard-target="card-item-field-value-' . $field['id'].'">
1224 1224
                                                     <i class="fa-solid fa-copy"></i>
1225 1225
                                                 </button>
1226
-                                                <span class="card-item-field-value float-right ml-1" id="card-item-field-value-' . $field['id'] . '"></span>
1226
+                                                <span class="card-item-field-value float-right ml-1" id="card-item-field-value-' . $field['id'].'"></span>
1227 1227
                                             </li>';
1228 1228
                                         }
1229 1229
                                         echo '
Please login to merge, or discard this patch.
scripts/background_tasks___userKeysCreation_subtaskHdl.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 DB::update(
123 123
     prefixTable('background_subtasks'),
124 124
     array(
125
-        'sub_task_in_progress' => 0,    // flag sub task is no more in prgoress
125
+        'sub_task_in_progress' => 0, // flag sub task is no more in prgoress
126 126
         'is_in_progress' => 0,
127 127
         'finished_at' => time(),
128 128
         'updated_at' => time(),
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
         // Check if user exists
159 159
         $userInfo = DB::queryFirstRow(
160 160
             'SELECT public_key, private_key
161
-            FROM ' . prefixTable('users') . '
161
+            FROM ' . prefixTable('users').'
162 162
             WHERE id = %i',
163 163
             $post_user_id
164 164
         );
@@ -271,13 +271,13 @@  discard block
 block discarded – undo
271 271
 {
272 272
     $userInfo = DB::queryFirstRow(
273 273
         'SELECT pw, public_key, private_key, login, name
274
-        FROM ' . prefixTable('users') . '
274
+        FROM ' . prefixTable('users').'
275 275
         WHERE id = %i',
276 276
         $owner_id
277 277
     );
278 278
     
279 279
     // decrypt owner password
280
-    $pwd = cryption($owner_pwd, '','decrypt', $SETTINGS)['string'];
280
+    $pwd = cryption($owner_pwd, '', 'decrypt', $SETTINGS)['string'];
281 281
     // decrypt private key and send back
282 282
     return [
283 283
         'private_key' => decryptPrivateKey($pwd, $userInfo['private_key']),
@@ -317,10 +317,10 @@  discard block
 block discarded – undo
317 317
     // Loop on items
318 318
     $rows = DB::query(
319 319
         'SELECT id, pw, perso
320
-        FROM ' . prefixTable('items') . '
320
+        FROM ' . prefixTable('items').'
321 321
         WHERE perso =  %i
322 322
         ORDER BY id ASC
323
-        LIMIT ' . $post_start . ', ' . $post_length,
323
+        LIMIT ' . $post_start.', '.$post_length,
324 324
         ($extra_arguments['only_personal_items'] ?? 0) === 1 ? 1 : 0
325 325
     );
326 326
 
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
         // Get itemKey from current user
329 329
         $currentUserKey = DB::queryFirstRow(
330 330
             'SELECT share_key, increment_id
331
-            FROM ' . prefixTable('sharekeys_items') . '
331
+            FROM ' . prefixTable('sharekeys_items').'
332 332
             WHERE object_id = %i AND user_id = %i',
333 333
             $record['id'],
334 334
             (int) $record['perso'] === 0 ? $extra_arguments['owner_id'] : $extra_arguments['new_user_id']
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
         
356 356
         $currentUserKey = DB::queryFirstRow(
357 357
             'SELECT increment_id
358
-            FROM ' . prefixTable('sharekeys_items') . '
358
+            FROM ' . prefixTable('sharekeys_items').'
359 359
             WHERE object_id = %i AND user_id = %i',
360 360
             $record['id'],
361 361
             $post_user_id
@@ -429,15 +429,15 @@  discard block
 block discarded – undo
429 429
     // Loop on logs
430 430
     $rows = DB::query(
431 431
         'SELECT increment_id
432
-        FROM ' . prefixTable('log_items') . '
432
+        FROM ' . prefixTable('log_items').'
433 433
         WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"
434
-        LIMIT ' . $post_start . ', ' . $post_length
434
+        LIMIT ' . $post_start.', '.$post_length
435 435
     );
436 436
     foreach ($rows as $record) {
437 437
         // Get itemKey from current user
438 438
         $currentUserKey = DB::queryFirstRow(
439 439
             'SELECT share_key
440
-            FROM ' . prefixTable('sharekeys_logs') . '
440
+            FROM ' . prefixTable('sharekeys_logs').'
441 441
             WHERE object_id = %i AND user_id = %i',
442 442
             $record['increment_id'],
443 443
             $extra_arguments['owner_id']
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
             if ((int) $post_user_id !== (int) $extra_arguments['owner_id']) {
470 470
                 $currentUserKey = DB::queryFirstRow(
471 471
                     'SELECT increment_id
472
-                    FROM ' . prefixTable('sharekeys_items') . '
472
+                    FROM ' . prefixTable('sharekeys_items').'
473 473
                     WHERE object_id = %i AND user_id = %i',
474 474
                     $record['id'],
475 475
                     $post_user_id
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
     // SHould we change step?
492 492
     DB::query(
493 493
         'SELECT increment_id
494
-        FROM ' . prefixTable('log_items') . '
494
+        FROM ' . prefixTable('log_items').'
495 495
         WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"'
496 496
     );
497 497
 
@@ -531,15 +531,15 @@  discard block
 block discarded – undo
531 531
     // Loop on fields
532 532
     $rows = DB::query(
533 533
         'SELECT id
534
-        FROM ' . prefixTable('categories_items') . '
534
+        FROM ' . prefixTable('categories_items').'
535 535
         WHERE encryption_type = "teampass_aes"
536
-        LIMIT ' . $post_start . ', ' . $post_length
536
+        LIMIT ' . $post_start.', '.$post_length
537 537
     );
538 538
     foreach ($rows as $record) {
539 539
         // Get itemKey from current user
540 540
         $currentUserKey = DB::queryFirstRow(
541 541
             'SELECT share_key
542
-            FROM ' . prefixTable('sharekeys_fields') . '
542
+            FROM ' . prefixTable('sharekeys_fields').'
543 543
             WHERE object_id = %i AND user_id = %i',
544 544
             $record['id'],
545 545
             $extra_arguments['owner_id']
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
                 if ((int) $post_user_id !== (int) $extra_arguments['owner_id']) {
568 568
                     $currentUserKey = DB::queryFirstRow(
569 569
                         'SELECT increment_id
570
-                        FROM ' . prefixTable('sharekeys_items') . '
570
+                        FROM ' . prefixTable('sharekeys_items').'
571 571
                         WHERE object_id = %i AND user_id = %i',
572 572
                         $record['id'],
573 573
                         $post_user_id
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
     // SHould we change step?
591 591
     DB::query(
592 592
         'SELECT *
593
-        FROM ' . prefixTable('categories_items') . '
593
+        FROM ' . prefixTable('categories_items').'
594 594
         WHERE encryption_type = "teampass_aes"'
595 595
     );
596 596
 
@@ -630,14 +630,14 @@  discard block
 block discarded – undo
630 630
     // Loop on suggestions
631 631
     $rows = DB::query(
632 632
         'SELECT id
633
-        FROM ' . prefixTable('suggestion') . '
634
-        LIMIT ' . $post_start . ', ' . $post_length
633
+        FROM ' . prefixTable('suggestion').'
634
+        LIMIT ' . $post_start.', '.$post_length
635 635
     );
636 636
     foreach ($rows as $record) {
637 637
         // Get itemKey from current user
638 638
         $currentUserKey = DB::queryFirstRow(
639 639
             'SELECT share_key
640
-            FROM ' . prefixTable('sharekeys_suggestions') . '
640
+            FROM ' . prefixTable('sharekeys_suggestions').'
641 641
             WHERE object_id = %i AND user_id = %i',
642 642
             $record['id'],
643 643
             $extra_arguments['owner_id']
@@ -669,7 +669,7 @@  discard block
 block discarded – undo
669 669
             if ((int) $post_user_id !== (int) $extra_arguments['owner_id']) {
670 670
                 $currentUserKey = DB::queryFirstRow(
671 671
                     'SELECT increment_id
672
-                    FROM ' . prefixTable('sharekeys_items') . '
672
+                    FROM ' . prefixTable('sharekeys_items').'
673 673
                     WHERE object_id = %i AND user_id = %i',
674 674
                     $record['id'],
675 675
                     $post_user_id
@@ -729,16 +729,16 @@  discard block
 block discarded – undo
729 729
     // Loop on files
730 730
     $rows = DB::query(
731 731
         'SELECT f.id AS id, i.perso AS perso
732
-        FROM ' . prefixTable('files') . ' AS f
733
-        INNER JOIN ' . prefixTable('items') . ' AS i ON i.id = f.id_item
734
-        WHERE f.status = "' . TP_ENCRYPTION_NAME . '"
735
-        LIMIT ' . $post_start . ', ' . $post_length
732
+        FROM ' . prefixTable('files').' AS f
733
+        INNER JOIN ' . prefixTable('items').' AS i ON i.id = f.id_item
734
+        WHERE f.status = "' . TP_ENCRYPTION_NAME.'"
735
+        LIMIT ' . $post_start.', '.$post_length
736 736
     ); //aes_encryption
737 737
     foreach ($rows as $record) {
738 738
         // Get itemKey from current user
739 739
         $currentUserKey = DB::queryFirstRow(
740 740
             'SELECT share_key, increment_id
741
-            FROM ' . prefixTable('sharekeys_files') . '
741
+            FROM ' . prefixTable('sharekeys_files').'
742 742
             WHERE object_id = %i AND user_id = %i',
743 743
             $record['id'],
744 744
             (int) $record['perso'] === 0 ? $extra_arguments['owner_id'] : $extra_arguments['new_user_id']
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
 
767 767
         $currentUserKey = DB::queryFirstRow(
768 768
             'SELECT increment_id
769
-            FROM ' . prefixTable('sharekeys_files') . '
769
+            FROM ' . prefixTable('sharekeys_files').'
770 770
             WHERE object_id = %i AND user_id = %i',
771 771
             $record['id'],
772 772
             $post_user_id
@@ -797,8 +797,8 @@  discard block
 block discarded – undo
797 797
     // SHould we change step? Finished ?
798 798
     DB::query(
799 799
         'SELECT *
800
-        FROM ' . prefixTable('files') . '
801
-        WHERE status = "' . TP_ENCRYPTION_NAME . '"'
800
+        FROM ' . prefixTable('files').'
801
+        WHERE status = "' . TP_ENCRYPTION_NAME.'"'
802 802
     );
803 803
     $counter = DB::count();
804 804
     $next_start = (int) $post_start + (int) $post_length;
@@ -864,7 +864,7 @@  discard block
 block discarded – undo
864 864
     // get user info
865 865
     $userInfo = DB::queryFirstRow(
866 866
         'SELECT email, login, auth_type, special, lastname, name
867
-        FROM ' . prefixTable('users') . '
867
+        FROM ' . prefixTable('users').'
868 868
         WHERE id = %i',
869 869
         $extra_arguments['new_user_id']
870 870
     );
@@ -879,10 +879,10 @@  discard block
 block discarded – undo
879 879
             filter_var($userInfo['email'], FILTER_SANITIZE_FULL_SPECIAL_CHARS),
880 880
             // @scrutinizer ignore-type
881 881
             empty($extra_arguments['email_body']) === false ? $extra_arguments['email_body'] : $lang->get('email_body_user_config_1'),
882
-            'TEAMPASS - ' . $lang->get('login_credentials'),
882
+            'TEAMPASS - '.$lang->get('login_credentials'),
883 883
             (array) filter_var_array(
884 884
                 [
885
-                    '#code#' => cryption($extra_arguments['new_user_code'], '','decrypt', $SETTINGS)['string'],
885
+                    '#code#' => cryption($extra_arguments['new_user_code'], '', 'decrypt', $SETTINGS)['string'],
886 886
                     '#lastname#' => isset($userInfo['name']) === true ? $userInfo['name'] : '',
887 887
                     '#login#' => isset($userInfo['login']) === true ? $userInfo['login'] : '',
888 888
                 ],
Please login to merge, or discard this patch.