From a55039a2e529dd27e38d1a355ea61dbad0f2fa15 Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Thu, 1 Oct 2009 15:37:37 +0200 Subject: [PATCH] Add getIPAddress() (Bug #8620). --- framework/Browser/lib/Horde/Browser.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/framework/Browser/lib/Horde/Browser.php b/framework/Browser/lib/Horde/Browser.php index bedb46d1e..4520c1d51 100644 --- a/framework/Browser/lib/Horde/Browser.php +++ b/framework/Browser/lib/Horde/Browser.php @@ -961,6 +961,18 @@ class Horde_Browser } /** + * Returns the IP address of the client. + * + * @return string The client IP address. + */ + public function getIPAddress() + { + return empty($_SERVER['HTTP_X_FORWARDED_FOR']) + ? $_SERVER['REMOTE_ADDR'] + : $_SERVER['HTTP_X_FORWARDED_FOR']; + } + + /** * Determines if files can be uploaded to the system. * * @return integer If uploads allowed, returns the maximum size of the -- 2.11.0