function _cas_allow_check_for_login in CAS 6.2
Same name and namespace in other branches
- 5.4 cas.module \_cas_allow_check_for_login()
- 5.3 cas.module \_cas_allow_check_for_login()
- 6.3 cas.module \_cas_allow_check_for_login()
- 7 cas.module \_cas_allow_check_for_login()
1 call to _cas_allow_check_for_login()
- cas_login_check in ./
cas.module - Checks to see if the user needs to be logged in
File
- ./
cas.module, line 926
Code
function _cas_allow_check_for_login() {
// Determine whether we should check for long
$cas_check_first = variable_get('cas_check_first', 1);
if (!$cas_check_first) {
return FALSE;
}
// Check to see if we already have.
if ($_COOKIE['cas_login_checked']) {
return FALSE;
}
// Check to see if we've got a search bot.
$crawlers = array(
'Google',
'msnbot',
'Rambler',
'Yahoo',
'AbachoBOT',
'accoona',
'AcoiRobot',
'ASPSeek',
'CrocCrawler',
'Dumbot',
'FAST-WebCrawler',
'GeonaBot',
'Gigabot',
'Lycos',
'MSRBOT',
'Scooter',
'AltaVista',
'IDBot',
'eStyle',
'Scrubby',
);
// Return on the first find.
foreach ($crawlers as $c) {
if (stripos($_SERVER['HTTP_USER_AGENT'], $c) !== FALSE) {
return FALSE;
}
}
// No need if we're on the cas login page.
list($arg0) = split('/', $_GET['q']);
// Don't even do the test if we're hitting the cas page
if ($arg0 == "cas") {
return FALSE;
}
// cron
if (stristr($_SERVER['SCRIPT_FILENAME'], 'xmlrpc.php')) {
return FALSE;
}
// XMLRPC
if (stristr($_SERVER['SCRIPT_FILENAME'], 'cron.php')) {
return FALSE;
}
// Drush
if (stristr($_SERVER['SCRIPT_FILENAME'], 'drush')) {
return FALSE;
}
// Drush
if (stristr($_SERVER['argv'][0], 'drush')) {
return FALSE;
}
$pages = variable_get('cas_exclude', CAS_EXCLUDE);
// Test against exclude pages.
if ($pages) {
$path = drupal_get_path_alias($_GET['q']);
$regexp = '/^(' . preg_replace(array(
'/(\\r\\n?|\\n)/',
'/\\\\\\*/',
'/(^|\\|)\\\\<front\\\\>($|\\|)/',
), array(
'|',
'.*',
'\\1' . variable_get('site_frontpage', 'node') . '\\2',
), preg_quote($pages, '/')) . ')$/';
$path_match = preg_match($regexp, $path);
// Alter the default
if ($path_match) {
return FALSE;
}
}
return $cas_check_first;
}