summaryrefslogtreecommitdiffstats
path: root/lib/class/tag.class.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2009-05-18 17:34:22 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2009-05-18 17:34:22 +0000
commitd84e62dba716114b799a618cbfd2b14ec61ed1f9 (patch)
tree1dc58dc8636fd369d3862cb0048004fab19f2233 /lib/class/tag.class.php
parent5bd82180f5470c4ce255d02b7aa36c476db1cd99 (diff)
downloadampache-d84e62dba716114b799a618cbfd2b14ec61ed1f9.tar.gz
ampache-d84e62dba716114b799a618cbfd2b14ec61ed1f9.tar.bz2
ampache-d84e62dba716114b799a618cbfd2b14ec61ed1f9.zip
api fixes, added librefm scrobbler (untested) and fixed minor error in header file with rtl vs ltr languages also removed dead RioPlayer plugin
Diffstat (limited to 'lib/class/tag.class.php')
-rw-r--r--lib/class/tag.class.php37
1 files changed, 32 insertions, 5 deletions
diff --git a/lib/class/tag.class.php b/lib/class/tag.class.php
index 44d91c9b..c6dcf13d 100644
--- a/lib/class/tag.class.php
+++ b/lib/class/tag.class.php
@@ -349,18 +349,20 @@ class Tag extends database_object {
/**
* get_object_tags
* Display all tags that apply to maching target type of the specified id
+ * UNUSED
*/
public static function get_object_tags($type, $id) {
if (!self::validate_type($type)) { return array(); }
+
+ $id = Dba::escape($id);
- $sql = "SELECT DISTINCT `tag_map`.`id`, `tag`.`name`, `tag_map`.`user` FROM `tag` " .
- "LEFT JOIN `tag_map` ON `tag_map`.`id`=`tag`.`map_id` " .
- "LEFT JOIN `$type` ON `$type`.`id`=`tag_map`.`object_id` " .
- "WHERE `tag_map`.`object_type`='$type'";
+ $sql = "SELECT `tag_map`.`id`, `tag`.`name`, `tag_map`.`user` FROM `tag` " .
+ "LEFT JOIN `tag_map` ON `tag_map`.`tag_id`=`tag`.`id` " .
+ "WHERE `tag_map`.`object_type`='$type' AND `tag_map`.`object_id`='$id'";
$results = array();
- $db_results = Dba::query($sql);
+ $db_results = Dba::read($sql);
while ($row = Dba::fetch_assoc($db_results)) {
$results[] = $row;
@@ -371,6 +373,31 @@ class Tag extends database_object {
} // get_object_tags
/**
+ * get_tag_objects
+ * This gets the objects from a specified tag and returns an array of object ids, nothing more
+ */
+ public static function get_tag_objects($type,$tag_id) {
+
+ if (!self::validate_type($type)) { return array(); }
+
+ $tag_id = Dba::escape($id);
+
+ $sql = "SELECT DISTINCT `tag_map`.`object_id` FROM `tag_map` " .
+ "WHERE `tag_map`.`tag_id`='$tag_id' AND `tag_map`.`object_type`='$type'";
+ $db_results = Dba::read($sql);
+
+ $results = array();
+
+ while ($row = Dba::fetch_assoc($db_results)) {
+ $results[] = $row['object_id'];
+ }
+
+ return $results;
+
+
+ } // get_tag_objects
+
+ /**
* get_tags
* This is a non-object non type depedent function that just returns tags
* we've got, it can take filters (this is used by the tag cloud)