You are here

function visitors_referers_condition in Visitors 7.2

Same name and namespace in other branches
  1. 8 forms/referers.inc \visitors_referers_condition()
  2. 7 forms/referers.inc \visitors_referers_condition()
  3. 7.0 forms/referers.inc \visitors_referers_condition()

Build sql query from referer type value.

Return value

string sql query.

1 call to visitors_referers_condition()
visitors_referer_list in reports/referers.inc
Display referers report.

File

forms/referers.inc, line 91
Referers form for visitors module.

Code

function visitors_referers_condition(&$query) {
  visitors_set_session_referer_type();
  switch ($_SESSION['referer_type']) {
    case REFERER_TYPE_INTERNAL_PAGES:
      $query
        ->condition('visitors_referer', sprintf('%%%s%%', $_SERVER['HTTP_HOST']), 'LIKE');
      $query
        ->condition('visitors_referer', '', '<>');
      break;
    case REFERER_TYPE_EXTERNAL_PAGES:
      $query
        ->condition('visitors_referer', sprintf('%%%s%%', $_SERVER['HTTP_HOST']), 'NOT LIKE');
      break;
    default:
      break;
  }
  return $query;
}