Completed
Pull Request — develop (#740)
by Maxim
08:32
created
manager/media/browser/mcpuk/core/browser.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
             $this->get['dir'] = $dir;
43 43
         }
44 44
 
45
-        $thumbsDir = $this->config['uploadDir'] . "/" . $this->config['thumbsDir'];
45
+        $thumbsDir = $this->config['uploadDir']."/".$this->config['thumbsDir'];
46 46
         if ((
47 47
                 !is_dir($thumbsDir) &&
48 48
                 !@mkdir($thumbsDir, $this->config['dirPerms'])
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
             $this->session['dir'] = $this->type;
115 115
         } else {
116 116
             $type = $this->getTypeFromPath($this->session['dir']);
117
-            $dir = $this->config['uploadDir'] . "/" . $this->session['dir'];
117
+            $dir = $this->config['uploadDir']."/".$this->session['dir'];
118 118
             if (($type != $this->type) || !is_dir($dir) || !is_readable($dir)) {
119 119
                 $this->session['dir'] = $this->type;
120 120
             }
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
         }
189 189
         $file = "{$this->thumbsDir}/{$this->type}/{$this->get['dir']}/$file";
190 190
         if (!is_file($file) || !is_readable($file)) {
191
-            $file = "{$this->config['uploadDir']}/{$this->type}/{$this->get['dir']}/" . basename($file);
191
+            $file = "{$this->config['uploadDir']}/{$this->type}/{$this->get['dir']}/".basename($file);
192 192
             if (!is_file($file) || !is_readable($file)) {
193 193
                 $this->sendDefaultThumb($file);
194 194
             }
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
     protected function act_chDir()
228 228
     {
229 229
         $this->postDir(); // Just for existing check
230
-        $this->session['dir'] = $this->type . "/" . $this->post['dir'];
230
+        $this->session['dir'] = $this->type."/".$this->post['dir'];
231 231
         $dirWritable = dir::isWritable("{$this->config['uploadDir']}/{$this->session['dir']}");
232 232
 
233 233
         return json_encode(array(
@@ -292,12 +292,12 @@  discard block
 block discarded – undo
292 292
         if (substr($newName, 0, 1) == ".") {
293 293
             $this->errorMsg("Folder name shouldn't begins with '.'");
294 294
         }
295
-        if (!@rename($dir, dirname($dir) . "/$newName")) {
295
+        if (!@rename($dir, dirname($dir)."/$newName")) {
296 296
             $this->errorMsg("Cannot rename the folder.");
297 297
         }
298 298
         $thumbDir = "$this->thumbsTypeDir/{$this->post['dir']}";
299 299
         if (is_dir($thumbDir)) {
300
-            @rename($thumbDir, dirname($thumbDir) . "/$newName");
300
+            @rename($thumbDir, dirname($thumbDir)."/$newName");
301 301
         }
302 302
 
303 303
         return json_encode(array('name' => $newName));
@@ -375,9 +375,9 @@  discard block
 block discarded – undo
375 375
         header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
376 376
         header("Cache-Control: private", false);
377 377
         header("Content-Type: application/octet-stream");
378
-        header('Content-Disposition: attachment; filename="' . str_replace('"', "_", $this->post['file']) . '"');
378
+        header('Content-Disposition: attachment; filename="'.str_replace('"', "_", $this->post['file']).'"');
379 379
         header("Content-Transfer-Encoding:­ binary");
380
-        header("Content-Length: " . filesize($file));
380
+        header("Content-Length: ".filesize($file));
381 381
         readfile($file);
382 382
         die;
383 383
     }
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
         $thumbFile = "$thumbDir/{$this->post['file']}";
435 435
 
436 436
         if (file_exists($thumbFile)) {
437
-            @rename($thumbFile, "$thumbDir/" . basename($newName));
437
+            @rename($thumbFile, "$thumbDir/".basename($newName));
438 438
         }
439 439
 
440 440
         return true;
@@ -514,11 +514,11 @@  discard block
 block discarded – undo
514 514
             if (!file_exists($path)) {
515 515
                 $error[] = $this->label("The file '{file}' does not exist.", $replace);
516 516
             } elseif (substr($base, 0, 1) == ".") {
517
-                $error[] = "$base: " . $this->label("File name shouldn't begins with '.'");
517
+                $error[] = "$base: ".$this->label("File name shouldn't begins with '.'");
518 518
             } elseif (!$this->validateExtension($ext, $type)) {
519
-                $error[] = "$base: " . $this->label("Denied file extension.");
519
+                $error[] = "$base: ".$this->label("Denied file extension.");
520 520
             } elseif (file_exists("$dir/$base")) {
521
-                $error[] = "$base: " . $this->label("A file or folder with that name already exists.");
521
+                $error[] = "$base: ".$this->label("A file or folder with that name already exists.");
522 522
             } elseif (!is_readable($path) || !is_file($path)) {
523 523
                 $error[] = $this->label("Cannot read '{file}'.", $replace);
524 524
             } elseif (!@copy($path, "$dir/$base")) {
@@ -578,11 +578,11 @@  discard block
 block discarded – undo
578 578
             if (!file_exists($path)) {
579 579
                 $error[] = $this->label("The file '{file}' does not exist.", $replace);
580 580
             } elseif (substr($base, 0, 1) == ".") {
581
-                $error[] = "$base: " . $this->label("File name shouldn't begins with '.'");
581
+                $error[] = "$base: ".$this->label("File name shouldn't begins with '.'");
582 582
             } elseif (!$this->validateExtension($ext, $type)) {
583
-                $error[] = "$base: " . $this->label("Denied file extension.");
583
+                $error[] = "$base: ".$this->label("Denied file extension.");
584 584
             } elseif (file_exists("$dir/$base")) {
585
-                $error[] = "$base: " . $this->label("A file or folder with that name already exists.");
585
+                $error[] = "$base: ".$this->label("A file or folder with that name already exists.");
586 586
             } elseif (!is_readable($path) || !is_file($path)) {
587 587
                 $error[] = $this->label("Cannot read '{file}'.", $replace);
588 588
             } elseif (!file::isWritable($path) || !@rename($path, "$dir/$base")) {
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
             }
636 636
             $path = "{$this->config['uploadDir']}/$file";
637 637
             $base = basename($file);
638
-            $filepath = str_replace('/' . $base, '', $path);
638
+            $filepath = str_replace('/'.$base, '', $path);
639 639
             $replace = array('file' => $base);
640 640
             if (!is_file($path)) {
641 641
                 $error[] = $this->label("The file '{file}' does not exist.", $replace);
@@ -681,15 +681,15 @@  discard block
 block discarded – undo
681 681
         if (!isset($this->post['dir']) || $this->config['denyZipDownload']) {
682 682
             $this->errorMsg("Unknown error.");
683 683
         }
684
-        $filename = basename($dir) . ".zip";
684
+        $filename = basename($dir).".zip";
685 685
         do {
686
-            $file = md5(time() . session_id());
686
+            $file = md5(time().session_id());
687 687
             $file = "{$this->config['uploadDir']}/$file.zip";
688 688
         } while (file_exists($file));
689 689
         new zipFolder($file, $dir);
690 690
         header("Content-Type: application/x-zip");
691
-        header('Content-Disposition: attachment; filename="' . str_replace('"', "_", $filename) . '"');
692
-        header("Content-Length: " . filesize($file));
691
+        header('Content-Disposition: attachment; filename="'.str_replace('"', "_", $filename).'"');
692
+        header("Content-Length: ".filesize($file));
693 693
         readfile($file);
694 694
         unlink($file);
695 695
         die;
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
         }
724 724
 
725 725
         do {
726
-            $file = md5(time() . session_id());
726
+            $file = md5(time().session_id());
727 727
             $file = "{$this->config['uploadDir']}/$file.zip";
728 728
         } while (file_exists($file));
729 729
 
@@ -736,8 +736,8 @@  discard block
 block discarded – undo
736 736
             $zip->close();
737 737
         }
738 738
         header("Content-Type: application/x-zip");
739
-        header('Content-Disposition: attachment; filename="selected_files_' . basename($file) . '"');
740
-        header("Content-Length: " . filesize($file));
739
+        header('Content-Disposition: attachment; filename="selected_files_'.basename($file).'"');
740
+        header("Content-Length: ".filesize($file));
741 741
         readfile($file);
742 742
         unlink($file);
743 743
         die;
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
             if ($type != $this->type) {
767 767
                 continue;
768 768
             }
769
-            $file = $this->config['uploadDir'] . "/$file";
769
+            $file = $this->config['uploadDir']."/$file";
770 770
             if (!is_file($file) || !is_readable($file)) {
771 771
                 continue;
772 772
             }
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
         }
775 775
 
776 776
         do {
777
-            $file = md5(time() . session_id());
777
+            $file = md5(time().session_id());
778 778
             $file = "{$this->config['uploadDir']}/$file.zip";
779 779
         } while (file_exists($file));
780 780
 
@@ -787,8 +787,8 @@  discard block
 block discarded – undo
787 787
             $zip->close();
788 788
         }
789 789
         header("Content-Type: application/x-zip");
790
-        header('Content-Disposition: attachment; filename="clipboard_' . basename($file) . '"');
791
-        header("Content-Length: " . filesize($file));
790
+        header('Content-Disposition: attachment; filename="clipboard_'.basename($file).'"');
791
+        header("Content-Length: ".filesize($file));
792 792
         readfile($file);
793 793
         unlink($file);
794 794
         die;
@@ -824,7 +824,7 @@  discard block
 block discarded – undo
824 824
             return $response;
825 825
         }
826 826
         $filename = $this->normalizeFilename($file['name']);
827
-        $target = "$dir/" . file::getInexistantFilename($filename, $dir);
827
+        $target = "$dir/".file::getInexistantFilename($filename, $dir);
828 828
 
829 829
         if (!@move_uploaded_file($file['tmp_name'], $target) &&
830 830
             !@rename($file['tmp_name'], $target) &&
@@ -890,7 +890,7 @@  discard block
 block discarded – undo
890 890
                 if (is_array($size) && count($size)) {
891 891
                     $preview = true;
892 892
                     if (!$this->config['noThumbnailsRecreation']) {
893
-                        $thumb_file = "$thumbDir/" . basename($file);
893
+                        $thumb_file = "$thumbDir/".basename($file);
894 894
                         if (!is_file($thumb_file) || filemtime($file) > filemtime($thumb_file)) {
895 895
                             $this->makeThumb($file);
896 896
                         }
@@ -907,7 +907,7 @@  discard block
 block discarded – undo
907 907
             }
908 908
             $name = basename($file);
909 909
             $types = $this->config['types'];
910
-            $types = explode(' ', $types['images'] . ' ' . $types['image']);
910
+            $types = explode(' ', $types['images'].' '.$types['image']);
911 911
             if (substr($name, 0, 1) == '.' && !$this->config['showHiddenFiles']) {
912 912
                 continue;
913 913
             }
@@ -987,7 +987,7 @@  discard block
 block discarded – undo
987 987
     {
988 988
         $dir = $this->typeDir;
989 989
         if (isset($this->post['dir'])) {
990
-            $dir .= "/" . $this->post['dir'];
990
+            $dir .= "/".$this->post['dir'];
991 991
         }
992 992
         if ($existent && (!is_dir($dir) || !is_readable($dir))) {
993 993
             $this->errorMsg("Inexistant or inaccessible folder.");
@@ -1004,7 +1004,7 @@  discard block
 block discarded – undo
1004 1004
     {
1005 1005
         $dir = $this->typeDir;
1006 1006
         if (isset($this->get['dir'])) {
1007
-            $dir .= "/" . $this->get['dir'];
1007
+            $dir .= "/".$this->get['dir'];
1008 1008
         }
1009 1009
         if ($existent && (!is_dir($dir) || !is_readable($dir))) {
1010 1010
             $this->errorMsg("Inexistant or inaccessible folder.");
Please login to merge, or discard this patch.