Update CodeIgniter system 3.1.0 => 3.1.16

This commit is contained in:
2020-08-02 02:23:47 -04:00
parent 3523bc5f57
commit 083b534f0a
176 changed files with 2351 additions and 1889 deletions
+48 -36
View File
@@ -6,7 +6,7 @@
*
* This content is released under the MIT License (MIT)
*
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
* Copyright (c) 2014 - 2019, British Columbia Institute of Technology
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -29,8 +29,8 @@
* @package CodeIgniter
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
* @license http://opensource.org/licenses/MIT MIT License
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
* @license https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 1.0.0
* @filesource
@@ -392,6 +392,16 @@ class CI_Image_lib {
$this->initialize($props);
}
/**
* A work-around for some improperly formatted, but
* usable JPEGs; known to be produced by Samsung
* smartphones' front-facing cameras.
*
* @see https://github.com/bcit-ci/CodeIgniter/issues/4967
* @see https://bugs.php.net/bug.php?id=72404
*/
ini_set('gd.jpeg_ignore_warning', 1);
log_message('info', 'Image Lib Class Initialized');
}
@@ -544,37 +554,30 @@ class CI_Image_lib {
*/
if ($this->new_image === '')
{
$this->dest_image = $this->source_image;
$this->dest_image = $this->source_image;
$this->dest_folder = $this->source_folder;
}
elseif (strpos($this->new_image, '/') === FALSE)
elseif (strpos($this->new_image, '/') === FALSE && strpos($this->new_image, '\\') === FALSE)
{
$this->dest_image = $this->new_image;
$this->dest_folder = $this->source_folder;
$this->dest_image = $this->new_image;
}
else
{
if (strpos($this->new_image, '/') === FALSE && strpos($this->new_image, '\\') === FALSE)
// Is there a file name?
if ( ! preg_match('#\.(jpg|jpeg|gif|png)$#i', $this->new_image))
{
$full_dest_path = str_replace('\\', '/', realpath($this->new_image));
$this->dest_image = $this->source_image;
$this->dest_folder = $this->new_image;
}
else
{
$full_dest_path = $this->new_image;
$x = explode('/', str_replace('\\', '/', $this->new_image));
$this->dest_image = end($x);
$this->dest_folder = str_replace($this->dest_image, '', $this->new_image);
}
// Is there a file name?
if ( ! preg_match('#\.(jpg|jpeg|gif|png)$#i', $full_dest_path))
{
$this->dest_folder = $full_dest_path.'/';
$this->dest_image = $this->source_image;
}
else
{
$x = explode('/', $full_dest_path);
$this->dest_image = end($x);
$this->dest_folder = str_replace($this->dest_image, '', $full_dest_path);
}
$this->dest_folder = realpath($this->dest_folder).'/';
}
/* Compile the finalized filenames/paths
@@ -832,7 +835,10 @@ class CI_Image_lib {
imagedestroy($dst_img);
imagedestroy($src_img);
chmod($this->full_dst_path, $this->file_permissions);
if ($this->dynamic_output !== TRUE)
{
chmod($this->full_dst_path, $this->file_permissions);
}
return TRUE;
}
@@ -886,7 +892,7 @@ class CI_Image_lib {
}
}
$cmd .= ' "'.escapeshellarg($this->full_src_path).'" "'.escapeshellarg($this->full_dst_path).'" 2>&1';
$cmd .= ' '.escapeshellarg($this->full_src_path).' '.escapeshellarg($this->full_dst_path).' 2>&1';
$retval = 1;
// exec() might be disabled
@@ -969,7 +975,7 @@ class CI_Image_lib {
$cmd_inner = 'pnmscale -xysize '.$this->width.' '.$this->height;
}
$cmd = $this->library_path.$cmd_in.' '.$this->full_src_path.' | '.$cmd_inner.' | '.$cmd_out.' > '.$this->dest_folder.'netpbm.tmp';
$cmd = $this->library_path.$cmd_in.' '.escapeshellarg($this->full_src_path).' | '.$cmd_inner.' | '.$cmd_out.' > '.$this->dest_folder.'netpbm.tmp';
$retval = 1;
// exec() might be disabled
@@ -1646,25 +1652,31 @@ class CI_Image_lib {
}
$vals = getimagesize($path);
if ($vals === FALSE)
{
$this->set_error('imglib_invalid_image');
return FALSE;
}
$types = array(1 => 'gif', 2 => 'jpeg', 3 => 'png');
$mime = (isset($types[$vals[2]])) ? 'image/'.$types[$vals[2]] : 'image/jpg';
$mime = isset($types[$vals[2]]) ? 'image/'.$types[$vals[2]] : 'image/jpg';
if ($return === TRUE)
{
return array(
'width' => $vals[0],
'height' => $vals[1],
'image_type' => $vals[2],
'size_str' => $vals[3],
'mime_type' => $mime
);
'width' => $vals[0],
'height' => $vals[1],
'image_type' => $vals[2],
'size_str' => $vals[3],
'mime_type' => $mime
);
}
$this->orig_width = $vals[0];
$this->orig_height = $vals[1];
$this->image_type = $vals[2];
$this->size_str = $vals[3];
$this->mime_type = $mime;
$this->orig_width = $vals[0];
$this->orig_height = $vals[1];
$this->image_type = $vals[2];
$this->size_str = $vals[3];
$this->mime_type = $mime;
return TRUE;
}