@@ -666,6 +666,9 @@ discard block |
||
666 | 666 | return json_encode(array('version' => false)); |
667 | 667 | } |
668 | 668 | |
669 | + /** |
|
670 | + * @param string $dir |
|
671 | + */ |
|
669 | 672 | protected function moveUploadFile($file, $dir) { |
670 | 673 | $message = $this->checkUploadedFile($file); |
671 | 674 | |
@@ -697,6 +700,9 @@ discard block |
||
697 | 700 | return "/" . basename($target); |
698 | 701 | } |
699 | 702 | |
703 | + /** |
|
704 | + * @param string $file |
|
705 | + */ |
|
700 | 706 | protected function sendDefaultThumb($file=null) { |
701 | 707 | if ($file !== null) { |
702 | 708 | $ext = file::getExtension($file); |
@@ -873,6 +879,9 @@ discard block |
||
873 | 879 | return ""; |
874 | 880 | } |
875 | 881 | |
882 | + /** |
|
883 | + * @param string $message |
|
884 | + */ |
|
876 | 885 | protected function errorMsg($message, array $data=null) { |
877 | 886 | if (in_array($this->action, array("thumb", "upload", "download", "downloadDir"))) |
878 | 887 | die($this->label($message, $data)); |
@@ -12,12 +12,12 @@ discard block |
||
12 | 12 | * @link http://kcfinder.sunhater.com |
13 | 13 | */ |
14 | 14 | |
15 | -class browser extends uploader { |
|
15 | +class browser extends uploader{ |
|
16 | 16 | protected $action; |
17 | 17 | protected $thumbsDir; |
18 | 18 | protected $thumbsTypeDir; |
19 | 19 | |
20 | - public function __construct($modx) { |
|
20 | + public function __construct($modx){ |
|
21 | 21 | parent::__construct($modx); |
22 | 22 | |
23 | 23 | if (isset($this->post['dir'])) { |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | $this->get['dir'] = $dir; |
33 | 33 | } |
34 | 34 | |
35 | - $thumbsDir = $this->config['uploadDir'] . "/" . $this->config['thumbsDir']; |
|
35 | + $thumbsDir = $this->config['uploadDir']."/".$this->config['thumbsDir']; |
|
36 | 36 | if (( |
37 | 37 | !is_dir($thumbsDir) && |
38 | 38 | !@mkdir($thumbsDir, $this->config['dirPerms']) |
@@ -70,9 +70,9 @@ discard block |
||
70 | 70 | $this->config['theme'] = $this->get['theme']; |
71 | 71 | } |
72 | 72 | |
73 | - public function action() { |
|
73 | + public function action(){ |
|
74 | 74 | $act = isset($this->get['act']) ? $this->get['act'] : "browser"; |
75 | - if(!preg_match('@^[0-9a-zA-Z_]+$@', $act)) $this->errorMsg("Unknown error."); |
|
75 | + if (!preg_match('@^[0-9a-zA-Z_]+$@', $act)) $this->errorMsg("Unknown error."); |
|
76 | 76 | if (!method_exists($this, "act_$act")) |
77 | 77 | $act = "browser"; |
78 | 78 | $this->action = $act; |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | $this->session['dir'] = $this->type; |
95 | 95 | else { |
96 | 96 | $type = $this->getTypeFromPath($this->session['dir']); |
97 | - $dir = $this->config['uploadDir'] . "/" . $this->session['dir']; |
|
97 | + $dir = $this->config['uploadDir']."/".$this->session['dir']; |
|
98 | 98 | if (($type != $this->type) || !is_dir($dir) || !is_readable($dir)) |
99 | 99 | $this->session['dir'] = $this->type; |
100 | 100 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | : $return; |
116 | 116 | } |
117 | 117 | |
118 | - protected function act_browser() { |
|
118 | + protected function act_browser(){ |
|
119 | 119 | if (isset($this->get['dir']) && |
120 | 120 | is_dir("{$this->typeDir}/{$this->get['dir']}") && |
121 | 121 | is_readable("{$this->typeDir}/{$this->get['dir']}") |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | return $this->output(); |
126 | 126 | } |
127 | 127 | |
128 | - protected function act_init() { |
|
128 | + protected function act_init(){ |
|
129 | 129 | $tree = $this->getDirInfo($this->typeDir); |
130 | 130 | $tree['dirs'] = $this->getTree($this->session['dir']); |
131 | 131 | if (!is_array($tree['dirs']) || !count($tree['dirs'])) |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | return json_encode($data); |
141 | 141 | } |
142 | 142 | |
143 | - protected function act_thumb() { |
|
143 | + protected function act_thumb(){ |
|
144 | 144 | $this->getDir($this->get['dir'], true); |
145 | 145 | if (!isset($this->get['file']) || !isset($this->get['dir'])) |
146 | 146 | $this->sendDefaultThumb(); |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | $this->sendDefaultThumb(); |
150 | 150 | $file = "{$this->thumbsDir}/{$this->type}/{$this->get['dir']}/$file"; |
151 | 151 | if (!is_file($file) || !is_readable($file)) { |
152 | - $file = "{$this->config['uploadDir']}/{$this->type}/{$this->get['dir']}/" . basename($file); |
|
152 | + $file = "{$this->config['uploadDir']}/{$this->type}/{$this->get['dir']}/".basename($file); |
|
153 | 153 | if (!is_file($file) || !is_readable($file)) |
154 | 154 | $this->sendDefaultThumb($file); |
155 | 155 | $image = image::factory($this->imageDriver, $file); |
@@ -171,13 +171,13 @@ discard block |
||
171 | 171 | httpCache::file($file, "image/jpeg"); |
172 | 172 | } |
173 | 173 | |
174 | - protected function act_expand() { |
|
174 | + protected function act_expand(){ |
|
175 | 175 | return json_encode(array('dirs' => $this->getDirs($this->postDir()))); |
176 | 176 | } |
177 | 177 | |
178 | - protected function act_chDir() { |
|
178 | + protected function act_chDir(){ |
|
179 | 179 | $this->postDir(); // Just for existing check |
180 | - $this->session['dir'] = $this->type . "/" . $this->post['dir']; |
|
180 | + $this->session['dir'] = $this->type."/".$this->post['dir']; |
|
181 | 181 | $dirWritable = dir::isWritable("{$this->config['uploadDir']}/{$this->session['dir']}"); |
182 | 182 | return json_encode(array( |
183 | 183 | 'files' => $this->getFiles($this->session['dir']), |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | )); |
186 | 186 | } |
187 | 187 | |
188 | - protected function act_newDir() { |
|
188 | + protected function act_newDir(){ |
|
189 | 189 | if (!$this->config['access']['dirs']['create'] || |
190 | 190 | !isset($this->post['dir']) || |
191 | 191 | !isset($this->post['newDir']) |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | return true; |
208 | 208 | } |
209 | 209 | |
210 | - protected function act_renameDir() { |
|
210 | + protected function act_renameDir(){ |
|
211 | 211 | if (!$this->config['access']['dirs']['rename'] || |
212 | 212 | !isset($this->post['dir']) || |
213 | 213 | !isset($this->post['newName']) |
@@ -222,15 +222,15 @@ discard block |
||
222 | 222 | $this->errorMsg("Unallowable characters in folder name."); |
223 | 223 | if (substr($newName, 0, 1) == ".") |
224 | 224 | $this->errorMsg("Folder name shouldn't begins with '.'"); |
225 | - if (!@rename($dir, dirname($dir) . "/$newName")) |
|
225 | + if (!@rename($dir, dirname($dir)."/$newName")) |
|
226 | 226 | $this->errorMsg("Cannot rename the folder."); |
227 | 227 | $thumbDir = "$this->thumbsTypeDir/{$this->post['dir']}"; |
228 | 228 | if (is_dir($thumbDir)) |
229 | - @rename($thumbDir, dirname($thumbDir) . "/$newName"); |
|
229 | + @rename($thumbDir, dirname($thumbDir)."/$newName"); |
|
230 | 230 | return json_encode(array('name' => $newName)); |
231 | 231 | } |
232 | 232 | |
233 | - protected function act_deleteDir() { |
|
233 | + protected function act_deleteDir(){ |
|
234 | 234 | if (!$this->config['access']['dirs']['delete'] || |
235 | 235 | !isset($this->post['dir']) || |
236 | 236 | !strlen(trim($this->post['dir'])) |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | return true; |
251 | 251 | } |
252 | 252 | |
253 | - protected function act_upload() { |
|
253 | + protected function act_upload(){ |
|
254 | 254 | if (!$this->config['access']['files']['upload'] || |
255 | 255 | !isset($this->post['dir']) |
256 | 256 | ) |
@@ -275,11 +275,11 @@ discard block |
||
275 | 275 | return $this->moveUploadFile($this->file, $dir); |
276 | 276 | } |
277 | 277 | |
278 | - protected function act_download() { |
|
278 | + protected function act_download(){ |
|
279 | 279 | $dir = $this->postDir(); |
280 | 280 | if (!isset($this->post['dir']) || |
281 | 281 | !isset($this->post['file']) || |
282 | - strpos($this->post['file'],'../')!==false || |
|
282 | + strpos($this->post['file'], '../') !== false || |
|
283 | 283 | (false === ($file = "$dir/{$this->post['file']}")) || |
284 | 284 | !file_exists($file) || !is_readable($file) |
285 | 285 | ) |
@@ -290,19 +290,19 @@ discard block |
||
290 | 290 | header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); |
291 | 291 | header("Cache-Control: private", false); |
292 | 292 | header("Content-Type: application/octet-stream"); |
293 | - header('Content-Disposition: attachment; filename="' . str_replace('"', "_", $this->post['file']) . '"'); |
|
293 | + header('Content-Disposition: attachment; filename="'.str_replace('"', "_", $this->post['file']).'"'); |
|
294 | 294 | header("Content-Transfer-Encoding: binary"); |
295 | - header("Content-Length: " . filesize($file)); |
|
295 | + header("Content-Length: ".filesize($file)); |
|
296 | 296 | readfile($file); |
297 | 297 | die; |
298 | 298 | } |
299 | 299 | |
300 | - protected function act_rename() { |
|
300 | + protected function act_rename(){ |
|
301 | 301 | $dir = $this->postDir(); |
302 | 302 | if (!$this->config['access']['files']['rename'] || |
303 | 303 | !isset($this->post['dir']) || |
304 | 304 | !isset($this->post['file']) || |
305 | - strpos($this->post['file'],'../')!==false || |
|
305 | + strpos($this->post['file'], '../') !== false || |
|
306 | 306 | !isset($this->post['newName']) || |
307 | 307 | (false === ($file = "$dir/{$this->post['file']}")) || |
308 | 308 | !file_exists($file) || !is_readable($file) || !file::isWritable($file) |
@@ -337,16 +337,16 @@ discard block |
||
337 | 337 | $thumbFile = "$thumbDir/{$this->post['file']}"; |
338 | 338 | |
339 | 339 | if (file_exists($thumbFile)) |
340 | - @rename($thumbFile, "$thumbDir/" . basename($newName)); |
|
340 | + @rename($thumbFile, "$thumbDir/".basename($newName)); |
|
341 | 341 | return true; |
342 | 342 | } |
343 | 343 | |
344 | - protected function act_delete() { |
|
344 | + protected function act_delete(){ |
|
345 | 345 | $dir = $this->postDir(); |
346 | 346 | if (!$this->config['access']['files']['delete'] || |
347 | 347 | !isset($this->post['dir']) || |
348 | 348 | !isset($this->post['file']) || |
349 | - strpos($this->post['file'],'../')!==false || |
|
349 | + strpos($this->post['file'], '../') !== false || |
|
350 | 350 | (false === ($file = "$dir/{$this->post['file']}")) || |
351 | 351 | !file_exists($file) || !is_readable($file) || !file::isWritable($file) || |
352 | 352 | !@unlink($file) |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | return true; |
359 | 359 | } |
360 | 360 | |
361 | - protected function act_cp_cbd() { |
|
361 | + protected function act_cp_cbd(){ |
|
362 | 362 | $dir = $this->postDir(); |
363 | 363 | if (!$this->config['access']['files']['copy'] || |
364 | 364 | !isset($this->post['dir']) || |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | $this->errorMsg("Unknown error."); |
370 | 370 | |
371 | 371 | $error = array(); |
372 | - foreach($this->post['files'] as $file) { |
|
372 | + foreach ($this->post['files'] as $file) { |
|
373 | 373 | $file = path::normalize($file); |
374 | 374 | if (substr($file, 0, 1) == ".") continue; |
375 | 375 | $type = explode("/", $file); |
@@ -382,11 +382,11 @@ discard block |
||
382 | 382 | if (!file_exists($path)) |
383 | 383 | $error[] = $this->label("The file '{file}' does not exist.", $replace); |
384 | 384 | elseif (substr($base, 0, 1) == ".") |
385 | - $error[] = "$base: " . $this->label("File name shouldn't begins with '.'"); |
|
385 | + $error[] = "$base: ".$this->label("File name shouldn't begins with '.'"); |
|
386 | 386 | elseif (!$this->validateExtension($ext, $type)) |
387 | - $error[] = "$base: " . $this->label("Denied file extension."); |
|
387 | + $error[] = "$base: ".$this->label("Denied file extension."); |
|
388 | 388 | elseif (file_exists("$dir/$base")) |
389 | - $error[] = "$base: " . $this->label("A file or folder with that name already exists."); |
|
389 | + $error[] = "$base: ".$this->label("A file or folder with that name already exists."); |
|
390 | 390 | elseif (!is_readable($path) || !is_file($path)) |
391 | 391 | $error[] = $this->label("Cannot read '{file}'.", $replace); |
392 | 392 | elseif (!@copy($path, "$dir/$base")) |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | return true; |
410 | 410 | } |
411 | 411 | |
412 | - protected function act_mv_cbd() { |
|
412 | + protected function act_mv_cbd(){ |
|
413 | 413 | $dir = $this->postDir(); |
414 | 414 | if (!$this->config['access']['files']['move'] || |
415 | 415 | !isset($this->post['dir']) || |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | $this->errorMsg("Unknown error."); |
421 | 421 | |
422 | 422 | $error = array(); |
423 | - foreach($this->post['files'] as $file) { |
|
423 | + foreach ($this->post['files'] as $file) { |
|
424 | 424 | $file = path::normalize($file); |
425 | 425 | if (substr($file, 0, 1) == ".") continue; |
426 | 426 | $type = explode("/", $file); |
@@ -433,11 +433,11 @@ discard block |
||
433 | 433 | if (!file_exists($path)) |
434 | 434 | $error[] = $this->label("The file '{file}' does not exist.", $replace); |
435 | 435 | elseif (substr($base, 0, 1) == ".") |
436 | - $error[] = "$base: " . $this->label("File name shouldn't begins with '.'"); |
|
436 | + $error[] = "$base: ".$this->label("File name shouldn't begins with '.'"); |
|
437 | 437 | elseif (!$this->validateExtension($ext, $type)) |
438 | - $error[] = "$base: " . $this->label("Denied file extension."); |
|
438 | + $error[] = "$base: ".$this->label("Denied file extension."); |
|
439 | 439 | elseif (file_exists("$dir/$base")) |
440 | - $error[] = "$base: " . $this->label("A file or folder with that name already exists."); |
|
440 | + $error[] = "$base: ".$this->label("A file or folder with that name already exists."); |
|
441 | 441 | elseif (!is_readable($path) || !is_file($path)) |
442 | 442 | $error[] = $this->label("Cannot read '{file}'.", $replace); |
443 | 443 | elseif (!file::isWritable($path) || !@rename($path, "$dir/$base")) |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | return true; |
461 | 461 | } |
462 | 462 | |
463 | - protected function act_rm_cbd() { |
|
463 | + protected function act_rm_cbd(){ |
|
464 | 464 | if (!$this->config['access']['files']['delete'] || |
465 | 465 | !isset($this->post['files']) || |
466 | 466 | !is_array($this->post['files']) || |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | $this->errorMsg("Unknown error."); |
470 | 470 | |
471 | 471 | $error = array(); |
472 | - foreach($this->post['files'] as $file) { |
|
472 | + foreach ($this->post['files'] as $file) { |
|
473 | 473 | $file = path::normalize($file); |
474 | 474 | if (substr($file, 0, 1) == ".") continue; |
475 | 475 | $type = explode("/", $file); |
@@ -492,25 +492,25 @@ discard block |
||
492 | 492 | return true; |
493 | 493 | } |
494 | 494 | |
495 | - protected function act_downloadDir() { |
|
495 | + protected function act_downloadDir(){ |
|
496 | 496 | $dir = $this->postDir(); |
497 | 497 | if (!isset($this->post['dir']) || $this->config['denyZipDownload']) |
498 | 498 | $this->errorMsg("Unknown error."); |
499 | - $filename = basename($dir) . ".zip"; |
|
499 | + $filename = basename($dir).".zip"; |
|
500 | 500 | do { |
501 | - $file = md5(time() . session_id()); |
|
501 | + $file = md5(time().session_id()); |
|
502 | 502 | $file = "{$this->config['uploadDir']}/$file.zip"; |
503 | 503 | } while (file_exists($file)); |
504 | 504 | new zipFolder($file, $dir); |
505 | 505 | header("Content-Type: application/x-zip"); |
506 | - header('Content-Disposition: attachment; filename="' . str_replace('"', "_", $filename) . '"'); |
|
507 | - header("Content-Length: " . filesize($file)); |
|
506 | + header('Content-Disposition: attachment; filename="'.str_replace('"', "_", $filename).'"'); |
|
507 | + header("Content-Length: ".filesize($file)); |
|
508 | 508 | readfile($file); |
509 | 509 | unlink($file); |
510 | 510 | die; |
511 | 511 | } |
512 | 512 | |
513 | - protected function act_downloadSelected() { |
|
513 | + protected function act_downloadSelected(){ |
|
514 | 514 | $dir = $this->postDir(); |
515 | 515 | if (!isset($this->post['dir']) || |
516 | 516 | !isset($this->post['files']) || |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | } |
532 | 532 | |
533 | 533 | do { |
534 | - $file = md5(time() . session_id()); |
|
534 | + $file = md5(time().session_id()); |
|
535 | 535 | $file = "{$this->config['uploadDir']}/$file.zip"; |
536 | 536 | } while (file_exists($file)); |
537 | 537 | |
@@ -543,14 +543,14 @@ discard block |
||
543 | 543 | $zip->close(); |
544 | 544 | } |
545 | 545 | header("Content-Type: application/x-zip"); |
546 | - header('Content-Disposition: attachment; filename="selected_files_' . basename($file) . '"'); |
|
547 | - header("Content-Length: " . filesize($file)); |
|
546 | + header('Content-Disposition: attachment; filename="selected_files_'.basename($file).'"'); |
|
547 | + header("Content-Length: ".filesize($file)); |
|
548 | 548 | readfile($file); |
549 | 549 | unlink($file); |
550 | 550 | die; |
551 | 551 | } |
552 | 552 | |
553 | - protected function act_downloadClipboard() { |
|
553 | + protected function act_downloadClipboard(){ |
|
554 | 554 | if (!isset($this->post['files']) || |
555 | 555 | !is_array($this->post['files']) || |
556 | 556 | $this->config['denyZipDownload'] |
@@ -566,14 +566,14 @@ discard block |
||
566 | 566 | $type = $type[0]; |
567 | 567 | if ($type != $this->type) |
568 | 568 | continue; |
569 | - $file = $this->config['uploadDir'] . "/$file"; |
|
569 | + $file = $this->config['uploadDir']."/$file"; |
|
570 | 570 | if (!is_file($file) || !is_readable($file)) |
571 | 571 | continue; |
572 | 572 | $zipFiles[] = $file; |
573 | 573 | } |
574 | 574 | |
575 | 575 | do { |
576 | - $file = md5(time() . session_id()); |
|
576 | + $file = md5(time().session_id()); |
|
577 | 577 | $file = "{$this->config['uploadDir']}/$file.zip"; |
578 | 578 | } while (file_exists($file)); |
579 | 579 | |
@@ -585,14 +585,14 @@ discard block |
||
585 | 585 | $zip->close(); |
586 | 586 | } |
587 | 587 | header("Content-Type: application/x-zip"); |
588 | - header('Content-Disposition: attachment; filename="clipboard_' . basename($file) . '"'); |
|
589 | - header("Content-Length: " . filesize($file)); |
|
588 | + header('Content-Disposition: attachment; filename="clipboard_'.basename($file).'"'); |
|
589 | + header("Content-Length: ".filesize($file)); |
|
590 | 590 | readfile($file); |
591 | 591 | unlink($file); |
592 | 592 | die; |
593 | 593 | } |
594 | 594 | |
595 | - protected function act_check4Update() { |
|
595 | + protected function act_check4Update(){ |
|
596 | 596 | if ($this->config['denyUpdateCheck']) |
597 | 597 | return json_encode(array('version' => false)); |
598 | 598 | |
@@ -632,24 +632,24 @@ discard block |
||
632 | 632 | // Curl extension |
633 | 633 | ) {} elseif ( |
634 | 634 | function_exists("curl_init") && |
635 | - (false !== ( $curl = @curl_init($url) )) && |
|
636 | - ( @ob_start() || (@curl_close($curl) && false)) && |
|
637 | - ( @curl_exec($curl) || (@curl_close($curl) && false)) && |
|
638 | - ((false !== ( $ver = @ob_get_clean() )) || (@curl_close($curl) && false)) && |
|
639 | - ( @curl_close($curl) || true ) && |
|
635 | + (false !== ($curl = @curl_init($url))) && |
|
636 | + (@ob_start() || (@curl_close($curl) && false)) && |
|
637 | + (@curl_exec($curl) || (@curl_close($curl) && false)) && |
|
638 | + ((false !== ($ver = @ob_get_clean())) || (@curl_close($curl) && false)) && |
|
639 | + (@curl_close($curl) || true) && |
|
640 | 640 | preg_match($pattern, $ver) |
641 | 641 | |
642 | 642 | // Socket extension |
643 | 643 | ) {} elseif (function_exists('socket_create')) { |
644 | 644 | $cmd = |
645 | - "GET $path " . strtoupper($protocol) . "/1.1\r\n" . |
|
646 | - "Host: $host\r\n" . |
|
645 | + "GET $path ".strtoupper($protocol)."/1.1\r\n". |
|
646 | + "Host: $host\r\n". |
|
647 | 647 | "Connection: Close\r\n\r\n"; |
648 | 648 | |
649 | - if ((false !== ( $socket = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP) )) && |
|
650 | - (false !== @socket_connect($socket, $host, $port) ) && |
|
651 | - (false !== @socket_write($socket, $cmd, strlen($cmd)) ) && |
|
652 | - (false !== ( $ver = @socket_read($socket, 2048) )) && |
|
649 | + if ((false !== ($socket = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP))) && |
|
650 | + (false !== @socket_connect($socket, $host, $port)) && |
|
651 | + (false !== @socket_write($socket, $cmd, strlen($cmd))) && |
|
652 | + (false !== ($ver = @socket_read($socket, 2048))) && |
|
653 | 653 | preg_match($responsePattern, $ver, $match) |
654 | 654 | ) |
655 | 655 | $ver = $match[2]; |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | return json_encode(array('version' => false)); |
667 | 667 | } |
668 | 668 | |
669 | - protected function moveUploadFile($file, $dir) { |
|
669 | + protected function moveUploadFile($file, $dir){ |
|
670 | 670 | $message = $this->checkUploadedFile($file); |
671 | 671 | |
672 | 672 | if ($message !== true) { |
@@ -676,28 +676,28 @@ discard block |
||
676 | 676 | } |
677 | 677 | |
678 | 678 | $filename = $this->normalizeFilename($file['name']); |
679 | - $target = "$dir/" . file::getInexistantFilename($filename, $dir); |
|
679 | + $target = "$dir/".file::getInexistantFilename($filename, $dir); |
|
680 | 680 | |
681 | 681 | if (!@move_uploaded_file($file['tmp_name'], $target) && |
682 | 682 | !@rename($file['tmp_name'], $target) && |
683 | 683 | !@copy($file['tmp_name'], $target) |
684 | 684 | ) { |
685 | 685 | @unlink($file['tmp_name']); |
686 | - return "{$file['name']}: " . $this->label("Cannot move uploaded file to target folder."); |
|
686 | + return "{$file['name']}: ".$this->label("Cannot move uploaded file to target folder."); |
|
687 | 687 | } elseif (function_exists('chmod')) |
688 | 688 | chmod($target, $this->config['filePerms']); |
689 | 689 | |
690 | - $this->modx->invokeEvent('OnFileBrowserUpload',array( |
|
690 | + $this->modx->invokeEvent('OnFileBrowserUpload', array( |
|
691 | 691 | 'filepath'=>realpath($dir), |
692 | - 'filename'=>str_replace("/","",str_replace($dir,"",realpath($target))) |
|
692 | + 'filename'=>str_replace("/", "", str_replace($dir, "", realpath($target))) |
|
693 | 693 | )); |
694 | 694 | |
695 | 695 | $this->makeThumb($target); |
696 | 696 | |
697 | - return "/" . basename($target); |
|
697 | + return "/".basename($target); |
|
698 | 698 | } |
699 | 699 | |
700 | - protected function sendDefaultThumb($file=null) { |
|
700 | + protected function sendDefaultThumb($file = null){ |
|
701 | 701 | if ($file !== null) { |
702 | 702 | $ext = file::getExtension($file); |
703 | 703 | $thumb = "themes/{$this->config['theme']}/img/files/big/$ext.png"; |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | die; |
710 | 710 | } |
711 | 711 | |
712 | - protected function getFiles($dir) { |
|
712 | + protected function getFiles($dir){ |
|
713 | 713 | $thumbDir = "{$this->config['uploadDir']}/{$this->config['thumbsDir']}/$dir"; |
714 | 714 | $dir = "{$this->config['uploadDir']}/$dir"; |
715 | 715 | $return = array(); |
@@ -720,10 +720,10 @@ discard block |
||
720 | 720 | foreach ($files as $file) { |
721 | 721 | $ext = file::getExtension($file); |
722 | 722 | $smallThumb = false; |
723 | - if (in_array(strtolower($ext), array('png', 'jpg', 'gif', 'jpeg' )) ) { |
|
723 | + if (in_array(strtolower($ext), array('png', 'jpg', 'gif', 'jpeg'))) { |
|
724 | 724 | $size = @getimagesize($file); |
725 | 725 | if (is_array($size) && count($size)) { |
726 | - $thumb_file = "$thumbDir/" . basename($file); |
|
726 | + $thumb_file = "$thumbDir/".basename($file); |
|
727 | 727 | if (!is_file($thumb_file) || filemtime($file) > filemtime($thumb_file)) |
728 | 728 | $this->makeThumb($file); |
729 | 729 | $smallThumb = |
@@ -736,9 +736,9 @@ discard block |
||
736 | 736 | if ($stat === false) continue; |
737 | 737 | $name = basename($file); |
738 | 738 | $types = $this->config['types']; |
739 | - $types = explode(' ',$types['images'].' '.$types['image']); |
|
740 | - if (substr($name,0,1) == '.' && !$this->config['showHiddenFiles']) continue; |
|
741 | - if ($this->type == 'images' && !in_array(strtolower($ext),$types)) continue; |
|
739 | + $types = explode(' ', $types['images'].' '.$types['image']); |
|
740 | + if (substr($name, 0, 1) == '.' && !$this->config['showHiddenFiles']) continue; |
|
741 | + if ($this->type == 'images' && !in_array(strtolower($ext), $types)) continue; |
|
742 | 742 | $bigIcon = file_exists("themes/{$this->config['theme']}/img/files/big/$ext.png"); |
743 | 743 | $smallIcon = file_exists("themes/{$this->config['theme']}/img/files/small/$ext.png"); |
744 | 744 | $thumb = file_exists("$thumbDir/$name"); |
@@ -758,7 +758,7 @@ discard block |
||
758 | 758 | return $return; |
759 | 759 | } |
760 | 760 | |
761 | - protected function getTree($dir, $index=0) { |
|
761 | + protected function getTree($dir, $index = 0){ |
|
762 | 762 | $path = explode("/", $dir); |
763 | 763 | |
764 | 764 | $pdir = ""; |
@@ -793,25 +793,25 @@ discard block |
||
793 | 793 | return $dirs; |
794 | 794 | } |
795 | 795 | |
796 | - protected function postDir($existent=true) { |
|
796 | + protected function postDir($existent = true){ |
|
797 | 797 | $dir = $this->typeDir; |
798 | 798 | if (isset($this->post['dir'])) |
799 | - $dir .= "/" . $this->post['dir']; |
|
799 | + $dir .= "/".$this->post['dir']; |
|
800 | 800 | if ($existent && (!is_dir($dir) || !is_readable($dir))) |
801 | 801 | $this->errorMsg("Inexistant or inaccessible folder."); |
802 | 802 | return $dir; |
803 | 803 | } |
804 | 804 | |
805 | - protected function getDir($existent=true) { |
|
805 | + protected function getDir($existent = true){ |
|
806 | 806 | $dir = $this->typeDir; |
807 | 807 | if (isset($this->get['dir'])) |
808 | - $dir .= "/" . $this->get['dir']; |
|
808 | + $dir .= "/".$this->get['dir']; |
|
809 | 809 | if ($existent && (!is_dir($dir) || !is_readable($dir))) |
810 | 810 | $this->errorMsg("Inexistant or inaccessible folder."); |
811 | 811 | return $dir; |
812 | 812 | } |
813 | 813 | |
814 | - protected function getDirs($dir) { |
|
814 | + protected function getDirs($dir){ |
|
815 | 815 | $dirs = dir::content($dir, array('types' => "dir")); |
816 | 816 | $return = array(); |
817 | 817 | if (is_array($dirs)) { |
@@ -826,7 +826,7 @@ discard block |
||
826 | 826 | return $return; |
827 | 827 | } |
828 | 828 | |
829 | - protected function getDirInfo($dir, $removable=false) { |
|
829 | + protected function getDirInfo($dir, $removable = false){ |
|
830 | 830 | if ((substr(basename($dir), 0, 1) == ".") || !is_dir($dir) || !is_readable($dir)) |
831 | 831 | return false; |
832 | 832 | $dirs = dir::content($dir, array('types' => "dir")); |
@@ -853,7 +853,7 @@ discard block |
||
853 | 853 | return $info; |
854 | 854 | } |
855 | 855 | |
856 | - protected function output($data=null, $template=null) { |
|
856 | + protected function output($data = null, $template = null){ |
|
857 | 857 | if (!is_array($data)) $data = array(); |
858 | 858 | if ($template === null) |
859 | 859 | $template = $this->action; |
@@ -873,7 +873,7 @@ discard block |
||
873 | 873 | return ""; |
874 | 874 | } |
875 | 875 | |
876 | - protected function errorMsg($message, array $data=null) { |
|
876 | + protected function errorMsg($message, array $data = null){ |
|
877 | 877 | if (in_array($this->action, array("thumb", "upload", "download", "downloadDir"))) |
878 | 878 | die($this->label($message, $data)); |
879 | 879 | if (($this->action === null) || ($this->action == "browser")) |
@@ -385,6 +385,9 @@ discard block |
||
385 | 385 | } |
386 | 386 | |
387 | 387 | |
388 | + /** |
|
389 | + * @return string |
|
390 | + */ |
|
388 | 391 | protected function normalizeFilename($filename) { |
389 | 392 | if ($this->getTransaliasSettings()) { |
390 | 393 | $format = strrchr($filename, "."); |
@@ -394,6 +397,9 @@ discard block |
||
394 | 397 | return $filename; |
395 | 398 | } |
396 | 399 | |
400 | + /** |
|
401 | + * @param string $dirname |
|
402 | + */ |
|
397 | 403 | protected function normalizeDirname($dirname) { |
398 | 404 | return $this->modx->stripAlias($dirname); |
399 | 405 | } |
@@ -506,6 +512,9 @@ discard block |
||
506 | 512 | return (is_dir($path) && is_readable($path)) ? $return : false; |
507 | 513 | } |
508 | 514 | |
515 | + /** |
|
516 | + * @param string $ext |
|
517 | + */ |
|
509 | 518 | protected function validateExtension($ext, $type) { |
510 | 519 | $ext = trim(strtolower($ext)); |
511 | 520 | if (!isset($this->types[$type])) |
@@ -531,11 +540,17 @@ discard block |
||
531 | 540 | return in_array($ext, $exts); |
532 | 541 | } |
533 | 542 | |
543 | + /** |
|
544 | + * @return string |
|
545 | + */ |
|
534 | 546 | protected function getTypeFromPath($path) { |
535 | 547 | return preg_match('/^([^\/]*)\/.*$/', $path, $patt) |
536 | 548 | ? $patt[1] : $path; |
537 | 549 | } |
538 | 550 | |
551 | + /** |
|
552 | + * @param string $path |
|
553 | + */ |
|
539 | 554 | protected function removeTypeFromPath($path) { |
540 | 555 | return preg_match('/^[^\/]*\/(.*)$/', $path, $patt) |
541 | 556 | ? $patt[1] : ""; |
@@ -728,6 +743,9 @@ discard block |
||
728 | 743 | die; |
729 | 744 | } |
730 | 745 | |
746 | + /** |
|
747 | + * @param string $url |
|
748 | + */ |
|
731 | 749 | protected function callBack($url, $message="") { |
732 | 750 | $message = text::jsValue($message); |
733 | 751 | $CKfuncNum = isset($this->opener['CKEditor']['funcNum']) |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * @link http://kcfinder.sunhater.com |
13 | 13 | */ |
14 | 14 | |
15 | -class uploader { |
|
15 | +class uploader{ |
|
16 | 16 | |
17 | 17 | /** Release version */ |
18 | 18 | const VERSION = "2.54"; |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | |
73 | 73 | /** Next three properties are got from the current language file |
74 | 74 | * @var string */ |
75 | - protected $dateTimeFull; // Currently not used |
|
76 | - protected $dateTimeMid; // Currently not used |
|
75 | + protected $dateTimeFull; // Currently not used |
|
76 | + protected $dateTimeMid; // Currently not used |
|
77 | 77 | protected $dateTimeSmall; |
78 | 78 | |
79 | 79 | /** Contain Specified language labels |
@@ -104,11 +104,11 @@ discard block |
||
104 | 104 | /** Magic method which allows read-only access to protected or private class properties |
105 | 105 | * @param string $property |
106 | 106 | * @return mixed */ |
107 | - public function __get($property) { |
|
107 | + public function __get($property){ |
|
108 | 108 | return property_exists($this, $property) ? $this->$property : null; |
109 | 109 | } |
110 | 110 | |
111 | - public function __construct($modx) { |
|
111 | + public function __construct($modx){ |
|
112 | 112 | |
113 | 113 | //MODX |
114 | 114 | try { |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | |
207 | 207 | // COOKIES INIT |
208 | 208 | $ip = '(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)'; |
209 | - $ip = '/^' . implode('\.', array($ip, $ip, $ip, $ip)) . '$/'; |
|
209 | + $ip = '/^'.implode('\.', array($ip, $ip, $ip, $ip)).'$/'; |
|
210 | 210 | if (preg_match($ip, $_SERVER['HTTP_HOST']) || |
211 | 211 | preg_match('/^[^\.]+$/', $_SERVER['HTTP_HOST']) |
212 | 212 | ) |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | ) { |
225 | 225 | list($unused, $protocol, $domain, $unused, $port, $path) = $patt; |
226 | 226 | $path = path::normalize($path); |
227 | - $this->config['uploadURL'] = "$protocol://$domain" . (strlen($port) ? ":$port" : "") . "/$path"; |
|
227 | + $this->config['uploadURL'] = "$protocol://$domain".(strlen($port) ? ":$port" : "")."/$path"; |
|
228 | 228 | $this->config['uploadDir'] = strlen($this->config['uploadDir']) |
229 | 229 | ? path::normalize($this->config['uploadDir']) |
230 | 230 | : path::url2fullPath("/$path"); |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | foreach ($this->langInputNames as $key) |
268 | 268 | if (isset($this->get[$key]) && |
269 | 269 | preg_match('/^[a-z][a-z\._\-]*$/i', $this->get[$key]) && |
270 | - file_exists("lang/" . strtolower($this->get[$key]) . ".php") |
|
270 | + file_exists("lang/".strtolower($this->get[$key]).".php") |
|
271 | 271 | ) { |
272 | 272 | $this->lang = $this->get[$key]; |
273 | 273 | break; |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | $this->backMsg("Cannot read upload folder."); |
299 | 299 | } |
300 | 300 | |
301 | - public function upload() { |
|
301 | + public function upload(){ |
|
302 | 302 | $config = &$this->config; |
303 | 303 | $file = &$this->file; |
304 | 304 | $url = $message = ""; |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | @mkdir(path::normalize($dir), $this->config['dirPerms'], true); |
330 | 330 | |
331 | 331 | $filename = $this->normalizeFilename($file['name']); |
332 | - $target = file::getInexistantFilename($dir . $filename); |
|
332 | + $target = file::getInexistantFilename($dir.$filename); |
|
333 | 333 | |
334 | 334 | if (!@move_uploaded_file($file['tmp_name'], $target) && |
335 | 335 | !@rename($file['tmp_name'], $target) && |
@@ -342,11 +342,11 @@ discard block |
||
342 | 342 | $this->makeThumb($target); |
343 | 343 | $url = $this->typeURL; |
344 | 344 | if (isset($udir)) $url .= "/$udir"; |
345 | - $url .= "/" . basename($target); |
|
345 | + $url .= "/".basename($target); |
|
346 | 346 | if (preg_match('/^([a-z]+)\:\/\/([^\/^\:]+)(\:(\d+))?\/(.+)$/', $url, $patt)) { |
347 | 347 | list($unused, $protocol, $domain, $unused, $port, $path) = $patt; |
348 | - $base = "$protocol://$domain" . (strlen($port) ? ":$port" : "") . "/"; |
|
349 | - $url = $base . path::urlPathEncode($path); |
|
348 | + $base = "$protocol://$domain".(strlen($port) ? ":$port" : "")."/"; |
|
349 | + $url = $base.path::urlPathEncode($path); |
|
350 | 350 | } else |
351 | 351 | $url = path::urlPathEncode($url); |
352 | 352 | } |
@@ -365,12 +365,12 @@ discard block |
||
365 | 365 | } |
366 | 366 | |
367 | 367 | |
368 | - protected function getTransaliasSettings() { |
|
368 | + protected function getTransaliasSettings(){ |
|
369 | 369 | $modx = evolutionCMS(); |
370 | 370 | |
371 | 371 | // Cleaning uploaded filename? |
372 | 372 | $setting = $modx->db->select('count(*)', $modx->getFullTableName('system_settings'), 'setting_name="clean_uploaded_filename" AND setting_value=1'); |
373 | - if ($modx->db->getValue($setting)>0) { |
|
373 | + if ($modx->db->getValue($setting) > 0) { |
|
374 | 374 | // Transalias plugin active? |
375 | 375 | $res = $modx->db->select('properties', $modx->getFullTableName('site_plugins'), 'name="TransAlias" AND disabled=0'); |
376 | 376 | if ($properties = $modx->db->getValue($res)) { |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | } |
386 | 386 | |
387 | 387 | |
388 | - protected function normalizeFilename($filename) { |
|
388 | + protected function normalizeFilename($filename){ |
|
389 | 389 | if ($this->getTransaliasSettings()) { |
390 | 390 | $format = strrchr($filename, "."); |
391 | 391 | $filename = str_replace($format, "", $filename); |
@@ -394,11 +394,11 @@ discard block |
||
394 | 394 | return $filename; |
395 | 395 | } |
396 | 396 | |
397 | - protected function normalizeDirname($dirname) { |
|
397 | + protected function normalizeDirname($dirname){ |
|
398 | 398 | return $this->modx->stripAlias($dirname); |
399 | 399 | } |
400 | 400 | |
401 | - protected function checkUploadedFile(array $aFile=null) { |
|
401 | + protected function checkUploadedFile(array $aFile = null){ |
|
402 | 402 | $config = &$this->config; |
403 | 403 | $file = ($aFile === null) ? $this->file : $aFile; |
404 | 404 | |
@@ -437,8 +437,7 @@ discard block |
||
437 | 437 | ($file['error'] == UPLOAD_ERR_NO_TMP_DIR) ? |
438 | 438 | $this->label("Missing a temporary folder.") : ( |
439 | 439 | ($file['error'] == UPLOAD_ERR_CANT_WRITE) ? |
440 | - $this->label("Failed to write file.") : |
|
441 | - $this->label("Unknown error.") |
|
440 | + $this->label("Failed to write file.") : $this->label("Unknown error.") |
|
442 | 441 | ))))); |
443 | 442 | |
444 | 443 | // HIDDEN FILENAMES CHECK |
@@ -473,14 +472,14 @@ discard block |
||
473 | 472 | |
474 | 473 | |
475 | 474 | // CHECK FOR MODX MAX FILE SIZE |
476 | - $actualfilesize=filesize($file['tmp_name']); |
|
475 | + $actualfilesize = filesize($file['tmp_name']); |
|
477 | 476 | if (isset($this->config['maxfilesize']) && $actualfilesize > $this->config['maxfilesize']) |
478 | 477 | return $this->label("File is too big: ".$actualfilesize." Bytes. (max ".$this->config['maxfilesize']." Bytes)"); |
479 | 478 | |
480 | 479 | return true; |
481 | 480 | } |
482 | 481 | |
483 | - protected function checkInputDir($dir, $inclType=true, $existing=true) { |
|
482 | + protected function checkInputDir($dir, $inclType = true, $existing = true){ |
|
484 | 483 | $dir = path::normalize($dir); |
485 | 484 | if (substr($dir, 0, 1) == "/") |
486 | 485 | $dir = substr($dir, 1); |
@@ -506,7 +505,7 @@ discard block |
||
506 | 505 | return (is_dir($path) && is_readable($path)) ? $return : false; |
507 | 506 | } |
508 | 507 | |
509 | - protected function validateExtension($ext, $type) { |
|
508 | + protected function validateExtension($ext, $type){ |
|
510 | 509 | $ext = trim(strtolower($ext)); |
511 | 510 | if (!isset($this->types[$type])) |
512 | 511 | return false; |
@@ -531,17 +530,17 @@ discard block |
||
531 | 530 | return in_array($ext, $exts); |
532 | 531 | } |
533 | 532 | |
534 | - protected function getTypeFromPath($path) { |
|
533 | + protected function getTypeFromPath($path){ |
|
535 | 534 | return preg_match('/^([^\/]*)\/.*$/', $path, $patt) |
536 | 535 | ? $patt[1] : $path; |
537 | 536 | } |
538 | 537 | |
539 | - protected function removeTypeFromPath($path) { |
|
538 | + protected function removeTypeFromPath($path){ |
|
540 | 539 | return preg_match('/^[^\/]*\/(.*)$/', $path, $patt) |
541 | 540 | ? $patt[1] : ""; |
542 | 541 | } |
543 | 542 | |
544 | - protected function imageResize($image, $file=null) { |
|
543 | + protected function imageResize($image, $file = null){ |
|
545 | 544 | |
546 | 545 | if (!($image instanceof image)) { |
547 | 546 | $img = image::factory($this->imageDriver, $image); |
@@ -629,24 +628,24 @@ discard block |
||
629 | 628 | $img->watermark($this->config['watermark']['file'], $left, $top); |
630 | 629 | } |
631 | 630 | |
632 | - $options = array( 'file' => $file ); |
|
631 | + $options = array('file' => $file); |
|
633 | 632 | |
634 | - $type = exif_imagetype( $file ); |
|
633 | + $type = exif_imagetype($file); |
|
635 | 634 | |
636 | - switch ( $type ) { |
|
635 | + switch ($type) { |
|
637 | 636 | case IMAGETYPE_GIF: |
638 | - return $img->output( 'gif', $options ); |
|
637 | + return $img->output('gif', $options); |
|
639 | 638 | |
640 | 639 | case IMAGETYPE_PNG: |
641 | - return $img->output( 'png', $options ); |
|
640 | + return $img->output('png', $options); |
|
642 | 641 | |
643 | 642 | default: |
644 | - return $img->output( 'jpeg', array_merge( $options, array( 'quality' => $this->config['jpegQuality'] ) ) ); |
|
643 | + return $img->output('jpeg', array_merge($options, array('quality' => $this->config['jpegQuality']))); |
|
645 | 644 | } |
646 | 645 | |
647 | 646 | } |
648 | 647 | |
649 | - protected function makeThumb($file, $overwrite=true) { |
|
648 | + protected function makeThumb($file, $overwrite = true){ |
|
650 | 649 | $img = image::factory($this->imageDriver, $file); |
651 | 650 | |
652 | 651 | // Drop files which are not images |
@@ -654,7 +653,7 @@ discard block |
||
654 | 653 | return true; |
655 | 654 | |
656 | 655 | $thumb = substr($file, strlen($this->config['uploadDir'])); |
657 | - $thumb = $this->config['uploadDir'] . "/" . $this->config['thumbsDir'] . "/" . $thumb; |
|
656 | + $thumb = $this->config['uploadDir']."/".$this->config['thumbsDir']."/".$thumb; |
|
658 | 657 | $thumb = path::normalize($thumb); |
659 | 658 | $thumbDir = dirname($thumb); |
660 | 659 | if (!is_dir($thumbDir) && !@mkdir($thumbDir, $this->config['dirPerms'], true)) |
@@ -677,15 +676,15 @@ discard block |
||
677 | 676 | if (!$img->resizeFit($this->config['thumbWidth'], $this->config['thumbHeight'])) |
678 | 677 | return false; |
679 | 678 | |
680 | - if ( $this->imageDriver == 'gd' ) { |
|
681 | - $width = imagesx( $img->image ); |
|
682 | - $height = imagesy( $img->image ); |
|
683 | - $back = image::factory( $this->imageDriver, array( $width, $height ) ); |
|
684 | - $tile = image::factory( $this->imageDriver, __DIR__ . '/../themes/' . $this->config['theme'] . '/img/bg_transparent.png' ); |
|
679 | + if ($this->imageDriver == 'gd') { |
|
680 | + $width = imagesx($img->image); |
|
681 | + $height = imagesy($img->image); |
|
682 | + $back = image::factory($this->imageDriver, array($width, $height)); |
|
683 | + $tile = image::factory($this->imageDriver, __DIR__.'/../themes/'.$this->config['theme'].'/img/bg_transparent.png'); |
|
685 | 684 | |
686 | - imagesettile( $back->image, $tile->image ); |
|
687 | - imagefilledrectangle( $back->image, 0, 0, $width, $height, IMG_COLOR_TILED ); |
|
688 | - imagecopy( $back->image, $img->image, 0, 0, 0, 0, $width, $height ); |
|
685 | + imagesettile($back->image, $tile->image); |
|
686 | + imagefilledrectangle($back->image, 0, 0, $width, $height, IMG_COLOR_TILED); |
|
687 | + imagecopy($back->image, $img->image, 0, 0, 0, 0, $width, $height); |
|
689 | 688 | |
690 | 689 | $img = $back; |
691 | 690 | } |
@@ -697,7 +696,7 @@ discard block |
||
697 | 696 | )); |
698 | 697 | } |
699 | 698 | |
700 | - protected function localize($langCode) { |
|
699 | + protected function localize($langCode){ |
|
701 | 700 | require "lang/{$langCode}.php"; |
702 | 701 | setlocale(LC_ALL, $lang['_locale']); |
703 | 702 | $this->charset = $lang['_charset']; |
@@ -712,7 +711,7 @@ discard block |
||
712 | 711 | $this->labels = $lang; |
713 | 712 | } |
714 | 713 | |
715 | - protected function label($string, array $data=null) { |
|
714 | + protected function label($string, array $data = null){ |
|
716 | 715 | $return = isset($this->labels[$string]) ? $this->labels[$string] : $string; |
717 | 716 | if (is_array($data)) |
718 | 717 | foreach ($data as $key => $val) |
@@ -720,7 +719,7 @@ discard block |
||
720 | 719 | return $return; |
721 | 720 | } |
722 | 721 | |
723 | - protected function backMsg($message, array $data=null) { |
|
722 | + protected function backMsg($message, array $data = null){ |
|
724 | 723 | $message = $this->label($message, $data); |
725 | 724 | if (isset($this->file['tmp_name']) && file_exists($this->file['tmp_name'])) |
726 | 725 | @unlink($this->file['tmp_name']); |
@@ -728,7 +727,7 @@ discard block |
||
728 | 727 | die; |
729 | 728 | } |
730 | 729 | |
731 | - protected function callBack($url, $message="") { |
|
730 | + protected function callBack($url, $message = ""){ |
|
732 | 731 | $message = text::jsValue($message); |
733 | 732 | $CKfuncNum = isset($this->opener['CKEditor']['funcNum']) |
734 | 733 | ? $this->opener['CKEditor']['funcNum'] : 0; |
@@ -769,7 +768,7 @@ discard block |
||
769 | 768 | |
770 | 769 | } |
771 | 770 | |
772 | - protected function get_htaccess() { |
|
771 | + protected function get_htaccess(){ |
|
773 | 772 | return "<IfModule mod_php4.c> |
774 | 773 | php_value engine off |
775 | 774 | </IfModule> |
@@ -183,6 +183,9 @@ discard block |
||
183 | 183 | } |
184 | 184 | |
185 | 185 | |
186 | + /** |
|
187 | + * @param integer $n |
|
188 | + */ |
|
186 | 189 | private function getChars($n) |
187 | 190 | { |
188 | 191 | $response = null; |
@@ -225,6 +228,9 @@ discard block |
||
225 | 228 | } |
226 | 229 | |
227 | 230 | |
231 | + /** |
|
232 | + * @param false|string $str |
|
233 | + */ |
|
228 | 234 | private function readInt($str) |
229 | 235 | { |
230 | 236 | $size = unpack("C*", $str); |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | { |
151 | 151 | $state = 'skipframe'; |
152 | 152 | } |
153 | - elseif (in_array($b, array_merge(range(0xC0,0xC3), range(0xC5,0xC7), range(0xC9,0xCB), range(0xCD,0xCF)))) |
|
153 | + elseif (in_array($b, array_merge(range(0xC0, 0xC3), range(0xC5, 0xC7), range(0xC9, 0xCB), range(0xCD, 0xCF)))) |
|
154 | 154 | { |
155 | 155 | $state = 'readsize'; |
156 | 156 | } |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | $response = null; |
189 | 189 | |
190 | 190 | // do we need more data? |
191 | - if ($this->strpos + $n -1 >= strlen($this->str)) |
|
191 | + if ($this->strpos + $n - 1 >= strlen($this->str)) |
|
192 | 192 | { |
193 | 193 | $end = ($this->strpos + $n); |
194 | 194 |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | * The parameter $bigger_size is the bigger dimension (width or height) of calculated sizes. |
169 | 169 | * The other dimension (height or width) will be calculated autamaticaly |
170 | 170 | * @param integer $bigger_size |
171 | - * @return array */ |
|
171 | + * @return integer[] */ |
|
172 | 172 | |
173 | 173 | public function get_prop_size($bigger_size) { |
174 | 174 | |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | * no samo po edno (x ili y) izmerenie |
256 | 256 | * @param integer $width |
257 | 257 | * @param integer $height |
258 | - * @return bool */ |
|
258 | + * @return gd */ |
|
259 | 259 | |
260 | 260 | public function resize_overflow($width, $height) { |
261 | 261 | |
@@ -397,6 +397,12 @@ discard block |
||
397 | 397 | return false; |
398 | 398 | } |
399 | 399 | |
400 | + /** |
|
401 | + * @param integer $x1 |
|
402 | + * @param integer $y1 |
|
403 | + * @param integer $x2 |
|
404 | + * @param integer $y2 |
|
405 | + */ |
|
400 | 406 | public function imagefilledrectangle($x1, $y1, $x2, $y2, $color) { |
401 | 407 | $color = $this->gd_color($color); |
402 | 408 | if ($color === false) return false; |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * @link http://kcfinder.sunhater.com |
13 | 13 | */ |
14 | 14 | |
15 | -class gd { |
|
15 | +class gd{ |
|
16 | 16 | |
17 | 17 | /** GD resource |
18 | 18 | * @var resource */ |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @param mixed $image |
41 | 41 | * @return array */ |
42 | 42 | |
43 | - protected function build_image($image) { |
|
43 | + protected function build_image($image){ |
|
44 | 44 | |
45 | 45 | if ($image instanceof gd) { |
46 | 46 | $width = $image->get_width(); |
@@ -58,12 +58,12 @@ discard block |
||
58 | 58 | |
59 | 59 | } elseif (false !== (list($width, $height, $type) = @getimagesize($image))) { |
60 | 60 | $image = |
61 | - ($type == IMAGETYPE_GIF) ? @imagecreatefromgif($image) : ( |
|
62 | - ($type == IMAGETYPE_WBMP) ? @imagecreatefromwbmp($image) : ( |
|
63 | - ($type == IMAGETYPE_JPEG) ? @imagecreatefromjpeg($image) : ( |
|
61 | + ($type == IMAGETYPE_GIF) ? @imagecreatefromgif($image) : ( |
|
62 | + ($type == IMAGETYPE_WBMP) ? @imagecreatefromwbmp($image) : ( |
|
63 | + ($type == IMAGETYPE_JPEG) ? @imagecreatefromjpeg($image) : ( |
|
64 | 64 | ($type == IMAGETYPE_JPEG2000) ? @imagecreatefromjpeg($image) : ( |
65 | - ($type == IMAGETYPE_PNG) ? @imagecreatefrompng($image) : ( |
|
66 | - ($type == IMAGETYPE_XBM) ? @imagecreatefromxbm($image) : false |
|
65 | + ($type == IMAGETYPE_PNG) ? @imagecreatefrompng($image) : ( |
|
66 | + ($type == IMAGETYPE_XBM) ? @imagecreatefromxbm($image) : false |
|
67 | 67 | ))))); |
68 | 68 | |
69 | 69 | if ($type == IMAGETYPE_PNG) |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * @param integer $bigger_size |
99 | 99 | * @return gd */ |
100 | 100 | |
101 | - public function __construct($image, $bigger_size=null) { |
|
101 | + public function __construct($image, $bigger_size = null){ |
|
102 | 102 | $this->image = $this->width = $this->height = null; |
103 | 103 | |
104 | 104 | $image_details = $this->build_image($image); |
@@ -126,21 +126,21 @@ discard block |
||
126 | 126 | /** Returns the GD resource |
127 | 127 | * @return resource */ |
128 | 128 | |
129 | - public function get_image() { |
|
129 | + public function get_image(){ |
|
130 | 130 | return $this->image; |
131 | 131 | } |
132 | 132 | |
133 | 133 | /** Returns the image width |
134 | 134 | * @return integer */ |
135 | 135 | |
136 | - public function get_width() { |
|
136 | + public function get_width(){ |
|
137 | 137 | return $this->width; |
138 | 138 | } |
139 | 139 | |
140 | 140 | /** Returns the image height |
141 | 141 | * @return integer */ |
142 | 142 | |
143 | - public function get_height() { |
|
143 | + public function get_height(){ |
|
144 | 144 | return $this->height; |
145 | 145 | } |
146 | 146 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * @param integer $resized_height |
149 | 149 | * @return integer */ |
150 | 150 | |
151 | - public function get_prop_width($resized_height) { |
|
151 | + public function get_prop_width($resized_height){ |
|
152 | 152 | $width = intval(($this->width * $resized_height) / $this->height); |
153 | 153 | if (!$width) $width = 1; |
154 | 154 | return $width; |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | * @param integer $resized_width |
159 | 159 | * @return integer */ |
160 | 160 | |
161 | - public function get_prop_height($resized_width) { |
|
161 | + public function get_prop_height($resized_width){ |
|
162 | 162 | $height = intval(($this->height * $resized_width) / $this->width); |
163 | 163 | if (!$height) $height = 1; |
164 | 164 | return $height; |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @param integer $bigger_size |
171 | 171 | * @return array */ |
172 | 172 | |
173 | - public function get_prop_size($bigger_size) { |
|
173 | + public function get_prop_size($bigger_size){ |
|
174 | 174 | |
175 | 175 | if ($this->width > $this->height) { |
176 | 176 | $width = $bigger_size; |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | * @param integer $height |
192 | 192 | * @return bool */ |
193 | 193 | |
194 | - public function resize($width, $height) { |
|
194 | + public function resize($width, $height){ |
|
195 | 195 | if (!$width) $width = 1; |
196 | 196 | if (!$height) $height = 1; |
197 | 197 | return ( |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | * @param mixed $src |
209 | 209 | * @return bool */ |
210 | 210 | |
211 | - public function resize_crop($src) { |
|
211 | + public function resize_crop($src){ |
|
212 | 212 | $image_details = $this->build_image($src); |
213 | 213 | |
214 | 214 | if ($image_details !== false) { |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | * @param integer $height |
239 | 239 | * @return bool */ |
240 | 240 | |
241 | - public function resize_fit($width, $height) { |
|
241 | + public function resize_fit($width, $height){ |
|
242 | 242 | if ((!$width && !$height) || (($width == $this->width) && ($height == $this->height))) |
243 | 243 | return true; |
244 | 244 | if (!$width || (($height / $width) < ($this->height / $this->width))) |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | * @param integer $height |
258 | 258 | * @return bool */ |
259 | 259 | |
260 | - public function resize_overflow($width, $height) { |
|
260 | + public function resize_overflow($width, $height){ |
|
261 | 261 | |
262 | 262 | $big = (($this->width / $this->height) > ($width / $height)) |
263 | 263 | ? ($this->width * $height) / $this->height |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | return $return; |
276 | 276 | } |
277 | 277 | |
278 | - public function gd_color() { |
|
278 | + public function gd_color(){ |
|
279 | 279 | $args = func_get_args(); |
280 | 280 | |
281 | 281 | $expr_rgb = '/^rgb\(\s*(\d{1,3})\s*\,\s*(\d{1,3})\s*\,\s*(\d{1,3})\s*\)$/i'; |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | return imagecolorallocate($this->image, $r, $g, $b); |
318 | 318 | } |
319 | 319 | |
320 | - public function fill_color($color) { |
|
320 | + public function fill_color($color){ |
|
321 | 321 | return $this->imagefilledrectangle(0, 0, $this->width - 1, $this->height - 1, $color); |
322 | 322 | } |
323 | 323 | |
@@ -326,11 +326,11 @@ discard block |
||
326 | 326 | |
327 | 327 | public function imagecopy( |
328 | 328 | $src, |
329 | - $dst_x=0, $dst_y=0, |
|
330 | - $src_x=0, $src_y=0, |
|
331 | - $dst_w=null, $dst_h=null, |
|
332 | - $src_w=null, $src_h=null |
|
333 | - ) { |
|
329 | + $dst_x = 0, $dst_y = 0, |
|
330 | + $src_x = 0, $src_y = 0, |
|
331 | + $dst_w = null, $dst_h = null, |
|
332 | + $src_w = null, $src_h = null |
|
333 | + ){ |
|
334 | 334 | $image_details = $this->build_image($src); |
335 | 335 | |
336 | 336 | if ($image_details !== false) { |
@@ -348,11 +348,11 @@ discard block |
||
348 | 348 | |
349 | 349 | public function imagecopyresampled( |
350 | 350 | $src, |
351 | - $dst_x=0, $dst_y=0, |
|
352 | - $src_x=0, $src_y=0, |
|
353 | - $dst_w=null, $dst_h=null, |
|
354 | - $src_w=null, $src_h=null |
|
355 | - ) { |
|
351 | + $dst_x = 0, $dst_y = 0, |
|
352 | + $src_x = 0, $src_y = 0, |
|
353 | + $dst_w = null, $dst_h = null, |
|
354 | + $src_w = null, $src_h = null |
|
355 | + ){ |
|
356 | 356 | $image_details = $this->build_image($src); |
357 | 357 | |
358 | 358 | if ($image_details !== false) { |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | if (is_null($src_w)) $src_w = $src_width - $src_x; |
364 | 364 | if (is_null($src_h)) $src_h = $src_height - $src_y; |
365 | 365 | imagealphablending($this->image, false); |
366 | - imagesavealpha($this->image,true); |
|
366 | + imagesavealpha($this->image, true); |
|
367 | 367 | |
368 | 368 | |
369 | 369 | |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | |
373 | 373 | $transindex = imagecolortransparent($src); |
374 | 374 | $palletsize = imagecolorstotal($src); |
375 | - if($transindex >= 0 && $transindex < $palletsize) { |
|
375 | + if ($transindex >= 0 && $transindex < $palletsize) { |
|
376 | 376 | $transcol = imagecolorsforindex($src, $transindex); |
377 | 377 | |
378 | 378 | /*** end gif transparent fix ***/ |
@@ -381,9 +381,9 @@ discard block |
||
381 | 381 | imagefilledrectangle($this->image, 0, 0, $dst_w, $dst_h, $transindex); |
382 | 382 | imagecopyresampled($this->image, $src, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h); |
383 | 383 | imagecolortransparent($this->image, $transindex); |
384 | - for($y=0; $y<$dst_h; ++$y) |
|
385 | - for($x=0; $x<$dst_w; ++$x) |
|
386 | - if(((imagecolorat($this->image, $x, $y)>>24) & 0x7F) >= 100) imagesetpixel($this->image, $x, $y, $transindex); |
|
384 | + for ($y = 0; $y < $dst_h; ++$y) |
|
385 | + for ($x = 0; $x < $dst_w; ++$x) |
|
386 | + if (((imagecolorat($this->image, $x, $y) >> 24) & 0x7F) >= 100) imagesetpixel($this->image, $x, $y, $transindex); |
|
387 | 387 | imagetruecolortopalette($this->image, true, 255); |
388 | 388 | } |
389 | 389 | else { |
@@ -397,26 +397,26 @@ discard block |
||
397 | 397 | return false; |
398 | 398 | } |
399 | 399 | |
400 | - public function imagefilledrectangle($x1, $y1, $x2, $y2, $color) { |
|
400 | + public function imagefilledrectangle($x1, $y1, $x2, $y2, $color){ |
|
401 | 401 | $color = $this->gd_color($color); |
402 | 402 | if ($color === false) return false; |
403 | 403 | return imagefilledrectangle($this->image, $x1, $y1, $x2, $y2, $color); |
404 | 404 | } |
405 | 405 | |
406 | - public function imagepng($filename=null, $quality=null, $filters=null) { |
|
406 | + public function imagepng($filename = null, $quality = null, $filters = null){ |
|
407 | 407 | if (is_null($filename) && !headers_sent()) |
408 | 408 | header("Content-Type: image/png"); |
409 | 409 | @imagesavealpha($this->image, true); |
410 | 410 | return imagepng($this->image, $filename, $quality, $filters); |
411 | 411 | } |
412 | 412 | |
413 | - public function imagejpeg($filename=null, $quality=75) { |
|
413 | + public function imagejpeg($filename = null, $quality = 75){ |
|
414 | 414 | if (is_null($filename) && !headers_sent()) |
415 | 415 | header("Content-Type: image/jpeg"); |
416 | 416 | return imagejpeg($this->image, $filename, $quality); |
417 | 417 | } |
418 | 418 | |
419 | - public function imagegif($filename=null) { |
|
419 | + public function imagegif($filename = null){ |
|
420 | 420 | if (is_null($filename) && !headers_sent()) |
421 | 421 | header("Content-Type: image/gif"); |
422 | 422 | @imagesavealpha($this->image, true); |
@@ -179,7 +179,6 @@ |
||
179 | 179 | |
180 | 180 | /** Resize and crop the image to fit in given resolution. Returns TRUE on |
181 | 181 | * success or FALSE on failure |
182 | - * @param mixed $src |
|
183 | 182 | * @param integer $offset |
184 | 183 | * @return bool */ |
185 | 184 | abstract public function resizeCrop($width, $height, $offset=false); |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * @link http://kcfinder.sunhater.com |
13 | 13 | */ |
14 | 14 | |
15 | -abstract class image { |
|
15 | +abstract class image{ |
|
16 | 16 | const DEFAULT_JPEG_QUALITY = 75; |
17 | 17 | |
18 | 18 | /** Image resource or object |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * @param string $property |
42 | 42 | * @return mixed */ |
43 | 43 | |
44 | - final public function __get($property) { |
|
44 | + final public function __get($property){ |
|
45 | 45 | return property_exists($this, $property) ? $this->$property : null; |
46 | 46 | } |
47 | 47 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * @param mixed $image |
58 | 58 | * @param array $options */ |
59 | 59 | |
60 | - public function __construct($image, array $options=array()) { |
|
60 | + public function __construct($image, array $options = array()){ |
|
61 | 61 | $this->image = $this->width = $this->height = null; |
62 | 62 | $imageDetails = $this->buildImage($image); |
63 | 63 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * @param mixed $image |
76 | 76 | * @return object */ |
77 | 77 | |
78 | - final static function factory($driver, $image, array $options=array()) { |
|
78 | + final static function factory($driver, $image, array $options = array()){ |
|
79 | 79 | $class = "image_$driver"; |
80 | 80 | return new $class($image, $options); |
81 | 81 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @param array $drivers |
87 | 87 | * @return string */ |
88 | 88 | |
89 | - final static function getDriver(array $drivers=array('gd')) { |
|
89 | + final static function getDriver(array $drivers = array('gd')){ |
|
90 | 90 | foreach ($drivers as $driver) { |
91 | 91 | if (!preg_match('/^[a-z0-9\_]+$/i', $driver)) |
92 | 92 | continue; |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * @param mixed $image |
106 | 106 | * @return array */ |
107 | 107 | |
108 | - final protected function buildImage($image) { |
|
108 | + final protected function buildImage($image){ |
|
109 | 109 | $class = get_class($this); |
110 | 110 | |
111 | 111 | if ($image instanceof $class) { |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | * @param integer $resizedHeight |
132 | 132 | * @return integer */ |
133 | 133 | |
134 | - final public function getPropWidth($resizedHeight) { |
|
134 | + final public function getPropWidth($resizedHeight){ |
|
135 | 135 | $width = round(($this->width * $resizedHeight) / $this->height); |
136 | 136 | if (!$width) $width = 1; |
137 | 137 | return $width; |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | * @param integer $resizedWidth |
143 | 143 | * @return integer */ |
144 | 144 | |
145 | - final public function getPropHeight($resizedWidth) { |
|
145 | + final public function getPropHeight($resizedWidth){ |
|
146 | 146 | $height = round(($this->height * $resizedWidth) / $this->width); |
147 | 147 | if (!$height) $height = 1; |
148 | 148 | return $height; |
@@ -153,13 +153,13 @@ discard block |
||
153 | 153 | * static method should be implemented into driver classes like abstract |
154 | 154 | * methods |
155 | 155 | * @return bool */ |
156 | - static function available() { return false; } |
|
156 | + static function available(){ return false; } |
|
157 | 157 | |
158 | 158 | /** Checks if file is an image. This static method should be implemented into |
159 | 159 | * driver classes like abstract methods |
160 | 160 | * @param string $file |
161 | 161 | * @return bool */ |
162 | - static function checkImage($file) { return false; } |
|
162 | + static function checkImage($file){ return false; } |
|
163 | 163 | |
164 | 164 | /** Resize image. Should return TRUE on success or FALSE on failure |
165 | 165 | * @param integer $width |
@@ -175,21 +175,21 @@ discard block |
||
175 | 175 | * @param integer $height |
176 | 176 | * @param mixed $background |
177 | 177 | * @return bool */ |
178 | - abstract public function resizeFit($width, $height, $background=false); |
|
178 | + abstract public function resizeFit($width, $height, $background = false); |
|
179 | 179 | |
180 | 180 | /** Resize and crop the image to fit in given resolution. Returns TRUE on |
181 | 181 | * success or FALSE on failure |
182 | 182 | * @param mixed $src |
183 | 183 | * @param integer $offset |
184 | 184 | * @return bool */ |
185 | - abstract public function resizeCrop($width, $height, $offset=false); |
|
185 | + abstract public function resizeCrop($width, $height, $offset = false); |
|
186 | 186 | |
187 | 187 | |
188 | 188 | /** Rotate image |
189 | 189 | * @param integer $angle |
190 | 190 | * @param string $background |
191 | 191 | * @return bool */ |
192 | - abstract public function rotate($angle, $background="#000000"); |
|
192 | + abstract public function rotate($angle, $background = "#000000"); |
|
193 | 193 | |
194 | 194 | abstract public function flipHorizontal(); |
195 | 195 | |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | * @param mixed $top |
206 | 206 | * @param mixed $left |
207 | 207 | * @return bool */ |
208 | - abstract public function watermark($file, $left=false, $top=false); |
|
208 | + abstract public function watermark($file, $left = false, $top = false); |
|
209 | 209 | |
210 | 210 | /** Should output the image. Second parameter is used to pass some options like |
211 | 211 | * 'file' - if is set, the output will be written to a file |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | * @param string $type |
215 | 215 | * @param array $options |
216 | 216 | * @return bool */ |
217 | - abstract public function output($type='jpeg', array $options=array()); |
|
217 | + abstract public function output($type = 'jpeg', array $options = array()); |
|
218 | 218 | |
219 | 219 | /** This method should create a blank image with selected size. Should returns |
220 | 220 | * resource or object related to the created image, which will be passed to |
@@ -327,6 +327,11 @@ |
||
327 | 327 | return imagecolorallocate($this->image, $r, $g, $b); |
328 | 328 | } |
329 | 329 | |
330 | + /** |
|
331 | + * @param integer $x1 |
|
332 | + * @param integer $y1 |
|
333 | + * @param boolean $color |
|
334 | + */ |
|
330 | 335 | protected function imageFilledRectangle($x1, $y1, $x2, $y2, $color) { |
331 | 336 | $color = $this->gdColor($color); |
332 | 337 | if ($color === false) return false; |
@@ -12,12 +12,12 @@ discard block |
||
12 | 12 | * @link http://kcfinder.sunhater.com |
13 | 13 | */ |
14 | 14 | |
15 | -class image_gd extends image { |
|
15 | +class image_gd extends image{ |
|
16 | 16 | |
17 | 17 | |
18 | 18 | // ABSTRACT PUBLIC METHODS |
19 | 19 | |
20 | - public function resize($width, $height) { |
|
20 | + public function resize($width, $height){ |
|
21 | 21 | if (!$width) $width = 1; |
22 | 22 | if (!$height) $height = 1; |
23 | 23 | return ( |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | ); |
30 | 30 | } |
31 | 31 | |
32 | - public function resizeFit($width, $height, $background=false) { |
|
32 | + public function resizeFit($width, $height, $background = false){ |
|
33 | 33 | if ((!$width && !$height) || (($width == $this->width) && ($height == $this->height))) |
34 | 34 | return true; |
35 | 35 | if (!$width || (($height / $width) < ($this->height / $this->width))) { |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | } |
68 | 68 | } |
69 | 69 | |
70 | - public function resizeCrop($width, $height, $offset=false) { |
|
70 | + public function resizeCrop($width, $height, $offset = false){ |
|
71 | 71 | |
72 | 72 | if (($this->width / $this->height) > ($width / $height)) { |
73 | 73 | $h = $height; |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | return $return; |
118 | 118 | } |
119 | 119 | |
120 | - public function rotate($angle, $background="#000000") { |
|
120 | + public function rotate($angle, $background = "#000000"){ |
|
121 | 121 | $angle = -$angle; |
122 | 122 | $img = @imagerotate($this->image, $angle, $this->gdColor($background)); |
123 | 123 | if ($img === false) |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | return true; |
129 | 129 | } |
130 | 130 | |
131 | - public function flipHorizontal() { |
|
131 | + public function flipHorizontal(){ |
|
132 | 132 | $img = imagecreatetruecolor($this->width, $this->height); |
133 | 133 | imagealphablending($img, false); |
134 | 134 | imagesavealpha($img, true); |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | return true; |
140 | 140 | } |
141 | 141 | |
142 | - public function flipVertical() { |
|
142 | + public function flipVertical(){ |
|
143 | 143 | $img = imagecreatetruecolor($this->width, $this->height); |
144 | 144 | imagealphablending($img, false); |
145 | 145 | imagesavealpha($img, true); |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | return true; |
151 | 151 | } |
152 | 152 | |
153 | - public function watermark($file, $left=false, $top=false) { |
|
153 | + public function watermark($file, $left = false, $top = false){ |
|
154 | 154 | $info = getimagesize($file); |
155 | 155 | list($w, $h, $t) = $info; |
156 | 156 | if (!in_array($t, array(IMAGETYPE_PNG, IMAGETYPE_GIF))) |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | return true; |
188 | 188 | } |
189 | 189 | |
190 | - public function output($type='jpeg', array $options=array()) { |
|
190 | + public function output($type = 'jpeg', array $options = array()){ |
|
191 | 191 | $method = "output_$type"; |
192 | 192 | if (!method_exists($this, $method)) |
193 | 193 | return false; |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | |
198 | 198 | // ABSTRACT PROTECTED METHODS |
199 | 199 | |
200 | - protected function getBlankImage($width, $height) { |
|
200 | + protected function getBlankImage($width, $height){ |
|
201 | 201 | $img = @imagecreatetruecolor($width, $height); |
202 | 202 | // imagealphablending($img, false); |
203 | 203 | // imagesavealpha($img, true); |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | return $img; |
208 | 208 | } |
209 | 209 | |
210 | - protected function getImage($image, &$width, &$height) { |
|
210 | + protected function getImage($image, &$width, &$height){ |
|
211 | 211 | |
212 | 212 | if (is_resource($image) && (get_resource_type($image) == "gd")) { |
213 | 213 | $width = @imagesx($image); |
@@ -218,11 +218,11 @@ discard block |
||
218 | 218 | (false !== (list($width, $height, $t) = @getimagesize($image))) |
219 | 219 | ) { |
220 | 220 | $image = |
221 | - ($t == IMAGETYPE_GIF) ? @imagecreatefromgif($image) : ( |
|
221 | + ($t == IMAGETYPE_GIF) ? @imagecreatefromgif($image) : ( |
|
222 | 222 | ($t == IMAGETYPE_WBMP) ? @imagecreatefromwbmp($image) : ( |
223 | 223 | ($t == IMAGETYPE_JPEG) ? @imagecreatefromjpeg($image) : ( |
224 | - ($t == IMAGETYPE_PNG) ? @imagecreatefrompng($image) : ( |
|
225 | - ($t == IMAGETYPE_XBM) ? @imagecreatefromxbm($image) : false |
|
224 | + ($t == IMAGETYPE_PNG) ? @imagecreatefrompng($image) : ( |
|
225 | + ($t == IMAGETYPE_XBM) ? @imagecreatefromxbm($image) : false |
|
226 | 226 | )))); |
227 | 227 | |
228 | 228 | return $image; |
@@ -234,22 +234,22 @@ discard block |
||
234 | 234 | |
235 | 235 | // PSEUDO-ABSTRACT STATIC METHODS |
236 | 236 | |
237 | - static function available() { |
|
237 | + static function available(){ |
|
238 | 238 | return function_exists("imagecreatefromjpeg"); |
239 | 239 | } |
240 | 240 | |
241 | - static function checkImage($file) { |
|
241 | + static function checkImage($file){ |
|
242 | 242 | if (!is_string($file) || |
243 | 243 | ((false === (list($width, $height, $t) = @getimagesize($file)))) |
244 | 244 | ) |
245 | 245 | return false; |
246 | 246 | |
247 | 247 | $img = |
248 | - ($t == IMAGETYPE_GIF) ? @imagecreatefromgif($file) : ( |
|
248 | + ($t == IMAGETYPE_GIF) ? @imagecreatefromgif($file) : ( |
|
249 | 249 | ($t == IMAGETYPE_WBMP) ? @imagecreatefromwbmp($file) : ( |
250 | 250 | ($t == IMAGETYPE_JPEG) ? @imagecreatefromjpeg($file) : ( |
251 | - ($t == IMAGETYPE_PNG) ? @imagecreatefrompng($file) : ( |
|
252 | - ($t == IMAGETYPE_XBM) ? @imagecreatefromxbm($file) : false |
|
251 | + ($t == IMAGETYPE_PNG) ? @imagecreatefrompng($file) : ( |
|
252 | + ($t == IMAGETYPE_XBM) ? @imagecreatefromxbm($file) : false |
|
253 | 253 | )))); |
254 | 254 | |
255 | 255 | return ($img !== false); |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | |
259 | 259 | // OWN METHODS |
260 | 260 | |
261 | - protected function output_png(array $options=array()) { |
|
261 | + protected function output_png(array $options = array()){ |
|
262 | 262 | $file = isset($options['file']) ? $options['file'] : null; |
263 | 263 | $quality = isset($options['quality']) ? $options['quality'] : null; |
264 | 264 | $filters = isset($options['filters']) ? $options['filters'] : null; |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | return imagepng($this->image, $file, $quality, $filters); |
269 | 269 | } |
270 | 270 | |
271 | - protected function output_jpeg(array $options=array()) { |
|
271 | + protected function output_jpeg(array $options = array()){ |
|
272 | 272 | $file = isset($options['file']) ? $options['file'] : null; |
273 | 273 | $quality = isset($options['quality']) |
274 | 274 | ? $options['quality'] |
@@ -278,14 +278,14 @@ discard block |
||
278 | 278 | return imagejpeg($this->image, $file, $quality); |
279 | 279 | } |
280 | 280 | |
281 | - protected function output_gif(array $options=array()) { |
|
281 | + protected function output_gif(array $options = array()){ |
|
282 | 282 | $file = isset($options['file']) ? $options['file'] : null; |
283 | 283 | if (isset($options['file']) && !headers_sent()) |
284 | 284 | header("Content-Type: image/gif"); |
285 | 285 | return imagegif($this->image, $file); |
286 | 286 | } |
287 | 287 | |
288 | - protected function gdColor() { |
|
288 | + protected function gdColor(){ |
|
289 | 289 | $args = func_get_args(); |
290 | 290 | |
291 | 291 | $exprRGB = '/^rgb\(\s*(\d{1,3})\s*\,\s*(\d{1,3})\s*\,\s*(\d{1,3})\s*\)$/i'; |
@@ -327,15 +327,15 @@ discard block |
||
327 | 327 | return imagecolorallocate($this->image, $r, $g, $b); |
328 | 328 | } |
329 | 329 | |
330 | - protected function imageFilledRectangle($x1, $y1, $x2, $y2, $color) { |
|
330 | + protected function imageFilledRectangle($x1, $y1, $x2, $y2, $color){ |
|
331 | 331 | $color = $this->gdColor($color); |
332 | 332 | if ($color === false) return false; |
333 | 333 | return imageFilledRectangle($this->image, $x1, $y1, $x2, $y2, $color); |
334 | 334 | } |
335 | 335 | |
336 | 336 | protected function imageCopyResampled( |
337 | - $src, $dstX=0, $dstY=0, $srcX=0, $srcY=0, $dstW=null, $dstH=null, $srcW=null, $srcH=null |
|
338 | - ) { |
|
337 | + $src, $dstX = 0, $dstY = 0, $srcX = 0, $srcY = 0, $dstW = null, $dstH = null, $srcW = null, $srcH = null |
|
338 | + ){ |
|
339 | 339 | $imageDetails = $this->buildImage($src); |
340 | 340 | |
341 | 341 | if ($imageDetails === false) |
@@ -18,6 +18,9 @@ discard block |
||
18 | 18 | protected $root; |
19 | 19 | protected $ignored; |
20 | 20 | |
21 | + /** |
|
22 | + * @param string $folder |
|
23 | + */ |
|
21 | 24 | function __construct($file, $folder, $ignored=null) { |
22 | 25 | $this->zip = new ZipArchive(); |
23 | 26 | |
@@ -39,6 +42,9 @@ discard block |
||
39 | 42 | $this->zip->close(); |
40 | 43 | } |
41 | 44 | |
45 | + /** |
|
46 | + * @param string $folder |
|
47 | + */ |
|
42 | 48 | function zip($folder, $parent=null) { |
43 | 49 | $full_path = "{$this->root}$parent$folder"; |
44 | 50 | $zip_path = "$parent$folder"; |
@@ -13,12 +13,12 @@ discard block |
||
13 | 13 | * @link http://kcfinder.sunhater.com |
14 | 14 | */ |
15 | 15 | |
16 | -class zipFolder { |
|
16 | +class zipFolder{ |
|
17 | 17 | protected $zip; |
18 | 18 | protected $root; |
19 | 19 | protected $ignored; |
20 | 20 | |
21 | - function __construct($file, $folder, $ignored=null) { |
|
21 | + function __construct($file, $folder, $ignored = null){ |
|
22 | 22 | $this->zip = new ZipArchive(); |
23 | 23 | |
24 | 24 | $this->ignored = is_array($ignored) |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | $this->zip->close(); |
40 | 40 | } |
41 | 41 | |
42 | - function zip($folder, $parent=null) { |
|
42 | + function zip($folder, $parent = null){ |
|
43 | 43 | $full_path = "{$this->root}$parent$folder"; |
44 | 44 | $zip_path = "$parent$folder"; |
45 | 45 | $this->zip->addEmptyDir($zip_path); |
@@ -102,7 +102,6 @@ discard block |
||
102 | 102 | |
103 | 103 | /** Checks if the given file is really writable. The standard PHP function |
104 | 104 | * is_writable() does not work properly on Windows servers. |
105 | - * @param string $dir |
|
106 | 105 | * @return bool */ |
107 | 106 | |
108 | 107 | static function isWritable($filename) { |
@@ -114,7 +113,6 @@ discard block |
||
114 | 113 | } |
115 | 114 | |
116 | 115 | /** Get the extension from filename |
117 | - * @param string $file |
|
118 | 116 | * @param bool $toLower |
119 | 117 | * @return string */ |
120 | 118 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * @link http://kcfinder.sunhater.com |
13 | 13 | */ |
14 | 14 | |
15 | -class file { |
|
15 | +class file{ |
|
16 | 16 | |
17 | 17 | static $MIME = array( |
18 | 18 | 'ai' => 'application/postscript', |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * @param string $dir |
106 | 106 | * @return bool */ |
107 | 107 | |
108 | - static function isWritable($filename) { |
|
108 | + static function isWritable($filename){ |
|
109 | 109 | $filename = path::normalize($filename); |
110 | 110 | if (!is_file($filename) || (false === ($fp = @fopen($filename, 'a+')))) |
111 | 111 | return false; |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | * @param bool $toLower |
119 | 119 | * @return string */ |
120 | 120 | |
121 | - static function getExtension($filename, $toLower=true) { |
|
121 | + static function getExtension($filename, $toLower = true){ |
|
122 | 122 | return preg_match('/^.*\.([^\.]*)$/s', $filename, $patt) |
123 | 123 | ? ($toLower ? strtolower($patt[1]) : $patt[1]) : ""; |
124 | 124 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | * @param string $magic |
135 | 135 | * @return string */ |
136 | 136 | |
137 | - static function getMimeType($filename, $magic=null) { |
|
137 | + static function getMimeType($filename, $magic = null){ |
|
138 | 138 | if (class_exists("finfo")) { |
139 | 139 | $finfo = ($magic === null) |
140 | 140 | ? new finfo(FILEINFO_MIME) |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @param string $tpl |
171 | 171 | * @return string */ |
172 | 172 | |
173 | - static function getInexistantFilename($filename, $dir=null, $tpl=null) { |
|
173 | + static function getInexistantFilename($filename, $dir = null, $tpl = null){ |
|
174 | 174 | if ($tpl === null) $tpl = "{name}({sufix}){ext}"; |
175 | 175 | $fullPath = ($dir === null); |
176 | 176 | if ($fullPath) |
@@ -188,12 +188,12 @@ discard block |
||
188 | 188 | $tpl = str_replace('{ext}', (strlen($ext) ? ".$ext" : ""), $tpl); |
189 | 189 | $i = 1; $file = "$dir/$filename"; |
190 | 190 | while (file_exists($file)) |
191 | - $file = "$dir/" . str_replace('{sufix}', $i++, $tpl); |
|
191 | + $file = "$dir/".str_replace('{sufix}', $i++, $tpl); |
|
192 | 192 | |
193 | 193 | return $fullPath |
194 | 194 | ? $file |
195 | 195 | : (strlen($fdir) |
196 | - ? "$fdir/" . basename($file) |
|
196 | + ? "$fdir/".basename($file) |
|
197 | 197 | : basename($file)); |
198 | 198 | } |
199 | 199 |
@@ -6,8 +6,8 @@ discard block |
||
6 | 6 | <tr> |
7 | 7 | <td nowrap class="warning"><?php echo $_lang['rb_title']?><br><small>[(use_browser)]</small></td> |
8 | 8 | <td> |
9 | - <?php echo wrap_label($_lang['yes'],form_radio('use_browser', 1, 'id="rbRowOn"'));?><br /> |
|
10 | - <?php echo wrap_label($_lang['no'], form_radio('use_browser', 0, 'id="rbRowOff"'));?> |
|
9 | + <?php echo wrap_label($_lang['yes'], form_radio('use_browser', 1, 'id="rbRowOn"')); ?><br /> |
|
10 | + <?php echo wrap_label($_lang['no'], form_radio('use_browser', 0, 'id="rbRowOff"')); ?> |
|
11 | 11 | </td> |
12 | 12 | </tr> |
13 | 13 | <tr> |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | <td colspan="2"><div class="split"></div></td> |
19 | 19 | </tr> |
20 | 20 | |
21 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
21 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
22 | 22 | <td nowrap class="warning"><?php echo $_lang['which_browser_default_title']?><br><small>[(which_browser)]</small></td> |
23 | 23 | <td> |
24 | 24 | <select name="which_browser" size="1" class="inputBox" onchange="documentDirty=true;"> |
@@ -27,206 +27,206 @@ discard block |
||
27 | 27 | $dir = str_replace('\\', '/', $dir); |
28 | 28 | $browser_name = substr($dir, strrpos($dir, '/') + 1); |
29 | 29 | $selected = $browser_name == $which_browser ? ' selected="selected"' : ''; |
30 | - echo '<option value="' . $browser_name . '"' . $selected . '>' . "{$browser_name}</option>\n"; |
|
30 | + echo '<option value="'.$browser_name.'"'.$selected.'>'."{$browser_name}</option>\n"; |
|
31 | 31 | } |
32 | 32 | ?> |
33 | 33 | </select> |
34 | 34 | </td> |
35 | 35 | </tr> |
36 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
36 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
37 | 37 | <td width="200"> </td> |
38 | 38 | <td class="comment"><?php echo $_lang['which_browser_default_msg']?></td> |
39 | 39 | </tr> |
40 | 40 | <tr> |
41 | 41 | <td colspan="2"><div class="split"></div></td> |
42 | 42 | </tr> |
43 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
43 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
44 | 44 | <td nowrap class="warning"><?php echo $_lang['rb_webuser_title']?><br><small>[(rb_webuser)]</small></td> |
45 | 45 | <td> |
46 | - <label><input type="radio" name="rb_webuser" value="1" <?php echo $rb_webuser=='1' ? 'checked="checked"' : "" ; ?> /> |
|
46 | + <label><input type="radio" name="rb_webuser" value="1" <?php echo $rb_webuser == '1' ? 'checked="checked"' : ""; ?> /> |
|
47 | 47 | <?php echo $_lang['yes']?></label><br /> |
48 | - <label><input type="radio" name="rb_webuser" value="0" <?php echo $rb_webuser=='0' ? 'checked="checked"' : "" ; ?> /> |
|
48 | + <label><input type="radio" name="rb_webuser" value="0" <?php echo $rb_webuser == '0' ? 'checked="checked"' : ""; ?> /> |
|
49 | 49 | <?php echo $_lang['no']?></label> |
50 | 50 | </td> |
51 | 51 | </tr> |
52 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
52 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
53 | 53 | <td width="200"> </td> |
54 | 54 | <td class="comment"><?php echo $_lang['rb_webuser_message']?></td> |
55 | 55 | </tr> |
56 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
56 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
57 | 57 | <td colspan="2"><div class="split"></div></td> |
58 | 58 | </tr> |
59 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
59 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
60 | 60 | <td nowrap class="warning"><?php echo $_lang['rb_base_dir_title']?><br><small>[(rb_base_dir)]</small></td> |
61 | 61 | <td> |
62 | 62 | <?php echo $_lang['default']; ?> <span id="default_rb_base_dir">[(base_path)]assets/</span><br /> |
63 | 63 | <input onchange="documentDirty=true;" type="text" maxlength="255" style="width: 250px;" name="rb_base_dir" id="rb_base_dir" value="<?php echo $rb_base_dir; ?>" /> <input type="button" onclick="reset_path('rb_base_dir');" value="<?php echo $_lang['reset']; ?>" name="reset_rb_base_dir"> |
64 | 64 | </td> |
65 | 65 | </tr> |
66 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
66 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
67 | 67 | <td width="200"> </td> |
68 | 68 | <td class="comment"><?php echo $_lang['rb_base_dir_message']?></td> |
69 | 69 | </tr> |
70 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
70 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
71 | 71 | <td colspan="2"><div class="split"></div></td> |
72 | 72 | </tr> |
73 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
73 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
74 | 74 | <td nowrap class="warning"><?php echo $_lang['rb_base_url_title']?><br><small>[(rb_base_url)]</small></td> |
75 | 75 | <td> |
76 | 76 | <input onchange="documentDirty=true;" type="text" maxlength="255" style="width: 250px;" name="rb_base_url" value="<?php echo $rb_base_url; ?>" /> |
77 | 77 | </td> |
78 | 78 | </tr> |
79 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
79 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
80 | 80 | <td width="200"> </td> |
81 | 81 | <td class="comment"><?php echo $_lang['rb_base_url_message']?></td> |
82 | 82 | </tr> |
83 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
83 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
84 | 84 | <td colspan="2"><div class="split"></div></td> |
85 | 85 | </tr> |
86 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
86 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
87 | 87 | <td nowrap class="warning"><?php echo $_lang['clean_uploaded_filename']?><br><small>[(clean_uploaded_filename)]</small></td> |
88 | 88 | <td> |
89 | - <label><input type="radio" name="clean_uploaded_filename" value="1" <?php echo $clean_uploaded_filename=='1' ? 'checked="checked"' : "" ; ?> /> |
|
89 | + <label><input type="radio" name="clean_uploaded_filename" value="1" <?php echo $clean_uploaded_filename == '1' ? 'checked="checked"' : ""; ?> /> |
|
90 | 90 | <?php echo $_lang['yes']?></label><br /> |
91 | - <label><input type="radio" name="clean_uploaded_filename" value="0" <?php echo $clean_uploaded_filename=='0' ? 'checked="checked"' : "" ; ?> /> |
|
91 | + <label><input type="radio" name="clean_uploaded_filename" value="0" <?php echo $clean_uploaded_filename == '0' ? 'checked="checked"' : ""; ?> /> |
|
92 | 92 | <?php echo $_lang['no']?></label> |
93 | 93 | </td> |
94 | 94 | </tr> |
95 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
95 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
96 | 96 | <td width="200"> </td> |
97 | - <td class="comment"><?php echo $_lang['clean_uploaded_filename_message'];?></td> |
|
97 | + <td class="comment"><?php echo $_lang['clean_uploaded_filename_message']; ?></td> |
|
98 | 98 | </tr> |
99 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
99 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
100 | 100 | <td colspan="2"><div class="split"></div></td> |
101 | 101 | </tr> |
102 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
102 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
103 | 103 | <td nowrap class="warning"><?php echo $_lang['settings_strip_image_paths_title']?><br><small>[(strip_image_paths)]</small></td> |
104 | 104 | <td> |
105 | - <label><input type="radio" name="strip_image_paths" value="1" <?php echo $strip_image_paths=='1' ? 'checked="checked"' : "" ; ?> /> |
|
105 | + <label><input type="radio" name="strip_image_paths" value="1" <?php echo $strip_image_paths == '1' ? 'checked="checked"' : ""; ?> /> |
|
106 | 106 | <?php echo $_lang['yes']?></label><br /> |
107 | - <label><input type="radio" name="strip_image_paths" value="0" <?php echo $strip_image_paths=='0' ? 'checked="checked"' : "" ; ?> /> |
|
107 | + <label><input type="radio" name="strip_image_paths" value="0" <?php echo $strip_image_paths == '0' ? 'checked="checked"' : ""; ?> /> |
|
108 | 108 | <?php echo $_lang['no']?></label> |
109 | 109 | </td> |
110 | 110 | </tr> |
111 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
111 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
112 | 112 | <td width="200"> </td> |
113 | 113 | <td class="comment"><?php echo $_lang['settings_strip_image_paths_message']?></td> |
114 | 114 | </tr> |
115 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
115 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
116 | 116 | <td colspan="2"><div class="split"></div></td> |
117 | 117 | </tr> |
118 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
118 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
119 | 119 | <td nowrap class="warning"><?php echo $_lang['maxImageWidth']?><br><small>[(maxImageWidth)]</small></td> |
120 | 120 | <td> |
121 | 121 | <input onchange="documentDirty=true;" type="text" maxlength="4" style="width: 50px;" name="maxImageWidth" value="<?php echo $maxImageWidth; ?>" /> |
122 | 122 | </td> |
123 | 123 | </tr> |
124 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
124 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
125 | 125 | <td width="200"> </td> |
126 | 126 | <td class="comment"><?php echo $_lang['maxImageWidth_message']?></td> |
127 | 127 | </tr> |
128 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
128 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
129 | 129 | <td colspan="2"><div class="split"></div></td> |
130 | 130 | </tr> |
131 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
131 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
132 | 132 | <td nowrap class="warning"><?php echo $_lang['maxImageHeight']?><br><small>[(maxImageHeight)]</small></td> |
133 | 133 | <td> |
134 | 134 | <input onchange="documentDirty=true;" type="text" maxlength="4" style="width: 50px;" name="maxImageHeight" value="<?php echo $maxImageHeight; ?>" /> |
135 | 135 | </td> |
136 | 136 | </tr> |
137 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
137 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
138 | 138 | <td width="200"> </td> |
139 | 139 | <td class="comment"><?php echo $_lang['maxImageHeight_message']?></td> |
140 | 140 | </tr> |
141 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
141 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
142 | 142 | <td colspan="2"><div class="split"></div></td> |
143 | 143 | </tr> |
144 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
144 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
145 | 145 | <td nowrap class="warning"><?php echo $_lang['thumbWidth']?><br><small>[(thumbWidth)]</small></td> |
146 | 146 | <td> |
147 | 147 | <input onchange="documentDirty=true;" type="text" maxlength="4" style="width: 50px;" name="thumbWidth" value="<?php echo $thumbWidth; ?>" /> |
148 | 148 | </td> |
149 | 149 | </tr> |
150 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
150 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
151 | 151 | <td width="200"> </td> |
152 | 152 | <td class="comment"><?php echo $_lang['thumbWidth_message']?></td> |
153 | 153 | </tr> |
154 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
154 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
155 | 155 | <td colspan="2"><div class="split"></div></td> |
156 | 156 | </tr> |
157 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
157 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
158 | 158 | <td nowrap class="warning"><?php echo $_lang['thumbHeight']?><br><small>[(thumbHeight)]</small></td> |
159 | 159 | <td> |
160 | 160 | <input onchange="documentDirty=true;" type="text" maxlength="4" style="width: 50px;" name="thumbHeight" value="<?php echo $thumbHeight; ?>" /> |
161 | 161 | </td> |
162 | 162 | </tr> |
163 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
163 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
164 | 164 | <td width="200"> </td> |
165 | 165 | <td class="comment"><?php echo $_lang['thumbHeight_message']?></td> |
166 | 166 | </tr> |
167 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
167 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
168 | 168 | <td colspan="2"><div class="split"></div></td> |
169 | 169 | </tr> |
170 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
170 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
171 | 171 | <td nowrap class="warning"><?php echo $_lang['thumbsDir']?><br><small>[(thumbsDir)]</small></td> |
172 | 172 | <td> |
173 | 173 | <input onchange="documentDirty=true;" type="text" maxlength="255" style="width: 250px;" name="thumbsDir" value="<?php echo $thumbsDir; ?>" /> |
174 | 174 | </td> |
175 | 175 | </tr> |
176 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
176 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
177 | 177 | <td width="200"> </td> |
178 | 178 | <td class="comment"><?php echo $_lang['thumbsDir_message']?></td> |
179 | 179 | </tr> |
180 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
180 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
181 | 181 | <td colspan="2"><div class="split"></div></td> |
182 | 182 | </tr> |
183 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
183 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
184 | 184 | <td nowrap class="warning"><?php echo $_lang['jpegQuality']?><br><small>[(jpegQuality)]</small></td> |
185 | 185 | <td> |
186 | 186 | <input onchange="documentDirty=true;" type="text" maxlength="4" style="width: 50px;" name="jpegQuality" value="<?php echo $jpegQuality; ?>" /> |
187 | 187 | </td> |
188 | 188 | </tr> |
189 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
189 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
190 | 190 | <td width="200"> </td> |
191 | 191 | <td class="comment"><?php echo $_lang['jpegQuality_message']?></td> |
192 | 192 | </tr> |
193 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
193 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
194 | 194 | <td colspan="2"><div class="split"></div></td> |
195 | 195 | </tr> |
196 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
196 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
197 | 197 | <td nowrap class="warning"><?php echo $_lang['denyZipDownload'] ?><br><small>[(denyZipDownload)]</small></td> |
198 | 198 | <td> |
199 | - <label><input type="radio" name="denyZipDownload" value="0" <?php echo $denyZipDownload=='0' ? 'checked="checked"' : ""; ?> /> |
|
199 | + <label><input type="radio" name="denyZipDownload" value="0" <?php echo $denyZipDownload == '0' ? 'checked="checked"' : ""; ?> /> |
|
200 | 200 | <?php echo $_lang['no']?></label><br /> |
201 | - <label><input type="radio" name="denyZipDownload" value="1" <?php echo $denyZipDownload=='1' ? 'checked="checked"' : ""; ?> /> |
|
201 | + <label><input type="radio" name="denyZipDownload" value="1" <?php echo $denyZipDownload == '1' ? 'checked="checked"' : ""; ?> /> |
|
202 | 202 | <?php echo $_lang['yes']?></label> |
203 | 203 | </td> |
204 | 204 | </tr> |
205 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
205 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
206 | 206 | <td colspan="2"><div class="split"></div></td> |
207 | 207 | </tr> |
208 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
208 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
209 | 209 | <td nowrap class="warning"><?php echo $_lang['denyExtensionRename'] ?><br><small>[(denyExtensionRename)]</small></td> |
210 | 210 | <td> |
211 | - <label><input type="radio" name="denyExtensionRename" value="0" <?php echo $denyExtensionRename=='0' ? 'checked="checked"' : ""; ?> /> |
|
211 | + <label><input type="radio" name="denyExtensionRename" value="0" <?php echo $denyExtensionRename == '0' ? 'checked="checked"' : ""; ?> /> |
|
212 | 212 | <?php echo $_lang['no']?></label><br /> |
213 | - <label><input type="radio" name="denyExtensionRename" value="1" <?php echo $denyExtensionRename=='1' ? 'checked="checked"' : ""; ?> /> |
|
213 | + <label><input type="radio" name="denyExtensionRename" value="1" <?php echo $denyExtensionRename == '1' ? 'checked="checked"' : ""; ?> /> |
|
214 | 214 | <?php echo $_lang['yes']?></label> |
215 | 215 | </td> |
216 | 216 | </tr> |
217 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
217 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
218 | 218 | <td colspan="2"><div class="split"></div></td> |
219 | 219 | </tr> |
220 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
220 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
221 | 221 | <td nowrap class="warning"><?php echo $_lang['showHiddenFiles'] ?><br><small>[(showHiddenFiles)]</small></td> |
222 | 222 | <td> |
223 | - <label><input type="radio" name="showHiddenFiles" value="0" <?php echo $showHiddenFiles=='0' ? 'checked="checked"' : ""; ?> /> |
|
223 | + <label><input type="radio" name="showHiddenFiles" value="0" <?php echo $showHiddenFiles == '0' ? 'checked="checked"' : ""; ?> /> |
|
224 | 224 | <?php echo $_lang['no']?></label><br /> |
225 | - <label><input type="radio" name="showHiddenFiles" value="1" <?php echo $showHiddenFiles=='1' ? 'checked="checked"' : ""; ?> /> |
|
225 | + <label><input type="radio" name="showHiddenFiles" value="1" <?php echo $showHiddenFiles == '1' ? 'checked="checked"' : ""; ?> /> |
|
226 | 226 | <?php echo $_lang['yes']?></label> |
227 | 227 | </td> |
228 | 228 | </tr> |
229 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
229 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
230 | 230 | <td colspan="2"><div class="split"></div></td> |
231 | 231 | </tr> |
232 | 232 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | <?php |
236 | 236 | // invoke OnMiscSettingsRender event |
237 | 237 | $evtOut = $modx->invokeEvent('OnMiscSettingsRender'); |
238 | - if(is_array($evtOut)) echo implode("",$evtOut); |
|
238 | + if (is_array($evtOut)) echo implode("", $evtOut); |
|
239 | 239 | ?> |
240 | 240 | </td> |
241 | 241 | </tr> |