You are here

function _seckit_ie_mime_js in Security Kit 6

Sends menu callback for AHAH, executes necessary functionality.

1 string reference to '_seckit_ie_mime_js'
seckit_menu in ./seckit.module
Implements hook_menu().

File

./seckit.module, line 247
Allows administrators to improve security of the website.

Code

function _seckit_ie_mime_js() {

  // prepare form
  include_once drupal_get_path('module', 'seckit') . '/includes/seckit.form.inc';
  $form_state = array(
    'storage' => NULL,
    'submitted' => FALSE,
  );
  $form_build_id = $_POST['form_build_id'];
  $form = form_get_cache($form_build_id, $form_state);
  $args = $form['#parameters'];
  $form_id = array_shift($args);
  $form['#post'] = $_POST;
  $form_state['post'] = $_POST;
  $form = drupal_rebuild_form($form_id, $form_state, $args, $form_build_id);
  $new_form = $form['seckit_xss']['ie_mime']['button'];
  unset($new_form['#prefix']);
  unset($new_form['#suffix']);

  // execute function
  _seckit_ie_mime();

  // change button text, considering current settings
  $result = _seckit_ie_mime_check();
  if ($result == SECKIT_IE_MIME_SECURE) {
    $new_form['#value'] = t('Allow uploading of .txt files');
  }
  else {
    $new_form['#value'] = t('Restrict uploading of .txt files');
  }

  // render new form
  $output = theme('status_messages') . drupal_render($new_form);
  drupal_json(array(
    'status' => TRUE,
    'data' => $output,
  ));
}