summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/libraries/User_agent.php21
1 files changed, 15 insertions, 6 deletions
diff --git a/system/libraries/User_agent.php b/system/libraries/User_agent.php
index e27004e9e..50ac9be98 100644
--- a/system/libraries/User_agent.php
+++ b/system/libraries/User_agent.php
@@ -471,15 +471,24 @@ class CI_User_agent {
*/
public function is_referral()
{
- if (empty($_SERVER['HTTP_REFERER']))
+ static $result;
+
+ if ( ! isset($result))
{
- return FALSE;
- }
+ if (empty($_SERVER['HTTP_REFERER']))
+ {
+ $result = FALSE;
+ }
+ else
+ {
+ $referer_host = @parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST);
+ $own_host = parse_url(config_item('base_url'), PHP_URL_HOST);
- $referer_host = @parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST);
- $own_host = parse_url(config_item('base_url'), PHP_URL_HOST);
+ $result = ($referer_host && $referer_host !== $own_host);
+ }
+ }
- return ($referer_host && $referer_host !== $own_host);
+ return $result;
}
// --------------------------------------------------------------------