function services_admin_browse_test in Services 5
Same name and namespace in other branches
- 6 services_admin_browse.inc \services_admin_browse_test()
- 6.2 services_admin_browse.inc \services_admin_browse_test()
- 7 services_admin_browse.inc \services_admin_browse_test()
1 string reference to 'services_admin_browse_test'
File
- ./
services_admin_browse.inc, line 111 - The file contains code which is used to create the services testing interface
Code
function services_admin_browse_test() {
$form = array();
$method = services_method_get(arg(4));
$form['arg'] = array(
'#tree' => TRUE,
);
$timestamp = time();
$nonce = user_password();
$args_hash = array();
foreach ($method['#args'] as $key => $arg) {
$form['name'][$key] = array(
'#value' => $arg['#name'],
);
$form['optional'][$key] = array(
'#value' => $arg['#optional'] ? t('optional') : t('required'),
);
//$form['type'][$key] = array('#value' => $arg['#type']);
switch ($arg['#name']) {
case 'hash':
$form['arg'][$key] = array(
'#title' => 'Hash',
'#type' => 'textfield',
'#default_value' => hash_hmac('sha256', $timestamp . ';' . $_SERVER['HTTP_HOST'] . ';' . $nonce . ';' . arg(4), services_admin_browse_get_first_key()),
);
break;
case 'sessid':
$form['arg'][$key] = array(
'#title' => 'Session id',
'#type' => 'textfield',
'#default_value' => session_id(),
);
break;
case 'domain_name':
$form['arg'][$key] = array(
'#title' => 'Domain name',
'#type' => 'textfield',
'#default_value' => $_SERVER['HTTP_HOST'],
);
break;
case 'domain_time_stamp':
$form['arg'][$key] = array(
'#title' => 'Timestamp',
'#type' => 'textfield',
'#default_value' => $timestamp,
);
break;
case 'nonce':
$form['arg'][$key] = array(
'#title' => 'Nonce',
'#type' => 'textfield',
'#default_value' => $nonce,
);
break;
default:
$form['arg'][$key] = array(
'#type' => 'textfield',
);
break;
}
}
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Call method'),
);
$form['#redirect'] = FALSE;
return $form;
}