kopia lustrzana https://github.com/magicbug/Cloudlog
Updated CodeIgniter to latest dev from Github
rodzic
f0b97c148a
commit
016cd7198c
|
@ -1 +1,6 @@
|
|||
Deny from all
|
||||
<IfModule authz_core_module>
|
||||
Require all denied
|
||||
</IfModule>
|
||||
<IfModule !authz_core_module>
|
||||
Deny from all
|
||||
</IfModule>
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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
|
||||
|
@ -47,7 +47,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Libraries
|
||||
* @category Libraries
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/libraries/benchmark.html
|
||||
* @link https://codeigniter.com/userguide3/libraries/benchmark.html
|
||||
*/
|
||||
class CI_Benchmark {
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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
|
||||
|
@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage CodeIgniter
|
||||
* @category Front-controller
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/
|
||||
* @link https://codeigniter.com/userguide3/
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -55,7 +55,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @var string
|
||||
*
|
||||
*/
|
||||
const CI_VERSION = '3.1.6';
|
||||
const CI_VERSION = '3.2.0-dev';
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------
|
||||
|
@ -79,57 +79,6 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
*/
|
||||
require_once(BASEPATH.'core/Common.php');
|
||||
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------
|
||||
* Security procedures
|
||||
* ------------------------------------------------------
|
||||
*/
|
||||
|
||||
if ( ! is_php('5.4'))
|
||||
{
|
||||
ini_set('magic_quotes_runtime', 0);
|
||||
|
||||
if ((bool) ini_get('register_globals'))
|
||||
{
|
||||
$_protected = array(
|
||||
'_SERVER',
|
||||
'_GET',
|
||||
'_POST',
|
||||
'_FILES',
|
||||
'_REQUEST',
|
||||
'_SESSION',
|
||||
'_ENV',
|
||||
'_COOKIE',
|
||||
'GLOBALS',
|
||||
'HTTP_RAW_POST_DATA',
|
||||
'system_path',
|
||||
'application_folder',
|
||||
'view_folder',
|
||||
'_protected',
|
||||
'_registered'
|
||||
);
|
||||
|
||||
$_registered = ini_get('variables_order');
|
||||
foreach (array('E' => '_ENV', 'G' => '_GET', 'P' => '_POST', 'C' => '_COOKIE', 'S' => '_SERVER') as $key => $superglobal)
|
||||
{
|
||||
if (strpos($_registered, $key) === FALSE)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach (array_keys($$superglobal) as $var)
|
||||
{
|
||||
if (isset($GLOBALS[$var]) && ! in_array($var, $_protected, TRUE))
|
||||
{
|
||||
$GLOBALS[$var] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------
|
||||
* Define a custom error handler so we can log PHP errors
|
||||
|
@ -192,20 +141,6 @@ if ( ! is_php('5.4'))
|
|||
$BM->mark('total_execution_time_start');
|
||||
$BM->mark('loading_time:_base_classes_start');
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------
|
||||
* Instantiate the hooks class
|
||||
* ------------------------------------------------------
|
||||
*/
|
||||
$EXT =& load_class('Hooks', 'core');
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------
|
||||
* Is there a "pre_system" hook?
|
||||
* ------------------------------------------------------
|
||||
*/
|
||||
$EXT->call_hook('pre_system');
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------
|
||||
* Instantiate the config class
|
||||
|
@ -227,6 +162,20 @@ if ( ! is_php('5.4'))
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------
|
||||
* Instantiate the hooks class
|
||||
* ------------------------------------------------------
|
||||
*/
|
||||
$EXT =& load_class('Hooks', 'core', $CFG);
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------
|
||||
* Is there a "pre_system" hook?
|
||||
* ------------------------------------------------------
|
||||
*/
|
||||
$EXT->call_hook('pre_system');
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------
|
||||
* Important charset-related stuff
|
||||
|
@ -294,14 +243,14 @@ if ( ! is_php('5.4'))
|
|||
* Instantiate the UTF-8 class
|
||||
* ------------------------------------------------------
|
||||
*/
|
||||
$UNI =& load_class('Utf8', 'core');
|
||||
$UNI =& load_class('Utf8', 'core', $charset);
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------
|
||||
* Instantiate the URI class
|
||||
* ------------------------------------------------------
|
||||
*/
|
||||
$URI =& load_class('URI', 'core');
|
||||
$URI =& load_class('URI', 'core', $CFG);
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------
|
||||
|
@ -332,14 +281,14 @@ if ( ! is_php('5.4'))
|
|||
* Load the security class for xss and csrf support
|
||||
* -----------------------------------------------------
|
||||
*/
|
||||
$SEC =& load_class('Security', 'core');
|
||||
$SEC =& load_class('Security', 'core', $charset);
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------
|
||||
* Load the Input class and sanitize globals
|
||||
* ------------------------------------------------------
|
||||
*/
|
||||
$IN =& load_class('Input', 'core');
|
||||
$IN =& load_class('Input', 'core', $SEC);
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------
|
||||
|
@ -438,7 +387,7 @@ if ( ! is_php('5.4'))
|
|||
* ReflectionMethod::isConstructor() is the ONLY reliable check,
|
||||
* knowing which method will be executed as a constructor.
|
||||
*/
|
||||
elseif ( ! is_callable(array($class, $method)))
|
||||
else
|
||||
{
|
||||
$reflection = new ReflectionMethod($class, $method);
|
||||
if ( ! $reflection->isPublic() OR $reflection->isConstructor())
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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
|
||||
|
@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage CodeIgniter
|
||||
* @category Common Functions
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/
|
||||
* @link https://codeigniter.com/userguide3/
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -81,8 +81,7 @@ if ( ! function_exists('is_really_writable'))
|
|||
* Tests for file writability
|
||||
*
|
||||
* is_writable() returns TRUE on Windows servers when you really can't write to
|
||||
* the file, based on the read-only attribute. is_writable() is also unreliable
|
||||
* on Unix servers if safe_mode is on.
|
||||
* the file, based on the read-only attribute.
|
||||
*
|
||||
* @link https://bugs.php.net/bug.php?id=54709
|
||||
* @param string
|
||||
|
@ -90,8 +89,8 @@ if ( ! function_exists('is_really_writable'))
|
|||
*/
|
||||
function is_really_writable($file)
|
||||
{
|
||||
// If we're on a Unix server with safe_mode off we call is_writable
|
||||
if (DIRECTORY_SEPARATOR === '/' && (is_php('5.4') OR ! ini_get('safe_mode')))
|
||||
// If we're on a UNIX-like server, just is_writable()
|
||||
if (DIRECTORY_SEPARATOR === '/')
|
||||
{
|
||||
return is_writable($file);
|
||||
}
|
||||
|
@ -499,6 +498,7 @@ if ( ! function_exists('set_status_header'))
|
|||
$stati = array(
|
||||
100 => 'Continue',
|
||||
101 => 'Switching Protocols',
|
||||
103 => 'Early Hints',
|
||||
|
||||
200 => 'OK',
|
||||
201 => 'Created',
|
||||
|
@ -507,6 +507,7 @@ if ( ! function_exists('set_status_header'))
|
|||
204 => 'No Content',
|
||||
205 => 'Reset Content',
|
||||
206 => 'Partial Content',
|
||||
207 => 'Multi-Status',
|
||||
|
||||
300 => 'Multiple Choices',
|
||||
301 => 'Moved Permanently',
|
||||
|
@ -515,6 +516,7 @@ if ( ! function_exists('set_status_header'))
|
|||
304 => 'Not Modified',
|
||||
305 => 'Use Proxy',
|
||||
307 => 'Temporary Redirect',
|
||||
308 => 'Permanent Redirect',
|
||||
|
||||
400 => 'Bad Request',
|
||||
401 => 'Unauthorized',
|
||||
|
@ -534,11 +536,13 @@ if ( ! function_exists('set_status_header'))
|
|||
415 => 'Unsupported Media Type',
|
||||
416 => 'Requested Range Not Satisfiable',
|
||||
417 => 'Expectation Failed',
|
||||
421 => 'Misdirected Request',
|
||||
422 => 'Unprocessable Entity',
|
||||
426 => 'Upgrade Required',
|
||||
428 => 'Precondition Required',
|
||||
429 => 'Too Many Requests',
|
||||
431 => 'Request Header Fields Too Large',
|
||||
451 => 'Unavailable For Legal Reasons',
|
||||
|
||||
500 => 'Internal Server Error',
|
||||
501 => 'Not Implemented',
|
||||
|
@ -565,7 +569,7 @@ if ( ! function_exists('set_status_header'))
|
|||
return;
|
||||
}
|
||||
|
||||
$server_protocol = (isset($_SERVER['SERVER_PROTOCOL']) && in_array($_SERVER['SERVER_PROTOCOL'], array('HTTP/1.0', 'HTTP/1.1', 'HTTP/2'), TRUE))
|
||||
$server_protocol = (isset($_SERVER['SERVER_PROTOCOL']) && in_array($_SERVER['SERVER_PROTOCOL'], array('HTTP/1.0', 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0'), TRUE))
|
||||
? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.1';
|
||||
header($server_protocol.' '.$code.' '.$text, TRUE, $code);
|
||||
}
|
||||
|
@ -625,7 +629,7 @@ if ( ! function_exists('_error_handler'))
|
|||
|
||||
// If the error is fatal, the execution of the script should be stopped because
|
||||
// errors can't be recovered from. Halting the script conforms with PHP's
|
||||
// default error handling. See http://www.php.net/manual/en/errorfunc.constants.php
|
||||
// default error handling. See https://secure.php.net/manual/en/errorfunc.constants.php
|
||||
if ($is_error)
|
||||
{
|
||||
exit(1); // EXIT_ERROR
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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
|
||||
|
@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Libraries
|
||||
* @category Libraries
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/libraries/config.html
|
||||
* @link https://codeigniter.com/userguide3/libraries/config.html
|
||||
*/
|
||||
class CI_Config {
|
||||
|
||||
|
@ -169,7 +169,7 @@ class CI_Config {
|
|||
$this->is_loaded[] = $file_path;
|
||||
$config = NULL;
|
||||
$loaded = TRUE;
|
||||
log_message('debug', 'Config file loaded: '.$file_path);
|
||||
log_message('info', 'Config file loaded: '.$file_path);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -350,20 +350,6 @@ class CI_Config {
|
|||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* System URL
|
||||
*
|
||||
* @deprecated 3.0.0 Encourages insecure practices
|
||||
* @return string
|
||||
*/
|
||||
public function system_url()
|
||||
{
|
||||
$x = explode('/', preg_replace('|/*(.+?)/*$|', '\\1', BASEPATH));
|
||||
return $this->slash_item('base_url').end($x).'/';
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Set a config file item
|
||||
*
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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
|
||||
|
@ -47,7 +47,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Libraries
|
||||
* @category Libraries
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/general/controllers.html
|
||||
* @link https://codeigniter.com/userguide3/general/controllers.html
|
||||
*/
|
||||
class CI_Controller {
|
||||
|
||||
|
@ -58,6 +58,13 @@ class CI_Controller {
|
|||
*/
|
||||
private static $instance;
|
||||
|
||||
/**
|
||||
* CI_Loader
|
||||
*
|
||||
* @var CI_Loader
|
||||
*/
|
||||
public $load;
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
*
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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
|
||||
|
@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Libraries
|
||||
* @category Exceptions
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/libraries/exceptions.html
|
||||
* @link https://codeigniter.com/userguide3/libraries/exceptions.html
|
||||
*/
|
||||
class CI_Exceptions {
|
||||
|
||||
|
@ -161,6 +161,10 @@ class CI_Exceptions {
|
|||
{
|
||||
$templates_path = VIEWPATH.'errors'.DIRECTORY_SEPARATOR;
|
||||
}
|
||||
else
|
||||
{
|
||||
$templates_path = rtrim($templates_path, '/\\').DIRECTORY_SEPARATOR;
|
||||
}
|
||||
|
||||
if (is_cli())
|
||||
{
|
||||
|
@ -194,6 +198,10 @@ class CI_Exceptions {
|
|||
{
|
||||
$templates_path = VIEWPATH.'errors'.DIRECTORY_SEPARATOR;
|
||||
}
|
||||
else
|
||||
{
|
||||
$templates_path = rtrim($templates_path, '/\\').DIRECTORY_SEPARATOR;
|
||||
}
|
||||
|
||||
$message = $exception->getMessage();
|
||||
if (empty($message))
|
||||
|
@ -240,6 +248,10 @@ class CI_Exceptions {
|
|||
{
|
||||
$templates_path = VIEWPATH.'errors'.DIRECTORY_SEPARATOR;
|
||||
}
|
||||
else
|
||||
{
|
||||
$templates_path = rtrim($templates_path, '/\\').DIRECTORY_SEPARATOR;
|
||||
}
|
||||
|
||||
$severity = isset($this->levels[$severity]) ? $this->levels[$severity] : $severity;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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
|
||||
|
@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Libraries
|
||||
* @category Libraries
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/general/hooks.html
|
||||
* @link https://codeigniter.com/userguide3/general/hooks.html
|
||||
*/
|
||||
class CI_Hooks {
|
||||
|
||||
|
@ -83,16 +83,16 @@ class CI_Hooks {
|
|||
/**
|
||||
* Class constructor
|
||||
*
|
||||
* @param CI_Config $config
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
public function __construct(CI_Config $config)
|
||||
{
|
||||
$CFG =& load_class('Config', 'core');
|
||||
log_message('info', 'Hooks Class Initialized');
|
||||
|
||||
// If hooks are not enabled in the config file
|
||||
// there is nothing else to do
|
||||
if ($CFG->item('enable_hooks') === FALSE)
|
||||
if ($config->item('enable_hooks') === FALSE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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
|
||||
|
@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Libraries
|
||||
* @category Input
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/libraries/input.html
|
||||
* @link https://codeigniter.com/userguide3/libraries/input.html
|
||||
*/
|
||||
class CI_Input {
|
||||
|
||||
|
@ -57,45 +57,6 @@ class CI_Input {
|
|||
*/
|
||||
protected $ip_address = FALSE;
|
||||
|
||||
/**
|
||||
* Allow GET array flag
|
||||
*
|
||||
* If set to FALSE, then $_GET will be set to an empty array.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $_allow_get_array = TRUE;
|
||||
|
||||
/**
|
||||
* Standardize new lines flag
|
||||
*
|
||||
* If set to TRUE, then newlines are standardized.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $_standardize_newlines;
|
||||
|
||||
/**
|
||||
* Enable XSS flag
|
||||
*
|
||||
* Determines whether the XSS filter is always active when
|
||||
* GET, POST or COOKIE data is encountered.
|
||||
* Set automatically based on config setting.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $_enable_xss = FALSE;
|
||||
|
||||
/**
|
||||
* Enable CSRF flag
|
||||
*
|
||||
* Enables a CSRF cookie token to be set.
|
||||
* Set automatically based on config setting.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $_enable_csrf = FALSE;
|
||||
|
||||
/**
|
||||
* List of all HTTP request headers
|
||||
*
|
||||
|
@ -122,8 +83,15 @@ class CI_Input {
|
|||
*/
|
||||
protected $_input_stream;
|
||||
|
||||
/**
|
||||
* CI_Security instance
|
||||
*
|
||||
* Used for the optional $xss_filter parameter that most
|
||||
* getter methods have here.
|
||||
*
|
||||
* @var CI_Security
|
||||
*/
|
||||
protected $security;
|
||||
protected $uni;
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
|
@ -135,30 +103,9 @@ class CI_Input {
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
public function __construct(CI_Security &$security)
|
||||
{
|
||||
$this->_allow_get_array = (config_item('allow_get_array') === TRUE);
|
||||
$this->_enable_xss = (config_item('global_xss_filtering') === TRUE);
|
||||
$this->_enable_csrf = (config_item('csrf_protection') === TRUE);
|
||||
$this->_standardize_newlines = (bool) config_item('standardize_newlines');
|
||||
|
||||
$this->security =& load_class('Security', 'core');
|
||||
|
||||
// Do we need the UTF-8 class?
|
||||
if (UTF8_ENABLED === TRUE)
|
||||
{
|
||||
$this->uni =& load_class('Utf8', 'core');
|
||||
}
|
||||
|
||||
// Sanitize global arrays
|
||||
$this->_sanitize_globals();
|
||||
|
||||
// CSRF Protection check
|
||||
if ($this->_enable_csrf === TRUE && ! is_cli())
|
||||
{
|
||||
$this->security->csrf_verify();
|
||||
}
|
||||
|
||||
$this->security = $security;
|
||||
log_message('info', 'Input Class Initialized');
|
||||
}
|
||||
|
||||
|
@ -174,10 +121,8 @@ class CI_Input {
|
|||
* @param bool $xss_clean Whether to apply XSS filtering
|
||||
* @return mixed
|
||||
*/
|
||||
protected function _fetch_from_array(&$array, $index = NULL, $xss_clean = NULL)
|
||||
protected function _fetch_from_array(&$array, $index = NULL, $xss_clean = FALSE)
|
||||
{
|
||||
is_bool($xss_clean) OR $xss_clean = $this->_enable_xss;
|
||||
|
||||
// If $index is NULL, it means that the whole $array is requested
|
||||
isset($index) OR $index = array_keys($array);
|
||||
|
||||
|
@ -237,7 +182,7 @@ class CI_Input {
|
|||
* @param bool $xss_clean Whether to apply XSS filtering
|
||||
* @return mixed
|
||||
*/
|
||||
public function get($index = NULL, $xss_clean = NULL)
|
||||
public function get($index = NULL, $xss_clean = FALSE)
|
||||
{
|
||||
return $this->_fetch_from_array($_GET, $index, $xss_clean);
|
||||
}
|
||||
|
@ -251,7 +196,7 @@ class CI_Input {
|
|||
* @param bool $xss_clean Whether to apply XSS filtering
|
||||
* @return mixed
|
||||
*/
|
||||
public function post($index = NULL, $xss_clean = NULL)
|
||||
public function post($index = NULL, $xss_clean = FALSE)
|
||||
{
|
||||
return $this->_fetch_from_array($_POST, $index, $xss_clean);
|
||||
}
|
||||
|
@ -265,11 +210,10 @@ class CI_Input {
|
|||
* @param bool $xss_clean Whether to apply XSS filtering
|
||||
* @return mixed
|
||||
*/
|
||||
public function post_get($index, $xss_clean = NULL)
|
||||
public function post_get($index, $xss_clean = FALSE)
|
||||
{
|
||||
return isset($_POST[$index])
|
||||
? $this->post($index, $xss_clean)
|
||||
: $this->get($index, $xss_clean);
|
||||
$output = $this->post($index, $xss_clean);
|
||||
return isset($output) ? $output : $this->get($index, $xss_clean);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
@ -281,11 +225,10 @@ class CI_Input {
|
|||
* @param bool $xss_clean Whether to apply XSS filtering
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_post($index, $xss_clean = NULL)
|
||||
public function get_post($index, $xss_clean = FALSE)
|
||||
{
|
||||
return isset($_GET[$index])
|
||||
? $this->get($index, $xss_clean)
|
||||
: $this->post($index, $xss_clean);
|
||||
$output = $this->get($index, $xss_clean);
|
||||
return isset($output) ? $output : $this->post($index, $xss_clean);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
@ -297,7 +240,7 @@ class CI_Input {
|
|||
* @param bool $xss_clean Whether to apply XSS filtering
|
||||
* @return mixed
|
||||
*/
|
||||
public function cookie($index = NULL, $xss_clean = NULL)
|
||||
public function cookie($index = NULL, $xss_clean = FALSE)
|
||||
{
|
||||
return $this->_fetch_from_array($_COOKIE, $index, $xss_clean);
|
||||
}
|
||||
|
@ -311,7 +254,7 @@ class CI_Input {
|
|||
* @param bool $xss_clean Whether to apply XSS filtering
|
||||
* @return mixed
|
||||
*/
|
||||
public function server($index, $xss_clean = NULL)
|
||||
public function server($index, $xss_clean = FALSE)
|
||||
{
|
||||
return $this->_fetch_from_array($_SERVER, $index, $xss_clean);
|
||||
}
|
||||
|
@ -327,7 +270,7 @@ class CI_Input {
|
|||
* @param bool $xss_clean Whether to apply XSS filtering
|
||||
* @return mixed
|
||||
*/
|
||||
public function input_stream($index = NULL, $xss_clean = NULL)
|
||||
public function input_stream($index = NULL, $xss_clean = FALSE)
|
||||
{
|
||||
// Prior to PHP 5.6, the input stream can only be read once,
|
||||
// so we'll need to check if we have already done that first.
|
||||
|
@ -359,7 +302,7 @@ class CI_Input {
|
|||
* @param bool $httponly Whether to only makes the cookie accessible via HTTP (no javascript)
|
||||
* @return void
|
||||
*/
|
||||
public function set_cookie($name, $value = '', $expire = '', $domain = '', $path = '/', $prefix = '', $secure = NULL, $httponly = NULL)
|
||||
public function set_cookie($name, $value = '', $expire = 0, $domain = '', $path = '/', $prefix = '', $secure = NULL, $httponly = NULL)
|
||||
{
|
||||
if (is_array($name))
|
||||
{
|
||||
|
@ -396,9 +339,9 @@ class CI_Input {
|
|||
? (bool) config_item('cookie_httponly')
|
||||
: (bool) $httponly;
|
||||
|
||||
if ( ! is_numeric($expire))
|
||||
if ( ! is_numeric($expire) OR $expire < 0)
|
||||
{
|
||||
$expire = time() - 86500;
|
||||
$expire = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -579,174 +522,13 @@ class CI_Input {
|
|||
*
|
||||
* @return string|null User Agent string or NULL if it doesn't exist
|
||||
*/
|
||||
public function user_agent($xss_clean = NULL)
|
||||
public function user_agent($xss_clean = FALSE)
|
||||
{
|
||||
return $this->_fetch_from_array($_SERVER, 'HTTP_USER_AGENT', $xss_clean);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Sanitize Globals
|
||||
*
|
||||
* Internal method serving for the following purposes:
|
||||
*
|
||||
* - Unsets $_GET data, if query strings are not enabled
|
||||
* - Cleans POST, COOKIE and SERVER data
|
||||
* - Standardizes newline characters to PHP_EOL
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function _sanitize_globals()
|
||||
{
|
||||
// Is $_GET data allowed? If not we'll set the $_GET to an empty array
|
||||
if ($this->_allow_get_array === FALSE)
|
||||
{
|
||||
$_GET = array();
|
||||
}
|
||||
elseif (is_array($_GET))
|
||||
{
|
||||
foreach ($_GET as $key => $val)
|
||||
{
|
||||
$_GET[$this->_clean_input_keys($key)] = $this->_clean_input_data($val);
|
||||
}
|
||||
}
|
||||
|
||||
// Clean $_POST Data
|
||||
if (is_array($_POST))
|
||||
{
|
||||
foreach ($_POST as $key => $val)
|
||||
{
|
||||
$_POST[$this->_clean_input_keys($key)] = $this->_clean_input_data($val);
|
||||
}
|
||||
}
|
||||
|
||||
// Clean $_COOKIE Data
|
||||
if (is_array($_COOKIE))
|
||||
{
|
||||
// Also get rid of specially treated cookies that might be set by a server
|
||||
// or silly application, that are of no use to a CI application anyway
|
||||
// but that when present will trip our 'Disallowed Key Characters' alarm
|
||||
// http://www.ietf.org/rfc/rfc2109.txt
|
||||
// note that the key names below are single quoted strings, and are not PHP variables
|
||||
unset(
|
||||
$_COOKIE['$Version'],
|
||||
$_COOKIE['$Path'],
|
||||
$_COOKIE['$Domain']
|
||||
);
|
||||
|
||||
foreach ($_COOKIE as $key => $val)
|
||||
{
|
||||
if (($cookie_key = $this->_clean_input_keys($key)) !== FALSE)
|
||||
{
|
||||
$_COOKIE[$cookie_key] = $this->_clean_input_data($val);
|
||||
}
|
||||
else
|
||||
{
|
||||
unset($_COOKIE[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Sanitize PHP_SELF
|
||||
$_SERVER['PHP_SELF'] = strip_tags($_SERVER['PHP_SELF']);
|
||||
|
||||
log_message('debug', 'Global POST, GET and COOKIE data sanitized');
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Clean Input Data
|
||||
*
|
||||
* Internal method that aids in escaping data and
|
||||
* standardizing newline characters to PHP_EOL.
|
||||
*
|
||||
* @param string|string[] $str Input string(s)
|
||||
* @return string
|
||||
*/
|
||||
protected function _clean_input_data($str)
|
||||
{
|
||||
if (is_array($str))
|
||||
{
|
||||
$new_array = array();
|
||||
foreach (array_keys($str) as $key)
|
||||
{
|
||||
$new_array[$this->_clean_input_keys($key)] = $this->_clean_input_data($str[$key]);
|
||||
}
|
||||
return $new_array;
|
||||
}
|
||||
|
||||
/* We strip slashes if magic quotes is on to keep things consistent
|
||||
|
||||
NOTE: In PHP 5.4 get_magic_quotes_gpc() will always return 0 and
|
||||
it will probably not exist in future versions at all.
|
||||
*/
|
||||
if ( ! is_php('5.4') && get_magic_quotes_gpc())
|
||||
{
|
||||
$str = stripslashes($str);
|
||||
}
|
||||
|
||||
// Clean UTF-8 if supported
|
||||
if (UTF8_ENABLED === TRUE)
|
||||
{
|
||||
$str = $this->uni->clean_string($str);
|
||||
}
|
||||
|
||||
// Remove control characters
|
||||
$str = remove_invisible_characters($str, FALSE);
|
||||
|
||||
// Standardize newlines if needed
|
||||
if ($this->_standardize_newlines === TRUE)
|
||||
{
|
||||
return preg_replace('/(?:\r\n|[\r\n])/', PHP_EOL, $str);
|
||||
}
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Clean Keys
|
||||
*
|
||||
* Internal method that helps to prevent malicious users
|
||||
* from trying to exploit keys we make sure that keys are
|
||||
* only named with alpha-numeric text and a few other items.
|
||||
*
|
||||
* @param string $str Input string
|
||||
* @param bool $fatal Whether to terminate script exection
|
||||
* or to return FALSE if an invalid
|
||||
* key is encountered
|
||||
* @return string|bool
|
||||
*/
|
||||
protected function _clean_input_keys($str, $fatal = TRUE)
|
||||
{
|
||||
if ( ! preg_match('/^[a-z0-9:_\/|-]+$/i', $str))
|
||||
{
|
||||
if ($fatal === TRUE)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
set_status_header(503);
|
||||
echo 'Disallowed Key Characters.';
|
||||
exit(7); // EXIT_USER_INPUT
|
||||
}
|
||||
}
|
||||
|
||||
// Clean UTF-8 if supported
|
||||
if (UTF8_ENABLED === TRUE)
|
||||
{
|
||||
return $this->uni->clean_string($str);
|
||||
}
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Request Headers
|
||||
*
|
||||
|
@ -838,21 +620,6 @@ class CI_Input {
|
|||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Is CLI request?
|
||||
*
|
||||
* Test to see if a request was made from the command line.
|
||||
*
|
||||
* @deprecated 3.0.0 Use is_cli() instead
|
||||
* @return bool
|
||||
*/
|
||||
public function is_cli_request()
|
||||
{
|
||||
return is_cli();
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Get Request Method
|
||||
*
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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
|
||||
|
@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Libraries
|
||||
* @category Language
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/libraries/language.html
|
||||
* @link https://codeigniter.com/userguide3/libraries/language.html
|
||||
*/
|
||||
class CI_Lang {
|
||||
|
||||
|
@ -146,6 +146,7 @@ class CI_Lang {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// try to load in default language (english) //
|
||||
if (($found !== TRUE)&&($idiom != 'english')) {
|
||||
$idiom = 'english';
|
||||
|
@ -161,7 +162,7 @@ class CI_Lang {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($found !== TRUE)
|
||||
{
|
||||
show_error('Unable to load the requested language file: language/'.$idiom.'/'.$langfile);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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
|
||||
|
@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Libraries
|
||||
* @category Loader
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/libraries/loader.html
|
||||
* @link https://codeigniter.com/userguide3/libraries/loader.html
|
||||
*/
|
||||
class CI_Loader {
|
||||
|
||||
|
@ -226,7 +226,7 @@ class CI_Loader {
|
|||
*
|
||||
* Loads and instantiates models.
|
||||
*
|
||||
* @param string $model Model name
|
||||
* @param mixed $model Model name
|
||||
* @param string $name An optional object name to assign to
|
||||
* @param bool $db_conn An optional database connection configuration to initialize
|
||||
* @return object
|
||||
|
@ -303,6 +303,8 @@ class CI_Loader {
|
|||
{
|
||||
throw new RuntimeException($app_path."Model.php exists, but doesn't declare class CI_Model");
|
||||
}
|
||||
|
||||
log_message('info', 'CI_Model class loaded');
|
||||
}
|
||||
elseif ( ! class_exists('CI_Model', FALSE))
|
||||
{
|
||||
|
@ -317,6 +319,8 @@ class CI_Loader {
|
|||
{
|
||||
throw new RuntimeException($app_path.$class.".php exists, but doesn't declare class ".$class);
|
||||
}
|
||||
|
||||
log_message('info', config_item('subclass_prefix').'Model class loaded');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -344,13 +348,16 @@ class CI_Loader {
|
|||
throw new RuntimeException('Unable to locate the model you have specified: '.$model);
|
||||
}
|
||||
}
|
||||
elseif ( ! is_subclass_of($model, 'CI_Model'))
|
||||
|
||||
if ( ! is_subclass_of($model, 'CI_Model'))
|
||||
{
|
||||
throw new RuntimeException("Class ".$model." already exists and doesn't extend CI_Model");
|
||||
throw new RuntimeException("Class ".$model." doesn't extend CI_Model");
|
||||
}
|
||||
|
||||
$this->_ci_models[] = $name;
|
||||
$CI->$name = new $model();
|
||||
$model = new $model();
|
||||
$CI->$name = $model;
|
||||
log_message('info', 'Model "'.get_class($model).'" initialized');
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -937,7 +944,7 @@ class CI_Loader {
|
|||
empty($_ci_vars) OR $this->_ci_cached_vars = array_merge($this->_ci_cached_vars, $_ci_vars);
|
||||
extract($this->_ci_cached_vars);
|
||||
|
||||
/*
|
||||
/**
|
||||
* Buffer the output
|
||||
*
|
||||
* We buffer the output for two reasons:
|
||||
|
@ -950,18 +957,7 @@ class CI_Loader {
|
|||
*/
|
||||
ob_start();
|
||||
|
||||
// If the PHP installation does not support short tags we'll
|
||||
// do a little string replacement, changing the short tags
|
||||
// to standard PHP echo statements.
|
||||
if ( ! is_php('5.4') && ! ini_get('short_open_tag') && config_item('rewrite_short_tags') === TRUE)
|
||||
{
|
||||
echo eval('?>'.preg_replace('/;*\s*\?>/', '; ?>', str_replace('<?=', '<?php echo ', file_get_contents($_ci_path))));
|
||||
}
|
||||
else
|
||||
{
|
||||
include($_ci_path); // include() vs include_once() allows for multiple views with the same name
|
||||
}
|
||||
|
||||
include($_ci_path); // include() vs include_once() allows for multiple views with the same name
|
||||
log_message('info', 'File loaded: '.$_ci_path);
|
||||
|
||||
// Return the file data if requested
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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
|
||||
|
@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Libraries
|
||||
* @category Logging
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/general/errors.html
|
||||
* @link https://codeigniter.com/userguide3/general/errors.html
|
||||
*/
|
||||
class CI_Log {
|
||||
|
||||
|
@ -124,7 +124,9 @@ class CI_Log {
|
|||
|
||||
isset(self::$func_overload) OR self::$func_overload = (extension_loaded('mbstring') && ini_get('mbstring.func_overload'));
|
||||
|
||||
$this->_log_path = ($config['log_path'] !== '') ? $config['log_path'] : APPPATH.'logs/';
|
||||
$this->_log_path = ($config['log_path'] !== '')
|
||||
? rtrim($config['log_path'], '/\\').DIRECTORY_SEPARATOR : APPPATH.'logs'.DIRECTORY_SEPARATOR;
|
||||
|
||||
$this->_file_ext = (isset($config['log_file_extension']) && $config['log_file_extension'] !== '')
|
||||
? ltrim($config['log_file_extension'], '.') : 'php';
|
||||
|
||||
|
@ -247,11 +249,11 @@ class CI_Log {
|
|||
* @param string $level The error level
|
||||
* @param string $date Formatted date string
|
||||
* @param string $message The log message
|
||||
* @return string Formatted log line with a new line character '\n' at the end
|
||||
* @return string Formatted log line with a new line character at the end
|
||||
*/
|
||||
protected function _format_line($level, $date, $message)
|
||||
{
|
||||
return $level.' - '.$date.' --> '.$message."\n";
|
||||
return $level.' - '.$date.' --> '.$message.PHP_EOL;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
@ -283,9 +285,6 @@ class CI_Log {
|
|||
{
|
||||
if (self::$func_overload)
|
||||
{
|
||||
// mb_substr($str, $start, null, '8bit') returns an empty
|
||||
// string on PHP 5.3
|
||||
isset($length) OR $length = ($start >= 0 ? self::strlen($str) - $start : -$start);
|
||||
return mb_substr($str, $start, $length, '8bit');
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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
|
||||
|
@ -44,22 +44,10 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Libraries
|
||||
* @category Libraries
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/libraries/config.html
|
||||
* @link https://codeigniter.com/userguide3/libraries/config.html
|
||||
*/
|
||||
class CI_Model {
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
log_message('info', 'Model Class Initialized');
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* __get magic
|
||||
*
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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
|
||||
|
@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Libraries
|
||||
* @category Output
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/libraries/output.html
|
||||
* @link https://codeigniter.com/userguide3/libraries/output.html
|
||||
*/
|
||||
class CI_Output {
|
||||
|
||||
|
@ -412,7 +412,7 @@ class CI_Output {
|
|||
* @param string $output Output data override
|
||||
* @return void
|
||||
*/
|
||||
public function _display($output = '')
|
||||
public function _display($output = NULL)
|
||||
{
|
||||
// Note: We use load_class() because we can't use $CI =& get_instance()
|
||||
// since this function is sometimes called by the caching mechanism,
|
||||
|
@ -429,7 +429,7 @@ class CI_Output {
|
|||
// --------------------------------------------------------------------
|
||||
|
||||
// Set the output data
|
||||
if ($output === '')
|
||||
if ($output === NULL)
|
||||
{
|
||||
$output =& $this->final_output;
|
||||
}
|
||||
|
@ -502,7 +502,7 @@ class CI_Output {
|
|||
|
||||
echo $output;
|
||||
log_message('info', 'Final output sent to browser');
|
||||
log_message('debug', 'Total execution time: '.$elapsed);
|
||||
log_message('info', 'Total execution time: '.$elapsed);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -539,7 +539,7 @@ class CI_Output {
|
|||
}
|
||||
|
||||
log_message('info', 'Final output sent to browser');
|
||||
log_message('debug', 'Total execution time: '.$elapsed);
|
||||
log_message('info', 'Total execution time: '.$elapsed);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
@ -554,7 +554,7 @@ class CI_Output {
|
|||
{
|
||||
$CI =& get_instance();
|
||||
$path = $CI->config->item('cache_path');
|
||||
$cache_path = ($path === '') ? APPPATH.'cache/' : $path;
|
||||
$cache_path = ($path === '') ? APPPATH.'cache'.DIRECTORY_SEPARATOR : rtrim($path, '/\\').DIRECTORY_SEPARATOR;
|
||||
|
||||
if ( ! is_dir($cache_path) OR ! is_really_writable($cache_path))
|
||||
{
|
||||
|
@ -563,7 +563,7 @@ class CI_Output {
|
|||
}
|
||||
|
||||
$uri = $CI->config->item('base_url')
|
||||
.$CI->config->item('index_page')
|
||||
.$CI->config->slash_item('index_page')
|
||||
.$CI->uri->uri_string();
|
||||
|
||||
if (($cache_query_string = $CI->config->item('cache_query_string')) && ! empty($_SERVER['QUERY_STRING']))
|
||||
|
@ -658,7 +658,7 @@ class CI_Output {
|
|||
$cache_path = ($CFG->item('cache_path') === '') ? APPPATH.'cache/' : $CFG->item('cache_path');
|
||||
|
||||
// Build the file path. The file name is an MD5 hash of the full URI
|
||||
$uri = $CFG->item('base_url').$CFG->item('index_page').$URI->uri_string;
|
||||
$uri = $CFG->item('base_url').$CFG->slash_item('index_page').$URI->uri_string;
|
||||
|
||||
if (($cache_query_string = $CFG->item('cache_query_string')) && ! empty($_SERVER['QUERY_STRING']))
|
||||
{
|
||||
|
@ -761,7 +761,7 @@ class CI_Output {
|
|||
}
|
||||
}
|
||||
|
||||
$cache_path .= md5($CI->config->item('base_url').$CI->config->item('index_page').ltrim($uri, '/'));
|
||||
$cache_path .= md5($CI->config->item('base_url').$CI->config->slash_item('index_page').ltrim($uri, '/'));
|
||||
|
||||
if ( ! @unlink($cache_path))
|
||||
{
|
||||
|
@ -829,9 +829,6 @@ class CI_Output {
|
|||
{
|
||||
if (self::$func_overload)
|
||||
{
|
||||
// mb_substr($str, $start, null, '8bit') returns an empty
|
||||
// string on PHP 5.3
|
||||
isset($length) OR $length = ($start >= 0 ? self::strlen($str) - $start : -$start);
|
||||
return mb_substr($str, $start, $length, '8bit');
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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
|
||||
|
@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Libraries
|
||||
* @category Libraries
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/general/routing.html
|
||||
* @link https://codeigniter.com/userguide3/general/routing.html
|
||||
*/
|
||||
class CI_Router {
|
||||
|
||||
|
@ -438,19 +438,6 @@ class CI_Router {
|
|||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Fetch the current class
|
||||
*
|
||||
* @deprecated 3.0.0 Read the 'class' property instead
|
||||
* @return string
|
||||
*/
|
||||
public function fetch_class()
|
||||
{
|
||||
return $this->class;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Set method name
|
||||
*
|
||||
|
@ -464,19 +451,6 @@ class CI_Router {
|
|||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Fetch the current method
|
||||
*
|
||||
* @deprecated 3.0.0 Read the 'method' property instead
|
||||
* @return string
|
||||
*/
|
||||
public function fetch_method()
|
||||
{
|
||||
return $this->method;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Set directory name
|
||||
*
|
||||
|
@ -495,21 +469,4 @@ class CI_Router {
|
|||
$this->directory .= str_replace('.', '', trim($dir, '/')).'/';
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Fetch directory
|
||||
*
|
||||
* Feches the sub-directory (if any) that contains the requested
|
||||
* controller class.
|
||||
*
|
||||
* @deprecated 3.0.0 Read the 'directory' property instead
|
||||
* @return string
|
||||
*/
|
||||
public function fetch_directory()
|
||||
{
|
||||
return $this->directory;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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
|
||||
|
@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Libraries
|
||||
* @category Security
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/libraries/security.html
|
||||
* @link https://codeigniter.com/userguide3/libraries/security.html
|
||||
*/
|
||||
class CI_Security {
|
||||
|
||||
|
@ -134,7 +134,9 @@ class CI_Security {
|
|||
*/
|
||||
protected $_never_allowed_str = array(
|
||||
'document.cookie' => '[removed]',
|
||||
'(document).cookie' => '[removed]',
|
||||
'document.write' => '[removed]',
|
||||
'(document).write' => '[removed]',
|
||||
'.parentNode' => '[removed]',
|
||||
'.innerHTML' => '[removed]',
|
||||
'-moz-binding' => '[removed]',
|
||||
|
@ -152,7 +154,7 @@ class CI_Security {
|
|||
*/
|
||||
protected $_never_allowed_regex = array(
|
||||
'javascript\s*:',
|
||||
'(document|(document\.)?window)\.(location|on\w*)',
|
||||
'(\(?document\)?|\(?window\)?(\.document)?)\.(location|on\w*)',
|
||||
'expression\s*(\(|&\#40;)', // CSS and IE
|
||||
'vbscript\s*:', // IE, surprise!
|
||||
'wscript\s*:', // IE
|
||||
|
@ -167,10 +169,12 @@ class CI_Security {
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
public function __construct($charset)
|
||||
{
|
||||
$this->charset = $charset;
|
||||
|
||||
// Is CSRF protection enabled?
|
||||
if (config_item('csrf_protection'))
|
||||
if (config_item('csrf_protection') && ! is_cli())
|
||||
{
|
||||
// CSRF config
|
||||
foreach (array('csrf_expire', 'csrf_token_name', 'csrf_cookie_name') as $key)
|
||||
|
@ -189,10 +193,9 @@ class CI_Security {
|
|||
|
||||
// Set the CSRF hash
|
||||
$this->_csrf_set_hash();
|
||||
$this->csrf_verify();
|
||||
}
|
||||
|
||||
$this->charset = strtoupper(config_item('charset'));
|
||||
|
||||
log_message('info', 'Security Class Initialized');
|
||||
}
|
||||
|
||||
|
@ -226,6 +229,7 @@ class CI_Security {
|
|||
|
||||
// Check CSRF token validity, but don't error on mismatch just yet - we'll want to regenerate
|
||||
$valid = isset($_POST[$this->_csrf_token_name], $_COOKIE[$this->_csrf_cookie_name])
|
||||
&& is_string($_POST[$this->_csrf_token_name]) && is_string($_COOKIE[$this->_csrf_cookie_name])
|
||||
&& hash_equals($_POST[$this->_csrf_token_name], $_COOKIE[$this->_csrf_cookie_name]);
|
||||
|
||||
// We kill this since we're done and we don't want to pollute the _POST array
|
||||
|
@ -542,6 +546,14 @@ class CI_Security {
|
|||
$str
|
||||
);
|
||||
|
||||
// Same thing, but for "tag functions" (e.g. eval`some code`)
|
||||
// See https://github.com/bcit-ci/CodeIgniter/issues/5420
|
||||
$str = preg_replace(
|
||||
'#(alert|prompt|confirm|cmd|passthru|eval|exec|expression|system|fopen|fsockopen|file|file_get_contents|readfile|unlink)(\s*)`(.*?)`#si',
|
||||
'\\1\\2`\\3`',
|
||||
$str
|
||||
);
|
||||
|
||||
// Final clean up
|
||||
// This adds a bit of extra precaution in case
|
||||
// something got through the above filters
|
||||
|
@ -628,7 +640,7 @@ class CI_Security {
|
|||
if (is_readable('/dev/urandom') && ($fp = fopen('/dev/urandom', 'rb')) !== FALSE)
|
||||
{
|
||||
// Try not to waste entropy ...
|
||||
is_php('5.4') && stream_set_chunk_size($fp, $length);
|
||||
stream_set_chunk_size($fp, $length);
|
||||
$output = fread($fp, $length);
|
||||
fclose($fp);
|
||||
if ($output !== FALSE)
|
||||
|
@ -658,7 +670,7 @@ class CI_Security {
|
|||
* correctly. html_entity_decode() does not convert entities without
|
||||
* semicolons, so we are left with our own little solution here. Bummer.
|
||||
*
|
||||
* @link http://php.net/html-entity-decode
|
||||
* @link https://secure.php.net/html-entity-decode
|
||||
*
|
||||
* @param string $str Input
|
||||
* @param string $charset Character set
|
||||
|
@ -673,26 +685,8 @@ class CI_Security {
|
|||
|
||||
static $_entities;
|
||||
|
||||
isset($charset) OR $charset = $this->charset;
|
||||
$flag = is_php('5.4')
|
||||
? ENT_COMPAT | ENT_HTML5
|
||||
: ENT_COMPAT;
|
||||
|
||||
if ( ! isset($_entities))
|
||||
{
|
||||
$_entities = array_map('strtolower', get_html_translation_table(HTML_ENTITIES, $flag, $charset));
|
||||
|
||||
// If we're not on PHP 5.4+, add the possibly dangerous HTML 5
|
||||
// entities to the array manually
|
||||
if ($flag === ENT_COMPAT)
|
||||
{
|
||||
$_entities[':'] = ':';
|
||||
$_entities['('] = '(';
|
||||
$_entities[')'] = ')';
|
||||
$_entities["\n"] = '
';
|
||||
$_entities["\t"] = '	';
|
||||
}
|
||||
}
|
||||
isset($charset) OR $charset = $this->charset;
|
||||
isset($_entities) OR $_entities = array_map('strtolower', get_html_translation_table(HTML_ENTITIES, ENT_COMPAT | ENT_HTML5, $charset));
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -717,14 +711,9 @@ class CI_Security {
|
|||
// Decode numeric & UTF16 two byte entities
|
||||
$str = html_entity_decode(
|
||||
preg_replace('/(&#(?:x0*[0-9a-f]{2,5}(?![0-9a-f;])|(?:0*\d{2,4}(?![0-9;]))))/iS', '$1;', $str),
|
||||
$flag,
|
||||
ENT_COMPAT | ENT_HTML5,
|
||||
$charset
|
||||
);
|
||||
|
||||
if ($flag === ENT_COMPAT)
|
||||
{
|
||||
$str = str_replace(array_values($_entities), array_keys($_entities), $str);
|
||||
}
|
||||
}
|
||||
while ($str_compare !== $str);
|
||||
return $str;
|
||||
|
@ -853,7 +842,7 @@ class CI_Security {
|
|||
// For other tags, see if their attributes are "evil" and strip those
|
||||
elseif (isset($matches['attributes']))
|
||||
{
|
||||
// We'll store the already fitlered attributes here
|
||||
// We'll store the already filtered attributes here
|
||||
$attributes = array();
|
||||
|
||||
// Attribute-catching pattern
|
||||
|
@ -927,7 +916,7 @@ class CI_Security {
|
|||
return str_replace(
|
||||
$match[1],
|
||||
preg_replace(
|
||||
'#href=.*?(?:(?:alert|prompt|confirm)(?:\(|&\#40;)|javascript:|livescript:|mocha:|charset=|window\.|document\.|\.cookie|<script|<xss|d\s*a\s*t\s*a\s*:)#si',
|
||||
'#href=.*?(?:(?:alert|prompt|confirm)(?:\(|&\#40;|`|&\#96;)|javascript:|livescript:|mocha:|charset=|window\.|\(?document\)?\.|\.cookie|<script|<xss|d\s*a\s*t\s*a\s*:)#si',
|
||||
'',
|
||||
$this->_filter_attributes($match[1])
|
||||
),
|
||||
|
@ -955,7 +944,7 @@ class CI_Security {
|
|||
return str_replace(
|
||||
$match[1],
|
||||
preg_replace(
|
||||
'#src=.*?(?:(?:alert|prompt|confirm|eval)(?:\(|&\#40;)|javascript:|livescript:|mocha:|charset=|window\.|document\.|\.cookie|<script|<xss|base64\s*,)#si',
|
||||
'#src=.*?(?:(?:alert|prompt|confirm|eval)(?:\(|&\#40;|`|&\#96;)|javascript:|livescript:|mocha:|charset=|window\.|\(?document\)?\.|\.cookie|<script|<xss|base64\s*,)#si',
|
||||
'',
|
||||
$this->_filter_attributes($match[1])
|
||||
),
|
||||
|
@ -1076,5 +1065,4 @@ class CI_Security {
|
|||
|
||||
return $this->_csrf_hash;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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
|
||||
|
@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Libraries
|
||||
* @category URI
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/libraries/uri.html
|
||||
* @link https://codeigniter.com/userguide3/libraries/uri.html
|
||||
*/
|
||||
class CI_URI {
|
||||
|
||||
|
@ -96,45 +96,40 @@ class CI_URI {
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
public function __construct(CI_Config $config)
|
||||
{
|
||||
$this->config =& load_class('Config', 'core');
|
||||
$this->config = $config;
|
||||
|
||||
// If it's a CLI request, ignore the configuration
|
||||
if (is_cli())
|
||||
{
|
||||
$this->_set_uri_string($this->_parse_argv(), TRUE);
|
||||
}
|
||||
// If query strings are enabled, we don't need to parse any segments.
|
||||
// However, they don't make sense under CLI.
|
||||
if (is_cli() OR $this->config->item('enable_query_strings') !== TRUE)
|
||||
elseif ($this->config->item('enable_query_strings') !== TRUE)
|
||||
{
|
||||
$this->_permitted_uri_chars = $this->config->item('permitted_uri_chars');
|
||||
$protocol = $this->config->item('uri_protocol');
|
||||
empty($protocol) && $protocol = 'REQUEST_URI';
|
||||
|
||||
// If it's a CLI request, ignore the configuration
|
||||
if (is_cli())
|
||||
switch ($protocol)
|
||||
{
|
||||
$uri = $this->_parse_argv();
|
||||
}
|
||||
else
|
||||
{
|
||||
$protocol = $this->config->item('uri_protocol');
|
||||
empty($protocol) && $protocol = 'REQUEST_URI';
|
||||
|
||||
switch ($protocol)
|
||||
{
|
||||
case 'AUTO': // For BC purposes only
|
||||
case 'REQUEST_URI':
|
||||
$uri = $this->_parse_request_uri();
|
||||
break;
|
||||
case 'QUERY_STRING':
|
||||
$uri = $this->_parse_query_string();
|
||||
break;
|
||||
case 'PATH_INFO':
|
||||
default:
|
||||
$uri = isset($_SERVER[$protocol])
|
||||
? $_SERVER[$protocol]
|
||||
: $this->_parse_request_uri();
|
||||
break;
|
||||
}
|
||||
case 'AUTO': // For BC purposes only
|
||||
case 'REQUEST_URI':
|
||||
$uri = $this->_parse_request_uri();
|
||||
break;
|
||||
case 'QUERY_STRING':
|
||||
$uri = $this->_parse_query_string();
|
||||
break;
|
||||
case 'PATH_INFO':
|
||||
default:
|
||||
$uri = isset($_SERVER[$protocol])
|
||||
? $_SERVER[$protocol]
|
||||
: $this->_parse_request_uri();
|
||||
break;
|
||||
}
|
||||
|
||||
$this->_set_uri_string($uri);
|
||||
$this->_set_uri_string($uri, FALSE);
|
||||
}
|
||||
|
||||
log_message('info', 'URI Class Initialized');
|
||||
|
@ -145,43 +140,66 @@ class CI_URI {
|
|||
/**
|
||||
* Set URI String
|
||||
*
|
||||
* @param string $str
|
||||
* @param string $str Input URI string
|
||||
* @param bool $is_cli Whether the input comes from CLI
|
||||
* @return void
|
||||
*/
|
||||
protected function _set_uri_string($str)
|
||||
protected function _set_uri_string($str, $is_cli = FALSE)
|
||||
{
|
||||
// Filter out control characters and trim slashes
|
||||
$this->uri_string = trim(remove_invisible_characters($str, FALSE), '/');
|
||||
|
||||
if ($this->uri_string !== '')
|
||||
// CLI requests have a bit simpler logic
|
||||
if ($is_cli)
|
||||
{
|
||||
// Remove the URL suffix, if present
|
||||
if (($suffix = (string) $this->config->item('url_suffix')) !== '')
|
||||
if (($this->uri_string = trim($str, '/')) === '')
|
||||
{
|
||||
$slen = strlen($suffix);
|
||||
|
||||
if (substr($this->uri_string, -$slen) === $suffix)
|
||||
{
|
||||
$this->uri_string = substr($this->uri_string, 0, -$slen);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
$this->segments[0] = NULL;
|
||||
// Populate the segments array
|
||||
foreach (explode('/', trim($this->uri_string, '/')) as $val)
|
||||
foreach (explode('/', $this->uri_string) as $segment)
|
||||
{
|
||||
$val = trim($val);
|
||||
// Filter segments for security
|
||||
$this->filter_uri($val);
|
||||
|
||||
if ($val !== '')
|
||||
if (($segment = trim($segment)) !== '')
|
||||
{
|
||||
$this->segments[] = $val;
|
||||
$this->segments[] = $segment;
|
||||
}
|
||||
}
|
||||
|
||||
unset($this->segments[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
// Filter out control characters and trim slashes
|
||||
$this->uri_string = trim(remove_invisible_characters($str, FALSE), '/');
|
||||
|
||||
if ($this->uri_string === '')
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove the URL suffix, if present
|
||||
if (($suffix = (string) $this->config->item('url_suffix')) !== '')
|
||||
{
|
||||
$slen = strlen($suffix);
|
||||
|
||||
if (substr($this->uri_string, -$slen) === $suffix)
|
||||
{
|
||||
$this->uri_string = substr($this->uri_string, 0, -$slen);
|
||||
}
|
||||
}
|
||||
|
||||
$this->segments[0] = NULL;
|
||||
foreach (explode('/', trim($this->uri_string, '/')) as $segment)
|
||||
{
|
||||
$segment = trim($segment);
|
||||
// Filter segments for security
|
||||
$this->filter_uri($segment);
|
||||
|
||||
if ($segment !== '')
|
||||
{
|
||||
$this->segments[] = $segment;
|
||||
}
|
||||
}
|
||||
|
||||
unset($this->segments[0]);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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 2.0.0
|
||||
* @filesource
|
||||
|
@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Libraries
|
||||
* @category UTF-8
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/libraries/utf8.html
|
||||
* @link https://codeigniter.com/userguide3/libraries/utf8.html
|
||||
*/
|
||||
class CI_Utf8 {
|
||||
|
||||
|
@ -57,21 +57,21 @@ class CI_Utf8 {
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
public function __construct($charset)
|
||||
{
|
||||
if (
|
||||
defined('PREG_BAD_UTF8_ERROR') // PCRE must support UTF-8
|
||||
&& (ICONV_ENABLED === TRUE OR MB_ENABLED === TRUE) // iconv or mbstring must be installed
|
||||
&& strtoupper(config_item('charset')) === 'UTF-8' // Application charset must be UTF-8
|
||||
)
|
||||
defined('PREG_BAD_UTF8_ERROR') // PCRE must support UTF-8
|
||||
&& (ICONV_ENABLED === TRUE OR MB_ENABLED === TRUE) // iconv or mbstring must be installed
|
||||
&& $charset === 'UTF-8' // Application charset must be UTF-8
|
||||
)
|
||||
{
|
||||
define('UTF8_ENABLED', TRUE);
|
||||
log_message('debug', 'UTF-8 Support Enabled');
|
||||
log_message('info', 'UTF-8 Support Enabled');
|
||||
}
|
||||
else
|
||||
{
|
||||
define('UTF8_ENABLED', FALSE);
|
||||
log_message('debug', 'UTF-8 Support Disabled');
|
||||
log_message('info', 'UTF-8 Support Disabled');
|
||||
}
|
||||
|
||||
log_message('info', 'Utf8 Class Initialized');
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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 3.0.0
|
||||
* @filesource
|
||||
|
@ -44,8 +44,8 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage CodeIgniter
|
||||
* @category Compatibility
|
||||
* @author Andrey Andreev
|
||||
* @link https://codeigniter.com/user_guide/
|
||||
* @link http://php.net/hash
|
||||
* @link https://codeigniter.com/userguide3/
|
||||
* @link https://secure.php.net/hash
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -62,7 +62,7 @@ if ( ! function_exists('hash_equals'))
|
|||
/**
|
||||
* hash_equals()
|
||||
*
|
||||
* @link http://php.net/hash_equals
|
||||
* @link https://secure.php.net/hash_equals
|
||||
* @param string $known_string
|
||||
* @param string $user_string
|
||||
* @return bool
|
||||
|
@ -108,7 +108,7 @@ if ( ! function_exists('hash_pbkdf2'))
|
|||
/**
|
||||
* hash_pbkdf2()
|
||||
*
|
||||
* @link http://php.net/hash_pbkdf2
|
||||
* @link https://secure.php.net/hash_pbkdf2
|
||||
* @param string $algo
|
||||
* @param string $password
|
||||
* @param string $salt
|
||||
|
@ -205,8 +205,6 @@ if ( ! function_exists('hash_pbkdf2'))
|
|||
'ripemd160' => 64,
|
||||
'ripemd256' => 64,
|
||||
'ripemd320' => 64,
|
||||
'salsa10' => 64,
|
||||
'salsa20' => 64,
|
||||
'sha1' => 64,
|
||||
'sha224' => 64,
|
||||
'sha256' => 64,
|
||||
|
|
|
@ -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 - 2017, 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 - 2017, 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 3.0.0
|
||||
* @filesource
|
||||
|
@ -44,8 +44,8 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage CodeIgniter
|
||||
* @category Compatibility
|
||||
* @author Andrey Andreev
|
||||
* @link https://codeigniter.com/user_guide/
|
||||
* @link http://php.net/mbstring
|
||||
* @link https://codeigniter.com/userguide3/
|
||||
* @link https://secure.php.net/mbstring
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -65,7 +65,7 @@ if ( ! function_exists('mb_strlen'))
|
|||
* WARNING: This function WILL fall-back to strlen()
|
||||
* if iconv is not available!
|
||||
*
|
||||
* @link http://php.net/mb_strlen
|
||||
* @link https://secure.php.net/mb_strlen
|
||||
* @param string $str
|
||||
* @param string $encoding
|
||||
* @return int
|
||||
|
@ -92,7 +92,7 @@ if ( ! function_exists('mb_strpos'))
|
|||
* WARNING: This function WILL fall-back to strpos()
|
||||
* if iconv is not available!
|
||||
*
|
||||
* @link http://php.net/mb_strpos
|
||||
* @link https://secure.php.net/mb_strpos
|
||||
* @param string $haystack
|
||||
* @param string $needle
|
||||
* @param int $offset
|
||||
|
@ -121,7 +121,7 @@ if ( ! function_exists('mb_substr'))
|
|||
* WARNING: This function WILL fall-back to substr()
|
||||
* if iconv is not available.
|
||||
*
|
||||
* @link http://php.net/mb_substr
|
||||
* @link https://secure.php.net/mb_substr
|
||||
* @param string $str
|
||||
* @param int $start
|
||||
* @param int $length
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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 3.0.0
|
||||
* @filesource
|
||||
|
@ -44,8 +44,8 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage CodeIgniter
|
||||
* @category Compatibility
|
||||
* @author Andrey Andreev
|
||||
* @link https://codeigniter.com/user_guide/
|
||||
* @link http://php.net/password
|
||||
* @link https://codeigniter.com/userguide3/
|
||||
* @link https://secure.php.net/password
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -67,7 +67,7 @@ if ( ! function_exists('password_get_info'))
|
|||
/**
|
||||
* password_get_info()
|
||||
*
|
||||
* @link http://php.net/password_get_info
|
||||
* @link https://secure.php.net/password_get_info
|
||||
* @param string $hash
|
||||
* @return array
|
||||
*/
|
||||
|
@ -86,7 +86,7 @@ if ( ! function_exists('password_hash'))
|
|||
/**
|
||||
* password_hash()
|
||||
*
|
||||
* @link http://php.net/password_hash
|
||||
* @link https://secure.php.net/password_hash
|
||||
* @param string $password
|
||||
* @param int $algo
|
||||
* @param array $options
|
||||
|
@ -141,7 +141,7 @@ if ( ! function_exists('password_hash'))
|
|||
}
|
||||
|
||||
// Try not to waste entropy ...
|
||||
is_php('5.4') && stream_set_chunk_size($fp, 16);
|
||||
stream_set_chunk_size($fp, 16);
|
||||
|
||||
$options['salt'] = '';
|
||||
for ($read = 0; $read < 16; $read = ($func_overload) ? mb_strlen($options['salt'], '8bit') : strlen($options['salt']))
|
||||
|
@ -194,7 +194,7 @@ if ( ! function_exists('password_needs_rehash'))
|
|||
/**
|
||||
* password_needs_rehash()
|
||||
*
|
||||
* @link http://php.net/password_needs_rehash
|
||||
* @link https://secure.php.net/password_needs_rehash
|
||||
* @param string $hash
|
||||
* @param int $algo
|
||||
* @param array $options
|
||||
|
@ -228,7 +228,7 @@ if ( ! function_exists('password_verify'))
|
|||
/**
|
||||
* password_verify()
|
||||
*
|
||||
* @link http://php.net/password_verify
|
||||
* @link https://secure.php.net/password_verify
|
||||
* @param string $password
|
||||
* @param string $hash
|
||||
* @return bool
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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 3.0.0
|
||||
* @filesource
|
||||
|
@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage CodeIgniter
|
||||
* @category Compatibility
|
||||
* @author Andrey Andreev
|
||||
* @link https://codeigniter.com/user_guide/
|
||||
* @link https://codeigniter.com/userguide3/
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -61,7 +61,7 @@ if ( ! function_exists('array_column'))
|
|||
/**
|
||||
* array_column()
|
||||
*
|
||||
* @link http://php.net/array_column
|
||||
* @link https://secure.php.net/array_column
|
||||
* @param array $array
|
||||
* @param mixed $column_key
|
||||
* @param mixed $index_key
|
||||
|
@ -132,51 +132,3 @@ if ( ! function_exists('array_column'))
|
|||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if (is_php('5.4'))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if ( ! function_exists('hex2bin'))
|
||||
{
|
||||
/**
|
||||
* hex2bin()
|
||||
*
|
||||
* @link http://php.net/hex2bin
|
||||
* @param string $data
|
||||
* @return string
|
||||
*/
|
||||
function hex2bin($data)
|
||||
{
|
||||
if (in_array($type = gettype($data), array('array', 'double', 'object', 'resource'), TRUE))
|
||||
{
|
||||
if ($type === 'object' && method_exists($data, '__toString'))
|
||||
{
|
||||
$data = (string) $data;
|
||||
}
|
||||
else
|
||||
{
|
||||
trigger_error('hex2bin() expects parameter 1 to be string, '.$type.' given', E_USER_WARNING);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (strlen($data) % 2 !== 0)
|
||||
{
|
||||
trigger_error('Hexadecimal input string must have an even length', E_USER_WARNING);
|
||||
return FALSE;
|
||||
}
|
||||
elseif ( ! preg_match('/^[0-9a-f]*$/i', $data))
|
||||
{
|
||||
trigger_error('Input string must be hexadecimal string', E_USER_WARNING);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return pack('H*', $data);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 - 2017, 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 - 2017, 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
|
||||
|
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*
|
||||
* @param string|string[] $params
|
||||
* @param bool $query_builder_override
|
||||
|
@ -82,7 +82,7 @@ function &DB($params = '', $query_builder_override = NULL)
|
|||
}
|
||||
}
|
||||
|
||||
if ( ! isset($db) OR count($db) === 0)
|
||||
if (empty($db))
|
||||
{
|
||||
show_error('No database connection settings were found in the database config file.');
|
||||
}
|
||||
|
@ -185,17 +185,20 @@ function &DB($params = '', $query_builder_override = NULL)
|
|||
elseif ( ! class_exists('CI_DB', FALSE))
|
||||
{
|
||||
/**
|
||||
* @ignore
|
||||
* @ignore
|
||||
*/
|
||||
class CI_DB extends CI_DB_driver { }
|
||||
}
|
||||
|
||||
// Load the DB driver
|
||||
$driver_file = BASEPATH.'database/drivers/'.$params['dbdriver'].'/'.$params['dbdriver'].'_driver.php';
|
||||
|
||||
file_exists($driver_file) OR show_error('Invalid DB driver');
|
||||
require_once($driver_file);
|
||||
|
||||
// Load the result classes as well
|
||||
require_once(BASEPATH.'database/DB_result.php');
|
||||
require_once(BASEPATH.'database/drivers/'.$params['dbdriver'].'/'.$params['dbdriver'].'_result.php');
|
||||
|
||||
// Instantiate the DB adapter
|
||||
$driver = 'CI_DB_'.$params['dbdriver'].'_driver';
|
||||
$DB = new $driver($params);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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
|
||||
|
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_Cache {
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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
|
||||
|
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
abstract class CI_DB_driver {
|
||||
|
||||
|
@ -142,7 +142,7 @@ abstract class CI_DB_driver {
|
|||
*
|
||||
* @var int
|
||||
*/
|
||||
public $port = '';
|
||||
public $port = NULL;
|
||||
|
||||
/**
|
||||
* Persistent connection flag
|
||||
|
@ -380,7 +380,8 @@ abstract class CI_DB_driver {
|
|||
/**
|
||||
* Initialize Database Settings
|
||||
*
|
||||
* @return bool
|
||||
* @return void
|
||||
* @throws RuntimeException In case of failure
|
||||
*/
|
||||
public function initialize()
|
||||
{
|
||||
|
@ -392,7 +393,7 @@ abstract class CI_DB_driver {
|
|||
*/
|
||||
if ($this->conn_id)
|
||||
{
|
||||
return TRUE;
|
||||
return;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
|
@ -429,19 +430,9 @@ abstract class CI_DB_driver {
|
|||
// We still don't have a connection?
|
||||
if ( ! $this->conn_id)
|
||||
{
|
||||
log_message('error', 'Unable to connect to the database');
|
||||
|
||||
if ($this->db_debug)
|
||||
{
|
||||
$this->display_error('db_unable_to_connect');
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
throw new RuntimeException('Unable to connect to the database.');
|
||||
}
|
||||
}
|
||||
|
||||
// Now we set the character set and that's all
|
||||
return $this->db_set_charset($this->char_set);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
@ -516,31 +507,6 @@ abstract class CI_DB_driver {
|
|||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Set client character set
|
||||
*
|
||||
* @param string
|
||||
* @return bool
|
||||
*/
|
||||
public function db_set_charset($charset)
|
||||
{
|
||||
if (method_exists($this, '_db_set_charset') && ! $this->_db_set_charset($charset))
|
||||
{
|
||||
log_message('error', 'Unable to set database connection charset: '.$charset);
|
||||
|
||||
if ($this->db_debug)
|
||||
{
|
||||
$this->display_error('db_unable_to_set_charset', $charset);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* The name of the platform in use (mysql, mssql, etc...)
|
||||
*
|
||||
|
@ -634,7 +600,6 @@ abstract class CI_DB_driver {
|
|||
// cached query if it exists
|
||||
if ($this->cache_on === TRUE && $return_object === TRUE && $this->_cache_init())
|
||||
{
|
||||
$this->load_rdriver();
|
||||
if (FALSE !== ($cache = $this->CACHE->read($sql)))
|
||||
{
|
||||
return $cache;
|
||||
|
@ -718,9 +683,9 @@ abstract class CI_DB_driver {
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
// Load and instantiate the result driver
|
||||
$driver = $this->load_rdriver();
|
||||
$RES = new $driver($this);
|
||||
// Instantiate the driver-specific result class
|
||||
$driver = 'CI_DB_'.$this->dbdriver.'_result';
|
||||
$RES = new $driver($this);
|
||||
|
||||
// Is query caching enabled? If so, we'll serialize the
|
||||
// result object and save it to a cache file.
|
||||
|
@ -749,26 +714,6 @@ abstract class CI_DB_driver {
|
|||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Load the result drivers
|
||||
*
|
||||
* @return string the name of the result class
|
||||
*/
|
||||
public function load_rdriver()
|
||||
{
|
||||
$driver = 'CI_DB_'.$this->dbdriver.'_result';
|
||||
|
||||
if ( ! class_exists($driver, FALSE))
|
||||
{
|
||||
require_once(BASEPATH.'database/DB_result.php');
|
||||
require_once(BASEPATH.'database/drivers/'.$this->dbdriver.'/'.$this->dbdriver.'_result.php');
|
||||
}
|
||||
|
||||
return $driver;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Simple Query
|
||||
* This is a simplified version of the query() function. Internally
|
||||
|
@ -780,14 +725,7 @@ abstract class CI_DB_driver {
|
|||
*/
|
||||
public function simple_query($sql)
|
||||
{
|
||||
if ( ! $this->conn_id)
|
||||
{
|
||||
if ( ! $this->initialize())
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
empty($this->conn_id) && $this->initialize();
|
||||
return $this->_execute($sql);
|
||||
}
|
||||
|
||||
|
@ -887,6 +825,18 @@ abstract class CI_DB_driver {
|
|||
{
|
||||
return $this->_trans_status;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Returns TRUE if a transaction is currently active
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function trans_active()
|
||||
{
|
||||
return (bool) $this->_trans_depth;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
|
@ -1308,19 +1258,13 @@ abstract class CI_DB_driver {
|
|||
*/
|
||||
public function list_fields($table)
|
||||
{
|
||||
// Is there a cached result?
|
||||
if (isset($this->data_cache['field_names'][$table]))
|
||||
{
|
||||
return $this->data_cache['field_names'][$table];
|
||||
}
|
||||
|
||||
if (FALSE === ($sql = $this->_list_columns($table)))
|
||||
{
|
||||
return ($this->db_debug) ? $this->display_error('db_unsupported_function') : FALSE;
|
||||
}
|
||||
|
||||
$query = $this->query($sql);
|
||||
$this->data_cache['field_names'][$table] = array();
|
||||
$fields = array();
|
||||
|
||||
foreach ($query->result_array() as $row)
|
||||
{
|
||||
|
@ -1342,10 +1286,10 @@ abstract class CI_DB_driver {
|
|||
}
|
||||
}
|
||||
|
||||
$this->data_cache['field_names'][$table][] = $row[$key];
|
||||
$fields[] = $row[$key];
|
||||
}
|
||||
|
||||
return $this->data_cache['field_names'][$table];
|
||||
return $fields;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
@ -1383,10 +1327,11 @@ abstract class CI_DB_driver {
|
|||
*
|
||||
* This function escapes column and table names
|
||||
*
|
||||
* @param mixed
|
||||
* @param mixed $item Identifier to escape
|
||||
* @param bool $split Whether to split identifiers when a dot is encountered
|
||||
* @return mixed
|
||||
*/
|
||||
public function escape_identifiers($item)
|
||||
public function escape_identifiers($item, $split = TRUE)
|
||||
{
|
||||
if ($this->_escape_char === '' OR empty($item) OR in_array($item, $this->_reserved_identifiers))
|
||||
{
|
||||
|
@ -1407,22 +1352,22 @@ abstract class CI_DB_driver {
|
|||
return $item;
|
||||
}
|
||||
|
||||
static $preg_ec = array();
|
||||
static $preg_ec;
|
||||
|
||||
if (empty($preg_ec))
|
||||
{
|
||||
if (is_array($this->_escape_char))
|
||||
{
|
||||
$preg_ec = array(
|
||||
preg_quote($this->_escape_char[0], '/'),
|
||||
preg_quote($this->_escape_char[1], '/'),
|
||||
preg_quote($this->_escape_char[0]),
|
||||
preg_quote($this->_escape_char[1]),
|
||||
$this->_escape_char[0],
|
||||
$this->_escape_char[1]
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$preg_ec[0] = $preg_ec[1] = preg_quote($this->_escape_char, '/');
|
||||
$preg_ec[0] = $preg_ec[1] = preg_quote($this->_escape_char);
|
||||
$preg_ec[2] = $preg_ec[3] = $this->_escape_char;
|
||||
}
|
||||
}
|
||||
|
@ -1431,11 +1376,13 @@ abstract class CI_DB_driver {
|
|||
{
|
||||
if (strpos($item, '.'.$id) !== FALSE)
|
||||
{
|
||||
return preg_replace('/'.$preg_ec[0].'?([^'.$preg_ec[1].'\.]+)'.$preg_ec[1].'?\./i', $preg_ec[2].'$1'.$preg_ec[3].'.', $item);
|
||||
return preg_replace('#'.$preg_ec[0].'?([^'.$preg_ec[1].'\.]+)'.$preg_ec[1].'?\.#i', $preg_ec[2].'$1'.$preg_ec[3].'.', $item);
|
||||
}
|
||||
}
|
||||
|
||||
return preg_replace('/'.$preg_ec[0].'?([^'.$preg_ec[1].'\.]+)'.$preg_ec[1].'?(\.)?/i', $preg_ec[2].'$1'.$preg_ec[3].'$2', $item);
|
||||
$dot = ($split !== FALSE) ? '\.' : '';
|
||||
|
||||
return preg_replace('#'.$preg_ec[0].'?([^'.$preg_ec[1].$dot.']+)'.$preg_ec[1].'?(\.)?#i', $preg_ec[2].'$1'.$preg_ec[3].'$2', $item);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
@ -1528,7 +1475,7 @@ abstract class CI_DB_driver {
|
|||
return 'UPDATE '.$table.' SET '.implode(', ', $valstr)
|
||||
.$this->_compile_wh('qb_where')
|
||||
.$this->_compile_order_by()
|
||||
.($this->qb_limit ? ' LIMIT '.$this->qb_limit : '');
|
||||
.($this->qb_limit !== FALSE ? ' LIMIT '.$this->qb_limit : '');
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
@ -1849,14 +1796,14 @@ abstract class CI_DB_driver {
|
|||
if ($offset = strripos($item, ' AS '))
|
||||
{
|
||||
$alias = ($protect_identifiers)
|
||||
? substr($item, $offset, 4).$this->escape_identifiers(substr($item, $offset + 4))
|
||||
? substr($item, $offset, 4).$this->escape_identifiers(substr($item, $offset + 4), FALSE)
|
||||
: substr($item, $offset);
|
||||
$item = substr($item, 0, $offset);
|
||||
}
|
||||
elseif ($offset = strrpos($item, ' '))
|
||||
{
|
||||
$alias = ($protect_identifiers)
|
||||
? ' '.$this->escape_identifiers(substr($item, $offset + 1))
|
||||
? ' '.$this->escape_identifiers(substr($item, $offset + 1), FALSE)
|
||||
: substr($item, $offset);
|
||||
$item = substr($item, 0, $offset);
|
||||
}
|
||||
|
@ -1926,15 +1873,19 @@ abstract class CI_DB_driver {
|
|||
$i++;
|
||||
}
|
||||
|
||||
// dbprefix may've already been applied, with or without the identifier escaped
|
||||
$ec = '(?<ec>'.preg_quote(is_array($this->_escape_char) ? $this->_escape_char[0] : $this->_escape_char).')?';
|
||||
isset($ec[0]) && $ec .= '?'; // Just in case someone has disabled escaping by forcing an empty escape character
|
||||
|
||||
// Verify table prefix and replace if necessary
|
||||
if ($this->swap_pre !== '' && strpos($parts[$i], $this->swap_pre) === 0)
|
||||
if ($this->swap_pre !== '' && preg_match('#^'.$ec.preg_quote($this->swap_pre).'#', $parts[$i]))
|
||||
{
|
||||
$parts[$i] = preg_replace('/^'.$this->swap_pre.'(\S+?)/', $this->dbprefix.'\\1', $parts[$i]);
|
||||
$parts[$i] = preg_replace('#^'.$ec.preg_quote($this->swap_pre).'(\S+?)#', '\\1'.$this->dbprefix.'\\2', $parts[$i]);
|
||||
}
|
||||
// We only add the table prefix if it does not already exist
|
||||
elseif (strpos($parts[$i], $this->dbprefix) !== 0)
|
||||
else
|
||||
{
|
||||
$parts[$i] = $this->dbprefix.$parts[$i];
|
||||
preg_match('#^'.$ec.preg_quote($this->dbprefix).'#', $parts[$i]) OR $parts[$i] = $this->dbprefix.$parts[$i];
|
||||
}
|
||||
|
||||
// Put the parts back together
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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
|
||||
|
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
abstract class CI_DB_forge {
|
||||
|
||||
|
@ -348,7 +348,10 @@ abstract class CI_DB_forge {
|
|||
|
||||
if (($result = $this->db->query($sql)) !== FALSE)
|
||||
{
|
||||
isset($this->db->data_cache['table_names']) && $this->db->data_cache['table_names'][] = $table;
|
||||
if (isset($this->db->data_cache['table_names']))
|
||||
{
|
||||
$this->db->data_cache['table_names'][] = $table;
|
||||
}
|
||||
|
||||
// Most databases don't support creating indexes from within the CREATE TABLE statement
|
||||
if ( ! empty($this->keys))
|
||||
|
@ -382,10 +385,8 @@ abstract class CI_DB_forge {
|
|||
{
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
$if_not_exists = FALSE;
|
||||
}
|
||||
|
||||
$if_not_exists = FALSE;
|
||||
}
|
||||
|
||||
$sql = ($if_not_exists)
|
||||
|
@ -726,7 +727,7 @@ abstract class CI_DB_forge {
|
|||
'type' => isset($attributes['TYPE']) ? $attributes['TYPE'] : NULL,
|
||||
'length' => '',
|
||||
'unsigned' => '',
|
||||
'null' => '',
|
||||
'null' => NULL,
|
||||
'unique' => '',
|
||||
'default' => '',
|
||||
'auto_increment' => '',
|
||||
|
@ -894,21 +895,33 @@ abstract class CI_DB_forge {
|
|||
return;
|
||||
}
|
||||
|
||||
if (array_key_exists('DEFAULT', $attributes))
|
||||
if ( ! array_key_exists('DEFAULT', $attributes))
|
||||
{
|
||||
if ($attributes['DEFAULT'] === NULL)
|
||||
{
|
||||
$field['default'] = empty($this->_null) ? '' : $this->_default.$this->_null;
|
||||
|
||||
// Override the NULL attribute if that's our default
|
||||
$attributes['NULL'] = TRUE;
|
||||
$field['null'] = empty($this->_null) ? '' : ' '.$this->_null;
|
||||
}
|
||||
else
|
||||
{
|
||||
$field['default'] = $this->_default.$this->db->escape($attributes['DEFAULT']);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if ($attributes['DEFAULT'] === NULL)
|
||||
{
|
||||
$field['default'] = empty($this->_null) ? '' : $this->_default.$this->_null;
|
||||
|
||||
// Override the NULL attribute if that's our default
|
||||
$attributes['NULL'] = TRUE;
|
||||
$field['null'] = empty($this->_null) ? '' : ' '.$this->_null;
|
||||
return;
|
||||
}
|
||||
|
||||
// White-list CURRENT_TIMESTAMP & similar (e.g. Oracle has stuff like SYSTIMESTAMP) defaults for date/time fields
|
||||
if (
|
||||
isset($attributes['TYPE'])
|
||||
&& (stripos($attributes['TYPE'], 'time') !== FALSE OR stripos($attributes['TYPE'], 'date') !== FALSE)
|
||||
&& (stripos($attributes['DEFAULT'], 'time') !== FALSE OR stripos($attributes['DEFAULT'], 'date') !== FALSE)
|
||||
)
|
||||
{
|
||||
$field['default'] = $this->_default.$attributes['DEFAULT'];
|
||||
return;
|
||||
}
|
||||
|
||||
$field['default'] = $this->_default.$this->db->escape($attributes['DEFAULT']);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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
|
||||
|
@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
|
||||
abstract class CI_DB_query_builder extends CI_DB_driver {
|
||||
|
@ -525,19 +525,8 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
|
|||
*/
|
||||
public function join($table, $cond, $type = '', $escape = NULL)
|
||||
{
|
||||
if ($type !== '')
|
||||
{
|
||||
$type = strtoupper(trim($type));
|
||||
|
||||
if ( ! in_array($type, array('LEFT', 'RIGHT', 'OUTER', 'INNER', 'LEFT OUTER', 'RIGHT OUTER'), TRUE))
|
||||
{
|
||||
$type = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$type .= ' ';
|
||||
}
|
||||
}
|
||||
$type = trim(strtoupper($type).' JOIN');
|
||||
preg_match('#^(NATURAL\s+)?((LEFT|RIGHT|FULL)\s+)?((INNER|OUTER)\s+)?JOIN$#', $type) OR $type = 'JOIN';
|
||||
|
||||
// Extract any aliases that might exist. We use this information
|
||||
// in the protect_identifiers to know whether to add a table prefix
|
||||
|
@ -545,7 +534,11 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
|
|||
|
||||
is_bool($escape) OR $escape = $this->_protect_identifiers;
|
||||
|
||||
if ( ! $this->_has_operator($cond))
|
||||
if (strpos($type, 'NATURAL') === 0)
|
||||
{
|
||||
$cond = '';
|
||||
}
|
||||
elseif ( ! $this->_has_operator($cond))
|
||||
{
|
||||
$cond = ' USING ('.($escape ? $this->escape_identifiers($cond) : $cond).')';
|
||||
}
|
||||
|
@ -594,7 +587,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
|
|||
}
|
||||
|
||||
// Assemble the JOIN statement
|
||||
$this->qb_join[] = $join = $type.'JOIN '.$table.$cond;
|
||||
$this->qb_join[] = $join = $type.' '.$table.$cond;
|
||||
|
||||
if ($this->qb_caching === TRUE)
|
||||
{
|
||||
|
@ -680,7 +673,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
|
|||
{
|
||||
if ($escape === TRUE)
|
||||
{
|
||||
$v = ' '.$this->escape($v);
|
||||
$v = $this->escape($v);
|
||||
}
|
||||
|
||||
if ( ! $this->_has_operator($k))
|
||||
|
@ -698,10 +691,11 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
|
|||
$k = substr($k, 0, $match[0][1]).($match[1][0] === '=' ? ' IS NULL' : ' IS NOT NULL');
|
||||
}
|
||||
|
||||
$this->{$qb_key}[] = array('condition' => $prefix.$k.$v, 'escape' => $escape);
|
||||
${$qb_key} = array('condition' => $prefix.$k, 'value' => $v, 'escape' => $escape);
|
||||
$this->{$qb_key}[] = ${$qb_key};
|
||||
if ($this->qb_caching === TRUE)
|
||||
{
|
||||
$this->{$qb_cache_key}[] = array('condition' => $prefix.$k.$v, 'escape' => $escape);
|
||||
$this->{$qb_cache_key}[] = ${$qb_key};
|
||||
$this->qb_cache_exists[] = substr($qb_key, 3);
|
||||
}
|
||||
|
||||
|
@ -723,9 +717,9 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
|
|||
* @param bool $escape
|
||||
* @return CI_DB_query_builder
|
||||
*/
|
||||
public function where_in($key = NULL, $values = NULL, $escape = NULL)
|
||||
public function where_in($key, array $values, $escape = NULL)
|
||||
{
|
||||
return $this->_where_in($key, $values, FALSE, 'AND ', $escape);
|
||||
return $this->_wh_in('qb_where', $key, $values, FALSE, 'AND ', $escape);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
@ -741,9 +735,9 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
|
|||
* @param bool $escape
|
||||
* @return CI_DB_query_builder
|
||||
*/
|
||||
public function or_where_in($key = NULL, $values = NULL, $escape = NULL)
|
||||
public function or_where_in($key, array $values, $escape = NULL)
|
||||
{
|
||||
return $this->_where_in($key, $values, FALSE, 'OR ', $escape);
|
||||
return $this->_wh_in('qb_where', $key, $values, FALSE, 'OR ', $escape);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
@ -759,9 +753,9 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
|
|||
* @param bool $escape
|
||||
* @return CI_DB_query_builder
|
||||
*/
|
||||
public function where_not_in($key = NULL, $values = NULL, $escape = NULL)
|
||||
public function where_not_in($key, array $values, $escape = NULL)
|
||||
{
|
||||
return $this->_where_in($key, $values, TRUE, 'AND ', $escape);
|
||||
return $this->_wh_in('qb_where', $key, $values, TRUE, 'AND ', $escape);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
@ -777,21 +771,98 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
|
|||
* @param bool $escape
|
||||
* @return CI_DB_query_builder
|
||||
*/
|
||||
public function or_where_not_in($key = NULL, $values = NULL, $escape = NULL)
|
||||
public function or_where_not_in($key, array $values, $escape = NULL)
|
||||
{
|
||||
return $this->_where_in($key, $values, TRUE, 'OR ', $escape);
|
||||
return $this->_wh_in('qb_where', $key, $values, TRUE, 'OR ', $escape);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Internal WHERE IN
|
||||
* HAVING IN
|
||||
*
|
||||
* Generates a HAVING field IN('item', 'item') SQL query,
|
||||
* joined with 'AND' if appropriate.
|
||||
*
|
||||
* @param string $key The field to search
|
||||
* @param array $values The values searched on
|
||||
* @param bool $escape
|
||||
* @return CI_DB_query_builder
|
||||
*/
|
||||
public function having_in($key, array $values, $escape = NULL)
|
||||
{
|
||||
return $this->_wh_in('qb_having', $key, $values, FALSE, 'AND ', $escape);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* OR HAVING IN
|
||||
*
|
||||
* Generates a HAVING field IN('item', 'item') SQL query,
|
||||
* joined with 'OR' if appropriate.
|
||||
*
|
||||
* @param string $key The field to search
|
||||
* @param array $values The values searched on
|
||||
* @param bool $escape
|
||||
* @return CI_DB_query_builder
|
||||
*/
|
||||
public function or_having_in($key, array $values, $escape = NULL)
|
||||
{
|
||||
return $this->_wh_in('qb_having', $key, $values, FALSE, 'OR ', $escape);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* HAVING NOT IN
|
||||
*
|
||||
* Generates a HAVING field NOT IN('item', 'item') SQL query,
|
||||
* joined with 'AND' if appropriate.
|
||||
*
|
||||
* @param string $key The field to search
|
||||
* @param array $values The values searched on
|
||||
* @param bool $escape
|
||||
* @return CI_DB_query_builder
|
||||
*/
|
||||
public function having_not_in($key, array $values, $escape = NULL)
|
||||
{
|
||||
return $this->_wh_in('qb_having', $key, $values, TRUE, 'AND ', $escape);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* OR HAVING NOT IN
|
||||
*
|
||||
* Generates a HAVING field NOT IN('item', 'item') SQL query,
|
||||
* joined with 'OR' if appropriate.
|
||||
*
|
||||
* @param string $key The field to search
|
||||
* @param array $values The values searched on
|
||||
* @param bool $escape
|
||||
* @return CI_DB_query_builder
|
||||
*/
|
||||
public function or_having_not_in($key, array $values, $escape = NULL)
|
||||
{
|
||||
return $this->_wh_in('qb_having', $key, $values, TRUE, 'OR ', $escape);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Internal WHERE/HAVING IN
|
||||
*
|
||||
* @used-by where_in()
|
||||
* @used-by or_where_in()
|
||||
* @used-by where_not_in()
|
||||
* @used-by or_where_not_in()
|
||||
* @used-by having_in()
|
||||
* @used-by or_having_in()
|
||||
* @used-by having_not_in()
|
||||
* @used-by or_having_not_in()
|
||||
*
|
||||
* @param string $qb_key 'qb_where' or 'qb_having'
|
||||
* @param string $key The field to search
|
||||
* @param array $values The values searched on
|
||||
* @param bool $not If the statement would be IN or NOT IN
|
||||
|
@ -799,16 +870,18 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
|
|||
* @param bool $escape
|
||||
* @return CI_DB_query_builder
|
||||
*/
|
||||
protected function _where_in($key = NULL, $values = NULL, $not = FALSE, $type = 'AND ', $escape = NULL)
|
||||
protected function _wh_in($qb_key, $key, array $values, $not = FALSE, $type = 'AND ', $escape = NULL)
|
||||
{
|
||||
if ($key === NULL OR $values === NULL)
|
||||
$qb_cache_key = ($qb_key === 'qb_having') ? 'qb_cache_having' : 'qb_cache_where';
|
||||
|
||||
if (empty($key) OR ! is_string($key))
|
||||
{
|
||||
return $this;
|
||||
throw new InvalidArgumentException(sprintf('%s() expects $key to be a non-empty string', debug_backtrace(0, 2)[1]['function']));
|
||||
}
|
||||
|
||||
if ( ! is_array($values))
|
||||
if (empty($values))
|
||||
{
|
||||
$values = array($values);
|
||||
throw new InvalidArgumentException(sprintf('%s() expects $values to be a non-empty array', debug_backtrace(0, 2)[1]['function']));
|
||||
}
|
||||
|
||||
is_bool($escape) OR $escape = $this->_protect_identifiers;
|
||||
|
@ -817,31 +890,32 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
|
|||
|
||||
if ($escape === TRUE)
|
||||
{
|
||||
$where_in = array();
|
||||
$wh_in = array();
|
||||
foreach ($values as $value)
|
||||
{
|
||||
$where_in[] = $this->escape($value);
|
||||
$wh_in[] = $this->escape($value);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$where_in = array_values($values);
|
||||
$wh_in = array_values($values);
|
||||
}
|
||||
|
||||
$prefix = (count($this->qb_where) === 0 && count($this->qb_cache_where) === 0)
|
||||
$prefix = (count($this->$qb_key) === 0 && count($this->$qb_cache_key) === 0)
|
||||
? $this->_group_get_type('')
|
||||
: $this->_group_get_type($type);
|
||||
|
||||
$where_in = array(
|
||||
'condition' => $prefix.$key.$not.' IN('.implode(', ', $where_in).')',
|
||||
$wh_in = array(
|
||||
'condition' => $prefix.$key.$not.' IN('.implode(', ', $wh_in).')',
|
||||
'value' => NULL,
|
||||
'escape' => $escape
|
||||
);
|
||||
|
||||
$this->qb_where[] = $where_in;
|
||||
$this->{$qb_key}[] = $wh_in;
|
||||
if ($this->qb_caching === TRUE)
|
||||
{
|
||||
$this->qb_cache_where[] = $where_in;
|
||||
$this->qb_cache_exists[] = 'where';
|
||||
$this->{$qb_cache_key}[] = $wh_in;
|
||||
$this->qb_cache_exists[] = substr($qb_key, 3);
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
@ -962,33 +1036,34 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
|
|||
$v = $this->escape_like_str($v);
|
||||
}
|
||||
|
||||
if ($side === 'none')
|
||||
switch ($side)
|
||||
{
|
||||
$like_statement = "{$prefix} {$k} {$not} LIKE '{$v}'";
|
||||
}
|
||||
elseif ($side === 'before')
|
||||
{
|
||||
$like_statement = "{$prefix} {$k} {$not} LIKE '%{$v}'";
|
||||
}
|
||||
elseif ($side === 'after')
|
||||
{
|
||||
$like_statement = "{$prefix} {$k} {$not} LIKE '{$v}%'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$like_statement = "{$prefix} {$k} {$not} LIKE '%{$v}%'";
|
||||
case 'none':
|
||||
$v = "'{$v}'";
|
||||
break;
|
||||
case 'before':
|
||||
$v = "'%{$v}'";
|
||||
break;
|
||||
case 'after':
|
||||
$v = "'{$v}%'";
|
||||
break;
|
||||
case 'both':
|
||||
default:
|
||||
$v = "'%{$v}%'";
|
||||
break;
|
||||
}
|
||||
|
||||
// some platforms require an escape sequence definition for LIKE wildcards
|
||||
if ($escape === TRUE && $this->_like_escape_str !== '')
|
||||
{
|
||||
$like_statement .= sprintf($this->_like_escape_str, $this->_like_escape_chr);
|
||||
$v .= sprintf($this->_like_escape_str, $this->_like_escape_chr);
|
||||
}
|
||||
|
||||
$this->qb_where[] = array('condition' => $like_statement, 'escape' => $escape);
|
||||
$qb_where = array('condition' => "{$prefix} {$k} {$not} LIKE {$v}", 'value' => NULL, 'escape' => $escape);
|
||||
$this->qb_where[] = $qb_where;
|
||||
if ($this->qb_caching === TRUE)
|
||||
{
|
||||
$this->qb_cache_where[] = array('condition' => $like_statement, 'escape' => $escape);
|
||||
$this->qb_cache_where[] = $qb_where;
|
||||
$this->qb_cache_exists[] = 'where';
|
||||
}
|
||||
}
|
||||
|
@ -1013,6 +1088,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
|
|||
$prefix = (count($this->qb_where) === 0 && count($this->qb_cache_where) === 0) ? '' : $type;
|
||||
$where = array(
|
||||
'condition' => $prefix.$not.str_repeat(' ', ++$this->qb_where_group_count).' (',
|
||||
'value' => NULL,
|
||||
'escape' => FALSE
|
||||
);
|
||||
|
||||
|
@ -1073,6 +1149,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
|
|||
$this->qb_where_group_started = FALSE;
|
||||
$where = array(
|
||||
'condition' => str_repeat(' ', $this->qb_where_group_count--).')',
|
||||
'value' => NULL,
|
||||
'escape' => FALSE
|
||||
);
|
||||
|
||||
|
@ -1114,7 +1191,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
|
|||
/**
|
||||
* GROUP BY
|
||||
*
|
||||
* @param string $by
|
||||
* @param mixed $by
|
||||
* @param bool $escape
|
||||
* @return CI_DB_query_builder
|
||||
*/
|
||||
|
@ -1405,9 +1482,9 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
|
|||
// for selecting COUNT(*) ...
|
||||
$qb_orderby = $this->qb_orderby;
|
||||
$qb_cache_orderby = $this->qb_cache_orderby;
|
||||
$this->qb_orderby = $this->qb_cache_orderby = NULL;
|
||||
$this->qb_orderby = $this->qb_cache_orderby = array();
|
||||
|
||||
$result = ($this->qb_distinct === TRUE OR ! empty($this->qb_groupby) OR ! empty($this->qb_cache_groupby) OR $this->qb_limit OR $this->qb_offset)
|
||||
$result = ($this->qb_distinct === TRUE OR ! empty($this->qb_groupby) OR ! empty($this->qb_cache_groupby) OR ! empty($this->qb_having) OR $this->qb_limit OR $this->qb_offset)
|
||||
? $this->query($this->_count_string.$this->protect_identifiers('numrows')."\nFROM (\n".$this->_compile_select()."\n) CI_count_all_results")
|
||||
: $this->query($this->_compile_select($this->_count_string.$this->protect_identifiers('numrows')));
|
||||
|
||||
|
@ -1433,7 +1510,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
|
|||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Get_Where
|
||||
* get_where()
|
||||
*
|
||||
* Allows the where clause, limit and offset to be added directly
|
||||
*
|
||||
|
@ -2210,7 +2287,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
|
|||
protected function _delete($table)
|
||||
{
|
||||
return 'DELETE FROM '.$table.$this->_compile_wh('qb_where')
|
||||
.($this->qb_limit ? ' LIMIT '.$this->qb_limit : '');
|
||||
.($this->qb_limit !== FALSE ? ' LIMIT '.$this->qb_limit : '');
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
@ -2360,7 +2437,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
|
|||
.$this->_compile_order_by(); // ORDER BY
|
||||
|
||||
// LIMIT
|
||||
if ($this->qb_limit OR $this->qb_offset)
|
||||
if ($this->qb_limit !== FALSE OR $this->qb_offset)
|
||||
{
|
||||
return $this->_limit($sql."\n");
|
||||
}
|
||||
|
@ -2395,7 +2472,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
|
|||
}
|
||||
elseif ($this->{$qb_key}[$i]['escape'] === FALSE)
|
||||
{
|
||||
$this->{$qb_key}[$i] = $this->{$qb_key}[$i]['condition'];
|
||||
$this->{$qb_key}[$i] = $this->{$qb_key}[$i]['condition'].(isset($this->{$qb_key}[$i]['value']) ? ' '.$this->{$qb_key}[$i]['value'] : '');
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -2434,7 +2511,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
|
|||
.' '.trim($matches[3]).$matches[4].$matches[5];
|
||||
}
|
||||
|
||||
$this->{$qb_key}[$i] = implode('', $conditions);
|
||||
$this->{$qb_key}[$i] = implode('', $conditions).(isset($this->{$qb_key}[$i]['value']) ? ' '.$this->{$qb_key}[$i]['value'] : '');
|
||||
}
|
||||
|
||||
return ($qb_key === 'qb_having' ? "\nHAVING " : "\nWHERE ")
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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
|
||||
|
@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_result {
|
||||
|
||||
|
@ -163,10 +163,8 @@ class CI_DB_result {
|
|||
{
|
||||
return $this->result_object();
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->custom_result_object($type);
|
||||
}
|
||||
|
||||
return $this->custom_result_object($type);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
@ -336,7 +334,8 @@ class CI_DB_result {
|
|||
|
||||
if ($type === 'object') return $this->row_object($n);
|
||||
elseif ($type === 'array') return $this->row_array($n);
|
||||
else return $this->custom_row_object($n, $type);
|
||||
|
||||
return $this->custom_row_object($n, $type);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
@ -382,7 +381,7 @@ class CI_DB_result {
|
|||
*/
|
||||
public function custom_row_object($n, $type)
|
||||
{
|
||||
isset($this->custom_result_object[$type]) OR $this->custom_result_object($type);
|
||||
isset($this->custom_result_object[$type]) OR $this->custom_result_object[$type] = $this->custom_result_object($type);
|
||||
|
||||
if (count($this->custom_result_object[$type]) === 0)
|
||||
{
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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
|
||||
|
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
abstract class CI_DB_utility {
|
||||
|
||||
|
@ -235,13 +235,8 @@ abstract class CI_DB_utility {
|
|||
* @param string $enclosure Enclosure (default: ")
|
||||
* @return string
|
||||
*/
|
||||
public function csv_from_result($query, $delim = ',', $newline = "\n", $enclosure = '"')
|
||||
public function csv_from_result(CI_DB_result $query, $delim = ',', $newline = "\n", $enclosure = '"')
|
||||
{
|
||||
if ( ! is_object($query) OR ! method_exists($query, 'list_fields'))
|
||||
{
|
||||
show_error('You must submit a valid result object');
|
||||
}
|
||||
|
||||
$out = '';
|
||||
// First generate the headings from the table column names
|
||||
foreach ($query->list_fields() as $name)
|
||||
|
@ -274,13 +269,8 @@ abstract class CI_DB_utility {
|
|||
* @param array $params Any preferences
|
||||
* @return string
|
||||
*/
|
||||
public function xml_from_result($query, $params = array())
|
||||
public function xml_from_result(CI_DB_result $query, $params = array())
|
||||
{
|
||||
if ( ! is_object($query) OR ! method_exists($query, 'list_fields'))
|
||||
{
|
||||
show_error('You must submit a valid result object');
|
||||
}
|
||||
|
||||
// Set our default values
|
||||
foreach (array('root' => 'root', 'element' => 'element', 'newline' => "\n", 'tab' => "\t") as $key => $val)
|
||||
{
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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 2.1.0
|
||||
* @filesource
|
||||
|
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author Esen Sagynov
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_cubrid_driver extends CI_DB {
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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 2.1.0
|
||||
* @filesource
|
||||
|
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
*
|
||||
* @category Database
|
||||
* @author Esen Sagynov
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_cubrid_forge extends CI_DB_forge {
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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 2.1.0
|
||||
* @filesource
|
||||
|
@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
*
|
||||
* @category Database
|
||||
* @author Esen Sagynov
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_cubrid_result extends CI_DB_result {
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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 2.1.0
|
||||
* @filesource
|
||||
|
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
*
|
||||
* @category Database
|
||||
* @author Esen Sagynov
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_cubrid_utility extends CI_DB_utility {
|
||||
|
||||
|
|
|
@ -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 - 2017, 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 - 2017, 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 3.0.0
|
||||
* @filesource
|
||||
|
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_ibase_driver extends CI_DB {
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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 3.0.0
|
||||
* @filesource
|
||||
|
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_ibase_forge extends CI_DB_forge {
|
||||
|
||||
|
@ -140,7 +140,7 @@ class CI_DB_ibase_forge extends CI_DB_forge {
|
|||
* @return string|string[]
|
||||
*/
|
||||
protected function _alter_table($alter_type, $table, $field)
|
||||
{
|
||||
{
|
||||
if (in_array($alter_type, array('DROP', 'ADD'), TRUE))
|
||||
{
|
||||
return parent::_alter_table($alter_type, $table, $field);
|
||||
|
@ -183,7 +183,7 @@ class CI_DB_ibase_forge extends CI_DB_forge {
|
|||
}
|
||||
|
||||
return $sqls;
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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 3.0.0
|
||||
* @filesource
|
||||
|
@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_ibase_result extends CI_DB_result {
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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 3.0.0
|
||||
* @filesource
|
||||
|
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_ibase_utility extends CI_DB_utility {
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
|
|
|
@ -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 - 2017, 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 - 2017, 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.3.0
|
||||
* @filesource
|
||||
|
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_mssql_driver extends CI_DB {
|
||||
|
||||
|
@ -108,6 +108,7 @@ class CI_DB_mssql_driver extends CI_DB {
|
|||
*/
|
||||
public function db_connect($persistent = FALSE)
|
||||
{
|
||||
ini_set('mssql.charset', $this->char_set);
|
||||
$this->conn_id = ($persistent)
|
||||
? mssql_pconnect($this->hostname, $this->username, $this->password)
|
||||
: mssql_connect($this->hostname, $this->username, $this->password);
|
||||
|
@ -248,19 +249,6 @@ class CI_DB_mssql_driver extends CI_DB {
|
|||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Set client character set
|
||||
*
|
||||
* @param string $charset
|
||||
* @return bool
|
||||
*/
|
||||
protected function _db_set_charset($charset)
|
||||
{
|
||||
return (ini_set('mssql.charset', $charset) !== FALSE);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Version number query string
|
||||
*
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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.3.0
|
||||
* @filesource
|
||||
|
@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_mssql_forge extends CI_DB_forge {
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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.3.0
|
||||
* @filesource
|
||||
|
@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_mssql_result extends CI_DB_result {
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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.3.0
|
||||
* @filesource
|
||||
|
@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_mssql_utility extends CI_DB_utility {
|
||||
|
||||
|
|
|
@ -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 - 2017, 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 - 2017, 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
|
||||
|
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_mysql_driver extends CI_DB {
|
||||
|
||||
|
@ -147,29 +147,41 @@ class CI_DB_mysql_driver extends CI_DB {
|
|||
: FALSE;
|
||||
}
|
||||
|
||||
if (isset($this->stricton) && is_resource($this->conn_id))
|
||||
if (is_resource($this->conn_id))
|
||||
{
|
||||
if ($this->stricton)
|
||||
if ( ! mysql_set_charset($this->char_set, $this->conn_id))
|
||||
{
|
||||
$this->simple_query('SET SESSION sql_mode = CONCAT(@@sql_mode, ",", "STRICT_ALL_TABLES")');
|
||||
log_message('error', "Database: Unable to set the configured connection charset ('{$this->char_set}').");
|
||||
$this->close();
|
||||
return ($this->db->debug) ? $this->display_error('db_unable_to_set_charset', $this->char_set) : FALSE;
|
||||
}
|
||||
else
|
||||
|
||||
if (isset($this->stricton))
|
||||
{
|
||||
$this->simple_query(
|
||||
'SET SESSION sql_mode =
|
||||
REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(
|
||||
@@sql_mode,
|
||||
"STRICT_ALL_TABLES,", ""),
|
||||
",STRICT_ALL_TABLES", ""),
|
||||
"STRICT_ALL_TABLES", ""),
|
||||
"STRICT_TRANS_TABLES,", ""),
|
||||
",STRICT_TRANS_TABLES", ""),
|
||||
"STRICT_TRANS_TABLES", "")'
|
||||
);
|
||||
if ($this->stricton)
|
||||
{
|
||||
$this->simple_query('SET SESSION sql_mode = CONCAT(@@sql_mode, ",", "STRICT_ALL_TABLES")');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->simple_query(
|
||||
'SET SESSION sql_mode =
|
||||
REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(
|
||||
@@sql_mode,
|
||||
"STRICT_ALL_TABLES,", ""),
|
||||
",STRICT_ALL_TABLES", ""),
|
||||
"STRICT_ALL_TABLES", ""),
|
||||
"STRICT_TRANS_TABLES,", ""),
|
||||
",STRICT_TRANS_TABLES", ""),
|
||||
"STRICT_TRANS_TABLES", "")'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->conn_id;
|
||||
}
|
||||
|
||||
return $this->conn_id;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
@ -217,19 +229,6 @@ class CI_DB_mysql_driver extends CI_DB {
|
|||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Set client character set
|
||||
*
|
||||
* @param string $charset
|
||||
* @return bool
|
||||
*/
|
||||
protected function _db_set_charset($charset)
|
||||
{
|
||||
return mysql_set_charset($charset, $this->conn_id);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Database version number
|
||||
*
|
||||
|
@ -383,7 +382,7 @@ class CI_DB_mysql_driver extends CI_DB {
|
|||
*/
|
||||
protected function _list_tables($prefix_limit = FALSE)
|
||||
{
|
||||
$sql = 'SHOW TABLES FROM '.$this->escape_identifiers($this->database);
|
||||
$sql = 'SHOW TABLES FROM '.$this->_escape_char.$this->database.$this->_escape_char;
|
||||
|
||||
if ($prefix_limit !== FALSE && $this->dbprefix !== '')
|
||||
{
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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
|
||||
|
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_mysql_forge extends CI_DB_forge {
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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
|
||||
|
@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_mysql_result extends CI_DB_result {
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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
|
||||
|
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_mysql_utility extends CI_DB_utility {
|
||||
|
||||
|
|
|
@ -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 - 2017, 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 - 2017, 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.3.0
|
||||
* @filesource
|
||||
|
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_mysqli_driver extends CI_DB {
|
||||
|
||||
|
@ -167,26 +167,28 @@ class CI_DB_mysqli_driver extends CI_DB {
|
|||
empty($this->encrypt['ssl_capath']) OR $ssl['capath'] = $this->encrypt['ssl_capath'];
|
||||
empty($this->encrypt['ssl_cipher']) OR $ssl['cipher'] = $this->encrypt['ssl_cipher'];
|
||||
|
||||
if (isset($this->encrypt['ssl_verify']))
|
||||
{
|
||||
$client_flags |= MYSQLI_CLIENT_SSL;
|
||||
|
||||
if ($this->encrypt['ssl_verify'])
|
||||
{
|
||||
defined('MYSQLI_OPT_SSL_VERIFY_SERVER_CERT') && $this->_mysqli->options(MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, TRUE);
|
||||
}
|
||||
// Apparently (when it exists), setting MYSQLI_OPT_SSL_VERIFY_SERVER_CERT
|
||||
// to FALSE didn't do anything, so PHP 5.6.16 introduced yet another
|
||||
// constant ...
|
||||
//
|
||||
// https://secure.php.net/ChangeLog-5.php#5.6.16
|
||||
// https://bugs.php.net/bug.php?id=68344
|
||||
elseif (defined('MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT'))
|
||||
{
|
||||
$client_flags |= MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! empty($ssl))
|
||||
{
|
||||
if (isset($this->encrypt['ssl_verify']))
|
||||
{
|
||||
if ($this->encrypt['ssl_verify'])
|
||||
{
|
||||
defined('MYSQLI_OPT_SSL_VERIFY_SERVER_CERT') && $this->_mysqli->options(MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, TRUE);
|
||||
}
|
||||
// Apparently (when it exists), setting MYSQLI_OPT_SSL_VERIFY_SERVER_CERT
|
||||
// to FALSE didn't do anything, so PHP 5.6.16 introduced yet another
|
||||
// constant ...
|
||||
//
|
||||
// https://secure.php.net/ChangeLog-5.php#5.6.16
|
||||
// https://bugs.php.net/bug.php?id=68344
|
||||
elseif (defined('MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT'))
|
||||
{
|
||||
$client_flags |= MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT;
|
||||
}
|
||||
}
|
||||
|
||||
$client_flags |= MYSQLI_CLIENT_SSL;
|
||||
$this->_mysqli->ssl_set(
|
||||
isset($ssl['key']) ? $ssl['key'] : NULL,
|
||||
|
@ -213,6 +215,13 @@ class CI_DB_mysqli_driver extends CI_DB {
|
|||
return ($this->db_debug) ? $this->display_error($message, '', TRUE) : FALSE;
|
||||
}
|
||||
|
||||
if ( ! $this->_mysqli->set_charset($this->char_set))
|
||||
{
|
||||
log_message('error', "Database: Unable to set the configured connection charset ('{$this->char_set}').");
|
||||
$this->_mysqli->close();
|
||||
return ($this->db->db_debug) ? $this->display_error('db_unable_to_set_charset', $this->char_set) : FALSE;
|
||||
}
|
||||
|
||||
return $this->_mysqli;
|
||||
}
|
||||
|
||||
|
@ -264,19 +273,6 @@ class CI_DB_mysqli_driver extends CI_DB {
|
|||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Set client character set
|
||||
*
|
||||
* @param string $charset
|
||||
* @return bool
|
||||
*/
|
||||
protected function _db_set_charset($charset)
|
||||
{
|
||||
return $this->conn_id->set_charset($charset);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Database version number
|
||||
*
|
||||
|
@ -427,7 +423,7 @@ class CI_DB_mysqli_driver extends CI_DB {
|
|||
*/
|
||||
protected function _list_tables($prefix_limit = FALSE)
|
||||
{
|
||||
$sql = 'SHOW TABLES FROM '.$this->escape_identifiers($this->database);
|
||||
$sql = 'SHOW TABLES FROM '.$this->_escape_char.$this->database.$this->_escape_char;
|
||||
|
||||
if ($prefix_limit !== FALSE && $this->dbprefix !== '')
|
||||
{
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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.3.0
|
||||
* @filesource
|
||||
|
@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_mysqli_forge extends CI_DB_forge {
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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.3.0
|
||||
* @filesource
|
||||
|
@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_mysqli_result extends CI_DB_result {
|
||||
|
||||
|
@ -130,10 +130,10 @@ class CI_DB_mysqli_result extends CI_DB_result {
|
|||
* mysqli_result::fetch_fields()
|
||||
*
|
||||
* @used-by CI_DB_mysqli_result::field_data()
|
||||
* @param int $flags
|
||||
* @param int $type
|
||||
* @return string
|
||||
*/
|
||||
private static function _get_field_type($flags)
|
||||
private static function _get_field_type($type)
|
||||
{
|
||||
static $map;
|
||||
isset($map) OR $map = array(
|
||||
|
@ -164,15 +164,7 @@ class CI_DB_mysqli_result extends CI_DB_result {
|
|||
MYSQLI_TYPE_GEOMETRY => 'geometry'
|
||||
);
|
||||
|
||||
foreach ($map as $flag => $name)
|
||||
{
|
||||
if ($flags & $flag)
|
||||
{
|
||||
return $name;
|
||||
}
|
||||
}
|
||||
|
||||
return $flags;
|
||||
return isset($map[$type]) ? $map[$type] : $type;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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.3.0
|
||||
* @filesource
|
||||
|
@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_mysqli_utility extends CI_DB_utility {
|
||||
|
||||
|
@ -155,11 +155,7 @@ class CI_DB_mysqli_utility extends CI_DB_utility {
|
|||
while ($field = $query->result_id->fetch_field())
|
||||
{
|
||||
// Most versions of MySQL store timestamp as a string
|
||||
$is_int[$i] = ($field->type & MYSQLI_TYPE_TINY)
|
||||
OR ($field->type & MYSQLI_TYPE_SHORT)
|
||||
OR ($field->type & MYSQLI_TYPE_INT24)
|
||||
OR ($field->type & MYSQLI_TYPE_LONG)
|
||||
OR ($field->type & MYSQLI_TYPE_LONGLONG);
|
||||
$is_int[$i] = in_array($field->type, array(MYSQLI_TYPE_TINY, MYSQLI_TYPE_SHORT, MYSQLI_TYPE_INT24, MYSQLI_TYPE_LONG), TRUE);
|
||||
|
||||
// Create a string of field names
|
||||
$field_str .= $this->db->escape_identifiers($field->name).', ';
|
||||
|
|
|
@ -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 - 2017, 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 - 2017, 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.4.1
|
||||
* @filesource
|
||||
|
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -97,7 +97,7 @@ class CI_DB_oci8_driver extends CI_DB {
|
|||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $limit_used;
|
||||
public $limit_used = FALSE;
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
|
@ -685,4 +685,17 @@ class CI_DB_oci8_driver extends CI_DB {
|
|||
oci_close($this->conn_id);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* We need to reset our $limit_used hack flag, so it doesn't propagate
|
||||
* to subsequent queries.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function _reset_select()
|
||||
{
|
||||
$this->limit_used = FALSE;
|
||||
parent::_reset_select();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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.4.1
|
||||
* @filesource
|
||||
|
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_oci8_forge extends CI_DB_forge {
|
||||
|
||||
|
@ -81,6 +81,13 @@ class CI_DB_oci8_forge extends CI_DB_forge {
|
|||
*/
|
||||
protected $_unsigned = FALSE;
|
||||
|
||||
/**
|
||||
* NULL value representation in CREATE/ALTER TABLE statements
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_null = 'NULL';
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
|
@ -152,7 +159,29 @@ class CI_DB_oci8_forge extends CI_DB_forge {
|
|||
*/
|
||||
protected function _attr_auto_increment(&$attributes, &$field)
|
||||
{
|
||||
// Not supported - sequences and triggers must be used instead
|
||||
if ( ! empty($attributes['AUTO_INCREMENT']) && $attributes['AUTO_INCREMENT'] === TRUE && stripos($field['type'], 'number') !== FALSE && version_compare($this->db->version(), '12.1', '>='))
|
||||
{
|
||||
$field['auto_increment'] = ' GENERATED ALWAYS AS IDENTITY';
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Process column
|
||||
*
|
||||
* @param array $field
|
||||
* @return string
|
||||
*/
|
||||
protected function _process_column($field)
|
||||
{
|
||||
return $this->db->escape_identifiers($field['name'])
|
||||
.' '.$field['type'].$field['length']
|
||||
.$field['unsigned']
|
||||
.$field['default']
|
||||
.$field['auto_increment']
|
||||
.$field['null']
|
||||
.$field['unique'];
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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.4.1
|
||||
* @filesource
|
||||
|
@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_oci8_result extends CI_DB_result {
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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.4.1
|
||||
* @filesource
|
||||
|
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_oci8_utility extends CI_DB_utility {
|
||||
|
||||
|
|
|
@ -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 - 2017, 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 - 2017, 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.3.0
|
||||
* @filesource
|
||||
|
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_odbc_driver extends CI_DB_driver {
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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.3.0
|
||||
* @filesource
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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.3.0
|
||||
* @filesource
|
||||
|
@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_odbc_result extends CI_DB_result {
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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.3.0
|
||||
* @filesource
|
||||
|
|
|
@ -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 - 2017, 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 - 2017, 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 2.1.0
|
||||
* @filesource
|
||||
|
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_pdo_driver extends CI_DB {
|
||||
|
||||
|
@ -302,7 +302,7 @@ class CI_DB_pdo_driver extends CI_DB {
|
|||
$error['code'] = isset($pdo_error[1]) ? $pdo_error[0].'/'.$pdo_error[1] : $pdo_error[0];
|
||||
if (isset($pdo_error[2]))
|
||||
{
|
||||
$error['message'] = $pdo_error[2];
|
||||
$error['message'] = $pdo_error[2];
|
||||
}
|
||||
|
||||
return $error;
|
||||
|
@ -326,4 +326,17 @@ class CI_DB_pdo_driver extends CI_DB {
|
|||
return 'TRUNCATE TABLE '.$table;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Close DB Connection
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function _close()
|
||||
{
|
||||
$this->result_id = FALSE;
|
||||
$this->conn_id = FALSE;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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 2.1.0
|
||||
* @filesource
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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 2.1.0
|
||||
* @filesource
|
||||
|
@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_pdo_result extends CI_DB_result {
|
||||
|
||||
|
@ -133,7 +133,7 @@ class CI_DB_pdo_result extends CI_DB_result {
|
|||
|
||||
$retval[$i] = new stdClass();
|
||||
$retval[$i]->name = $field['name'];
|
||||
$retval[$i]->type = $field['native_type'];
|
||||
$retval[$i]->type = isset($field['native_type']) ? $field['native_type'] : null;
|
||||
$retval[$i]->max_length = ($field['len'] > 0) ? $field['len'] : NULL;
|
||||
$retval[$i]->primary_key = (int) ( ! empty($field['flags']) && in_array('primary_key', $field['flags'], TRUE));
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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 2.1.0
|
||||
* @filesource
|
||||
|
|
|
@ -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 - 2017, 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 - 2017, 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 3.0.0
|
||||
* @filesource
|
||||
|
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_pdo_4d_driver extends CI_DB_pdo_driver {
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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 3.0.0
|
||||
* @filesource
|
||||
|
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_pdo_4d_forge extends CI_DB_pdo_forge {
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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 3.0.0
|
||||
* @filesource
|
||||
|
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_pdo_cubrid_driver extends CI_DB_pdo_driver {
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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 3.0.0
|
||||
* @filesource
|
||||
|
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_pdo_cubrid_forge extends CI_DB_pdo_forge {
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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 3.0.0
|
||||
* @filesource
|
||||
|
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_pdo_dblib_driver extends CI_DB_pdo_driver {
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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 3.0.0
|
||||
* @filesource
|
||||
|
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_pdo_dblib_forge extends CI_DB_pdo_forge {
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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 3.0.0
|
||||
* @filesource
|
||||
|
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_pdo_firebird_driver extends CI_DB_pdo_driver {
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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 3.0.0
|
||||
* @filesource
|
||||
|
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_pdo_firebird_forge extends CI_DB_pdo_forge {
|
||||
|
||||
|
@ -126,7 +126,7 @@ class CI_DB_pdo_firebird_forge extends CI_DB_pdo_forge {
|
|||
* @return string|string[]
|
||||
*/
|
||||
protected function _alter_table($alter_type, $table, $field)
|
||||
{
|
||||
{
|
||||
if (in_array($alter_type, array('DROP', 'ADD'), TRUE))
|
||||
{
|
||||
return parent::_alter_table($alter_type, $table, $field);
|
||||
|
@ -150,7 +150,7 @@ class CI_DB_pdo_firebird_forge extends CI_DB_pdo_forge {
|
|||
if ( ! empty($field[$i]['default']))
|
||||
{
|
||||
$sqls[] = $sql.' ALTER COLUMN '.$this->db->escape_identifiers($field[$i]['name'])
|
||||
.' SET DEFAULT '.$field[$i]['default'];
|
||||
.' SET '.$field[$i]['default'];
|
||||
}
|
||||
|
||||
if (isset($field[$i]['null']))
|
||||
|
@ -169,7 +169,7 @@ class CI_DB_pdo_firebird_forge extends CI_DB_pdo_forge {
|
|||
}
|
||||
|
||||
return $sqls;
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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 3.0.0
|
||||
* @filesource
|
||||
|
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_pdo_ibm_driver extends CI_DB_pdo_driver {
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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 3.0.0
|
||||
* @filesource
|
||||
|
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_pdo_ibm_forge extends CI_DB_pdo_forge {
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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 3.0.0
|
||||
* @filesource
|
||||
|
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_pdo_informix_driver extends CI_DB_pdo_driver {
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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 3.0.0
|
||||
* @filesource
|
||||
|
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_pdo_informix_forge extends CI_DB_pdo_forge {
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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 3.0.0
|
||||
* @filesource
|
||||
|
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_pdo_mysql_driver extends CI_DB_pdo_driver {
|
||||
|
||||
|
@ -167,6 +167,11 @@ class CI_DB_pdo_mysql_driver extends CI_DB_pdo_driver {
|
|||
empty($this->encrypt['ssl_capath']) OR $ssl[PDO::MYSQL_ATTR_SSL_CAPATH] = $this->encrypt['ssl_capath'];
|
||||
empty($this->encrypt['ssl_cipher']) OR $ssl[PDO::MYSQL_ATTR_SSL_CIPHER] = $this->encrypt['ssl_cipher'];
|
||||
|
||||
if (defined('PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT') && isset($this->encrypt['ssl_verify']))
|
||||
{
|
||||
$ssl[PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT] = $this->encrypt['ssl_verify'];
|
||||
}
|
||||
|
||||
// DO NOT use array_merge() here!
|
||||
// It re-indexes numeric keys and the PDO_MYSQL_ATTR_SSL_* constants are integers.
|
||||
empty($ssl) OR $this->options += $ssl;
|
||||
|
@ -274,7 +279,7 @@ class CI_DB_pdo_mysql_driver extends CI_DB_pdo_driver {
|
|||
*/
|
||||
protected function _list_tables($prefix_limit = FALSE)
|
||||
{
|
||||
$sql = 'SHOW TABLES';
|
||||
$sql = 'SHOW TABLES FROM '.$this->_escape_char.$this->database.$this->_escape_char;
|
||||
|
||||
if ($prefix_limit === TRUE && $this->dbprefix !== '')
|
||||
{
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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 3.0.0
|
||||
* @filesource
|
||||
|
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_pdo_mysql_forge extends CI_DB_pdo_forge {
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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 3.0.0
|
||||
* @filesource
|
||||
|
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_pdo_oci_driver extends CI_DB_pdo_driver {
|
||||
|
||||
|
@ -142,9 +142,9 @@ class CI_DB_pdo_oci_driver extends CI_DB_pdo_driver {
|
|||
}
|
||||
|
||||
$version_string = parent::version();
|
||||
if (preg_match('#Release\s(?<version>\d+(?:\.\d+)+)#', $version_string, $match))
|
||||
if (preg_match('#(Release\s)?(?<version>\d+(?:\.\d+)+)#', $version_string, $match))
|
||||
{
|
||||
return $this->data_cache['version'] = $match[1];
|
||||
return $this->data_cache['version'] = $match['version'];
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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 3.0.0
|
||||
* @filesource
|
||||
|
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_pdo_oci_forge extends CI_DB_pdo_forge {
|
||||
|
||||
|
@ -74,6 +74,13 @@ class CI_DB_pdo_oci_forge extends CI_DB_pdo_forge {
|
|||
*/
|
||||
protected $_unsigned = FALSE;
|
||||
|
||||
/**
|
||||
* NULL value representation in CREATE/ALTER TABLE statements
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_null = 'NULL';
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
|
@ -143,9 +150,33 @@ class CI_DB_pdo_oci_forge extends CI_DB_pdo_forge {
|
|||
*/
|
||||
protected function _attr_auto_increment(&$attributes, &$field)
|
||||
{
|
||||
// Not supported - sequences and triggers must be used instead
|
||||
if ( ! empty($attributes['AUTO_INCREMENT']) && $attributes['AUTO_INCREMENT'] === TRUE && stripos($field['type'], 'number') !== FALSE && version_compare($this->db->version(), '12.1', '>='))
|
||||
{
|
||||
$field['auto_increment'] = ' GENERATED ALWAYS AS IDENTITY';
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Process column
|
||||
*
|
||||
* @param array $field
|
||||
* @return string
|
||||
*/
|
||||
protected function _process_column($field)
|
||||
{
|
||||
return $this->db->escape_identifiers($field['name'])
|
||||
.' '.$field['type'].$field['length']
|
||||
.$field['unsigned']
|
||||
.$field['default']
|
||||
.$field['auto_increment']
|
||||
.$field['null']
|
||||
.$field['unique'];
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Field attribute TYPE
|
||||
*
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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 3.0.0
|
||||
* @filesource
|
||||
|
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_pdo_odbc_driver extends CI_DB_pdo_driver {
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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 3.0.0
|
||||
* @filesource
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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 3.0.0
|
||||
* @filesource
|
||||
|
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_pdo_pgsql_driver extends CI_DB_pdo_driver {
|
||||
|
||||
|
@ -98,7 +98,7 @@ class CI_DB_pdo_pgsql_driver extends CI_DB_pdo_driver {
|
|||
|
||||
if ( ! empty($this->username))
|
||||
{
|
||||
$this->dsn .= ';username='.$this->username;
|
||||
$this->dsn .= ';user='.$this->username;
|
||||
empty($this->password) OR $this->dsn .= ';password='.$this->password;
|
||||
}
|
||||
}
|
||||
|
@ -255,7 +255,7 @@ class CI_DB_pdo_pgsql_driver extends CI_DB_pdo_driver {
|
|||
{
|
||||
return 'SELECT "column_name"
|
||||
FROM "information_schema"."columns"
|
||||
WHERE LOWER("table_name") = '.$this->escape(strtolower($table));
|
||||
WHERE "table_schema" = \''.$this->schema.'\' AND LOWER("table_name") = '.$this->escape(strtolower($table));
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
@ -270,7 +270,7 @@ class CI_DB_pdo_pgsql_driver extends CI_DB_pdo_driver {
|
|||
{
|
||||
$sql = 'SELECT "column_name", "data_type", "character_maximum_length", "numeric_precision", "column_default"
|
||||
FROM "information_schema"."columns"
|
||||
WHERE LOWER("table_name") = '.$this->escape(strtolower($table));
|
||||
WHERE "table_schema" = \''.$this->schema.'\' AND LOWER("table_name") = '.$this->escape(strtolower($table));
|
||||
|
||||
if (($query = $this->query($sql)) === FALSE)
|
||||
{
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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 3.0.0
|
||||
* @filesource
|
||||
|
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_pdo_pgsql_forge extends CI_DB_pdo_forge {
|
||||
|
||||
|
@ -106,7 +106,7 @@ class CI_DB_pdo_pgsql_forge extends CI_DB_pdo_forge {
|
|||
* @return string|string[]
|
||||
*/
|
||||
protected function _alter_table($alter_type, $table, $field)
|
||||
{
|
||||
{
|
||||
if (in_array($alter_type, array('DROP', 'ADD'), TRUE))
|
||||
{
|
||||
return parent::_alter_table($alter_type, $table, $field);
|
||||
|
@ -130,13 +130,13 @@ class CI_DB_pdo_pgsql_forge extends CI_DB_pdo_forge {
|
|||
if ( ! empty($field[$i]['default']))
|
||||
{
|
||||
$sqls[] = $sql.' ALTER COLUMN '.$this->db->escape_identifiers($field[$i]['name'])
|
||||
.' SET DEFAULT '.$field[$i]['default'];
|
||||
.' SET '.$field[$i]['default'];
|
||||
}
|
||||
|
||||
if (isset($field[$i]['null']))
|
||||
{
|
||||
$sqls[] = $sql.' ALTER COLUMN '.$this->db->escape_identifiers($field[$i]['name'])
|
||||
.($field[$i]['null'] === TRUE ? ' DROP NOT NULL' : ' SET NOT NULL');
|
||||
.(trim($field[$i]['null']) === $this->_null ? ' DROP NOT NULL' : ' SET NOT NULL');
|
||||
}
|
||||
|
||||
if ( ! empty($field[$i]['new_name']))
|
||||
|
@ -154,7 +154,7 @@ class CI_DB_pdo_pgsql_forge extends CI_DB_pdo_forge {
|
|||
}
|
||||
|
||||
return $sqls;
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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 3.0.0
|
||||
* @filesource
|
||||
|
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_pdo_sqlite_driver extends CI_DB_pdo_driver {
|
||||
|
||||
|
@ -128,24 +128,18 @@ class CI_DB_pdo_sqlite_driver extends CI_DB_pdo_driver {
|
|||
*/
|
||||
public function list_fields($table)
|
||||
{
|
||||
// Is there a cached result?
|
||||
if (isset($this->data_cache['field_names'][$table]))
|
||||
{
|
||||
return $this->data_cache['field_names'][$table];
|
||||
}
|
||||
|
||||
if (($result = $this->query('PRAGMA TABLE_INFO('.$this->protect_identifiers($table, TRUE, NULL, FALSE).')')) === FALSE)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$this->data_cache['field_names'][$table] = array();
|
||||
$fields = array();
|
||||
foreach ($result->result_array() as $row)
|
||||
{
|
||||
$this->data_cache['field_names'][$table][] = $row['name'];
|
||||
$fields[] = $row['name'];
|
||||
}
|
||||
|
||||
return $this->data_cache['field_names'][$table];
|
||||
return $fields;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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 3.0.0
|
||||
* @filesource
|
||||
|
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_pdo_sqlite_forge extends CI_DB_pdo_forge {
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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 3.0.0
|
||||
* @filesource
|
||||
|
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_pdo_sqlsrv_driver extends CI_DB_pdo_driver {
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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 3.0.0
|
||||
* @filesource
|
||||
|
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_pdo_sqlsrv_forge extends CI_DB_pdo_forge {
|
||||
|
||||
|
|
|
@ -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 - 2017, 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 - 2017, 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.3.0
|
||||
* @filesource
|
||||
|
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_postgre_driver extends CI_DB {
|
||||
|
||||
|
@ -78,22 +78,12 @@ class CI_DB_postgre_driver extends CI_DB {
|
|||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
* Build DSN
|
||||
*
|
||||
* Creates a DSN string to be used for db_connect() and db_pconnect()
|
||||
*
|
||||
* @param array $params
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($params)
|
||||
protected function _build_dsn()
|
||||
{
|
||||
parent::__construct($params);
|
||||
|
||||
if ( ! empty($this->dsn))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$this->dsn === '' OR $this->dsn = '';
|
||||
|
||||
if (strpos($this->hostname, '/') !== FALSE)
|
||||
|
@ -149,6 +139,7 @@ class CI_DB_postgre_driver extends CI_DB {
|
|||
*/
|
||||
public function db_connect($persistent = FALSE)
|
||||
{
|
||||
empty($this->dsn) && $this->_build_dsn();
|
||||
$this->conn_id = ($persistent === TRUE)
|
||||
? pg_pconnect($this->dsn)
|
||||
: pg_connect($this->dsn);
|
||||
|
@ -163,6 +154,13 @@ class CI_DB_postgre_driver extends CI_DB {
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (pg_set_client_encoding($this->conn_id, $this->char_set) !== 0)
|
||||
{
|
||||
log_message('error', "Database: Unable to set the configured connection charset ('{$this->char_set}').");
|
||||
pg_close($this->conn_id);
|
||||
return ($this->db->db_debug) ? $this->display_error('db_unable_to_set_charset', $this->char_set) : FALSE;
|
||||
}
|
||||
|
||||
empty($this->schema) OR $this->simple_query('SET search_path TO '.$this->schema.',public');
|
||||
}
|
||||
|
||||
|
@ -189,19 +187,6 @@ class CI_DB_postgre_driver extends CI_DB {
|
|||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Set client character set
|
||||
*
|
||||
* @param string $charset
|
||||
* @return bool
|
||||
*/
|
||||
protected function _db_set_charset($charset)
|
||||
{
|
||||
return (pg_set_client_encoding($this->conn_id, $charset) === 0);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Database version number
|
||||
*
|
||||
|
@ -224,8 +209,8 @@ class CI_DB_postgre_driver extends CI_DB {
|
|||
* and so we'll have to fall back to running a query in
|
||||
* order to get it.
|
||||
*/
|
||||
return isset($pg_version['server'])
|
||||
? $this->data_cache['version'] = $pg_version['server']
|
||||
return (isset($pg_version['server']) && preg_match('#^(\d+\.\d+)#', $pg_version['server'], $match))
|
||||
? $this->data_cache['version'] = $match[1]
|
||||
: parent::version();
|
||||
}
|
||||
|
||||
|
@ -321,7 +306,7 @@ class CI_DB_postgre_driver extends CI_DB {
|
|||
*/
|
||||
public function escape($str)
|
||||
{
|
||||
if (is_php('5.4.4') && (is_string($str) OR (is_object($str) && method_exists($str, '__toString'))))
|
||||
if (is_string($str) OR (is_object($str) && method_exists($str, '__toString')))
|
||||
{
|
||||
return pg_escape_literal($this->conn_id, $str);
|
||||
}
|
||||
|
@ -354,8 +339,7 @@ class CI_DB_postgre_driver extends CI_DB {
|
|||
*/
|
||||
public function insert_id()
|
||||
{
|
||||
$v = pg_version($this->conn_id);
|
||||
$v = isset($v['server']) ? $v['server'] : 0; // 'server' key is only available since PosgreSQL 7.4
|
||||
$v = $this->version();
|
||||
|
||||
$table = (func_num_args() > 0) ? func_get_arg(0) : NULL;
|
||||
$column = (func_num_args() > 1) ? func_get_arg(1) : NULL;
|
||||
|
@ -429,7 +413,7 @@ class CI_DB_postgre_driver extends CI_DB {
|
|||
{
|
||||
return 'SELECT "column_name"
|
||||
FROM "information_schema"."columns"
|
||||
WHERE LOWER("table_name") = '.$this->escape(strtolower($table));
|
||||
WHERE "table_schema" = \''.$this->schema.'\' AND LOWER("table_name") = '.$this->escape(strtolower($table));
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
@ -444,7 +428,7 @@ class CI_DB_postgre_driver extends CI_DB {
|
|||
{
|
||||
$sql = 'SELECT "column_name", "data_type", "character_maximum_length", "numeric_precision", "column_default"
|
||||
FROM "information_schema"."columns"
|
||||
WHERE LOWER("table_name") = '.$this->escape(strtolower($table));
|
||||
WHERE "table_schema" = \''.$this->schema.'\' AND LOWER("table_name") = '.$this->escape(strtolower($table));
|
||||
|
||||
if (($query = $this->query($sql)) === FALSE)
|
||||
{
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, 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 - 2017, 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.3.0
|
||||
* @filesource
|
||||
|
@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/userguide3/database/
|
||||
*/
|
||||
class CI_DB_postgre_forge extends CI_DB_forge {
|
||||
|
||||
|
@ -101,7 +101,7 @@ class CI_DB_postgre_forge extends CI_DB_forge {
|
|||
* @return string|string[]
|
||||
*/
|
||||
protected function _alter_table($alter_type, $table, $field)
|
||||
{
|
||||
{
|
||||
if (in_array($alter_type, array('DROP', 'ADD'), TRUE))
|
||||
{
|
||||
return parent::_alter_table($alter_type, $table, $field);
|
||||
|
@ -125,13 +125,13 @@ class CI_DB_postgre_forge extends CI_DB_forge {
|
|||
if ( ! empty($field[$i]['default']))
|
||||
{
|
||||
$sqls[] = $sql.' ALTER COLUMN '.$this->db->escape_identifiers($field[$i]['name'])
|
||||
.' SET DEFAULT '.$field[$i]['default'];
|
||||
.' SET '.$field[$i]['default'];
|
||||
}
|
||||
|
||||
if (isset($field[$i]['null']))
|
||||
{
|
||||
$sqls[] = $sql.' ALTER COLUMN '.$this->db->escape_identifiers($field[$i]['name'])
|
||||
.($field[$i]['null'] === TRUE ? ' DROP NOT NULL' : ' SET NOT NULL');
|
||||
.(trim($field[$i]['null']) === $this->_null ? ' DROP NOT NULL' : ' SET NOT NULL');
|
||||
}
|
||||
|
||||
if ( ! empty($field[$i]['new_name']))
|
||||
|
@ -149,7 +149,7 @@ class CI_DB_postgre_forge extends CI_DB_forge {
|
|||
}
|
||||
|
||||
return $sqls;
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Ładowanie…
Reference in New Issue