Index: flag.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/flag/flag.module,v
retrieving revision 1.11.2.72.2.42
diff -u -F '^[^a-z]*function' -U 10 -r1.11.2.72.2.42 flag.module
--- flag.module	16 Aug 2010 20:32:29 -0000	1.11.2.72.2.42
+++ flag.module	20 Aug 2010 10:37:09 -0000
@@ -1502,53 +1502,53 @@ function flag_get_content_id($fcid) {
  *   Optional. The user SID (provided by Session API) whose flags we're
  *   checking. If none given, the current user will be used. The SID is 0 for
  *   logged in users.
  * @param $reset
  *   Reset the internal cache and execute the SQL query another time.
  *
  * @return $flags
  *   If returning a single node's flags, an array of the structure
  *   [name] => (fid => [fid], uid => [uid] nid => [nid], timestamp => [timestamp])
  *
- *   If returning all nodes, an array of the arrays for each node.
- *   [nid] => [name] => Object from above.
+ *   If returning all nodes, an array of the arrays for each flag.
+ *   [name] => [nid] => Object from above.
  *
  */
 function flag_get_user_flags($content_type, $content_id = NULL, $uid = NULL, $sid = NULL, $reset = FALSE) {
   static $flagged_content;
 
   if ($reset) {
     $flagged_content = array();
     if (!isset($content_type)) {
       return;
     }
   }
 
   $uid = !isset($uid) ? $GLOBALS['user']->uid : $uid;
   $sid = !isset($sid) ? flag_get_sid($uid) : $sid;
 
   if (isset($content_id)) {
-    if (!isset($flagged_content[$uid][$content_type][$content_id])) {
+    if (!isset($flagged_content[$uid][$sid][$content_type][$content_id])) {
       $flag_names = _flag_get_flag_names();
       $flagged_content[$uid][$sid][$content_type][$content_id] = array();
       $result = db_query("SELECT * FROM {flag_content} WHERE content_type = '%s' AND content_id = %d AND (uid = %d OR uid = 0) AND sid = %s", $content_type, $content_id, $uid, $sid);
       while ($flag_content = db_fetch_object($result)) {
         $flagged_content[$uid][$sid][$content_type][$content_id][$flag_names[$flag_content->fid]] = $flag_content;
       }
     }
     return $flagged_content[$uid][$sid][$content_type][$content_id];
   }
 
   else {
-    if (!isset($flagged_content[$uid][$sid]['all'][$content_type])) {
+    if (!isset($flagged_content[$uid][$sid][$content_type]['all'])) {
       $flag_names = _flag_get_flag_names();
-      $flagged_content[$uid][$sid]['all'][$content_type] = TRUE;
+      $flagged_content[$uid][$sid][$content_type]['all'] = array();
       $result = db_query("SELECT * FROM {flag_content} WHERE content_type = '%s' AND (uid = %d OR uid = 0) AND sid = %s", $content_type, $uid, $sid);
       while ($flag_content = db_fetch_object($result)) {
         $flagged_content[$uid][$sid][$content_type]['all'][$flag_names[$flag_content->fid]][$flag_content->content_id] = $flag_content;
       }
     }
     return $flagged_content[$uid][$sid][$content_type]['all'];
   }
 
 }
 
