Index: forward.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/forward/forward.install,v retrieving revision 1.1.2.2 diff -u -F^f -r1.1.2.2 forward.install --- forward.install 11 Jul 2006 19:33:44 -0000 1.1.2.2 +++ forward.install 6 Oct 2006 15:47:22 -0000 @@ -22,7 +22,7 @@ function forward_install() { break; default: break; - } // End case + } if ($query) { drupal_set_message(t('Forward module installed tables successfully.')); @@ -31,3 +31,14 @@ function forward_install() { drupal_set_message(t('Table installation for the Forward module was unsuccessful. The tables may need to be installed by hand. See forward.install file for a list of the installation queries.'), 'error'); } } + +function forward_update_1() { + return _system_update_utf8(array('forward_log')); +} + +function forward_update_2() { + if ($show_on_main = variable_get('forward_show_on_main', FALSE)) { + variable_set('forward_show_on_teasers', $show_on_main); + variable_del('forward_show_on_main'); + } +} \ No newline at end of file Index: forward.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/forward/forward.module,v retrieving revision 1.11.2.22 diff -u -F^f -r1.11.2.22 forward.module --- forward.module 17 Sep 2006 19:47:47 -0000 1.11.2.22 +++ forward.module 6 Oct 2006 15:47:23 -0000 @@ -96,23 +96,23 @@ function forward_settings() { ); $form['forward_options']['forward_link_type'] = array( '#type' => 'checkbox', - '#title' => t('Use Node Type in Link'), + '#title' => t('Use node type in link'), '#return_value' => 1, '#default_value' => variable_get('forward_link_type', FALSE), - '#description' => t('If checked, the link will read "email this nodetype"; if not, it will just read "email this page"'), + '#description' => t('If checked, the link will read "e-mail this node type"; if not, it will just read "e-mail this page"'), ); - $form['forward_options']['forward_show_on_main'] = array( + $form['forward_options']['forward_show_on_teasers'] = array( '#type' => 'checkbox', - '#title' => t('Show link on main page'), + '#title' => t('Show link on teasers'), '#return_value' => 1, - '#default_value' => variable_get('forward_show_on_main', FALSE), - '#description' => t('If checked, the link will appear on your home page'), + '#default_value' => variable_get('forward_show_on_teasers', FALSE), + '#description' => t('If checked, the link will appear on teasers and full texts, otherwise it will appear only on full texts.'), ); $form['forward_options']['forward_form_type'] = array( '#type' => 'select', '#title' => t('Form Type'), - '#default_value' => variable_get('forward_form_type', "link"), - '#options' => array("link" => "link", "form" => "form"), + '#default_value' => variable_get('forward_form_type', 'link'), + '#options' => array('link' => t('Link'), 'form' => t('Form')), '#description' => t('Select link for a forward this page link or form to use a collapsible forwarding form.'), ); $form['forward_options']['forward_flood_control'] = array( @@ -125,7 +125,7 @@ function forward_settings() { $form['forward_options']['forward_flood_error'] = array( '#type' => 'textarea', '#title' => t('Flood Control Error'), - '#default_value' => variable_get('forward_flood_error', t('You can\'t send more than %number messages per hour. Please try again later.')), + '#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'), @@ -141,7 +141,7 @@ function forward_settings() { $form['forward_text_values']['forward_instructions'] = array( '#type' => 'textarea', '#title' => t('Forward Instructions'), - '#default_value' => variable_get('forward_instructions', '
'.t('Thank you for your interest in spreading the word on').' '.variable_get('site_name', 'drupal').'.
'.t('NOTE: We only request your email address so that the person you are recommending the page to knows that you wanted them to see it, and that it is not junk mail. We do not capture any email address.').'
'), + '#default_value' => variable_get('forward_instructions', ''. t('Thank you for your interest in spreading the word on %site_name.', array('%site_name' => variable_get('site_name', 'drupal'))) .'
'. t('NOTE: We only request your e-mail address so that the person you are recommending the page to knows that you wanted them to see it, and that it is not junk mail. We do not capture any e-mail address.').'
'), '#cols' => 40, '#rows' => 10, '#description' => t('This message will be displayed above the form.'), @@ -149,7 +149,7 @@ function forward_settings() { $form['forward_text_values']['forward_thankyou'] = array( '#type' => 'textarea', '#title' => t('Thank You Message'), - '#default_value' => variable_get('forward_thankyou', t('Thank you for your help in spreading the word about').' '.variable_get('site_name', 'drupal').'. '.t('We appreciate your help.')), + '#default_value' => variable_get('forward_thankyou', t('Thank you for your help in spreading the word about %site_name. We appreciate your help.', array('%site_name' => variable_get('site_name', 'drupal')))), '#cols' => 40, '#rows' => 10, '#description' => t('This message will be displayed after the user successfully submits the form.'), @@ -168,11 +168,11 @@ function forward_settings() { '#default_value' => variable_get('forward_sender_addy', "NoReply@".$host['host']), '#size' => 40, '#maxlength' => 40, - '#description' => t('The address to send from. Should be a functioning email address.'), + '#description' => t('The address to send from. Should be a functioning e-mail address.'), ); $form['forward_default_values']['forward_header_image'] = array( '#type' => 'textfield', - '#title' => t('Header Image for Email'), + '#title' => t('Header Image for e-mail'), '#default_value' => variable_get('forward_header_image',''), '#size' => 40, '#maxlength' => 256, @@ -181,51 +181,51 @@ function forward_settings() { ); $form['forward_default_values']['forward_emailsubject'] = array( '#type' => 'textfield', - '#title' => t('Forward Message Subject'), + '#title' => t('Forward Message subject'), '#default_value' => variable_get('forward_emailsubject', t('%name has forwarded a page 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("E-mail 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"), ); $form['forward_default_values']['forward_emailmessage'] = array( '#type' => 'textarea', - '#title' => t('Forward Message Body'), + '#title' => t('Forward Message body'), '#default_value' => variable_get('forward_emailmessage', 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.'), + '#description' => t("E-mail 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."), ); $form['forward_default_values']['forward_postcardsubject'] = array( '#type' => 'textfield', - '#title' => t('e-Postcard Message Subject'), + '#title' => t('e-Postcard Message subject'), '#default_value' => variable_get('forward_postcardsubject', t('%name has sent you an e-postcard from %site')), '#size' => 40, '#maxlength' => 256, - '#description' => t('Postcard 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("Postcard 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."), ); $form['forward_default_values']['forward_postcardmessage'] = array( '#type' => 'textarea', - '#title' => t('e-Postcard Message Body'), + '#title' => t('e-Postcard Message body'), '#default_value' => variable_get('forward_postcardmessage', t('%name has sent you an e-postcard from the %site web site. Please take a moment to visit our web site.')), '#cols' => 40, '#rows' => 10, - '#description' => t('Postcard 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.'), + '#description' => t("Postcard 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."), ); $form['forward_default_values']['forward_ad_footer'] = array( '#type' => 'textarea', - '#title' => t('Oranization Ad'), - '#default_value' => variable_get('forward_ad_footer', " "), + '#title' => t('Organization Ad'), + '#default_value' => variable_get('forward_ad_footer', ''), '#cols' => 40, '#rows' => 10, - '#description' => t('This message will be just above the footer message in the email.'), + '#description' => t('This message will be just above the footer message in the e-mail.'), ); $form['forward_default_values']['forward_footer'] = array( '#type' => 'textarea', '#title' => t('Footer Message'), - '#default_value' => variable_get('forward_footer', " "), + '#default_value' => variable_get('forward_footer', ''), '#cols' => 40, '#rows' => 4, - '#description' => t('This message will be postpended as a footer message to the email.'), + '#description' => t('This message will be postpended as a footer message to the e-mail.'), ); $dyn_options = array( 'node' => t('Latest Blog Articles'), @@ -239,7 +239,7 @@ function forward_settings() { '#title' => t('Dynamic Block'), '#default_value' => variable_get('forward_dynamic_block', 'none'), '#options' => $dyn_options, - '#description' => t('Choose the dynamic block to send with these emails'), + '#description' => t('Choose the dynamic block to send with these e-mails.'), '#required' => TRUE, '#attributes' => NULL, ); @@ -265,25 +265,25 @@ function forward_form() { } global $base_url, $user; - $host=parse_url($base_url); + $host = parse_url($base_url); if (arg(2) == 'email_ref'){ db_query("INSERT INTO {forward_log} (nid, type, timestamp) VALUES ('%d', '%s', %d)", $nid, "REF", time()); if (arg(1) == 'postcard'){ - drupal_goto(drupal_get_path_alias('')); + drupal_goto(); } else { - drupal_goto(drupal_get_path_alias('node/'.$nid)); + drupal_goto('node/'. $nid); } } if (!flood_is_allowed('forward', variable_get('forward_flood_control', 10))) { - $output = 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))); + $output = strtr(variable_get('forward_flood_error', t("You can't send more than %number messages per hour. Please try again later.")), array('%number' => variable_get('forward_flood_control', 10))); } else { - $form = array(); + $form = array(); $url = $base_url.'/node/'.$nid; - $output = variable_get('forward_instructions', ''.t('Thank you for your interest in spreading the word on').' '.variable_get('site_name', 'drupal').'.
'.t('NOTE: We only request your email address so that the person you are recommending the page to knows that you wanted them to see it, and that it is not junk mail. We do not capture any email address.').'
'); + $output = variable_get('forward_instructions', ''. t('Thank you for your interest in spreading the word on %site_name.', array('%site_name' => variable_get('site_name', 'drupal'))) .'
'. t('NOTE: We only request your e-mail address so that the person you are recommending the page to knows that you wanted them to see it, and that it is not junk mail. We do not capture any e-mail address.').'
'); if ($nid != '') { @@ -295,12 +295,12 @@ function forward_form() { $form['message'] = array( '#type' => 'fieldset', - '#title' => t('Message to Send'), + '#title' => t('Message to send'), '#description' => '', ); $form['message']['yemail'] = array( '#type' => 'textfield', - '#title' => t('Your Email'), + '#title' => t('Your e-mail address'), '#default_value' => $user->mail, '#size' => 50, '#maxlength' => 256, @@ -310,7 +310,7 @@ function forward_form() { ); $form['message']['yname'] = array( '#type' => 'textfield', - '#title' => t('Your Name'), + '#title' => t('Your name'), '#default_value' => $user->name, '#size' => 50, '#maxlength' => 256, @@ -320,7 +320,7 @@ function forward_form() { ); $form['message']['recipients'] = array( '#type' => 'textarea', - '#title' => t('Send To'), + '#title' => t('Send to'), '#default_value' => str_replace(', ', '\n', $recipients), '#cols' => 50, '#rows' => 5, @@ -331,25 +331,25 @@ function forward_form() { if ($emailtype == 'email') { $form['message'][] = array( '#type' => 'item', - '#title' => t('Page Being Sent'), - '#value' => $base_url.'/'.drupal_get_path_alias('node/'.$nid.''), + '#title' => t('Page being sent'), + '#value' => url('node/'. $nid, NULL, NULL, TRUE), ); } $form['message']['subject'] = array( '#type' => 'item', - '#title' => t('Message Subject'), - '#value' => t(variable_get('forward_'.$emailtype.'subject', '%name has sent you a message from %site'), array('%name' => t('(Your Name)'), '%site' => variable_get('site_name', 'drupal'))), + '#title' => t('Message subject'), + '#value' => strtr(variable_get('forward_'.$emailtype.'subject', t('%name has sent you a message from %site')), array('%name' => '('. t('Your name') .')', '%site' => variable_get('site_name', 'drupal'))), '#description' => '', ); $form['message']['body'] = array( '#type' => 'item', - '#title' => t('Message Body'), - '#value' => t(variable_get('forward_'.$emailtype.'message', '%name thought you would like to see the %site web site.'), array('%name' => t('(Your Name)'), '%site' => variable_get('site_name', 'drupal'))), + '#title' => t('Message body'), + '#value' => strtr(variable_get('forward_'.$emailtype.'message', t('%name thought you would like to see this page from the %site web site.')), array('%name' => '('. t('Your name') .')', '%site' => variable_get('site_name', 'drupal'))), '#description' => '', ); $form['message']['message'] = array( '#type' => 'textarea', - '#title' => t('Your Personal Message'), + '#title' => t('Your personal message'), '#default_value' => '', '#cols' => 50, '#rows' => 10, @@ -367,11 +367,11 @@ function forward_form() { ); $form['message'][] = array( '#type' => 'submit', - '#value' => t('Send Message'), + '#value' => t('Send e-mail'), ); $form['#method'] = 'post'; - $output = drupal_get_form('forward_form', $form); + $output .= drupal_get_form('forward_form', $form); } return $output; } @@ -393,7 +393,7 @@ function forward_nodeapi(&$node, $op, $a ); $form['message']['yemail'] = array( '#type' => 'textfield', - '#title' => t('Your Email'), + '#title' => t('Your e-mail address'), '#default_value' => $user->mail, '#size' => 45, '#maxlength' => 256, @@ -403,7 +403,7 @@ function forward_nodeapi(&$node, $op, $a ); $form['message']['yname'] = array( '#type' => 'textfield', - '#title' => t('Your Name'), + '#title' => t('Your name'), '#default_value' => $user->name, '#size' => 45, '#maxlength' => 256, @@ -413,7 +413,7 @@ function forward_nodeapi(&$node, $op, $a ); $form['message']['recipients'] = array( '#type' => 'textarea', - '#title' => t('Send To'), + '#title' => t('Send to'), '#default_value' => str_replace(', ', '\n', $recipients), '#cols' => 50, '#rows' => 5, @@ -423,19 +423,19 @@ function forward_nodeapi(&$node, $op, $a ); $form['message']['subject'] = array( '#type' => 'item', - '#title' => t('Message Subject'), - '#value' => t(variable_get('forward_'.$emailtype.'subject', '%name has sent you a message from %site'), array('%name' => t('(Your Name)'), '%site' => variable_get('site_name', 'drupal'))), + '#title' => t('Message subject'), + '#value' => strtr(variable_get('forward_'.$emailtype.'subject', t('%name has sent you a message from %site')), array('%name' => t('(Your name)'), '%site' => variable_get('site_name', 'drupal'))), '#description' => '', ); $form['message']['body'] = array( '#type' => 'item', - '#title' => t('Message Body'), - '#value' => t(variable_get('forward_'.$emailtype.'message', '%name thought you would like to see the %site web site.'), array('%name' => t('(Your Name)'), '%site' => variable_get('site_name', 'drupal'))), + '#title' => t('Message body'), + '#value' => strtr(variable_get('forward_'.$emailtype.'message', t('%name thought you would like to see this page from the %site web site.')), array('%name' => t('(Your name)'), '%site' => variable_get('site_name', 'drupal'))), '#description' => '', ); $form['message']['message'] = array( '#type' => 'textarea', - '#title' => t('Your Personal Message'), + '#title' => t('Your personal message'), '#default_value' => '', '#cols' => 50, '#rows' => 10, @@ -453,7 +453,7 @@ function forward_nodeapi(&$node, $op, $a ); $form['message'][] = array( '#type' => 'submit', - '#value' => t('Send Message'), + '#value' => t('Send e-mail'), ); $form['#method'] = 'post'; @@ -472,7 +472,7 @@ function forward_form_validate($form_id, ### To check values, simply access them w/ the same name with which they were declared if (!user_access('administer forward')) { if (!flood_is_allowed('forward', variable_get('forward_flood_control', 10))) { - form_set_error(NULL,variable_get('forward_flood_error', t('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(NULL,variable_get('forward_flood_error', t("You can't send more than %number messages per hour. Please try again later.", array('%number' => variable_get('forward_flood_control', 10))))); } } @@ -502,7 +502,7 @@ function forward_form_validate($form_id, form_set_error('yemail', t('Header injection attempt detected. Do not enter line feed characters into the from field!')); } if (user_validate_mail($form['yemail'])){ - form_set_error('yemail', t('Your Email address is invalid.')); + form_set_error('yemail', t('Your e-mail address is invalid.')); } if (!$form['yname']) { form_set_error('yname', t('You must enter your name.')); @@ -537,7 +537,7 @@ function forward_form_submit($form_id, $ $dynamic_content .= forward_top5_list($query, $base_url,'blog'); break; case 'user': - $dynamic_content = ''.variable_get('forward_total', 0).' '.t('emails sent to').' '.variable_get('forward_recipients', 0).' '.t('recipients').'
'; + $output = ''. t('%total e-mails sent to %recipients recipients.', array('%total' => variable_get('forward_total', 0), '%recipients' => variable_get('forward_recipients', 0))) .'
'; $output .= theme('table', $header, $rows); } else { - $output = ''.t('No one has used Forward yet.').'
'; + $output = ''.t('No one has used forward yet.').'
'; } - print theme("page", $output); - drupal_set_title(t('Forward Tracking')); + drupal_set_title(t('Forward tracking')); + return $output; } @@ -704,14 +708,14 @@ function forward_tracking() { function forward_block($op = 'list', $delta = 0, $edit = array()) { switch ($op) { case 'list': - $blocks[0]['info'] = t('Most Emailed'); + $blocks[0]['info'] = t('Most e-mailed'); return $blocks; case 'configure': $block_options = array ( - 'today' => t('Most Emailed Today'), - 'week' => t('Most Emailed This Week'), - 'allTime' => t('Most Emailed of All Time'), - 'recent' => t('Most Recently Emailed') + 'today' => t('Most e-mailed today'), + 'week' => t('Most e-mailed this week'), + 'allTime' => t('Most e-mailed of all time'), + 'recent' => t('Most recently e-mailed') ); $form['forward_block_type'] = array( '#type' => 'radios', @@ -733,23 +737,23 @@ function forward_block($op = 'list', $de case 'today': $pastday = time()-(24 * 60 * 60); $query='SELECT n.nid, n.title, count(*) FROM {forward_log} s LEFT JOIN {node} n ON s.nid = n.nid WHERE s.type="sent" AND timestamp > '.$pastday.' GROUP BY n.nid DESC'; - $block['subject'] = t("Today's Most Emailed"); + $block['subject'] = t("Today's most e-mailed"); $block['content'] = node_title_list(db_query_range($query, 0, 5)); break; case 'week': $pastweek = time()-(7 * 24 * 60 * 60); $query='SELECT n.nid, n.title, count(*) FROM {forward_log} s LEFT JOIN {node} n ON s.nid = n.nid WHERE s.type="sent" AND timestamp > '.$pastweek.' GROUP BY n.nid DESC'; - $block['subject'] = t("This Week's Most Emailed"); + $block['subject'] = t("This week's most e-mailed"); $block['content'] = node_title_list(db_query_range($query, 0, 5)); break; case 'allTime': $query='SELECT n.nid, n.title, count(*) FROM {forward_log} s LEFT JOIN {node} n ON s.nid = n.nid WHERE s.type="sent" GROUP BY n.nid DESC'; - $block['subject'] = t("Most Emailed"); + $block['subject'] = t('Most e-mailed'); $block['content'] = node_title_list(db_query_range($query, 0, 5)); break; case 'recent': $query="SELECT DISTINCT n.nid, n.title FROM {node} n LEFT JOIN {forward_log} s ON s.nid = n.nid WHERE s.timestamp <> '0' AND s.type='SENT' AND n.status = 1 ORDER BY s.timestamp DESC"; - $block['subject'] = t("Most Recently Emailed"); + $block['subject'] = t('Most recently e-mailed'); $block['content'] = node_title_list(db_query_range($query, 0, 5)); break; } @@ -763,12 +767,14 @@ function forward_top5_list($query, $base $items = '