git://git.onelab.eu
/
www-register-wizard.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
upgrade to codeigniter 1.7.2 for f12
[www-register-wizard.git]
/
libraries
/
Upload.php
diff --git
a/libraries/Upload.php
b/libraries/Upload.php
index
54124bc
..
618c49b
100644
(file)
--- a/
libraries/Upload.php
+++ b/
libraries/Upload.php
@@
-6,7
+6,7
@@
*
* @package CodeIgniter
* @author ExpressionEngine Dev Team
*
* @package CodeIgniter
* @author ExpressionEngine Dev Team
- * @copyright Copyright (c) 2008, EllisLab, Inc.
+ * @copyright Copyright (c) 2008
- 2009
, EllisLab, Inc.
* @license http://codeigniter.com/user_guide/license.html
* @link http://codeigniter.com
* @since Version 1.0
* @license http://codeigniter.com/user_guide/license.html
* @link http://codeigniter.com
* @since Version 1.0
@@
-556,11
+556,22
@@
class CI_Upload {
$this->set_error('upload_no_file_types');
return FALSE;
}
$this->set_error('upload_no_file_types');
return FALSE;
}
-
+
+ $image_types = array('gif', 'jpg', 'jpeg', 'png', 'jpe');
+
foreach ($this->allowed_types as $val)
{
$mime = $this->mimes_types(strtolower($val));
foreach ($this->allowed_types as $val)
{
$mime = $this->mimes_types(strtolower($val));
-
+
+ // Images get some additional checks
+ if (in_array($val, $image_types))
+ {
+ if (getimagesize($this->file_temp) === FALSE)
+ {
+ return FALSE;
+ }
+ }
+
if (is_array($mime))
{
if (in_array($this->file_type, $mime, TRUE))
if (is_array($mime))
{
if (in_array($this->file_type, $mime, TRUE))
@@
-900,11
+911,11
@@
class CI_Upload {
{
return $filename;
}
{
return $filename;
}
-
+
$parts = explode('.', $filename);
$ext = array_pop($parts);
$filename = array_shift($parts);
$parts = explode('.', $filename);
$ext = array_pop($parts);
$filename = array_shift($parts);
-
+
foreach ($parts as $part)
{
if ($this->mimes_types(strtolower($part)) === FALSE)
foreach ($parts as $part)
{
if ($this->mimes_types(strtolower($part)) === FALSE)
@@
-916,7
+927,14
@@
class CI_Upload {
$filename .= '.'.$part;
}
}
$filename .= '.'.$part;
}
}
-
+
+ // file name override, since the exact name is provided, no need to
+ // run it through a $this->mimes check.
+ if ($this->file_name != '')
+ {
+ $filename = $this->file_name;
+ }
+
$filename .= '.'.$ext;
return $filename;
$filename .= '.'.$ext;
return $filename;