CodeIgniter 3.1.11 -> 3.4.5 (pocketarc fork) en PHP 8.3-fixes
- system/ vervangen door CodeIgniter 3.4.5 (pocketarc/codeigniter, PHP 8.2-8.5 compatibel) - config.php, mimes.php, user_agents.php en error-views bijgewerkt naar 3.4.5 - composer.json: php-constraint "^7.4 || ^8.0" zodat composer install op 8.3 werkt - PHP 8-fatals opgelost: count()/array-functies op FALSE/null, rekenen met lege strings, delen door nul, property zetten op FALSE, curly-brace string offsets, ongedefinieerde constanten, foute curl_setopt in Phantom_model::create_img - dynamic properties gedeclareerd in libraries, optionele parameters voor verplichte opgelost - vergelijkingen waar '' == 0 in PHP 8 anders uitvalt gecast naar (int) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2019, British Columbia Institute of Technology
|
||||
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -30,6 +30,7 @@
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
|
||||
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
@@ -44,7 +45,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Helpers
|
||||
* @category Helpers
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/helpers/array_helper.html
|
||||
* @link https://codeigniter.com/userguide3/helpers/array_helper.html
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2019, British Columbia Institute of Technology
|
||||
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -30,6 +30,7 @@
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
|
||||
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
@@ -44,7 +45,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Helpers
|
||||
* @category Helpers
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/helpers/captcha_helper.html
|
||||
* @link https://codeigniter.com/userguide3/helpers/captcha_helper.html
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
@@ -54,13 +55,10 @@ if ( ! function_exists('create_captcha'))
|
||||
/**
|
||||
* Create CAPTCHA
|
||||
*
|
||||
* @param array $data Data for the CAPTCHA
|
||||
* @param string $img_path Path to create the image in (deprecated)
|
||||
* @param string $img_url URL to the CAPTCHA image folder (deprecated)
|
||||
* @param string $font_path Server path to font (deprecated)
|
||||
* @return string
|
||||
* @param array $data Data for the CAPTCHA
|
||||
* @return array
|
||||
*/
|
||||
function create_captcha($data = '', $img_path = '', $img_url = '', $font_path = '')
|
||||
function create_captcha($data)
|
||||
{
|
||||
$defaults = array(
|
||||
'word' => '',
|
||||
@@ -68,10 +66,12 @@ if ( ! function_exists('create_captcha'))
|
||||
'img_url' => '',
|
||||
'img_width' => '150',
|
||||
'img_height' => '30',
|
||||
'img_alt' => 'captcha',
|
||||
'img_class' => '',
|
||||
'font_path' => '',
|
||||
'font_size' => 16,
|
||||
'expiration' => 7200,
|
||||
'word_length' => 8,
|
||||
'font_size' => 16,
|
||||
'img_id' => '',
|
||||
'pool' => '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
||||
'colors' => array(
|
||||
@@ -82,6 +82,8 @@ if ( ! function_exists('create_captcha'))
|
||||
)
|
||||
);
|
||||
|
||||
$now = microtime(TRUE);
|
||||
|
||||
foreach ($defaults as $key => $val)
|
||||
{
|
||||
if ( ! is_array($data) && empty($$key))
|
||||
@@ -94,30 +96,59 @@ if ( ! function_exists('create_captcha'))
|
||||
}
|
||||
}
|
||||
|
||||
if ($img_path === '' OR $img_url === ''
|
||||
OR ! is_dir($img_path) OR ! is_really_writable($img_path)
|
||||
OR ! extension_loaded('gd'))
|
||||
if ( ! extension_loaded('gd'))
|
||||
{
|
||||
log_message('error', 'create_captcha(): GD extension is not loaded.');
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// -----------------------------------
|
||||
// Remove old images
|
||||
// -----------------------------------
|
||||
|
||||
$now = microtime(TRUE);
|
||||
|
||||
$current_dir = @opendir($img_path);
|
||||
while ($filename = @readdir($current_dir))
|
||||
if ($img_path === '' OR $img_url === '')
|
||||
{
|
||||
if (in_array(substr($filename, -4), array('.jpg', '.png'))
|
||||
&& (str_replace(array('.jpg', '.png'), '', $filename) + $expiration) < $now)
|
||||
{
|
||||
@unlink($img_path.$filename);
|
||||
}
|
||||
log_message('error', 'create_captcha(): img_path and img_url are required.');
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@closedir($current_dir);
|
||||
if ( ! is_dir($img_path) OR ! is_really_writable($img_path))
|
||||
{
|
||||
log_message('error', "create_captcha(): '{$img_path}' is not a dir, nor is it writable.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ($img_url !== '' OR $img_path !== '')
|
||||
{
|
||||
if ($img_path === '' OR $img_url === '')
|
||||
{
|
||||
log_message('error', 'create_captcha(): $img_path and $img_url are required.');
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( ! is_dir($img_path) OR ! is_really_writable($img_path))
|
||||
{
|
||||
log_message('error', "create_captcha(): '{$img_path}' is not a dir, nor is it writable.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove old images
|
||||
*/
|
||||
$current_dir = @opendir($img_path);
|
||||
while ($filename = @readdir($current_dir))
|
||||
{
|
||||
if (preg_match('#^(?<ts>\d{10})\.png$#', $filename, $match) && ($match['ts'] + $expiration) < $now)
|
||||
{
|
||||
@unlink($img_path.$filename);
|
||||
}
|
||||
}
|
||||
|
||||
@closedir($current_dir);
|
||||
|
||||
// This variable will later be used later to determine whether we write to disk or output a data:image URI
|
||||
$img_filename = $now.'.png';
|
||||
}
|
||||
else
|
||||
{
|
||||
$img_filename = NULL;
|
||||
}
|
||||
|
||||
// -----------------------------------
|
||||
// Do we have a "word" yet?
|
||||
@@ -227,9 +258,9 @@ if ( ! function_exists('create_captcha'))
|
||||
// Determine angle and position
|
||||
// -----------------------------------
|
||||
$length = strlen($word);
|
||||
$angle = ($length >= 6) ? mt_rand(-($length-6), ($length-6)) : 0;
|
||||
$x_axis = mt_rand(6, (360/$length)-16);
|
||||
$y_axis = ($angle >= 0) ? mt_rand($img_height, $img_width) : mt_rand(6, $img_height);
|
||||
$angle = ($length >= 6) ? mt_rand(-($length - 6), ($length - 6)) : 0;
|
||||
$x_axis = mt_rand(6, (int) ((360 / $length) - 16));
|
||||
$y_axis = ($angle >= 0) ? mt_rand((int) $img_height, (int) $img_width) : mt_rand(6, (int) $img_height);
|
||||
|
||||
// Create image
|
||||
// PHP.net recommends imagecreatetruecolor(), but it isn't always available
|
||||
@@ -266,12 +297,12 @@ if ( ! function_exists('create_captcha'))
|
||||
{
|
||||
$theta += $thetac;
|
||||
$rad = $radius * ($i / $points);
|
||||
$x = ($rad * cos($theta)) + $x_axis;
|
||||
$y = ($rad * sin($theta)) + $y_axis;
|
||||
$x = round(($rad * cos($theta)) + $x_axis);
|
||||
$y = round(($rad * sin($theta)) + $y_axis);
|
||||
$theta += $thetac;
|
||||
$rad1 = $radius * (($i + 1) / $points);
|
||||
$x1 = ($rad1 * cos($theta)) + $x_axis;
|
||||
$y1 = ($rad1 * sin($theta)) + $y_axis;
|
||||
$x1 = round(($rad1 * cos($theta)) + $x_axis);
|
||||
$y1 = round(($rad1 * sin($theta)) + $y_axis);
|
||||
imageline($im, $x, $y, $x1, $y1, $colors['grid']);
|
||||
$theta -= $thetac;
|
||||
}
|
||||
@@ -284,13 +315,13 @@ if ( ! function_exists('create_captcha'))
|
||||
if ($use_font === FALSE)
|
||||
{
|
||||
($font_size > 5) && $font_size = 5;
|
||||
$x = mt_rand(0, $img_width / ($length / 3));
|
||||
$x = mt_rand(0, (int) ($img_width / ($length / 3)));
|
||||
$y = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
($font_size > 30) && $font_size = 30;
|
||||
$x = mt_rand(0, $img_width / ($length / 1.5));
|
||||
$x = mt_rand(0, (int) ($img_width / ($length / 1.5)));
|
||||
$y = $font_size + 2;
|
||||
}
|
||||
|
||||
@@ -298,13 +329,13 @@ if ( ! function_exists('create_captcha'))
|
||||
{
|
||||
if ($use_font === FALSE)
|
||||
{
|
||||
$y = mt_rand(0 , $img_height / 2);
|
||||
$y = mt_rand(0, (int) ($img_height / 2));
|
||||
imagestring($im, $font_size, $x, $y, $word[$i], $colors['text']);
|
||||
$x += ($font_size * 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
$y = mt_rand($img_height / 2, $img_height - 3);
|
||||
$y = mt_rand((int) ($img_height / 2), (int) ($img_height - 3));
|
||||
imagettftext($im, $font_size, $angle, $x, $y, $colors['text'], $font_path, $word[$i]);
|
||||
$x += $font_size;
|
||||
}
|
||||
@@ -316,25 +347,38 @@ if ( ! function_exists('create_captcha'))
|
||||
// -----------------------------------
|
||||
// Generate the image
|
||||
// -----------------------------------
|
||||
$img_url = rtrim($img_url, '/').'/';
|
||||
|
||||
if (function_exists('imagejpeg'))
|
||||
if (isset($img_filename))
|
||||
{
|
||||
$img_filename = $now.'.jpg';
|
||||
imagejpeg($im, $img_path.$img_filename);
|
||||
}
|
||||
elseif (function_exists('imagepng'))
|
||||
{
|
||||
$img_filename = $now.'.png';
|
||||
$img_src = rtrim($img_url, '/').'/'.$img_filename;
|
||||
imagepng($im, $img_path.$img_filename);
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
// I don't see an easier way to get the image contents without writing to file
|
||||
$buffer = fopen('php://memory', 'wb+');
|
||||
imagepng($im, $buffer);
|
||||
rewind($buffer);
|
||||
$img_src = '';
|
||||
|
||||
// fread() will return an empty string (not FALSE) after the entire contents are read
|
||||
while (strlen($read = fread($buffer, 4096)))
|
||||
{
|
||||
$img_src .= $read;
|
||||
}
|
||||
|
||||
fclose($buffer);
|
||||
$img_src = 'data:image/png;base64,'.base64_encode($img_src);
|
||||
}
|
||||
|
||||
$img = '<img '.($img_id === '' ? '' : 'id="'.$img_id.'"').' src="'.$img_url.$img_filename.'" style="width: '.$img_width.'px; height: '.$img_height .'px; border: 0;" alt=" " />';
|
||||
ImageDestroy($im);
|
||||
$img_class = trim($img_class);
|
||||
$img_class = (bool) strlen($img_class) ? 'class="'.$img_class.'" ' : '';
|
||||
|
||||
$img = '<img '.($img_id === '' ? '' : 'id="'.$img_id.'"').' src="'.$img_src.'" style="width: '.$img_width.'px; height: '.$img_height .'px; border: 0;" '.$img_class.'alt="'.$img_alt.'" />';
|
||||
if (PHP_VERSION_ID < 80000)
|
||||
{
|
||||
imagedestroy($im);
|
||||
}
|
||||
|
||||
return array('word' => $word, 'time' => $now, 'image' => $img, 'filename' => $img_filename);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2019, British Columbia Institute of Technology
|
||||
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -30,6 +30,7 @@
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
|
||||
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
@@ -44,7 +45,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Helpers
|
||||
* @category Helpers
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/helpers/cookie_helper.html
|
||||
* @link https://codeigniter.com/userguide3/helpers/cookie_helper.html
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
@@ -59,7 +60,7 @@ if ( ! function_exists('set_cookie'))
|
||||
*
|
||||
* @param mixed
|
||||
* @param string the value of the cookie
|
||||
* @param string the number of seconds until expiration
|
||||
* @param int the number of seconds until expiration
|
||||
* @param string the cookie domain. Usually: .yourdomain.com
|
||||
* @param string the cookie path
|
||||
* @param string the cookie prefix
|
||||
@@ -67,10 +68,10 @@ if ( ! function_exists('set_cookie'))
|
||||
* @param bool true makes the cookie accessible via http(s) only (no javascript)
|
||||
* @return void
|
||||
*/
|
||||
function set_cookie($name, $value = '', $expire = '', $domain = '', $path = '/', $prefix = '', $secure = NULL, $httponly = NULL)
|
||||
function set_cookie($name, $value = '', $expire = 0, $domain = '', $path = '/', $prefix = '', $secure = NULL, $httponly = NULL, $samesite = NULL)
|
||||
{
|
||||
// Set the config file options
|
||||
get_instance()->input->set_cookie($name, $value, $expire, $domain, $path, $prefix, $secure, $httponly);
|
||||
get_instance()->input->set_cookie($name, $value, $expire, $domain, $path, $prefix, $secure, $httponly, $samesite);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,9 +86,8 @@ if ( ! function_exists('get_cookie'))
|
||||
* @param bool
|
||||
* @return mixed
|
||||
*/
|
||||
function get_cookie($index, $xss_clean = NULL)
|
||||
function get_cookie($index, $xss_clean = FALSE)
|
||||
{
|
||||
is_bool($xss_clean) OR $xss_clean = (config_item('global_xss_filtering') === TRUE);
|
||||
$prefix = isset($_COOKIE[$index]) ? '' : config_item('cookie_prefix');
|
||||
return get_instance()->input->cookie($prefix.$index, $xss_clean);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2019, British Columbia Institute of Technology
|
||||
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -30,6 +30,7 @@
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
|
||||
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
@@ -44,7 +45,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Helpers
|
||||
* @category Helpers
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/helpers/date_helper.html
|
||||
* @link https://codeigniter.com/userguide3/helpers/date_helper.html
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
@@ -130,14 +131,10 @@ if ( ! function_exists('standard_date'))
|
||||
* Returns a date formatted according to the submitted standard.
|
||||
*
|
||||
* As of PHP 5.2, the DateTime extension provides constants that
|
||||
* serve for the exact same purpose and are used with date().
|
||||
* serve for the exact same purpose and are used internally by
|
||||
* date() as well.
|
||||
*
|
||||
* @todo Remove in version 3.1+.
|
||||
* @deprecated 3.0.0 Use PHP's native date() instead.
|
||||
* @link http://www.php.net/manual/en/class.datetime.php#datetime.constants.types
|
||||
*
|
||||
* @example date(DATE_RFC822, now()); // default
|
||||
* @example date(DATE_W3C, $time); // a different format and time
|
||||
* @deprecated 3.1.3 Use PHP's native date() with DateTime constants
|
||||
*
|
||||
* @param string $fmt = 'DATE_RFC822' the chosen format
|
||||
* @param int $time = NULL Unix timestamp
|
||||
@@ -606,7 +603,7 @@ if ( ! function_exists('timezones'))
|
||||
* for various other ones in this library
|
||||
*
|
||||
* @param string timezone
|
||||
* @return string
|
||||
* @return string|array
|
||||
*/
|
||||
function timezones($tz = '')
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2019, British Columbia Institute of Technology
|
||||
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -30,6 +30,7 @@
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
|
||||
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
@@ -44,7 +45,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Helpers
|
||||
* @category Helpers
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/helpers/directory_helper.html
|
||||
* @link https://codeigniter.com/userguide3/helpers/directory_helper.html
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2019, British Columbia Institute of Technology
|
||||
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -30,6 +30,7 @@
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
|
||||
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
@@ -44,7 +45,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Helpers
|
||||
* @category Helpers
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/helpers/download_helper.html
|
||||
* @link https://codeigniter.com/userguide3/helpers/download_helper.html
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
@@ -56,7 +57,7 @@ if ( ! function_exists('force_download'))
|
||||
*
|
||||
* Generates headers that force a download to happen
|
||||
*
|
||||
* @param string filename
|
||||
* @param mixed filename (or an array of local file path => destination filename)
|
||||
* @param mixed the data to be downloaded
|
||||
* @param bool whether to try and send the actual file MIME type
|
||||
* @return void
|
||||
@@ -69,14 +70,34 @@ if ( ! function_exists('force_download'))
|
||||
}
|
||||
elseif ($data === NULL)
|
||||
{
|
||||
if ( ! @is_file($filename) OR ($filesize = @filesize($filename)) === FALSE)
|
||||
// Is $filename an array as ['local source path' => 'destination filename']?
|
||||
if (is_array($filename))
|
||||
{
|
||||
if (count($filename) !== 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
reset($filename);
|
||||
$filepath = key($filename);
|
||||
$filename = current($filename);
|
||||
|
||||
if (is_int($filepath))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$filepath = $filename;
|
||||
$filename = explode('/', str_replace(DIRECTORY_SEPARATOR, '/', $filename));
|
||||
$filename = end($filename);
|
||||
}
|
||||
|
||||
if ( ! @is_file($filepath) OR ($filesize = @filesize($filepath)) === FALSE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$filepath = $filename;
|
||||
$filename = explode('/', str_replace(DIRECTORY_SEPARATOR, '/', $filename));
|
||||
$filename = end($filename);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -121,20 +142,23 @@ if ( ! function_exists('force_download'))
|
||||
$filename = implode('.', $x);
|
||||
}
|
||||
|
||||
if ($data === NULL && ($fp = @fopen($filepath, 'rb')) === FALSE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Clean output buffer
|
||||
if (ob_get_level() !== 0 && @ob_end_clean() === FALSE)
|
||||
{
|
||||
@ob_clean();
|
||||
}
|
||||
|
||||
// RFC 6266 allows for multibyte filenames, but only in UTF-8,
|
||||
// so we have to make it conditional ...
|
||||
$charset = strtoupper(config_item('charset'));
|
||||
$utf8_filename = ($charset !== 'UTF-8')
|
||||
? get_instance()->utf8->convert_to_utf8($filename, $charset)
|
||||
: $filename;
|
||||
isset($utf8_filename[0]) && $utf8_filename = " filename*=UTF-8''".rawurlencode($utf8_filename);
|
||||
|
||||
// Generate the server headers
|
||||
header('Content-Type: '.$mime);
|
||||
header('Content-Disposition: attachment; filename="'.$filename.'"');
|
||||
header('Content-Disposition: attachment; filename="'.$filename.'";'.$utf8_filename);
|
||||
header('Expires: 0');
|
||||
header('Content-Transfer-Encoding: binary');
|
||||
header('Content-Length: '.$filesize);
|
||||
@@ -146,13 +170,12 @@ if ( ! function_exists('force_download'))
|
||||
exit($data);
|
||||
}
|
||||
|
||||
// Flush 1MB chunks of data
|
||||
while ( ! feof($fp) && ($data = fread($fp, 1048576)) !== FALSE)
|
||||
// Flush the file
|
||||
if (@readfile($filepath) === FALSE)
|
||||
{
|
||||
echo $data;
|
||||
return;
|
||||
}
|
||||
|
||||
fclose($fp);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2019, British Columbia Institute of Technology
|
||||
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
|
||||
*
|
||||
* 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,9 @@
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2019, 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/)
|
||||
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
@@ -44,7 +45,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Helpers
|
||||
* @category Helpers
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/helpers/email_helper.html
|
||||
* @link https://codeigniter.com/userguide3/helpers/email_helper.html
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2019, British Columbia Institute of Technology
|
||||
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -30,6 +30,7 @@
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
|
||||
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
@@ -44,7 +45,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Helpers
|
||||
* @category Helpers
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/helpers/file_helper.html
|
||||
* @link https://codeigniter.com/userguide3/helpers/file_helper.html
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
@@ -56,7 +57,6 @@ if ( ! function_exists('read_file'))
|
||||
*
|
||||
* Opens the file specified in the path and returns it as a string.
|
||||
*
|
||||
* @todo Remove in version 3.1+.
|
||||
* @deprecated 3.0.0 It is now just an alias for PHP's native file_get_contents().
|
||||
* @param string $file Path to file
|
||||
* @return string File contents
|
||||
@@ -219,6 +219,8 @@ if ( ! function_exists('get_dir_file_info'))
|
||||
*
|
||||
* Any sub-folders contained within the specified path are read as well.
|
||||
*
|
||||
* Keys are the file paths relative to $source_dir.
|
||||
*
|
||||
* @param string path to source
|
||||
* @param bool Look only at the top level directory specified?
|
||||
* @param bool internal variable to determine recursion status - do not use in calls
|
||||
@@ -227,6 +229,7 @@ if ( ! function_exists('get_dir_file_info'))
|
||||
function get_dir_file_info($source_dir, $top_level_only = TRUE, $_recursion = FALSE)
|
||||
{
|
||||
static $_filedata = array();
|
||||
static $_root_dir = '';
|
||||
$relative_path = $source_dir;
|
||||
|
||||
if ($fp = @opendir($source_dir))
|
||||
@@ -236,6 +239,7 @@ if ( ! function_exists('get_dir_file_info'))
|
||||
{
|
||||
$_filedata = array();
|
||||
$source_dir = rtrim(realpath($source_dir), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;
|
||||
$_root_dir = $source_dir;
|
||||
}
|
||||
|
||||
// Used to be foreach (scandir($source_dir, 1) as $file), but scandir() is simply not as fast
|
||||
@@ -247,8 +251,13 @@ if ( ! function_exists('get_dir_file_info'))
|
||||
}
|
||||
elseif ($file[0] !== '.')
|
||||
{
|
||||
$_filedata[$file] = get_file_info($source_dir.$file);
|
||||
$_filedata[$file]['relative_path'] = $relative_path;
|
||||
$filedata = get_file_info($source_dir.$file);
|
||||
|
||||
if (is_array($filedata))
|
||||
{
|
||||
$filedata['relative_path'] = $relative_path;
|
||||
$_filedata[substr($source_dir.$file, strlen($_root_dir))] = $filedata;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2019, British Columbia Institute of Technology
|
||||
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -30,6 +30,7 @@
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
|
||||
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
@@ -44,7 +45,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Helpers
|
||||
* @category Helpers
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/helpers/form_helper.html
|
||||
* @link https://codeigniter.com/userguide3/helpers/form_helper.html
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
@@ -273,11 +274,10 @@ if ( ! function_exists('form_upload'))
|
||||
* Identical to the input function but adds the "file" type
|
||||
*
|
||||
* @param mixed
|
||||
* @param string
|
||||
* @param mixed
|
||||
* @return string
|
||||
*/
|
||||
function form_upload($data = '', $value = '', $extra = '')
|
||||
function form_upload($data = '', $extra = '')
|
||||
{
|
||||
$defaults = array('type' => 'file', 'name' => '');
|
||||
is_array($data) OR $data = array('name' => $data);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2019, British Columbia Institute of Technology
|
||||
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -30,6 +30,7 @@
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
|
||||
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
@@ -44,7 +45,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Helpers
|
||||
* @category Helpers
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/helpers/html_helper.html
|
||||
* @link https://codeigniter.com/userguide3/helpers/html_helper.html
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
@@ -133,7 +134,6 @@ if ( ! function_exists('_list'))
|
||||
// Write the opening list tag
|
||||
.'<'.$type._stringify_attributes($attributes).">\n";
|
||||
|
||||
|
||||
// Cycle through the list elements. If an array is
|
||||
// encountered we will recursively call _list()
|
||||
|
||||
@@ -229,7 +229,7 @@ if ( ! function_exists('doctype'))
|
||||
* @param string type The doctype to be generated
|
||||
* @return string
|
||||
*/
|
||||
function doctype($type = 'xhtml1-strict')
|
||||
function doctype($type = 'html5')
|
||||
{
|
||||
static $doctypes;
|
||||
|
||||
@@ -360,15 +360,30 @@ if ( ! function_exists('meta'))
|
||||
$name = array($name);
|
||||
}
|
||||
|
||||
$allowed_types = array('charset', 'http-equiv', 'name', 'property');
|
||||
$str = '';
|
||||
foreach ($name as $meta)
|
||||
{
|
||||
$type = (isset($meta['type']) && $meta['type'] !== 'name') ? 'http-equiv' : 'name';
|
||||
$name = isset($meta['name']) ? $meta['name'] : '';
|
||||
$content = isset($meta['content']) ? $meta['content'] : '';
|
||||
$newline = isset($meta['newline']) ? $meta['newline'] : "\n";
|
||||
// This is to preserve BC with pre-3.1 versions where only
|
||||
// 'http-equiv' (default) and 'name' were supported.
|
||||
if (isset($meta['type']))
|
||||
{
|
||||
if ($meta['type'] === 'equiv')
|
||||
{
|
||||
$meta['type'] = 'http-equiv';
|
||||
}
|
||||
elseif ( ! in_array($meta['type'], $allowed_types, TRUE))
|
||||
{
|
||||
$meta['type'] = 'name';
|
||||
}
|
||||
}
|
||||
|
||||
$str .= '<meta '.$type.'="'.$name.'" content="'.$content.'" />'.$newline;
|
||||
$type = isset($meta['type']) ? $meta['type'] : 'name';
|
||||
$name = isset($meta['name']) ? $meta['name'] : '';
|
||||
$content = isset($meta['content']) ? $meta['content'] : '';
|
||||
$newline = isset($meta['newline']) ? $meta['newline'] : "\n";
|
||||
|
||||
$str .= '<meta '.$type.'="'.$name.($type === 'charset' ? '' : '" content="'.$content).'" />'.$newline;
|
||||
}
|
||||
|
||||
return $str;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2019, British Columbia Institute of Technology
|
||||
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -30,6 +30,7 @@
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
|
||||
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
@@ -44,7 +45,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Helpers
|
||||
* @category Helpers
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/helpers/inflector_helper.html
|
||||
* @link https://codeigniter.com/userguide3/helpers/inflector_helper.html
|
||||
*/
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
@@ -285,3 +286,42 @@ if ( ! function_exists('is_countable'))
|
||||
return word_is_countable($word);
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if ( ! function_exists('ordinal_format'))
|
||||
{
|
||||
/**
|
||||
* Returns the English ordinal numeral for a given number
|
||||
*
|
||||
* @param int $number
|
||||
* @return string
|
||||
*/
|
||||
function ordinal_format($number)
|
||||
{
|
||||
if ( ! ctype_digit((string) $number) OR $number < 1)
|
||||
{
|
||||
return $number;
|
||||
}
|
||||
|
||||
$last_digit = array(
|
||||
0 => 'th',
|
||||
1 => 'st',
|
||||
2 => 'nd',
|
||||
3 => 'rd',
|
||||
4 => 'th',
|
||||
5 => 'th',
|
||||
6 => 'th',
|
||||
7 => 'th',
|
||||
8 => 'th',
|
||||
9 => 'th'
|
||||
);
|
||||
|
||||
if (($number % 100) >= 11 && ($number % 100) <= 13)
|
||||
{
|
||||
return $number.'th';
|
||||
}
|
||||
|
||||
return $number.$last_digit[$number % 10];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2019, British Columbia Institute of Technology
|
||||
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -30,6 +30,7 @@
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
|
||||
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
@@ -44,7 +45,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Helpers
|
||||
* @category Helpers
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/helpers/language_helper.html
|
||||
* @link https://codeigniter.com/userguide3/helpers/language_helper.html
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2019, British Columbia Institute of Technology
|
||||
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -30,6 +30,7 @@
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
|
||||
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
@@ -44,7 +45,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Helpers
|
||||
* @category Helpers
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/helpers/number_helper.html
|
||||
* @link https://codeigniter.com/userguide3/helpers/number_helper.html
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2019, British Columbia Institute of Technology
|
||||
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -30,6 +30,7 @@
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
|
||||
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
@@ -44,7 +45,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Helpers
|
||||
* @category Helpers
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/helpers/path_helper.html
|
||||
* @link https://codeigniter.com/userguide3/helpers/path_helper.html
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2019, British Columbia Institute of Technology
|
||||
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -30,6 +30,7 @@
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
|
||||
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
@@ -44,7 +45,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Helpers
|
||||
* @category Helpers
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/helpers/security_helper.html
|
||||
* @link https://codeigniter.com/userguide3/helpers/security_helper.html
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
@@ -80,14 +81,13 @@ if ( ! function_exists('sanitize_filename'))
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if ( ! function_exists('do_hash'))
|
||||
{
|
||||
/**
|
||||
* Hash encode a string
|
||||
*
|
||||
* @todo Remove in version 3.1+.
|
||||
* @deprecated 3.0.0 Use PHP's native hash() instead.
|
||||
* @param string $str
|
||||
* @param string $type = 'sha1'
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2019, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, 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,7 +29,7 @@
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2019, British Columbia Institute of Technology
|
||||
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -30,6 +30,7 @@
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
|
||||
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
@@ -44,7 +45,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Helpers
|
||||
* @category Helpers
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/helpers/string_helper.html
|
||||
* @link https://codeigniter.com/userguide3/helpers/string_helper.html
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
@@ -62,7 +63,6 @@ if ( ! function_exists('trim_slashes'))
|
||||
*
|
||||
* this/that/theother
|
||||
*
|
||||
* @todo Remove in version 3.1+.
|
||||
* @deprecated 3.0.0 This is just an alias for PHP's native trim()
|
||||
*
|
||||
* @param string
|
||||
@@ -197,7 +197,7 @@ if ( ! function_exists('random_string'))
|
||||
/**
|
||||
* Create a "Random" String
|
||||
*
|
||||
* @param string type of random string. basic, alpha, alnum, numeric, nozero, unique, md5, encrypt and sha1
|
||||
* @param string type of random string. basic, alpha, alnum, numeric, nozero, md5 and sha1
|
||||
* @param int number of characters
|
||||
* @return string
|
||||
*/
|
||||
@@ -227,10 +227,10 @@ if ( ! function_exists('random_string'))
|
||||
break;
|
||||
}
|
||||
return substr(str_shuffle(str_repeat($pool, ceil($len / strlen($pool)))), 0, $len);
|
||||
case 'unique': // todo: remove in 3.1+
|
||||
case 'unique':
|
||||
case 'md5':
|
||||
return md5(uniqid(mt_rand()));
|
||||
case 'encrypt': // todo: remove in 3.1+
|
||||
case 'encrypt':
|
||||
case 'sha1':
|
||||
return sha1(uniqid(mt_rand(), TRUE));
|
||||
}
|
||||
@@ -290,8 +290,7 @@ if ( ! function_exists('repeater'))
|
||||
/**
|
||||
* Repeater function
|
||||
*
|
||||
* @todo Remove in version 3.1+.
|
||||
* @deprecated 3.0.0 This is just an alias for PHP's native str_repeat()
|
||||
* @deprecated 3.0.0 Use PHP's native str_repeat() instead
|
||||
*
|
||||
* @param string $data String to repeat
|
||||
* @param int $num Number of repeats
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2019, British Columbia Institute of Technology
|
||||
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -30,6 +30,7 @@
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
|
||||
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
@@ -44,7 +45,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Helpers
|
||||
* @category Helpers
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/helpers/text_helper.html
|
||||
* @link https://codeigniter.com/userguide3/helpers/text_helper.html
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
@@ -342,12 +343,12 @@ if ( ! function_exists('highlight_code'))
|
||||
$str = preg_replace(
|
||||
array(
|
||||
'/<span style="color: #([A-Z0-9]+)"><\?php( | )/i',
|
||||
'/(<span style="color: #[A-Z0-9]+">.*?)\?><\/span>\n<\/span>\n<\/code>/is',
|
||||
'/(<span style="color: #[A-Z0-9]+">.*?)\?><\/span>(\n<\/span>\n<\/code>|<\/code><\/pre>)/is',
|
||||
'/<span style="color: #[A-Z0-9]+"\><\/span>/i'
|
||||
),
|
||||
array(
|
||||
'<span style="color: #$1">',
|
||||
"$1</span>\n</span>\n</code>",
|
||||
'$1</span>$2',
|
||||
''
|
||||
),
|
||||
$str
|
||||
@@ -422,6 +423,8 @@ if ( ! function_exists('convert_accented_characters'))
|
||||
$array_from = array_keys($foreign_characters);
|
||||
$array_to = array_values($foreign_characters);
|
||||
}
|
||||
|
||||
$str = (gettype($str) === 'NULL') ? '' : $str;
|
||||
|
||||
return preg_replace($array_from, $array_to, $str);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2019, British Columbia Institute of Technology
|
||||
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -30,6 +30,7 @@
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
|
||||
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
@@ -44,7 +45,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Helpers
|
||||
* @category Helpers
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/helpers/typography_helper.html
|
||||
* @link https://codeigniter.com/userguide3/helpers/typography_helper.html
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2019, British Columbia Institute of Technology
|
||||
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -30,6 +30,7 @@
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
|
||||
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
@@ -44,7 +45,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Helpers
|
||||
* @category Helpers
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/helpers/url_helper.html
|
||||
* @link https://codeigniter.com/userguide3/helpers/url_helper.html
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
@@ -211,7 +212,7 @@ if ( ! function_exists('anchor_popup'))
|
||||
{
|
||||
$attributes = array($attributes);
|
||||
|
||||
// Ref: http://www.w3schools.com/jsref/met_win_open.asp
|
||||
// Ref: https://www.w3schools.com/jsref/met_win_open.asp
|
||||
$window_name = '_blank';
|
||||
}
|
||||
elseif ( ! empty($attributes['window_name']))
|
||||
@@ -443,7 +444,7 @@ if ( ! function_exists('prep_url'))
|
||||
*/
|
||||
function prep_url($str = '')
|
||||
{
|
||||
if ($str === 'http://' OR $str === '')
|
||||
if ($str === '')
|
||||
{
|
||||
return '';
|
||||
}
|
||||
@@ -470,10 +471,8 @@ if ( ! function_exists('url_title'))
|
||||
* human-friendly URL string with a "separator" string
|
||||
* as the word separator.
|
||||
*
|
||||
* @todo Remove old 'dash' and 'underscore' usage in 3.1+.
|
||||
* @param string $str Input string
|
||||
* @param string $separator Word separator
|
||||
* (usually '-' or '_')
|
||||
* @param string $separator Word separator (usually '-' or '_')
|
||||
* @param bool $lowercase Whether to transform the output string to lowercase
|
||||
* @return string
|
||||
*/
|
||||
@@ -494,7 +493,7 @@ if ( ! function_exists('url_title'))
|
||||
'&.+?;' => '',
|
||||
'[^\w\d _-]' => '',
|
||||
'\s+' => $separator,
|
||||
'('.$q_separator.')+' => $separator
|
||||
'('.$q_separator.')+' => $separator,
|
||||
);
|
||||
|
||||
$str = strip_tags($str);
|
||||
@@ -546,7 +545,7 @@ if ( ! function_exists('redirect'))
|
||||
if (isset($_SERVER['SERVER_PROTOCOL'], $_SERVER['REQUEST_METHOD']) && $_SERVER['SERVER_PROTOCOL'] === 'HTTP/1.1')
|
||||
{
|
||||
$code = ($_SERVER['REQUEST_METHOD'] !== 'GET')
|
||||
? 303 // reference: http://en.wikipedia.org/wiki/Post/Redirect/Get
|
||||
? 303 // reference: https://en.wikipedia.org/wiki/Post/Redirect/Get
|
||||
: 307;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2019, British Columbia Institute of Technology
|
||||
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -30,6 +30,7 @@
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
|
||||
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
@@ -44,7 +45,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Helpers
|
||||
* @category Helpers
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/helpers/xml_helper.html
|
||||
* @link https://codeigniter.com/userguide3/helpers/xml_helper.html
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user