_abuse_report_generated

Definition

_abuse_report_generated($type = NULL, $oid = NULL, $matches = array(), $hidden=1)
abuse/abuse.module, line 964

Code

<?php
function _abuse_report_generated($type = NULL, $oid = NULL, $matches = array(), $hidden=1) {
  if (!empty($type) && !empty($oid)) {
      //A administrative Computer User
    $admin = array('uid' => 0, 
                  'name' => 'AUTO_ADMIN', 
                  'mail' => variable_get('site_mail', 'AUTO_ADMIN@watchlist_generator.com'), 
                  'reason' => 5,
                  'body' => 'WATCHLIST: '. implode(', ', array_unique($matches))
                  );
    if (intval(variable_get('nodes_pre_moderated', 0)) == 1) {
      switch ($type) {
        case 'node':
          db_query("UPDATE {node} SET status = 0 WHERE nid = %d", $oid);
          break;
        case 'comment':
          db_query("UPDATE {comments} SET status = 1 WHERE cid = %d", $oid);
          break;
      }
    }
    
    if ($hidden == 1) {  //Set status of movie as hidden
      _abuse_set_status($type, $oid, ABUSE_HIDDEN);
    } 
    else {
      _abuse_set_status($type, $oid, ABUSE_PENDING);
      if (sizeof($matches) <= 0) {
        $admin['body'] = "AUTO MESSAGE: No questionable words were found in this $type";
      }
    }
    if (db_result(db_query("SELECT COUNT(*) FROM {abuse} WHERE type = '%s' AND oid = %d AND uid = %d", $type, $oid, $admin['uid'])) == 0) {
      $aid = db_next_id('{abuse}_aid');
      db_query("INSERT INTO {abuse} (aid, type, oid, created, body, reason, uid, name, mail) VALUES (%d, '%s', %d, %d, '%s', '%s', %d, '%s', '%s')",
        $aid, $type, $oid,  time(), $admin['body'], $admin['reason'], $admin['uid'], $admin['name'], $admin['mail']);
    } 
    else {
      db_query("UPDATE {abuse} SET body = '%s', created = %d WHERE type = '%s' AND oid = %d AND uid = %d AND name = '%s' AND mail = '%s'", 
        $admin['body'], time(), $type, $oid, $admin['uid'], $admin['name'], $admin['mail']);
    }
  }
}
?>