Gazelle/sections/bookmarks/artists.php

109 lines
2.9 KiB
PHP
Raw Permalink Normal View History

<?
2013-05-05 08:00:31 +00:00
if (!empty($_GET['userid'])) {
if (!check_perms('users_override_paranoia')) {
error(403);
}
$UserID = $_GET['userid'];
2013-10-24 08:01:05 +00:00
$Sneaky = $UserID !== $LoggedUser['ID'];
2013-05-05 08:00:31 +00:00
if (!is_number($UserID)) {
error(404);
}
2013-07-13 08:00:46 +00:00
$DB->query("
SELECT Username
FROM users_main
WHERE ID = '$UserID'");
list($Username) = $DB->next_record();
} else {
$UserID = $LoggedUser['ID'];
}
2013-10-24 08:01:05 +00:00
$Sneaky = $UserID !== $LoggedUser['ID'];
2013-03-29 08:00:08 +00:00
//$ArtistList = Bookmarks::all_bookmarks('artist', $UserID);
2013-07-13 08:00:46 +00:00
$DB->query("
2013-05-05 08:00:31 +00:00
SELECT ag.ArtistID, ag.Name
FROM bookmarks_artists AS ba
2013-05-05 08:00:31 +00:00
INNER JOIN artists_group AS ag ON ba.ArtistID = ag.ArtistID
2013-07-13 08:00:46 +00:00
WHERE ba.UserID = $UserID
ORDER BY ag.Name");
$ArtistList = $DB->to_array();
2013-10-24 08:01:05 +00:00
$Title = $Sneaky ? "$Username's bookmarked artists" : 'Your bookmarked artists';
2013-07-13 08:00:46 +00:00
View::show_header($Title, 'browse');
?>
<div class="thin">
2012-08-19 08:00:19 +00:00
<div class="header">
<h2><?=$Title?></h2>
<div class="linkbox">
2013-02-09 08:01:01 +00:00
<a href="bookmarks.php?type=torrents" class="brackets">Torrents</a>
<a href="bookmarks.php?type=artists" class="brackets">Artists</a>
<a href="bookmarks.php?type=collages" class="brackets">Collages</a>
<a href="bookmarks.php?type=requests" class="brackets">Requests</a>
2012-08-19 08:00:19 +00:00
</div>
</div>
<div class="box pad" align="center">
2013-07-17 08:00:52 +00:00
<? if (count($ArtistList) === 0) { ?>
2013-10-24 08:01:05 +00:00
<h2>You have not bookmarked any artists.</h2>
</div>
</div><!--content-->
<?
2012-10-11 08:00:15 +00:00
View::show_footer();
die();
} ?>
2012-09-01 08:00:24 +00:00
<table width="100%" class="artist_table">
<tr class="colhead">
<td>Artist</td>
</tr>
<?
$Row = 'a';
foreach ($ArtistList as $Artist) {
2013-07-17 08:00:52 +00:00
$Row = $Row === 'a' ? 'b' : 'a';
list($ArtistID, $Name) = $Artist;
?>
<tr class="row<?=$Row?> bookmark_<?=$ArtistID?>">
<td>
<a href="artist.php?id=<?=$ArtistID?>"><?=$Name?></a>
2013-05-05 08:00:31 +00:00
<span style="float: right;">
<?
if (check_perms('site_torrents_notify')) {
2013-04-13 08:00:19 +00:00
if (($Notify = $Cache->get_value('notify_artists_'.$LoggedUser['ID'])) === false) {
2013-05-05 08:00:31 +00:00
$DB->query("
SELECT ID, Artists
FROM users_notify_filters
2013-07-13 08:00:46 +00:00
WHERE UserID = '$LoggedUser[ID]'
AND Label = 'Artist notifications'
2013-05-05 08:00:31 +00:00
LIMIT 1");
$Notify = $DB->next_record(MYSQLI_ASSOC);
$Cache->cache_value('notify_artists_'.$LoggedUser['ID'], $Notify, 0);
}
2013-07-13 08:00:46 +00:00
if (stripos($Notify['Artists'], "|$Name|") === false) {
?>
2013-05-05 08:00:31 +00:00
<a href="artist.php?action=notify&amp;artistid=<?=$ArtistID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Notify of new uploads</a>
<?
} else {
?>
2013-05-05 08:00:31 +00:00
<a href="artist.php?action=notifyremove&amp;artistid=<?=$ArtistID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Do not notify of new uploads</a>
<?
}
}
?>
2013-07-13 08:00:46 +00:00
<a href="#" id="bookmarklink_artist_<?=$ArtistID?>" onclick="Unbookmark('artist', <?=$ArtistID?>, 'Bookmark'); return false;" class="brackets">Remove bookmark</a>
</span>
</td>
</tr>
<?
}
?>
</table>
</div>
</div>
<?
2012-10-11 08:00:15 +00:00
View::show_footer();
$Cache->cache_value('bookmarks_'.$UserID, serialize(array(array($Username, $TorrentList, $CollageDataList))), 3600);
?>