function yandex_services_auth_status in Yandex Services Authorization API 7
Same name and namespace in other branches
- 6 yandex_services_auth.module \yandex_services_auth_status()
Helper function to determine the authorization status.
2 calls to yandex_services_auth_status()
- yandex_services_auth_admin_settings in ./
yandex_services_auth.admin.inc - Menu callback; the application authorization form.
- yandex_services_auth_requirements in ./
yandex_services_auth.install - Implements hook_requirements().
File
- ./
yandex_services_auth.module, line 76 - Main file for the Yandex Services Authorization API module.
Code
function yandex_services_auth_status($period = 604800) {
$auth_token = variable_get('yandex_services_auth_token', '');
$auth_timestamp = variable_get('yandex_services_auth_timestamp', '');
if (empty($auth_token)) {
return 'not authorized';
}
if (empty($auth_timestamp)) {
return 'authorized';
}
if ($auth_timestamp - REQUEST_TIME < 0) {
return 'expired';
}
if ($auth_timestamp - REQUEST_TIME < $period) {
return 'expiring';
}
else {
return 'authorized';
}
}