function spam_comment_overview in Spam 5
Display the form that allows the user to edit comment spam.
1 string reference to 'spam_comment_overview'
- spam_menu in ./
spam.module - Implementation of hook_menu().
File
- ./
spam.module, line 2626
Code
function spam_comment_overview() {
$form['options'] = array(
'#prefix' => '<div class="container-inline">',
'#suffix' => '</div>',
'#title' => t('Update options'),
'#type' => 'fieldset',
);
$form['options']['operation'] = array(
'#options' => array(
'NOT_SPAM' => t('Mark the selected comments as not spam'),
'UNPUBLISH' => t('Unpublish the selected comments'),
'PUBLISH' => t('Publish the selected comments'),
'DELETE' => t('Delete the selected comments (no confirmation)'),
),
'#type' => 'select',
);
$form['options']['submit'] = array(
'#type' => 'submit',
'#value' => t('Update'),
);
$form['header'] = array(
'#type' => 'value',
'#value' => array(
theme('table_select_header_cell'),
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('timestamp'),
'field' => 'c.timestamp',
'sort' => 'desc',
),
array(
'data' => t('operations'),
),
),
);
$sql = "SELECT c.*, s.id, s.probability FROM {spam_tracker} s, {comments} c WHERE s.source = 'comment' AND s.id = c.cid AND s.probability >= " . variable_get('spam_threshold', 80);
$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['subject'][$comment->cid] = array(
'#value' => l($comment->subject, 'node/' . $comment->nid, array(
'title' => truncate_utf8($comment->comment, 128),
), NULL, 'comment-' . $comment->cid),
);
$form['username'][$comment->cid] = array(
'#value' => theme('username', $comment),
);
$form['hostname'][$comment->cid] = array(
'#value' => $comment->hostname,
);
$form['status'][$comment->cid] = array(
'#value' => $comment->status == 0 ? t('published') : t('not published'),
);
$form['timestamp'][$comment->cid] = array(
'#value' => format_date($comment->timestamp, 'small'),
);
$form['operations'][$comment->cid] = array(
'#value' => l(t('edit'), "comment/edit/{$comment->cid}", array(), 'destination=admin/content/comment/') . ' ' . l(t('details'), "admin/logs/spam/logs/comment/{$comment->cid}"),
);
}
$form['comments'] = array(
'#type' => 'checkboxes',
'#options' => $comments,
);
$form['pager'] = array(
'#value' => theme('pager', NULL, 50, 0),
);
return $form;
}