| | |
| | | header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
| | | header("Cache-Control: private, must-revalidate, post-check=0, pre-check=0"); |
| | | header("Pragma: no-cache"); |
| | | // Request browser to disable DNS prefetching (CVE-2010-0464) |
| | | header("X-DNS-Prefetch-Control: off"); |
| | | |
| | | // We need to set the following headers to make downloads work using IE in HTTPS mode. |
| | | if (rcube_https_check()) { |
| | |
| | | $mime_type = $mime_ext[$suffix]; |
| | | } |
| | | // try fileinfo extension if available |
| | | if (!$mime_type) { |
| | | if (!extension_loaded('fileinfo')) { |
| | | @dl('fileinfo.' . PHP_SHLIB_SUFFIX); |
| | | } |
| | | if (function_exists('finfo_open')) { |
| | | if ($finfo = finfo_open(FILEINFO_MIME, $mime_magic)) { |
| | | $mime_type = finfo_file($finfo, $path); |
| | | finfo_close($finfo); |
| | | } |
| | | if (!$mime_type && function_exists('finfo_open')) { |
| | | if ($finfo = finfo_open(FILEINFO_MIME, $mime_magic)) { |
| | | $mime_type = finfo_file($finfo, $path); |
| | | finfo_close($finfo); |
| | | } |
| | | } |
| | | // try PHP's mime_content_type |
| | | if (!$mime_type && function_exists('mime_content_type')) { |
| | | $mime_type = mime_content_type($path); |
| | | $mime_type = mime_content_type($path); |
| | | } |
| | | // fall back to user-submitted string |
| | | if (!$mime_type) { |
| | |
| | | { |
| | | $input = rc_utf8_clean($input); |
| | | |
| | | return json_encode($input); |
| | | // sometimes even using rc_utf8_clean() the input contains invalid UTF-8 sequences |
| | | // that's why we have @ here |
| | | return @json_encode($input); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | /** |
| | | * Get all keys from array (recursive) |
| | | * |
| | | * @param array Input array |
| | | * @return array |
| | | */ |
| | | function array_keys_recursive($array) |
| | | { |
| | | $keys = array(); |
| | | |
| | | if (!empty($array)) |
| | | foreach ($array as $key => $child) { |
| | | $keys[] = $key; |
| | | if ($children = array_keys_recursive($child)) |
| | | $keys = array_merge($keys, $children); |
| | | } |
| | | return $keys; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * mbstring replacement functions |
| | | */ |
| | | |