You are here

function forward_page in Forward 5

Same name and namespace in other branches
  1. 6 forward.module \forward_page()
  2. 7.3 forward.module \forward_page()
  3. 7 forward.module \forward_page()
  4. 7.2 forward.module \forward_page()

Form

2 string references to 'forward_page'
forward_link in ./forward.module
Generate links for pages
forward_menu in ./forward.module
Menu Hooks

File

./forward.module, line 341

Code

function forward_page() {
  drupal_set_html_head('<meta name="robots" content="noindex, nofollow" />');
  $nid = NULL;
  if (empty($_GET['path']) || $_GET['path'] == 'node/0') {
    return t('No path was selected to forward');
  }
  if (!empty($_GET['path'])) {
    $path = drupal_get_normal_path($_GET['path']);
    $ret = preg_match("/^node\\/(.*)/i", $path, $matches);
    if ($ret == 1) {
      $nid = $matches[1];
    }
  }
  if (is_numeric($nid)) {

    // we have a node
    $node = node_load(array(
      'nid' => $nid,
    ));
    if (!node_access('view', $node)) {

      // Access is denied
      return drupal_access_denied();
    }
    $path = 'node/' . $node->nid;
  }
  else {
    $args = explode('/', $path);
    if ($args[0] == 'admin') {
      return drupal_access_denied();
    }
    $node = new stdClass();
    $node->title = $path;
  }

  //print "$path - $nid - $node->title"; exit;
  return drupal_get_form('forward_form', $path, $node->title);
}