function aes_ajax_callback in AES encryption 7
Callback for user's password ajax link.
Takes different logic paths based on whether Javascript was enabled. If $type == 'ajax', it tells this function that ajax.js has rewritten the URL and thus we are doing an AJAX and can return an array of commands.
Parameters
int $uid: User's identifier.
string $type: Either 'ajax' or 'nojs'.
Return value
string|array If $type == 'ajax', returns an array of AJAX Commands. Otherwise, just returns the content, which will end up being a page.
1 string reference to 'aes_ajax_callback'
- aes_menu in ./
aes.module - Implements hook_menu().
File
- ./
aes.module, line 162 - Main file of the AES encryption module.
Code
function aes_ajax_callback($uid, $type = 'ajax') {
$output = aes_get_password($uid, TRUE);
if ($type != 'ajax') {
$user = user_load($uid, FALSE);
drupal_set_title($user->name . '\'s password');
return $output;
}
$commands = array();
$commands[] = ajax_command_replace('#aes_password', $output);
$page = array(
'#type' => 'ajax',
'#commands' => $commands,
);
ajax_deliver($page);
}