Gazelle/sections/ajax/bookmarks/artists.php

61 lines
1.1 KiB
PHP
Raw Normal View History

2012-01-19 08:00:18 +00:00
<?
if(!empty($_GET['userid'])) {
if(!check_perms('users_override_paranoia')) {
2013-02-22 08:00:24 +00:00
print
2012-01-19 08:00:18 +00:00
json_encode(
array(
'status' => 'failure'
)
);
die();
}
$UserID = $_GET['userid'];
$Sneaky = ($UserID != $LoggedUser['ID']);
if(!is_number($UserID)) {
2013-02-22 08:00:24 +00:00
print
2012-01-19 08:00:18 +00:00
json_encode(
array(
'status' => 'failure'
)
);
die();
}
$DB->query("SELECT Username FROM users_main WHERE ID='$UserID'");
list($Username) = $DB->next_record();
} else {
$UserID = $LoggedUser['ID'];
}
$Sneaky = ($UserID != $LoggedUser['ID']);
//$ArtistList = all_bookmarks('artist', $UserID);
$DB->query('SELECT ag.ArtistID, ag.Name
FROM bookmarks_artists AS ba
INNER JOIN artists_group AS ag ON ba.ArtistID = ag.ArtistID
WHERE ba.UserID = '.$UserID);
$ArtistList = $DB->to_array();
$JsonArtists = array();
foreach($ArtistList as $Artist) {
list($ArtistID, $Name) = $Artist;
$JsonArtists[] = array(
'artistId' => (int) $ArtistID,
'artistName' => $Name
);
}
print
json_encode(
array(
'status' => 'success',
'response' => array(
'artists' => $JsonArtists
)
)
);
?>