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
+41 -18
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
@@ -90,20 +90,49 @@ if ( ! function_exists('form_open'))
$form = '<form action="'.$action.'"'.$attributes.">\n";
// Add CSRF field if enabled, but leave it out for GET requests and requests to external websites
if ($CI->config->item('csrf_protection') === TRUE && strpos($action, $CI->config->base_url()) !== FALSE && ! stripos($form, 'method="get"'))
{
$hidden[$CI->security->get_csrf_token_name()] = $CI->security->get_csrf_hash();
}
if (is_array($hidden))
{
foreach ($hidden as $name => $value)
{
$form .= '<input type="hidden" name="'.$name.'" value="'.html_escape($value).'" style="display:none;" />'."\n";
$form .= '<input type="hidden" name="'.$name.'" value="'.html_escape($value).'" />'."\n";
}
}
// Add CSRF field if enabled, but leave it out for GET requests and requests to external websites
if ($CI->config->item('csrf_protection') === TRUE && strpos($action, $CI->config->base_url()) !== FALSE && ! stripos($form, 'method="get"'))
{
// Prepend/append random-length "white noise" around the CSRF
// token input, as a form of protection against BREACH attacks
if (FALSE !== ($noise = $CI->security->get_random_bytes(1)))
{
list(, $noise) = unpack('c', $noise);
}
else
{
$noise = mt_rand(-128, 127);
}
// Prepend if $noise has a negative value, append if positive, do nothing for zero
$prepend = $append = '';
if ($noise < 0)
{
$prepend = str_repeat(" ", abs($noise));
}
elseif ($noise > 0)
{
$append = str_repeat(" ", $noise);
}
$form .= sprintf(
'%s<input type="hidden" name="%s" value="%s" />%s%s',
$prepend,
$CI->security->get_csrf_token_name(),
$CI->security->get_csrf_hash(),
$append,
"\n"
);
}
return $form;
}
}
@@ -568,7 +597,7 @@ if ( ! function_exists('form_label'))
*
* @param string The text to appear onscreen
* @param string The id the label applies to
* @param array Additional attributes
* @param mixed Additional attributes
* @return string
*/
function form_label($label_text = '', $id = '', $attributes = array())
@@ -581,13 +610,7 @@ if ( ! function_exists('form_label'))
$label .= ' for="'.$id.'"';
}
if (is_array($attributes) && count($attributes) > 0)
{
foreach ($attributes as $key => $val)
{
$label .= ' '.$key.'="'.$val.'"';
}
}
$label .= _attributes_to_string($attributes);
return $label.'>'.$label_text.'</label>';
}