--- D:/Profiles/nathan/Desktop/community_tags_CVS/community_tags.ajax.inc	Fri Jul 18 04:32:55 2008
+++ C:/Programs/WAMP/www/TRANSIT/sites/all/modules/community_tags/community_tags.ajax.inc	Sat Jul 19 15:06:46 2008
@@ -2,7 +2,7 @@
 // $Id: community_tags.ajax.inc,v 1.1 2008/07/18 03:32:55 herc Exp $
 
 /**
- * @file community_tags.ajax.inc
+ * @file
  *
  * Handles the server side Ajax interactions of Community Tags.
  *
--- D:/Profiles/nathan/Desktop/community_tags_CVS/community_tags.install	Fri Jul 18 04:32:55 2008
+++ C:/Programs/WAMP/www/TRANSIT/sites/all/modules/community_tags/community_tags.install	Sat Jul 19 15:07:02 2008
@@ -12,7 +12,7 @@
 function community_tags_install() {
   // Install schema
   drupal_install_schema('community_tags');
-  
+
   // Drop module weight so we act after taxonomy.
   $weight = (int)db_result(db_query("SELECT weight FROM {system} WHERE name = 'taxonomy'"));
   db_query("UPDATE {system} SET weight = %d WHERE name = 'community_tags'", $weight + 1);
--- D:/Profiles/nathan/Desktop/community_tags_CVS/community_tags.module	Fri Jul 18 04:32:55 2008
+++ C:/Programs/WAMP/www/TRANSIT/sites/all/modules/community_tags/community_tags.module	Sat Jul 19 15:39:38 2008
@@ -2,6 +2,11 @@
 // $Id: community_tags.module,v 1.37 2008/07/18 03:32:55 herc Exp $
 
 /**
+ * @file
+ * Implements community tagging of nodes using a specific vocabulary for Drupal v6.x
+ */
+
+/**
  * Display modes.
  */
 define('COMMUNITY_TAGS_MODE_BLOCK', 0);
@@ -11,8 +16,8 @@
 /**
  * Implementation of hook_help().
  */
-function community_tags_help($section) {
-  switch ($section) {
+function community_tags_help($path, $arg) {
+  switch ($path) {
     case 'admin/settings/community-tags':
       return t('To set up community tagging, you must first <a href="@taxonomy">create a normal free tagged vocabulary</a>. Then activate community tagging on such a vocabulary below, and set the <a href="@workflow">workflow options</a> for node types to control how users can tag nodes.', array('@taxonomy' => url('admin/content/taxonomy'), '@workflow' => url('admin/content/types')));
       break;
@@ -30,39 +35,41 @@
     ),
     'community_tags' => array(
       'arguments' => array('tags' => NULL),
-    ),    
+    ),
   );
 }
 
-/** 
+/**
  * Implementation of hook_update_index().
  */
 function community_tags_update_index() {
   // Last cron run
   $last = variable_get('node_cron_last', 0);
   $limit = (int)variable_get('search_cron_limit', 100);
- 
+
   $sql = "SELECT nid FROM {community_tags} WHERE date > %d";
+  $sqlcount = "SELECT COUNT(nid) FROM {community_tags} WHERE date > %d";
   $result = db_query_range($sql, $last, 0, $limit);
- 
-  if ($result && db_num_rows($result) > 0) {
+  $resultcount = db_query_range($sqlcount, $last, 0, $limit);
+
+  if ($result && db_result($resultcount) > 0) {
     while ($data = db_fetch_object($result)) {
       $node = node_load($data->nid);
       // Build the node body.
       $node = node_build_content($node, FALSE, FALSE);
       $node->body = drupal_render($node->content);
- 
+
       // Allow modules to modify the fully-built node.
       node_invoke_nodeapi($node, 'alter');
- 
+
       $text = '<h1>'. check_plain($node->title) .'</h1>'. $node->body;
- 
+
       // Fetch extra data normally not visible
       $extra = node_invoke_nodeapi($node, 'update index');
       foreach ($extra as $t) {
         $text .= $t;
       }
- 
+
       // Update index
       search_index($node->nid, 'node', $text);
     }
@@ -77,7 +84,7 @@
 
   $items['admin/settings/community-tags'] = array(
     'title' => 'Community tags',
-    'description' => t('Configure community tagging.'),
+    'description' => 'Configure community tagging.',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('community_tags_settings'),
     'access arguments' => array('administer site configuration'),
@@ -88,9 +95,9 @@
     'page callback' => 'community_tags_from_js',
     'access callback' => '_community_tags_menu_access',
     'type' => MENU_CALLBACK,
-    'file' => 'community_tags.ajax.inc',  
+    'file' => 'community_tags.ajax.inc',
   );
-  
+
   $items['community-tags/user'] = array(
     'page callback' => 'community_tags_by_user',
     'access callback' => '_community_tags_menu_access',
@@ -105,7 +112,6 @@
     'access arguments' => array(1),
     'type' => MENU_LOCAL_TASK,
     'weight' => 2,
-    'file' => 'community_tags.pages.inc',
   );
 
   return $items;
@@ -168,7 +174,7 @@
     case 'view':
       if (user_access('access content') && user_access('tag content')) {
         if (arg(0) == 'node' && is_numeric(arg(1)) && (arg(2) == '' || arg(2) == 'view')) {
-          $node = node_load(arg(1));
+          $node = menu_get_object();
           if ($node && variable_get('community_tags_display_'. $node->type, COMMUNITY_TAGS_MODE_TAB) == COMMUNITY_TAGS_MODE_BLOCK) {
             $block['subject'] = t('Tag this');
             $block['content'] = community_tags_node_view($node, TRUE);
@@ -255,7 +261,7 @@
       COMMUNITY_TAGS_MODE_INLINE => t('Inline'),
     );
     $form['workflow']['community_tags_display'] = array(
-      '#type' => 'radios', 	
+      '#type' => 'radios',
       '#title' => t('Community tagging form'),
       '#default_value' => variable_get('community_tags_display_'. $form['#node_type']->type, COMMUNITY_TAGS_MODE_TAB),
       '#options' => $modes,
@@ -285,14 +291,16 @@
   if (count($community_tagged) == 0) {
     return;
   }
-  $nid = $node->nid;
+  if (!is_numeric($node)) {
+    $node = $node->nid;
+  }
 
   // If we're adding tags from the node add/edit page, then we want to delete
   // any tags that aren't entered to allow admins to remove node tags.
   // If not, we at least want the existing counts to update them.
 
   $old_tags_by_uid = array();
-  $result = db_query('SELECT * FROM {community_tags} ttn WHERE nid = %d', $nid);
+  $result = db_query('SELECT * FROM {community_tags} ttn WHERE nid = %d', $node);
   while ($old_tag_node = db_fetch_object($result)) {
     $old_tags_by_uid[$old_tag_node->uid][$old_tag_node->tid] = $old_tag_node;
   }
@@ -335,9 +343,9 @@
         }
 
         // If there was an existing tag by this user, load that data.
-        $tag_node = new StdClass();
+        $tag_node = new stdClass();
         $tag_node->tid = $typed_term_tid;
-        $tag_node->nid = $nid;
+        $tag_node->nid = $node;
         $tag_node->uid = $uid;
         $tag_node->date = time();
         $tag_node->vid = $node->vid;
@@ -366,7 +374,7 @@
   // Get existing term-node associations to see if we need to re-insert a term-node
   // relation for each old tag we're putting back in since we're acting after
   // taxonomy.module has done its business.
-  $result = db_query('SELECT tid FROM {term_node} WHERE nid = %d', $nid);
+  $result = db_query('SELECT tid FROM {term_node} WHERE nid = %d', $node);
   $existing_term_nodes = array();
   $add_term_nodes = array();
   while ($term_node = db_fetch_object($result)) {
@@ -375,7 +383,7 @@
 
   // Re-insert tag-node-user associations and term-node if not existing.
   db_lock_table('{community_tags}');
-  db_query('DELETE FROM {community_tags} WHERE nid = %d', $nid);
+  db_query('DELETE FROM {community_tags} WHERE nid = %d', $node);
   foreach ($tag_nodes as $tag_node) {
     db_query('INSERT INTO {community_tags} (tid, nid, uid, date) VALUES (%d, %d, %d, %d)', $tag_node->tid, $tag_node->nid, $tag_node->uid, $tag_node->date);
 
@@ -396,7 +404,7 @@
   // Match real tags to community tags, if necessary (e.g. after quick tagging).
   if (!$is_owner) {
     $placeholders = implode(',', array_fill(0, count($community_tagged), '%d'));
-    $result = db_query('SELECT n.tid, n.nid FROM {term_node} n LEFT JOIN {community_tags} c ON n.tid = c.tid AND n.nid = c.nid INNER JOIN {term_data} d ON n.tid = d.tid WHERE n.nid = %d AND c.nid IS NULL AND d.vid IN ('. $placeholders .')', $nid, $community_tagged);
+    $result = db_query('SELECT n.tid, n.nid FROM {term_node} n LEFT JOIN {community_tags} c ON n.tid = c.tid AND n.nid = c.nid INNER JOIN {term_data} d ON n.tid = d.tid WHERE n.nid = %d AND c.nid IS NULL AND d.vid IN ('. $placeholders .')', $node, $community_tagged);
     while ($tag = db_fetch_object($result)) {
       db_query('DELETE FROM {term_node} WHERE nid = %d AND tid = %d', $tag->nid, $tag->tid);
     }
@@ -482,19 +490,19 @@
   $tags = community_tags_get_user_node_tags($user->uid, $node->nid);
   $names = array();
   $output = '';
-  
+
   module_load_include('inc', 'community_tags', 'community_tags.pages');
 
   if (!count($tags)) {
     // User has not yet added tags to this node yet. Show form.
-    $output .= drupal_get_form('community_tags_form', array('node'=> $node, 'cloud' => $cloud, 'nid' => $node->nid, 'vid' => $vid, 'tags' => NULL, 'inline' => $inline));
-  } 
+    $output .= drupal_get_form('community_tags_form', array('node' => $node, 'cloud' => $cloud, 'nid' => $node->nid, 'vid' => $vid, 'tags' => NULL, 'inline' => $inline));
+  }
   elseif (user_access('edit own tags')) {
     // User has already tagged this node, but can edit their tags. Show form
     // with the user's tags pre-populated.
     $names = community_tags_flatten($tags);
     $tags = taxonomy_implode_tags($tags);
-    $output .= drupal_get_form('community_tags_form', array('node'=> $node, 'cloud' => $cloud, 'nid' => $node->nid, 'vid' => $vid, 'tags' => $tags, 'inline' => $inline));
+    $output .= drupal_get_form('community_tags_form', array('node' => $node, 'cloud' => $cloud, 'nid' => $node->nid, 'vid' => $vid, 'tags' => $tags, 'inline' => $inline));
   }
   else {
     // Sorry, no more adding tags for you!
--- D:/Profiles/nathan/Desktop/community_tags_CVS/community_tags.pages.inc	Fri Jul 18 04:32:55 2008
+++ C:/Programs/WAMP/www/TRANSIT/sites/all/modules/community_tags/community_tags.pages.inc	Sat Jul 19 15:36:26 2008
@@ -2,7 +2,7 @@
 // $Id: community_tags.pages.inc,v 1.1 2008/07/18 03:32:55 herc Exp $
 
 /**
- * @file community_tags.pages.inc
+ * @file
  *
  * Page handlers of Community Tags.
  *
@@ -19,7 +19,7 @@
     '#title' => t('All tags'),
     '#value' => $edit['cloud'],
   );
-  
+
   $access = user_access('tag content');
 
   $form['tags'] = array(
@@ -35,7 +35,7 @@
   if ($edit['inline']) {
     $form['tags']['#size'] = 20;
   }
-  
+
   if (!$access) {
     $destination = drupal_get_destination();
     $form['login'] = array(
@@ -49,12 +49,12 @@
     '#value' => t('Save'),
     '#access' => $access,
   );
-  
+
   $form['node'] = array(
     '#type' => 'value',
     '#value' => $edit['node'],
   );
-  
+
   $form['nid'] = array(
     '#type' => 'value',
     '#value' => $edit['nid'],
@@ -82,10 +82,7 @@
  */
 function community_tags_form_submit($form, &$form_state) {
   global $user;
-  $form_values = $form_state['values']; 
-  community_tags_taxonomy_node_save($form_values['node'], array('tags' => array($form_values['vid'] => $form_values['tags'])), FALSE, $user->uid);
-
-  $form_state['redirect'] = 'node/'. $form_values['nid']; 
+  community_tags_taxonomy_node_save($form_state['values']['nid'], array('tags' => array($form_state['values']['vid'] => $form_state['values']['tags'])), FALSE, $user->uid);
 }
 
 /**
@@ -105,7 +102,7 @@
 }
 
 /**
- * Menu callback: 
+ * Menu callback:
  */
 function community_tags_mypage($uid = NULL) {
   $uid = isset($uid) ? $uid : $GLOBALS['uid'];
--- D:/Profiles/nathan/Desktop/community_tags_CVS/README.txt	Fri Jul 18 04:32:55 2008
+++ C:/Programs/WAMP/www/TRANSIT/sites/all/modules/community_tags/README.txt	Sat Jul 19 15:42:42 2008
@@ -57,3 +57,5 @@
 
 Steven Wittens of Bryght updated this module to 5.x, cleaned up the code some more
 and added more shiny features.
+
+Ported to 6.x by Nathan Burles and Dropcube
\ No newline at end of file
