Index: README.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/favorite_nodes/README.txt,v
retrieving revision 1.3
diff -u -p -r1.3 README.txt
--- README.txt	1 Jul 2006 22:50:01 -0000	1.3
+++ README.txt	18 Jan 2007 21:41:54 -0000
@@ -1,4 +1,4 @@
-$Id: README.txt,v 1.3 2006/07/01 22:50:01 kbahey Exp $
+$Id: README.txt,v 1.2.2.1 2006/07/01 22:51:02 kbahey Exp $
 
 Copyright 2006 http://2bits.com
 
@@ -18,11 +18,11 @@ Configuration
 -------------
 To enable this module do the following:
 
-1. Go to Administer -> Modules, and enable favorite_nodes.
+1. Go to Administer -> Site building -> Modules, and enable favorite_nodes.
 
-2. Go to Administer -> Access Control and enable for the roles you want.
+2. Go to Administer -> User management -> Access control and enable for the roles you want.
 
-3. Go to Administer -> Settings -> favorite_nodes and configure the 
+3. Go to Administer -> Site configuration -> Favorite nodes and configure the 
    node types that are allowed to be added to favorites.
 
 Bugs/Features/Patches:
Index: favorite_nodes.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/favorite_nodes/favorite_nodes.install,v
retrieving revision 1.2
diff -u -p -r1.2 favorite_nodes.install
--- favorite_nodes.install	1 Jul 2006 22:50:01 -0000	1.2
+++ favorite_nodes.install	18 Jan 2007 21:41:54 -0000
@@ -1,5 +1,9 @@
 <?php
+// $Id: 
 
+/**
+ * Implementation of hook_install().
+ */
 function favorite_nodes_install() {
   switch ($GLOBALS['db_type']) {
     case 'mysql':
@@ -16,10 +20,19 @@ function favorite_nodes_install() {
       // TODO: need this
       break;
   }
-  
+
   if ($result) {
-    drupal_set_message(t("favourite_nodes module database tables created successfully."));  
+    drupal_set_message(t('favourite_nodes module database tables created successfully.'));
   } else {
-    drupal_set_message(t("favourite_nodes module database table creation failure. Please view the favourite_nodes module folder and read the README.txt"), 'error');    
+    drupal_set_message(t('favourite_nodes module database table creation failure. Please view the favourite_nodes module folder and read the README.txt'), 'error');
   }
 }
+
+/**
+ * Implementation of hook_uninstall().
+ */
+function favorite_nodes_uninstall() {
+  db_query('DROP TABLE {favorite_nodes}');
+  // TODO: need to handle this.
+  //db_query("DELETE FROM {variable} WHERE name LIKE '%favorite_nodes%'");
+}
Index: favorite_nodes.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/favorite_nodes/favorite_nodes.module,v
retrieving revision 1.4
diff -u -p -r1.4 favorite_nodes.module
--- favorite_nodes.module	9 Dec 2006 17:44:59 -0000	1.4
+++ favorite_nodes.module	18 Jan 2007 21:41:55 -0000
@@ -1,57 +1,135 @@
 <?php
 // $Id: favorite_nodes.module,v 1.4 2006/12/09 17:44:59 kbahey Exp $
-define('FAVORITE_NODES_NODE_TYPE',           'favorite_nodes_node_type_');
-define('FAVORITE_NODES_PERM_ADD',            'create favorite nodes');
-define('FAVORITE_NODES_PERM_VIEW',           'view favorite nodes');
-define('FAVORITE_NODES_BLOCK',               'favorite_nodes_block_type_');
-define('FAVORITE_NODES_BLOCK_LIMIT',        'favorite_nodes_block_limit');
-define('FAVORITE_NODES_BLOCK_TITLE',        'favorite_nodes_block_title');
-define('FAVORITE_NODES_PAGE_LIMIT',         'favorite_nodes_page_limit');
-define('FAVORITE_NODES_PROFILE_LIMIT',      'favorite_nodes_profile_limit');
-define('FAVORITE_NODES_PAGE_TYPE',          'favorite_nodes_page_type');
-
+define('FAVORITE_NODES_NODE_TYPE', 'favorite_nodes_node_type_');
+define('FAVORITE_NODES_PERM_ADD', 'create favorite nodes');
+define('FAVORITE_NODES_PERM_VIEW', 'view favorite nodes');
+define('FAVORITE_NODES_PERM_ADMINISTER', 'administer favorite nodes');
+define('FAVORITE_NODES_BLOCK', 'favorite_nodes_block_type_');
+define('FAVORITE_NODES_BLOCK_LIMIT', 'favorite_nodes_block_limit');
+define('FAVORITE_NODES_BLOCK_TITLE', 'favorite_nodes_block_title');
+define('FAVORITE_NODES_PAGE_LIMIT', 'favorite_nodes_page_limit');
+define('FAVORITE_NODES_PROFILE_LIMIT', 'favorite_nodes_profile_limit');
+define('FAVORITE_NODES_PAGE_TYPE', 'favorite_nodes_page_type');
+
+/**
+ * Implementation of hook_help().
+ */
 function favorite_nodes_help($section) {
   switch ($section) {
     case 'admin/help#favorite_nodes':
     case 'admin/modules#description':
-      return t('The favorite_nodes module is used to add nodes to a list per user.');
+      return t('Allows users to manage a favorite list of nodes.');
   }
 }
 
 function favorite_nodes_perm() {
-  return array(FAVORITE_NODES_PERM_ADD, FAVORITE_NODES_PERM_VIEW);
+  return array(FAVORITE_NODES_PERM_ADD, FAVORITE_NODES_PERM_VIEW, FAVORITE_NODES_PERM_ADMINISTER);
 }
 
+/**
+ * Implementation of hook_menu().
+ */
 function favorite_nodes_menu($may_cache) {
   $items = array();
 
-  $arg2 = (int)arg(2);
-
   if ($may_cache) {
     $items[] = array(
       'path'     => 'favorite_nodes/add',
-      'callback' => 'favorite_nodes_add',
+      'callback' => 'favorite_nodes_add_page',
       'type'     => MENU_CALLBACK,
       'access'   => user_access(FAVORITE_NODES_PERM_ADD),
     );
 
     $items[] = array(
       'path'     => 'favorite_nodes/delete',
-      'callback' => 'favorite_nodes_delete',
+      'callback' => 'favorite_nodes_delete_page',
       'type'     => MENU_CALLBACK,
       'access'   => user_access(FAVORITE_NODES_PERM_ADD),
     );
-
+ 
     $items[] = array(
       'path'     => 'favorite_nodes/view',
-      'callback' => 'favorite_nodes_view',
+      'callback' => 'favorite_nodes_view_page',
       'type'     => MENU_CALLBACK,
       'access'   => user_access(FAVORITE_NODES_PERM_VIEW),
     );
+ 
+    $items[] = array(
+      'title' => 'Favorite node settings',
+      'path'     => 'admin/settings/favorite_nodes',
+      'description' => 'Settings for favourite nodes',
+      'callback' => 'drupal_get_form',
+      'callback arguments' => 'favorite_nodes_settings',
+      'type'     => MENU_NORMAL_ITEM,
+      'access'   => user_access(FAVORITE_NODES_PERM_ADMINISTER),
+    );
   }
   return $items;
 }
 
+/**
++ * Implementation of hook_xmlrpc().
++ */
+function favorite_nodes_xmlrpc() {
+  $items = array();
+
+  $items[] = array(
+    'favorite_nodes.add',
+    'favorite_nodes_add',
+    array('boolean', 'int'),
+    t('Add a favorite node to the current user\'s list.')
+  );
+}
+
+/**
+ * Implementation of hook_user().
+ */
+function favorite_nodes_user($op, &$edit, &$user, $category = null) {
+  switch ($op) {
+    case 'view':
+      $fav_list = array();
+      $node_types = node_get_types();
+      natcasesort($node_types);
+      foreach($node_types as $type) {
+        if (variable_get(FAVORITE_NODES_NODE_TYPE . $type->type, 0)) {
+          $uid = intval($user->uid);
+          $favorites = favorite_nodes_get($uid, $type->type, variable_get(FAVORITE_NODES_BLOCK_LIMIT, 5));
+          $items = array();
+          if (count($favorites) > 0) {
+            foreach ($favorites as $favorite) {
+              $items[] = l($favorite->title, 'node/' . $favorite->nid);
+            }
+          }
+          $fav_list[] = array(
+          'title' => $type->name,
+          'value' => theme('item_list', $items),
+          );
+        }
+      }
+      return array(t('Favorites') => $fav_list);
+      break;
+
+    case 'delete':
+      favorite_nodes_delete_favorites($user->uid);
+      break;
+  }
+}
+
+/**
+ * Implementation of hook_nodeapi().
+ */
+function favorite_nodes_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
+  switch ($op) {
+    case 'delete':
+      // Delete all favorite entries of the node being deleted.
+      db_query("DELETE FROM {favorite_nodes} WHERE nid = %d", $node->nid);
+      break;
+  }
+}
+
+/**
+ * Implementation of hook_block().
+ */
 function favorite_nodes_block($op = 'list', $delta = 0, $edit = array()) {
   global $user;
 
@@ -64,26 +142,26 @@ function favorite_nodes_block($op = 'lis
         $block = array();
         $block['subject'] = variable_get(FAVORITE_NODES_BLOCK_TITLE, t('Favorites'));
         $block['content'] = '';
-  
+
         $node_types = node_get_types();
         natcasesort($node_types);
-  
-        foreach ($node_types as $type => $name) {
-          if (variable_get(FAVORITE_NODES_NODE_TYPE . $type, 0)) {
+
+        foreach ($node_types as $type) {
+          if (variable_get(FAVORITE_NODES_NODE_TYPE . $type->type, 0)) {
             $uid = intval($user->uid);
-            $favorites = favorite_nodes_get($uid, $type, variable_get(FAVORITE_NODES_BLOCK_LIMIT, 5));
+            $favorites = favorite_nodes_get($uid, $type->type, variable_get(FAVORITE_NODES_BLOCK_LIMIT, 5));
             $items = array();
             if (count($favorites) > 0) {
               foreach ($favorites as $favorite) {
                 $items[] = l($favorite->title, 'node/' . $favorite->nid);
               }
-              $block['content'] .= theme('item_list', $items, variable_get(FAVORITE_NODES_BLOCK . $type, $name));
+              $block['content'] .= theme('item_list', $items, variable_get(FAVORITE_NODES_BLOCK . $type->type, $type->name));
             }
             $sql = "SELECT COUNT(*) FROM {node} n INNER JOIN {favorite_nodes} f USING(nid) WHERE n.type = '%s' AND f.uid = %d ORDER by f.last DESC";
-            $count = db_result(db_query($sql, $type, $user->uid));
+            $count = db_result(db_query($sql, $type->type, $user->uid));
             if ($count > variable_get(FAVORITE_NODES_BLOCK_LIMIT, 5)) {
               $block['content'] .= '<div class="more">' . "\n";
-              $block['content'] .= l(t('More Favorite %types', array('%types' => variable_get(FAVORITE_NODES_BLOCK . $type, $name))), 'favorite_nodes/view/' . $user->uid . '/' . $type);
+              $block['content'] .= l(t('More Favorite %types', array('%types' => variable_get(FAVORITE_NODES_BLOCK . $type->type, $type->name))), 'favorite_nodes/view/' . $user->uid . '/' . $type->type);
               $block['content'] .= '</div>' . "\n";
             }
           }
@@ -122,14 +200,14 @@ function favorite_nodes_block($op = 'lis
         '#collapsible' => true,
         '#collapsed' => true,
       );
-      foreach ($node_types as $type => $name) {
-        if (variable_get(FAVORITE_NODES_NODE_TYPE . $type, 0)) {
-          $form['titles']['subtitles'][FAVORITE_NODES_BLOCK . $type] = array(
+      foreach ($node_types as $type) {
+        if (variable_get(FAVORITE_NODES_NODE_TYPE . $type->type, 0)) {
+          $form['titles']['subtitles'][FAVORITE_NODES_BLOCK . $type->type] = array(
             '#type' => 'textfield',
-            '#title' => t('Subtitle for the %name content type', array('%name' => $name)),
+            '#title' => t('Subtitle for the %name content type', array('%name' => $type->name)),
             '#size' => 60,
             '#description' => t('Within the block, any links to content of the %name type will be categorized under this subtitle.', array('%name' => $name)),
-            '#default_value' => variable_get(FAVORITE_NODES_BLOCK . $type, $name),
+            '#default_value' => variable_get(FAVORITE_NODES_BLOCK . $type->type, $type->name),
           );
         }
       }
@@ -139,9 +217,9 @@ function favorite_nodes_block($op = 'lis
       variable_set(FAVORITE_NODES_BLOCK_TITLE, $edit['title']);
       variable_set(FAVORITE_NODES_BLOCK_LIMIT, $edit['limit']);
       $node_types = node_get_types();
-      foreach ($node_types as $type => $name) {
-        if (variable_get(FAVORITE_NODES_NODE_TYPE . $type, 0)) {
-          variable_set(FAVORITE_NODES_BLOCK . $type, $edit[FAVORITE_NODES_BLOCK . $type]);
+      foreach ($node_types as $type) {
+        if (variable_get(FAVORITE_NODES_NODE_TYPE . $type->type, 0)) {
+          variable_set(FAVORITE_NODES_BLOCK . $type->type, $edit[FAVORITE_NODES_BLOCK . $type->type]);
         }
       }
       break;
@@ -151,6 +229,9 @@ function favorite_nodes_block($op = 'lis
   }
 }
 
+/**
+ * Implementation of hook_links().
+ */
 function favorite_nodes_link($type, $node = null, $teaser = false) {
   global $user;
   $links = array();
@@ -158,12 +239,11 @@ function favorite_nodes_link($type, $nod
     if (variable_get(FAVORITE_NODES_NODE_TYPE . $node->type, 0)) {
       if (user_access(FAVORITE_NODES_PERM_ADD)) {
         if (!_favorite_nodes_check($node->nid)) {
-          $links[] = l(t('add to favorites'), "favorite_nodes/add/$node->nid");
-        }
-        else {
+          $links[] = array('title' => t('add to favorites'), 'href' => 'favorite_nodes/add/'. $node->nid);
+        } else {
           if (user_access(FAVORITE_NODES_PERM_VIEW)) {
-            $links[] = t('in favorites');
-            $links[] = l(t('remove from favorites'), "favorite_nodes/remove/$node->nid");
+            $links[] = array('title' => t('in favorites'));
+            $links[] = array('title' => t('remove from favorites'), 'href' => 'favorite_nodes/delete/'. $node->nid);
           }
         }
       }
@@ -172,6 +252,9 @@ function favorite_nodes_link($type, $nod
   return $links;
 }
 
+/**
+ * Settings page for this module.
+ */
 function favorite_nodes_settings() {
   $set = 'page';
   $form[$set] = array(
@@ -209,54 +292,145 @@ function favorite_nodes_settings() {
     '#collapsible' => true,
     '#collapsed' => false,
   );
-
-  foreach(node_get_types() as $type => $name) {
-    $form[$set][FAVORITE_NODES_NODE_TYPE . $type] = array(
+  foreach(node_get_types() as $type) {
+    $form[$set][FAVORITE_NODES_NODE_TYPE . $type->type] = array(
       '#type' => 'checkbox',
-      '#title' => $name,
+      '#title' => $type->name,
       '#return_value' => 1,
-      '#default_value' => variable_get(FAVORITE_NODES_NODE_TYPE . $type, 0),
+      '#default_value' => variable_get(FAVORITE_NODES_NODE_TYPE . $type->type, 0),
     );
   }
 
-  return $form;
+  return system_settings_form($form);
 }
 
-function favorite_nodes_add() {
+/**
+ * Add a favorite node.
+ */
+function favorite_nodes_add($nid) {
   global $user;
-  $nid = (int)arg(2);
 
-  if ($nid) {
-    $node = node_load($nid);
-    if ($node->nid) {
-      db_query("DELETE FROM {favorite_nodes} WHERE nid=%d AND uid=%d", $nid, $user->uid);
-      db_query("INSERT INTO {favorite_nodes} (nid, uid, last) VALUES (%d, %d, %d)", $nid, $user->uid, time());
-      drupal_set_message(t('The %node was added to your favorites.', array('%node' => _node_names('name', $node))));
-      drupal_goto("node/$nid");
+  $node = node_load($nid);
+
+  if ($node->nid) {
+    db_query("DELETE FROM {favorite_nodes} WHERE nid = %d AND uid = %d", $nid, $user->uid);
+    db_query("INSERT INTO {favorite_nodes} (nid, uid, last) VALUES (%d, %d, %d)", $nid, $user->uid, time());
+
+    return true;
+  } else {
+    return false;
+  }
+}
+
+/**
+ * Delete a favorite node.
+ */
+function favorite_nodes_delete($nid) {
+   global $user;
+   
+  db_query("DELETE FROM {favorite_nodes} WHERE nid = %d AND uid = %d", $nid, $user->uid);
+}
+
+/**
+ * Select all the favorite nodes a user has.
+ */
+function favorite_nodes_get($uid, $type = NULL, $limit = NULL) {
+  if (is_null($limit)) {
+    $limit = variable_get(FAVORITE_NODES_PAGE_LIMIT, 10);
+  }
+  $row = array();
+  if ($type && variable_get(FAVORITE_NODES_NODE_TYPE . $type, 0)) {
+    $sql = "SELECT n.nid, n.title, f.uid, f.last FROM {node} n INNER JOIN {favorite_nodes} f ON n.nid=f.nid WHERE n.type = '%s' AND f.uid = %d ORDER by f.last DESC";
+
+    $result = pager_query($sql, $limit, 0, NULL, $type, $uid);
+    if ($result && db_num_rows($result) > 0) {
+      while ($data = db_fetch_object($result)) {
+        $row[$data->nid] = $data;
+      }
+    }
+  }
+  return $row;
+}
+
+/**
+ * Page to add a favorite node.
+ */
+function favorite_nodes_add_page() {
+  $nid = arg(2);
+  if (is_numeric($nid)) {
+    $result = favorite_nodes_add($nid);
+    if ($result) {
+       drupal_set_message(t('The node was added to your favorites.'));
+    } else {
+
     }
+    drupal_goto('node/'. $nid);
   }
+
   drupal_not_found();
 }
 
-function favorite_nodes_delete() {
-  global $user;
-  $nid = (int)arg(2);
-
-  _favorite_nodes_delete_nid($nid);
+/**
+ * Page to delete a favorite node.
+ */
+function favorite_nodes_delete_page() {
+   global $user;
+  $nid = arg(2);
+ 
+  favorite_nodes_delete($nid);
   drupal_set_message(t('The node was deleted from your favorites'));
-  drupal_goto("user/$user->uid");
-}
+  drupal_goto('user/'. $user->uid);
+ }
 
-function favorite_nodes_view() {
-  $uid  = (int)arg(2);
+/**
+ * Page to display a user's favorite list.
+ */
+function favorite_nodes_view_page() {
+  $uid  = arg(2);
   $type = arg(3);
-  print theme('page', theme('favorite_nodes_view_' . variable_get(FAVORITE_NODES_PAGE_TYPE, 'table'), favorite_nodes_get($uid, $type), $uid, $type));
+  $output = theme('favorite_nodes_view_' . variable_get(FAVORITE_NODES_PAGE_TYPE, 'table'), favorite_nodes_get($uid, $type), $uid, $type);
+
+  print theme('page', $output);
+}
+
+/**
+ * Delete favorite nodes a user has.
+ */
+function favorite_nodes_delete_favorites($uid) {
+  db_query("DELETE FROM {favorite_nodes} WHERE uid = %d", $uid);
+}
+
+/**
+ * Get all the favorite nodes inner joining the users.
+ * TODO: currently not being used.. do we need this?
+ */
+function _favorite_nodes_get_users($nid) {
+  $sql = "SELECT u.*, f.last FROM {users} u INNER JOIN {favorite_nodes} f USING(uid) WHERE f.nid = %d ORDER by f.last DESC";
+  $result = db_query($sql, $nid);
+  $row = array();
+  while ($data = db_fetch_object($result)) {
+    $row[$data->uid] = $data;
+  }
+
+  return $row;
 }
 
+/**
+ * Check if a user already has a node in their favorite list.
+ */
+function _favorite_nodes_check($nid) {
+  global $user;
+  $sql = "SELECT COUNT(*) FROM {favorite_nodes} WHERE uid = %d AND nid = %d";
+  return db_result(db_query($sql, $user->uid, $nid));
+}
+
+/**
+ * TODO: This is not being used.. do we need it?
+ */
 function theme_favorite_nodes_view_teasers($list = array(), $uid = NULL, $type = NULL) {
   $user = user_load(array('uid' => $uid));
   $output .= '<h2>' . t('Favorite %type for %user', array('%type' => variable_get(FAVORITE_NODES_BLOCK . $type, $name), '%user' => theme('username', $user))) . '</h2>' . "\n";
-  
+
   if (isset($list)) {
     foreach($list as $nid => $data) {
       $node = node_load($nid);
@@ -264,17 +438,20 @@ function theme_favorite_nodes_view_tease
     }
   }
   $output .= theme('pager');
-  
+
   return $output;
 }
 
+/**
+ * Table which displays favorite node lists.
+ */
 function theme_favorite_nodes_view_table($list = array(), $uid = NULL, $type = NULL) {
   global $user;
-  $account = user_load(array('uid' => $uid));
-  $rows = array();
 
+  $account = user_load(array('uid' => $uid));
   $header = array(t('Title'), t('Added'), t('Operations'));
 
+  $rows = array();
   if (isset($list)) {
     foreach($list as $nid => $data) {
       $title = array(l($data->title, "node/$nid"), format_date($data->last, 'custom', 'Y-m-d H:i'));
@@ -288,92 +465,10 @@ function theme_favorite_nodes_view_table
       $rows[] = array('data' => $result);
     }
   }
-  
+
   $output .= '<h2>' . t('Favorite %type for %user', array('%type' => variable_get(FAVORITE_NODES_BLOCK . $type, $name), '%user' => theme('username', $account))) . '</h2>' . "\n";
   $output .= theme('table', $header, $rows);
   $output .= theme('pager');
   
   return $output;
 }
-
-function favorite_nodes_user($op, &$edit, &$user, $category = null) {
-  switch ($op) {
-    case 'view':
-      $fav_list = array();
-      $node_types = node_get_types();
-      natcasesort($node_types);
-      foreach(node_get_types() as $type => $name) {
-        if (variable_get(FAVORITE_NODES_NODE_TYPE . $type, 0)) {
-          $uid = intval($user->uid);
-          $favorites = favorite_nodes_get($uid, $type, variable_get(FAVORITE_NODES_BLOCK_LIMIT, 5));
-          $items = array();
-          if (count($favorites) > 0) {
-            foreach ($favorites as $favorite) {
-              $items[] = l($favorite->title, 'node/' . $favorite->nid);
-            }
-          }
-          $fav_list[] = array(
-            'title' => $name,
-            'value' => theme('item_list', $items),
-          );
-        }
-      }
-      return array(t('Favorites') => $fav_list);
-      break;
-
-    case 'delete':
-      _favorite_nodes_delete_uid($user->uid);
-      break;
-  }
-}
-
-function favorite_nodes_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
-  switch ($op) {
-    case 'delete':
-      _favorite_nodes_delete_uid($node->nid);
-      break;
-  }
-}
-
-function _favorite_nodes_delete_nid($nid) {
-  db_query("DELETE FROM {favorite_nodes} WHERE nid = %d", $nid);
-}
-
-function _favorite_nodes_delete_uid($uid) {
-  db_query("DELETE FROM {favorite_nodes} WHERE uid = %d", $uid);
-}
-
-function favorite_nodes_get($uid, $type = NULL, $limit = NULL) {
-  if (is_null($limit)) {
-    $limit = variable_get(FAVORITE_NODES_PAGE_LIMIT, 10);
-  } 
-  $row = array();
-  if ($type && variable_get(FAVORITE_NODES_NODE_TYPE . $type, 0)) {
-    $sql = "SELECT n.nid, n.title, f.uid, f.last FROM {node} n INNER JOIN {favorite_nodes} f USING(nid) WHERE n.type = '%s' AND f.uid = %d ORDER by f.last DESC";
-
-    $result = pager_query($sql, $limit, 0, NULL, $type, $uid);
-    if ($result && db_num_rows($result) > 0) {
-      while ($data = db_fetch_object($result)) {
-        $row[$data->nid] = $data;
-      }
-    }
-  }
-  return $row;
-}
-
-function favorite_nodes_get_users($nid) {
-  $sql = "SELECT u.*, f.last FROM {users} u INNER JOIN {favorite_nodes} f USING(uid) WHERE f.nid = %d ORDER by f.last DESC";
-  $result = db_query($sql, $nid);
-  $row = array();
-  while ($data = db_fetch_object($result)) {
-    $row[$data->uid] = $data;
-  }
-
-  return $row;
-}
-
-function _favorite_nodes_check($nid) {
-  global $user;
-  $sql = "SELECT COUNT(*) FROM {favorite_nodes} WHERE uid = %d AND nid = %d";
-  return db_result(db_query($sql, $user->uid, $nid));
-}
