Passed
Pull Request — master (#4738)
by Nils
05:45
created
sources/import.queries.php 1 patch
Spacing   +33 added lines, -33 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;
@@ -219,26 +219,26 @@  discard block
 block discarded – undo
219 219
                 'ISO-8859-1',
220 220
                 'ISO-8859-15',
221 221
                 'Windows-1252',
222
-                'Windows-1251',  // Cyrillique
223
-                'CP1251',        // Cyrillique alternatif
224
-                'KOI8-R',        // Cyrillique russe
225
-                'Shift_JIS',     // Japonais
226
-                'EUC-JP',        // Japonais
227
-                'ISO-2022-JP',   // Japonais
228
-                'TIS-620',       // ThaĂŻ
229
-                'Windows-874',   // ThaĂŻ Windows
230
-                'Big5',          // Chinois traditionnel
231
-                'GB2312',        // Chinois simplifié
232
-                'GBK',           // Chinois simplifié étendu
233
-                'EUC-KR',        // Coréen
234
-                'ISO-8859-2',    // Europe centrale
235
-                'ISO-8859-5',    // Cyrillique ISO
236
-                'ISO-8859-7',    // Grec
237
-                'Windows-1250',  // Europe centrale
238
-                'Windows-1253',  // Grec
239
-                'Windows-1254',  // Turc
240
-                'Windows-1255',  // Hébreu
241
-                'Windows-1256',  // Arabe
222
+                'Windows-1251', // Cyrillique
223
+                'CP1251', // Cyrillique alternatif
224
+                'KOI8-R', // Cyrillique russe
225
+                'Shift_JIS', // Japonais
226
+                'EUC-JP', // Japonais
227
+                'ISO-2022-JP', // Japonais
228
+                'TIS-620', // ThaĂŻ
229
+                'Windows-874', // ThaĂŻ Windows
230
+                'Big5', // Chinois traditionnel
231
+                'GB2312', // Chinois simplifié
232
+                'GBK', // Chinois simplifié étendu
233
+                'EUC-KR', // Coréen
234
+                'ISO-8859-2', // Europe centrale
235
+                'ISO-8859-5', // Cyrillique ISO
236
+                'ISO-8859-7', // Grec
237
+                'Windows-1250', // Europe centrale
238
+                'Windows-1253', // Grec
239
+                'Windows-1254', // Turc
240
+                'Windows-1255', // Hébreu
241
+                'Windows-1256', // Arabe
242 242
             ];
243 243
             
244 244
             // Récupérer les encodages supportés par le système
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 
283 283
         // Get the data and ensure columns are correctly mapped
284 284
         $interpreter = new Interpreter();
285
-        $interpreter->addObserver(function (array $row) use (&$valuesToImport, $header) {
285
+        $interpreter->addObserver(function(array $row) use (&$valuesToImport, $header) {
286 286
             $rowData = array_combine($header, $row);
287 287
 
288 288
             if ($rowData !== false) {
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
             // Handle multiple lignes description
336 336
             if (strpos($comments, '<br>') !== false || strpos($label, '<br>') !== false) {
337 337
                 $continue_on_next_line = true;
338
-                $comment .= " " . $label . " " . $comments;
338
+                $comment .= " ".$label." ".$comments;
339 339
             } else {
340 340
                 // Insert previous line if changing line
341 341
                 if (!empty($label)) {
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
                     // Insert in batch
345 345
                     $batchInsert[] = array(
346 346
                         'label'        => $label,
347
-                        'description'  => $comment . $comments,
347
+                        'description'  => $comment.$comments,
348 348
                         'pwd'          => $pwd,
349 349
                         'url'          => $url,
350 350
                         'folder'       => ((int) $session->get('user-admin') === 1 || (int) $session->get('user-manager') === 1 || (int) $session->get('user-can_manage_all_users') === 1) ? $folder : '',
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
             // Insert in batch
376 376
             $batchInsert[] = array(
377 377
                 'label'        => $label,
378
-                'description'  => $comment . $comments,
378
+                'description'  => $comment.$comments,
379 379
                 'pwd'          => $pwd,
380 380
                 'url'          => $url,
381 381
                 'folder'       => ((int) $session->get('user-admin') === 1 || (int) $session->get('user-manager') === 1 || (int) $session->get('user-can_manage_all_users') === 1) ? $folder : '',
@@ -399,10 +399,10 @@  discard block
 block discarded – undo
399 399
             $values = [];
400 400
         
401 401
             foreach ($batchInsert as $data) {
402
-                $values[] = "('" . implode("','", array_map('addslashes', $data)) . "')";
402
+                $values[] = "('".implode("','", array_map('addslashes', $data))."')";
403 403
             }
404 404
         
405
-            $sql = "INSERT INTO `$tableName` (`label`, `description`, `pwd`, `url`, `folder`, `login`, `operation_id`) VALUES " . implode(',', $values);
405
+            $sql = "INSERT INTO `$tableName` (`label`, `description`, `pwd`, `url`, `folder`, `login`, `operation_id`) VALUES ".implode(',', $values);
406 406
             
407 407
             DB::query($sql);
408 408
         }
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
             $parentId = $dataReceived['folderId']; // Strating with provided folder
486 486
 
487 487
             foreach ($parts as $part) {
488
-                $currentPath = trim($currentPath . "/" . $part, "/");
488
+                $currentPath = trim($currentPath."/".$part, "/");
489 489
                 $currentFolder = $part;
490 490
 
491 491
                 // Check if this folder has already been created
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
                         // Get ID of existing folder
547 547
                         $ret = DB::queryFirstRow(
548 548
                             'SELECT *
549
-                            FROM ' . prefixTable('nested_tree') . '
549
+                            FROM ' . prefixTable('nested_tree').'
550 550
                             WHERE title = %s',
551 551
                             $currentFolder
552 552
                         );
@@ -1068,7 +1068,7 @@  discard block
 block discarded – undo
1068 1068
         ];
1069 1069
         $startPathLevel = 1;
1070 1070
 
1071
-        foreach($post_folders as $folder) {
1071
+        foreach ($post_folders as $folder) {
1072 1072
             // get parent id
1073 1073
             $parentId = $arrFolders[$folder['parentFolderId']];
1074 1074
 
@@ -1139,7 +1139,7 @@  discard block
 block discarded – undo
1139 1139
         DB::startTransaction();
1140 1140
 
1141 1141
         // Import all items
1142
-        foreach($post_items as $item) {
1142
+        foreach ($post_items as $item) {
1143 1143
             // get info about this folder
1144 1144
             $destinationFolderMore = DB::queryFirstRow(
1145 1145
                 'SELECT title FROM '.prefixTable('nested_tree').' WHERE id = %i',
@@ -1364,7 +1364,7 @@  discard block
 block discarded – undo
1364 1364
     ];
1365 1365
 }
1366 1366
 
1367
-spl_autoload_register(function ($class) {
1367
+spl_autoload_register(function($class) {
1368 1368
     $prefix = 'League\\Csv\\';
1369 1369
     $base_dir = __DIR__.'/src/';
1370 1370
     $len = strlen($prefix);
Please login to merge, or discard this patch.