function spam_menu in Spam 5.3
Same name and namespace in other branches
- 5 spam.module \spam_menu()
- 6 spam.module \spam_menu()
Drupal _menu() hook.
File
- ./
spam.module, line 416
Code
function spam_menu($may_cache) {
$items = spam_invoke_api('menu', $may_cache);
if ($may_cache) {
$items[] = array(
'path' => 'admin/content/spam',
'title' => t('Spam'),
'callback' => 'spam_admin_list',
'access' => user_access('administer spam'),
'description' => t('Manage spam on your website.'),
);
$items[] = array(
'path' => 'admin/content/spam/list',
'title' => t('list'),
'type' => MENU_DEFAULT_LOCAL_TASK,
'callback' => 'spam_admin_list',
'access' => user_access('administer spam'),
);
$items[] = array(
'path' => 'admin/content/spam/feedback',
'title' => t('feedback'),
'type' => MENU_LOCAL_TASK,
'callback' => 'spam_admin_list_feedback',
'access' => user_access('administer spam'),
'weight' => 2,
);
$items[] = array(
'path' => 'admin/settings/spam',
'title' => t('Spam'),
'callback' => 'spam_admin_settings',
'access' => user_access('administer spam'),
'description' => t('Configure the spam module.'),
);
$items[] = array(
'path' => 'admin/settings/spam/general',
'title' => t('General'),
'type' => MENU_DEFAULT_LOCAL_TASK,
'access' => user_access('administer spam'),
'weight' => -4,
);
$items[] = array(
'path' => 'admin/settings/spam/filters',
'title' => t('Filters'),
'callback' => 'spam_admin_filter_overview',
'type' => MENU_LOCAL_TASK,
'access' => user_access('administer spam'),
'weight' => -2,
);
$items[] = array(
'path' => 'admin/settings/spam/filters/overview',
'title' => t('Overview'),
'weight' => -2,
'type' => MENU_DEFAULT_LOCAL_TASK,
'access' => user_access('administer spam'),
);
// TODO: Content groups.
/*
$items[] = array(
'path' => 'admin/settings/spam/groups',
'title' => t('Content groups'),
'weight' => 0,
'callback' => 'spam_admin_filter_groups',
'access' => user_access('administer spam'),
'type' => MENU_LOCAL_TASK,
);
*/
$items[] = array(
'path' => 'admin/logs/spam',
'title' => t('Spam logs'),
'access' => user_access('administer spam'),
'callback' => 'spam_logs_overview',
'description' => t('Detect and manage spam posts.'),
);
$items[] = array(
'path' => 'admin/logs/spam/logs',
'title' => t('Logs'),
'access' => user_access('administer spam'),
'callback' => 'spam_logs_overview',
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
);
$items[] = array(
'path' => 'admin/logs/spam/statistics',
'title' => t('Statistics'),
'access' => user_access('administer spam'),
'callback' => 'spam_logs_statistics',
'type' => MENU_LOCAL_TASK,
'weight' => -7,
);
$items[] = array(
'path' => 'spam/denied',
'callback' => 'spam_denied_page',
'type' => MENU_CALLBACK,
'access' => TRUE,
);
}
else {
if (arg(0) == 'spam') {
if (arg(1) == 'denied' && arg(2) == 'error') {
$hash1 = md5($_SESSION['content']);
$hash2 = _spam_sign($_SESSION['content']);
if (arg(3) == $hash1 && arg(4) == $hash2) {
$items[] = array(
'path' => "spam/denied/error/{$hash1}/{$hash2}",
'title' => t('Report legitimate content'),
'callback' => 'spam_denied_in_error_page',
'type' => MENU_CALLBACK,
'access' => TRUE,
);
}
}
if (is_numeric(arg(2)) && (arg(3) == 'spam' || arg(3) == 'notspam')) {
$type = arg(1);
if (spam_invoke_module($type, 'content_module') == $type) {
$id = arg(2);
$action = arg(3);
if ($action == 'spam') {
$callback = 'spam_mark_as_spam';
spam_update_statistics(t('@type manually marked as spam', array(
'@type' => $type,
)));
}
else {
spam_update_statistics(t('@type manually marked as not spam', array(
'@type' => $type,
)));
$callback = 'spam_mark_as_not_spam';
}
$items[] = array(
'path' => "spam/{$type}/{$id}/{$action}",
'callback' => $callback,
'callback arguments' => array(
$type,
$id,
array(
'redirect' => TRUE,
),
),
'type' => MENU_CALLBACK,
'access' => TRUE,
);
}
}
}
$sid = arg(3);
if (is_numeric($sid)) {
$items[] = array(
'path' => "admin/logs/spam/{$sid}/detail",
'access' => user_access('administer spam'),
'callback' => 'spam_logs_entry',
'callback arguments' => array(
$sid,
),
'type' => MENU_LOCAL_CALLBACK,
);
$items[] = array(
'path' => "admin/logs/spam/{$sid}/trace",
'access' => user_access('administer spam'),
'callback' => 'spam_logs_trace',
'callback arguments' => array(
$sid,
),
'type' => MENU_LOCAL_CALLBACK,
);
}
$bid = arg(4);
if (is_numeric($bid)) {
$items[] = array(
'path' => "admin/content/spam/feedback/{$bid}",
'title' => t('View feedback'),
'type' => MENU_CALLBACK,
'callback' => 'drupal_get_form',
'callback arguments' => array(
'spam_admin_feedback_form',
$bid,
),
'access' => user_access('administer spam'),
'weight' => 2,
);
}
}
return $items;
}