mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-05 19:41:55 +02:00
api fixes, added librefm scrobbler (untested) and fixed minor error in header file with rtl vs ltr languages also removed dead RioPlayer plugin
This commit is contained in:
parent
5bd82180f5
commit
d84e62dba7
10 changed files with 286 additions and 106 deletions
|
@ -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;
|
||||
|
@ -370,6 +372,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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue