abuse_admin_moderate_content

Definition

abuse_admin_moderate_content(&$form_state, $type = NULL, $oid = NULL, $inline = FALSE)
abuse/abuse.admin.inc, line 466

Code

<?php
function abuse_admin_moderate_content(&$form_state, $type = NULL, $oid = NULL, $inline = FALSE) {
  $object = _abuse_load($type, $oid);
  if (!isset($object)) {
    return drupal_not_found();
  }

  global $user;
  static $run_once;
  $form = array();
  $form['#validate'][] = 'abuse_admin_moderate_content_validate';
  $form['#submit'][] = 'abuse_admin_moderate_content_submit';

  if (!$inline) {
    $form['target'] = array(
      '#type' => 'item',
      '#value' => "<!-- Empty Section -->",
      '#prefix' => '<div id="message-wrapper" class="message status">',
      '#suffix' => '</div>' ,
    );
    $run_once = TRUE;
  }

  $form['object_type'] = array(
    '#type' => 'hidden',
    '#value' => $object->type
  );
  $form['object_oid'] = array(
    '#type' => 'hidden',
    '#value' => $object->oid,
  );
  $form['object_uid'] = array(
    '#type' => 'hidden',
    '#value' => $object->uid,
  );

  if ($inline) {
    $form['redirect'] = array(
      '#type' => 'hidden',
      '#value' => $_GET['q'],
    );
  }

  $form['allow'] = array(
    '#type' => 'fieldset',
    '#title' => t('Allow content on site?'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#attributes' => array(
      'class' => 'abuse-report-allow'
    ),
  );
  $form['allow']['message'] = array(
    '#type' => 'item',
    '#value' => t('Are you sure you want to allow !content?', array('!content' => '<em>'. $object->title .'</em>')),
    '#attributes' => array(
      'class' => 'confirm'
    ),
  );
  $form['allow']['allow'] = array(
    '#type' => 'submit',
    '#value' => t('allow'),
    //'#ahah' => $temp,
  );

  $form['remove'] = array(
    '#type' => 'fieldset',
    '#title' => t('Remove content from site?'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#attributes' => array(
      'class' => 'abuse-report-remove'
    ),
  );
  $form['remove']['message'] = array(
    '#type' => 'item',
    '#value' => t('Are you sure you want to remove !content?', array('!content' => '<em>'. $object->title .'</em>')),
    '#attributes' => array(
      'class' => 'confirm'
    ),
  );
  $form['remove']['remove'] = array(
    '#type' => 'submit',
    '#value' => t('remove'),
  );

  if (variable_get('abuse_assigned_moderators', FALSE) && !user_access(ADMINISTER_ALL_ABUSE_REPORTS)) {
    $form['assign'] = array(
      '#type' => 'submit',
      '#value' => t('assign to superadmin'),
    );
  }

  $form['warn']['allow'] = array(
    '#type' => 'fieldset',
    '#title' => t('Warn and Allow'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#attributes' => array(
      'class' => 'abuse-report-warn-and-allow'
    ),
  );

  $form['warn']['remove'] = array(
    '#type' => 'fieldset',
    '#title' => t('Warn and Remove'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#attributes' => array(
      'class' => 'abuse-report-warn-and-remove'
    ),
  );
  $form['warn']['allow']['allow_subject'] = $form['warn']['remove']['remove_subject'] = array(
    '#type' => 'textfield',
    '#title' => t('Warning subject'),
    '#default_value' => variable_get('abuse_warn_subject', t('Abuse warning')),
    '#cols' => 72,
    '#rows' => 10,
    '#required' => TRUE,
  );
  $form['warn']['allow']['allow_body'] = $form['warn']['remove']['remove_body'] = array(
    '#type' => 'textarea',
    '#title' => t('Warning body'),
    '#default_value' => t(variable_get('abuse_warn_body', '')),
    '#size' => 72,
    '#required' => TRUE,
    '#description' => t('available fields are !title, !url, !name, and !id. You can copy from the list below.'),
  );
  $tmp_content = "<div class=\"clear-block\"><dl class=\"warning-templates\">\n";
  $reasons = _abuse_reasons();
  foreach ($reasons as $key => $reason) {
    $tmp_content .= "<!-- $reason->reason -->\n";
    $tmp_content .= "<dt class=\"warning-reason-title\"><a href='#'>". check_plain($reason->reason) ."</a></dt>\n";
    $tmp_content .= "<dd class=\"warning-reason-email\">". check_plain($reason->argumentation) ."</dd>\n";
  }
  $tmp_content .= '</dl></div>';

  $form['warn']['allow']['allow_preset_messages'] = $form['warn']['remove']['remove_preset_messages'] = array(
    '#type' => 'item',
    '#value' => $tmp_content,
  );
  $form['warn']['allow']['allow_warn'] = array(
    '#type' => 'submit',
    '#value' => t('warn and allow'),
  );

  $form['warn']['remove']['remove_warn'] = array(
    '#type' => 'submit',
    '#value' => t('warn and remove'),
  );

  if ($user->uid !== $object->uid && $object->uid > 1) {
    $form['ban'] = array(
      '#type' => 'fieldset',
      '#title' => t('Ban !user?', array('!user' => check_plain($object->name))),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
      '#attributes' => array(
        'class' => 'abuse-report-ban'
      ),
    );
    $form['ban']['confirmation_message'] = array(
      '#type' => 'item',
      '#value' => t('Are you sure you want to ban !name?', array('!name' => '<em>'. check_plain($object->name) .'</em>')),
      '#attributes' => array(
        'class' => 'confirm'
      ),
    );
    $form['ban']['ban'] = array(
      '#type' => 'submit',
      '#value' => t('ban')
    );
  }
  return $form;
}
?>