- Timestamp:
- Apr 27, 2017 2:56:05 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Utilities.inc.php
r591 r598 1261 1261 if (array_key_exists($key, $_SERVER)) { 1262 1262 foreach (explode(',', $_SERVER[$key]) as $addr) { 1263 // Strip non-address data to avoid "PHP Warning: inet_pton(): Unrecognized address for=189.211.197.173 in ./Utilities.inc.php on line 1293" 1264 $addr = preg_replace('/[^=]=/', '', $addr); 1263 1265 $addr = canonicalIPAddr(trim($addr)); 1264 1266 if (false !== filter_var($addr, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) { … … 1394 1396 { 1395 1397 $current_url = absoluteMe(); 1396 $refer er_url = getenv('HTTP_REFERER');1398 $referrer_url = getenv('HTTP_REFERER'); 1397 1399 1398 1400 // If one of the hostnames is an IP address, compare only the path of both. 1399 1401 if (preg_match('/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/', parse_url($current_url, PHP_URL_HOST)) || preg_match('/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/', parse_url($referrer_url, PHP_URL_HOST))) { 1400 1402 $current_url = preg_replace('@^https?://[^/]+@', '', $current_url); 1401 $refer er_url = preg_replace('@^https?://[^/]+@', '', $referer_url);1403 $referrer_url = preg_replace('@^https?://[^/]+@', '', $referrer_url); 1402 1404 } 1403 1405 1404 1406 if ($exclude_query) { 1405 return (stripQuery($current_url) == stripQuery($refer er_url));1407 return (stripQuery($current_url) == stripQuery($referrer_url)); 1406 1408 } else { 1407 1409 $app =& App::getInstance(); 1408 $app->logMsg(sprintf('refererIsMe comparison: %s == %s', $current_url, $refer er_url), LOG_DEBUG, __FILE__, __LINE__);1409 return ($current_url == $refer er_url);1410 $app->logMsg(sprintf('refererIsMe comparison: %s == %s', $current_url, $referrer_url), LOG_DEBUG, __FILE__, __LINE__); 1411 return ($current_url == $referrer_url); 1410 1412 } 1411 1413 }
Note: See TracChangeset
for help on using the changeset viewer.