function _login_security_get_variables_by_name in Login Security 6
Same name and namespace in other branches
- 8 login_security.module \_login_security_get_variables_by_name()
- 5 login_security.module \_login_security_get_variables_by_name()
- 7 login_security.module \_login_security_get_variables_by_name()
- 2.x login_security.module \_login_security_get_variables_by_name()
Helper function to get the variable array for the messages.
3 calls to _login_security_get_variables_by_name()
- login_security_nagios in ./
login_security.module - Implement hook_nagios().
- login_security_soft_block_validate in ./
login_security.module - Temporarily deny validation to users with excess invalid login attempts.
- login_security_validate in ./
login_security.module - Implementation of form validate. This functions does more than just validating, but it's main Intention is to break the login form flow.
File
- ./
login_security.module, line 352 - Login Security
Code
function _login_security_get_variables_by_name($name) {
$account = user_load(array(
"name" => $name,
));
$ipaddress = ip_address();
global $base_url;
$variables = array(
'%date' => format_date(time()),
'%ip' => $ipaddress,
'%username' => $account->name,
'%email' => $account->mail,
'%uid' => $account->uid,
'%site' => variable_get('site_name', 'drupal'),
'%uri' => $base_url,
'%edit_uri' => url('user/' . $account->uid . '/edit', array(
'absolute' => TRUE,
)),
'%hard_block_attempts' => variable_get('login_security_host_wrong_count_hard', LOGIN_SECURITY_HOST_WRONG_COUNT_HARD),
'%soft_block_attempts' => variable_get('login_security_host_wrong_count', LOGIN_SECURITY_USER_WRONG_COUNT),
'%user_block_attempts' => variable_get('login_security_user_wrong_count', LOGIN_SECURITY_USER_WRONG_COUNT),
'%user_ip_current_count' => db_result(db_query("SELECT COUNT(id) FROM {login_security_track} WHERE name = '%s' AND host = '%s'", $name, $ipaddress)),
'%ip_current_count' => db_result(db_query("SELECT COUNT(id) FROM {login_security_track} WHERE host = '%s'", $ipaddress)),
'%user_current_count' => db_result(db_query("SELECT COUNT(id) FROM {login_security_track} WHERE name = '%s'", $name)),
'%tracking_time' => variable_get('login_security_track_time', LOGIN_SECURITY_TRACK_TIME),
'%tracking_current_count' => db_result(db_query("SELECT COUNT(id) FROM {login_security_track}")),
'%activity_threshold' => variable_get('login_security_activity_threshold', LOGIN_SECURITY_ACTIVITY_THRESHOLD),
);
return $variables;
}