function spam_reported_comments_overview in Spam 5
Display the form that allows the user to manage comment spam
1 string reference to 'spam_reported_comments_overview'
- spam_menu in ./
spam.module - Implementation of hook_menu().
File
- ./
spam.module, line 2319
Code
function spam_reported_comments_overview() {
//drupal_set_html_head(spam_javascript());
$operations = array(
'IGNORE' => t('Ignore the selected comments'),
'SPAM' => t('Mark the selected comments as spam'),
'DELETE' => t('Delete the selected comments (no confirmation)'),
);
// build an 'Update options' form
$form['options'] = array(
'#type' => 'fieldset',
'#title' => t('Update options'),
'#prefix' => '<div class="container-inline">',
'#suffix' => '</div>',
);
$form['options']['operation'] = array(
'#type' => 'select',
'#options' => $operations,
'#description' => t(''),
);
$form['options']['submit'] = array(
'#type' => 'submit',
'#value' => t('Update'),
);
// create the select all button w/ select as a label
//$selectButton = spam_select_all('spam_reported_comments_overview');
$form['header'] = array(
'#type' => 'value',
'#value' => array(
$selectButton,
array(
'data' => t('times reported'),
'field' => 'count',
'sort' => 'desc',
),
array(
'data' => t('last reported'),
'field' => 's.timestamp',
),
array(
'data' => t('reported by'),
'field' => 'r.name',
),
array(
'data' => t('subject'),
'field' => 'subject',
),
array(
'data' => t('author'),
'field' => 'u.name',
),
array(
'data' => t('hostname'),
'field' => 'c.hostname',
),
array(
'data' => t('status'),
'field' => 'status',
),
array(
'data' => t('operations'),
'colspan' => 3,
),
),
);
$sql = "SELECT c.*, count(r.rid) as count, r.source, r.rid, r.id, r.uid as ruid, r.hostname, r.feedback, r.timestamp FROM {comments} c, {spam_reported} r WHERE r.source = 'comment' AND r.id = c.cid GROUP BY r.id";
$sql .= tablesort_sql($form['header']['#value']);
$result = pager_query($sql, variable_get('spam_display_quantity', 50));
// build a table listing the appropriate comments
while ($comment = db_fetch_object($result)) {
$comments[$comment->cid] = '';
$comment->name = $comment->uid ? $comment->registered_name : $comment->name;
$form['times_reported'][$comment->cid] = array(
'#value' => $comment->count,
);
$form['last_reported'][$comment->cid] = array(
'#value' => format_date($comment->timestamp, 'small'),
);
$form['reported_by'][$comment->cid] = array(
'#value' => theme('username', user_load(array(
'uid' => $comment->ruid,
))),
);
$form['subject'][$comment->cid] = array(
'#value' => l($comment->subject, "node/{$comment->nid}", array(
'title' => htmlspecialchars(substr($comment->comment, 0, 128)),
), NULL, "comment-{$comment->cid}") . ' ' . (node_last_viewed($comment->nid) < $comment->timestamp ? theme('mark') : ''),
);
$form['author'][$comment->cid] = array(
'#value' => theme('username', user_load(array(
'uid' => $comment->uid,
))),
);
$form['hostname'][$comment->cid] = array(
'#value' => $comment->hostname,
);
$form['status'][$comment->cid] = array(
'#value' => $comment->status == 0 ? t('published') : t('not published'),
);
$form['operations'][$comment->cid] = array(
'#value' => l(t('View log'), "admin/logs/spam/logs/comment/{$comment->cid}") . ' ' . l(t('Details'), "admin/content/spam/reported/comment/{$comment->cid}/details", array(
'title' => htmlspecialchars(substr($comment->feedback, 0, 128)),
)) . ' ' . l(t('Edit'), "comment/edit/{$comment->cid}"),
);
}
$form['comments'] = array(
'#type' => 'checkboxes',
'#options' => $comments,
);
$form['pager'] = array(
'#value' => theme('pager', NULL, variable_get('spam_display_quantity', 50), 0),
);
return $form;
}