Update RFM + WebP
This commit is contained in:
parent
f95eedb798
commit
ce304140ba
@ -45,7 +45,7 @@ class common {
|
|||||||
|
|
||||||
// Numéro de version
|
// Numéro de version
|
||||||
const ZWII_UPDATE_URL = 'https://forge.chapril.org/ZwiiCMS-Team/update/raw/branch/master/';
|
const ZWII_UPDATE_URL = 'https://forge.chapril.org/ZwiiCMS-Team/update/raw/branch/master/';
|
||||||
const ZWII_VERSION = '11.2.00.27';
|
const ZWII_VERSION = '11.2.00.28';
|
||||||
const ZWII_UPDATE_CHANNEL = "test";
|
const ZWII_UPDATE_CHANNEL = "test";
|
||||||
|
|
||||||
public static $actions = [];
|
public static $actions = [];
|
||||||
|
204
core/vendor/filemanager/UploadHandler.php
vendored
204
core/vendor/filemanager/UploadHandler.php
vendored
@ -41,6 +41,7 @@ class UploadHandler
|
|||||||
const IMAGETYPE_GIF = 1;
|
const IMAGETYPE_GIF = 1;
|
||||||
const IMAGETYPE_JPEG = 2;
|
const IMAGETYPE_JPEG = 2;
|
||||||
const IMAGETYPE_PNG = 3;
|
const IMAGETYPE_PNG = 3;
|
||||||
|
const IMAGETYPE_WEBP = 4;
|
||||||
|
|
||||||
protected $image_objects = array();
|
protected $image_objects = array();
|
||||||
|
|
||||||
@ -75,12 +76,12 @@ class UploadHandler
|
|||||||
),
|
),
|
||||||
// By default, allow redirects to the referer protocol+host:
|
// By default, allow redirects to the referer protocol+host:
|
||||||
'redirect_allow_target' => '/^'.preg_quote(
|
'redirect_allow_target' => '/^'.preg_quote(
|
||||||
parse_url($this->get_server_var('HTTP_REFERER'), PHP_URL_SCHEME)
|
parse_url($this->get_server_var('HTTP_REFERER'), PHP_URL_SCHEME)
|
||||||
.'://'
|
.'://'
|
||||||
.parse_url($this->get_server_var('HTTP_REFERER'), PHP_URL_HOST)
|
.parse_url($this->get_server_var('HTTP_REFERER'), PHP_URL_HOST)
|
||||||
.'/', // Trailing slash to not match subdomains by mistake
|
.'/', // Trailing slash to not match subdomains by mistake
|
||||||
'/' // preg_quote delimiter param
|
'/' // preg_quote delimiter param
|
||||||
).'/',
|
).'/',
|
||||||
// Enable to provide file downloads via GET requests to the PHP script:
|
// Enable to provide file downloads via GET requests to the PHP script:
|
||||||
// 1. Set to 1 to download files via readfile method through PHP
|
// 1. Set to 1 to download files via readfile method through PHP
|
||||||
// 2. Set to 2 to send a X-Sendfile header for lighttpd/Apache
|
// 2. Set to 2 to send a X-Sendfile header for lighttpd/Apache
|
||||||
@ -151,14 +152,14 @@ class UploadHandler
|
|||||||
'identify_bin' => 'identify',
|
'identify_bin' => 'identify',
|
||||||
'image_versions' => array(
|
'image_versions' => array(
|
||||||
// The empty image version key defines options for the original image.
|
// The empty image version key defines options for the original image.
|
||||||
// Keep in mind: these image manipulations are inherited by all other image versions from this point onwards.
|
// Keep in mind: these image manipulations are inherited by all other image versions from this point onwards.
|
||||||
// Also note that the property 'no_cache' is not inherited, since it's not a manipulation.
|
// Also note that the property 'no_cache' is not inherited, since it's not a manipulation.
|
||||||
'' => array(
|
'' => array(
|
||||||
// Automatically rotate images based on EXIF meta data:
|
// Automatically rotate images based on EXIF meta data:
|
||||||
'auto_orient' => true
|
'auto_orient' => true
|
||||||
),
|
),
|
||||||
// You can add arrays to generate different versions.
|
// You can add arrays to generate different versions.
|
||||||
// The name of the key is the name of the version (example: 'medium').
|
// The name of the key is the name of the version (example: 'medium').
|
||||||
// the array contains the options to apply.
|
// the array contains the options to apply.
|
||||||
/*
|
/*
|
||||||
'medium' => array(
|
'medium' => array(
|
||||||
@ -167,22 +168,22 @@ class UploadHandler
|
|||||||
),
|
),
|
||||||
*/
|
*/
|
||||||
//'thumbnail' => array(
|
//'thumbnail' => array(
|
||||||
// Uncomment the following to use a defined directory for the thumbnails
|
// Uncomment the following to use a defined directory for the thumbnails
|
||||||
// instead of a subdirectory based on the version identifier.
|
// instead of a subdirectory based on the version identifier.
|
||||||
// Make sure that this directory doesn't allow execution of files if you
|
// Make sure that this directory doesn't allow execution of files if you
|
||||||
// don't pose any restrictions on the type of uploaded files, e.g. by
|
// don't pose any restrictions on the type of uploaded files, e.g. by
|
||||||
// copying the .htaccess file from the files directory for Apache:
|
// copying the .htaccess file from the files directory for Apache:
|
||||||
//'upload_dir' => dirname($this->get_server_var('SCRIPT_FILENAME')).'/thumb/',
|
//'upload_dir' => dirname($this->get_server_var('SCRIPT_FILENAME')).'/thumb/',
|
||||||
//'upload_url' => $this->get_full_url().'/thumb/',
|
//'upload_url' => $this->get_full_url().'/thumb/',
|
||||||
// Uncomment the following to force the max
|
// Uncomment the following to force the max
|
||||||
// dimensions and e.g. create square thumbnails:
|
// dimensions and e.g. create square thumbnails:
|
||||||
// 'auto_orient' => true,
|
// 'auto_orient' => true,
|
||||||
// 'crop' => true,
|
// 'crop' => true,
|
||||||
// 'jpeg_quality' => 70,
|
// 'jpeg_quality' => 70,
|
||||||
// 'no_cache' => true, (there's a caching option, but this remembers thumbnail sizes from a previous action!)
|
// 'no_cache' => true, (there's a caching option, but this remembers thumbnail sizes from a previous action!)
|
||||||
// 'strip' => true, (this strips EXIF tags, such as geolocation)
|
// 'strip' => true, (this strips EXIF tags, such as geolocation)
|
||||||
// 'max_width' => 80, // either specify width, or set to 0. Then width is automatically adjusted - keeping aspect ratio to a specified max_height.
|
// 'max_width' => 80, // either specify width, or set to 0. Then width is automatically adjusted - keeping aspect ratio to a specified max_height.
|
||||||
// 'max_height' => 80 // either specify height, or set to 0. Then height is automatically adjusted - keeping aspect ratio to a specified max_width.
|
// 'max_height' => 80 // either specify height, or set to 0. Then height is automatically adjusted - keeping aspect ratio to a specified max_width.
|
||||||
// )
|
// )
|
||||||
),
|
),
|
||||||
'print_response' => true
|
'print_response' => true
|
||||||
@ -223,13 +224,13 @@ class UploadHandler
|
|||||||
protected function get_full_url() {
|
protected function get_full_url() {
|
||||||
$https = !empty($_SERVER['HTTPS']) && strcasecmp($_SERVER['HTTPS'], 'on') === 0 ||
|
$https = !empty($_SERVER['HTTPS']) && strcasecmp($_SERVER['HTTPS'], 'on') === 0 ||
|
||||||
!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) &&
|
!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) &&
|
||||||
strcasecmp($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') === 0;
|
strcasecmp($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') === 0;
|
||||||
return
|
return
|
||||||
($https ? 'https://' : 'http://').
|
($https ? 'https://' : 'http://').
|
||||||
(!empty($_SERVER['REMOTE_USER']) ? $_SERVER['REMOTE_USER'].'@' : '').
|
(!empty($_SERVER['REMOTE_USER']) ? $_SERVER['REMOTE_USER'].'@' : '').
|
||||||
(isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ($_SERVER['SERVER_NAME'].
|
(isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ($_SERVER['SERVER_NAME'].
|
||||||
($https && $_SERVER['SERVER_PORT'] === 443 ||
|
($https && $_SERVER['SERVER_PORT'] === 443 ||
|
||||||
$_SERVER['SERVER_PORT'] === 80 ? '' : ':'.$_SERVER['SERVER_PORT']))).
|
$_SERVER['SERVER_PORT'] === 80 ? '' : ':'.$_SERVER['SERVER_PORT']))).
|
||||||
substr($_SERVER['SCRIPT_NAME'],0, strrpos($_SERVER['SCRIPT_NAME'], '/'));
|
substr($_SERVER['SCRIPT_NAME'],0, strrpos($_SERVER['SCRIPT_NAME'], '/'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -360,9 +361,9 @@ class UploadHandler
|
|||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
return array_values(array_filter(array_map(
|
return array_values(array_filter(array_map(
|
||||||
array($this, $iteration_method),
|
array($this, $iteration_method),
|
||||||
scandir($upload_dir)
|
scandir($upload_dir)
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function count_file_objects() {
|
protected function count_file_objects() {
|
||||||
@ -414,7 +415,7 @@ class UploadHandler
|
|||||||
if ($this->options['max_file_size'] && (
|
if ($this->options['max_file_size'] && (
|
||||||
$file_size > $this->options['max_file_size'] ||
|
$file_size > $this->options['max_file_size'] ||
|
||||||
$file->size > $this->options['max_file_size'])
|
$file->size > $this->options['max_file_size'])
|
||||||
) {
|
) {
|
||||||
$file->error = $this->get_error_message('max_file_size');
|
$file->error = $this->get_error_message('max_file_size');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -424,9 +425,9 @@ class UploadHandler
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (is_int($this->options['max_number_of_files']) &&
|
if (is_int($this->options['max_number_of_files']) &&
|
||||||
($this->count_file_objects() >= $this->options['max_number_of_files']) &&
|
($this->count_file_objects() >= $this->options['max_number_of_files']) &&
|
||||||
// Ignore additional chunks of existing files:
|
// Ignore additional chunks of existing files:
|
||||||
!is_file($this->get_upload_path($file->name))) {
|
!is_file($this->get_upload_path($file->name))) {
|
||||||
$file->error = $this->get_error_message('max_number_of_files');
|
$file->error = $this->get_error_message('max_number_of_files');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -488,27 +489,30 @@ class UploadHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected function get_unique_filename($file_path, $name, $size, $type, $error,
|
protected function get_unique_filename($file_path, $name, $size, $type, $error,
|
||||||
$index, $content_range) {
|
$index, $content_range) {
|
||||||
while(is_dir($this->get_upload_path($name))) {
|
while(is_dir($this->get_upload_path($name))) {
|
||||||
$name = $this->upcount_name($name);
|
$name = $this->upcount_name($name);
|
||||||
}
|
}
|
||||||
// Keep an existing filename if this is part of a chunked upload:
|
// Keep an existing filename if this is part of a chunked upload:
|
||||||
$uploaded_bytes = $this->fix_integer_overflow((int)$content_range[1]);
|
$uploaded_bytes =!empty($content_range[1]) ? $this->fix_integer_overflow((int)$content_range[1]) : 0;
|
||||||
while (is_file($this->get_upload_path($name))) {
|
while (is_file($this->get_upload_path($name))) {
|
||||||
if ($uploaded_bytes === $this->get_file_size(
|
if(isset($uploaded_bytes)){
|
||||||
$this->get_upload_path($name))) {
|
if ($uploaded_bytes === $this->get_file_size(
|
||||||
break;
|
$this->get_upload_path($name))) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$name = $this->upcount_name($name);
|
$name = $this->upcount_name($name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $name;
|
return $name;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function fix_file_extension($file_path, $name, $size, $type, $error,
|
protected function fix_file_extension($file_path, $name, $size, $type, $error,
|
||||||
$index, $content_range) {
|
$index, $content_range) {
|
||||||
// Add missing file extension for known image types:
|
// Add missing file extension for known image types:
|
||||||
if (strpos($name, '.') === false &&
|
if (strpos($name, '.') === false &&
|
||||||
preg_match('/^image\/(gif|jpe?g|png)/', $type, $matches)) {
|
preg_match('/^image\/(gif|jpe?g|png|webp)/', $type, $matches)) {
|
||||||
$name .= '.'.$matches[1];
|
$name .= '.'.$matches[1];
|
||||||
}
|
}
|
||||||
if ($this->options['correct_image_extensions']) {
|
if ($this->options['correct_image_extensions']) {
|
||||||
@ -522,6 +526,9 @@ class UploadHandler
|
|||||||
case self::IMAGETYPE_GIF:
|
case self::IMAGETYPE_GIF:
|
||||||
$extensions = array('gif');
|
$extensions = array('gif');
|
||||||
break;
|
break;
|
||||||
|
case self::IMAGETYPE_WEBP:
|
||||||
|
$extensions = array('webp');
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
// Adjust incorrect image file extensions:
|
// Adjust incorrect image file extensions:
|
||||||
if (!empty($extensions)) {
|
if (!empty($extensions)) {
|
||||||
@ -538,7 +545,7 @@ class UploadHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected function trim_file_name($file_path, $name, $size, $type, $error,
|
protected function trim_file_name($file_path, $name, $size, $type, $error,
|
||||||
$index, $content_range) {
|
$index, $content_range) {
|
||||||
// Remove path information and dots around the filename, to prevent uploading
|
// Remove path information and dots around the filename, to prevent uploading
|
||||||
// into different directories or replacing hidden system files.
|
// into different directories or replacing hidden system files.
|
||||||
// Also remove control characters and spaces (\x00..\x20) around the filename:
|
// Also remove control characters and spaces (\x00..\x20) around the filename:
|
||||||
@ -561,13 +568,13 @@ class UploadHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected function get_file_name($file_path, $name, $size, $type, $error,
|
protected function get_file_name($file_path, $name, $size, $type, $error,
|
||||||
$index, $content_range) {
|
$index, $content_range) {
|
||||||
$name = $this->trim_file_name($file_path, $name, $size, $type, $error,
|
$name = $this->trim_file_name($file_path, $name, $size, $type, $error,
|
||||||
$index, $content_range);
|
$index, $content_range);
|
||||||
return $this->get_unique_filename(
|
return $this->get_unique_filename(
|
||||||
$file_path,
|
$file_path,
|
||||||
$this->fix_file_extension($file_path, $name, $size, $type, $error,
|
$this->fix_file_extension($file_path, $name, $size, $type, $error,
|
||||||
$index, $content_range),
|
$index, $content_range),
|
||||||
$size,
|
$size,
|
||||||
$type,
|
$type,
|
||||||
$error,
|
$error,
|
||||||
@ -734,6 +741,12 @@ class UploadHandler
|
|||||||
$image_quality = isset($options['png_quality']) ?
|
$image_quality = isset($options['png_quality']) ?
|
||||||
$options['png_quality'] : 9;
|
$options['png_quality'] : 9;
|
||||||
break;
|
break;
|
||||||
|
case 'webp':
|
||||||
|
$src_func = 'imagecreatefromwebp';
|
||||||
|
$write_func = 'imagewebp';
|
||||||
|
$image_quality = isset($options['webp_quality']) ?
|
||||||
|
$options['webp_quality'] : 75;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -803,17 +816,17 @@ class UploadHandler
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$success = imagecopyresampled(
|
$success = imagecopyresampled(
|
||||||
$new_img,
|
$new_img,
|
||||||
$src_img,
|
$src_img,
|
||||||
$dst_x,
|
$dst_x,
|
||||||
$dst_y,
|
$dst_y,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
$new_width,
|
$new_width,
|
||||||
$new_height,
|
$new_height,
|
||||||
$img_width,
|
$img_width,
|
||||||
$img_height
|
$img_height
|
||||||
) && $write_func($new_img, $new_file_path, $image_quality);
|
) && $write_func($new_img, $new_file_path, $image_quality);
|
||||||
$this->gd_set_image_object($file_path, $new_img);
|
$this->gd_set_image_object($file_path, $new_img);
|
||||||
return $success;
|
return $success;
|
||||||
}
|
}
|
||||||
@ -896,32 +909,32 @@ class UploadHandler
|
|||||||
$image_oriented = false;
|
$image_oriented = false;
|
||||||
if (!empty($options['auto_orient'])) {
|
if (!empty($options['auto_orient'])) {
|
||||||
$image_oriented = $this->imagick_orient_image($image);
|
$image_oriented = $this->imagick_orient_image($image);
|
||||||
}
|
}
|
||||||
|
|
||||||
$image_resize = false;
|
$image_resize = false;
|
||||||
$new_width = $max_width = $img_width = $image->getImageWidth();
|
$new_width = $max_width = $img_width = $image->getImageWidth();
|
||||||
$new_height = $max_height = $img_height = $image->getImageHeight();
|
$new_height = $max_height = $img_height = $image->getImageHeight();
|
||||||
|
|
||||||
// use isset(). User might be setting max_width = 0 (auto in regular resizing). Value 0 would be considered empty when you use empty()
|
// use isset(). User might be setting max_width = 0 (auto in regular resizing). Value 0 would be considered empty when you use empty()
|
||||||
if (isset($options['max_width'])) {
|
if (isset($options['max_width'])) {
|
||||||
$image_resize = true;
|
$image_resize = true;
|
||||||
$new_width = $max_width = $options['max_width'];
|
$new_width = $max_width = $options['max_width'];
|
||||||
}
|
}
|
||||||
if (isset($options['max_height'])) {
|
if (isset($options['max_height'])) {
|
||||||
$image_resize = true;
|
$image_resize = true;
|
||||||
$new_height = $max_height = $options['max_height'];
|
$new_height = $max_height = $options['max_height'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$image_strip = (isset($options['strip']) ? $options['strip'] : false);
|
$image_strip = (isset($options['strip']) ? $options['strip'] : false);
|
||||||
|
|
||||||
if ( !$image_oriented && ($max_width >= $img_width) && ($max_height >= $img_height) && !$image_strip && empty($options["jpeg_quality"]) ) {
|
if ( !$image_oriented && ($max_width >= $img_width) && ($max_height >= $img_height) && !$image_strip && empty($options["jpeg_quality"]) ) {
|
||||||
if ($file_path !== $new_file_path) {
|
if ($file_path !== $new_file_path) {
|
||||||
return copy($file_path, $new_file_path);
|
return copy($file_path, $new_file_path);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
$crop = (isset($options['crop']) ? $options['crop'] : false);
|
$crop = (isset($options['crop']) ? $options['crop'] : false);
|
||||||
|
|
||||||
if ($crop) {
|
if ($crop) {
|
||||||
$x = 0;
|
$x = 0;
|
||||||
$y = 0;
|
$y = 0;
|
||||||
@ -1083,6 +1096,9 @@ class UploadHandler
|
|||||||
if (bin2hex(@$data[0]).substr($data, 1, 4) === '89PNG') {
|
if (bin2hex(@$data[0]).substr($data, 1, 4) === '89PNG') {
|
||||||
return self::IMAGETYPE_PNG;
|
return self::IMAGETYPE_PNG;
|
||||||
}
|
}
|
||||||
|
if ($data === 'RIFF') {
|
||||||
|
return self::IMAGETYPE_WEBP;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1111,17 +1127,17 @@ class UploadHandler
|
|||||||
}
|
}
|
||||||
if (count($failed_versions)) {
|
if (count($failed_versions)) {
|
||||||
$file->error = $this->get_error_message('image_resize')
|
$file->error = $this->get_error_message('image_resize')
|
||||||
.' ('.implode($failed_versions, ', ').')';
|
.' ('.implode(', ', $failed_versions).')';
|
||||||
}
|
}
|
||||||
// Free memory:
|
// Free memory:
|
||||||
$this->destroy_image_object($file_path);
|
$this->destroy_image_object($file_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function handle_file_upload($uploaded_file, $name, $size, $type, $error,
|
protected function handle_file_upload($uploaded_file, $name, $size, $type, $error,
|
||||||
$index = null, $content_range = null) {
|
$index = null, $content_range = null) {
|
||||||
$file = new \stdClass();
|
$file = new \stdClass();
|
||||||
$file->name = $this->get_file_name($uploaded_file, $name, $size, $type, $error,
|
$file->name = $this->get_file_name($uploaded_file, $name, $size, $type, $error,
|
||||||
$index, $content_range);
|
$index, $content_range);
|
||||||
$file->size = $this->fix_integer_overflow((int)$size);
|
$file->size = $this->fix_integer_overflow((int)$size);
|
||||||
$file->type = $type;
|
$file->type = $type;
|
||||||
if ($this->validate($uploaded_file, $file, $error, $index)) {
|
if ($this->validate($uploaded_file, $file, $error, $index)) {
|
||||||
@ -1203,11 +1219,19 @@ class UploadHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected function get_query_param($id) {
|
protected function get_query_param($id) {
|
||||||
return @$_GET[$id];
|
if (isset($_GET[$id])) {
|
||||||
|
return @$_GET[$id];
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function get_server_var($id) {
|
protected function get_server_var($id) {
|
||||||
return @$_SERVER[$id];
|
if (isset($_SERVER[$id])) {
|
||||||
|
return @$_SERVER[$id];
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function handle_form_data($file, $index) {
|
protected function handle_form_data($file, $index) {
|
||||||
@ -1306,11 +1330,11 @@ class UploadHandler
|
|||||||
protected function send_access_control_headers() {
|
protected function send_access_control_headers() {
|
||||||
$this->header('Access-Control-Allow-Origin: '.$this->options['access_control_allow_origin']);
|
$this->header('Access-Control-Allow-Origin: '.$this->options['access_control_allow_origin']);
|
||||||
$this->header('Access-Control-Allow-Credentials: '
|
$this->header('Access-Control-Allow-Credentials: '
|
||||||
.($this->options['access_control_allow_credentials'] ? 'true' : 'false'));
|
.($this->options['access_control_allow_credentials'] ? 'true' : 'false'));
|
||||||
$this->header('Access-Control-Allow-Methods: '
|
$this->header('Access-Control-Allow-Methods: '
|
||||||
.implode(', ', $this->options['access_control_allow_methods']));
|
.implode(', ', $this->options['access_control_allow_methods']));
|
||||||
$this->header('Access-Control-Allow-Headers: '
|
$this->header('Access-Control-Allow-Headers: '
|
||||||
.implode(', ', $this->options['access_control_allow_headers']));
|
.implode(', ', $this->options['access_control_allow_headers']));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function generate_response($content, $print_response = true) {
|
public function generate_response($content, $print_response = true) {
|
||||||
@ -1328,8 +1352,8 @@ class UploadHandler
|
|||||||
$content[$this->options['param_name']] : null;
|
$content[$this->options['param_name']] : null;
|
||||||
if ($files && is_array($files) && is_object($files[0]) && $files[0]->size) {
|
if ($files && is_array($files) && is_object($files[0]) && $files[0]->size) {
|
||||||
$this->header('Range: 0-'.(
|
$this->header('Range: 0-'.(
|
||||||
$this->fix_integer_overflow((int)$files[0]->size) - 1
|
$this->fix_integer_overflow((int)$files[0]->size) - 1
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->body($json);
|
$this->body($json);
|
||||||
@ -1379,10 +1403,10 @@ class UploadHandler
|
|||||||
$content_disposition_header = $this->get_server_var('HTTP_CONTENT_DISPOSITION');
|
$content_disposition_header = $this->get_server_var('HTTP_CONTENT_DISPOSITION');
|
||||||
$file_name = $content_disposition_header ?
|
$file_name = $content_disposition_header ?
|
||||||
rawurldecode(preg_replace(
|
rawurldecode(preg_replace(
|
||||||
'/(^[^"]+")|("$)/',
|
'/(^[^"]+")|("$)/',
|
||||||
'',
|
'',
|
||||||
$content_disposition_header
|
$content_disposition_header
|
||||||
)) : null;
|
)) : null;
|
||||||
// Parse the Content-Range header, which has the following form:
|
// Parse the Content-Range header, which has the following form:
|
||||||
// Content-Range: bytes 0-524287/2000000
|
// Content-Range: bytes 0-524287/2000000
|
||||||
$content_range_header = $this->get_server_var('HTTP_CONTENT_RANGE');
|
$content_range_header = $this->get_server_var('HTTP_CONTENT_RANGE');
|
||||||
@ -1411,11 +1435,11 @@ class UploadHandler
|
|||||||
$files[] = $this->handle_file_upload(
|
$files[] = $this->handle_file_upload(
|
||||||
isset($upload['tmp_name']) ? $upload['tmp_name'] : null,
|
isset($upload['tmp_name']) ? $upload['tmp_name'] : null,
|
||||||
$file_name ? $file_name : (isset($upload['name']) ?
|
$file_name ? $file_name : (isset($upload['name']) ?
|
||||||
$upload['name'] : null),
|
$upload['name'] : null),
|
||||||
$size ? $size : (isset($upload['size']) ?
|
$size ? $size : (isset($upload['size']) ?
|
||||||
$upload['size'] : $this->get_server_var('CONTENT_LENGTH')),
|
$upload['size'] : $this->get_server_var('CONTENT_LENGTH')),
|
||||||
isset($upload['type']) ?
|
isset($upload['type']) ?
|
||||||
$upload['type'] : $this->get_server_var('CONTENT_TYPE'),
|
$upload['type'] : $this->get_server_var('CONTENT_TYPE'),
|
||||||
isset($upload['error']) ? $upload['error'] : null,
|
isset($upload['error']) ? $upload['error'] : null,
|
||||||
null,
|
null,
|
||||||
$content_range
|
$content_range
|
||||||
@ -1426,7 +1450,7 @@ class UploadHandler
|
|||||||
$name = $file_name ? $file_name : $upload['name'][0];
|
$name = $file_name ? $file_name : $upload['name'][0];
|
||||||
$res = $this->generate_response($response, $print_response);
|
$res = $this->generate_response($response, $print_response);
|
||||||
if(is_file($this->get_upload_path($name))){
|
if(is_file($this->get_upload_path($name))){
|
||||||
$uploaded_bytes = $this->fix_integer_overflow((int)$content_range[1]);
|
$uploaded_bytes =!empty($content_range[1]) ? $this->fix_integer_overflow((int)$content_range[1]) : 0;
|
||||||
$totalSize = $this->get_file_size($this->get_upload_path($name));
|
$totalSize = $this->get_file_size($this->get_upload_path($name));
|
||||||
if ($totalSize - $uploaded_bytes - $this->options['readfile_chunk_size'] < 0) {
|
if ($totalSize - $uploaded_bytes - $this->options['readfile_chunk_size'] < 0) {
|
||||||
$this->onUploadEnd($res);
|
$this->onUploadEnd($res);
|
||||||
@ -1451,10 +1475,12 @@ class UploadHandler
|
|||||||
if (!is_dir($targetPathThumb)) {
|
if (!is_dir($targetPathThumb)) {
|
||||||
mkdir($targetPathThumb, $this->options['mkdir_mode'], true);
|
mkdir($targetPathThumb, $this->options['mkdir_mode'], true);
|
||||||
}
|
}
|
||||||
if(is_file($targetFile)) {
|
if(is_function_callable('chmod')){
|
||||||
chmod($targetFile, $this->options['config']['filePermission']);
|
if(is_file($targetFile)) {
|
||||||
}elseif(is_dir($targetFile)){
|
chmod($targetFile, $this->options['config']['filePermission']);
|
||||||
chmod($targetFile, $this->options['config']['folderPermission']);
|
}elseif(is_dir($targetFile)){
|
||||||
|
chmod($targetFile, $this->options['config']['folderPermission']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
$targetFile = $this->options['config']['ftp_temp_folder'].$res['files'][0]->name;
|
$targetFile = $this->options['config']['ftp_temp_folder'].$res['files'][0]->name;
|
||||||
|
2
core/vendor/filemanager/config/config.php
vendored
2
core/vendor/filemanager/config/config.php
vendored
@ -454,7 +454,7 @@ $config = array(
|
|||||||
//**********************
|
//**********************
|
||||||
//Allowed extensions (lowercase insert)
|
//Allowed extensions (lowercase insert)
|
||||||
//**********************
|
//**********************
|
||||||
'ext_img' => array( 'jpg', 'jpeg', 'png', 'gif', 'bmp', 'tiff','svg', 'ico' ), //Images
|
'ext_img' => array( 'jpg', 'jpeg', 'png', 'gif', 'bmp', 'tiff','svg', 'ico', 'webp' ), //Images
|
||||||
'ext_file' => array( 'doc', 'docx', 'rtf', 'pdf', 'xls', 'xlsx', 'txt', 'csv', 'html', 'xhtml', 'psd', 'sql', 'log', 'fla', 'xml', 'ade', 'adp', 'mdb', 'accdb', 'ppt', 'pptx', 'odt', 'ots', 'ott', 'odb', 'odg', 'otp', 'otg', 'odf', 'ods', 'odp', 'css', 'ai', 'kmz','dwg', 'dxf', 'hpgl', 'plt', 'spl', 'step', 'stp', 'iges', 'igs', 'sat', 'cgm', 'ics', 'gpx', 'kml', ''), //Files
|
'ext_file' => array( 'doc', 'docx', 'rtf', 'pdf', 'xls', 'xlsx', 'txt', 'csv', 'html', 'xhtml', 'psd', 'sql', 'log', 'fla', 'xml', 'ade', 'adp', 'mdb', 'accdb', 'ppt', 'pptx', 'odt', 'ots', 'ott', 'odb', 'odg', 'otp', 'otg', 'odf', 'ods', 'odp', 'css', 'ai', 'kmz','dwg', 'dxf', 'hpgl', 'plt', 'spl', 'step', 'stp', 'iges', 'igs', 'sat', 'cgm', 'ics', 'gpx', 'kml', ''), //Files
|
||||||
'ext_video' => array( 'mov', 'mpeg', 'm4v', 'mp4', 'avi', 'mpg', 'wma', "flv", "webm" ), //Video
|
'ext_video' => array( 'mov', 'mpeg', 'm4v', 'mp4', 'avi', 'mpg', 'wma', "flv", "webm" ), //Video
|
||||||
'ext_music' => array( 'mp3', 'mpga', 'm4a', 'ac3', 'aiff', 'mid', 'ogg', 'wav' ), //Audio
|
'ext_music' => array( 'mp3', 'mpga', 'm4a', 'ac3', 'aiff', 'mid', 'ogg', 'wav' ), //Audio
|
||||||
|
2311
core/vendor/filemanager/dialog.php
vendored
2311
core/vendor/filemanager/dialog.php
vendored
File diff suppressed because it is too large
Load Diff
16
core/vendor/filemanager/execute.php
vendored
16
core/vendor/filemanager/execute.php
vendored
@ -41,7 +41,21 @@ while ($cycle && $i < $max_cycles) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (file_exists($path . "config.php")) {
|
if (file_exists($path . "config.php")) {
|
||||||
require_once $path . "config.php";
|
$configMain = $config;
|
||||||
|
$configTemp = include $path . "config.php";
|
||||||
|
if(is_array($configTemp) && count($configTemp) > 0){
|
||||||
|
$config = array_merge($configMain, $configTemp);
|
||||||
|
$config['ext'] = array_merge(
|
||||||
|
$config['ext_img'],
|
||||||
|
$config['ext_file'],
|
||||||
|
$config['ext_misc'],
|
||||||
|
$config['ext_video'],
|
||||||
|
$config['ext_music']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$config = $configMain;
|
||||||
|
}
|
||||||
$cycle = false;
|
$cycle = false;
|
||||||
}
|
}
|
||||||
$path = fix_dirname($path) . "/";
|
$path = fix_dirname($path) . "/";
|
||||||
|
648
core/vendor/filemanager/include/Response.php
vendored
648
core/vendor/filemanager/include/Response.php
vendored
@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Response
|
* Class Response
|
||||||
@ -9,357 +9,357 @@
|
|||||||
*/
|
*/
|
||||||
class Response {
|
class Response {
|
||||||
|
|
||||||
const HTTP_CONTINUE = 100;
|
const HTTP_CONTINUE = 100;
|
||||||
const HTTP_SWITCHING_PROTOCOLS = 101;
|
const HTTP_SWITCHING_PROTOCOLS = 101;
|
||||||
const HTTP_PROCESSING = 102; // RFC2518
|
const HTTP_PROCESSING = 102; // RFC2518
|
||||||
const HTTP_OK = 200;
|
const HTTP_OK = 200;
|
||||||
const HTTP_CREATED = 201;
|
const HTTP_CREATED = 201;
|
||||||
const HTTP_ACCEPTED = 202;
|
const HTTP_ACCEPTED = 202;
|
||||||
const HTTP_NON_AUTHORITATIVE_INFORMATION = 203;
|
const HTTP_NON_AUTHORITATIVE_INFORMATION = 203;
|
||||||
const HTTP_NO_CONTENT = 204;
|
const HTTP_NO_CONTENT = 204;
|
||||||
const HTTP_RESET_CONTENT = 205;
|
const HTTP_RESET_CONTENT = 205;
|
||||||
const HTTP_PARTIAL_CONTENT = 206;
|
const HTTP_PARTIAL_CONTENT = 206;
|
||||||
const HTTP_MULTI_STATUS = 207; // RFC4918
|
const HTTP_MULTI_STATUS = 207; // RFC4918
|
||||||
const HTTP_ALREADY_REPORTED = 208; // RFC5842
|
const HTTP_ALREADY_REPORTED = 208; // RFC5842
|
||||||
const HTTP_IM_USED = 226; // RFC3229
|
const HTTP_IM_USED = 226; // RFC3229
|
||||||
const HTTP_MULTIPLE_CHOICES = 300;
|
const HTTP_MULTIPLE_CHOICES = 300;
|
||||||
const HTTP_MOVED_PERMANENTLY = 301;
|
const HTTP_MOVED_PERMANENTLY = 301;
|
||||||
const HTTP_FOUND = 302;
|
const HTTP_FOUND = 302;
|
||||||
const HTTP_SEE_OTHER = 303;
|
const HTTP_SEE_OTHER = 303;
|
||||||
const HTTP_NOT_MODIFIED = 304;
|
const HTTP_NOT_MODIFIED = 304;
|
||||||
const HTTP_USE_PROXY = 305;
|
const HTTP_USE_PROXY = 305;
|
||||||
const HTTP_RESERVED = 306;
|
const HTTP_RESERVED = 306;
|
||||||
const HTTP_TEMPORARY_REDIRECT = 307;
|
const HTTP_TEMPORARY_REDIRECT = 307;
|
||||||
const HTTP_PERMANENTLY_REDIRECT = 308; // RFC7238
|
const HTTP_PERMANENTLY_REDIRECT = 308; // RFC7238
|
||||||
const HTTP_BAD_REQUEST = 400;
|
const HTTP_BAD_REQUEST = 400;
|
||||||
const HTTP_UNAUTHORIZED = 401;
|
const HTTP_UNAUTHORIZED = 401;
|
||||||
const HTTP_PAYMENT_REQUIRED = 402;
|
const HTTP_PAYMENT_REQUIRED = 402;
|
||||||
const HTTP_FORBIDDEN = 403;
|
const HTTP_FORBIDDEN = 403;
|
||||||
const HTTP_NOT_FOUND = 404;
|
const HTTP_NOT_FOUND = 404;
|
||||||
const HTTP_METHOD_NOT_ALLOWED = 405;
|
const HTTP_METHOD_NOT_ALLOWED = 405;
|
||||||
const HTTP_NOT_ACCEPTABLE = 406;
|
const HTTP_NOT_ACCEPTABLE = 406;
|
||||||
const HTTP_PROXY_AUTHENTICATION_REQUIRED = 407;
|
const HTTP_PROXY_AUTHENTICATION_REQUIRED = 407;
|
||||||
const HTTP_REQUEST_TIMEOUT = 408;
|
const HTTP_REQUEST_TIMEOUT = 408;
|
||||||
const HTTP_CONFLICT = 409;
|
const HTTP_CONFLICT = 409;
|
||||||
const HTTP_GONE = 410;
|
const HTTP_GONE = 410;
|
||||||
const HTTP_LENGTH_REQUIRED = 411;
|
const HTTP_LENGTH_REQUIRED = 411;
|
||||||
const HTTP_PRECONDITION_FAILED = 412;
|
const HTTP_PRECONDITION_FAILED = 412;
|
||||||
const HTTP_REQUEST_ENTITY_TOO_LARGE = 413;
|
const HTTP_REQUEST_ENTITY_TOO_LARGE = 413;
|
||||||
const HTTP_REQUEST_URI_TOO_LONG = 414;
|
const HTTP_REQUEST_URI_TOO_LONG = 414;
|
||||||
const HTTP_UNSUPPORTED_MEDIA_TYPE = 415;
|
const HTTP_UNSUPPORTED_MEDIA_TYPE = 415;
|
||||||
const HTTP_REQUESTED_RANGE_NOT_SATISFIABLE = 416;
|
const HTTP_REQUESTED_RANGE_NOT_SATISFIABLE = 416;
|
||||||
const HTTP_EXPECTATION_FAILED = 417;
|
const HTTP_EXPECTATION_FAILED = 417;
|
||||||
const HTTP_I_AM_A_TEAPOT = 418; // RFC2324
|
const HTTP_I_AM_A_TEAPOT = 418; // RFC2324
|
||||||
const HTTP_UNPROCESSABLE_ENTITY = 422; // RFC4918
|
const HTTP_UNPROCESSABLE_ENTITY = 422; // RFC4918
|
||||||
const HTTP_LOCKED = 423; // RFC4918
|
const HTTP_LOCKED = 423; // RFC4918
|
||||||
const HTTP_FAILED_DEPENDENCY = 424; // RFC4918
|
const HTTP_FAILED_DEPENDENCY = 424; // RFC4918
|
||||||
const HTTP_RESERVED_FOR_WEBDAV_ADVANCED_COLLECTIONS_EXPIRED_PROPOSAL = 425; // RFC2817
|
const HTTP_RESERVED_FOR_WEBDAV_ADVANCED_COLLECTIONS_EXPIRED_PROPOSAL = 425; // RFC2817
|
||||||
const HTTP_UPGRADE_REQUIRED = 426; // RFC2817
|
const HTTP_UPGRADE_REQUIRED = 426; // RFC2817
|
||||||
const HTTP_PRECONDITION_REQUIRED = 428; // RFC6585
|
const HTTP_PRECONDITION_REQUIRED = 428; // RFC6585
|
||||||
const HTTP_TOO_MANY_REQUESTS = 429; // RFC6585
|
const HTTP_TOO_MANY_REQUESTS = 429; // RFC6585
|
||||||
const HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE = 431; // RFC6585
|
const HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE = 431; // RFC6585
|
||||||
const HTTP_INTERNAL_SERVER_ERROR = 500;
|
const HTTP_INTERNAL_SERVER_ERROR = 500;
|
||||||
const HTTP_NOT_IMPLEMENTED = 501;
|
const HTTP_NOT_IMPLEMENTED = 501;
|
||||||
const HTTP_BAD_GATEWAY = 502;
|
const HTTP_BAD_GATEWAY = 502;
|
||||||
const HTTP_SERVICE_UNAVAILABLE = 503;
|
const HTTP_SERVICE_UNAVAILABLE = 503;
|
||||||
const HTTP_GATEWAY_TIMEOUT = 504;
|
const HTTP_GATEWAY_TIMEOUT = 504;
|
||||||
const HTTP_VERSION_NOT_SUPPORTED = 505;
|
const HTTP_VERSION_NOT_SUPPORTED = 505;
|
||||||
const HTTP_VARIANT_ALSO_NEGOTIATES_EXPERIMENTAL = 506; // RFC2295
|
const HTTP_VARIANT_ALSO_NEGOTIATES_EXPERIMENTAL = 506; // RFC2295
|
||||||
const HTTP_INSUFFICIENT_STORAGE = 507; // RFC4918
|
const HTTP_INSUFFICIENT_STORAGE = 507; // RFC4918
|
||||||
const HTTP_LOOP_DETECTED = 508; // RFC5842
|
const HTTP_LOOP_DETECTED = 508; // RFC5842
|
||||||
const HTTP_NOT_EXTENDED = 510; // RFC2774
|
const HTTP_NOT_EXTENDED = 510; // RFC2774
|
||||||
const HTTP_NETWORK_AUTHENTICATION_REQUIRED = 511; // RFC6585
|
const HTTP_NETWORK_AUTHENTICATION_REQUIRED = 511; // RFC6585
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Status codes translation table.
|
* Status codes translation table.
|
||||||
*
|
*
|
||||||
* The list of codes is complete according to the
|
* The list of codes is complete according to the
|
||||||
* {@link http://www.iana.org/assignments/http-status-codes/ Hypertext Transfer Protocol (HTTP) Status Code Registry}
|
* {@link http://www.iana.org/assignments/http-status-codes/ Hypertext Transfer Protocol (HTTP) Status Code Registry}
|
||||||
* (last updated 2012-02-13).
|
* (last updated 2012-02-13).
|
||||||
*
|
*
|
||||||
* Unless otherwise noted, the status code is defined in RFC2616.
|
* Unless otherwise noted, the status code is defined in RFC2616.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public static $statusTexts = array(
|
public static $statusTexts = array(
|
||||||
100 => 'Continue',
|
100 => 'Continue',
|
||||||
101 => 'Switching Protocols',
|
101 => 'Switching Protocols',
|
||||||
102 => 'Processing', // RFC2518
|
102 => 'Processing', // RFC2518
|
||||||
200 => 'OK',
|
200 => 'OK',
|
||||||
201 => 'Created',
|
201 => 'Created',
|
||||||
202 => 'Accepted',
|
202 => 'Accepted',
|
||||||
203 => 'Non-Authoritative Information',
|
203 => 'Non-Authoritative Information',
|
||||||
204 => 'No Content',
|
204 => 'No Content',
|
||||||
205 => 'Reset Content',
|
205 => 'Reset Content',
|
||||||
206 => 'Partial Content',
|
206 => 'Partial Content',
|
||||||
207 => 'Multi-Status', // RFC4918
|
207 => 'Multi-Status', // RFC4918
|
||||||
208 => 'Already Reported', // RFC5842
|
208 => 'Already Reported', // RFC5842
|
||||||
226 => 'IM Used', // RFC3229
|
226 => 'IM Used', // RFC3229
|
||||||
300 => 'Multiple Choices',
|
300 => 'Multiple Choices',
|
||||||
301 => 'Moved Permanently',
|
301 => 'Moved Permanently',
|
||||||
302 => 'Found',
|
302 => 'Found',
|
||||||
303 => 'See Other',
|
303 => 'See Other',
|
||||||
304 => 'Not Modified',
|
304 => 'Not Modified',
|
||||||
305 => 'Use Proxy',
|
305 => 'Use Proxy',
|
||||||
306 => 'Reserved',
|
306 => 'Reserved',
|
||||||
307 => 'Temporary Redirect',
|
307 => 'Temporary Redirect',
|
||||||
308 => 'Permanent Redirect', // RFC7238
|
308 => 'Permanent Redirect', // RFC7238
|
||||||
400 => 'Bad Request',
|
400 => 'Bad Request',
|
||||||
401 => 'Unauthorized',
|
401 => 'Unauthorized',
|
||||||
402 => 'Payment Required',
|
402 => 'Payment Required',
|
||||||
403 => 'Forbidden',
|
403 => 'Forbidden',
|
||||||
404 => 'Not Found',
|
404 => 'Not Found',
|
||||||
405 => 'Method Not Allowed',
|
405 => 'Method Not Allowed',
|
||||||
406 => 'Not Acceptable',
|
406 => 'Not Acceptable',
|
||||||
407 => 'Proxy Authentication Required',
|
407 => 'Proxy Authentication Required',
|
||||||
408 => 'Request Timeout',
|
408 => 'Request Timeout',
|
||||||
409 => 'Conflict',
|
409 => 'Conflict',
|
||||||
410 => 'Gone',
|
410 => 'Gone',
|
||||||
411 => 'Length Required',
|
411 => 'Length Required',
|
||||||
412 => 'Precondition Failed',
|
412 => 'Precondition Failed',
|
||||||
413 => 'Request Entity Too Large',
|
413 => 'Request Entity Too Large',
|
||||||
414 => 'Request-URI Too Long',
|
414 => 'Request-URI Too Long',
|
||||||
415 => 'Unsupported Media Type',
|
415 => 'Unsupported Media Type',
|
||||||
416 => 'Requested Range Not Satisfiable',
|
416 => 'Requested Range Not Satisfiable',
|
||||||
417 => 'Expectation Failed',
|
417 => 'Expectation Failed',
|
||||||
418 => 'I\'m a teapot', // RFC2324
|
418 => 'I\'m a teapot', // RFC2324
|
||||||
422 => 'Unprocessable Entity', // RFC4918
|
422 => 'Unprocessable Entity', // RFC4918
|
||||||
423 => 'Locked', // RFC4918
|
423 => 'Locked', // RFC4918
|
||||||
424 => 'Failed Dependency', // RFC4918
|
424 => 'Failed Dependency', // RFC4918
|
||||||
425 => 'Reserved for WebDAV advanced collections expired proposal', // RFC2817
|
425 => 'Reserved for WebDAV advanced collections expired proposal', // RFC2817
|
||||||
426 => 'Upgrade Required', // RFC2817
|
426 => 'Upgrade Required', // RFC2817
|
||||||
428 => 'Precondition Required', // RFC6585
|
428 => 'Precondition Required', // RFC6585
|
||||||
429 => 'Too Many Requests', // RFC6585
|
429 => 'Too Many Requests', // RFC6585
|
||||||
431 => 'Request Header Fields Too Large', // RFC6585
|
431 => 'Request Header Fields Too Large', // RFC6585
|
||||||
500 => 'Internal Server Error',
|
500 => 'Internal Server Error',
|
||||||
501 => 'Not Implemented',
|
501 => 'Not Implemented',
|
||||||
502 => 'Bad Gateway',
|
502 => 'Bad Gateway',
|
||||||
503 => 'Service Unavailable',
|
503 => 'Service Unavailable',
|
||||||
504 => 'Gateway Timeout',
|
504 => 'Gateway Timeout',
|
||||||
505 => 'HTTP Version Not Supported',
|
505 => 'HTTP Version Not Supported',
|
||||||
506 => 'Variant Also Negotiates (Experimental)', // RFC2295
|
506 => 'Variant Also Negotiates (Experimental)', // RFC2295
|
||||||
507 => 'Insufficient Storage', // RFC4918
|
507 => 'Insufficient Storage', // RFC4918
|
||||||
508 => 'Loop Detected', // RFC5842
|
508 => 'Loop Detected', // RFC5842
|
||||||
510 => 'Not Extended', // RFC2774
|
510 => 'Not Extended', // RFC2774
|
||||||
511 => 'Network Authentication Required', // RFC6585
|
511 => 'Network Authentication Required', // RFC6585
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $content;
|
protected $content;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
protected $statusCode;
|
protected $statusCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $statusText;
|
protected $statusText;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $headers;
|
public $headers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $version;
|
protected $version;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct the response
|
* Construct the response
|
||||||
*
|
*
|
||||||
* @param mixed $content
|
* @param mixed $content
|
||||||
* @param int $statusCode
|
* @param int $statusCode
|
||||||
* @param array $headers
|
* @param array $headers
|
||||||
*/
|
*/
|
||||||
public function __construct($content = '', $statusCode = 200, $headers = array())
|
public function __construct($content = '', $statusCode = 200, $headers = array())
|
||||||
{
|
{
|
||||||
$this->setContent($content);
|
$this->setContent($content);
|
||||||
$this->setStatusCode($statusCode);
|
$this->setStatusCode($statusCode);
|
||||||
$this->headers = $headers;
|
$this->headers = $headers;
|
||||||
$this->version = '1.1';
|
$this->version = '1.1';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the content on the response.
|
* Set the content on the response.
|
||||||
*
|
*
|
||||||
* @param mixed $content
|
* @param mixed $content
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setContent($content)
|
public function setContent($content)
|
||||||
{
|
{
|
||||||
if ($content instanceof ArrayObject || is_array($content))
|
if ($content instanceof ArrayObject || is_array($content))
|
||||||
{
|
{
|
||||||
$this->headers['Content-Type'] = array('application/json');
|
$this->headers['Content-Type'] = array('application/json');
|
||||||
|
|
||||||
$content = json_encode($content);
|
$content = json_encode($content);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->content = $content;
|
$this->content = $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the Response as an HTTP string.
|
* Returns the Response as an HTTP string.
|
||||||
*
|
*
|
||||||
* The string representation of the Response is the same as the
|
* The string representation of the Response is the same as the
|
||||||
* one that will be sent to the client only if the prepare() method
|
* one that will be sent to the client only if the prepare() method
|
||||||
* has been called before.
|
* has been called before.
|
||||||
*
|
*
|
||||||
* @return string The Response as an HTTP string
|
* @return string The Response as an HTTP string
|
||||||
*
|
*
|
||||||
* @see prepare()
|
* @see prepare()
|
||||||
*/
|
*/
|
||||||
public function __toString()
|
public function __toString()
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText)."\r\n".
|
sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText)."\r\n".
|
||||||
$this->headers."\r\n".
|
$this->headers."\r\n".
|
||||||
$this->getContent();
|
$this->getContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the response status code.
|
* Sets the response status code.
|
||||||
*
|
*
|
||||||
* @param int $code HTTP status code
|
* @param int $code HTTP status code
|
||||||
* @param mixed $text HTTP status text
|
* @param mixed $text HTTP status text
|
||||||
*
|
*
|
||||||
* If the status text is null it will be automatically populated for the known
|
* If the status text is null it will be automatically populated for the known
|
||||||
* status codes and left empty otherwise.
|
* status codes and left empty otherwise.
|
||||||
*
|
*
|
||||||
* @return Response
|
* @return Response
|
||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException When the HTTP status code is not valid
|
* @throws \InvalidArgumentException When the HTTP status code is not valid
|
||||||
*
|
*
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
public function setStatusCode($code, $text = null)
|
public function setStatusCode($code, $text = null)
|
||||||
{
|
{
|
||||||
$this->statusCode = $code = (int) $code;
|
$this->statusCode = $code = (int) $code;
|
||||||
if ($this->isInvalid()) {
|
if ($this->isInvalid()) {
|
||||||
throw new InvalidArgumentException(sprintf('The HTTP status code "%s" is not valid.', $code));
|
throw new InvalidArgumentException(sprintf('The HTTP status code "%s" is not valid.', $code));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null === $text) {
|
if (null === $text) {
|
||||||
$this->statusText = isset(self::$statusTexts[$code]) ? self::$statusTexts[$code] : '';
|
$this->statusText = isset(self::$statusTexts[$code]) ? self::$statusTexts[$code] : '';
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (false === $text) {
|
if (false === $text) {
|
||||||
$this->statusText = '';
|
$this->statusText = '';
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->statusText = $text;
|
$this->statusText = $text;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
|
// http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
|
||||||
/**
|
/**
|
||||||
* Is response invalid?
|
* Is response invalid?
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*
|
*
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
public function isInvalid()
|
public function isInvalid()
|
||||||
{
|
{
|
||||||
return $this->statusCode < 100 || $this->statusCode >= 600;
|
return $this->statusCode < 100 || $this->statusCode >= 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a header on the Response.
|
* Set a header on the Response.
|
||||||
*
|
*
|
||||||
* @param string $key
|
* @param string $key
|
||||||
* @param string $value
|
* @param string $value
|
||||||
* @param bool $replace
|
* @param bool $replace
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function header($key, $value, $replace = true)
|
public function header($key, $value, $replace = true)
|
||||||
{
|
{
|
||||||
if (empty($this->headers[$key]))
|
if (empty($this->headers[$key]))
|
||||||
{
|
{
|
||||||
$this->headers[$key] = array();
|
$this->headers[$key] = array();
|
||||||
}
|
}
|
||||||
if ($replace)
|
if ($replace)
|
||||||
{
|
{
|
||||||
$this->headers[$key] = array($value);
|
$this->headers[$key] = array($value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->headers[$key][] = $value;
|
$this->headers[$key][] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends HTTP headers and content.
|
* Sends HTTP headers and content.
|
||||||
*
|
*
|
||||||
* @return Response
|
* @return Response
|
||||||
*
|
*
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
public function send()
|
public function send()
|
||||||
{
|
{
|
||||||
$this->sendHeaders();
|
$this->sendHeaders();
|
||||||
$this->sendContent();
|
$this->sendContent();
|
||||||
|
|
||||||
if (function_exists('fastcgi_finish_request')) {
|
if (function_exists('fastcgi_finish_request')) {
|
||||||
fastcgi_finish_request();
|
fastcgi_finish_request();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends content for the current web response.
|
* Sends content for the current web response.
|
||||||
*
|
*
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function sendContent()
|
public function sendContent()
|
||||||
{
|
{
|
||||||
echo $this->content;
|
echo $this->content;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends HTTP headers.
|
* Sends HTTP headers.
|
||||||
*
|
*
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function sendHeaders()
|
public function sendHeaders()
|
||||||
{
|
{
|
||||||
// headers have already been sent by the developer
|
// headers have already been sent by the developer
|
||||||
if (headers_sent()) {
|
if (headers_sent()) {
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
// status
|
// status
|
||||||
header(sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText), true, $this->statusCode);
|
header(sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText), true, $this->statusCode);
|
||||||
|
|
||||||
// headers
|
// headers
|
||||||
foreach ($this->headers as $name => $values) {
|
foreach ($this->headers as $name => $values) {
|
||||||
if (is_array($values))
|
if (is_array($values))
|
||||||
{
|
{
|
||||||
foreach ($values as $value)
|
foreach ($values as $value)
|
||||||
{
|
{
|
||||||
header($name . ': ' . $value, false, $this->statusCode);
|
header($name . ': ' . $value, false, $this->statusCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
header($name . ': ' . $values, false, $this->statusCode);
|
header($name . ': ' . $values, false, $this->statusCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
}
|
}
|
75
core/vendor/filemanager/include/get_png_imageinfo.php
vendored
Normal file
75
core/vendor/filemanager/include/get_png_imageinfo.php
vendored
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License
|
||||||
|
*
|
||||||
|
* This code was originally taken from:
|
||||||
|
* https://github.com/ktomk/Miscellaneous/blob/master/get_png_imageinfo/get_png_imageinfo.php
|
||||||
|
* It has been modified to fix bugs and improve code formatting
|
||||||
|
*
|
||||||
|
* Get image-information from PNG file
|
||||||
|
*
|
||||||
|
* php's getimagesize does not support additional image information
|
||||||
|
* from PNG files like channels or bits.
|
||||||
|
*
|
||||||
|
* get_png_imageinfo() can be used to obtain this information
|
||||||
|
* from PNG files.
|
||||||
|
*
|
||||||
|
* @author Tom Klingenberg <lastflood.net>
|
||||||
|
* @license Apache 2.0
|
||||||
|
* @link https://github.com/ktomk/Miscellaneous/blob/master/get_png_imageinfo/get_png_imageinfo.php
|
||||||
|
* @link http://www.libpng.org/pub/png/spec/iso/index-object.html#11IHDR
|
||||||
|
*
|
||||||
|
* @param string $file filename
|
||||||
|
* @return array|bool image information, FALSE on error
|
||||||
|
*/
|
||||||
|
function get_png_imageinfo($file) {
|
||||||
|
if (! is_file($file)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$info = unpack(
|
||||||
|
'a8sig/Nchunksize/A4chunktype/Nwidth/Nheight/Cbit-depth/Ccolor/Ccompression/Cfilter/Cinterface',
|
||||||
|
file_get_contents($file, 0, null, 0, 29)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (empty($info)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ("\x89\x50\x4E\x47\x0D\x0A\x1A\x0A" != array_shift($info)) {
|
||||||
|
return false; // no PNG signature
|
||||||
|
}
|
||||||
|
if (13 != array_shift($info)) {
|
||||||
|
return false; // wrong length for IHDR chunk
|
||||||
|
}
|
||||||
|
if ('IHDR'!==array_shift($info)) {
|
||||||
|
return false; // a non-IHDR chunk singals invalid data
|
||||||
|
}
|
||||||
|
|
||||||
|
$color = $info['color'];
|
||||||
|
$type = array(
|
||||||
|
0 => 'Greyscale',
|
||||||
|
2 => 'Truecolour',
|
||||||
|
3 => 'Indexed-colour',
|
||||||
|
4 => 'Greyscale with alpha',
|
||||||
|
6 => 'Truecolour with alpha'
|
||||||
|
);
|
||||||
|
|
||||||
|
if (empty($type[$color])) {
|
||||||
|
return false; // invalid color value
|
||||||
|
}
|
||||||
|
|
||||||
|
$info['color-type'] = $type[$color];
|
||||||
|
$samples = ((($color % 4) % 3) ? 3 : 1) + ($color > 3 ? 1 : 0);
|
||||||
|
$info['channels'] = $samples;
|
||||||
|
$info['bits'] = $info['bit-depth'];
|
||||||
|
|
||||||
|
return $info;
|
||||||
|
}
|
451
core/vendor/filemanager/include/mime_type_lib.php
vendored
451
core/vendor/filemanager/include/mime_type_lib.php
vendored
@ -1,249 +1,252 @@
|
|||||||
<?php
|
<?php
|
||||||
$mime_types = array(
|
$mime_types = array(
|
||||||
"application/postscript" => "ps",
|
"application/postscript" => "ps",
|
||||||
"audio/x-aiff" => "aiff",
|
"audio/x-aiff" => "aiff",
|
||||||
"text/plain" => "txt",
|
"text/plain" => "txt",
|
||||||
"video/x-ms-asf" => "asx",
|
"video/x-ms-asf" => "asx",
|
||||||
"audio/basic" => "snd",
|
"audio/basic" => "snd",
|
||||||
"video/x-msvideo" => "avi",
|
"video/x-msvideo" => "avi",
|
||||||
"application/x-bcpio" => "bcpio",
|
"application/x-bcpio" => "bcpio",
|
||||||
"application/octet-stream" => "so",
|
"application/octet-stream" => "so",
|
||||||
"image/bmp" => "bmp",
|
"image/bmp" => "bmp",
|
||||||
"application/x-rar" => "rar",
|
"application/x-rar" => "rar",
|
||||||
"application/x-bzip2" => "bz2",
|
"application/x-bzip2" => "bz2",
|
||||||
"application/x-netcdf" => "nc",
|
"application/x-netcdf" => "nc",
|
||||||
"application/x-kchart" => "chrt",
|
"application/x-kchart" => "chrt",
|
||||||
"application/x-cpio" => "cpio",
|
"application/x-cpio" => "cpio",
|
||||||
"application/mac-compactpro" => "cpt",
|
"application/mac-compactpro" => "cpt",
|
||||||
"application/x-csh" => "csh",
|
"application/x-csh" => "csh",
|
||||||
"text/css" => "css",
|
"text/css" => "css",
|
||||||
"application/x-director" => "dxr",
|
"text/csv" => "csv",
|
||||||
"image/vnd.djvu" => "djvu",
|
"application/x-director" => "dxr",
|
||||||
"application/x-dvi" => "dvi",
|
"image/vnd.djvu" => "djvu",
|
||||||
"image/vnd.dwg" => "dwg",
|
"application/x-dvi" => "dvi",
|
||||||
"application/epub" => "epub",
|
"image/vnd.dwg" => "dwg",
|
||||||
"application/epub+zip" => "epub",
|
"application/epub" => "epub",
|
||||||
"text/x-setext" => "etx",
|
"application/epub+zip" => "epub",
|
||||||
"application/andrew-inset" => "ez",
|
"text/x-setext" => "etx",
|
||||||
"video/x-flv" => "flv",
|
"application/andrew-inset" => "ez",
|
||||||
"image/gif" => "gif",
|
"video/x-flv" => "flv",
|
||||||
"application/x-gtar" => "gtar",
|
"image/gif" => "gif",
|
||||||
"application/x-gzip" => "tgz",
|
"application/x-gtar" => "gtar",
|
||||||
"application/x-hdf" => "hdf",
|
"application/x-gzip" => "tgz",
|
||||||
"application/mac-binhex40" => "hqx",
|
"application/x-hdf" => "hdf",
|
||||||
"text/html" => "html",
|
"application/mac-binhex40" => "hqx",
|
||||||
"text/htm" => "htm",
|
"text/html" => "html",
|
||||||
"x-conference/x-cooltalk" => "ice",
|
"text/htm" => "htm",
|
||||||
"image/ief" => "ief",
|
"x-conference/x-cooltalk" => "ice",
|
||||||
"model/iges" => "igs",
|
"image/ief" => "ief",
|
||||||
"text/vnd.sun.j2me.app-descriptor" => "jad",
|
"model/iges" => "igs",
|
||||||
"application/x-java-archive" => "jar",
|
"text/vnd.sun.j2me.app-descriptor" => "jad",
|
||||||
"application/x-java-jnlp-file" => "jnlp",
|
"application/x-java-archive" => "jar",
|
||||||
"image/jpeg" => "jpg",
|
"application/x-java-jnlp-file" => "jnlp",
|
||||||
"application/x-javascript" => "js",
|
"image/jpeg" => "jpg",
|
||||||
"audio/midi" => "midi",
|
"application/x-javascript" => "js",
|
||||||
"application/x-killustrator" => "kil",
|
"audio/midi" => "midi",
|
||||||
"application/x-kpresenter" => "kpt",
|
"application/x-killustrator" => "kil",
|
||||||
"application/x-kspread" => "ksp",
|
"application/x-kpresenter" => "kpt",
|
||||||
"application/x-kword" => "kwt",
|
"application/x-kspread" => "ksp",
|
||||||
"application/vnd.google-earth.kml+xml" => "kml",
|
"application/x-kword" => "kwt",
|
||||||
"application/vnd.google-earth.kmz" => "kmz",
|
"application/vnd.google-earth.kml+xml" => "kml",
|
||||||
"application/x-latex" => "latex",
|
"application/vnd.google-earth.kmz" => "kmz",
|
||||||
"audio/x-mpegurl" => "m3u",
|
"application/x-latex" => "latex",
|
||||||
"application/x-troff-man" => "man",
|
"audio/x-mpegurl" => "m3u",
|
||||||
"application/x-troff-me" => "me",
|
"application/x-troff-man" => "man",
|
||||||
"model/mesh" => "silo",
|
"application/x-troff-me" => "me",
|
||||||
"application/vnd.mif" => "mif",
|
"model/mesh" => "silo",
|
||||||
"video/quicktime" => "mov",
|
"application/vnd.mif" => "mif",
|
||||||
"video/x-sgi-movie" => "movie",
|
"video/quicktime" => "mov",
|
||||||
"audio/mpeg" => "mp3",
|
"video/x-sgi-movie" => "movie",
|
||||||
"video/mp4" => "mp4",
|
"audio/mpeg" => "mp3",
|
||||||
"video/mpeg" => "mpeg",
|
"video/mp4" => "mp4",
|
||||||
"application/x-troff-ms" => "ms",
|
"video/mpeg" => "mpeg",
|
||||||
"video/vnd.mpegurl" => "mxu",
|
"application/x-troff-ms" => "ms",
|
||||||
"application/vnd.oasis.opendocument.database" => "odb",
|
"video/vnd.mpegurl" => "mxu",
|
||||||
"application/vnd.oasis.opendocument.chart" => "odc",
|
"application/vnd.oasis.opendocument.database" => "odb",
|
||||||
"application/vnd.oasis.opendocument.formula" => "odf",
|
"application/vnd.oasis.opendocument.chart" => "odc",
|
||||||
"application/vnd.oasis.opendocument.graphics" => "odg",
|
"application/vnd.oasis.opendocument.formula" => "odf",
|
||||||
"application/vnd.oasis.opendocument.image" => "odi",
|
"application/vnd.oasis.opendocument.graphics" => "odg",
|
||||||
"application/vnd.oasis.opendocument.text-master" => "odm",
|
"application/vnd.oasis.opendocument.image" => "odi",
|
||||||
"application/vnd.oasis.opendocument.presentation" => "odp",
|
"application/vnd.oasis.opendocument.text-master" => "odm",
|
||||||
"application/vnd.oasis.opendocument.spreadsheet" => "ods",
|
"application/vnd.oasis.opendocument.presentation" => "odp",
|
||||||
"application/vnd.oasis.opendocument.text" => "odt",
|
"application/vnd.oasis.opendocument.spreadsheet" => "ods",
|
||||||
"application/ogg" => "ogg",
|
"application/vnd.oasis.opendocument.text" => "odt",
|
||||||
"video/ogg" => "ogv",
|
"application/ogg" => "ogg",
|
||||||
"application/vnd.oasis.opendocument.graphics-template" => "otg",
|
"video/ogg" => "ogv",
|
||||||
"application/vnd.oasis.opendocument.text-web" => "oth",
|
"application/vnd.oasis.opendocument.graphics-template" => "otg",
|
||||||
"application/vnd.oasis.opendocument.presentation-template" => "otp",
|
"application/vnd.oasis.opendocument.text-web" => "oth",
|
||||||
"application/vnd.oasis.opendocument.spreadsheet-template" => "ots",
|
"application/vnd.oasis.opendocument.presentation-template" => "otp",
|
||||||
"application/vnd.oasis.opendocument.text-template" => "ott",
|
"application/vnd.oasis.opendocument.spreadsheet-template" => "ots",
|
||||||
"image/x-portable-bitmap" => "pbm",
|
"application/vnd.oasis.opendocument.text-template" => "ott",
|
||||||
"chemical/x-pdb" => "pdb",
|
"image/x-portable-bitmap" => "pbm",
|
||||||
"application/pdf" => "pdf",
|
"chemical/x-pdb" => "pdb",
|
||||||
"image/x-portable-graymap" => "pgm",
|
"application/pdf" => "pdf",
|
||||||
"application/x-chess-pgn" => "pgn",
|
"image/x-portable-graymap" => "pgm",
|
||||||
"text/x-php" => "php",
|
"application/x-chess-pgn" => "pgn",
|
||||||
"image/png" => "png",
|
"text/x-php" => "php",
|
||||||
"image/x-portable-anymap" => "pnm",
|
"image/png" => "png",
|
||||||
"image/x-portable-pixmap" => "ppm",
|
"image/x-portable-anymap" => "pnm",
|
||||||
"application/vnd.ms-powerpoint" => "ppt",
|
"image/x-portable-pixmap" => "ppm",
|
||||||
"audio/x-realaudio" => "ra",
|
"application/vnd.ms-powerpoint" => "ppt",
|
||||||
"audio/x-pn-realaudio" => "rm",
|
"audio/x-realaudio" => "ra",
|
||||||
"image/x-cmu-raster" => "ras",
|
"audio/x-pn-realaudio" => "rm",
|
||||||
"image/x-rgb" => "rgb",
|
"image/x-cmu-raster" => "ras",
|
||||||
"application/x-troff" => "tr",
|
"image/x-rgb" => "rgb",
|
||||||
"application/x-rpm" => "rpm",
|
"application/x-troff" => "tr",
|
||||||
"text/rtf" => "rtf",
|
"application/x-rpm" => "rpm",
|
||||||
"text/richtext" => "rtx",
|
"text/rtf" => "rtf",
|
||||||
"text/sgml" => "sgml",
|
"text/richtext" => "rtx",
|
||||||
"application/x-sh" => "sh",
|
"text/sgml" => "sgml",
|
||||||
"application/x-shar" => "shar",
|
"application/x-sh" => "sh",
|
||||||
"application/vnd.symbian.install" => "sis",
|
"application/x-shar" => "shar",
|
||||||
"application/x-stuffit" => "sit",
|
"application/vnd.symbian.install" => "sis",
|
||||||
"application/x-koan" => "skt",
|
"application/x-stuffit" => "sit",
|
||||||
"application/smil" => "smil",
|
"application/x-koan" => "skt",
|
||||||
"image/svg+xml" => "svg",
|
"application/smil" => "smil",
|
||||||
"application/x-futuresplash" => "spl",
|
"image/svg+xml" => "svg",
|
||||||
"application/x-wais-source" => "src",
|
"application/x-futuresplash" => "spl",
|
||||||
"application/vnd.sun.xml.calc.template" => "stc",
|
"application/x-wais-source" => "src",
|
||||||
"application/vnd.sun.xml.draw.template" => "std",
|
"application/vnd.sun.xml.calc.template" => "stc",
|
||||||
"application/vnd.sun.xml.impress.template" => "sti",
|
"application/vnd.sun.xml.draw.template" => "std",
|
||||||
"application/vnd.sun.xml.writer.template" => "stw",
|
"application/vnd.sun.xml.impress.template" => "sti",
|
||||||
"application/x-sv4cpio" => "sv4cpio",
|
"application/vnd.sun.xml.writer.template" => "stw",
|
||||||
"application/x-sv4crc" => "sv4crc",
|
"application/x-sv4cpio" => "sv4cpio",
|
||||||
"application/x-shockwave-flash" => "swf",
|
"application/x-sv4crc" => "sv4crc",
|
||||||
"application/vnd.sun.xml.calc" => "sxc",
|
"application/x-shockwave-flash" => "swf",
|
||||||
"application/vnd.sun.xml.draw" => "sxd",
|
"application/vnd.sun.xml.calc" => "sxc",
|
||||||
"application/vnd.sun.xml.writer.global" => "sxg",
|
"application/vnd.sun.xml.draw" => "sxd",
|
||||||
"application/vnd.sun.xml.impress" => "sxi",
|
"application/vnd.sun.xml.writer.global" => "sxg",
|
||||||
"application/vnd.sun.xml.math" => "sxm",
|
"application/vnd.sun.xml.impress" => "sxi",
|
||||||
"application/vnd.sun.xml.writer" => "sxw",
|
"application/vnd.sun.xml.math" => "sxm",
|
||||||
"application/x-tar" => "tar",
|
"application/vnd.sun.xml.writer" => "sxw",
|
||||||
"application/x-tcl" => "tcl",
|
"application/x-tar" => "tar",
|
||||||
"application/x-tex" => "tex",
|
"application/x-tcl" => "tcl",
|
||||||
"application/x-texinfo" => "texinfo",
|
"application/x-tex" => "tex",
|
||||||
"image/tiff" => "tiff",
|
"application/x-texinfo" => "texinfo",
|
||||||
"image/tiff-fx" => "tiff",
|
"image/tiff" => "tiff",
|
||||||
"application/x-bittorrent" => "torrent",
|
"image/tiff-fx" => "tiff",
|
||||||
"text/tab-separated-values" => "tsv",
|
"application/x-bittorrent" => "torrent",
|
||||||
"application/x-ustar" => "ustar",
|
"text/tab-separated-values" => "tsv",
|
||||||
"application/x-cdlink" => "vcd",
|
"application/x-ustar" => "ustar",
|
||||||
"model/vrml" => "wrl",
|
"application/x-cdlink" => "vcd",
|
||||||
"audio/x-wav" => "wav",
|
"model/vrml" => "wrl",
|
||||||
"audio/x-ms-wax" => "wax",
|
"audio/x-wav" => "wav",
|
||||||
"image/vnd.wap.wbmp" => "wbmp",
|
"audio/x-ms-wax" => "wax",
|
||||||
"application/vnd.wap.wbxml" => "wbxml",
|
"image/vnd.wap.wbmp" => "wbmp",
|
||||||
"video/x-ms-wm" => "wm",
|
"application/vnd.wap.wbxml" => "wbxml",
|
||||||
"audio/x-ms-wma" => "wma",
|
"video/webm" => "webm",
|
||||||
"text/vnd.wap.wml" => "wml",
|
"image/webp" => "webp",
|
||||||
"application/vnd.wap.wmlc" => "wmlc",
|
"video/x-ms-wm" => "wm",
|
||||||
"text/vnd.wap.wmlscript" => "wmls",
|
"audio/x-ms-wma" => "wma",
|
||||||
"application/vnd.wap.wmlscriptc" => "wmlsc",
|
"text/vnd.wap.wml" => "wml",
|
||||||
"video/x-ms-wmv" => "wmv",
|
"application/vnd.wap.wmlc" => "wmlc",
|
||||||
"video/x-ms-wmx" => "wmx",
|
"text/vnd.wap.wmlscript" => "wmls",
|
||||||
"video/x-ms-wvx" => "wvx",
|
"application/vnd.wap.wmlscriptc" => "wmlsc",
|
||||||
"image/x-xbitmap" => "xbm",
|
"video/x-ms-wmv" => "wmv",
|
||||||
"application/xhtml+xml" => "xhtml",
|
"video/x-ms-wmx" => "wmx",
|
||||||
"application/xml" => "xml",
|
"video/x-ms-wvx" => "wvx",
|
||||||
"image/x-xpixmap" => "xpm",
|
"image/x-xbitmap" => "xbm",
|
||||||
"text/xsl" => "xsl",
|
"application/xhtml+xml" => "xhtml",
|
||||||
"image/x-xwindowdump" => "xwd",
|
"application/xml" => "xml",
|
||||||
"chemical/x-xyz" => "xyz",
|
"image/x-xpixmap" => "xpm",
|
||||||
"application/zip" => "zip",
|
"text/xsl" => "xsl",
|
||||||
"application/msword" => "doc",
|
"image/x-xwindowdump" => "xwd",
|
||||||
"application/vnd.openxmlformats-officedocument.wordprocessingml.document" => "docx",
|
"chemical/x-xyz" => "xyz",
|
||||||
"application/vnd.openxmlformats-officedocument.wordprocessingml.template" => "dotx",
|
"application/zip" => "zip",
|
||||||
"application/vnd.ms-word.document.macroEnabled.12" => "docm",
|
"application/msword" => "doc",
|
||||||
"application/vnd.ms-excel" => "xls",
|
"application/vnd.openxmlformats-officedocument.wordprocessingml.document" => "docx",
|
||||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" => "xlsx",
|
"application/vnd.openxmlformats-officedocument.wordprocessingml.template" => "dotx",
|
||||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.template" => "xltx",
|
"application/vnd.ms-word.document.macroEnabled.12" => "docm",
|
||||||
"application/vnd.ms-excel.sheet.macroEnabled.12" => "xlsm",
|
"application/vnd.ms-excel" => "xls",
|
||||||
"application/vnd.ms-excel.template.macroEnabled.12" => "xltm",
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" => "xlsx",
|
||||||
"application/vnd.ms-excel.addin.macroEnabled.12" => "xlam",
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.template" => "xltx",
|
||||||
"application/vnd.ms-excel.sheet.binary.macroEnabled.12" => "xlsb",
|
"application/vnd.ms-excel.sheet.macroEnabled.12" => "xlsm",
|
||||||
"application/vnd.openxmlformats-officedocument.presentationml.presentation" => "pptx",
|
"application/vnd.ms-excel.template.macroEnabled.12" => "xltm",
|
||||||
"application/vnd.openxmlformats-officedocument.presentationml.template" => "potx",
|
"application/vnd.ms-excel.addin.macroEnabled.12" => "xlam",
|
||||||
"application/vnd.openxmlformats-officedocument.presentationml.slideshow" => "ppsx",
|
"application/vnd.ms-excel.sheet.binary.macroEnabled.12" => "xlsb",
|
||||||
"application/vnd.ms-powerpoint.addin.macroEnabled.12" => "ppam",
|
"application/vnd.openxmlformats-officedocument.presentationml.presentation" => "pptx",
|
||||||
"application/vnd.ms-powerpoint.presentation.macroEnabled.12" => "pptm",
|
"application/vnd.openxmlformats-officedocument.presentationml.template" => "potx",
|
||||||
"application/vnd.ms-powerpoint.template.macroEnabled.12" => "potm",
|
"application/vnd.openxmlformats-officedocument.presentationml.slideshow" => "ppsx",
|
||||||
"application/vnd.ms-powerpoint.slideshow.macroEnabled.12" => "ppsm",
|
"application/vnd.ms-powerpoint.addin.macroEnabled.12" => "ppam",
|
||||||
|
"application/vnd.ms-powerpoint.presentation.macroEnabled.12" => "pptm",
|
||||||
|
"application/vnd.ms-powerpoint.template.macroEnabled.12" => "potm",
|
||||||
|
"application/vnd.ms-powerpoint.slideshow.macroEnabled.12" => "ppsm",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
if ( ! function_exists('get_extension_from_mime'))
|
if ( ! function_exists('get_extension_from_mime'))
|
||||||
{
|
{
|
||||||
function get_extension_from_mime($mime){
|
function get_extension_from_mime($mime){
|
||||||
global $mime_types;
|
global $mime_types;
|
||||||
if(strpos($mime, ';')!==FALSE){
|
if(strpos($mime, ';')!==FALSE){
|
||||||
$mime = substr($mime, 0,strpos($mime, ';'));
|
$mime = substr($mime, 0,strpos($mime, ';'));
|
||||||
}
|
}
|
||||||
if(isset($mime_types[$mime])){
|
if(isset($mime_types[$mime])){
|
||||||
return $mime_types[$mime];
|
return $mime_types[$mime];
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! function_exists('get_file_mime_type'))
|
if ( ! function_exists('get_file_mime_type'))
|
||||||
{
|
{
|
||||||
function get_file_mime_type($filename, $debug = false)
|
function get_file_mime_type($filename, $debug = false)
|
||||||
{
|
{
|
||||||
if (function_exists('finfo_open') && function_exists('finfo_file') && function_exists('finfo_close'))
|
if (function_exists('finfo_open') && function_exists('finfo_file') && function_exists('finfo_close'))
|
||||||
{
|
{
|
||||||
$fileinfo = finfo_open(FILEINFO_MIME_TYPE);
|
$fileinfo = finfo_open(FILEINFO_MIME_TYPE);
|
||||||
$mime_type = finfo_file($fileinfo, $filename);
|
$mime_type = finfo_file($fileinfo, $filename);
|
||||||
finfo_close($fileinfo);
|
finfo_close($fileinfo);
|
||||||
|
|
||||||
if ( ! empty($mime_type))
|
if ( ! empty($mime_type))
|
||||||
{
|
{
|
||||||
if (true === $debug)
|
if (true === $debug)
|
||||||
{
|
{
|
||||||
return array( 'mime_type' => $mime_type, 'method' => 'fileinfo' );
|
return array( 'mime_type' => $mime_type, 'method' => 'fileinfo' );
|
||||||
}
|
}
|
||||||
|
|
||||||
return $mime_type;
|
return $mime_type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (function_exists('mime_content_type'))
|
if (function_exists('mime_content_type'))
|
||||||
{
|
{
|
||||||
$mime_type = mime_content_type($filename);
|
$mime_type = mime_content_type($filename);
|
||||||
|
|
||||||
if ( ! empty($mime_type))
|
if ( ! empty($mime_type))
|
||||||
{
|
{
|
||||||
if (true === $debug)
|
if (true === $debug)
|
||||||
{
|
{
|
||||||
return array( 'mime_type' => $mime_type, 'method' => 'mime_content_type' );
|
return array( 'mime_type' => $mime_type, 'method' => 'mime_content_type' );
|
||||||
}
|
}
|
||||||
|
|
||||||
return $mime_type;
|
return $mime_type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
global $mime_types;
|
global $mime_types;
|
||||||
$mime_types = array_flip($mime_types);
|
$mime_types = array_flip($mime_types);
|
||||||
|
|
||||||
$tmp_array = explode('.', $filename);
|
$tmp_array = explode('.', $filename);
|
||||||
$ext = strtolower(array_pop($tmp_array));
|
$ext = strtolower(array_pop($tmp_array));
|
||||||
|
|
||||||
if ( ! empty($mime_types[ $ext ]))
|
if ( ! empty($mime_types[ $ext ]))
|
||||||
{
|
{
|
||||||
if (true === $debug)
|
if (true === $debug)
|
||||||
{
|
{
|
||||||
return array( 'mime_type' => $mime_types[ $ext ], 'method' => 'from_array' );
|
return array( 'mime_type' => $mime_types[ $ext ], 'method' => 'from_array' );
|
||||||
}
|
}
|
||||||
|
|
||||||
return $mime_types[ $ext ];
|
return $mime_types[ $ext ];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (true === $debug)
|
if (true === $debug)
|
||||||
{
|
{
|
||||||
return array( 'mime_type' => 'application/octet-stream', 'method' => 'last_resort' );
|
return array( 'mime_type' => 'application/octet-stream', 'method' => 'last_resort' );
|
||||||
}
|
}
|
||||||
|
|
||||||
return 'application/octet-stream';
|
return 'application/octet-stream';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
5719
core/vendor/filemanager/include/php_image_magician.php
vendored
5719
core/vendor/filemanager/include/php_image_magician.php
vendored
File diff suppressed because it is too large
Load Diff
2166
core/vendor/filemanager/include/utils.php
vendored
2166
core/vendor/filemanager/include/utils.php
vendored
File diff suppressed because it is too large
Load Diff
66
core/vendor/filemanager/upload.php
vendored
66
core/vendor/filemanager/upload.php
vendored
@ -50,8 +50,21 @@ try {
|
|||||||
$cycle = false;
|
$cycle = false;
|
||||||
}
|
}
|
||||||
if (file_exists($path . "config.php")) {
|
if (file_exists($path . "config.php")) {
|
||||||
|
$configMain = $config;
|
||||||
$configTemp = include $path . 'config.php';
|
$configTemp = include $path . 'config.php';
|
||||||
$config = array_merge($config, $configTemp);
|
if(is_array($configTemp) && count($configTemp) > 0){
|
||||||
|
$config = array_merge($configMain, $configTemp);
|
||||||
|
$config['ext'] = array_merge(
|
||||||
|
$config['ext_img'],
|
||||||
|
$config['ext_file'],
|
||||||
|
$config['ext_misc'],
|
||||||
|
$config['ext_video'],
|
||||||
|
$config['ext_music']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$config = $configMain;
|
||||||
|
}
|
||||||
//TODO switch to array
|
//TODO switch to array
|
||||||
$cycle = false;
|
$cycle = false;
|
||||||
}
|
}
|
||||||
@ -63,35 +76,36 @@ try {
|
|||||||
if (trans("Upload_error_messages") !== "Upload_error_messages") {
|
if (trans("Upload_error_messages") !== "Upload_error_messages") {
|
||||||
$messages = trans("Upload_error_messages");
|
$messages = trans("Upload_error_messages");
|
||||||
}
|
}
|
||||||
|
if ($config['url_upload']) {
|
||||||
|
// make sure the length is limited to avoid DOS attacks
|
||||||
|
if (isset($_POST['url']) && strlen($_POST['url']) < 2000) {
|
||||||
|
$url = $_POST['url'];
|
||||||
|
$urlPattern = '/^(https?:\/\/)?([\da-z\.-]+\.[a-z\.]{2,6}|[\d\.]+)([\/?=&#]{1}[\da-z\.-]+)*[\/\?]?$/i';
|
||||||
|
|
||||||
// make sure the length is limited to avoid DOS attacks
|
if (preg_match($urlPattern, $url)) {
|
||||||
if (isset($_POST['url']) && strlen($_POST['url']) < 2000) {
|
$temp = tempnam('/tmp', 'RF');
|
||||||
$url = $_POST['url'];
|
|
||||||
$urlPattern = '/^(https?:\/\/)?([\da-z\.-]+\.[a-z\.]{2,6}|[\d\.]+)([\/?=&#]{1}[\da-z\.-]+)*[\/\?]?$/i';
|
|
||||||
|
|
||||||
if (preg_match($urlPattern, $url)) {
|
$ch = curl_init($url);
|
||||||
$temp = tempnam('/tmp','RF');
|
$fp = fopen($temp, 'wb');
|
||||||
|
curl_setopt($ch, CURLOPT_FILE, $fp);
|
||||||
$ch = curl_init($url);
|
curl_setopt($ch, CURLOPT_HEADER, 0);
|
||||||
$fp = fopen($temp, 'wb');
|
curl_exec($ch);
|
||||||
curl_setopt($ch, CURLOPT_FILE, $fp);
|
if (curl_errno($ch)) {
|
||||||
curl_setopt($ch, CURLOPT_HEADER, 0);
|
curl_close($ch);
|
||||||
curl_exec($ch);
|
throw new Exception('Invalid URL');
|
||||||
if (curl_errno($ch)) {
|
}
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
throw new Exception('Invalid URL');
|
fclose($fp);
|
||||||
}
|
|
||||||
curl_close($ch);
|
|
||||||
fclose($fp);
|
|
||||||
|
|
||||||
$_FILES['files'] = array(
|
$_FILES['files'] = array(
|
||||||
'name' => array(basename($_POST['url'])),
|
'name' => array(basename($_POST['url'])),
|
||||||
'tmp_name' => array($temp),
|
'tmp_name' => array($temp),
|
||||||
'size' => array(filesize($temp)),
|
'size' => array(filesize($temp)),
|
||||||
'type' => null
|
'type' => null
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
throw new Exception('Is not a valid URL.');
|
throw new Exception('Is not a valid URL.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user