You are here

function fast_404_validate_path_drupal in Fast 404 6

Same name and namespace in other branches
  1. 7 fast_404.inc \fast_404_validate_path_drupal()
1 call to fast_404_validate_path_drupal()
fast_404_path_check in ./fast_404.inc

File

./fast_404.inc, line 99

Code

function fast_404_validate_path_drupal() {

  //check if path_redirect module is installed
  if (db_result(db_query("SELECT name FROM {system} WHERE type = 'module' AND status = 1 AND name = 'path_redirect'"))) {

    //check if path exits in path_redirect table
    if (db_result(db_query("SELECT rid FROM {path_redirect} WHERE '%s' LIKE source", $_GET['q']))) {
      return TRUE;
    }
  }
  $sql = "SELECT path FROM {menu_router} WHERE '%s' LIKE path OR '%s' LIKE CONCAT(path,'%')";
  $res = db_result(db_query($sql, $_GET['q'], $_GET['q']));
  if ($res) {
    return TRUE;
  }
  else {
    $sql = "SELECT pid FROM {url_alias} WHERE '%s' LIKE dst OR '%s' LIKE CONCAT(dst,'%')";
    $res = db_result(db_query($sql, $_GET['q'], $_GET['q']));
    return $res == 0 ? FALSE : TRUE;
  }
  return FALSE;
}