Skip to content

Commit

Permalink
Merge pull request #16 from patricknelson/issue-15-get-ip
Browse files Browse the repository at this point in the history
FIX for #15 Ensuring we use the framework for determining client IP (security/bug fix)
  • Loading branch information
dljoseph committed Oct 15, 2015
2 parents 5d550e7 + 223a9b1 commit d1c2a25
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions code/MaintenanceModeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d1c2a25

Please sign in to comment.