Download & Extend

Internal referer routine for overriding home breadcrumbs can be tricked by Google links

Project:Front Page
Version:6.x-2.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review

Issue Summary

Even though Front Page is a great module (worked like a charm for some months now), we recently encountered some problems that I would like to share with you.

Take a look at the method used to identify internally refered links, in order to override the home breadcrumbs. Please check the code in front_page.module starting at line 289.

@ line 296, the PHP server variable $_SERVER['HTTP_REFERER'] is compared against drupal's $base_url in order to evaluate if this is an internally pressed link. For example, if the $base_url is mydomain.tld and the referer is http://mydomain.tld/mypage/myview/etc then obviously this is actually an internal referer.

However, this creates confusion with links generated by Google results, that have the actual domain in their redirect URL. For example, when you lookup "drupal" in Google, the first hit is the link to:

http://www.google.com/url?sa=t&source=web&cd=1&sqi=2&ved=0CCUQFjAA&url=http%3A%2F%2Fdrupal.org%2F&ei=eRfCTLDlKtW7jAeo_exX&usg=AFQjCNFm9QShEHSv1oZ9NwNP_UHzLkKdqA

This causes the module to think that all Google links are internal referers and thus trigger the HOME breadcrumb override. Eventually, this could lead to wrong Front Page redirections...

This seems like a minor bug. The following code can be used to correct it (just before line 296):

    $ref2 = explode('http://', $ref);
    $ref2 = explode('/', $ref2[1]);
    $ref = $ref2[0];

Comments

#1

Version:6.x-1.2» 6.x-2.x-dev
Status:active» needs review

Hi tvasilla, this will no longer happen with both the 6.x-2.x and 7.x-2.x versions of front page as the home links are now truly rewritten rather than redirected after loading the home page.

Cheers,
Tim