Subversion-Projekte lars-tiefland.ci

Revision

Revision 1257 | Revision 2107 | Zur aktuellen Revision | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 1257 Revision 2049
Zeile 4... Zeile 4...
4
 *
4
 *
5
 * An open source application development framework for PHP
5
 * An open source application development framework for PHP
6
 *
6
 *
7
 * This content is released under the MIT License (MIT)
7
 * This content is released under the MIT License (MIT)
8
 *
8
 *
9
 * Copyright (c) 2014 - 2016, British Columbia Institute of Technology
9
 * Copyright (c) 2014 - 2017, British Columbia Institute of Technology
10
 *
10
 *
11
 * Permission is hereby granted, free of charge, to any person obtaining a copy
11
 * Permission is hereby granted, free of charge, to any person obtaining a copy
12
 * of this software and associated documentation files (the "Software"), to deal
12
 * of this software and associated documentation files (the "Software"), to deal
13
 * in the Software without restriction, including without limitation the rights
13
 * in the Software without restriction, including without limitation the rights
14
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
Zeile 27... Zeile 27...
27
 * THE SOFTWARE.
27
 * THE SOFTWARE.
28
 *
28
 *
29
 * @package	CodeIgniter
29
 * @package	CodeIgniter
30
 * @author	EllisLab Dev Team
30
 * @author	EllisLab Dev Team
31
 * @copyright	Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
31
 * @copyright	Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
32
 * @copyright	Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
32
 * @copyright	Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/)
33
 * @license	http://opensource.org/licenses/MIT	MIT License
33
 * @license	http://opensource.org/licenses/MIT	MIT License
34
 * @link	https://codeigniter.com
34
 * @link	https://codeigniter.com
35
 * @since	Version 1.0.0
35
 * @since	Version 1.0.0
36
 * @filesource
36
 * @filesource
37
 */
37
 */
Zeile 1216... Zeile 1216...
1216
	protected function _file_mime_type($file)
1216
	protected function _file_mime_type($file)
1217
	{
1217
	{
1218
		// We'll need this to validate the MIME info string (e.g. text/plain; charset=us-ascii)
1218
		// We'll need this to validate the MIME info string (e.g. text/plain; charset=us-ascii)
1219
		$regexp = '/^([a-z\-]+\/[a-z0-9\-\.\+]+)(;\s.+)?$/';
1219
		$regexp = '/^([a-z\-]+\/[a-z0-9\-\.\+]+)(;\s.+)?$/';
Zeile -... Zeile 1220...
-
 
1220
 
1220
 
1221
		/**
1221
		// Fileinfo extension - most reliable method
-
 
1222
		$finfo = @finfo_open(FILEINFO_MIME);
-
 
1223
		if (is_resource($finfo)) // It is possible that a FALSE value is returned, if there is no magic MIME database file found on the system
1222
		 * Fileinfo extension - most reliable method
1224
		{
1223
		 *
1225
			$mime = @finfo_file($finfo, $file['tmp_name']);
-
 
1226
			finfo_close($finfo);
-
 
1227
 
1224
		 * Apparently XAMPP, CentOS, cPanel and who knows what
1228
			/* According to the comments section of the PHP manual page,
1225
		 * other PHP distribution channels EXPLICITLY DISABLE
1229
			 * it is possible that this function returns an empty string
1226
		 * ext/fileinfo, which is otherwise enabled by default
1230
			 * for some files (e.g. if they don't exist in the magic MIME database)
1227
		 * since PHP 5.3 ...
1231
			 */
1228
		 */
-
 
1229
		if (function_exists('finfo_file'))
-
 
1230
		{
-
 
1231
			$finfo = @finfo_open(FILEINFO_MIME);
1232
			if (is_string($mime) && preg_match($regexp, $mime, $matches))
1232
			if (is_resource($finfo)) // It is possible that a FALSE value is returned, if there is no magic MIME database file found on the system
-
 
1233
			{
-
 
1234
				$mime = @finfo_file($finfo, $file['tmp_name']);
-
 
1235
				finfo_close($finfo);
-
 
1236
 
-
 
1237
				/* According to the comments section of the PHP manual page,
-
 
1238
				 * it is possible that this function returns an empty string
-
 
1239
				 * for some files (e.g. if they don't exist in the magic MIME database)
-
 
1240
				 */
-
 
1241
				if (is_string($mime) && preg_match($regexp, $mime, $matches))
1233
			{
1242
				{
1234
				$this->file_type = $matches[1];
1243
					$this->file_type = $matches[1];
-
 
1244
					return;
1235
				return;
1245
				}
1236
			}
1246
			}
Zeile 1237... Zeile 1247...
1237
		}
1247
		}
1238
 
1248