From 1074bbf1851499e98912349c386701657c7f2cdd Mon Sep 17 00:00:00 2001 From: "Richard Deurwaarder (Xeli)" Date: Wed, 19 Jun 2013 10:57:27 +0200 Subject: Add support for https behind a reverse proxy using X-Forwarded-Proto --- system/core/Common.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'system/core/Common.php') diff --git a/system/core/Common.php b/system/core/Common.php index cad340f33..7bf11dae5 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -345,9 +345,17 @@ if ( ! function_exists('is_https')) * @return bool */ function is_https() - { - return (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) === 'on'); - } + { + if(isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) === 'on'){ + return True; + }elseif (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https'){ + return True; + }elseif (isset($_SERVER['HTTP_FRONT_END_HTTPS']) && $_SERVER['HTTP_FRONT_END_HTTPS'] == 'on'){ + return True; + }else{ + return False + } + } } // ------------------------------------------------------------------------ @@ -731,4 +739,4 @@ if ( ! function_exists('function_usable')) } /* End of file Common.php */ -/* Location: ./system/core/Common.php */ \ No newline at end of file +/* Location: ./system/core/Common.php */ -- cgit v1.2.3-24-g4f1b From 983b3139d4d834caed06a2341f0cd0beaa09114a Mon Sep 17 00:00:00 2001 From: "Richard Deurwaarder (Xeli)" Date: Wed, 19 Jun 2013 13:49:08 +0200 Subject: Change True -> TRUE per codeigniter guidelines --- system/core/Common.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'system/core/Common.php') diff --git a/system/core/Common.php b/system/core/Common.php index 7bf11dae5..467691cbf 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -347,13 +347,13 @@ if ( ! function_exists('is_https')) function is_https() { if(isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) === 'on'){ - return True; + return TRUE; }elseif (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https'){ - return True; + return TRUE; }elseif (isset($_SERVER['HTTP_FRONT_END_HTTPS']) && $_SERVER['HTTP_FRONT_END_HTTPS'] == 'on'){ - return True; + return TRUE; }else{ - return False + return FALSE; } } } -- cgit v1.2.3-24-g4f1b From 7cd4055f460f0c191e29d0e2952023d5f6400d30 Mon Sep 17 00:00:00 2001 From: "Richard Deurwaarder (Xeli)" Date: Mon, 24 Jun 2013 13:48:34 +0200 Subject: Use codeigniter coding style --- system/core/Common.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'system/core/Common.php') diff --git a/system/core/Common.php b/system/core/Common.php index 467691cbf..db611e39a 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -346,13 +346,20 @@ if ( ! function_exists('is_https')) */ function is_https() { - if(isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) === 'on'){ + if(isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) === 'on') + { return TRUE; - }elseif (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https'){ + } + elseif (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') + { return TRUE; - }elseif (isset($_SERVER['HTTP_FRONT_END_HTTPS']) && $_SERVER['HTTP_FRONT_END_HTTPS'] == 'on'){ + } + elseif (isset($_SERVER['HTTP_FRONT_END_HTTPS']) && $_SERVER['HTTP_FRONT_END_HTTPS'] == 'on') + { return TRUE; - }else{ + } + else + { return FALSE; } } @@ -737,6 +744,5 @@ if ( ! function_exists('function_usable')) return FALSE; } } - /* End of file Common.php */ /* Location: ./system/core/Common.php */ -- cgit v1.2.3-24-g4f1b From 668d0093a08a4be58f0bcfcf1414d94a924256b8 Mon Sep 17 00:00:00 2001 From: "Richard Deurwaarder (Xeli)" Date: Mon, 24 Jun 2013 13:50:52 +0200 Subject: remove newline in system/core/Common.php --- system/core/Common.php | 1 + 1 file changed, 1 insertion(+) (limited to 'system/core/Common.php') diff --git a/system/core/Common.php b/system/core/Common.php index db611e39a..11ff4bae9 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -744,5 +744,6 @@ if ( ! function_exists('function_usable')) return FALSE; } } + /* End of file Common.php */ /* Location: ./system/core/Common.php */ -- cgit v1.2.3-24-g4f1b From 7061bd014b6b7dbf89bf42e940aa134228f044ce Mon Sep 17 00:00:00 2001 From: "Richard Deurwaarder (Xeli)" Date: Mon, 24 Jun 2013 14:07:21 +0200 Subject: remove newline at eof in syste/core/Common --- system/core/Common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/core/Common.php') diff --git a/system/core/Common.php b/system/core/Common.php index 11ff4bae9..081b63cce 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -746,4 +746,4 @@ if ( ! function_exists('function_usable')) } /* End of file Common.php */ -/* Location: ./system/core/Common.php */ +/* Location: ./system/core/Common.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 4760aeff226175cc4267dd8fb8963a03031b78d2 Mon Sep 17 00:00:00 2001 From: "Richard Deurwaarder (Xeli)" Date: Mon, 24 Jun 2013 14:50:35 +0200 Subject: Revert "remove newline at eof in syste/core/Common" This reverts commit 7061bd014b6b7dbf89bf42e940aa134228f044ce. --- system/core/Common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/core/Common.php') diff --git a/system/core/Common.php b/system/core/Common.php index 081b63cce..11ff4bae9 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -746,4 +746,4 @@ if ( ! function_exists('function_usable')) } /* End of file Common.php */ -/* Location: ./system/core/Common.php */ \ No newline at end of file +/* Location: ./system/core/Common.php */ -- cgit v1.2.3-24-g4f1b From 23dc052fb2149725c15e0e51e64e34642b89defd Mon Sep 17 00:00:00 2001 From: "Richard Deurwaarder (Xeli)" Date: Mon, 24 Jun 2013 14:52:47 +0200 Subject: fix indentation according to codeigniter codestyle system/core/Common --- system/core/Common.php | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'system/core/Common.php') diff --git a/system/core/Common.php b/system/core/Common.php index 11ff4bae9..bd187dcda 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -345,24 +345,24 @@ if ( ! function_exists('is_https')) * @return bool */ function is_https() - { - if(isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) === 'on') - { - return TRUE; - } - elseif (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') - { - return TRUE; - } - elseif (isset($_SERVER['HTTP_FRONT_END_HTTPS']) && $_SERVER['HTTP_FRONT_END_HTTPS'] == 'on') - { - return TRUE; - } - else - { - return FALSE; - } - } + { + if(isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) === 'on') + { + return TRUE; + } + elseif (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') + { + return TRUE; + } + elseif (isset($_SERVER['HTTP_FRONT_END_HTTPS']) && $_SERVER['HTTP_FRONT_END_HTTPS'] == 'on') + { + return TRUE; + } + else + { + return FALSE; + } + } } // ------------------------------------------------------------------------ -- cgit v1.2.3-24-g4f1b From 4055d577822130006e058f6505d022aac444f855 Mon Sep 17 00:00:00 2001 From: "Richard Deurwaarder (Xeli)" Date: Mon, 24 Jun 2013 14:59:20 +0200 Subject: remove newline again in system/core/Common.php, silly editor keeps adding it --- system/core/Common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/core/Common.php') diff --git a/system/core/Common.php b/system/core/Common.php index bd187dcda..851d4f34e 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -746,4 +746,4 @@ if ( ! function_exists('function_usable')) } /* End of file Common.php */ -/* Location: ./system/core/Common.php */ +/* Location: ./system/core/Common.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 7cc29451bb685d05b4faeb79762b1b291cb44b8b Mon Sep 17 00:00:00 2001 From: "Richard Deurwaarder (Xeli)" Date: Mon, 24 Jun 2013 15:06:19 +0200 Subject: remove else clause in is_https function, just add return FALSE as fallback --- system/core/Common.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'system/core/Common.php') diff --git a/system/core/Common.php b/system/core/Common.php index 851d4f34e..f3a1b5055 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -358,10 +358,7 @@ if ( ! function_exists('is_https')) { return TRUE; } - else - { - return FALSE; - } + return FALSE; } } -- cgit v1.2.3-24-g4f1b From 98999976f6025d7ffcb04f8aa448518651fb0d89 Mon Sep 17 00:00:00 2001 From: "Richard Deurwaarder (Xeli)" Date: Mon, 24 Jun 2013 15:19:30 +0200 Subject: some more readablility tweaks in system/core/Common --- system/core/Common.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'system/core/Common.php') diff --git a/system/core/Common.php b/system/core/Common.php index f3a1b5055..cb087cb22 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -346,7 +346,7 @@ if ( ! function_exists('is_https')) */ function is_https() { - if(isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) === 'on') + if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) === 'on') { return TRUE; } @@ -354,10 +354,11 @@ if ( ! function_exists('is_https')) { return TRUE; } - elseif (isset($_SERVER['HTTP_FRONT_END_HTTPS']) && $_SERVER['HTTP_FRONT_END_HTTPS'] == 'on') + elseif (isset($_SERVER['HTTP_FRONT_END_HTTPS']) && $_SERVER['HTTP_FRONT_END_HTTPS'] === 'on') { return TRUE; } + return FALSE; } } -- cgit v1.2.3-24-g4f1b