You are here

function anonymous_publishing_menu in Anonymous Publishing 5

Implementation of hook_menu().

File

./anonymous_publishing.module, line 171
Installation file for the anonymous_publishing module.

Code

function anonymous_publishing_menu($may_cache) {
  global $user;
  $items = array();
  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/settings/anonymous-publishing',
      'title' => t('Anonymous publishing'),
      'description' => t('Settings for Anonymous publishing feature'),
      'callback arguments' => array(
        'anonymous_publishing_admin_settings',
      ),
      'callback' => 'drupal_get_form',
      'access' => user_access('administer site configuration'),
    );
  }
  else {
    if (isset($_GET['akey']) && arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == 'activate') {
      $node = node_load(arg(1));
      if ($node && !empty($node->anonymous_publishing) && $node->anonymous_publishing['akey'] == $_GET['akey']) {
        $items[] = array(
          'path' => 'node/' . arg(1) . '/activate',
          'type' => MENU_CALLBACK,
          'callback' => 'anonymous_publishing_activate',
          'callback arguments' => array(
            $node,
            $akey,
          ),
          'access' => TRUE,
        );
      }
    }
  }
  return $items;
}