function forward_page in Forward 7.2
Same name and namespace in other branches
- 5 forward.module \forward_page()
- 6 forward.module \forward_page()
- 7.3 forward.module \forward_page()
- 7 forward.module \forward_page()
Callback function for the forward Page
3 string references to 'forward_page'
- forward_form_submit in ./
forward.module - Submit callback function for forward form submit
- forward_mail in ./
forward.module - Implements hook_mail().
- forward_menu in ./
forward.module - Implements hook_menu().
File
- ./
forward.module, line 302
Code
function forward_page() {
// Tell SEO to ignore this page (but don't generate the meta tag for an overlay)
if (variable_get('forward_link_noindex', 1) && !isset($_GET['overlay'])) {
$element = array(
'#type' => 'html_tag',
'#tag' => 'meta',
'#attributes' => array(
'name' => 'robots',
'content' => 'noindex, nofollow',
),
);
drupal_add_html_head($element, 'forward_meta_noindex');
}
// Get node or path being forwarded
$nid = NULL;
if (empty($_GET['path']) || $_GET['path'] == 'node/0') {
return t('No path was selected to forward');
}
if (url_is_external($_GET['path'])) {
return t('You cannot forward an external URL.');
}
if (!empty($_GET['path'])) {
$form_state['values']['path'] = drupal_get_normal_path($_GET['path']);
$ret = preg_match("/^node\\/(.*)/i", $form_state['values']['path'], $matches);
if ($ret == 1) {
$nid = $matches[1];
}
}
if (is_numeric($nid)) {
// we have a node
$node = node_load($nid);
if (!node_access('view', $node)) {
// Access is denied
return MENU_ACCESS_DENIED;
}
$form_state['values']['path'] = 'node/' . $node->nid;
}
else {
$args = explode('/', $form_state['values']['path']);
if ($args[0] == 'admin') {
return MENU_ACCESS_DENIED;
}
$node = new stdClass();
$node->title = $form_state['values']['path'];
}
if ($form_state['values']['path'] == 'epostcard') {
$emailtype = 'postcard';
drupal_set_title(t(variable_get('forward_epostcard_title', 'Send an e-Postcard')));
}
else {
$emailtype = 'page';
if (!empty($_GET['cid'])) {
$cid = '?cid=' . $_GET['cid'];
$form_state['values']['path'] .= $cid;
}
drupal_set_title(t(variable_get('forward_email_title', 'Forward this page to a friend')));
}
return theme('forward_' . $emailtype, array(
'vars' => drupal_get_form('forward_form', $form_state['values']['path'], $node),
'node' => $node,
));
}