function fast_404_ext_check in Fast 404 6
Same name and namespace in other branches
- 7 fast_404.inc \fast_404_ext_check()
1 call to fast_404_ext_check()
- fast_404_boot in ./fast_404.module
- @desc Run the 404 check on boot. This function gets called during the DRUPAL_BOOTSTRAP_LATE_PAGE_CACHE stage of drupal_bootstrap. This means that if there is already cached content for the current URL, it will be delivered before this hook is reached.
File
- ./fast_404.inc, line 3
Code
function fast_404_ext_check() {
if (!empty($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING'] != '/' && $_SERVER['QUERY_STRING'] != '/index.php') {
$server_var = 'QUERY_STRING';
}
elseif (!empty($_SERVER['REQUEST_URI']) && $_SERVER['REQUEST_URI'] != '/' && $_SERVER['REQUEST_URI'] != '/index.php') {
$server_var = 'REQUEST_URI';
}
else {
return TRUE;
}
if (strpos($_SERVER[$server_var], 'imagecache')) {
if (variable_get('fast_404_allow_anon_imagecache', TRUE)) {
return TRUE;
}
else {
$found_session = FALSE;
foreach ($_COOKIE as $k => $v) {
if (stristr($k, 'SESS')) {
$found_session = TRUE;
break;
}
}
if ($found_session) {
return TRUE;
}
}
}
if (strpos($_SERVER[$server_var], '/advagg_')) {
return TRUE;
}
if (variable_get('fast_404_url_whitelisting', FALSE)) {
$allowed = variable_get('fast_404_whitelist', array());
if (in_array($_SERVER[$server_var], $allowed)) {
return TRUE;
}
}
$exts = variable_get('fast_404_exts', '/\\.(txt|png|gif|jpe?g|css|js|ico|swf|flv|cgi|bat|pl|dll|exe|asp|)$/i');
if ($exts && preg_match($exts, $_SERVER[$server_var], $m)) {
fast_404_error_return();
}
define('FAST_404_EXT_CHECKED', TRUE);
}