--- forward/forward.module	2008-09-06 16:07:27.000000000 -0500
+++ sites/all/modules/forward/forward.module	2008-10-06 01:47:39.000000000 -0500
@@ -1,5 +1,12 @@
 <?php
-/* $Id: forward.module,v 1.55.2.10 2008/09/06 21:07:27 seanr Exp $ */
+// $Id: forward.module,v 1.55.2.10 2008/09/06 21:07:27 seanr Exp $
+
+/**
+ * @file
+ * Allows forwarding of nodes by email,
+ * and provides a record of how often each has been forwarded.
+ *
+ */
 
 include(drupal_get_path('module', 'forward') .'/forward.theme');
 
@@ -90,8 +97,8 @@ function forward_admin_settings() {
   $form['forward_options'] = array(
     '#type' => 'fieldset',
     '#title' => t('Administrative Options'),
-    '#collapsible' => true,
-    '#collapsed' => false
+    '#collapsible' => TRUE,
+    '#collapsed' => FALSE
   );
   $form['forward_options']['forward_link_style'] = array(
     '#type' => 'radios',
@@ -104,28 +111,28 @@ function forward_admin_settings() {
     '#type' => 'checkbox',
     '#title' => t('Use Node Type in Link'),
     '#return_value' => 1,
-    '#default_value' => variable_get('forward_link_type', false),
+    '#default_value' => variable_get('forward_link_type', FALSE),
     '#description' => t('If checked, the link will read &quot;email this <em>nodetype</em>&quot;; if not, it will just read &quot;email this page&quot;'),
   );
   $form['forward_options']['forward_display_teasers'] = array(
     '#type' => 'checkbox',
     '#title' => t('Show Forward on teasers'),
     '#return_value' => 1,
-    '#default_value' => variable_get('forward_display_teasers', false),
+    '#default_value' => variable_get('forward_display_teasers', FALSE),
     '#description' => t('If checked, the link/form will appear on teasers in lists of nodes'),
   );
   $form['forward_options']['forward_display_comments'] = array(
     '#type' => 'checkbox',
     '#title' => t('Show Forward on comments'),
     '#return_value' => 1,
-    '#default_value' => variable_get('forward_display_comments', false),
+    '#default_value' => variable_get('forward_display_comments', FALSE),
     '#description' => t('If checked, the link/form will appear on comments'),
   );
   $form['forward_options']['forward_display_nonnode'] = array(
     '#type' => 'checkbox',
     '#title' => t('Show Forward on non-node pages'),
     '#return_value' => 1,
-    '#default_value' => variable_get('forward_display_nonnode', false),
+    '#default_value' => variable_get('forward_display_nonnode', FALSE),
     '#description' => t('If checked, the link/form will appear on non-node pages like views and other module pages'),
   );
   $form['forward_options']['forward_form_type'] = array(
@@ -154,7 +161,7 @@ function forward_admin_settings() {
     '#type' => 'checkbox',
     '#title' => t('Allow HTML Messages'),
     '#return_value' => 1,
-    '#default_value' => variable_get('forward_filter_html', false),
+    '#default_value' => variable_get('forward_filter_html', FALSE),
     '#description' => t('If checked, will filter XSS and all tags not allowed below from the custom body field.  Otherwise, the body will converted to plain text with all HTML converted to character entities'),
   );
   $form['forward_options']['forward_filter_tags'] = array(
@@ -169,8 +176,8 @@ function forward_admin_settings() {
   $form['forward_text_values'] = array(
     '#type' => 'fieldset',
     '#title' => t('Page Text Values'),
-    '#collapsible' => true,
-    '#collapsed' => false
+    '#collapsible' => TRUE,
+    '#collapsed' => FALSE
   );
   $form['forward_text_values']['forward_instructions'] = array(
     '#type' => 'textarea',
@@ -193,8 +200,8 @@ function forward_admin_settings() {
   $form['forward_page_defaults'] = array(
     '#type' => 'fieldset',
     '#title' => t('Default Values for Email This Page'),
-    '#collapsible' => true,
-    '#collapsed' => false,
+    '#collapsible' => TRUE,
+    '#collapsed' => FALSE,
     '#description' => t('These options will set the default values for the "email this page" form.')
   );
   $form['forward_page_defaults']['forward_sender_addy'] = array(
@@ -212,7 +219,7 @@ function forward_admin_settings() {
     '#size' => 40,
     '#maxlength' => 256,
     '#description' => t('Enter the URL of the image to as a logo at the top of forwarded pages.'),
-    '#attributes' => false,
+    '#attributes' => FALSE,
   );
   $form['forward_page_defaults']['forward_page_title'] = array(
     '#type' => 'textfield',
@@ -243,8 +250,8 @@ function forward_admin_settings() {
   $form['forward_epostcard_defaults'] = array(
     '#type' => 'fieldset',
     '#title' => t('Default Values for e-Postcard'),
-    '#collapsible' => true,
-    '#collapsed' => false,
+    '#collapsible' => TRUE,
+    '#collapsed' => FALSE,
     '#description' => t('These options will set the default values for the "Send an e-Postcard" form.')
   );
   $form['forward_epostcard_defaults']['forward_epostcard_title'] = array(
@@ -300,8 +307,8 @@ function forward_admin_settings() {
     '#default_value' => variable_get('forward_dynamic_block', 'none'),
     '#options' => $dyn_options,
     '#description' => t('Choose the dynamic block to send with these emails'),
-    '#required' => true,
-    '#attributes' => null,
+    '#required' => TRUE,
+    '#attributes' => NULL,
   );
   return system_settings_form($form);
 }
@@ -312,18 +319,18 @@ function forward_admin_settings() {
 function forward_tracker() {
   $path = drupal_get_normal_path($_GET['path']);
   $args = explode('/', $path);
-  
+
   if (($args[0] == 'node') && (is_numeric($args[1]))) {
     $nid = $args[1];
     db_query("UPDATE {forward_statistics} SET clickthrough_count = clickthrough_count+1 WHERE nid = %d", $nid);
   }
-  
+
   if ($path == variable_get('site_frontpage', 'node')) {
     $path = '<front>';
   }
-  
+
   db_query("INSERT INTO {forward_log} (path, type, timestamp) VALUES ('%s', '%s', %d)", $path, 'REF', time());
-  
+
   drupal_goto(drupal_get_path_alias($path));
 }
 
@@ -334,7 +341,7 @@ function forward_tracker() {
 function forward_page() {
   //print '<pre>'.print_r(menu_get_menu(),1).'</pre>'; exit;
   $nid = NULL;
-  
+
   if (!empty($_GET['path'])) {
     $path = drupal_get_normal_path($_GET['path']);
     $ret = preg_match("/^node\/(.*)/i", $path, $matches);
@@ -349,8 +356,9 @@ function forward_page() {
       // Access is denied
       return drupal_access_denied();
     }
-    $path = 'node/'.$node->nid;
-  } else {
+    $path = 'node/'. $node->nid;
+  }
+  else {
     $args = explode('/', $path);
     if ($args[0] == 'admin') {
       return drupal_access_denied();
@@ -376,14 +384,14 @@ function forward_form(&$form_state, $pat
   else {
     $emailtype = 'email';
   }
-  
+
   if ($nodeapi == TRUE) {
     $form['message'] = array(
       '#type' => 'fieldset',
       '#title' => t('Forward this page to a friend'),
       '#description' => '',
-      '#collapsed' => true,
-      '#collapsible' => true,
+      '#collapsed' => TRUE,
+      '#collapsible' => TRUE,
     );
   }
   $form['message']['yemail'] = array(
@@ -391,14 +399,14 @@ function forward_form(&$form_state, $pat
     '#title' => t('Your Email'),
     '#size' => 58,
     '#maxlength' => 256,
-    '#required' => true,
+    '#required' => TRUE,
   );
   $form['message']['yname'] = array(
     '#type' => 'textfield',
     '#title' => t('Your Name'),
     '#size' => 58,
     '#maxlength' => 256,
-    '#required' => true,
+    '#required' => TRUE,
   );
   $form['message']['recipients'] = array(
     '#type' => 'textarea',
@@ -407,7 +415,7 @@ function forward_form(&$form_state, $pat
     '#cols' => 50,
     '#rows' => 5,
     '#description' => t('Enter multiple addresses on separate lines or separate them with commas.'),
-    '#required' => true,
+    '#required' => TRUE,
   );
   if (($emailtype == 'email') && ($nodeapi == FALSE)) {
     $form['message']['page'] = array(
@@ -435,7 +443,7 @@ function forward_form(&$form_state, $pat
     '#cols' => 50,
     '#rows' => 10,
     '#description' => '',
-    '#required' => true,
+    '#required' => TRUE,
   );
   $form['message']['path'] = array(
     '#type' => 'hidden',
@@ -449,10 +457,10 @@ function forward_form(&$form_state, $pat
     '#type' => 'submit',
     '#value' => t('Send Message'),
   );
-  
+
   if ($user->uid != 0) {
     $form['message']['yemail']['#default_value'] = $user->mail;
-    $form['message']['yemail']['#disabled'] = true;
+    $form['message']['yemail']['#disabled'] = TRUE;
     $form['message']['yemail']['#value'] = $user->mail;
     $form['message']['yname']['#default_value'] = $user->name;
   }
@@ -468,7 +476,7 @@ function forward_nodeapi(&$node, $op, $t
     switch ($op) {
       case 'view':
         if (user_access('access forward')) {
-          $output = drupal_get_form('forward_form', 'node/'.$node->nid, $node->title, TRUE);
+          $output = drupal_get_form('forward_form', 'node/'. $node->nid, $node->title, TRUE);
           $node->content['forward'] = array('#value' => $output, '#weight' => 10);
         }
         break;
@@ -490,7 +498,7 @@ function forward_form_validate($form, &$
   // 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)))));
     }
   }
 
@@ -510,13 +518,13 @@ function forward_form_validate($form, &$
   $recipient_addresses = explode(',', $recipients);
 
   $bad_items = array('Content-Type:', 'MIME-Version:', 'Content-Transfer-Encoding:', 'bcc:', 'cc:');
-  $bad_string = false;
+  $bad_string = FALSE;
   foreach ($bad_items as $item) {
     if (eregi($item, $yemail)) {
-      $bad_string = true;
+      $bad_string = TRUE;
     }
   }
-  if (strpos($yemail, "\r") !== false || strpos($yemail, "\n") !== false || $bad_string == true) {
+  if (strpos($yemail, "\r") !== FALSE || strpos($yemail, "\n") !== FALSE || $bad_string == TRUE) {
     form_set_error('yemail', t('Header injection attempt detected.  Do not enter line feed characters into the from field!'));
   }
   if (user_validate_mail($yemail)) {
@@ -557,7 +565,7 @@ function forward_form_submit($form, &$fo
       break;
     case 'user':
       $dynamic_content = '<h3>'. t("Who's new") .'</h3>';
-      $query = 'SELECT u.uid, u.name FROM {users} u WHERE status != 0 ORDER BY uid DESC';
+      $query = 'SELECT u.uid, u.name FROM {users} u WHERE status <> 0 ORDER BY uid DESC';
       $dynamic_content .= forward_top5_list($query, $base_url, 'user');
       break;
     case 'comment':
@@ -587,23 +595,24 @@ function forward_form_submit($form, &$fo
         // Access is denied
         return drupal_access_denied();
       }
-      $content->teaser = check_markup($content->teaser, $content->format, false);
-    } else {
+      $content->teaser = check_markup($content->teaser, $content->format, FALSE);
+    }
+    else {
       $_GET['q'] = $form_state['values']['path'];
       //_menu_append_contextual_items();
-    
+
       menu_set_active_item($form_state['values']['path']);
-      
+
       // Adapted from index.php.
       $content = new stdClass();
       $content->body = menu_execute_active_handler();
       $content->title = menu_get_active_title();
-    
+
       // It may happen that a drupal_not_found is called in the above call
       if (preg_match('/404 Not Found/', drupal_get_headers()) == 1) {
         return;
       }
-    
+
       switch ($content->body) {
         case MENU_NOT_FOUND:
           return drupal_not_found();
@@ -616,13 +625,13 @@ function forward_form_submit($form, &$fo
       $content->body = '';
     }
   }
-  
+
   $vars = array(
     'forward_header_image' => variable_get('forward_header_image', ''),
     'site_name' => variable_get('site_name', 'Drupal'),
     'yemail' => $form_state['values']['yemail'],
-    'forward_message' => t(variable_get('forward_'. $emailtype .'message', '!name thought you would like to see the !site web site.'), array('!name' => l($form_state['values']['yname'], 'mailto:'. $form_state['values']['yemail'], array('absolute' => true)), '!site' => variable_get('site_name', 'drupal'))),
-    'message' => variable_get('forward_filter_html', false) ? nl2br(filter_xss($form_state['values']['message']), implode(',', variable_get('forward_filter_tags', 'p,br,em,strong,cite,code,ul,ol,li,dl,dt,dd'))) : nl2br(check_plain($form_state['values']['message'])),
+    'forward_message' => t(variable_get('forward_'. $emailtype .'message', '!name thought you would like to see the !site web site.'), array('!name' => l($form_state['values']['yname'], 'mailto:'. $form_state['values']['yemail'], array('absolute' => TRUE)), '!site' => variable_get('site_name', 'drupal'))),
+    'message' => variable_get('forward_filter_html', FALSE) ? nl2br(filter_xss($form_state['values']['message']), implode(',', variable_get('forward_filter_tags', 'p,br,em,strong,cite,code,ul,ol,li,dl,dt,dd'))) : nl2br(check_plain($form_state['values']['message'])),
     'base_url' => $base_url,
     'content' => $content,
     'path' => $form_state['values']['path'],
@@ -641,7 +650,7 @@ function forward_form_submit($form, &$fo
   $recipients = str_replace(', ', ', ', $recipients);
   $recipients = str_replace(',  ', ', ', $recipients);
   $recipients = explode(', ', $recipients);
-  
+
   foreach ($recipients as $to) {
     drupal_mail('forward', 'forward_page', $to, language_default(), $params, $params['from']);
   }
@@ -652,7 +661,7 @@ function forward_form_submit($form, &$fo
   if (!empty($nid)) {
     db_query("UPDATE {forward_statistics} SET forward_count = forward_count+1, last_forward_timestamp = %d WHERE nid = %d", time(), $nid);
   }
-  
+
   variable_set('forward_total', variable_get('forward_total', 0) +1);
   variable_set('forward_recipients', variable_get('forward_recipients', 0) + count($recipients));
 
@@ -674,9 +683,9 @@ function forward_form_submit($form, &$fo
  * @param $params
  *   Array of parameters to indicate what text to include in the message body.
  *
- * @see drupal_mail();
- * @see _update_cron_notify();
- * @see _update_message_text();
+ * @see drupal_mail()
+ * @see _update_cron_notify()
+ * @see _update_message_text()
  */
 function forward_mail($key, &$message, $params) {
   $message['subject'] .= $params['subject'];
@@ -690,23 +699,23 @@ function forward_mail($key, &$message, $
  * Implementation of hook_help - adds link to non-node pages
  */
 function forward_help($path) {
-  if (user_access('access forward') && (preg_match("/^node\//i", $path) == 0) && (variable_get('forward_display_nonnode', false))) {
+  if (user_access('access forward') && (preg_match("/^node\//i", $path) == 0) && (variable_get('forward_display_nonnode', FALSE))) {
     drupal_add_css(drupal_get_path('module', 'forward') .'/forward.css');
     $title = t('Email this page');
     $img = drupal_get_path('module', 'forward') .'/forward.gif';
-    $html = false;
+    $html = FALSE;
     switch (variable_get('forward_link_style', 0)) {
       case 1:
         $title = theme('image', $img, $title, '', array('class' => 'forward-icon'));
-        $html = true;
+        $html = TRUE;
         break;
       case 2:
         $title = theme('image', $img, $title, '', array('class' => 'forward-icon forward-icon-margin')) . $title;
-        $html = true;
+        $html = TRUE;
         break;
     }
     $attributes = array('title' => t('Forward this page to a friend'), 'class' => 'forward-page');
-    $query = 'path='.$path;
+    $query = 'path='. $path;
     return '<span class="forward">'. l($title, 'forward', array('attributes' => $attributes, 'query' => $query, 'html' => $html)) .'</span>';
   }
 }
@@ -716,10 +725,10 @@ function forward_help($path) {
  * Generate links for pages
  */
 function forward_link($type, $node=0, $teaser=0) {
-  if ('comment' == $type && !variable_get('forward_display_comments', false)) {
+  if ('comment' == $type && !variable_get('forward_display_comments', FALSE)) {
     return;
   }
-  
+
   if (($type == 'node' || $type == 'comment') && user_access('access forward') && (variable_get('forward_form_type', 'link') == 'link') && variable_get('forward_display_'. $node->type, '1')) {
     $links=array();
     if (($type == 'system')) {
@@ -740,25 +749,25 @@ function forward_link($type, $node=0, $t
       drupal_add_css(drupal_get_path('module', 'forward') .'/forward.css');
       $title = t('Email this !type', array('!type' => $forward_link_type));
       $img = drupal_get_path('module', 'forward') .'/forward.gif';
-      $html = false;
+      $html = FALSE;
       switch (variable_get('forward_link_style', 0)) {
         case 1:
           $title = theme('image', $img, $title, '', array('class' => 'forward-icon'));
-          $html = true;
+          $html = TRUE;
           break;
         case 2:
           $title = theme('image', $img, $title, '', array('class' => 'forward-icon forward-icon-margin')) . $title;
-          $html = true;
+          $html = TRUE;
           break;
       }
-      $path = 'node/'.$node->nid;
-      $cid = ($type == 'comment') ? '&cid='.$node->cid : NULL;
+      $path = 'node/'. $node->nid;
+      $cid = ($type == 'comment') ? '&cid='. $node->cid : NULL;
       $links['forward_links'] = array(
         'title'      => $title,
         'href'       => 'forward',
         'html'       => $html,
         'attributes' => array('title' => t('Forward this page to a friend'), 'class' => 'forward-page'),
-        'query'      => 'path='.$path.$cid,
+        'query'      => 'path='. $path . $cid,
       );
       return $links;
     }
@@ -766,7 +775,7 @@ function forward_link($type, $node=0, $t
 }
 
 /**
- * Implementation of hook_theme()
+ * Implementation of hook_theme().
  */
 function forward_theme() {
   return array(
@@ -792,7 +801,7 @@ function forward_form_alter(&$form, $for
       '#type' => 'checkbox',
       '#title' => t('Show forwarding link/form'),
       '#return_value' => 1,
-      '#default_value' => variable_get('forward_display_comments', false),
+      '#default_value' => variable_get('forward_display_comments', FALSE),
       '#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' ))),
     );
   }
@@ -804,7 +813,7 @@ function forward_form_alter(&$form, $for
  */
 function forward_tracking() {
   $output = '<p><strong>'. variable_get('forward_total', 0) .'</strong> '. t('emails sent to') .' <strong>'. variable_get('forward_recipients', 0) .'</strong> '. t('recipients') .'</p>';
-  
+
   /**
    * Most Forwarded Nodes
    */
@@ -816,12 +825,12 @@ function forward_tracking() {
     array('data' => t('Forwards')),
     array('data' => t('Clickthroughs')),
   );
-  $result = db_query('SELECT n.title, f.* FROM {forward_statistics} f LEFT JOIN {node} n ON f.nid = n.nid ORDER BY f.forward_count DESC LIMIT 10');
+  $result = db_query_range('SELECT n.title, f.* FROM {forward_statistics} f LEFT JOIN {node} n ON f.nid = n.nid ORDER BY f.forward_count DESC', 0, 10);
   $num_rows = FALSE;
-  
+
   while ($log = db_fetch_object($result)) {
     $num_rows = TRUE;
-    $_path = drupal_get_path_alias('node/'.$log->nid);
+    $_path = drupal_get_path_alias('node/'. $log->nid);
     $title = ($log->nid) ? $log->title : 'Front Page';
     $rows[] = array(
       l(_forward_column_width($title), $_path),
@@ -830,15 +839,15 @@ function forward_tracking() {
       $log->clickthrough_count,
     );
   }
-  
+
   if ($num_rows) {
     $output .= theme('table', $header, $rows);
   }
   else {
     $output = '<p>'. t('No one has used Forward yet.') .'</p>';
   }
-  
-  
+
+
   /**
    * Most Clickthroughs
    */
@@ -850,12 +859,12 @@ function forward_tracking() {
     array('data' => t('Forwards')),
     array('data' => t('Clickthroughs')),
   );
-  $result = db_query('SELECT n.title, f.* FROM {forward_statistics} f LEFT JOIN {node} n ON f.nid = n.nid ORDER BY f.clickthrough_count DESC LIMIT 10');
+  $result = db_query_range('SELECT n.title, f.* FROM {forward_statistics} f LEFT JOIN {node} n ON f.nid = n.nid ORDER BY f.clickthrough_count DESC', 0, 10);
   $num_rows = FALSE;
-  
+
   while ($log = db_fetch_object($result)) {
     $num_rows = TRUE;
-    $_path = drupal_get_path_alias('node/'.$log->nid);
+    $_path = drupal_get_path_alias('node/'. $log->nid);
     $title = ($log->nid) ? $log->title : 'Front Page';
     $rows[] = array(
       l(_forward_column_width($title), $_path),
@@ -864,15 +873,15 @@ function forward_tracking() {
       $log->clickthrough_count,
     );
   }
-  
+
   if ($num_rows) {
     $output .= theme('table', $header, $rows);
   }
   else {
     $output = '<p>'. t('No one has used Forward yet.') .'</p>';
   }
-  
-  
+
+
   /**
    * Recently Forwarded Pages
    */
@@ -884,17 +893,17 @@ function forward_tracking() {
     array('data' => t('Path'))
   );
 
-  $result = pager_query('SELECT * FROM {forward_log}'. tablesort_sql($header), 30, 0, null);
+  $result = pager_query('SELECT * FROM {forward_log}'. tablesort_sql($header), 30, 0, NULL);
   $num_rows = FALSE;
-  
+
   while ($log = db_fetch_object($result)) {
     $num_rows = TRUE;
     $_path = drupal_get_path_alias($log->path);
-    
+
     //menu_set_active_item($_path);
     //$content = new stdClass();
     //$content->title = menu_get_active_title();
-    
+
     $rows[] = array(
       array('data' => format_date($log->timestamp, 'small'), 'nowrap' => 'nowrap'),
       $log->type,
@@ -904,7 +913,7 @@ function forward_tracking() {
   }
 
   if ($num_rows) {
-    if ($pager = theme('pager', null, 30, 0)) {
+    if ($pager = theme('pager', NULL, 30, 0)) {
       $rows[] = array(array('data' => $pager, 'colspan' => '3'));
     }
     $output .= theme('table', $header, $rows);
@@ -912,7 +921,7 @@ function forward_tracking() {
   else {
     $output = '<p>'. t('No one has used Forward yet.') .'</p>';
   }
-  
+
   print theme('page', $output);
   drupal_set_title(t('Forward Tracking'));
 }
@@ -933,10 +942,10 @@ function forward_block($op = 'list', $de
         'allTime' => t('Most Emailed of All Time'),
         'recent' => t('Most Recently Emailed')
       );
-      $output = drupal_get_form('forward_block_formbody', $block_options);
+      $output = forward_block_formbody($block_options);
       return $output;
     case 'save':
-      variable_set('forward_block_type', $form_state['values']['forward_block_type']);
+      variable_set('forward_block_type', $edit['forward_block_type']);
       break;
     case 'view':
       if (user_access('access content')) {
@@ -954,14 +963,14 @@ function forward_block($op = 'list', $de
             $block['content'] = node_title_list(db_query_range($query, 0, 5));
             break;
           case 'allTime':
-            $query="SELECT n.nid, n.title, f.* FROM {forward_statistics} f LEFT JOIN {node} n ON f.nid = n.nid ORDER BY f.clickthrough_count DESC LIMIT 5";
+            $query="SELECT n.nid, n.title, f.* FROM {forward_statistics} f LEFT JOIN {node} n ON f.nid = n.nid WHERE forward_count > 0 ORDER BY f.clickthrough_count DESC";
             $block['subject'] = t("Most Emailed");
-            $block['content'] = node_title_list(db_query($query));
+            $block['content'] = node_title_list(db_query_range($query, 0, 5));
             break;
           case 'recent':
-            $query="SELECT n.nid, n.title, f.* FROM {forward_statistics} f LEFT JOIN {node} n ON f.nid = n.nid ORDER BY f.last_forward_timestamp DESC LIMIT 5";
+            $query="SELECT n.nid, n.title, f.* FROM {forward_statistics} f LEFT JOIN {node} n ON f.nid = n.nid ORDER BY f.last_forward_timestamp DESC";
             $block['subject'] = t("Most Recently Emailed");
-            $block['content'] = node_title_list(db_query($query));
+            $block['content'] = node_title_list(db_query_range($query, 0, 5));
             break;
         }
         return $block;
@@ -973,11 +982,11 @@ function forward_block_formbody($block_o
   $form['forward_block_type'] = array(
     '#type' => 'radios',
     '#title' => t('Block Type'),
-    '#default_value' => variable_get('forward_block_type', " "),
+    '#default_value' => variable_get('forward_block_type', ""),
     '#options' => $block_options,
     '#description' => t('Choose the block type'),
-    '#required' => null,
-    '#attributes' => true,
+    '#required' => FALSE,
+    '#attributes' => array('class' => 'forward-block-type'),
   );
   return $form;
 }
@@ -1001,5 +1010,5 @@ function forward_top5_list($query, $base
 }
 
 function _forward_column_width($column, $width = 35) {
-  return (strlen($column) > $width ? substr($column, 0, $width) .'...' : $column);
+  return (drupal_strlen($column) > $width ? drupal_substr($column, 0, $width) .'...' : $column);
 }
\ No newline at end of file
