function spam_admin_overview in Spam 6
Same name and namespace in other branches
- 5.3 spam.module \spam_admin_overview()
A filterable list of spam.
1 string reference to 'spam_admin_overview'
- spam_admin_list in ./
spam.module - Manage spam content.
File
- ./
spam.module, line 1327 - Spam module, v3 Copyright(c) 2006-2008 Jeremy Andrews <jeremy@tag1consulting.com>. All rights reserved.
Code
function spam_admin_overview() {
$filter = spam_build_filter_query();
$result = pager_query('SELECT t.* FROM {spam_tracker} t ' . $filter['join'] . ' ' . $filter['where'] . ' ORDER BY t.timestamp DESC', 50, 0, NULL, $filter['args']);
$form['options'] = array(
'#type' => 'fieldset',
'#title' => t('Update options'),
'#prefix' => '<div class="container-inline">',
'#suffix' => '</div>',
);
// Set labels for desired callbacks using spam_spam_operations().
$options = array(
'markasnotspam' => array(),
'publish' => array(),
'unpublish' => array(),
);
$operations = module_invoke_all('spam_operations');
foreach ($options as $option => $array) {
$options[$option] = $operations[$option]['label'];
}
$form['options']['operation'] = array(
'#type' => 'select',
'#options' => $options,
'#default_value' => 'approve',
);
$form['options']['submit'] = array(
'#type' => 'submit',
'#value' => t('Update'),
);
$destination = drupal_get_destination();
while ($spam = db_fetch_object($result)) {
$all["{$spam->content_type}-{$spam->content_id}"] = '';
$form['content_type']["{$spam->content_type}-{$spam->content_id}"] = array(
'#value' => $spam->content_type,
);
$title = spam_invoke_module($spam->content_type, 'title', $spam->content_id);
$link = spam_invoke_module($spam->content_type, 'edit_link', $spam->content_id);
if ($link) {
$form['title']["{$spam->content_type}-{$spam->content_id}"] = array(
'#value' => l($title, $link),
);
}
else {
$form['title']["{$spam->content_type}-{$spam->content_id}"] = array(
'#value' => check_plain($title),
);
}
$form['score']["{$spam->content_type}-{$spam->content_id}"] = array(
'#value' => $spam->score,
);
$status = spam_invoke_module($spam->content_type, 'status', $spam->content_id);
$form['status']["{$spam->content_type}-{$spam->content_id}"] = array(
'#value' => $status == SPAM_PUBLISHED ? t('published') : t('not published'),
);
$form['hostname']["{$spam->content_type}-{$spam->content_id}"] = array(
'#value' => $spam->hostname,
);
$feedback = db_result(db_query("SELECT bid FROM {spam_filters_errors} WHERE content_type = '%s' AND content_id = '%s'", $spam->content_type, $spam->content_id));
if ($feedback) {
$form['feedback']["{$spam->content_type}-{$spam->content_id}"] = array(
'#value' => l('view', "admin/content/spam/feedback/{$feedback}"),
);
}
else {
$form['feedback']["{$spam->content_type}-{$spam->content_id}"] = array(
'#value' => '<em>n/a</em>',
);
}
}
$form['spam'] = array(
'#type' => 'checkboxes',
'#options' => $all,
);
$form['pager'] = array(
'#value' => theme('pager', NULL, 50, 0),
);
return $form;
}