Merge branch '11200' of https://forge.chapril.org/ZwiiCMS-Team/ZwiiCMS into 11200
commit
8310343886
File diff suppressed because it is too large
Load Diff
@ -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;
|
||||
}
|
@ -1,249 +1,252 @@
|
||||
<?php
|
||||
$mime_types = array(
|
||||
"application/postscript" => "ps",
|
||||
"audio/x-aiff" => "aiff",
|
||||
"text/plain" => "txt",
|
||||
"video/x-ms-asf" => "asx",
|
||||
"audio/basic" => "snd",
|
||||
"video/x-msvideo" => "avi",
|
||||
"application/x-bcpio" => "bcpio",
|
||||
"application/octet-stream" => "so",
|
||||
"image/bmp" => "bmp",
|
||||
"application/x-rar" => "rar",
|
||||
"application/x-bzip2" => "bz2",
|
||||
"application/x-netcdf" => "nc",
|
||||
"application/x-kchart" => "chrt",
|
||||
"application/x-cpio" => "cpio",
|
||||
"application/mac-compactpro" => "cpt",
|
||||
"application/x-csh" => "csh",
|
||||
"text/css" => "css",
|
||||
"application/x-director" => "dxr",
|
||||
"image/vnd.djvu" => "djvu",
|
||||
"application/x-dvi" => "dvi",
|
||||
"image/vnd.dwg" => "dwg",
|
||||
"application/epub" => "epub",
|
||||
"application/epub+zip" => "epub",
|
||||
"text/x-setext" => "etx",
|
||||
"application/andrew-inset" => "ez",
|
||||
"video/x-flv" => "flv",
|
||||
"image/gif" => "gif",
|
||||
"application/x-gtar" => "gtar",
|
||||
"application/x-gzip" => "tgz",
|
||||
"application/x-hdf" => "hdf",
|
||||
"application/mac-binhex40" => "hqx",
|
||||
"text/html" => "html",
|
||||
"text/htm" => "htm",
|
||||
"x-conference/x-cooltalk" => "ice",
|
||||
"image/ief" => "ief",
|
||||
"model/iges" => "igs",
|
||||
"text/vnd.sun.j2me.app-descriptor" => "jad",
|
||||
"application/x-java-archive" => "jar",
|
||||
"application/x-java-jnlp-file" => "jnlp",
|
||||
"image/jpeg" => "jpg",
|
||||
"application/x-javascript" => "js",
|
||||
"audio/midi" => "midi",
|
||||
"application/x-killustrator" => "kil",
|
||||
"application/x-kpresenter" => "kpt",
|
||||
"application/x-kspread" => "ksp",
|
||||
"application/x-kword" => "kwt",
|
||||
"application/vnd.google-earth.kml+xml" => "kml",
|
||||
"application/vnd.google-earth.kmz" => "kmz",
|
||||
"application/x-latex" => "latex",
|
||||
"audio/x-mpegurl" => "m3u",
|
||||
"application/x-troff-man" => "man",
|
||||
"application/x-troff-me" => "me",
|
||||
"model/mesh" => "silo",
|
||||
"application/vnd.mif" => "mif",
|
||||
"video/quicktime" => "mov",
|
||||
"video/x-sgi-movie" => "movie",
|
||||
"audio/mpeg" => "mp3",
|
||||
"video/mp4" => "mp4",
|
||||
"video/mpeg" => "mpeg",
|
||||
"application/x-troff-ms" => "ms",
|
||||
"video/vnd.mpegurl" => "mxu",
|
||||
"application/vnd.oasis.opendocument.database" => "odb",
|
||||
"application/vnd.oasis.opendocument.chart" => "odc",
|
||||
"application/vnd.oasis.opendocument.formula" => "odf",
|
||||
"application/vnd.oasis.opendocument.graphics" => "odg",
|
||||
"application/vnd.oasis.opendocument.image" => "odi",
|
||||
"application/vnd.oasis.opendocument.text-master" => "odm",
|
||||
"application/vnd.oasis.opendocument.presentation" => "odp",
|
||||
"application/vnd.oasis.opendocument.spreadsheet" => "ods",
|
||||
"application/vnd.oasis.opendocument.text" => "odt",
|
||||
"application/ogg" => "ogg",
|
||||
"video/ogg" => "ogv",
|
||||
"application/vnd.oasis.opendocument.graphics-template" => "otg",
|
||||
"application/vnd.oasis.opendocument.text-web" => "oth",
|
||||
"application/vnd.oasis.opendocument.presentation-template" => "otp",
|
||||
"application/vnd.oasis.opendocument.spreadsheet-template" => "ots",
|
||||
"application/vnd.oasis.opendocument.text-template" => "ott",
|
||||
"image/x-portable-bitmap" => "pbm",
|
||||
"chemical/x-pdb" => "pdb",
|
||||
"application/pdf" => "pdf",
|
||||
"image/x-portable-graymap" => "pgm",
|
||||
"application/x-chess-pgn" => "pgn",
|
||||
"text/x-php" => "php",
|
||||
"image/png" => "png",
|
||||
"image/x-portable-anymap" => "pnm",
|
||||
"image/x-portable-pixmap" => "ppm",
|
||||
"application/vnd.ms-powerpoint" => "ppt",
|
||||
"audio/x-realaudio" => "ra",
|
||||
"audio/x-pn-realaudio" => "rm",
|
||||
"image/x-cmu-raster" => "ras",
|
||||
"image/x-rgb" => "rgb",
|
||||
"application/x-troff" => "tr",
|
||||
"application/x-rpm" => "rpm",
|
||||
"text/rtf" => "rtf",
|
||||
"text/richtext" => "rtx",
|
||||
"text/sgml" => "sgml",
|
||||
"application/x-sh" => "sh",
|
||||
"application/x-shar" => "shar",
|
||||
"application/vnd.symbian.install" => "sis",
|
||||
"application/x-stuffit" => "sit",
|
||||
"application/x-koan" => "skt",
|
||||
"application/smil" => "smil",
|
||||
"image/svg+xml" => "svg",
|
||||
"application/x-futuresplash" => "spl",
|
||||
"application/x-wais-source" => "src",
|
||||
"application/vnd.sun.xml.calc.template" => "stc",
|
||||
"application/vnd.sun.xml.draw.template" => "std",
|
||||
"application/vnd.sun.xml.impress.template" => "sti",
|
||||
"application/vnd.sun.xml.writer.template" => "stw",
|
||||
"application/x-sv4cpio" => "sv4cpio",
|
||||
"application/x-sv4crc" => "sv4crc",
|
||||
"application/x-shockwave-flash" => "swf",
|
||||
"application/vnd.sun.xml.calc" => "sxc",
|
||||
"application/vnd.sun.xml.draw" => "sxd",
|
||||
"application/vnd.sun.xml.writer.global" => "sxg",
|
||||
"application/vnd.sun.xml.impress" => "sxi",
|
||||
"application/vnd.sun.xml.math" => "sxm",
|
||||
"application/vnd.sun.xml.writer" => "sxw",
|
||||
"application/x-tar" => "tar",
|
||||
"application/x-tcl" => "tcl",
|
||||
"application/x-tex" => "tex",
|
||||
"application/x-texinfo" => "texinfo",
|
||||
"image/tiff" => "tiff",
|
||||
"image/tiff-fx" => "tiff",
|
||||
"application/x-bittorrent" => "torrent",
|
||||
"text/tab-separated-values" => "tsv",
|
||||
"application/x-ustar" => "ustar",
|
||||
"application/x-cdlink" => "vcd",
|
||||
"model/vrml" => "wrl",
|
||||
"audio/x-wav" => "wav",
|
||||
"audio/x-ms-wax" => "wax",
|
||||
"image/vnd.wap.wbmp" => "wbmp",
|
||||
"application/vnd.wap.wbxml" => "wbxml",
|
||||
"video/x-ms-wm" => "wm",
|
||||
"audio/x-ms-wma" => "wma",
|
||||
"text/vnd.wap.wml" => "wml",
|
||||
"application/vnd.wap.wmlc" => "wmlc",
|
||||
"text/vnd.wap.wmlscript" => "wmls",
|
||||
"application/vnd.wap.wmlscriptc" => "wmlsc",
|
||||
"video/x-ms-wmv" => "wmv",
|
||||
"video/x-ms-wmx" => "wmx",
|
||||
"video/x-ms-wvx" => "wvx",
|
||||
"image/x-xbitmap" => "xbm",
|
||||
"application/xhtml+xml" => "xhtml",
|
||||
"application/xml" => "xml",
|
||||
"image/x-xpixmap" => "xpm",
|
||||
"text/xsl" => "xsl",
|
||||
"image/x-xwindowdump" => "xwd",
|
||||
"chemical/x-xyz" => "xyz",
|
||||
"application/zip" => "zip",
|
||||
"application/msword" => "doc",
|
||||
"application/vnd.openxmlformats-officedocument.wordprocessingml.document" => "docx",
|
||||
"application/vnd.openxmlformats-officedocument.wordprocessingml.template" => "dotx",
|
||||
"application/vnd.ms-word.document.macroEnabled.12" => "docm",
|
||||
"application/vnd.ms-excel" => "xls",
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" => "xlsx",
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.template" => "xltx",
|
||||
"application/vnd.ms-excel.sheet.macroEnabled.12" => "xlsm",
|
||||
"application/vnd.ms-excel.template.macroEnabled.12" => "xltm",
|
||||
"application/vnd.ms-excel.addin.macroEnabled.12" => "xlam",
|
||||
"application/vnd.ms-excel.sheet.binary.macroEnabled.12" => "xlsb",
|
||||
"application/vnd.openxmlformats-officedocument.presentationml.presentation" => "pptx",
|
||||
"application/vnd.openxmlformats-officedocument.presentationml.template" => "potx",
|
||||
"application/vnd.openxmlformats-officedocument.presentationml.slideshow" => "ppsx",
|
||||
"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",
|
||||
"application/postscript" => "ps",
|
||||
"audio/x-aiff" => "aiff",
|
||||
"text/plain" => "txt",
|
||||
"video/x-ms-asf" => "asx",
|
||||
"audio/basic" => "snd",
|
||||
"video/x-msvideo" => "avi",
|
||||
"application/x-bcpio" => "bcpio",
|
||||
"application/octet-stream" => "so",
|
||||
"image/bmp" => "bmp",
|
||||
"application/x-rar" => "rar",
|
||||
"application/x-bzip2" => "bz2",
|
||||
"application/x-netcdf" => "nc",
|
||||
"application/x-kchart" => "chrt",
|
||||
"application/x-cpio" => "cpio",
|
||||
"application/mac-compactpro" => "cpt",
|
||||
"application/x-csh" => "csh",
|
||||
"text/css" => "css",
|
||||
"text/csv" => "csv",
|
||||
"application/x-director" => "dxr",
|
||||
"image/vnd.djvu" => "djvu",
|
||||
"application/x-dvi" => "dvi",
|
||||
"image/vnd.dwg" => "dwg",
|
||||
"application/epub" => "epub",
|
||||
"application/epub+zip" => "epub",
|
||||
"text/x-setext" => "etx",
|
||||
"application/andrew-inset" => "ez",
|
||||
"video/x-flv" => "flv",
|
||||
"image/gif" => "gif",
|
||||
"application/x-gtar" => "gtar",
|
||||
"application/x-gzip" => "tgz",
|
||||
"application/x-hdf" => "hdf",
|
||||
"application/mac-binhex40" => "hqx",
|
||||
"text/html" => "html",
|
||||
"text/htm" => "htm",
|
||||
"x-conference/x-cooltalk" => "ice",
|
||||
"image/ief" => "ief",
|
||||
"model/iges" => "igs",
|
||||
"text/vnd.sun.j2me.app-descriptor" => "jad",
|
||||
"application/x-java-archive" => "jar",
|
||||
"application/x-java-jnlp-file" => "jnlp",
|
||||
"image/jpeg" => "jpg",
|
||||
"application/x-javascript" => "js",
|
||||
"audio/midi" => "midi",
|
||||
"application/x-killustrator" => "kil",
|
||||
"application/x-kpresenter" => "kpt",
|
||||
"application/x-kspread" => "ksp",
|
||||
"application/x-kword" => "kwt",
|
||||
"application/vnd.google-earth.kml+xml" => "kml",
|
||||
"application/vnd.google-earth.kmz" => "kmz",
|
||||
"application/x-latex" => "latex",
|
||||
"audio/x-mpegurl" => "m3u",
|
||||
"application/x-troff-man" => "man",
|
||||
"application/x-troff-me" => "me",
|
||||
"model/mesh" => "silo",
|
||||
"application/vnd.mif" => "mif",
|
||||
"video/quicktime" => "mov",
|
||||
"video/x-sgi-movie" => "movie",
|
||||
"audio/mpeg" => "mp3",
|
||||
"video/mp4" => "mp4",
|
||||
"video/mpeg" => "mpeg",
|
||||
"application/x-troff-ms" => "ms",
|
||||
"video/vnd.mpegurl" => "mxu",
|
||||
"application/vnd.oasis.opendocument.database" => "odb",
|
||||
"application/vnd.oasis.opendocument.chart" => "odc",
|
||||
"application/vnd.oasis.opendocument.formula" => "odf",
|
||||
"application/vnd.oasis.opendocument.graphics" => "odg",
|
||||
"application/vnd.oasis.opendocument.image" => "odi",
|
||||
"application/vnd.oasis.opendocument.text-master" => "odm",
|
||||
"application/vnd.oasis.opendocument.presentation" => "odp",
|
||||
"application/vnd.oasis.opendocument.spreadsheet" => "ods",
|
||||
"application/vnd.oasis.opendocument.text" => "odt",
|
||||
"application/ogg" => "ogg",
|
||||
"video/ogg" => "ogv",
|
||||
"application/vnd.oasis.opendocument.graphics-template" => "otg",
|
||||
"application/vnd.oasis.opendocument.text-web" => "oth",
|
||||
"application/vnd.oasis.opendocument.presentation-template" => "otp",
|
||||
"application/vnd.oasis.opendocument.spreadsheet-template" => "ots",
|
||||
"application/vnd.oasis.opendocument.text-template" => "ott",
|
||||
"image/x-portable-bitmap" => "pbm",
|
||||
"chemical/x-pdb" => "pdb",
|
||||
"application/pdf" => "pdf",
|
||||
"image/x-portable-graymap" => "pgm",
|
||||
"application/x-chess-pgn" => "pgn",
|
||||
"text/x-php" => "php",
|
||||
"image/png" => "png",
|
||||
"image/x-portable-anymap" => "pnm",
|
||||
"image/x-portable-pixmap" => "ppm",
|
||||
"application/vnd.ms-powerpoint" => "ppt",
|
||||
"audio/x-realaudio" => "ra",
|
||||
"audio/x-pn-realaudio" => "rm",
|
||||
"image/x-cmu-raster" => "ras",
|
||||
"image/x-rgb" => "rgb",
|
||||
"application/x-troff" => "tr",
|
||||
"application/x-rpm" => "rpm",
|
||||
"text/rtf" => "rtf",
|
||||
"text/richtext" => "rtx",
|
||||
"text/sgml" => "sgml",
|
||||
"application/x-sh" => "sh",
|
||||
"application/x-shar" => "shar",
|
||||
"application/vnd.symbian.install" => "sis",
|
||||
"application/x-stuffit" => "sit",
|
||||
"application/x-koan" => "skt",
|
||||
"application/smil" => "smil",
|
||||
"image/svg+xml" => "svg",
|
||||
"application/x-futuresplash" => "spl",
|
||||
"application/x-wais-source" => "src",
|
||||
"application/vnd.sun.xml.calc.template" => "stc",
|
||||
"application/vnd.sun.xml.draw.template" => "std",
|
||||
"application/vnd.sun.xml.impress.template" => "sti",
|
||||
"application/vnd.sun.xml.writer.template" => "stw",
|
||||
"application/x-sv4cpio" => "sv4cpio",
|
||||
"application/x-sv4crc" => "sv4crc",
|
||||
"application/x-shockwave-flash" => "swf",
|
||||
"application/vnd.sun.xml.calc" => "sxc",
|
||||
"application/vnd.sun.xml.draw" => "sxd",
|
||||
"application/vnd.sun.xml.writer.global" => "sxg",
|
||||
"application/vnd.sun.xml.impress" => "sxi",
|
||||
"application/vnd.sun.xml.math" => "sxm",
|
||||
"application/vnd.sun.xml.writer" => "sxw",
|
||||
"application/x-tar" => "tar",
|
||||
"application/x-tcl" => "tcl",
|
||||
"application/x-tex" => "tex",
|
||||
"application/x-texinfo" => "texinfo",
|
||||
"image/tiff" => "tiff",
|
||||
"image/tiff-fx" => "tiff",
|
||||
"application/x-bittorrent" => "torrent",
|
||||
"text/tab-separated-values" => "tsv",
|
||||
"application/x-ustar" => "ustar",
|
||||
"application/x-cdlink" => "vcd",
|
||||
"model/vrml" => "wrl",
|
||||
"audio/x-wav" => "wav",
|
||||
"audio/x-ms-wax" => "wax",
|
||||
"image/vnd.wap.wbmp" => "wbmp",
|
||||
"application/vnd.wap.wbxml" => "wbxml",
|
||||
"video/webm" => "webm",
|
||||
"image/webp" => "webp",
|
||||
"video/x-ms-wm" => "wm",
|
||||
"audio/x-ms-wma" => "wma",
|
||||
"text/vnd.wap.wml" => "wml",
|
||||
"application/vnd.wap.wmlc" => "wmlc",
|
||||
"text/vnd.wap.wmlscript" => "wmls",
|
||||
"application/vnd.wap.wmlscriptc" => "wmlsc",
|
||||
"video/x-ms-wmv" => "wmv",
|
||||
"video/x-ms-wmx" => "wmx",
|
||||
"video/x-ms-wvx" => "wvx",
|
||||
"image/x-xbitmap" => "xbm",
|
||||
"application/xhtml+xml" => "xhtml",
|
||||
"application/xml" => "xml",
|
||||
"image/x-xpixmap" => "xpm",
|
||||
"text/xsl" => "xsl",
|
||||
"image/x-xwindowdump" => "xwd",
|
||||
"chemical/x-xyz" => "xyz",
|
||||
"application/zip" => "zip",
|
||||
"application/msword" => "doc",
|
||||
"application/vnd.openxmlformats-officedocument.wordprocessingml.document" => "docx",
|
||||
"application/vnd.openxmlformats-officedocument.wordprocessingml.template" => "dotx",
|
||||
"application/vnd.ms-word.document.macroEnabled.12" => "docm",
|
||||
"application/vnd.ms-excel" => "xls",
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" => "xlsx",
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.template" => "xltx",
|
||||
"application/vnd.ms-excel.sheet.macroEnabled.12" => "xlsm",
|
||||
"application/vnd.ms-excel.template.macroEnabled.12" => "xltm",
|
||||
"application/vnd.ms-excel.addin.macroEnabled.12" => "xlam",
|
||||
"application/vnd.ms-excel.sheet.binary.macroEnabled.12" => "xlsb",
|
||||
"application/vnd.openxmlformats-officedocument.presentationml.presentation" => "pptx",
|
||||
"application/vnd.openxmlformats-officedocument.presentationml.template" => "potx",
|
||||
"application/vnd.openxmlformats-officedocument.presentationml.slideshow" => "ppsx",
|
||||
"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",
|
||||