summaryrefslogtreecommitdiffstats
path: root/system/core
diff options
context:
space:
mode:
Diffstat (limited to 'system/core')
-rw-r--r--system/core/Common.php23
-rw-r--r--system/core/Input.php33
-rw-r--r--system/core/Loader.php6
-rw-r--r--system/core/Log.php4
4 files changed, 39 insertions, 27 deletions
diff --git a/system/core/Common.php b/system/core/Common.php
index b4f0c388e..93cd0a0ae 100644
--- a/system/core/Common.php
+++ b/system/core/Common.php
@@ -346,7 +346,20 @@ if ( ! function_exists('is_https'))
*/
function is_https()
{
- return (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) === 'on');
+ if ( ! empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off')
+ {
+ return TRUE;
+ }
+ elseif (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https')
+ {
+ return TRUE;
+ }
+ elseif ( ! empty($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower($_SERVER['HTTP_FRONT_END_HTTPS']) !== 'off')
+ {
+ return TRUE;
+ }
+
+ return FALSE;
}
}
@@ -424,12 +437,12 @@ if ( ! function_exists('log_message'))
* We use this as a simple mechanism to access the logging
* class and send messages to be logged.
*
- * @param string
- * @param string
- * @param bool
+ * @param string the error level: 'error', 'debug' or 'info'
+ * @param string the error message
+ * @param bool whether the error is a native PHP error
* @return void
*/
- function log_message($level = 'error', $message, $php_error = FALSE)
+ function log_message($level, $message, $php_error = FALSE)
{
static $_log, $_log_threshold;
diff --git a/system/core/Input.php b/system/core/Input.php
index 6690b7f2e..0ef81128e 100644
--- a/system/core/Input.php
+++ b/system/core/Input.php
@@ -790,31 +790,30 @@ class CI_Input {
*/
public function request_headers($xss_clean = FALSE)
{
+ // If header is already defined, return it immediately
+ if ( ! empty($this->headers))
+ {
+ return $this->headers;
+ }
+
// In Apache, you can simply call apache_request_headers()
if (function_exists('apache_request_headers'))
{
- $headers = apache_request_headers();
+ return $this->headers = apache_request_headers();
}
- else
- {
- $headers['Content-Type'] = isset($_SERVER['CONTENT_TYPE']) ? $_SERVER['CONTENT_TYPE'] : @getenv('CONTENT_TYPE');
- foreach ($_SERVER as $key => $val)
- {
- if (sscanf($key, 'HTTP_%s', $header) === 1)
- {
- $headers[$header] = $this->_fetch_from_array($_SERVER, $key, $xss_clean);
- }
- }
- }
+ $this->headers['Content-Type'] = isset($_SERVER['CONTENT_TYPE']) ? $_SERVER['CONTENT_TYPE'] : @getenv('CONTENT_TYPE');
- // take SOME_HEADER and turn it into Some-Header
- foreach ($headers as $key => $val)
+ foreach ($_SERVER as $key => $val)
{
- $key = str_replace(array('_', '-'), ' ', strtolower($key));
- $key = str_replace(' ', '-', ucwords($key));
+ if (sscanf($key, 'HTTP_%s', $header) === 1)
+ {
+ // take SOME_HEADER and turn it into Some-Header
+ $header = str_replace('_', ' ', strtolower($header));
+ $header = str_replace(' ', '-', ucwords($header));
- $this->headers[$key] = $val;
+ $this->headers[$header] = $this->_fetch_from_array($_SERVER, $key, $xss_clean);
+ }
}
return $this->headers;
diff --git a/system/core/Loader.php b/system/core/Loader.php
index d4e63231c..70a6b6fa6 100644
--- a/system/core/Loader.php
+++ b/system/core/Loader.php
@@ -658,7 +658,7 @@ class CI_Loader {
return FALSE;
}
- if ( ! class_exists('CI_Driver_Library'))
+ if ( ! class_exists('CI_Driver_Library', FALSE))
{
// We aren't instantiating an object here, just making the base class available
require BASEPATH.'libraries/Driver.php';
@@ -713,7 +713,7 @@ class CI_Loader {
*
* Return a list of all package paths.
*
- * @param bool $include_base Whether to include BASEPATH (default: TRUE)
+ * @param bool $include_base Whether to include BASEPATH (default: FALSE)
* @return array
*/
public function get_package_paths($include_base = FALSE)
@@ -955,7 +955,7 @@ class CI_Loader {
// Is this a class extension request?
if (file_exists($subclass))
{
- $baseclass = BASEPATH.'libraries/'.$class.'.php';
+ $baseclass = BASEPATH.'libraries/'.$subdir.$class.'.php';
if ( ! file_exists($baseclass))
{
diff --git a/system/core/Log.php b/system/core/Log.php
index a84d3dc22..e4d72b544 100644
--- a/system/core/Log.php
+++ b/system/core/Log.php
@@ -138,12 +138,12 @@ class CI_Log {
*
* Generally this function will be called using the global log_message() function
*
- * @param string the error level
+ * @param string the error level: 'error', 'debug' or 'info'
* @param string the error message
* @param bool whether the error is a native PHP error
* @return bool
*/
- public function write_log($level = 'error', $msg, $php_error = FALSE)
+ public function write_log($level, $msg, $php_error = FALSE)
{
if ($this->_enabled === FALSE)
{