Index: flag.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/flag/Attic/flag.inc,v
retrieving revision 1.1.2.30
diff -u -p -r1.1.2.30 flag.inc
--- flag.inc	14 Mar 2009 06:13:54 -0000	1.1.2.30
+++ flag.inc	29 Jul 2009 08:15:52 -0000
@@ -184,8 +184,8 @@ class flag_flag {
    *
    * Derived classes should want to override this.
    */
-  function default_options() {
-    return array(
+  function options() {
+    $options = array(
       'flag_short' => '',
       'flag_long' => '',
       'flag_message' => '',
@@ -196,6 +196,9 @@ class flag_flag {
       'unflag_confirmation' => '',
       'link_type' => 'toggle',
     );
+    // Allow other modules to change the flag options. 
+    drupal_alter('flag_options', $options);
+    return $options;    
   }
 
   /**
@@ -210,7 +213,7 @@ class flag_flag {
    * Default constructor. Loads the default options.
    */
   function construct() {
-    $options = $this->default_options();
+    $options = $this->options();
     foreach ($options as $option => $value) {
       $this->$option = $value;
     }
@@ -724,7 +727,7 @@ class flag_flag {
    * Options are stored serialized in the database.
    */
   function get_serialized_options() {
-    $option_names = array_keys($this->default_options());
+    $option_names = array_keys($this->options());
     $options = array();
     foreach ($option_names as $option) {
       $options[$option] = $this->$option;
@@ -798,8 +801,8 @@ class flag_flag {
  * Implements a node flag.
  */
 class flag_node extends flag_flag {
-  function default_options() {
-    $options = parent::default_options();
+  function options() {
+    $options = parent::options();
     $options += array(
       'show_on_page' => TRUE,
       'show_on_teaser' => TRUE,
@@ -975,8 +978,8 @@ class flag_node extends flag_flag {
  * Implements a comment flag.
  */
 class flag_comment extends flag_flag  {
-  function default_options() {
-    $options = parent::default_options();
+  function options() {
+    $options = parent::options();
     $options += array(
       'show_on_comment' => TRUE,
     );
@@ -1089,8 +1092,8 @@ class flag_comment extends flag_flag  {
  * Implements a user flag.
  */
 class flag_user extends flag_flag {
-  function default_options() {
-    $options = parent::default_options();
+  function options() {
+    $options = parent::options();
     $options += array(
       'show_on_profile' => TRUE,
     );
Index: flag.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/flag/Attic/flag.module,v
retrieving revision 1.11.2.72
diff -u -p -r1.11.2.72 flag.module
--- flag.module	15 Jun 2009 20:05:42 -0000	1.11.2.72
+++ flag.module	29 Jul 2009 08:15:52 -0000
@@ -827,6 +827,70 @@ function flag_get_counts($content_type, 
 }
 
 /**
+ * Get the number of flagged contents in a flag.
+ * 
+ *  @param $fid
+ *    The flag ID.
+ *  @param $reset
+ *    TRUE if counts cache should be cleared.
+ */
+function flag_get_flag_counts($fid, $reset = FALSE) {
+  static $counts;
+
+  if ($reset) {
+    $counts = array();
+  }
+  if (!isset($counts[$fid])) {
+    $counts[$fid] = db_result(db_query("SELECT COUNT(*) FROM {flag_content} WHERE fid = %d", $fid));    
+  }
+  
+  return $counts[$fid];    
+}
+
+/**
+ * Get all flagged content in a flag.
+ * 
+ *  @param
+ *    The flag ID.
+ */
+function flag_get_flagged_content($fid) {
+  $return = array();
+  $result = db_query("SELECT *  FROM {flag_content} WHERE fid = %d", $fid);
+  while ($row = db_fetch_object($result)) {
+    $return[] = $row;
+  }
+  return $return;    
+}
+
+/**
+ * Get fcid from content ID of a certain flag.
+ * 
+ * @param $content_id
+ *   The content ID.
+ * @param $fid
+ *   The flag ID.
+ * @return
+ *   Since a user may flag only once a content in the same flag return a keyd 
+ *   array with the user ID that flagged it and the value as the flag content 
+ *   ID (fcid).   
+ */
+function flag_get_fcid_from_content_id($content_id, $fid) {
+  $return = array();
+  $result = db_query("SELECT fcid, uid FROM {flag_content} WHERE content_id = %d AND fid = %d", $content_id, $fid);
+  while ($row = db_fetch_object($result)) {
+    $return[$row->uid] = $row->fcid;
+  }
+  return $return; 
+}
+
+/**
+ * Get content ID from content fcid.
+ */
+function flag_get_content_id_from_fcid($fcid) {
+  return db_result(db_query("SELECT content_id FROM {flag_content} WHERE fcid = %d", $fcid));
+}
+
+/**
  * Load a single flag either by name or by flag ID.
  *
  * @param $name
