Index: user.module =================================================================== RCS file: /cvs/drupal/drupal/modules/user.module,v retrieving revision 1.548 diff -u -r1.548 user.module --- user.module 6 Jan 2006 07:42:31 -0000 1.548 +++ user.module 6 Jan 2006 23:31:20 -0000 @@ -1363,60 +1363,57 @@ * Menu callback: check an access rule */ function user_admin_access_check() { - $op = isset($_POST['op']) ? $_POST['op'] : ''; - $edit = isset($_POST['edit']) ? $_POST['edit'] : ''; - - if (!empty($op)) { - if (!empty($edit['user']['test'])) { - if (drupal_is_denied('user', $edit['user']['test'])) { - drupal_set_message(t('The username %name is not allowed.', array('%name' => theme('placeholder', $edit['user']['test'])))); - } - else { - drupal_set_message(t('The username %name is allowed.', array('%name' => theme('placeholder', $edit['user']['test'])))); - } - } - if (!empty($edit['mail']['test'])) { - if (drupal_is_denied('mail', $edit['mail']['test'])) { - drupal_set_message(t('The e-mail address %mail is not allowed.', array('%mail' => theme('placeholder', $edit['mail']['test'])))); - } - else { - drupal_set_message(t('The e-mail address %mail is allowed.', array('%mail' => theme('placeholder', $edit['mail']['test'])))); - } - } - if (!empty($edit['host']['test'])) { - if (drupal_is_denied('host', $edit['host']['test'])) { - drupal_set_message(t('The hostname %host is not allowed.', array('%host' => theme('placeholder', $edit['host']['test'])))); - } - else { - drupal_set_message(t('The hostname %host is allowed.', array('%host' => theme('placeholder', $edit['host']['test'])))); - } - } - } - - $form['user'] = array('#type' => 'fieldset', '#title' => t('Username')); + $form['user'] = array('#type' => 'fieldset', '#title' => t('Username'), '#tree' => TRUE); $form['user']['test'] = array('#type' => 'textfield', '#title' => '', '#description' => t('Enter a username to check if it will be denied or allowed.'), '#size' => 30, '#maxlength' => 64); $form['user']['type'] = array('#type' => 'hidden', '#value' => 'user'); $form['user']['submit'] = array('#type' => 'submit', '#value' => t('Check username')); - $output .= drupal_get_form('check_user', $form); + $output .= drupal_get_form('check_user', $form, 'user_admin_access_check'); unset($form); // prevent endless loop? - $form['mail'] = array('#type' => 'fieldset', '#title' => t('E-mail')); + $form['mail'] = array('#type' => 'fieldset', '#title' => t('E-mail'), '#tree' => TRUE); $form['mail']['test'] = array('#type' => 'textfield', '#title' => '', '#description' => t('Enter an e-mail address to check if it will be denied or allowed.'), '#size' => 30, '#maxlength' => 64); $form['mail']['type'] = array('#type' => 'hidden', '#value' => 'mail'); $form['mail']['submit'] = array('#type' => 'submit', '#value' => t('Check e-mail')); - $output .= drupal_get_form('check_mail', $form); + $output .= drupal_get_form('check_mail', $form, 'user_admin_access_check'); unset($form); // prevent endless loop? - $form['host'] = array('#type' => 'fieldset', '#title' => t('Hostname')); + $form['host'] = array('#type' => 'fieldset', '#title' => t('Hostname'), '#tree' => TRUE); $form['host']['test'] = array('#type' => 'textfield', '#title' => '', '#description' => t('Enter a hostname or IP address to check if it will be denied or allowed.'), '#size' => 30, '#maxlength' => 64); $form['host']['type'] = array('#type' => 'hidden', '#value' => 'host'); $form['host']['submit'] = array('#type' => 'submit', '#value' => t('Check hostname')); - $output .= drupal_get_form('check_host', $form); + $output .= drupal_get_form('check_host', $form, 'user_admin_access_check'); unset($form); // prevent endless loop? return $output; } +function user_admin_access_check_submit($form_id, $edit) { + if (!empty($edit['user']['test'])) { + if (drupal_is_denied('user', $edit['user']['test'])) { + drupal_set_message(t('The username %name is not allowed.', array('%name' => theme('placeholder', $edit['user']['test'])))); + } + else { + drupal_set_message(t('The username %name is allowed.', array('%name' => theme('placeholder', $edit['user']['test'])))); + } + } + if (!empty($edit['mail']['test'])) { + if (drupal_is_denied('mail', $edit['mail']['test'])) { + drupal_set_message(t('The e-mail address %mail is not allowed.', array('%mail' => theme('placeholder', $edit['mail']['test'])))); + } + else { + drupal_set_message(t('The e-mail address %mail is allowed.', array('%mail' => theme('placeholder', $edit['mail']['test'])))); + } + } + if (!empty($edit['host']['test'])) { + if (drupal_is_denied('host', $edit['host']['test'])) { + drupal_set_message(t('The hostname %host is not allowed.', array('%host' => theme('placeholder', $edit['host']['test'])))); + } + else { + drupal_set_message(t('The hostname %host is allowed.', array('%host' => theme('placeholder', $edit['host']['test'])))); + } + } +} + /** * Menu callback: add an access rule */