function yandex_services_auth_admin_settings in Yandex Services Authorization API 6
Same name and namespace in other branches
- 7 yandex_services_auth.admin.inc \yandex_services_auth_admin_settings()
Menu callback; the application authorization form.
1 string reference to 'yandex_services_auth_admin_settings'
- yandex_services_auth_menu in ./
yandex_services_auth.module - Implements hook_menu().
File
- ./
yandex_services_auth.admin.inc, line 10 - Admin pages for the Yandex Services Authorization API module.
Code
function yandex_services_auth_admin_settings() {
$auth_token = variable_get('yandex_services_auth_token', '');
$auth_timestamp = variable_get('yandex_services_auth_timestamp', '');
switch (yandex_services_auth_status()) {
case 'not authorized':
$auth_status = '<span style="color:red;">' . t('The application is not authorized yet.') . '</span>';
break;
case 'authorized':
$auth_status = '<span style="color:green;">' . t('The application is already authorized.') . '</span>';
break;
case 'expiring':
$auth_status = '<span style="color:yellow;">' . t('The application authorization is expiring.') . '</span>';
break;
case 'expired':
$auth_status = '<span style="color:red;">' . t('The application authorization has expired.') . '</span>';
break;
}
$form['yandex_services_auth_text'] = array(
'#type' => 'item',
'#value' => $auth_status,
);
$form['yandex_services_auth_client_id'] = array(
'#type' => 'textfield',
'#title' => t('Client ID'),
'#description' => t('Your application client ID.'),
'#required' => TRUE,
'#default_value' => variable_get('yandex_services_auth_client_id', ''),
);
$form['yandex_services_auth_client_secret'] = array(
'#type' => 'textfield',
'#title' => t('Client Secret'),
'#description' => t('Your application secret.'),
'#default_value' => variable_get('yandex_services_auth_client_secret', ''),
);
$form['yandex_services_auth_timestamp'] = array(
'#type' => 'item',
'#title' => t('Expiration time'),
'#value' => $auth_timestamp ? format_date($auth_timestamp) : t('Not available'),
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => !empty($auth_token) ? t('Re-Authorize') : t('Authorize'),
);
return $form;
}