From a48889fed83b007202e76ddf1ba5436eca310df0 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Thu, 18 Aug 2011 22:21:50 +0200 Subject: [feature/request-class] Add is_secure method to request for HTTPS PHPBB3-9716 --- phpBB/includes/request/interface.php | 7 +++++++ phpBB/includes/request/request.php | 10 ++++++++++ 2 files changed, 17 insertions(+) (limited to 'phpBB') diff --git a/phpBB/includes/request/interface.php b/phpBB/includes/request/interface.php index 983a05d6c4..c0b8768b24 100644 --- a/phpBB/includes/request/interface.php +++ b/phpBB/includes/request/interface.php @@ -121,6 +121,13 @@ interface phpbb_request_interface */ public function is_ajax(); + /** + * Checks if the current request is happening over HTTPS. + * + * @return bool True if the request is secure. + */ + public function is_secure(); + /** * Returns all variable names for a given super global * diff --git a/phpBB/includes/request/request.php b/phpBB/includes/request/request.php index 466397480b..8659ee8998 100644 --- a/phpBB/includes/request/request.php +++ b/phpBB/includes/request/request.php @@ -326,6 +326,16 @@ class phpbb_request implements phpbb_request_interface return $this->header('X-Requested-With') == 'XMLHttpRequest'; } + /** + * Checks if the current request is happening over HTTPS. + * + * @return bool True if the request is secure. + */ + public function is_secure() + { + return $this->server('HTTPS') == 'on'; + } + /** * Returns all variable names for a given super global * -- cgit v1.2.1