Skip to content

Commit

Permalink
Merge pull request #54 from havok89/feature/codeigniter-upgrade
Browse files Browse the repository at this point in the history
Upgrade Codeigniter to V3.1.11
  • Loading branch information
havok89 authored May 1, 2020
2 parents 87a7c40 + 4b32b21 commit 9917e2a
Show file tree
Hide file tree
Showing 173 changed files with 7,080 additions and 3,936 deletions.
1,550 changes: 1,550 additions & 0 deletions hoosk/hoosk0/cache/rss_Parse_91450f65d5d24f183d50d2d24ca21b10

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions hoosk/system/core/Benchmark.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* This content is released under the MIT License (MIT)
*
* Copyright (c) 2014 - 2015, 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
Expand All @@ -28,10 +28,10 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
* @license http://opensource.org/licenses/MIT MIT License
* @link http://codeigniter.com
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
* @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
*/
Expand All @@ -47,7 +47,7 @@
* @subpackage Libraries
* @category Libraries
* @author EllisLab Dev Team
* @link http://codeigniter.com/user_guide/libraries/benchmark.html
* @link https://codeigniter.com/user_guide/libraries/benchmark.html
*/
class CI_Benchmark {

Expand Down
46 changes: 32 additions & 14 deletions hoosk/system/core/CodeIgniter.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* This content is released under the MIT License (MIT)
*
* Copyright (c) 2014 - 2015, 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
Expand All @@ -28,10 +28,10 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
* @license http://opensource.org/licenses/MIT MIT License
* @link http://codeigniter.com
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
* @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
*/
Expand All @@ -46,7 +46,7 @@
* @subpackage CodeIgniter
* @category Front-controller
* @author EllisLab Dev Team
* @link http://codeigniter.com/user_guide/
* @link https://codeigniter.com/user_guide/
*/

/**
Expand All @@ -55,7 +55,7 @@
* @var string
*
*/
define('CI_VERSION', '3.0.0');
const CI_VERSION = '3.1.11';

/*
* ------------------------------------------------------
Expand All @@ -67,7 +67,10 @@
require_once(APPPATH.'config/'.ENVIRONMENT.'/constants.php');
}

require_once(APPPATH.'config/constants.php');
if (file_exists(APPPATH.'config/constants.php'))
{
require_once(APPPATH.'config/constants.php');
}

/*
* ------------------------------------------------------
Expand Down Expand Up @@ -359,7 +362,7 @@
*
* Returns current CI instance object
*
* @return object
* @return CI_Controller
*/
function &get_instance()
{
Expand Down Expand Up @@ -416,14 +419,29 @@ function &get_instance()
$params = array($method, array_slice($URI->rsegments, 2));
$method = '_remap';
}
// WARNING: It appears that there are issues with is_callable() even in PHP 5.2!
// Furthermore, there are bug reports and feature/change requests related to it
// that make it unreliable to use in this context. Please, DO NOT change this
// work-around until a better alternative is available.
elseif ( ! in_array(strtolower($method), array_map('strtolower', get_class_methods($class)), TRUE))
elseif ( ! method_exists($class, $method))
{
$e404 = TRUE;
}
/**
* DO NOT CHANGE THIS, NOTHING ELSE WORKS!
*
* - method_exists() returns true for non-public methods, which passes the previous elseif
* - is_callable() returns false for PHP 4-style constructors, even if there's a __construct()
* - method_exists($class, '__construct') won't work because CI_Controller::__construct() is inherited
* - People will only complain if this doesn't work, even though it is documented that it shouldn't.
*
* ReflectionMethod::isConstructor() is the ONLY reliable check,
* knowing which method will be executed as a constructor.
*/
elseif ( ! is_callable(array($class, $method)))
{
$reflection = new ReflectionMethod($class, $method);
if ( ! $reflection->isPublic() OR $reflection->isConstructor())
{
$e404 = TRUE;
}
}
}

if ($e404)
Expand Down
95 changes: 46 additions & 49 deletions hoosk/system/core/Common.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* This content is released under the MIT License (MIT)
*
* Copyright (c) 2014 - 2015, 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
Expand All @@ -28,10 +28,10 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
* @license http://opensource.org/licenses/MIT MIT License
* @link http://codeigniter.com
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
* @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
*/
Expand All @@ -46,7 +46,7 @@
* @subpackage CodeIgniter
* @category Common Functions
* @author EllisLab Dev Team
* @link http://codeigniter.com/user_guide/
* @link https://codeigniter.com/user_guide/
*/

// ------------------------------------------------------------------------
Expand Down Expand Up @@ -135,7 +135,7 @@ function is_really_writable($file)
*
* @param string the class name being requested
* @param string the directory where the class should be found
* @param string an optional argument to pass to the class constructor
* @param mixed an optional argument to pass to the class constructor
* @return object
*/
function &load_class($class, $directory = 'libraries', $param = NULL)
Expand Down Expand Up @@ -181,7 +181,7 @@ function &load_class($class, $directory = 'libraries', $param = NULL)
// Did we find the class?
if ($name === FALSE)
{
// Note: We use exit() rather then show_error() in order to avoid a
// Note: We use exit() rather than show_error() in order to avoid a
// self-referencing loop with the Exceptions class
set_status_header(503);
echo 'Unable to locate the specified class: '.$class.'.php';
Expand Down Expand Up @@ -319,17 +319,13 @@ function &get_mimes()

if (empty($_mimes))
{
$_mimes = file_exists(APPPATH.'config/mimes.php')
? include(APPPATH.'config/mimes.php')
: array();

if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/mimes.php'))
{
$_mimes = include(APPPATH.'config/'.ENVIRONMENT.'/mimes.php');
}
elseif (file_exists(APPPATH.'config/mimes.php'))
{
$_mimes = include(APPPATH.'config/mimes.php');
}
else
{
$_mimes = array();
$_mimes = array_merge($_mimes, include(APPPATH.'config/'.ENVIRONMENT.'/mimes.php'));
}
}

Expand All @@ -355,7 +351,7 @@ function is_https()
{
return TRUE;
}
elseif (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https')
elseif (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) === 'https')
{
return TRUE;
}
Expand Down Expand Up @@ -410,11 +406,6 @@ function show_error($message, $status_code = 500, $heading = 'An Error Was Encou
if ($status_code < 100)
{
$exit_status = $status_code + 9; // 9 is EXIT__AUTO_MIN
if ($exit_status > 125) // 125 is EXIT__AUTO_MAX
{
$exit_status = 1; // EXIT_ERROR
}

$status_code = 500;
}
else
Expand Down Expand Up @@ -506,6 +497,9 @@ function set_status_header($code = 200, $text = '')
{
is_int($code) OR $code = (int) $code;
$stati = array(
100 => 'Continue',
101 => 'Switching Protocols',

200 => 'OK',
201 => 'Created',
202 => 'Accepted',
Expand All @@ -524,6 +518,7 @@ function set_status_header($code = 200, $text = '')

400 => 'Bad Request',
401 => 'Unauthorized',
402 => 'Payment Required',
403 => 'Forbidden',
404 => 'Not Found',
405 => 'Method Not Allowed',
Expand All @@ -540,13 +535,18 @@ function set_status_header($code = 200, $text = '')
416 => 'Requested Range Not Satisfiable',
417 => 'Expectation Failed',
422 => 'Unprocessable Entity',
426 => 'Upgrade Required',
428 => 'Precondition Required',
429 => 'Too Many Requests',
431 => 'Request Header Fields Too Large',

500 => 'Internal Server Error',
501 => 'Not Implemented',
502 => 'Bad Gateway',
503 => 'Service Unavailable',
504 => 'Gateway Timeout',
505 => 'HTTP Version Not Supported'
505 => 'HTTP Version Not Supported',
511 => 'Network Authentication Required',
);

if (isset($stati[$code]))
Expand All @@ -562,12 +562,12 @@ function set_status_header($code = 200, $text = '')
if (strpos(PHP_SAPI, 'cgi') === 0)
{
header('Status: '.$code.' '.$text, TRUE);
return;
}
else
{
$server_protocol = isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.1';
header($server_protocol.' '.$code.' '.$text, TRUE, $code);
}

$server_protocol = (isset($_SERVER['SERVER_PROTOCOL']) && in_array($_SERVER['SERVER_PROTOCOL'], array('HTTP/1.0', 'HTTP/1.1', 'HTTP/2'), TRUE))
? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.1';
header($server_protocol.' '.$code.' '.$text, TRUE, $code);
}
}

Expand All @@ -594,7 +594,7 @@ function set_status_header($code = 200, $text = '')
*/
function _error_handler($severity, $message, $filepath, $line)
{
$is_error = (((E_ERROR | E_COMPILE_ERROR | E_CORE_ERROR | E_USER_ERROR) & $severity) === $severity);
$is_error = (((E_ERROR | E_PARSE | E_COMPILE_ERROR | E_CORE_ERROR | E_USER_ERROR) & $severity) === $severity);

// When an error occurred, set the status header to '500 Internal Server Error'
// to indicate to the client something went wrong.
Expand Down Expand Up @@ -652,6 +652,7 @@ function _exception_handler($exception)
$_error =& load_class('Exceptions', 'core');
$_error->log_exception('error', 'Exception: '.$exception->getMessage(), $exception->getFile(), $exception->getLine());

is_cli() OR set_status_header(500);
// Should we display the error?
if (str_ireplace(array('off', 'none', 'no', 'false', 'null'), '', ini_get('display_errors')))
{
Expand All @@ -673,7 +674,7 @@ function _exception_handler($exception)
* of CodeIgniter.php. The main reason we use this is to simulate
* a complete custom exception handler.
*
* E_STRICT is purposivly neglected because such events may have
* E_STRICT is purposively neglected because such events may have
* been caught. Duplication or none? None is preferred for now.
*
* @link http://insomanic.me.uk/post/229851073/php-trick-catching-fatal-errors-e-error-with-a
Expand Down Expand Up @@ -712,8 +713,9 @@ function remove_invisible_characters($str, $url_encoded = TRUE)
// carriage return (dec 13) and horizontal tab (dec 09)
if ($url_encoded)
{
$non_displayables[] = '/%0[0-8bcef]/'; // url encoded 00-08, 11, 12, 14, 15
$non_displayables[] = '/%1[0-9a-f]/'; // url encoded 16-31
$non_displayables[] = '/%0[0-8bcef]/i'; // url encoded 00-08, 11, 12, 14, 15
$non_displayables[] = '/%1[0-9a-f]/i'; // url encoded 16-31
$non_displayables[] = '/%7f/i'; // url encoded 127
}

$non_displayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127
Expand Down Expand Up @@ -745,10 +747,15 @@ function html_escape($var, $double_encode = TRUE)
{
return $var;
}

if (is_array($var))
{
return array_map('html_escape', $var, array_fill(0, count($var), $double_encode));
foreach (array_keys($var) as $key)
{
$var[$key] = html_escape($var[$key], $double_encode);
}

return $var;
}

return htmlspecialchars($var, ENT_QUOTES, config_item('charset'), $double_encode);
Expand Down Expand Up @@ -812,7 +819,7 @@ function _stringify_attributes($attributes, $js = FALSE)
* terminate script execution if a disabled function is executed.
*
* The above described behavior turned out to be a bug in Suhosin,
* but even though a fix was commited for 0.9.34 on 2012-02-12,
* but even though a fix was committed for 0.9.34 on 2012-02-12,
* that version is yet to be released. This function will therefore
* be just temporary, but would probably be kept for a few years.
*
Expand All @@ -829,19 +836,9 @@ function function_usable($function_name)
{
if ( ! isset($_suhosin_func_blacklist))
{
if (extension_loaded('suhosin'))
{
$_suhosin_func_blacklist = explode(',', trim(ini_get('suhosin.executor.func.blacklist')));

if ( ! in_array('eval', $_suhosin_func_blacklist, TRUE) && ini_get('suhosin.executor.disable_eval'))
{
$_suhosin_func_blacklist[] = 'eval';
}
}
else
{
$_suhosin_func_blacklist = array();
}
$_suhosin_func_blacklist = extension_loaded('suhosin')
? explode(',', trim(ini_get('suhosin.executor.func.blacklist')))
: array();
}

return ! in_array($function_name, $_suhosin_func_blacklist, TRUE);
Expand Down
Loading

0 comments on commit 9917e2a

Please sign in to comment.