@@ -12,9 +12,9 @@ discard block |
||
| 12 | 12 | * @link http://kcfinder.sunhater.com |
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | -class type_mime { |
|
| 15 | +class type_mime{ |
|
| 16 | 16 | |
| 17 | - public function checkFile($file, array $config) { |
|
| 17 | + public function checkFile($file, array $config){ |
|
| 18 | 18 | if (!class_exists("finfo")) |
| 19 | 19 | return "Fileinfo PECL extension is missing."; |
| 20 | 20 | |
@@ -33,12 +33,12 @@ discard block |
||
| 33 | 33 | $mimes = $config['params']; |
| 34 | 34 | if (substr($mimes, 0, 1) == "!") { |
| 35 | 35 | $mimes = trim(substr($mimes, 1)); |
| 36 | - return in_array($type , explode(" ", $mimes)) |
|
| 36 | + return in_array($type, explode(" ", $mimes)) |
|
| 37 | 37 | ? "You can't upload such files." |
| 38 | 38 | : true; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - return !in_array($type , explode(" ", $mimes)) |
|
| 41 | + return !in_array($type, explode(" ", $mimes)) |
|
| 42 | 42 | ? "You can't upload such files." |
| 43 | 43 | : true; |
| 44 | 44 | } |
@@ -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")) |
@@ -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 | global $modx; |
| 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> |
@@ -1,2 +1,2 @@ |
||
| 1 | -<link href="css.php?type=<?php echo $this->type ?><?php echo ($this->cms ? "&cms={$this->cms}" : "" ) ?>" rel="stylesheet" type="text/css" /> |
|
| 1 | +<link href="css.php?type=<?php echo $this->type ?><?php echo ($this->cms ? "&cms={$this->cms}" : "") ?>" rel="stylesheet" type="text/css" /> |
|
| 2 | 2 | <link href="themes/<?php echo $this->config['theme'] ?>/style.css" rel="stylesheet" type="text/css" /> |
@@ -9,8 +9,8 @@ |
||
| 9 | 9 | |
| 10 | 10 | $lang = array( |
| 11 | 11 | |
| 12 | - '_locale' => "pt_BR.UTF-8", // UNIX localization code |
|
| 13 | - '_charset' => "utf-8", // Browser charset |
|
| 12 | + '_locale' => "pt_BR.UTF-8", // UNIX localization code |
|
| 13 | + '_charset' => "utf-8", // Browser charset |
|
| 14 | 14 | |
| 15 | 15 | // Date time formats. See http://www.php.net/manual/en/function.strftime.php |
| 16 | 16 | '_dateTimeFull' => "%A, %e %B, %Y %H:%M", |
@@ -6,8 +6,8 @@ |
||
| 6 | 6 | |
| 7 | 7 | $lang = array( |
| 8 | 8 | |
| 9 | - '_locale' => "de_DE.UTF-8", // UNIX localization code |
|
| 10 | - '_charset' => "utf-8", // Browser charset |
|
| 9 | + '_locale' => "de_DE.UTF-8", // UNIX localization code |
|
| 10 | + '_charset' => "utf-8", // Browser charset |
|
| 11 | 11 | |
| 12 | 12 | // Date time formats. See http://www.php.net/manual/en/function.strftime.php |
| 13 | 13 | '_dateTimeFull' => "%A, %e.%B.%Y %I:%M %p", |
@@ -7,8 +7,8 @@ |
||
| 7 | 7 | |
| 8 | 8 | $lang = array( |
| 9 | 9 | |
| 10 | - '_locale' => "uk_UA.UTF-8", // UNIX localization code |
|
| 11 | - '_charset' => "utf-8", // Browser charset |
|
| 10 | + '_locale' => "uk_UA.UTF-8", // UNIX localization code |
|
| 11 | + '_charset' => "utf-8", // Browser charset |
|
| 12 | 12 | |
| 13 | 13 | // Date time formats. See http://www.php.net/manual/en/function.strftime.php |
| 14 | 14 | '_dateTimeFull' => "%A, %e %B, %Y %H:%M", |
@@ -11,8 +11,8 @@ |
||
| 11 | 11 | |
| 12 | 12 | $lang = array( |
| 13 | 13 | |
| 14 | - '_locale' => "ja_JP.UTF-8", // UNIX localization code |
|
| 15 | - '_charset' => "utf-8", // Browser charset |
|
| 14 | + '_locale' => "ja_JP.UTF-8", // UNIX localization code |
|
| 15 | + '_charset' => "utf-8", // Browser charset |
|
| 16 | 16 | |
| 17 | 17 | // Date time formats. See http://www.php.net/manual/en/function.strftime.php |
| 18 | 18 | '_dateTimeFull' => "%Y/%m/%d %H:%M", |
@@ -7,8 +7,8 @@ |
||
| 7 | 7 | |
| 8 | 8 | $lang = array( |
| 9 | 9 | |
| 10 | - '_locale' => "fr_FR.UTF-8", // UNIX localization code |
|
| 11 | - '_charset' => "utf-8", // Browser charset |
|
| 10 | + '_locale' => "fr_FR.UTF-8", // UNIX localization code |
|
| 11 | + '_charset' => "utf-8", // Browser charset |
|
| 12 | 12 | |
| 13 | 13 | // Date time formats. See http://www.php.net/manual/en/function.strftime.php |
| 14 | 14 | '_dateTimeFull' => "%A %e %B %Y %H:%M", |