Passed
Pull Request — master (#4744)
by
unknown
06:48
created
sources/import.queries.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1364,4 +1364,4 @@
 block discarded – undo
1364 1364
     $string = str_replace("{%}", "?", $string);
1365 1365
     // Trim and return.
1366 1366
     return trim($string);
1367
-  }
1368 1367
\ No newline at end of file
1368
+    }
1369 1369
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 ) {
80 80
     // Not allowed page
81 81
     $session->set('system-error_code', ERR_NOT_ALLOWED);
82
-    include $SETTINGS['cpassman_dir'] . '/error.php';
82
+    include $SETTINGS['cpassman_dir'].'/error.php';
83 83
     exit;
84 84
 }
85 85
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
         );
168 168
 
169 169
         // Initialisation
170
-        $file = $SETTINGS['path_to_files_folder'] . '/' . $data['valeur'];
170
+        $file = $SETTINGS['path_to_files_folder'].'/'.$data['valeur'];
171 171
         $importation_possible = true;
172 172
         $valuesToImport = [];
173 173
         $items_number = 0;
@@ -224,26 +224,26 @@  discard block
 block discarded – undo
224 224
                 'ISO-8859-1',
225 225
                 'ISO-8859-15',
226 226
                 'Windows-1252',
227
-                'Windows-1251',  // Cyrillique
228
-                'CP1251',        // Cyrillique alternatif
229
-                'KOI8-R',        // Cyrillique russe
230
-                'Shift_JIS',     // Japonais
231
-                'EUC-JP',        // Japonais
232
-                'ISO-2022-JP',   // Japonais
233
-                'TIS-620',       // Thaï
234
-                'Windows-874',   // Thaï Windows
235
-                'Big5',          // Chinois traditionnel
236
-                'GB2312',        // Chinois simplifié
237
-                'GBK',           // Chinois simplifié étendu
238
-                'EUC-KR',        // Coréen
239
-                'ISO-8859-2',    // Europe centrale
240
-                'ISO-8859-5',    // Cyrillique ISO
241
-                'ISO-8859-7',    // Grec
242
-                'Windows-1250',  // Europe centrale
243
-                'Windows-1253',  // Grec
244
-                'Windows-1254',  // Turc
245
-                'Windows-1255',  // Hébreu
246
-                'Windows-1256',  // Arabe
227
+                'Windows-1251', // Cyrillique
228
+                'CP1251', // Cyrillique alternatif
229
+                'KOI8-R', // Cyrillique russe
230
+                'Shift_JIS', // Japonais
231
+                'EUC-JP', // Japonais
232
+                'ISO-2022-JP', // Japonais
233
+                'TIS-620', // Thaï
234
+                'Windows-874', // Thaï Windows
235
+                'Big5', // Chinois traditionnel
236
+                'GB2312', // Chinois simplifié
237
+                'GBK', // Chinois simplifié étendu
238
+                'EUC-KR', // Coréen
239
+                'ISO-8859-2', // Europe centrale
240
+                'ISO-8859-5', // Cyrillique ISO
241
+                'ISO-8859-7', // Grec
242
+                'Windows-1250', // Europe centrale
243
+                'Windows-1253', // Grec
244
+                'Windows-1254', // Turc
245
+                'Windows-1255', // Hébreu
246
+                'Windows-1256', // Arabe
247 247
             ];
248 248
 
249 249
             // Get the list of encodings supported by the system
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 
287 287
         // Get the data and ensure columns are correctly mapped
288 288
         $interpreter = new Interpreter();
289
-        $interpreter->addObserver(function (array $row) use (&$valuesToImport, $header) {
289
+        $interpreter->addObserver(function(array $row) use (&$valuesToImport, $header) {
290 290
             $rowData = array_combine($header, $row);
291 291
 
292 292
             if ($rowData !== false) {
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
             // Handle multiple lignes description
340 340
             if (strpos($comments, '<br>') !== false || strpos($label, '<br>') !== false) {
341 341
                 $continue_on_next_line = true;
342
-                $comment .= " " . $label . " " . $comments;
342
+                $comment .= " ".$label." ".$comments;
343 343
             } else {
344 344
                 // Insert previous line if changing line
345 345
                 if (!empty($label)) {
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
                     // Insert in batch
349 349
                     $batchInsert[] = array(
350 350
                         'label'        => $label,
351
-                        'description'  => $comment . $comments,
351
+                        'description'  => $comment.$comments,
352 352
                         'pwd'          => $pwd,
353 353
                         'url'          => $url,
354 354
                         'folder'       => ((int) $session->get('user-admin') === 1 || (int) $session->get('user-manager') === 1 || (int) $session->get('user-can_manage_all_users') === 1) ? $folder : '',
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
             // Insert in batch
380 380
             $batchInsert[] = array(
381 381
                 'label'        => $label,
382
-                'description'  => $comment . $comments,
382
+                'description'  => $comment.$comments,
383 383
                 'pwd'          => $pwd,
384 384
                 'url'          => $url,
385 385
                 'folder'       => ((int) $session->get('user-admin') === 1 || (int) $session->get('user-manager') === 1 || (int) $session->get('user-can_manage_all_users') === 1) ? $folder : '',
@@ -403,10 +403,10 @@  discard block
 block discarded – undo
403 403
             $values = [];
404 404
 
405 405
             foreach ($batchInsert as $data) {
406
-                $values[] = "('" . implode("','", array_map('addslashes', $data)) . "')";
406
+                $values[] = "('".implode("','", array_map('addslashes', $data))."')";
407 407
             }
408 408
 
409
-            $sql = "INSERT INTO `$tableName` (`label`, `description`, `pwd`, `url`, `folder`, `login`, `operation_id`) VALUES " . implode(',', $values);
409
+            $sql = "INSERT INTO `$tableName` (`label`, `description`, `pwd`, `url`, `folder`, `login`, `operation_id`) VALUES ".implode(',', $values);
410 410
 
411 411
             DB::query($sql);
412 412
         }
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
             $parentId = $dataReceived['folderId']; // Strating with provided folder
490 490
 
491 491
             foreach ($parts as $part) {
492
-                $currentPath = trim($currentPath . "/" . $part, "/");
492
+                $currentPath = trim($currentPath."/".$part, "/");
493 493
                 $currentFolder = $part;
494 494
 
495 495
                 // Check if this folder has already been created
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
                         // Get ID of existing folder
551 551
                         $ret = DB::queryFirstRow(
552 552
                             'SELECT *
553
-                            FROM ' . prefixTable('nested_tree') . '
553
+                            FROM ' . prefixTable('nested_tree').'
554 554
                             WHERE title = %s',
555 555
                             $currentFolder
556 556
                         );
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
                         'pw' => $itemPassword,
676 676
                         'pw_iv' => '',
677 677
                         'url' => empty($item['url']) === true ? '' : substr($item['url'], 0, 500),
678
-                        'id_tree' => isset($post_folders[$item['parentFolderId']]['id']) ? (int)$post_folders[$item['parentFolderId']]['id'] : 0,
678
+                        'id_tree' => isset($post_folders[$item['parentFolderId']]['id']) ? (int) $post_folders[$item['parentFolderId']]['id'] : 0,
679 679
                         'login' => empty($item['login']) === true ? '' : substr($item['login'], 0, 200),
680 680
                         'anyone_can_modify' => $dataReceived['editAll'],
681 681
                         'encryption_type' => 'teampass_aes',
@@ -1072,7 +1072,7 @@  discard block
 block discarded – undo
1072 1072
         ];
1073 1073
         $startPathLevel = 1;
1074 1074
 
1075
-        foreach($post_folders as $folder) {
1075
+        foreach ($post_folders as $folder) {
1076 1076
             // get parent id
1077 1077
             $parentId = $arrFolders[$folder['parentFolderId']];
1078 1078
 
@@ -1143,7 +1143,7 @@  discard block
 block discarded – undo
1143 1143
         DB::startTransaction();
1144 1144
 
1145 1145
         // Import all items
1146
-        foreach($post_items as $item) {
1146
+        foreach ($post_items as $item) {
1147 1147
             // get info about this folder
1148 1148
             $destinationFolderMore = DB::queryFirstRow(
1149 1149
                 'SELECT title FROM '.prefixTable('nested_tree').' WHERE id = %i',
@@ -1174,7 +1174,7 @@  discard block
 block discarded – undo
1174 1174
                     'pw' => $cryptedStuff['encrypted'],
1175 1175
                     'pw_iv' => '',
1176 1176
                     'url' => substr($item['URL'], 0, 500),
1177
-                    'id_tree' => isset($post_folders[$item['parentFolderId']]['id']) ? (int)$post_folders[$item['parentFolderId']]['id'] : 0,
1177
+                    'id_tree' => isset($post_folders[$item['parentFolderId']]['id']) ? (int) $post_folders[$item['parentFolderId']]['id'] : 0,
1178 1178
                     'login' => substr($item['UserName'], 0, 500),
1179 1179
                     'anyone_can_modify' => $$inputData['editAll'],
1180 1180
                     'encryption_type' => 'teampass_aes',
@@ -1369,7 +1369,7 @@  discard block
 block discarded – undo
1369 1369
     ];
1370 1370
 }
1371 1371
 
1372
-spl_autoload_register(function ($class) {
1372
+spl_autoload_register(function($class) {
1373 1373
     $prefix = 'League\\Csv\\';
1374 1374
     $base_dir = __DIR__.'/src/';
1375 1375
     $len = strlen($prefix);
Please login to merge, or discard this patch.