From 223a9b14fcee2977dfe6282e33f637e4ec15e083 Mon Sep 17 00:00:00 2001 From: Patrick Nelson Date: Thu, 15 Oct 2015 11:38:55 -0400 Subject: [PATCH] FIX for #15 Ensuring we use the framework for determining client IP (security/bug fix) --- code/MaintenanceModeExtension.php | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/code/MaintenanceModeExtension.php b/code/MaintenanceModeExtension.php index 774b399..7954f73 100755 --- a/code/MaintenanceModeExtension.php +++ b/code/MaintenanceModeExtension.php @@ -84,22 +84,7 @@ public function hasAllowedIP() { * @return string */ public function getClientIP() { - if (isset($_SERVER['HTTP_CLIENT_IP'])) { - $ipaddress = $_SERVER['HTTP_CLIENT_IP']; - } elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { - $ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR']; - } elseif (isset($_SERVER['HTTP_X_FORWARDED'])) { - $ipaddress = $_SERVER['HTTP_X_FORWARDED']; - } elseif (isset($_SERVER['HTTP_FORWARDED_FOR'])) { - $ipaddress = $_SERVER['HTTP_FORWARDED_FOR']; - } elseif (isset($_SERVER['HTTP_FORWARDED'])) { - $ipaddress = $_SERVER['HTTP_FORWARDED']; - } elseif (isset($_SERVER['REMOTE_ADDR'])) { - $ipaddress = $_SERVER['REMOTE_ADDR']; - } else { - $ipaddress = 'Unknown'; - } - return $ipaddress; + return $this->owner->getRequest()->getIP(); } }//end class MaintenanceMode_Page_ControllerExtension