function yandex_services_auth_status in Yandex Services Authorization API 6
Same name and namespace in other branches
- 7 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) {
$request_time = time();
$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';
}
}