Closed (fixed)
Project:
Front Page
Version:
6.x-1.2
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
18 Jun 2008 at 05:43 UTC
Updated:
24 Jan 2009 at 15:10 UTC
Jump to comment: Most recent file
When using the front module to specify different front pages per role and override "Home" breadcrumb links, I get this error when directly accessing the site (typing the address instead of clicking through).
The error message received:
notice: Undefined index: HTTP_REFERER in /home/.xxx/yyyy/zzz.ca/sites/all/modules/front/front_page.module on line 292.
Contents of line 292:
//this checks to see if you are overriding HOME links on the site
if (variable_get('front_page_breadcrumb', 0)) {
// This checks to see if the referer is an internal HOME link or not.
$newhome = variable_get('front_page_breadcrumb_redirect', 'node');
$ref = $_SERVER['HTTP_REFERER']; // LINE 292
global $user, $base_url;
$parsed_url=parse_url($base_url);
$domain = $parsed_url['host'];
if (stristr($ref, $domain)) {
drupal_goto($path = $newhome, $query = null, $fragment = null);
}
}
Just a humble suggestion: add isset($_SERVER['HTTP_REFERER']) to the if construct that determines if home links should be overridden.
//this checks to see if you are overriding HOME links on the site
if (variable_get('front_page_breadcrumb', 0) && isset($_SERVER['HTTP_REFERER'])) {
// This checks to see if the referer is an internal HOME link or not.
$newhome = variable_get('front_page_breadcrumb_redirect', 'node');
$ref = $_SERVER['HTTP_REFERER'];
global $user, $base_url;
$parsed_url=parse_url($base_url);
$domain = $parsed_url['host'];
if (stristr($ref, $domain)) {
drupal_goto($path = $newhome, $query = null, $fragment = null);
}
}
Seems to work for me. Patch attached.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | front_page.module.1.patch | 245 bytes | Ryan Palmer |
Comments
Comment #1
Ryan Palmer commentedPatch really attached.
Comment #2
Dublin Drupaller commentedThanks for the patch, Ryan. Good catch. Patch has been committed.