You are here

function spam_menu in Spam 5

Same name and namespace in other branches
  1. 5.3 spam.module \spam_menu()
  2. 6 spam.module \spam_menu()

Implementation of hook_menu().

File

./spam.module, line 652

Code

function spam_menu($may_cache) {
  $items = array();
  if ($may_cache) {
    $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('access spam'),
      'callback' => 'spam_logs_overview',
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'weight' => -10,
    );
    $items[] = array(
      'path' => 'admin/logs/spam/blockedips',
      'title' => t('Blocked IPs'),
      'access' => user_access('administer spam'),
      'callback' => 'spam_blocked_ips_overview',
      'type' => MENU_LOCAL_TASK,
    );
    $items[] = array(
      'path' => 'admin/content/spam/logs/entry',
      'access' => user_access('access spam'),
      'callback' => 'spam_logs_entry',
      'type' => MENU_LOCAL_CALLBACK,
    );
    $items[] = array(
      'path' => 'admin/content/comment/list/spam',
      'title' => t('Spam'),
      'access' => user_access('administer spam'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'spam_comment_overview',
      ),
      'type' => MENU_LOCAL_TASK,
    );

    // Main module administration page
    $items[] = array(
      'path' => 'admin/settings/spam',
      'title' => t('Spam'),
      'access' => user_access('administer spam'),
      'callback' => 'spam_admin_settings',
      'description' => t('Control settings for the spam module.'),
    );
    $items[] = array(
      'path' => 'admin/settings/spam/filter',
      'title' => t('Filters'),
      'access' => user_access('administer spam'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'spam_admin_settings_filter',
      ),
      'description' => t('Select content type filters for the spam module.'),
      'weight' => -5,
      'type' => MENU_LOCAL_TASK,
    );
    $items[] = array(
      'path' => 'admin/settings/spam/limits',
      'title' => t('Limits'),
      'access' => user_access('administer spam'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'spam_admin_settings_limits',
      ),
      'description' => t('Set filtering limits for the spam module.'),
      'weight' => -5,
      'type' => MENU_LOCAL_TASK,
    );
    $items[] = array(
      'path' => 'admin/settings/spam/actions',
      'title' => t('Actions'),
      'access' => user_access('administer spam'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'spam_admin_settings_actions',
      ),
      'description' => t('Select actions for the spam module.'),
      'weight' => -4,
      'type' => MENU_LOCAL_TASK,
    );
    $items[] = array(
      'path' => 'admin/settings/spam/advanced',
      'title' => t('Advanced'),
      'access' => user_access('administer spam'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'spam_admin_settings_advanced',
      ),
      'description' => t('Set advanced option for the spam module.'),
      'weight' => -4,
      'type' => MENU_LOCAL_TASK,
    );
    $items[] = array(
      'path' => 'admin/settings/spam/custom',
      'title' => t('Custom filters'),
      'access' => user_access('administer spam'),
      'callback' => 'spam_custom_filter_overview',
      'type' => MENU_LOCAL_TASK,
      'weight' => -3,
    );
    $items[] = array(
      'path' => 'admin/settings/spam/url',
      'title' => t('URL filters'),
      'access' => user_access('administer spam'),
      'callback' => 'spam_url_filter_overview',
      'type' => MENU_LOCAL_TASK,
      'weight' => -3,
    );

    // node admin submenu
    $items[] = array(
      'path' => 'admin/content/node/list/spam',
      'title' => t('Spam'),
      'access' => user_access('administer spam'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'spam_node_overview',
      ),
      'type' => MENU_LOCAL_TASK,
    );

    // spam page
    $items[] = array(
      'path' => 'spam',
      'title' => t('Spam'),
      'access' => user_access('administer spam'),
      'callback' => 'spam_page',
      'type' => MENU_CALLBACK,
    );

    // report spam page
    $items[] = array(
      'path' => 'spam/report',
      'title' => t('Spam'),
      'access' => user_access('report spam'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'spam_user_report',
      ),
      'type' => MENU_CALLBACK,
    );

    // reported comment spam admin submenu
    $items[] = array(
      'path' => 'admin/content/comment/list/reported',
      'title' => t('Reported spam'),
      'access' => user_access('administer spam'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'spam_reported_comments_overview',
      ),
      'type' => MENU_LOCAL_TASK,
      'weight' => 5,
    );

    // reported node spam admin submenu
    $items[] = array(
      'path' => 'admin/content/node/list/reported',
      'title' => t('Reported spam'),
      'access' => user_access('administer spam'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'spam_reported_nodes_overview',
      ),
      'type' => MENU_LOCAL_TASK,
      'weight' => 5,
    );
  }
  else {
    if (arg(6) == 'details') {
      $source = arg(4);
      $id = arg(5);

      // reported spam details page
      $items[] = array(
        'path' => "admin/content/spam/reported/{$source}/{$id}/details",
        'title' => t('Reported spam details'),
        'access' => user_access('administer spam'),
        'callback' => 'spam_reported_details',
        'type' => MENU_CALLBACK,
      );
    }
  }
  return $items;
}