mirror of
https://github.com/WhatCD/Gazelle.git
synced 2024-12-13 02:46:30 +00:00
Empty commit
This commit is contained in:
parent
e0246b7d98
commit
9b793cb975
@ -135,7 +135,8 @@ public static function get_groups($GroupIDs, $Return = true, $GetArtists = true,
|
||||
foreach ($Artists as $GroupID => $Data) {
|
||||
if (array_key_exists(1, $Data) || array_key_exists(4, $Data) || array_key_exists(6, $Data)) {
|
||||
$Found[$GroupID]['Artists'] = isset($Data[1]) ? $Data[1] : null; // Only use main artists (legacy)
|
||||
for ($i = 1; $i <= 6; $i++) {
|
||||
// TODO: find a better solution than this crap / rewrite the artist system
|
||||
for ($i = 1; $i <= 7; $i++) {
|
||||
$Found[$GroupID]['ExtendedArtists'][$i] = isset($Data[$i]) ? $Data[$i] : null;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
CHANGELOG
|
||||
|
||||
2013-07-30 by Y
|
||||
Collage API additions.
|
||||
|
||||
2013-07-23 by draculesti
|
||||
New mod button to generate random user passwords
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?
|
||||
define('ARTIST_COLLAGE', 'Artists');
|
||||
include(SERVER_ROOT.'/classes/text.class.php'); // Text formatting class
|
||||
$Text = new TEXT;
|
||||
|
||||
@ -38,22 +39,116 @@
|
||||
list($Name, $Description, $CreatorID, $Deleted, $CollageCategoryID, $Locked, $MaxGroups, $MaxGroupsPerUser) = $DB->next_record();
|
||||
}
|
||||
|
||||
$JSON = array(
|
||||
'id' => (int)$CollageID,
|
||||
'name' => $Name,
|
||||
'description' => $Text->full_format($Description),
|
||||
'creatorID' => (int)$CreatorID,
|
||||
'deleted' => (bool)$Deleted,
|
||||
'collageCategoryID' => (int)$CollageCategoryID,
|
||||
'collageCategoryName' => $CollageCats[(int)$CollageCategoryID],
|
||||
'locked' => (bool)$Locked,
|
||||
'maxGroups' => (int)$MaxGroups,
|
||||
'maxGroupsPerUser' => (int)$MaxGroupsPerUser,
|
||||
'hasBookmarked' => Bookmarks::has_bookmarked('collage', $CollageID)
|
||||
);
|
||||
|
||||
if ($CollageCategoryID != array_search(ARTIST_COLLAGE, $CollageCats)) {
|
||||
// torrent collage
|
||||
$TorrentGroups = array();
|
||||
$DB->query("
|
||||
SELECT
|
||||
ct.GroupID
|
||||
FROM collages_torrents AS ct
|
||||
JOIN torrents_group AS tg ON tg.ID = ct.GroupID
|
||||
WHERE ct.CollageID = '$CollageID'
|
||||
ORDER BY ct.Sort");
|
||||
$GroupIDs = $DB->collect('GroupID');
|
||||
$GroupList = Torrents::get_groups($GroupIDs);
|
||||
$GroupList = $GroupList['matches'];
|
||||
foreach ($GroupIDs as $GroupID) {
|
||||
if (isset($GroupList[$GroupID])) {
|
||||
$GroupDetails = Torrents::array_group($GroupList[$GroupID]);
|
||||
if ($GroupDetails['GroupCategoryID'] > 0 && $Categories[$GroupDetails['GroupCategoryID'] - 1] == 'Music') {
|
||||
$ArtistForm = $GroupDetails['ExtendedArtists'];
|
||||
$JsonMusicInfo = array(
|
||||
'composers' => ($ArtistForm[4] == null) ? array() : pullmediainfo($ArtistForm[4]),
|
||||
'dj' => ($ArtistForm[6] == null) ? array() : pullmediainfo($ArtistForm[6]),
|
||||
'artists' => ($ArtistForm[1] == null) ? array() : pullmediainfo($ArtistForm[1]),
|
||||
'with' => ($ArtistForm[2] == null) ? array() : pullmediainfo($ArtistForm[2]),
|
||||
'conductor' => ($ArtistForm[5] == null) ? array() : pullmediainfo($ArtistForm[5]),
|
||||
'remixedBy' => ($ArtistForm[3] == null) ? array() : pullmediainfo($ArtistForm[3]),
|
||||
'producer' => ($ArtistForm[7] == null) ? array() : pullmediainfo($ArtistForm[7])
|
||||
);
|
||||
} else {
|
||||
$JsonMusicInfo = null;
|
||||
}
|
||||
$TorrentList = array();
|
||||
foreach ($GroupDetails['Torrents'] as $Torrent) {
|
||||
$TorrentList[] = array(
|
||||
'torrentid' => (int)$Torrent['ID'],
|
||||
'media' => $Torrent['Media'],
|
||||
'format' => $Torrent['Format'],
|
||||
'encoding' => $Torrent['Encoding'],
|
||||
'remastered' => ($Torrent['Remastered'] == 1),
|
||||
'remasterYear' => (int)$Torrent['RemasterYear'],
|
||||
'remasterTitle' => $Torrent['RemasterTitle'],
|
||||
'remasterRecordLabel' => $Torrent['RemasterRecordLabel'],
|
||||
'remasterCatalogueNumber' => $Torrent['RemasterCatalogueNumber'],
|
||||
'scene' => ($Torrent['Scene'] == 1),
|
||||
'hasLog' => ($Torrent['HasLog'] == 1),
|
||||
'hasCue' => ($Torrent['HasCue'] == 1),
|
||||
'logScore' => (int)$Torrent['LogScore'],
|
||||
'fileCount' => (int)$Torrent['FileCount'],
|
||||
'size' => (int)$Torrent['Size'],
|
||||
'seeders' => (int)$Torrent['Seeders'],
|
||||
'leechers' => (int)$Torrent['Leechers'],
|
||||
'snatched' => (int)$Torrent['Snatched'],
|
||||
'freeTorrent' => ($Torrent['FreeTorrent'] == 1),
|
||||
'reported' => $Torrent['Reported'],
|
||||
'time' => $Torrent['Time']
|
||||
);
|
||||
}
|
||||
$TorrentGroups[] = array(
|
||||
'id' => $GroupDetails['GroupID'],
|
||||
'name' => $GroupDetails['GroupName'],
|
||||
'year' => $GroupDetails['GroupYear'],
|
||||
'categoryId' => $GroupDetails['GroupCategoryID'],
|
||||
'recordLabel' => $GroupDetails['GroupRecordLabel'],
|
||||
'catalogueNumber' => $GroupDetails['GroupCatalogueNumber'],
|
||||
'vanityHouse' => $GroupDetails['GroupVanityHouse'],
|
||||
'tagList' => $GroupDetails['TagList'],
|
||||
'releaseType' => $GroupDetails['ReleaseType'],
|
||||
'wikiImage' => $GroupDetails['WikiImage'],
|
||||
'musicInfo' => $JsonMusicInfo,
|
||||
'torrents' => $TorrentList
|
||||
);
|
||||
}
|
||||
}
|
||||
$JSON['torrentgroups'] = $TorrentGroups;
|
||||
} else {
|
||||
// artist collage
|
||||
$DB->query("
|
||||
SELECT
|
||||
ca.ArtistID,
|
||||
ag.Name,
|
||||
aw.Image
|
||||
FROM collages_artists AS ca
|
||||
JOIN artists_group AS ag ON ag.ArtistID=ca.ArtistID
|
||||
LEFT JOIN wiki_artists AS aw ON aw.RevisionID = ag.RevisionID
|
||||
WHERE ca.CollageID='$CollageID'
|
||||
ORDER BY ca.Sort");
|
||||
$Artists = array();
|
||||
while (list($ArtistID, $ArtistName, $ArtistImage) = $DB->next_record()) {
|
||||
$Artists[] = array(
|
||||
'id' => (int)$ArtistID,
|
||||
'name' => $ArtistName,
|
||||
'image' => $ArtistImage
|
||||
);
|
||||
}
|
||||
$JSON['artists'] = $Artists;
|
||||
}
|
||||
|
||||
$Cache->cache_value($CacheKey, array(array($Name, $Description, array(), array(), array(), $Deleted, $CollageCategoryID, $CreatorID, $Locked, $MaxGroups, $MaxGroupsPerUser)), 3600);
|
||||
|
||||
json_die("success", array(
|
||||
'id' => (int) $CollageID,
|
||||
'name' => $Name,
|
||||
'description' => $Text->full_format($Description),
|
||||
'creatorID' => (int) $CreatorID,
|
||||
'deleted' => (bool) $Deleted,
|
||||
'collageCategoryID' => (int) $CollageCategoryID,
|
||||
'locked' => (bool) $Locked,
|
||||
'categoryID' => (int) $CategoryID,
|
||||
'maxGroups' => (int) $MaxGroups,
|
||||
'maxGroupsPerUser' => (int) $MaxGroupsPerUser,
|
||||
'hasBookmarked' => Bookmarks::has_bookmarked('collage', $CollageID),
|
||||
'cached' => (bool) $Cached,
|
||||
));
|
||||
|
||||
?>
|
||||
json_die("success", $JSON);
|
||||
|
@ -12,6 +12,10 @@
|
||||
if ($CategoryID == 0 && $UserID != $LoggedUser['ID'] && !check_perms('site_collages_delete')) {
|
||||
error(403);
|
||||
}
|
||||
if ($CategoryID == array_search(ARTIST_COLLAGE, $CollageCats)) {
|
||||
error(404);
|
||||
}
|
||||
|
||||
$DB->query("
|
||||
SELECT
|
||||
ct.GroupID,
|
||||
|
@ -12,8 +12,8 @@
|
||||
if ($CategoryID === '0' && $UserID !== $LoggedUser['ID'] && !check_perms('site_collages_delete')) {
|
||||
error(403);
|
||||
}
|
||||
if ($CategoryID !== array_search(ARTIST_COLLAGE, $CollageCats)) {
|
||||
error(403);
|
||||
if ($CategoryID != array_search(ARTIST_COLLAGE, $CollageCats)) {
|
||||
error(404);
|
||||
}
|
||||
|
||||
$DB->query("
|
||||
|
Loading…
Reference in New Issue
Block a user