Definition

abuse_report($type = NULL, $oid = NULL, $status = NULL)
abuse/abuse.module, line 489

Description

Generate the page to flag an object

Parameters

$type the type of object

$oid id of object

$status the new status of the object (either null or 'reported')

Return value

form if reporting; reported message page if object status changed; not found page if type or object are invalid.

Code

<?php
function abuse_report($type = NULL, $oid = NULL, $status = NULL) {
  global $user;
  if (empty($type) || empty($oid) || (!user_access('report abuse') && !user_access('direct flag'))) {
    return drupal_not_found();
  }
  $object = _abuse_load($type, $oid);
  if (!$object) {
    return drupal_not_found();
  } 
  elseif ($object->uid == $user->uid && $user->uid != 0) {
    drupal_set_message(t("You cannot flag your own content"));
    drupal_goto($object->path['URL'], $object->path['QUERY'], $object->path['BREADCRUMB']);
  }

  if ($status == 'reported') {
    return t('Thank you for your report.  The item in question with be looked at by our moderators shortly.');
  }
  return drupal_get_form('abuse_report_form', $object, $user);
}
?>