@@ -24,10 +24,10 @@ |
||
24 | 24 | |
25 | 25 | // й ё Й Ё Ø Å |
26 | 26 | $patterns = array("\u0438\u0306", "\u0435\u0308", "\u0418\u0306", "\u0415\u0308", "\u00d8A", "\u030a"); |
27 | -$replace = array("\u0439", "\u0451", "\u0419", "\u0401", "\u00d8", "\u00c5"); |
|
27 | +$replace = array("\u0439", "\u0451", "\u0419", "\u0401", "\u00d8", "\u00c5"); |
|
28 | 28 | |
29 | 29 | |
30 | -foreach(scandir($path) as $f) { |
|
30 | +foreach (scandir($path) as $f) { |
|
31 | 31 | if ($f != '.' && $f != '..' && substr($f, 0, 1) != '.') { |
32 | 32 | |
33 | 33 | // echo mb_detect_encoding($f); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @return void |
35 | 35 | * @author Dmitry (dio) Levashov |
36 | 36 | **/ |
37 | - public function __construct($elFinder, $debug=false) { |
|
37 | + public function __construct($elFinder, $debug = false) { |
|
38 | 38 | |
39 | 39 | $this->elFinder = $elFinder; |
40 | 40 | if ($debug) { |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | if ($isPost && !$src && $rawPostData = @file_get_contents('php://input')) { |
55 | 55 | // for support IE XDomainRequest() |
56 | 56 | $parts = explode('&', $rawPostData); |
57 | - foreach($parts as $part) { |
|
57 | + foreach ($parts as $part) { |
|
58 | 58 | list($key, $value) = array_pad(explode('=', $part), 2, ''); |
59 | 59 | $key = rawurldecode($key); |
60 | 60 | if (substr($key, -2) === '[]') { |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | **/ |
122 | 122 | protected function output(array $data) { |
123 | 123 | // clear output buffer |
124 | - while(@ob_get_level()){ @ob_end_clean(); } |
|
124 | + while (@ob_get_level()) { @ob_end_clean(); } |
|
125 | 125 | |
126 | 126 | $header = isset($data['header']) ? $data['header'] : $this->header; |
127 | 127 | unset($data['header']); |
@@ -162,14 +162,14 @@ discard block |
||
162 | 162 | $psize = $end - $start + 1; |
163 | 163 | |
164 | 164 | header('HTTP/1.1 206 Partial Content'); |
165 | - header('Content-Length: ' . $psize); |
|
166 | - header('Content-Range: bytes ' . $start . '-' . $end . '/' . $size); |
|
165 | + header('Content-Length: '.$psize); |
|
166 | + header('Content-Range: bytes '.$start.'-'.$end.'/'.$size); |
|
167 | 167 | |
168 | 168 | fseek($fp, $start); |
169 | 169 | } |
170 | 170 | } |
171 | 171 | } |
172 | - if (is_null($psize)){ |
|
172 | + if (is_null($psize)) { |
|
173 | 173 | rewind($fp); |
174 | 174 | } |
175 | 175 | } else { |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | **/ |
62 | 62 | protected function _dirname($path) { |
63 | 63 | |
64 | - $newpath = preg_replace("/\/$/", "", $path); |
|
65 | - $dn = substr($path, 0, strrpos($newpath, '/')) ; |
|
64 | + $newpath = preg_replace("/\/$/", "", $path); |
|
65 | + $dn = substr($path, 0, strrpos($newpath, '/')); |
|
66 | 66 | |
67 | 67 | if (substr($dn, 0, 1) != '/') { |
68 | 68 | $dn = "/$dn"; |
@@ -105,9 +105,9 @@ discard block |
||
105 | 105 | * @author Troex Nevelin |
106 | 106 | **/ |
107 | 107 | protected function _normpath($path) { |
108 | - $tmp = preg_replace("/^\//", "", $path); |
|
109 | - $tmp = preg_replace("/\/\//", "/", $tmp); |
|
110 | - $tmp = preg_replace("/\/$/", "", $tmp); |
|
108 | + $tmp = preg_replace("/^\//", "", $path); |
|
109 | + $tmp = preg_replace("/\/\//", "/", $tmp); |
|
110 | + $tmp = preg_replace("/\/$/", "", $tmp); |
|
111 | 111 | return $tmp; |
112 | 112 | } |
113 | 113 | |
@@ -128,9 +128,9 @@ discard block |
||
128 | 128 | $newpath = "/$newpath"; |
129 | 129 | } |
130 | 130 | |
131 | - $newpath = preg_replace("/\/$/", "", $newpath); |
|
131 | + $newpath = preg_replace("/\/$/", "", $newpath); |
|
132 | 132 | |
133 | - $ret = ($newpath == $this->root) ? '' : substr($newpath, strlen($this->root)+1); |
|
133 | + $ret = ($newpath == $this->root) ? '' : substr($newpath, strlen($this->root) + 1); |
|
134 | 134 | |
135 | 135 | return $ret; |
136 | 136 | } |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | $np = $this->_normpath($path); |
232 | 232 | |
233 | 233 | try { |
234 | - $obj = $this->s3->GetObject(array('Bucket' => $this->options['bucket'], 'Key' => $np , 'GetMetadata' => true, 'InlineData' => false, 'GetData' => false)); |
|
234 | + $obj = $this->s3->GetObject(array('Bucket' => $this->options['bucket'], 'Key' => $np, 'GetMetadata' => true, 'InlineData' => false, 'GetData' => false)); |
|
235 | 235 | } catch (Exception $e) { |
236 | 236 | |
237 | 237 | } |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | if (!isset($obj) || ($obj->GetObjectResponse->Status->Code != 200)) { |
240 | 240 | $np .= '/'; |
241 | 241 | try { |
242 | - $obj = $this->s3->GetObject(array('Bucket' => $this->options['bucket'], 'Key' => $np , 'GetMetadata' => true, 'InlineData' => false, 'GetData' => false)); |
|
242 | + $obj = $this->s3->GetObject(array('Bucket' => $this->options['bucket'], 'Key' => $np, 'GetMetadata' => true, 'InlineData' => false, 'GetData' => false)); |
|
243 | 243 | } catch (Exception $e) { |
244 | 244 | |
245 | 245 | } |
@@ -341,14 +341,14 @@ discard block |
||
341 | 341 | **/ |
342 | 342 | protected function _scandir($path) { |
343 | 343 | |
344 | - $s3path = preg_replace("/^\//", "", $path) . '/'; |
|
344 | + $s3path = preg_replace("/^\//", "", $path).'/'; |
|
345 | 345 | |
346 | 346 | $files = $this->s3->ListBucket(array('Bucket' => $this->options['bucket'], 'delimiter' => '/', 'Prefix' => $s3path))->ListBucketResponse->Contents; |
347 | 347 | |
348 | 348 | $finalfiles = array(); |
349 | 349 | |
350 | 350 | foreach ($files as $file) { |
351 | - if (preg_match("|^" . $s3path . "[^/]*/?$|", $file->Key)) { |
|
351 | + if (preg_match("|^".$s3path."[^/]*/?$|", $file->Key)) { |
|
352 | 352 | $fname = preg_replace("/\/$/", "", $file->Key); |
353 | 353 | $fname = $file->Key; |
354 | 354 | |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | * @author Dmitry (dio) Levashov, |
374 | 374 | * @author Alexey Sukhotin |
375 | 375 | **/ |
376 | - protected function _fopen($path, $mode="rb") { |
|
376 | + protected function _fopen($path, $mode = "rb") { |
|
377 | 377 | |
378 | 378 | $tn = $this->getTempFile($path); |
379 | 379 | |
@@ -385,8 +385,8 @@ discard block |
||
385 | 385 | if ($fp) { |
386 | 386 | |
387 | 387 | try { |
388 | - $obj = $this->s3->GetObject(array('Bucket' => $this->options['bucket'], 'Key' => $this->_normpath($path) , 'GetMetadata' => true, 'InlineData' => true, 'GetData' => true)); |
|
389 | - } catch (Exception $e) { |
|
388 | + $obj = $this->s3->GetObject(array('Bucket' => $this->options['bucket'], 'Key' => $this->_normpath($path), 'GetMetadata' => true, 'InlineData' => true, 'GetData' => true)); |
|
389 | + } catch (Exception $e) { |
|
390 | 390 | |
391 | 391 | } |
392 | 392 | |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | * @return bool |
411 | 411 | * @author Dmitry (dio) Levashov |
412 | 412 | **/ |
413 | - protected function _fclose($fp, $path='') { |
|
413 | + protected function _fclose($fp, $path = '') { |
|
414 | 414 | @fclose($fp); |
415 | 415 | if ($path) { |
416 | 416 | @unlink($this->getTempFile($path)); |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | $newkey = "$newkey/$name/"; |
436 | 436 | |
437 | 437 | try { |
438 | - $obj = $this->s3->PutObjectInline(array('Bucket' => $this->options['bucket'], 'Key' => $newkey , 'ContentLength' => 0, 'Data' => '')); |
|
438 | + $obj = $this->s3->PutObjectInline(array('Bucket' => $this->options['bucket'], 'Key' => $newkey, 'ContentLength' => 0, 'Data' => '')); |
|
439 | 439 | } catch (Exception $e) { |
440 | 440 | |
441 | 441 | } |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | $newkey = "$newkey/$name"; |
463 | 463 | |
464 | 464 | try { |
465 | - $obj = $this->s3->PutObjectInline(array('Bucket' => $this->options['bucket'], 'Key' => $newkey , 'ContentLength' => 0, 'Data' => '', 'Metadata' => array(array('Name' => 'Content-Type', 'Value' => 'text/plain')))); |
|
465 | + $obj = $this->s3->PutObjectInline(array('Bucket' => $this->options['bucket'], 'Key' => $newkey, 'ContentLength' => 0, 'Data' => '', 'Metadata' => array(array('Name' => 'Content-Type', 'Value' => 'text/plain')))); |
|
466 | 466 | } catch (Exception $e) { |
467 | 467 | |
468 | 468 | } |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | * @author Dmitry (dio) Levashov |
564 | 564 | **/ |
565 | 565 | protected function _rmdir($path) { |
566 | - return $this->_unlink($path . '/'); |
|
566 | + return $this->_unlink($path.'/'); |
|
567 | 567 | } |
568 | 568 | |
569 | 569 | /** |
@@ -682,7 +682,7 @@ discard block |
||
682 | 682 | /* Getting list of S3 web service functions which requires signing */ |
683 | 683 | $funcs = $this->__getFunctions(); |
684 | 684 | |
685 | - $funcnames = array(); |
|
685 | + $funcnames = array(); |
|
686 | 686 | |
687 | 687 | foreach ($funcs as $func) { |
688 | 688 | preg_match("/\S+\s+([^\)]+)\(/", $func, $m); |
@@ -723,7 +723,7 @@ discard block |
||
723 | 723 | 'Timestamp' => gmdate('Y-m-d\TH:i:s.000\Z'), |
724 | 724 | ); |
725 | 725 | |
726 | - $sign_str = 'AmazonS3' . $operation . $params['Timestamp']; |
|
726 | + $sign_str = 'AmazonS3'.$operation.$params['Timestamp']; |
|
727 | 727 | |
728 | 728 | $params['Signature'] = base64_encode(hash_hmac('sha1', $sign_str, $this->secretkey, TRUE)); |
729 | 729 |
@@ -57,13 +57,13 @@ discard block |
||
57 | 57 | |
58 | 58 | public function __construct($opts) { |
59 | 59 | $defaults = array( |
60 | - 'enable' => true, // For control by volume driver |
|
60 | + 'enable' => true, // For control by volume driver |
|
61 | 61 | 'source' => 'logo.png', // Path to Water mark image |
62 | - 'marginRight' => 5, // Margin right pixel |
|
63 | - 'marginBottom' => 5, // Margin bottom pixel |
|
64 | - 'quality' => 95, // JPEG image save quality |
|
65 | - 'transparency' => 70, // Water mark image transparency ( other than PNG ) |
|
66 | - 'targetType' => IMG_GIF|IMG_JPG|IMG_PNG|IMG_WBMP, // Target image formats ( bit-field ) |
|
62 | + 'marginRight' => 5, // Margin right pixel |
|
63 | + 'marginBottom' => 5, // Margin bottom pixel |
|
64 | + 'quality' => 95, // JPEG image save quality |
|
65 | + 'transparency' => 70, // Water mark image transparency ( other than PNG ) |
|
66 | + 'targetType' => IMG_GIF | IMG_JPG | IMG_PNG | IMG_WBMP, // Target image formats ( bit-field ) |
|
67 | 67 | 'targetMinPixel' => 200 // Target image minimum pixel size |
68 | 68 | ); |
69 | 69 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $opts = array_merge($this->opts, $volOpts); |
80 | 80 | } |
81 | 81 | |
82 | - if (! $opts['enable']) { |
|
82 | + if (!$opts['enable']) { |
|
83 | 83 | return false; |
84 | 84 | } |
85 | 85 | |
@@ -94,12 +94,12 @@ discard block |
||
94 | 94 | } |
95 | 95 | |
96 | 96 | // check water mark image |
97 | - if (! file_exists($opts['source'])) { |
|
98 | - $opts['source'] = dirname(__FILE__) . "/" . $opts['source']; |
|
97 | + if (!file_exists($opts['source'])) { |
|
98 | + $opts['source'] = dirname(__FILE__)."/".$opts['source']; |
|
99 | 99 | } |
100 | 100 | if (is_readable($opts['source'])) { |
101 | 101 | $watermarkImgInfo = @getimagesize($opts['source']); |
102 | - if (! $watermarkImgInfo) { |
|
102 | + if (!$watermarkImgInfo) { |
|
103 | 103 | return false; |
104 | 104 | } |
105 | 105 | } else { |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | IMAGETYPE_PNG => IMG_PNG, |
120 | 120 | IMAGETYPE_WBMP => IMG_WBMP, |
121 | 121 | ); |
122 | - if (! ($opts['targetType'] & $imgTypes[$srcImgInfo[2]])) { |
|
122 | + if (!($opts['targetType'] & $imgTypes[$srcImgInfo[2]])) { |
|
123 | 123 | return false; |
124 | 124 | } |
125 | 125 | |
@@ -192,14 +192,14 @@ discard block |
||
192 | 192 | break; |
193 | 193 | case 'image/jpeg': |
194 | 194 | if (@imagetypes() & IMG_JPG) { |
195 | - $oWatermarkImg = @imagecreatefromjpeg($watermark) ; |
|
195 | + $oWatermarkImg = @imagecreatefromjpeg($watermark); |
|
196 | 196 | } else { |
197 | 197 | $ermsg = 'JPEG images are not supported'; |
198 | 198 | } |
199 | 199 | break; |
200 | 200 | case 'image/png': |
201 | 201 | if (@imagetypes() & IMG_PNG) { |
202 | - $oWatermarkImg = @imagecreatefrompng($watermark) ; |
|
202 | + $oWatermarkImg = @imagecreatefrompng($watermark); |
|
203 | 203 | } else { |
204 | 204 | $ermsg = 'PNG images are not supported'; |
205 | 205 | } |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | break; |
218 | 218 | } |
219 | 219 | |
220 | - if (! $ermsg) { |
|
220 | + if (!$ermsg) { |
|
221 | 221 | switch ($srcImgInfo['mime']) { |
222 | 222 | case 'image/gif': |
223 | 223 | if (@imagetypes() & IMG_GIF) { |
@@ -228,14 +228,14 @@ discard block |
||
228 | 228 | break; |
229 | 229 | case 'image/jpeg': |
230 | 230 | if (@imagetypes() & IMG_JPG) { |
231 | - $oSrcImg = @imagecreatefromjpeg($src) ; |
|
231 | + $oSrcImg = @imagecreatefromjpeg($src); |
|
232 | 232 | } else { |
233 | 233 | $ermsg = 'JPEG images are not supported'; |
234 | 234 | } |
235 | 235 | break; |
236 | 236 | case 'image/png': |
237 | 237 | if (@imagetypes() & IMG_PNG) { |
238 | - $oSrcImg = @imagecreatefrompng($src) ; |
|
238 | + $oSrcImg = @imagecreatefrompng($src); |
|
239 | 239 | } else { |
240 | 240 | $ermsg = 'PNG images are not supported'; |
241 | 241 | } |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | if ($srcImgInfo['mime'] === 'image/png') { |
262 | 262 | if (function_exists('imagecolorallocatealpha')) { |
263 | 263 | $bg = imagecolorallocatealpha($oSrcImg, 255, 255, 255, 127); |
264 | - imagefill($oSrcImg, 0, 0 , $bg); |
|
264 | + imagefill($oSrcImg, 0, 0, $bg); |
|
265 | 265 | } |
266 | 266 | } |
267 | 267 |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | |
50 | 50 | public function __construct($opts) { |
51 | 51 | $defaults = array( |
52 | - 'enable' => true, // For control by volume driver |
|
53 | - 'targets' => array('\\','/',':','*','?','"','<','>','|'), // target chars |
|
52 | + 'enable' => true, // For control by volume driver |
|
53 | + 'targets' => array('\\', '/', ':', '*', '?', '"', '<', '>', '|'), // target chars |
|
54 | 54 | 'replace' => '_' // replace to this |
55 | 55 | ); |
56 | 56 | |
@@ -59,13 +59,13 @@ discard block |
||
59 | 59 | |
60 | 60 | public function cmdPreprocess($cmd, &$args, $elfinder, $volume) { |
61 | 61 | $opts = $this->getOpts($volume); |
62 | - if (! $opts['enable']) { |
|
62 | + if (!$opts['enable']) { |
|
63 | 63 | return false; |
64 | 64 | } |
65 | 65 | |
66 | 66 | if (isset($args['name'])) { |
67 | 67 | if (is_array($args['name'])) { |
68 | - foreach($args['name'] as $i => $name) { |
|
68 | + foreach ($args['name'] as $i => $name) { |
|
69 | 69 | $args['name'][$i] = $this->sanitizeFileName($name, $opts); |
70 | 70 | } |
71 | 71 | } else { |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | public function onUpLoadPreSave(&$path, &$name, $src, $elfinder, $volume) { |
79 | 79 | $opts = $this->getOpts($volume); |
80 | - if (! $opts['enable']) { |
|
80 | + if (!$opts['enable']) { |
|
81 | 81 | return false; |
82 | 82 | } |
83 | 83 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | } |
101 | 101 | |
102 | 102 | private function sanitizeFileName($filename, $opts, $allows = array()) { |
103 | - $targets = $allows? array_diff($opts['targets'], $allows) : $opts['targets']; |
|
103 | + $targets = $allows ? array_diff($opts['targets'], $allows) : $opts['targets']; |
|
104 | 104 | return str_replace($targets, $opts['replace'], $filename); |
105 | 105 | } |
106 | 106 | } |
@@ -58,9 +58,9 @@ discard block |
||
58 | 58 | |
59 | 59 | public function __construct($opts) { |
60 | 60 | $defaults = array( |
61 | - 'enable' => true, // For control by volume driver |
|
62 | - 'nfc' => true, // Canonical Decomposition followed by Canonical Composition |
|
63 | - 'nfkc' => true, // Compatibility Decomposition followed by Canonical |
|
61 | + 'enable' => true, // For control by volume driver |
|
62 | + 'nfc' => true, // Canonical Decomposition followed by Canonical Composition |
|
63 | + 'nfkc' => true, // Compatibility Decomposition followed by Canonical |
|
64 | 64 | 'lowercase' => false, // Make chars lowercase |
65 | 65 | 'convmap' => array()// Convert map ('FROM' => 'TO') array |
66 | 66 | ); |
@@ -70,13 +70,13 @@ discard block |
||
70 | 70 | |
71 | 71 | public function cmdPreprocess($cmd, &$args, $elfinder, $volume) { |
72 | 72 | $opts = $this->getOpts($volume); |
73 | - if (! $opts['enable']) { |
|
73 | + if (!$opts['enable']) { |
|
74 | 74 | return false; |
75 | 75 | } |
76 | 76 | |
77 | 77 | if (isset($args['name'])) { |
78 | 78 | if (is_array($args['name'])) { |
79 | - foreach($args['name'] as $i => $name) { |
|
79 | + foreach ($args['name'] as $i => $name) { |
|
80 | 80 | $args['name'][$i] = $this->normalize($name, $opts); |
81 | 81 | } |
82 | 82 | } else { |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | |
89 | 89 | public function onUpLoadPreSave(&$path, &$name, $src, $elfinder, $volume) { |
90 | 90 | $opts = $this->getOpts($volume); |
91 | - if (! $opts['enable']) { |
|
91 | + if (!$opts['enable']) { |
|
92 | 92 | return false; |
93 | 93 | } |
94 | 94 | |
@@ -113,12 +113,12 @@ discard block |
||
113 | 113 | private function normalize($str, $opts) { |
114 | 114 | if ($opts['nfc'] || $opts['nfkc']) { |
115 | 115 | if (class_exists('Normalizer', false)) { |
116 | - if ($opts['nfc'] && ! Normalizer::isNormalized($str, Normalizer::FORM_C)) |
|
116 | + if ($opts['nfc'] && !Normalizer::isNormalized($str, Normalizer::FORM_C)) |
|
117 | 117 | $str = Normalizer::normalize($str, Normalizer::FORM_C); |
118 | - if ($opts['nfkc'] && ! Normalizer::isNormalized($str, Normalizer::FORM_KC)) |
|
118 | + if ($opts['nfkc'] && !Normalizer::isNormalized($str, Normalizer::FORM_KC)) |
|
119 | 119 | $str = Normalizer::normalize($str, Normalizer::FORM_KC); |
120 | 120 | } else { |
121 | - if (! class_exists('I18N_UnicodeNormalizer', false)) { |
|
121 | + if (!class_exists('I18N_UnicodeNormalizer', false)) { |
|
122 | 122 | @ include_once 'I18N/UnicodeNormalizer.php'; |
123 | 123 | } |
124 | 124 | if (class_exists('I18N_UnicodeNormalizer', false)) { |
@@ -52,12 +52,12 @@ discard block |
||
52 | 52 | |
53 | 53 | public function __construct($opts) { |
54 | 54 | $defaults = array( |
55 | - 'enable' => true, // For control by volume driver |
|
56 | - 'maxWidth' => 1024, // Path to Water mark image |
|
57 | - 'maxHeight' => 1024, // Margin right pixel |
|
58 | - 'quality' => 95, // JPEG image save quality |
|
59 | - 'preserveExif' => false, // Preserve EXIF data (Imagick only) |
|
60 | - 'targetType' => IMG_GIF|IMG_JPG|IMG_PNG|IMG_WBMP // Target image formats ( bit-field ) |
|
55 | + 'enable' => true, // For control by volume driver |
|
56 | + 'maxWidth' => 1024, // Path to Water mark image |
|
57 | + 'maxHeight' => 1024, // Margin right pixel |
|
58 | + 'quality' => 95, // JPEG image save quality |
|
59 | + 'preserveExif' => false, // Preserve EXIF data (Imagick only) |
|
60 | + 'targetType' => IMG_GIF | IMG_JPG | IMG_PNG | IMG_WBMP // Target image formats ( bit-field ) |
|
61 | 61 | ); |
62 | 62 | |
63 | 63 | $this->opts = array_merge($defaults, $opts); |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | $opts = array_merge($this->opts, $volOpts); |
72 | 72 | } |
73 | 73 | |
74 | - if (! $opts['enable']) { |
|
74 | + if (!$opts['enable']) { |
|
75 | 75 | return false; |
76 | 76 | } |
77 | 77 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | IMAGETYPE_PNG => IMG_PNG, |
88 | 88 | IMAGETYPE_WBMP => IMG_WBMP, |
89 | 89 | ); |
90 | - if (! ($opts['targetType'] & $imgTypes[$srcImgInfo[2]])) { |
|
90 | + if (!($opts['targetType'] & $imgTypes[$srcImgInfo[2]])) { |
|
91 | 91 | return false; |
92 | 92 | } |
93 | 93 | |
@@ -99,9 +99,9 @@ discard block |
||
99 | 99 | } |
100 | 100 | |
101 | 101 | private function resize($src, $srcImgInfo, $maxWidth, $maxHeight, $quality, $preserveExif) { |
102 | - $zoom = min(($maxWidth/$srcImgInfo[0]),($maxHeight/$srcImgInfo[1])); |
|
103 | - $width = round($srcImgInfo[0] * $zoom); |
|
104 | - $height = round($srcImgInfo[1] * $zoom); |
|
102 | + $zoom = min(($maxWidth/$srcImgInfo[0]), ($maxHeight/$srcImgInfo[1])); |
|
103 | + $width = round($srcImgInfo[0]*$zoom); |
|
104 | + $height = round($srcImgInfo[1]*$zoom); |
|
105 | 105 | |
106 | 106 | if (class_exists('Imagick', false)) { |
107 | 107 | return $this->resize_imagick($src, $width, $height, $quality, $preserveExif); |
@@ -121,14 +121,14 @@ discard block |
||
121 | 121 | break; |
122 | 122 | case 'image/jpeg': |
123 | 123 | if (@imagetypes() & IMG_JPG) { |
124 | - $oSrcImg = @imagecreatefromjpeg($src) ; |
|
124 | + $oSrcImg = @imagecreatefromjpeg($src); |
|
125 | 125 | } else { |
126 | 126 | $ermsg = 'JPEG images are not supported'; |
127 | 127 | } |
128 | 128 | break; |
129 | 129 | case 'image/png': |
130 | 130 | if (@imagetypes() & IMG_PNG) { |
131 | - $oSrcImg = @imagecreatefrompng($src) ; |
|
131 | + $oSrcImg = @imagecreatefrompng($src); |
|
132 | 132 | } else { |
133 | 133 | $ermsg = 'PNG images are not supported'; |
134 | 134 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | break; |
147 | 147 | } |
148 | 148 | |
149 | - if ($oSrcImg && false != ($tmp = imagecreatetruecolor($width, $height))) { |
|
149 | + if ($oSrcImg && false != ($tmp = imagecreatetruecolor($width, $height))) { |
|
150 | 150 | |
151 | 151 | if (!imagecopyresampled($tmp, $oSrcImg, 0, 0, 0, 0, $width, $height, $srcImgInfo[0], $srcImgInfo[1])) { |
152 | 152 | return false; |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | ); |
104 | 104 | $this->options = array_merge($this->options, $opts); |
105 | 105 | $this->options['mimeDetect'] = 'internal'; |
106 | - $this->options['maxArcFilesSize'] = 0; // max allowed archive files size (0 - no limit) |
|
106 | + $this->options['maxArcFilesSize'] = 0; // max allowed archive files size (0 - no limit) |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | $scheme = parse_url($this->options['host'], PHP_URL_SCHEME); |
164 | 164 | |
165 | 165 | if ($scheme) { |
166 | - $this->options['host'] = substr($this->options['host'], strlen($scheme)+3); |
|
166 | + $this->options['host'] = substr($this->options['host'], strlen($scheme) + 3); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | // normalize root path |
@@ -239,11 +239,11 @@ discard block |
||
239 | 239 | if ($this->encoding) { |
240 | 240 | @ftp_exec($this->connect, 'OPTS UTF8 OFF'); |
241 | 241 | } else { |
242 | - @ftp_exec($this->connect, 'OPTS UTF8 ON' ); |
|
242 | + @ftp_exec($this->connect, 'OPTS UTF8 ON'); |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | // switch off extended passive mode - may be usefull for some servers |
246 | - @ftp_exec($this->connect, 'epsv4 off' ); |
|
246 | + @ftp_exec($this->connect, 'epsv4 off'); |
|
247 | 247 | // enter passive mode if required |
248 | 248 | ftp_pasv($this->connect, $this->options['mode'] == 'passive'); |
249 | 249 | |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | $name = $info[8]; |
312 | 312 | |
313 | 313 | if (preg_match('|(.+)\-\>(.+)|', $name, $m)) { |
314 | - $name = trim($m[1]); |
|
314 | + $name = trim($m[1]); |
|
315 | 315 | // check recursive processing |
316 | 316 | if ($this->cacheDirTarget && $this->_joinPath($base, $name) !== $this->cacheDirTarget) { |
317 | 317 | return array(); |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | $stat['owner'] = $info[2]; |
348 | 348 | $stat['group'] = $info[3]; |
349 | 349 | $stat['perm'] = substr($info[0], 1); |
350 | - $stat['isowner'] = $stat['owner']? ($stat['owner'] == $this->options['user']) : $this->options['owner']; |
|
350 | + $stat['isowner'] = $stat['owner'] ? ($stat['owner'] == $this->options['user']) : $this->options['owner']; |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | $perm = $this->parsePermissions($info[0], $stat['owner']); |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | $info[4] = 0; |
380 | 380 | $info[0] = 'drwxr-xr-x'; |
381 | 381 | } else { |
382 | - $info[4] = (int)$size; |
|
382 | + $info[4] = (int) $size; |
|
383 | 383 | $info[0] = '-rw-r--r--'; |
384 | 384 | } |
385 | 385 | return $info; |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | protected function parsePermissions($perm, $user = '') { |
396 | 396 | $res = array(); |
397 | 397 | $parts = array(); |
398 | - $owner = $user? ($user == $this->options['user']) : $this->options['owner']; |
|
398 | + $owner = $user ? ($user == $this->options['user']) : $this->options['owner']; |
|
399 | 399 | for ($i = 0, $l = strlen($perm); $i < $l; $i++) { |
400 | 400 | $parts[] = substr($perm, $i, 1); |
401 | 401 | } |
@@ -426,10 +426,10 @@ discard block |
||
426 | 426 | } |
427 | 427 | } |
428 | 428 | $list = $this->convEncOut($list); |
429 | - $prefix = ($path === $this->separator)? $this->separator : $path . $this->separator; |
|
429 | + $prefix = ($path === $this->separator) ? $this->separator : $path.$this->separator; |
|
430 | 430 | $targets = array(); |
431 | - foreach($list as $stat) { |
|
432 | - $p = $prefix . $stat['name']; |
|
431 | + foreach ($list as $stat) { |
|
432 | + $p = $prefix.$stat['name']; |
|
433 | 433 | if (isset($stat['target'])) { |
434 | 434 | // stat later |
435 | 435 | $targets[$stat['name']] = $stat['target']; |
@@ -441,10 +441,10 @@ discard block |
||
441 | 441 | } |
442 | 442 | } |
443 | 443 | // stat link targets |
444 | - foreach($targets as $name => $target) { |
|
444 | + foreach ($targets as $name => $target) { |
|
445 | 445 | $stat = array(); |
446 | 446 | $stat['name'] = $name; |
447 | - $p = $prefix . $name; |
|
447 | + $p = $prefix.$name; |
|
448 | 448 | $cacheDirTarget = $this->cacheDirTarget; |
449 | 449 | $this->cacheDirTarget = $this->convEncIn($target, true); |
450 | 450 | if ($tstat = $this->stat($target)) { |
@@ -453,12 +453,12 @@ discard block |
||
453 | 453 | $stat['thash'] = $tstat['hash']; |
454 | 454 | $stat['mime'] = $tstat['mime']; |
455 | 455 | $stat['read'] = $tstat['read']; |
456 | - $stat['write'] = $tstat['write']; |
|
456 | + $stat['write'] = $tstat['write']; |
|
457 | 457 | |
458 | - if (isset($tstat['ts'])) { $stat['ts'] = $tstat['ts']; } |
|
459 | - if (isset($tstat['owner'])) { $stat['owner'] = $tstat['owner']; } |
|
460 | - if (isset($tstat['group'])) { $stat['group'] = $tstat['group']; } |
|
461 | - if (isset($tstat['perm'])) { $stat['perm'] = $tstat['perm']; } |
|
458 | + if (isset($tstat['ts'])) { $stat['ts'] = $tstat['ts']; } |
|
459 | + if (isset($tstat['owner'])) { $stat['owner'] = $tstat['owner']; } |
|
460 | + if (isset($tstat['group'])) { $stat['group'] = $tstat['group']; } |
|
461 | + if (isset($tstat['perm'])) { $stat['perm'] = $tstat['perm']; } |
|
462 | 462 | if (isset($tstat['isowner'])) { $stat['isowner'] = $tstat['isowner']; } |
463 | 463 | } else { |
464 | 464 | |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | $comps = $new_comps; |
572 | 572 | $path = implode($this->separator, $comps); |
573 | 573 | if ($initial_slashes) { |
574 | - $path = str_repeat($this->separator, $initial_slashes) . $path; |
|
574 | + $path = str_repeat($this->separator, $initial_slashes).$path; |
|
575 | 575 | } |
576 | 576 | |
577 | 577 | return $path ? $path : '.'; |
@@ -637,7 +637,7 @@ discard block |
||
637 | 637 | * @author Dmitry (dio) Levashov |
638 | 638 | **/ |
639 | 639 | protected function _inpath($path, $parent) { |
640 | - return $path == $parent || strpos($path, $parent. $this->separator) === 0; |
|
640 | + return $path == $parent || strpos($path, $parent.$this->separator) === 0; |
|
641 | 641 | } |
642 | 642 | |
643 | 643 | /***************** file stat ********************/ |
@@ -669,7 +669,7 @@ discard block |
||
669 | 669 | } |
670 | 670 | if (!$this->MLSTsupprt) { |
671 | 671 | //if ($path == $this->root && (empty($this->ARGS['reload']) || !isset($this->ARGS['target']) || strpos($this->ARGS['target'], $this->id) !== 0)) { |
672 | - if ($path == $this->root && ! $this->isMyReload()) { |
|
672 | + if ($path == $this->root && !$this->isMyReload()) { |
|
673 | 673 | return array( |
674 | 674 | 'name' => $this->root, |
675 | 675 | 'mime' => 'directory', |
@@ -677,9 +677,9 @@ discard block |
||
677 | 677 | ); |
678 | 678 | } |
679 | 679 | $this->cacheDir($this->convEncOut($this->_dirname($path))); |
680 | - return $this->convEncIn(isset($this->cache[$outPath])? $this->cache[$outPath] : array()); |
|
680 | + return $this->convEncIn(isset($this->cache[$outPath]) ? $this->cache[$outPath] : array()); |
|
681 | 681 | } |
682 | - $raw = ftp_raw($this->connect, 'MLST ' . $path); |
|
682 | + $raw = ftp_raw($this->connect, 'MLST '.$path); |
|
683 | 683 | if (is_array($raw) && count($raw) > 1 && substr(trim($raw[0]), 0, 1) == 2) { |
684 | 684 | $parts = explode(';', trim($raw[1])); |
685 | 685 | array_pop($parts); |
@@ -709,8 +709,8 @@ discard block |
||
709 | 709 | |
710 | 710 | case 'perm': |
711 | 711 | $val = strtolower($val); |
712 | - $stat['read'] = (int)preg_match('/e|l|r/', $val); |
|
713 | - $stat['write'] = (int)preg_match('/w|m|c/', $val); |
|
712 | + $stat['read'] = (int) preg_match('/e|l|r/', $val); |
|
713 | + $stat['write'] = (int) preg_match('/w|m|c/', $val); |
|
714 | 714 | if (!preg_match('/f|d/', $val)) { |
715 | 715 | $stat['locked'] = 1; |
716 | 716 | } |
@@ -795,7 +795,7 @@ discard block |
||
795 | 795 | if (!$this->ftpOsUnix) { |
796 | 796 | $info = $this->normalizeRawWindows($str); |
797 | 797 | } |
798 | - $name = isset($info[8])? trim($info[8]) : ''; |
|
798 | + $name = isset($info[8]) ? trim($info[8]) : ''; |
|
799 | 799 | if ($name && $name !== '.' && $name !== '..' && substr(strtolower($info[0]), 0, 1) === 'd') { |
800 | 800 | return true; |
801 | 801 | } |
@@ -850,7 +850,7 @@ discard block |
||
850 | 850 | * @return resource|false |
851 | 851 | * @author Dmitry (dio) Levashov |
852 | 852 | **/ |
853 | - protected function _fopen($path, $mode='rb') { |
|
853 | + protected function _fopen($path, $mode = 'rb') { |
|
854 | 854 | // try ftp stream wrapper |
855 | 855 | if (ini_get('allow_url_fopen')) { |
856 | 856 | $url = 'ftp://'.$this->options['user'].':'.$this->options['pass'].'@'.$this->options['host'].':'.$this->options['port'].$path; |
@@ -887,7 +887,7 @@ discard block |
||
887 | 887 | * @return bool |
888 | 888 | * @author Dmitry (dio) Levashov |
889 | 889 | **/ |
890 | - protected function _fclose($fp, $path='') { |
|
890 | + protected function _fclose($fp, $path = '') { |
|
891 | 891 | @fclose($fp); |
892 | 892 | if ($path) { |
893 | 893 | @unlink($this->getTempFile($path)); |
@@ -1062,7 +1062,7 @@ discard block |
||
1062 | 1062 | if (@file_put_contents($local, $content, LOCK_EX) !== false |
1063 | 1063 | && ($fp = @fopen($local, 'rb'))) { |
1064 | 1064 | clearstatcache(); |
1065 | - $res = ftp_fput($this->connect, $path, $fp, $this->ftpMode($path)); |
|
1065 | + $res = ftp_fput($this->connect, $path, $fp, $this->ftpMode($path)); |
|
1066 | 1066 | @fclose($fp); |
1067 | 1067 | } |
1068 | 1068 | file_exists($local) && @unlink($local); |
@@ -1087,7 +1087,7 @@ discard block |
||
1087 | 1087 | * @return bool |
1088 | 1088 | **/ |
1089 | 1089 | protected function _chmod($path, $mode) { |
1090 | - $modeOct = is_string($mode) ? octdec($mode) : octdec(sprintf("%04o",$mode)); |
|
1090 | + $modeOct = is_string($mode) ? octdec($mode) : octdec(sprintf("%04o", $mode)); |
|
1091 | 1091 | return @ftp_chmod($this->connect, $modeOct, $path); |
1092 | 1092 | } |
1093 | 1093 | |
@@ -1140,7 +1140,7 @@ discard block |
||
1140 | 1140 | } |
1141 | 1141 | |
1142 | 1142 | $basename = $this->_basename($path); |
1143 | - $localPath = $dir . DIRECTORY_SEPARATOR . $basename; |
|
1143 | + $localPath = $dir.DIRECTORY_SEPARATOR.$basename; |
|
1144 | 1144 | |
1145 | 1145 | if (!ftp_get($this->connect, $localPath, $path, FTP_BINARY)) { |
1146 | 1146 | //cleanup |
@@ -1177,7 +1177,7 @@ discard block |
||
1177 | 1177 | |
1178 | 1178 | // archive contains one item - extract in archive dir |
1179 | 1179 | $name = ''; |
1180 | - $src = $dir . DIRECTORY_SEPARATOR . $filesToProcess[0]; |
|
1180 | + $src = $dir.DIRECTORY_SEPARATOR.$filesToProcess[0]; |
|
1181 | 1181 | if (($extractTo === 'auto' || !$extractTo) && count($filesToProcess) === 1 && is_file($src)) { |
1182 | 1182 | $name = $filesToProcess[0]; |
1183 | 1183 | } else if ($extractTo === 'auto' || $extractTo) { |
@@ -1186,7 +1186,7 @@ discard block |
||
1186 | 1186 | $src = $dir; |
1187 | 1187 | $name = basename($path); |
1188 | 1188 | if (preg_match('/\.((tar\.(gz|bz|bz2|z|lzo))|cpio\.gz|ps\.gz|xcf\.(gz|bz2)|[a-z0-9]{1,4})$/i', $name, $m)) { |
1189 | - $name = substr($name, 0, strlen($name)-strlen($m[0])); |
|
1189 | + $name = substr($name, 0, strlen($name) - strlen($m[0])); |
|
1190 | 1190 | } |
1191 | 1191 | $test = $this->_joinPath(dirname($path), $name); |
1192 | 1192 | if ($this->stat($test)) { |
@@ -1197,7 +1197,7 @@ discard block |
||
1197 | 1197 | if ($name !== '' && is_file($src)) { |
1198 | 1198 | $result = $this->_joinPath(dirname($path), $name); |
1199 | 1199 | |
1200 | - if (! ftp_put($this->connect, $result, $src, FTP_BINARY)) { |
|
1200 | + if (!ftp_put($this->connect, $result, $src, FTP_BINARY)) { |
|
1201 | 1201 | $this->rmdirRecursive($dir); |
1202 | 1202 | return false; |
1203 | 1203 | } |
@@ -1211,19 +1211,19 @@ discard block |
||
1211 | 1211 | } |
1212 | 1212 | $result[] = $dstDir; |
1213 | 1213 | } |
1214 | - foreach($filesToProcess as $name) { |
|
1214 | + foreach ($filesToProcess as $name) { |
|
1215 | 1215 | $name = rtrim($name, DIRECTORY_SEPARATOR); |
1216 | - $src = $dir . DIRECTORY_SEPARATOR . $name; |
|
1216 | + $src = $dir.DIRECTORY_SEPARATOR.$name; |
|
1217 | 1217 | if (is_dir($src)) { |
1218 | 1218 | $p = dirname($name); |
1219 | 1219 | $name = basename($name); |
1220 | - if (! $target = $this->_mkdir($this->_joinPath($dstDir, $p), $name)) { |
|
1220 | + if (!$target = $this->_mkdir($this->_joinPath($dstDir, $p), $name)) { |
|
1221 | 1221 | $this->rmdirRecursive($dir); |
1222 | 1222 | return false; |
1223 | 1223 | } |
1224 | 1224 | } else { |
1225 | 1225 | $target = $this->_joinPath($dstDir, $name); |
1226 | - if (! ftp_put($this->connect, $target, $src, FTP_BINARY)) { |
|
1226 | + if (!ftp_put($this->connect, $target, $src, FTP_BINARY)) { |
|
1227 | 1227 | $this->rmdirRecursive($dir); |
1228 | 1228 | return false; |
1229 | 1229 | } |
@@ -1239,7 +1239,7 @@ discard block |
||
1239 | 1239 | is_dir($dir) && $this->rmdirRecursive($dir); |
1240 | 1240 | |
1241 | 1241 | $this->clearcache(); |
1242 | - return $result? $result : false; |
|
1242 | + return $result ? $result : false; |
|
1243 | 1243 | } |
1244 | 1244 | |
1245 | 1245 | /** |
@@ -1279,7 +1279,7 @@ discard block |
||
1279 | 1279 | } |
1280 | 1280 | |
1281 | 1281 | //cleanup |
1282 | - if(!$this->rmdirRecursive($tmpDir)) { |
|
1282 | + if (!$this->rmdirRecursive($tmpDir)) { |
|
1283 | 1283 | return false; |
1284 | 1284 | } |
1285 | 1285 | |
@@ -1383,7 +1383,7 @@ discard block |
||
1383 | 1383 | $remoteDirLen = strlen($remote_directory); |
1384 | 1384 | foreach ($contents as $item) { |
1385 | 1385 | $relative_path = substr($item['path'], $remoteDirLen); |
1386 | - $local_path = $dest_local_directory . DIRECTORY_SEPARATOR . $relative_path; |
|
1386 | + $local_path = $dest_local_directory.DIRECTORY_SEPARATOR.$relative_path; |
|
1387 | 1387 | switch ($item['type']) { |
1388 | 1388 | case 'd': |
1389 | 1389 | $success = mkdir($local_path); |
@@ -1414,8 +1414,8 @@ discard block |
||
1414 | 1414 | } else { |
1415 | 1415 | $success = true; |
1416 | 1416 | foreach (array_reverse(elFinderVolumeFTP::listFilesInDirectory($dirPath, false)) as $path) { |
1417 | - $path = $dirPath . DIRECTORY_SEPARATOR . $path; |
|
1418 | - if(is_link($path)) { |
|
1417 | + $path = $dirPath.DIRECTORY_SEPARATOR.$path; |
|
1418 | + if (is_link($path)) { |
|
1419 | 1419 | unlink($path); |
1420 | 1420 | } else if (is_dir($path)) { |
1421 | 1421 | $success = rmdir($path); |
@@ -1426,11 +1426,11 @@ discard block |
||
1426 | 1426 | break; |
1427 | 1427 | } |
1428 | 1428 | } |
1429 | - if($success) { |
|
1429 | + if ($success) { |
|
1430 | 1430 | $success = rmdir($dirPath); |
1431 | 1431 | } |
1432 | 1432 | } |
1433 | - if(!$success) { |
|
1433 | + if (!$success) { |
|
1434 | 1434 | $this->setError(elFinder::ERROR_RM, $dirPath); |
1435 | 1435 | return false; |
1436 | 1436 | } |
@@ -1452,25 +1452,25 @@ discard block |
||
1452 | 1452 | if (!is_dir($dir)) { |
1453 | 1453 | return false; |
1454 | 1454 | } |
1455 | - $excludes = array(".",".."); |
|
1455 | + $excludes = array(".", ".."); |
|
1456 | 1456 | $result = array(); |
1457 | 1457 | $files = scandir($dir); |
1458 | - if(!$files) { |
|
1458 | + if (!$files) { |
|
1459 | 1459 | return array(); |
1460 | 1460 | } |
1461 | - foreach($files as $file) { |
|
1462 | - if(!in_array($file, $excludes)) { |
|
1461 | + foreach ($files as $file) { |
|
1462 | + if (!in_array($file, $excludes)) { |
|
1463 | 1463 | $path = $dir.DIRECTORY_SEPARATOR.$file; |
1464 | - if(is_link($path)) { |
|
1465 | - if($omitSymlinks) { |
|
1464 | + if (is_link($path)) { |
|
1465 | + if ($omitSymlinks) { |
|
1466 | 1466 | continue; |
1467 | 1467 | } else { |
1468 | 1468 | $result[] = $prefix.$file; |
1469 | 1469 | } |
1470 | - } else if(is_dir($path)) { |
|
1470 | + } else if (is_dir($path)) { |
|
1471 | 1471 | $result[] = $prefix.$file.DIRECTORY_SEPARATOR; |
1472 | 1472 | $subs = elFinderVolumeFTP::listFilesInDirectory($path, $omitSymlinks, $prefix.$file.DIRECTORY_SEPARATOR); |
1473 | - if($subs) { |
|
1473 | + if ($subs) { |
|
1474 | 1474 | $result = array_merge($result, $subs); |
1475 | 1475 | } |
1476 | 1476 |
@@ -2,20 +2,20 @@ discard block |
||
2 | 2 | |
3 | 3 | // Implement similar functionality in PHP 5.2 or 5.3 |
4 | 4 | // http://php.net/manual/class.recursivecallbackfilteriterator.php#110974 |
5 | -if (! class_exists('RecursiveCallbackFilterIterator', false)) { |
|
5 | +if (!class_exists('RecursiveCallbackFilterIterator', false)) { |
|
6 | 6 | class RecursiveCallbackFilterIterator extends RecursiveFilterIterator { |
7 | 7 | |
8 | - public function __construct ( RecursiveIterator $iterator, $callback ) { |
|
8 | + public function __construct(RecursiveIterator $iterator, $callback) { |
|
9 | 9 | $this->callback = $callback; |
10 | 10 | parent::__construct($iterator); |
11 | 11 | } |
12 | 12 | |
13 | - public function accept () { |
|
13 | + public function accept() { |
|
14 | 14 | $callback = $this->callback; |
15 | 15 | return $callback(parent::current(), parent::key(), parent::getInnerIterator()); |
16 | 16 | } |
17 | 17 | |
18 | - public function getChildren () { |
|
18 | + public function getChildren() { |
|
19 | 19 | return new self($this->getInnerIterator()->getChildren(), $this->callback); |
20 | 20 | } |
21 | 21 | } |
@@ -60,11 +60,11 @@ discard block |
||
60 | 60 | * @author Dmitry (dio) Levashov |
61 | 61 | **/ |
62 | 62 | public function __construct() { |
63 | - $this->options['alias'] = ''; // alias to replace root dir name |
|
64 | - $this->options['dirMode'] = 0755; // new dirs mode |
|
65 | - $this->options['fileMode'] = 0644; // new files mode |
|
66 | - $this->options['quarantine'] = '.quarantine'; // quarantine folder name - required to check archive (must be hidden) |
|
67 | - $this->options['maxArcFilesSize'] = 0; // max allowed archive files size (0 - no limit) |
|
63 | + $this->options['alias'] = ''; // alias to replace root dir name |
|
64 | + $this->options['dirMode'] = 0755; // new dirs mode |
|
65 | + $this->options['fileMode'] = 0644; // new files mode |
|
66 | + $this->options['quarantine'] = '.quarantine'; // quarantine folder name - required to check archive (must be hidden) |
|
67 | + $this->options['maxArcFilesSize'] = 0; // max allowed archive files size (0 - no limit) |
|
68 | 68 | $this->options['rootCssClass'] = 'elfinder-navbar-root-local'; |
69 | 69 | } |
70 | 70 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | protected function init() { |
82 | 82 | // Normalize directory separator for windows |
83 | 83 | if (DIRECTORY_SEPARATOR !== '/') { |
84 | - foreach(array('path', 'tmbPath', 'tmpPath', 'quarantine') as $key) { |
|
84 | + foreach (array('path', 'tmbPath', 'tmpPath', 'quarantine') as $key) { |
|
85 | 85 | if (!empty($this->options[$key])) { |
86 | 86 | $this->options[$key] = str_replace('/', DIRECTORY_SEPARATOR, $this->options[$key]); |
87 | 87 | } |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | // if no thumbnails url - try detect it |
146 | 146 | if ($root['read'] && !$this->tmbURL && $this->URL) { |
147 | 147 | if (strpos($this->tmbPath, $this->root) === 0) { |
148 | - $this->tmbURL = $this->URL.str_replace(DIRECTORY_SEPARATOR, '/', substr($this->tmbPath, strlen($this->root)+1)); |
|
148 | + $this->tmbURL = $this->URL.str_replace(DIRECTORY_SEPARATOR, '/', substr($this->tmbPath, strlen($this->root) + 1)); |
|
149 | 149 | if (preg_match("|[^/?&=]$|", $this->tmbURL)) { |
150 | 150 | $this->tmbURL .= '/'; |
151 | 151 | } |
@@ -203,11 +203,11 @@ discard block |
||
203 | 203 | if ($mtime != $compare) { |
204 | 204 | return $mtime; |
205 | 205 | } |
206 | - $inotifywait = defined('ELFINER_INOTIFYWAIT_PATH')? ELFINER_INOTIFYWAIT_PATH : 'inotifywait'; |
|
206 | + $inotifywait = defined('ELFINER_INOTIFYWAIT_PATH') ? ELFINER_INOTIFYWAIT_PATH : 'inotifywait'; |
|
207 | 207 | $path = escapeshellarg($path); |
208 | 208 | $standby = max(1, intval($standby)); |
209 | 209 | $cmd = $inotifywait.' '.$path.' -t '.$standby.' -e moved_to,moved_from,move,create,delete,delete_self'; |
210 | - $this->procExec($cmd , $o, $r); |
|
210 | + $this->procExec($cmd, $o, $r); |
|
211 | 211 | if ($r === 0) { |
212 | 212 | // changed |
213 | 213 | clearstatcache(); |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | * @author Dmitry (dio) Levashov |
267 | 267 | **/ |
268 | 268 | protected function _joinPath($dir, $name) { |
269 | - return rtrim($dir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $name; |
|
269 | + return rtrim($dir, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.$name; |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | /** |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | $comps = $new_comps; |
319 | 319 | $path = implode('/', $comps); |
320 | 320 | if ($initial_slashes) { |
321 | - $path = str_repeat('/', $initial_slashes) . $path; |
|
321 | + $path = str_repeat('/', $initial_slashes).$path; |
|
322 | 322 | } |
323 | 323 | |
324 | 324 | if ($changeSep) { |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | **/ |
390 | 390 | protected function _inpath($path, $parent) { |
391 | 391 | $cwd = getcwd(); |
392 | - $real_path = $this->getFullPath($path, $cwd); |
|
392 | + $real_path = $this->getFullPath($path, $cwd); |
|
393 | 393 | $real_parent = $this->getFullPath($parent, $cwd); |
394 | 394 | if ($real_path && $real_parent) { |
395 | 395 | return $real_path === $real_parent || strpos($real_path, rtrim($real_parent, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR) === 0; |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | $stat = array(); |
449 | 449 | return $stat; |
450 | 450 | } else { |
451 | - $stat['mime'] = 'symlink-broken'; |
|
451 | + $stat['mime'] = 'symlink-broken'; |
|
452 | 452 | $target = readlink($path); |
453 | 453 | $lstat = lstat($path); |
454 | 454 | $ostat = $this->getOwnerStat($lstat['uid'], $lstat['gid']); |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | $fstat = stat($path); |
465 | 465 | $uid = $fstat['uid']; |
466 | 466 | $gid = $fstat['gid']; |
467 | - $stat['perm'] = substr((string)decoct($fstat['mode']), -4); |
|
467 | + $stat['perm'] = substr((string) decoct($fstat['mode']), -4); |
|
468 | 468 | $stat = array_merge($stat, $this->getOwnerStat($uid, $gid)); |
469 | 469 | } |
470 | 470 | |
@@ -474,8 +474,8 @@ discard block |
||
474 | 474 | $stat['mime'] = $dir ? 'directory' : $this->mimetype($path); |
475 | 475 | } |
476 | 476 | //logical rights first |
477 | - $stat['read'] = ($linkreadable || is_readable($path))? null : false; |
|
478 | - $stat['write'] = is_writable($path)? null : false; |
|
477 | + $stat['read'] = ($linkreadable || is_readable($path)) ? null : false; |
|
478 | + $stat['write'] = is_writable($path) ? null : false; |
|
479 | 479 | |
480 | 480 | if (is_null($stat['read'])) { |
481 | 481 | $stat['size'] = $dir ? 0 : $size; |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | $dirItr = new ParentIterator( |
548 | 548 | new RecursiveDirectoryIterator($path, |
549 | 549 | FilesystemIterator::SKIP_DOTS | |
550 | - (defined('RecursiveDirectoryIterator::FOLLOW_SYMLINKS')? |
|
550 | + (defined('RecursiveDirectoryIterator::FOLLOW_SYMLINKS') ? |
|
551 | 551 | RecursiveDirectoryIterator::FOLLOW_SYMLINKS : 0) |
552 | 552 | ) |
553 | 553 | ); |
@@ -633,7 +633,7 @@ discard block |
||
633 | 633 | $br = true; |
634 | 634 | } else { |
635 | 635 | $_path = $fpath; |
636 | - $stat['mime'] = 'symlink-broken'; |
|
636 | + $stat['mime'] = 'symlink-broken'; |
|
637 | 637 | $target = readlink($_path); |
638 | 638 | $lstat = lstat($_path); |
639 | 639 | $ostat = $this->getOwnerStat($lstat['uid'], $lstat['gid']); |
@@ -658,13 +658,13 @@ discard block |
||
658 | 658 | if ($statOwner && !$linkreadable) { |
659 | 659 | $uid = $file->getOwner(); |
660 | 660 | $gid = $file->getGroup(); |
661 | - $stat['perm'] = substr((string)decoct($file->getPerms()), -4); |
|
661 | + $stat['perm'] = substr((string) decoct($file->getPerms()), -4); |
|
662 | 662 | $stat = array_merge($stat, $this->getOwnerStat($uid, $gid)); |
663 | 663 | } |
664 | 664 | |
665 | 665 | //logical rights first |
666 | - $stat['read'] = ($linkreadable || $file->isReadable())? null : false; |
|
667 | - $stat['write'] = $file->isWritable()? null : false; |
|
666 | + $stat['read'] = ($linkreadable || $file->isReadable()) ? null : false; |
|
667 | + $stat['write'] = $file->isWritable() ? null : false; |
|
668 | 668 | |
669 | 669 | if (is_null($stat['read'])) { |
670 | 670 | $stat['size'] = $dir ? 0 : $size; |
@@ -680,7 +680,7 @@ discard block |
||
680 | 680 | |
681 | 681 | if ($cache) { |
682 | 682 | $cache = $this->convEncOut($cache, false); |
683 | - foreach($cache as $d) { |
|
683 | + foreach ($cache as $d) { |
|
684 | 684 | $this->updateCache($d[0], $d[1]); |
685 | 685 | } |
686 | 686 | } |
@@ -696,7 +696,7 @@ discard block |
||
696 | 696 | * @return resource|false |
697 | 697 | * @author Dmitry (dio) Levashov |
698 | 698 | **/ |
699 | - protected function _fopen($path, $mode='rb') { |
|
699 | + protected function _fopen($path, $mode = 'rb') { |
|
700 | 700 | return @fopen($path, $mode); |
701 | 701 | } |
702 | 702 | |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | * @return bool |
708 | 708 | * @author Dmitry (dio) Levashov |
709 | 709 | **/ |
710 | - protected function _fclose($fp, $path='') { |
|
710 | + protected function _fclose($fp, $path = '') { |
|
711 | 711 | return @fclose($fp); |
712 | 712 | } |
713 | 713 | |
@@ -839,7 +839,7 @@ discard block |
||
839 | 839 | $path = $this->_joinPath($dir, $name); |
840 | 840 | |
841 | 841 | $meta = stream_get_meta_data($fp); |
842 | - $uri = isset($meta['uri'])? $meta['uri'] : ''; |
|
842 | + $uri = isset($meta['uri']) ? $meta['uri'] : ''; |
|
843 | 843 | if ($uri && @is_file($uri)) { |
844 | 844 | fclose($fp); |
845 | 845 | $isCmdPaste = ($this->ARGS['cmd'] === 'paste'); |
@@ -903,7 +903,7 @@ discard block |
||
903 | 903 | * @return bool |
904 | 904 | **/ |
905 | 905 | protected function _chmod($path, $mode) { |
906 | - $modeOct = is_string($mode) ? octdec($mode) : octdec(sprintf("%04o",$mode)); |
|
906 | + $modeOct = is_string($mode) ? octdec($mode) : octdec(sprintf("%04o", $mode)); |
|
907 | 907 | $ret = @chmod($path, $modeOct); |
908 | 908 | $ret && clearstatcache(); |
909 | 909 | return $ret; |
@@ -1021,7 +1021,7 @@ discard block |
||
1021 | 1021 | $src = $dir; |
1022 | 1022 | $name = basename($path); |
1023 | 1023 | if (preg_match('/\.((tar\.(gz|bz|bz2|z|lzo))|cpio\.gz|ps\.gz|xcf\.(gz|bz2)|[a-z0-9]{1,4})$/i', $name, $m)) { |
1024 | - $name = substr($name, 0, strlen($name)-strlen($m[0])); |
|
1024 | + $name = substr($name, 0, strlen($name) - strlen($m[0])); |
|
1025 | 1025 | } |
1026 | 1026 | $test = dirname($path).DIRECTORY_SEPARATOR.$name; |
1027 | 1027 | if (file_exists($test) || is_link($test)) { |
@@ -1030,9 +1030,9 @@ discard block |
||
1030 | 1030 | } |
1031 | 1031 | |
1032 | 1032 | if ($name !== '') { |
1033 | - $result = dirname($path).DIRECTORY_SEPARATOR.$name; |
|
1033 | + $result = dirname($path).DIRECTORY_SEPARATOR.$name; |
|
1034 | 1034 | |
1035 | - if (! @rename($src, $result)) { |
|
1035 | + if (!@rename($src, $result)) { |
|
1036 | 1036 | $this->delTree($dir); |
1037 | 1037 | return false; |
1038 | 1038 | } |
@@ -1040,7 +1040,7 @@ discard block |
||
1040 | 1040 | $dstDir = dirname($path); |
1041 | 1041 | $res = false; |
1042 | 1042 | $result = array(); |
1043 | - foreach($ls as $name) { |
|
1043 | + foreach ($ls as $name) { |
|
1044 | 1044 | $target = $dstDir.DIRECTORY_SEPARATOR.$name; |
1045 | 1045 | if (is_dir($target)) { |
1046 | 1046 | $this->delTree($target); |
@@ -1126,7 +1126,7 @@ discard block |
||
1126 | 1126 | new RecursiveDirectoryIterator($path, |
1127 | 1127 | FilesystemIterator::KEY_AS_PATHNAME | |
1128 | 1128 | FilesystemIterator::SKIP_DOTS | |
1129 | - (defined('RecursiveDirectoryIterator::FOLLOW_SYMLINKS')? |
|
1129 | + (defined('RecursiveDirectoryIterator::FOLLOW_SYMLINKS') ? |
|
1130 | 1130 | RecursiveDirectoryIterator::FOLLOW_SYMLINKS : 0) |
1131 | 1131 | ), |
1132 | 1132 | array($this, 'localFileSystemSearchIteratorFilter') |
@@ -1148,7 +1148,7 @@ discard block |
||
1148 | 1148 | $result = array(); |
1149 | 1149 | |
1150 | 1150 | if ($match) { |
1151 | - foreach($match as $p) { |
|
1151 | + foreach ($match as $p) { |
|
1152 | 1152 | $stat = $this->stat($p); |
1153 | 1153 | |
1154 | 1154 | if (!$stat) { // invalid links |
@@ -1165,7 +1165,7 @@ discard block |
||
1165 | 1165 | $stat['path'] = $this->path($stat['hash']); |
1166 | 1166 | if ($this->URL && !isset($stat['url'])) { |
1167 | 1167 | $path = str_replace(DIRECTORY_SEPARATOR, '/', substr($p, strlen($this->root) + 1)); |
1168 | - $stat['url'] = $this->URL . $path; |
|
1168 | + $stat['url'] = $this->URL.$path; |
|
1169 | 1169 | } |
1170 | 1170 | |
1171 | 1171 | $result[] = $stat; |
@@ -1180,9 +1180,9 @@ discard block |
||
1180 | 1180 | |
1181 | 1181 | public function localFileSystemSearchIteratorFilter($file, $key, $iterator) { |
1182 | 1182 | if ($iterator->hasChildren()) { |
1183 | - return (bool)$this->attr($key, 'read', null, true); |
|
1183 | + return (bool) $this->attr($key, 'read', null, true); |
|
1184 | 1184 | } |
1185 | - return ($this->stripos($file->getFilename(), $this->doSearchCurrentQuery) === false)? false : true; |
|
1185 | + return ($this->stripos($file->getFilename(), $this->doSearchCurrentQuery) === false) ? false : true; |
|
1186 | 1186 | } |
1187 | 1187 | |
1188 | 1188 | } // END class |