function antispam_confirm_multiple_operation in AntiSpam 7
Same name and namespace in other branches
- 6 antispam.admin.inc \antispam_confirm_multiple_operation()
1 string reference to 'antispam_confirm_multiple_operation'
- antispam_callback_queue in ./
antispam.admin.inc - Menu callback; Moderation queue.
File
- ./
antispam.admin.inc, line 897 - The antispam admin theme.
Code
function antispam_confirm_multiple_operation($form, &$form_state, $mode = '', $submode = '') {
$edit = $_POST;
$operation = $edit['operation'];
$valid_operations = antispam_moderator_operations($mode, $submode);
// Make sure we deal with a valid combination of mode, submode and operation.
if (!isset($valid_operations[$operation])) {
return;
}
$confirm_message = '<strong>' . $valid_operations[$operation]['confirm'] . '</strong>';
$confirm_button = $valid_operations[$operation]['button'];
$confirm_warning = '<p>' . (isset($valid_operations[$operation]['warning']) ? $valid_operations[$operation]['warning'] : '') . '</p>';
$content_type = $mode == 'nodes' ? 'node' : 'comment';
$form = array();
$form['items'] = array(
'#prefix' => '<ul>',
'#suffix' => '</ul>',
'#tree' => TRUE,
);
// array_filter() returns only elements with actual values
foreach (array_filter($edit['items']) as $content_id => $value) {
if ($content = antispam_content_load($content_type, $content_id)) {
$title = '"' . check_plain($content_type == 'node' ? $content->title : $content->subject) . '", ' . t('by') . ' ' . theme('username', array(
'account' => user_load($content->uid),
));
$form['items'][$content_id] = array(
'#type' => 'hidden',
'#value' => $content_id,
'#prefix' => '<li>',
'#suffix' => $title . '</li>',
);
}
}
$form['mode'] = array(
'#type' => 'hidden',
'#value' => $mode,
);
$form['submode'] = array(
'#type' => 'hidden',
'#value' => $submode,
);
$form['operation'] = array(
'#type' => 'hidden',
'#value' => $operation,
);
// Redirect to a non-existent menu item to make tabs disappear.
menu_set_active_item('');
$path = 'admin/content/antispam/' . $mode;
if ($submode != 'spam') {
$path .= '/' . $submode;
}
return confirm_form($form, $confirm_message, $path, $confirm_warning, $confirm_button, t('Cancel'));
}