Skip to content
This repository has been archived by the owner on Jul 14, 2021. It is now read-only.

Commit

Permalink
Initial upgrade to CI 3.13
Browse files Browse the repository at this point in the history
  • Loading branch information
lonnieezell committed Jan 24, 2017
1 parent c7073c8 commit 318420c
Show file tree
Hide file tree
Showing 200 changed files with 1,867 additions and 1,528 deletions.
4 changes: 2 additions & 2 deletions bonfire/ci3/core/Benchmark.php
100644 → 100755
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 - 2016, British Columbia Institute of Technology
* Copyright (c) 2014 - 2017, 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 @@ -29,7 +29,7 @@
* @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:https://bcit.ca/)
* @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http:https://bcit.ca/)
* @license http:https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 1.0.0
Expand Down
47 changes: 29 additions & 18 deletions bonfire/ci3/core/CodeIgniter.php
100644 → 100755
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 - 2016, British Columbia Institute of Technology
* Copyright (c) 2014 - 2017, 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 @@ -29,7 +29,7 @@
* @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:https://bcit.ca/)
* @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http:https://bcit.ca/)
* @license http:https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 1.0.0
Expand All @@ -55,7 +55,7 @@
* @var string
*
*/
define('CI_VERSION', '3.0.6');
const CI_VERSION = '3.1.3';

/*
* ------------------------------------------------------
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 @@ -399,20 +402,13 @@ function &get_instance()
$class = ucfirst($RTR->class);
$method = $RTR->method;

if (empty($class))
if (empty($class) OR ! file_exists(APPPATH.'controllers/'.$RTR->directory.$class.'.php'))
{
$e404 = TRUE;
}
else
{
// Check for Bonfire controller if Application controller was not found.
if (file_exists(APPPATH.'controllers/'.$RTR->directory.$class.'.php')) {
require_once(APPPATH.'controllers/'.$RTR->directory.$class.'.php');
} elseif (file_exists(BFPATH . 'controllers/' . $RTR->directory . $class . '.php')) {
require_once(BFPATH . 'controllers/' . $RTR->directory . $class . '.php');
} else {
$e404 = TRUE;
}
require_once(APPPATH.'controllers/'.$RTR->directory.$class.'.php');

if ( ! class_exists($class, FALSE) OR $method[0] === '_' OR method_exists('CI_Controller', $method))
{
Expand All @@ -423,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)) && strcasecmp($class, $method) === 0)
{
$reflection = new ReflectionMethod($class, $method);
if ( ! $reflection->isPublic() OR $reflection->isConstructor())
{
$e404 = TRUE;
}
}
}

if ($e404)
Expand Down
36 changes: 14 additions & 22 deletions bonfire/ci3/core/Common.php
100644 → 100755
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 - 2016, British Columbia Institute of Technology
* Copyright (c) 2014 - 2017, 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 @@ -29,7 +29,7 @@
* @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:https://bcit.ca/)
* @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http:https://bcit.ca/)
* @license http:https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 1.0.0
Expand Down Expand Up @@ -151,9 +151,8 @@ function &load_class($class, $directory = 'libraries', $param = NULL)
$name = FALSE;

// Look for the class first in the local application/libraries folder
// then in Bonfire's bonfire/libraries folder
// then in the native system/libraries folder
foreach (array(APPPATH, BFPATH, BASEPATH) as $path)
foreach (array(APPPATH, BASEPATH) as $path)
{
if (file_exists($path.$directory.'/'.$class.'.php'))
{
Expand All @@ -168,19 +167,6 @@ function &load_class($class, $directory = 'libraries', $param = NULL)
}
}

// Search in the Bonfire folder first for class extensions.
// Note that these classes will have a BF_ prefix, instead of the subclass
// prefix (MY_) to allow for graceful extending of child classes in the
// application.
if (file_exists(BFPATH . $directory . '/BF_' . $class . '.php'))
{
$name = 'BF_' . $class;
if (class_exists($name, FALSE) === FALSE)
{
require_once(BFPATH . $directory . '/BF_' . $class . '.php');
}
}

// Is the request a class extension? If so we load it too
if (file_exists(APPPATH.$directory.'/'.config_item('subclass_prefix').$class.'.php'))
{
Expand Down Expand Up @@ -369,7 +355,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 @@ -558,13 +544,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 Down Expand Up @@ -612,7 +603,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 @@ -670,6 +661,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 Down Expand Up @@ -730,8 +722,8 @@ 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[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127
Expand Down
13 changes: 5 additions & 8 deletions bonfire/ci3/core/Config.php
100644 → 100755
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 - 2016, British Columbia Institute of Technology
* Copyright (c) 2014 - 2017, 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 @@ -29,7 +29,7 @@
* @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:https://bcit.ca/)
* @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http:https://bcit.ca/)
* @license http:https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 1.0.0
Expand Down Expand Up @@ -319,7 +319,7 @@ public function base_url($uri = '', $protocol = NULL)
}
}

return $base_url.ltrim($this->_uri_string($uri), '/');
return $base_url.$this->_uri_string($uri);
}

// -------------------------------------------------------------
Expand All @@ -337,11 +337,8 @@ protected function _uri_string($uri)
{
if ($this->item('enable_query_strings') === FALSE)
{
if (is_array($uri))
{
$uri = implode('/', $uri);
}
return trim($uri, '/');
is_array($uri) && $uri = implode('/', $uri);
return ltrim($uri, '/');
}
elseif (is_array($uri))
{
Expand Down
4 changes: 2 additions & 2 deletions bonfire/ci3/core/Controller.php
100644 → 100755
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 - 2016, British Columbia Institute of Technology
* Copyright (c) 2014 - 2017, 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 @@ -29,7 +29,7 @@
* @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:https://bcit.ca/)
* @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http:https://bcit.ca/)
* @license http:https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 1.0.0
Expand Down
5 changes: 2 additions & 3 deletions bonfire/ci3/core/Exceptions.php
100644 → 100755
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 - 2016, British Columbia Institute of Technology
* Copyright (c) 2014 - 2017, 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 @@ -29,7 +29,7 @@
* @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:https://bcit.ca/)
* @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http:https://bcit.ca/)
* @license http:https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 1.0.0
Expand Down Expand Up @@ -207,7 +207,6 @@ public function show_exception($exception)
}
else
{
set_status_header(500);
$templates_path .= 'html'.DIRECTORY_SEPARATOR;
}

Expand Down
4 changes: 2 additions & 2 deletions bonfire/ci3/core/Hooks.php
100644 → 100755
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 - 2016, British Columbia Institute of Technology
* Copyright (c) 2014 - 2017, 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 @@ -29,7 +29,7 @@
* @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:https://bcit.ca/)
* @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http:https://bcit.ca/)
* @license http:https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 1.0.0
Expand Down
34 changes: 18 additions & 16 deletions bonfire/ci3/core/Input.php
100644 → 100755
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 - 2016, British Columbia Institute of Technology
* Copyright (c) 2014 - 2017, 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 @@ -29,7 +29,7 @@
* @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:https://bcit.ca/)
* @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http:https://bcit.ca/)
* @license http:https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 1.0.0
Expand Down Expand Up @@ -519,9 +519,9 @@ public function ip_address()
if ($separator === ':')
{
$netaddr = explode(':', str_replace('::', str_repeat(':', 9 - substr_count($netaddr, ':')), $netaddr));
for ($i = 0; $i < 8; $i++)
for ($j = 0; $j < 8; $j++)
{
$netaddr[$i] = intval($netaddr[$i], 16);
$netaddr[$j] = intval($netaddr[$j], 16);
}
}
else
Expand Down Expand Up @@ -760,30 +760,32 @@ public function request_headers($xss_clean = FALSE)
// If header is already defined, return it immediately
if ( ! empty($this->headers))
{
return $this->headers;
return $this->_fetch_from_array($this->headers, NULL, $xss_clean);
}

// In Apache, you can simply call apache_request_headers()
if (function_exists('apache_request_headers'))
{
return $this->headers = apache_request_headers();
$this->headers = apache_request_headers();
}

$this->headers['Content-Type'] = isset($_SERVER['CONTENT_TYPE']) ? $_SERVER['CONTENT_TYPE'] : @getenv('CONTENT_TYPE');

foreach ($_SERVER as $key => $val)
else
{
if (sscanf($key, 'HTTP_%s', $header) === 1)
isset($_SERVER['CONTENT_TYPE']) && $this->headers['Content-Type'] = $_SERVER['CONTENT_TYPE'];

foreach ($_SERVER as $key => $val)
{
// take SOME_HEADER and turn it into Some-Header
$header = str_replace('_', ' ', strtolower($header));
$header = str_replace(' ', '-', ucwords($header));
if (sscanf($key, 'HTTP_%s', $header) === 1)
{
// take SOME_HEADER and turn it into Some-Header
$header = str_replace('_', ' ', strtolower($header));
$header = str_replace(' ', '-', ucwords($header));

$this->headers[$header] = $this->_fetch_from_array($_SERVER, $key, $xss_clean);
$this->headers[$header] = $_SERVER[$key];
}
}
}

return $this->headers;
return $this->_fetch_from_array($this->headers, NULL, $xss_clean);
}

// --------------------------------------------------------------------
Expand Down
Loading

0 comments on commit 318420c

Please sign in to comment.