summaryrefslogtreecommitdiffstats
path: root/system/core/Common.php
diff options
context:
space:
mode:
Diffstat (limited to 'system/core/Common.php')
-rw-r--r--system/core/Common.php25
1 files changed, 19 insertions, 6 deletions
diff --git a/system/core/Common.php b/system/core/Common.php
index efa7a9380..93cd0a0ae 100644
--- a/system/core/Common.php
+++ b/system/core/Common.php
@@ -92,7 +92,7 @@ if ( ! function_exists('is_really_writable'))
*/
if (is_dir($file))
{
- $file = rtrim($file, '/').'/'.md5(mt_rand(1,100).mt_rand(1,100));
+ $file = rtrim($file, '/').'/'.md5(mt_rand());
if (($fp = @fopen($file, FOPEN_WRITE_CREATE)) === FALSE)
{
return FALSE;
@@ -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;