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.

CommentFileSizeAuthor
#1 front_page.module.1.patch245 bytesRyan Palmer

Comments

Ryan Palmer’s picture

StatusFileSize
new245 bytes

Patch really attached.

Dublin Drupaller’s picture

Assigned: Unassigned » Dublin Drupaller
Status: Active » Fixed

Thanks for the patch, Ryan. Good catch. Patch has been committed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.