--- forward.module (saved version)
+++ (current document)
@@ -104,13 +104,13 @@
     '#title' => t('Show link on main page'),
     '#return_value' => 1,
     '#default_value' => variable_get('forward_show_on_main', FALSE),
-    '#description' => t('If checked, the link will appear on your home page'),
+    '#description' => t('If checked, the link will appear on your home page. If Form Type is block_link, this does not matter.'),
   );
   $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"),
+    '#options' => array("link" => "link", "form" => "form", "block_link" => "block_link"),
     '#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(
@@ -606,9 +606,13 @@
       if ($type == 'comment') {
         $forward_link_type = 'comment';
       }
-      else {$forward_link_type = $node->type;}
+      else {
+		$forward_link_type = $node->type;
+	  }
     }
-    else $forward_link_type = 'page';
+    else {
+	  $forward_link_type = 'page';
+	}
 
     // Work out if this is a node page.  We don't want to go adding
     // links anywhere but on the front page or on nodes.  Without 
@@ -693,47 +697,87 @@
   switch ($op) {
     case 'list':
       $blocks[0]['info'] = t('Most Emailed');
+	  $blocks[1]['info'] = t('Forward');
       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')
-      );
-      $output = drupal_get_form('forward_block_formbody', $block_options);
-      return $output;
+	  switch ($delta) {
+	    case '0':
+		  $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')
+	      );
+	      $output = drupal_get_form('forward_block_formbody', $block_options);
+	      return $output;
+	  }
     case 'save':
-      variable_set('forward_block_type', $edit['forward_block_type']);
-      break;
+	  switch ($delta) {
+		case '0':
+		  variable_set('forward_block_type', $edit['forward_block_type']);
+	      break;
+	  }
     case 'view':
-      if (user_access('access content')) {
-        switch (variable_get('forward_block_type','allTime')) {
-          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['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['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['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['content'] = node_title_list(db_query_range($query, 0, 5));
-            break;
-        }
-        return $block;
-      }
+	  switch ($delta) {
+		case '0':
+		  if (user_access('access content')) {
+	        switch (variable_get('forward_block_type','allTime')) {
+	          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['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['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['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['content'] = node_title_list(db_query_range($query, 0, 5));
+	            break;
+	        }
+	        return $block;
+	      }
+		  break;
+		case '1':
+		  if (user_access('access forward') && variable_get('forward_form_type', 'link') == "block_link" && !$node->in_preview) {
+			$forward_link_type = variable_get('forward_link_type', 0);
+			if ($forward_link_type) {
+			  if ($type == 'comment') {
+			    $forward_link_type = 'comment';
+			  }
+			  else {
+				$forward_link_type = $node->type;}
+			  }
+			  else {
+				$forward_link_type = 'page';
+			  }
+
+			  // Work out if this is a node page.  We don't want to go adding
+			  // links anywhere but on the front page or on nodes.  Without 
+			  // this logic, pages such as /event end up with an "email this page" link
+			  // that does not actually email that page.
+			  $path = drupal_get_normal_path($_GET['q']);
+			  list($node_url, $nid) = array_values(explode('/', $path));
+
+			  if ($node_url == 'node' && (!$main || variable_get('forward_show_on_main', 0)) && $nid != NULL) {
+			    $link = l(t('Email this !type', array('!type' => $forward_link_type)), 'forward/'.$nid, array('title' => t('Forward this page to a friend'), 'class' => 'forward-page'));
+			    $block['subject'] = t("Forward");
+			    $block['content'] = $link;
+			}
+			return $block;
+		  }
+		  break;
+	  }
   }
 }
 
