--- sites/all/modules/forward/forward.module 2009-11-03 22:51:59.000000000 +0000 +++ sites/all/modules/forward/forward_fixed.module 2009-11-05 13:27:06.000000000 +0000 @@ -47,7 +47,7 @@ function forward_menu() { 'access arguments' => array('administer forward'), ); $items['admin/settings/forward'] = array( - 'description' => t('Configure settings for forward module.'), + 'description' => 'Configure settings for Forward module.', 'title' => 'Forward', 'page callback' => 'drupal_get_form', 'page arguments' => array('forward_admin_settings'), @@ -172,7 +172,7 @@ function forward_admin_settings() { '#default_value' => variable_get('forward_flood_error', t('You can\'t send more than !number messages per hour. Please try again later.')), '#cols' => 40, '#rows' => 10, - '#description' => t('This text appears if a user exceeds the flood control limit. The value of the flood control limit setting will appear in place of %number in the message presented to users'), + '#description' => t('This text appears if a user exceeds the flood control limit. The value of the flood control limit setting will appear in place of !number in the message presented to users'), ); $form['forward_options']['forward_message'] = array( '#type' => 'select', @@ -203,13 +203,13 @@ function forward_admin_settings() { '#maxlength' => 40, '#description' => t('If left blank, the from address entered in the form will be used as the from address for the email. Enter a valid email address here to override that. The sender\'s email will still appear in the body of the message.'), ); - + $types = node_get_types(); $options = array(); $defaults = array(); foreach ($types as $type => $info) { $options[$type] = $info->name; - if (variable_get('forward_display_'.$type, TRUE)) { + if (variable_get('forward_display_'. $type, TRUE)) { $defaults[] = $type; } } @@ -270,18 +270,18 @@ function forward_admin_settings() { '#maxlength' => 256, '#description' => t('Title to display above the Forward page form'), ); - $form['forward_page_defaults']['forward_page_subject'] = array( + $form['forward_page_defaults']['forward_email_subject'] = array( '#type' => 'textfield', '#title' => t('Forward Message Subject'), - '#default_value' => variable_get('forward_page_subject', t('!name has forwarded a page to you from !site')), + '#default_value' => variable_get('forward_email_subject', t('!name has forwarded !title to you from !site')), '#size' => 40, '#maxlength' => 256, - '#description' => t('Email subject line. The sender\'s name will appear in place of !name in the subject. The web site name will be inserted in place of !site.'), + '#description' => t('Email subject line. !name, !title and !site will be respectively replaced by the sender\'s name, the node title and the site name.'), ); - $form['forward_page_defaults']['forward_page_message'] = array( + $form['forward_page_defaults']['forward_email_message'] = array( '#type' => 'textarea', '#title' => t('Forward Message Body'), - '#default_value' => variable_get('forward_page_message', t('!name thought you would like to see this page from the !site web site.')), + '#default_value' => variable_get('forward_email_message', t('!name thought you would like to see this page from the !site web site.')), '#cols' => 40, '#rows' => 10, '#description' => t('Email message body. The sender\'s name will appear in place of !name in the message body. The web site name will be inserted in place of !site. The sender will be able to add their own message after this.'), @@ -374,10 +374,10 @@ function forward_admin_settings_submit($ $types = node_get_types(); foreach ($types as $type => $info) { if (!empty($form_state['values']['forward_display_types'][$type])) { - variable_set('forward_display_'.$type, TRUE); + variable_set('forward_display_'. $type, TRUE); } else { - variable_set('forward_display_'.$type, FALSE); + variable_set('forward_display_'. $type, FALSE); } } unset($form_state['values']['forward_display_types']); @@ -441,7 +441,7 @@ function forward_page() { $node = new stdClass(); $node->title = $form_state['values']['path']; } - + if ($form_state['values']['path'] == 'epostcard') { $emailtype = 'postcard'; drupal_set_title(variable_get('forward_epostcard_title', 'Send an e-Postcard')); @@ -449,12 +449,12 @@ function forward_page() { else { $emailtype = 'email'; if (!empty($_GET['cid'])) { - $cid = '?cid='.$_GET['cid']; + $cid = '?cid='. $_GET['cid']; } $form_state['values']['path'] .= $cid; drupal_set_title(variable_get('forward_page_title', 'Forward this page')); } - + return drupal_get_form('forward_form', $form_state['values']['path'], $node->title); } @@ -469,7 +469,7 @@ function forward_form(&$form_state, $pat if (preg_match("/\?cid=/i", $path) == 1) { $paths = explode('?cid=', $path); - $cid = array('fragment' => 'comment-'.$paths[1]); + $cid = array('fragment' => 'comment-'. $paths[1]); $path = $paths[0]; } @@ -545,7 +545,7 @@ function forward_form(&$form_state, $pat ); $form['message']['path_cid'] = array( '#type' => 'hidden', - '#value' => (!empty($cid['fragment'])) ? '#'.$cid['fragment'] : '', + '#value' => (!empty($cid['fragment'])) ? '#'. $cid['fragment'] : '', ); $form['message']['forward_footer'] = array( '#type' => 'hidden', @@ -634,7 +634,7 @@ function forward_form_validate($form, &$ // Check if it looks like we are going to exceed the flood limit. // It is important to ensure that the number of e-mails to be sent count against the threshold. if (!flood_is_allowed('forward', variable_get('forward_flood_control', 10) - count($recipient_addresses) + 1)) { - form_set_error('recipients', t(variable_get('forward_flood_error', 'You can\'t send more than %number messages per hour. Please try again later.'), array('%number' => variable_get('forward_flood_control', 10)))); + form_set_error('recipients', t(variable_get('forward_flood_error', 'You can\'t send more than !number messages per hour. Please try again later.'), array('!number' => variable_get('forward_flood_control', 10)))); } } if ((variable_get('forward_message', 1) == 2) && (empty($form_state['values']['message']))) { @@ -645,7 +645,7 @@ function forward_form_validate($form, &$ function forward_form_submit($form, &$form_state) { global $base_url, $user; $dynamic_content = ""; - + // Compose the body: // Note how the form values are accessed the same way they were accessed in the validate function @@ -741,18 +741,19 @@ function forward_form_submit($form, &$fo 'message' => $message, 'base_url' => $base_url, 'content' => $content, - 'path' => $returnurl.$form_state['values']['path_cid'], + 'path' => $returnurl . $form_state['values']['path_cid'], 'dynamic_content' => $dynamic_content, 'forward_ad_footer' => variable_get('forward_ad_footer', ''), 'forward_footer' => variable_get('forward_footer', ''), // New values for forward.tpl.php - 'site_url' => url('forward/emailref', array('absolute' => TRUE, 'query' => 'path='.$returnurl.$form_state['values']['path_cid'])), - 'logo' => '', - 'title' => ($emailtype == 'page') ? l($content->title, 'forward/emailref', array('absolute' => TRUE, 'query' => 'path='.$returnurl)) : FALSE, - 'submitted' => (theme_get_setting('toggle_node_info_'.$content->type)) ? t('by %author', array('%author' => $content->name)) : FALSE, - 'node' => ($emailtype == 'page') ? $content->teaser : FALSE, - 'link' => ($emailtype == 'page') ? l(t('Click here to read more on our site'), 'forward/emailref', array('absolute' => TRUE, 'query' => 'path='.$returnurl.$form_state['values']['path_cid'])) : FALSE, + 'site_url' => url('forward/emailref', array('absolute' => TRUE, 'query' => 'path='. $returnurl . $form_state['values']['path_cid'])), + 'logo' => '', + 'title' => ($emailtype == 'email') ? l($content->title, 'forward/emailref', array('absolute' => TRUE, 'query' => 'path='. $returnurl)) : FALSE, + 'submitted' => (theme_get_setting('toggle_node_info_'. $content->type)) ? t('by %author', array('%author' => $content->name)) : FALSE, + 'node' => ($emailtype == 'email') ? $content->teaser : FALSE, + 'link' => ($emailtype == 'email') ? l(t('Click here to read more on our site'), 'forward/emailref', array('absolute' => TRUE, 'query' => 'path='. $returnurl . $form_state['values']['path_cid'])) : FALSE, + 'raw_link' => ($emailtype == 'email') ? url($content->path, array('absolute' => TRUE)) : FALSE, ); if (variable_get('forward_theme_template', 0)) { @@ -764,9 +765,9 @@ function forward_form_submit($form, &$fo $params['body'] = theme('forward_'. $emailtype, $vars); } - $params['subject'] = t(variable_get('forward_'. $emailtype .'_subject', '!name has sent you a message from !site'), array('!name' => $form_state['values']['yname'], '!site' => variable_get('site_name', 'drupal'))); - - $params['from'] = trim($form_state['values']['yname'] .' <'. variable_get('forward_sender_address', variable_get('site_mail','')) .'>'); + $params['subject'] = t(variable_get('forward_'. $emailtype .'_subject', '!name has sent you !title from !site'), array('!name' => $form_state['values']['yname'], '!title' => $content->title, '!site' => variable_get('site_name', 'drupal'))); + + $params['from'] = trim($form_state['values']['yname'] .' <'. variable_get('forward_sender_address', variable_get('site_mail', '')) .'>'); $params['headers']['Reply-To'] = trim($form_state['values']['yname'] .' <'. $form_state['values']['yemail'] .'>'); $recipients = trim($form_state['values']['recipients']); @@ -813,7 +814,7 @@ function forward_form_submit($form, &$fo 'activity_type' => 'F', 'level' => '', 'flag' => '', - 'description' => substr(url($returnurl, array('absolute' => true)), 0, 100), + 'description' => substr(url($returnurl, array('absolute' => TRUE)), 0, 100), ); crmapi_activity_save($activity_params); } @@ -845,7 +846,7 @@ function template_preprocess_forward(&$v function forward_mail($key, &$message, $params) { $message['subject'] .= $params['subject']; $message['body'][] = $params['body']; - + $message['headers']['Reply-To'] = $params['headers']['Reply-To']; $message['headers']['MIME-Version'] = '1.0'; $message['headers']['Content-Type'] = 'text/html; charset=utf-8'; @@ -886,7 +887,7 @@ function forward_link($type, $node=0, $t ||('node' == $type && (!variable_get('forward_display_nodes', TRUE) && !$teaser))) { return; } - + if ((($type == 'node' && variable_get('forward_display_'. $node->type, '1')) || $type == 'comment') && user_access('access forward') && variable_get('forward_form_type', 'link') == 'link') { $links = array(); @@ -966,7 +967,7 @@ function forward_form_alter(&$form, $for '#description' => t('Displays the form/link to allow visitors to forward the page to a friend. Further configuration is available on the !settings.', array('!settings' => l(t('settings page'), 'admin/settings/forward' ))), ); } - else if ($form_id == 'comment_admin_settings') { + elseif ($form_id == 'comment_admin_settings') { $form['viewing_options']['forward_display_comments'] = array( '#type' => 'checkbox', '#title' => t('Show forwarding link/form'),