Index: flag_content.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/flag_content/flag_content.module,v
retrieving revision 1.1.2.5
diff -u -p -r1.1.2.5 flag_content.module
--- flag_content.module	19 Feb 2007 01:26:42 -0000	1.1.2.5
+++ flag_content.module	19 Feb 2007 03:25:32 -0000
@@ -7,6 +7,7 @@ define('FLAG_CONTENT_NODE_TYPE',   'flag
 define('FLAG_CONTENT_PERM_ADD',    'flag content');
 define('FLAG_CONTENT_PERM_MANAGE', 'manage flagged list');
 define('FLAG_CONTENT_EMAIL',       'flag_content_email');
+define('FLAG_CONTENT_ADD_REL',     'flag_content_add_rel');
 
 function flag_content_help($section) {
   switch ($section) {
@@ -70,6 +71,14 @@ function flag_content_settings() {
     '#title' => t('Advanced options'),
   );
 
+  $form[$set][FLAG_CONTENT_ADD_REL] = array(
+    '#type' => 'radios',
+    '#title' => t('Add "nofollow" hints to links'),
+    '#options' => array(t('Disabled'), t('Enabled')),
+    '#default_value' => variable_get('flag_content_add_rel', 1),
+    '#description' => t('This option allows you to add rel="nofollow" to the flag links to avoid them being followed by well behaved bots.'),
+  );
+
   $form[$set][FLAG_CONTENT_EMAIL] = array(
     '#type' => 'textfield',
     '#title' => t('Email address'),
@@ -91,14 +100,19 @@ function flag_content_link($type, $node 
     if (variable_get(FLAG_CONTENT_NODE_TYPE . $node->type, 0)) {
       if ($user->uid) {
         if (user_access(FLAG_CONTENT_PERM_ADD)) {
+          $options = array('class' => 'flag_content');
+          if (variable_get(FLAG_CONTENT_ADD_REL, 0)) {
+            $options['rel'] = 'nofollow';
+          }
+
           if (!_flag_content_check($node->nid)) {
             // Not already flagged, flag it for admin
-            $links[] = l(t('flag as offensive'), "flag_content/add/$node->nid", array('class' => 'flag_content'));
+            $links[] = l(t('flag as offensive'), "flag_content/add/$node->nid", $options);
           }
           else {
             // If has admin privileges, show an unflag link
             if (user_access(FLAG_CONTENT_PERM_MANAGE)) {
-              $links[] = l(t('unflag'), "flag_content/unflag/$node->nid", array('class' => 'flag_content'));
+              $links[] = l(t('unflag'), "flag_content/unflag/$node->nid", $options);
             }
             else {
               // Otherwise just show it as flagged
@@ -113,9 +127,22 @@ function flag_content_link($type, $node 
 }
 
 function flag_content_add($nid = 0) {
+  $node = node_load($nid);
+
+  $form['nid'] = array('#type' => 'hidden', '#value' => $nid);
+  return confirm_form('flag_content_add',
+    $form,
+    t('Are you sure you want to flag %type %title', array('%type' => $node->type, '%title' => theme('placeholder', $node->title))),
+    $_GET['destination'] ? $_GET['destination'] : 'node/'. $node->nid,
+    t(''),
+    t('Flag'), t('Cancel'));
+}
+
+function flag_content_add_submit($form_id, $form_values) {
+  $nid = $form_values['nid'];
   if ($nid) {
     // Insert the data into the table
-    db_query("INSERT INTO {flag_content} (nid, timestamp) VALUES (%d, %d)", $nid, time());
+    db_query('INSERT INTO {flag_content} (nid, timestamp) VALUES (%d, %d)', $nid, time());
     // Prepare the data
     $node = node_load($nid);
     // Email the admin
@@ -123,15 +150,28 @@ function flag_content_add($nid = 0) {
     // Give feedback to the user
     drupal_set_message(t('The item was flagged for the administrator'));
   }
-  drupal_goto("node/$nid");
+  return "node/$nid";
 }  
 
 function flag_content_unflag($nid = 0) {
+  $node = node_load($nid);
+
+  $form['nid'] = array('#type' => 'hidden', '#value' => $nid);
+  return confirm_form('flag_content_unflag',
+    $form,
+    t('Are you sure you want to unflag %type %title', array('%type' => $node->type, '%title' => theme('placeholder', $node->title))),
+    $_GET['destination'] ? $_GET['destination'] : 'node/'. $node->nid,
+    t(''),
+    t('Unflag'), t('Cancel'));
+}
+
+function flag_content_unflag_submit($form_id, $form_values) {
+  $nid = $form_values['nid'];
   if ($nid) {
     _flag_content_unflag($nid);
     drupal_set_message(t('The item was unflagged.'));
   }
-  drupal_goto('flag_content/view');
+  return 'flag_content/view';
 }
 
 function flag_content_view() {
