Empty commit

This commit is contained in:
Git 2013-05-25 08:01:03 +00:00
parent da2cd45c46
commit dc035fbc0d
48 changed files with 1487 additions and 758 deletions

View File

@ -86,9 +86,8 @@ function set_up() {
JOIN artists_similar AS s2 ON s1.SimilarID=s2.SimilarID AND s1.ArtistID!=s2.ArtistID
JOIN artists_similar_scores AS ass ON ass.SimilarID=s1.SimilarID
JOIN artists_group AS a ON a.ArtistID=s2.ArtistID
WHERE s1.ArtistID IN(".implode(',',$ArtistIDs).")
AND s2.ArtistID IN(".implode(',',$ArtistIDs).")
");
WHERE s1.ArtistID IN(".implode(',',$ArtistIDs).')
AND s2.ArtistID IN('.implode(',',$ArtistIDs).')');
// Build into array
while (list($Artist1ID, $Artist2ID) = $DB->next_record()) {
@ -304,8 +303,8 @@ function scan_array_range($Array, $Start, $Finish) {
function write_artists() {
?>
<div style="position: absolute; bottom: <?=$this->y - 10 ?>px; left: <?=$this->x - $this->NameLength * 4 ?>px; font-size: 13pt; white-space: nowrap;" class="similar_artist_header">
<?=$this->Name?>
<div style="position: absolute; bottom: <?=($this->y - 10)?>px; left: <?=($this->x - $this->NameLength * 4)?>px; font-size: 13pt; white-space: nowrap;" class="similar_artist_header">
<?=($this->Name)?>
</div>
<?
foreach ($this->Artists as $Artist) {
@ -330,8 +329,8 @@ function write_artists() {
$FontSize = 12;
}
?>
<div style="position: absolute; top: <?=$Artist->y - 5 ?>px; left: <?=$xPosition?>px; font-size: <?=$FontSize?>pt; white-space: nowrap;">
<a href="artist.php?id=<?=$Artist->ID?>" class="similar_artist"><?=$Artist->Name?></a>
<div style="position: absolute; top: <?=($Artist->y - 5)?>px; left: <?=$xPosition?>px; font-size: <?=$FontSize?>pt; white-space: nowrap;">
<a href="artist.php?id=<?=($Artist->ID)?>" class="similar_artist"><?=($Artist->Name)?></a>
</div>
<?
}
@ -371,8 +370,8 @@ function dump() {
echo ' - ';
echo $Artist->Name;
echo "\n";
echo "x - ".$Artist->x."\n";
echo "y - ".$Artist->y."\n";
echo 'x - ' . $Artist->x . "\n";
echo 'y - ' . $Artist->y . "\n";
print_r($this->Similar[$Artist->ID]);
//print_r($Artist->Similar);
echo "\n\n---\n\n";

View File

@ -30,4 +30,16 @@ public static function get_comment_catalogue($CollageID, $CatalogueID) {
}
return $Catalogue;
}
public static function increase_subscriptions($CollageID) {
global $DB;
$DB->query("UPDATE collages SET Subscribers = Subscribers + 1 WHERE ID = '$CollageID'");
}
public static function decrease_subscriptions($CollageID) {
global $DB;
$DB->query("UPDATE collages SET Subscribers = IF(Subscribers < 1, 0, Subscribers - 1) WHERE ID = '$CollageID'");
}
}

View File

@ -10,8 +10,7 @@
*
* It can be used for Bookmarks, Collages, or anywhere where torrents are managed.
*/
class MASS_USER_TORRENTS_TABLE_VIEW
{
class MASS_USER_TORRENTS_TABLE_VIEW {
/**
* Used to set text the page heading (h2 tag)
* @var string $Heading
@ -147,13 +146,13 @@ public function header () {
<table id="manage_collage_table">
<thead>
<tr class="colhead">
<th style="width: 7%">Order</th>
<th style="width: 1%"><span><abbr title="Current order">#</abbr></span></th>
<th style="width: 1%"><span>Year</span></th>
<th style="width: 15%"><span>Artist</span></th>
<th style="width: 7%;">Order</th>
<th style="width: 1%;"><span><abbr title="Current order">#</abbr></span></th>
<th style="width: 1%;"><span>Year</span></th>
<th style="width: 15%;"><span>Artist</span></th>
<th><span>Torrent</span></th>
<th style="width: 5%"><span>Bookmarked</span></th>
<th style="width: 1%" id="check_all"><span>Remove</span></th>
<th style="width: 5%;"><span>Bookmarked</span></th>
<th style="width: 1%;" id="check_all"><span>Remove</span></th>
</tr>
</thead>
<tbody>

View File

@ -466,7 +466,7 @@ function to_html($Array) {
$Str.='<em>'.$this->to_html($Block['Val'])."</em>";
break;
case 's':
$Str.='<span style="text-decoration: line-through">'.$this->to_html($Block['Val']).'</span>';
$Str.='<span style="text-decoration: line-through;">'.$this->to_html($Block['Val']).'</span>';
break;
case 'user':
$Str.='<a href="user.php?action=search&amp;search='.urlencode($Block['Val']).'">'.$Block['Val'].'</a>';
@ -478,7 +478,7 @@ function to_html($Array) {
$Str.='<a href="wiki.php?action=article&amp;name='.urlencode($Block['Val']).'">'.$Block['Val'].'</a>';
break;
case 'tex':
$Str.='<img style="vertical-align: middle" src="'.STATIC_SERVER.'blank.gif" onload="if (this.src.substr(this.src.length-9,this.src.length) == \'blank.gif\') { this.src = \'http://chart.apis.google.com/chart?cht=tx&amp;chf=bg,s,FFFFFF00&amp;chl='.urlencode(mb_convert_encoding($Block['Val'],"UTF-8","HTML-ENTITIES")).'&amp;chco=\' + hexify(getComputedStyle(this.parentNode,null).color); }" />';
$Str.='<img style="vertical-align: middle;" src="'.STATIC_SERVER.'blank.gif" onload="if (this.src.substr(this.src.length-9,this.src.length) == \'blank.gif\') { this.src = \'http://chart.apis.google.com/chart?cht=tx&amp;chf=bg,s,FFFFFF00&amp;chl='.urlencode(mb_convert_encoding($Block['Val'],"UTF-8","HTML-ENTITIES")).'&amp;chco=\' + hexify(getComputedStyle(this.parentNode,null).color); }" />';
break;
case 'plain':
$Str.=$Block['Val'];
@ -502,7 +502,7 @@ function to_html($Array) {
if (!in_array($Block['Attr'], $ValidAttribs)) {
$Str.='[align='.$Block['Attr'].']'.$this->to_html($Block['Val']).'[/align]';
} else {
$Str.='<div style="text-align:'.$Block['Attr'].'">'.$this->to_html($Block['Val']).'</div>';
$Str.='<div style="text-align: '.$Block['Attr'].';">'.$this->to_html($Block['Val']).'</div>';
}
break;
case 'color':
@ -511,7 +511,7 @@ function to_html($Array) {
if (!in_array($Block['Attr'], $ValidAttribs) && !preg_match('/^#[0-9a-f]{6}$/', $Block['Attr'])) {
$Str.='[color='.$Block['Attr'].']'.$this->to_html($Block['Val']).'[/color]';
} else {
$Str.='<span style="color:'.$Block['Attr'].'">'.$this->to_html($Block['Val']).'</span>';
$Str.='<span style="color: '.$Block['Attr'].';">'.$this->to_html($Block['Val']).'</span>';
}
break;
case 'inlinesize':

View File

@ -472,7 +472,7 @@ function show() {
<? if ($this->NewTorrent) { ?>
<tr>
<td class="label">Multi-format uploader:</td>
<td><input type="button" value="+" id="add_format" /><input type="button" style="display: none" value="-" id="remove_format" /></td>
<td><input type="button" value="+" id="add_format" /><input type="button" style="display: none;" value="-" id="remove_format" /></td>
</tr>
<tr id="placeholder_row_top"></tr>
<tr id="placeholder_row_bottom"></tr>

View File

@ -9,7 +9,7 @@ class Votes {
public static function vote_link($GroupID, $Vote = '') {
global $LoggedUser;
if (!$LoggedUser['NoVoteLinks'] && check_perms('site_album_votes')) { ?>
<span class="votespan brackets" style="white-space: nowrap">
<span class="votespan brackets" style="white-space: nowrap;">
Vote:
<a href="#" onclick="UpVoteGroup(<?=$GroupID?>, '<?=$LoggedUser['AuthKey']?>'); return false;" class="small_upvote vote_link_<?=$GroupID?><?=(!empty($Vote)?' hidden':'')?>" title="Upvote"></a>
<span class="voted_type small_upvoted voted_up_<?=$GroupID?><?=(($Vote == 'Down' || empty($Vote))?' hidden':'')?>" title="Upvoted"></span>

View File

@ -19,7 +19,7 @@
$Load = sys_getloadavg();
?>
<p>Site and design &copy; <?=date("Y")?> <?=SITE_NAME?></p>
<p>Site and design &copy; <?=date('Y')?> <?=SITE_NAME?></p>
<? if (!empty($LastActive)) { ?>
<p><a href="user.php?action=sessions" title="Manage sessions">Last activity <?=time_diff($LastActive['LastUpdate'])?> from <?=$LastActive['IP']?>.</a></p>
<? } ?>

View File

@ -167,12 +167,25 @@ CREATE TABLE `collages` (
`MaxGroups` int(10) NOT NULL DEFAULT '0',
`MaxGroupsPerUser` int(10) NOT NULL DEFAULT '0',
`Featured` tinyint(4) NOT NULL DEFAULT '0',
`Subscribers` int(10) DEFAULT '0',
`updated` datetime NOT NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `Name` (`Name`),
KEY `UserID` (`UserID`),
KEY `CategoryID` (`CategoryID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
CREATE TABLE `collages_artists` (
`CollageID` int(10) NOT NULL,
`ArtistID` int(10) NOT NULL,
`UserID` int(10) NOT NULL,
`Sort` int(10) NOT NULL DEFAULT '0',
`AddedOn` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`CollageID`,`ArtistID`),
KEY `UserID` (`UserID`),
KEY `Sort` (`Sort`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `collages_comments` (
`ID` int(10) NOT NULL AUTO_INCREMENT,
`CollageID` int(10) NOT NULL,

View File

@ -710,6 +710,55 @@ function compare($X, $Y) {
echo $TorrentDisplayList;
$Collages = $Cache->get_value('artists_collages_'.$ArtistID);
if (!is_array($Collages)) {
$DB->query("SELECT
c.Name, c.NumTorrents, c.ID
FROM collages AS c
JOIN collages_artists AS ca ON ca.CollageID=c.ID
WHERE ca.ArtistID='$ArtistID'
AND Deleted='0' AND CategoryID = '7'");
$Collages = $DB->to_array();
$Cache->cache_value('artists_collages_'.$ArtistID, $Collages, 3600*6);
}
if (count($Collages) > 0) {
if (count($Collages) > MAX_COLLAGES) {
// Pick some at random
$Range = range(0,count($Collages) - 1);
shuffle($Range);
$Indices = array_slice($Range, 0, MAX_COLLAGES);
$SeeAll = ' <a href="#" onclick="$(\'.collage_rows\').toggle(); return false;">(See all)</a>';
} else {
$Indices = range(0, count($Collages)-1);
$SeeAll = '';
}
?>
<table class="collage_table" id="collages">
<tr class="colhead">
<td width="85%"><a href="#">&uarr;</a>&nbsp;This artists is in <?=number_format(count($Collages))?> collage<?=((count($Collages)>1) ? 's' : '')?><?=$SeeAll?></td>
<td># artists</td>
</tr>
<? foreach ($Indices as $i) {
list($CollageName, $CollageArtists, $CollageID) = $Collages[$i];
unset($Collages[$i]);
?>
<tr>
<td><a href="collages.php?id=<?=$CollageID?>"><?=$CollageName?></a></td>
<td><?=number_format($CollageArtists)?></td>
</tr>
<? }
foreach ($Collages as $Collage) {
list($CollageName, $CollageArtists, $CollageID) = $Collage;
?>
<tr class="collage_rows hidden">
<td><a href="collages.php?id=<?=$CollageID?>"><?=$CollageName?></a></td>
<td><?=number_format($CollageArtists)?></td>
</tr>
<? } ?>
</table>
<?
}
if ($NumRequests > 0) {
?>
@ -810,7 +859,7 @@ function compare($X, $Y) {
<strong id="flipper_title">Similar artist map</strong>
<a id="flip_to" class="brackets" href="#null" onclick="flipView();">Switch to cloud</a>
</div>
<div id="flip_view_1" style="display: block; width: <?=(WIDTH)?>px; height: <?=(HEIGHT)?>px; position: relative; background-image: url(static/similar/<?=($ArtistID)?>.png?t=<?=(time())?>)">
<div id="flip_view_1" style="display: block; width: <?=(WIDTH)?>px; height: <?=(HEIGHT)?>px; position: relative; background-image: url(static/similar/<?=($ArtistID)?>.png?t=<?=(time())?>);">
<?
$Similar->write_artists();
?>

View File

@ -217,11 +217,10 @@ function compare($X, $Y) {
?>
<li class="image_group_<?=$GroupID?>">
<a href="torrents.php?id=<?=$GroupID?>" class="bookmark_<?=$GroupID?>">
<? if ($WikiImage) {
?>
<? if ($WikiImage) { ?>
<img src="<?=ImageTools::process($WikiImage, true)?>" alt="<?=$DisplayName?>" title="<?=$DisplayName?>" width="117" />
<? } else { ?>
<div style="width:107px;padding:5px"><?=$DisplayName?></div>
<div style="width: 107px; padding: 5px;"><?=$DisplayName?></div>
<? } ?>
</a>
</li>

View File

@ -0,0 +1,141 @@
<?
//NumTorrents is actually the number of things in the collage, the name just isn't generic.
authorize();
include(SERVER_ROOT.'/classes/class_validate.php');
$Val = new VALIDATE;
function add_artist($CollageID, $ArtistID) {
global $Cache, $LoggedUser, $DB;
$DB->query("SELECT MAX(Sort) FROM collages_artists WHERE CollageID='$CollageID'");
list($Sort) = $DB->next_record();
$Sort+=10;
$DB->query("SELECT ArtistID FROM collages_artists WHERE CollageID='$CollageID' AND ArtistID='$ArtistID'");
if ($DB->record_count() == 0) {
$DB->query("INSERT IGNORE INTO collages_artists
(CollageID, ArtistID, UserID, Sort, AddedOn)
VALUES
('$CollageID', '$ArtistID', '$LoggedUser[ID]', '$Sort', NOW())");
$DB->query("UPDATE collages SET NumTorrents=NumTorrents+1 WHERE ID='$CollageID'");
$Cache->delete_value('collage_'.$CollageID);
$Cache->delete_value('artists_collages_'.$ArtistID);
$Cache->delete_value('artists_collages_personal_'.$ArtistID);
$DB->query("SELECT UserID FROM users_collage_subs WHERE CollageID=$CollageID");
while (list($CacheUserID) = $DB->next_record()) {
$Cache->delete_value('collage_subs_user_new_'.$CacheUserID);
}
}
}
$CollageID = $_POST['collageid'];
if (!is_number($CollageID)) {
error(404);
}
$DB->query("SELECT UserID, CategoryID, Locked, NumTorrents, MaxGroups, MaxGroupsPerUser FROM collages WHERE ID='$CollageID'");
list($UserID, $CategoryID, $Locked, $NumTorrents, $MaxGroups, $MaxGroupsPerUser) = $DB->next_record();
if (!check_perms('site_collages_delete')) {
if ($Locked) {
$Err = "This collage is locked";
}
if ($CategoryID == 0 && $UserID != $LoggedUser['ID']) {
$Err = "You cannot edit someone else's personal collage";
}
if ($MaxGroups > 0 && $NumTorrents >= $MaxGroups) {
$Err = "This collage already holds its maximum allowed number of artists";
}
if (isset($Err)) {
error($Err);
}
}
if ($MaxGroupsPerUser > 0) {
$DB->query("SELECT COUNT(*) FROM collages_artists WHERE CollageID='$CollageID' AND UserID='$LoggedUser[ID]'");
list($GroupsForUser) = $DB->next_record();
if (!check_perms('site_collages_delete') && $GroupsForUser >= $MaxGroupsPerUser) {
error(403);
}
}
if ($_REQUEST['action'] == 'add_artist') {
$URLRegex = '/^https?:\/\/(www\.|ssl\.)?'.preg_quote(NONSSL_SITE_URL, '/').'\/artist\.php\?(page=[0-9]+&)?id=([0-9]+)/i';
$Val->SetFields('url', '1','regex','The URL must be a link to a artist on the site.',array('regex'=>$URLRegex));
$Err = $Val->ValidateForm($_POST);
if ($Err) {
error($Err);
}
$URL = $_POST['url'];
// Get artist ID
$URLRegex = '/artist\.php\?(page=[0-9]+&)?id=([0-9]+)/i';
preg_match($URLRegex, $URL, $Matches);
$ArtistID = $Matches[2];
if (!$ArtistID || (int) $ArtistID == 0) {
error(404);
}
$DB->query("SELECT ArtistID FROM artists_group WHERE ArtistID='$ArtistID'");
list($ArtistID) = $DB->next_record();
if (!$ArtistID) {
error('The artist was not found in the database.');
}
add_artist($CollageID, $ArtistID);
} else {
$URLRegex = '/^https?:\/\/(www\.|ssl\.)?'.NONSSL_SITE_URL.'\/artist\.php\?(page=[0-9]+&)?id=([0-9]+)/i';
$URLs = explode("\n",$_REQUEST['urls']);
$ArtistIDs = array();
$Err = '';
foreach ($URLs as $Key => &$URL) {
$URL = trim($URL);
if ($URL == '') {
unset($URLs[$Key]);
}
}
unset($URL);
if (!check_perms('site_collages_delete')) {
if ($MaxGroups > 0 && ($NumTorrents + count($URLs) > $MaxGroups)) {
$Err = "This collage can only hold $MaxGroups artists.";
}
if ($MaxGroupsPerUser > 0 && ($GroupsForUser + count($URLs) > $MaxGroupsPerUser)) {
$Err = "You may only have $MaxGroupsPerUser artists in this collage.";
}
}
foreach ($URLs as $URL) {
$Matches = array();
if (preg_match($URLRegex, $URL, $Matches)) {
$ArtistIDs[] = $Matches[3];
$ArtistID = $Matches[3];
} else {
$Err = "One of the entered URLs ($URL) does not correspond to an artist on the site.";
break;
}
$DB->query("SELECT ArtistID FROM artists_group WHERE ArtistID='$ArtistID'");
if (!$DB->record_count()) {
$Err = "One of the entered URLs ($URL) does not correspond to an artist on the site.";
break;
}
}
if ($Err) {
error($Err);
}
foreach ($ArtistIDs as $ArtistID) {
add_artist($CollageID, $ArtistID);
}
}
header('Location: collages.php?id='.$CollageID);

View File

@ -5,7 +5,7 @@
include(SERVER_ROOT.'/classes/class_validate.php');
$Val = new VALIDATE;
function AddTorrent($CollageID, $GroupID) {
function add_torrent($CollageID, $GroupID) {
global $Cache, $LoggedUser, $DB;
$DB->query("SELECT MAX(Sort) FROM collages_torrents WHERE CollageID='$CollageID'");
@ -19,7 +19,7 @@ function AddTorrent($CollageID, $GroupID) {
VALUES
('$CollageID', '$GroupID', '$LoggedUser[ID]', '$Sort', NOW())");
$DB->query("UPDATE collages SET NumTorrents=NumTorrents+1 WHERE ID='$CollageID'");
$DB->query("UPDATE collages SET NumTorrents=NumTorrents+1, Updated = NOW() WHERE ID='$CollageID'");
$Cache->delete_value('collage_'.$CollageID);
$Cache->delete_value('torrents_details_'.$GroupID);
@ -89,7 +89,7 @@ function AddTorrent($CollageID, $GroupID) {
error('The torrent was not found in the database.');
}
AddTorrent($CollageID, $GroupID);
add_torrent($CollageID, $GroupID);
} else {
$URLRegex = '/^https?:\/\/(www\.|ssl\.)?'.NONSSL_SITE_URL.'\/torrents\.php\?(page=[0-9]+&)?id=([0-9]+)/i';
@ -135,7 +135,7 @@ function AddTorrent($CollageID, $GroupID) {
}
foreach ($GroupIDs as $GroupID) {
AddTorrent($CollageID, $GroupID);
add_torrent($CollageID, $GroupID);
}
}
header('Location: collages.php?id='.$CollageID);

View File

@ -0,0 +1,291 @@
<?
$DB->query("SELECT
ca.ArtistID,
ag.Name,
aw.Image,
um.ID AS UserID,
um.Username
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
LEFT JOIN users_main AS um ON um.ID=ca.UserID
WHERE ca.CollageID='$CollageID'
ORDER BY ca.Sort");
$Artists = $DB->to_array('ArtistID', MYSQLI_ASSOC);
// Loop through the result set, building up $Collage and $TorrentTable
// Then we print them.
$Collage = array();
$TorrentTable = '';
$NumArtists = 0;
$NumArtistsByUser = 0;
$Users = array();
foreach($Artists as $Artist) {
$UserID = $Artist['UserID'];
$Username = $Artist['Username'];
$NumArtists++;
if ($UserID == $LoggedUser['ID']) {
$NumArtistsByUser++;
}
if ($Username) {
if (!isset($Users[$UserID])) {
$Users[$UserID] = array('name'=>$Username, 'count'=>1);
} else {
$Users[$UserID]['count']++;
}
}
ob_start();
?>
<tr>
<td>
<a href="artist.php?id=<?=$Artist['ArtistID']?>"><?=$Artist['Name']?></a>
</td>
</tr>
<?
$ArtistTable.=ob_get_clean();
ob_start();
?>
<li class="image_group_<?=$Artist['ArtistID']?>">
<a href="artist.php?id=<?=$Artist['ArtistID']?>">
<? if ($Artist['Image']) { ?>
<img src="<?=ImageTools::process($Artist['Image'], true)?>" alt="<?=$Artist['Name']?>" title="<?=$Artist['Name']?>" width="118" />
<? } else { ?>
<span style="width: 107px; padding: 5px;"><?=$Artist['Name']?></span>
<? } ?>
</a>
</li>
<?
$Collage[] = ob_get_clean();
}
if (!check_perms('site_collages_delete') && ($Locked || ($MaxGroups > 0 && $NumGroups >= $MaxGroups) || ($MaxGroupsPerUser > 0 && $NumGroupsByUser >= $MaxGroupsPerUser))) {
$PreventAdditions = true;
}
// Silly hack for people who are on the old setting
$CollageCovers = isset($LoggedUser['CollageCovers']) ? $LoggedUser['CollageCovers'] : 25 * (abs($LoggedUser['HideCollage'] - 1));
$CollagePages = array();
// Pad it out
if ($NumGroups > $CollageCovers) {
for ($i = $NumGroups + 1; $i <= ceil($NumGroups / $CollageCovers) * $CollageCovers; $i++) {
$Collage[] = '<li></li>';
}
}
for ($i = 0; $i < $NumGroups / $CollageCovers; $i++) {
$Groups = array_slice($Collage, $i * $CollageCovers, $CollageCovers);
$CollagePage = '';
foreach ($Groups as $Group) {
$CollagePage .= $Group;
}
$CollagePages[] = $CollagePage;
}
View::show_header($Name,'browse,collage,bbcode,voting,jquery,recommend');
?>
<div class="thin">
<div class="header">
<h2><?=$Name?></h2>
<div class="linkbox">
<a href="collages.php" class="brackets">List of collages</a>
<? if (check_perms('site_collages_create')) { ?>
<a href="collages.php?action=new" class="brackets">New collage</a>
<? } ?>
<br /><br />
<? if (check_perms('site_collages_subscribe')) { ?>
<a href="#" id="subscribelink<?=$CollageID?>" class="brackets" onclick="CollageSubscribe(<?=$CollageID?>);return false;"><?=(in_array($CollageID, $CollageSubscriptions) ? 'Unsubscribe' : 'Subscribe')?></a>
<? }
if (check_perms('site_collages_delete') || (check_perms('site_edit_wiki') && !$Locked)) { ?>
<a href="collages.php?action=edit&amp;collageid=<?=$CollageID?>" class="brackets">Edit description</a>
<? } else { ?>
<span class="brackets">Locked</span>
<? }
if (Bookmarks::has_bookmarked('collage', $CollageID)) {
?>
<a href="#" id="bookmarklink_collage_<?=$CollageID?>" class="brackets" onclick="Unbookmark('collage', <?=$CollageID?>,'Bookmark');return false;">Remove bookmark</a>
<? } else { ?>
<a href="#" id="bookmarklink_collage_<?=$CollageID?>" class="brackets" onclick="Bookmark('collage', <?=$CollageID?>,'Remove bookmark');return false;">Bookmark</a>
<? }
?>
<!-- <a href="#" id="recommend" class="brackets">Recommend</a> -->
<?
if (check_perms('site_collages_manage') && !$Locked) { ?>
<a href="collages.php?action=manage_artists&amp;collageid=<?=$CollageID?>" class="brackets">Manage artists</a>
<? } ?>
<a href="reports.php?action=report&amp;type=collage&amp;id=<?=$CollageID?>" class="brackets">Report collage</a>
<? if (check_perms('site_collages_delete') || $CreatorID == $LoggedUser['ID']) { ?>
<a href="collages.php?action=delete&amp;collageid=<?=$CollageID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets" onclick="return confirm('Are you sure you want to delete this collage?');">Delete</a>
<? } ?>
</div>
</div>
<? /* Misc::display_recommend($CollageID, "collage"); */ ?>
<div class="sidebar">
<div class="box box_category">
<div class="head"><strong>Category</strong></div>
<div class="pad"><a href="collages.php?action=search&amp;cats[<?=(int)$CollageCategoryID?>]=1"><?=$CollageCats[(int)$CollageCategoryID]?></a></div>
</div>
<div class="box box_description">
<div class="head"><strong>Description</strong></div>
<div class="pad"><?=$Text->full_format($Description)?></div>
</div>
<div class="box box_info box_statistics_collage_torrents">
<div class="head"><strong>Stats</strong></div>
<ul class="stats nobullet">
<li>Artists: <?=number_format($NumArtists)?></li>
<li>Built by <?=number_format(count($Users))?> user<?=(count($Users) > 1 ? 's' : '')?></li>
</ul>
</div>
<div class="box box_contributors">
<div class="head"><strong>Top contributors</strong></div>
<div class="pad">
<ol style="padding-left: 5px;">
<?
uasort($Users, 'compare');
$i = 0;
foreach ($Users as $ID => $User) {
$i++;
if ($i > 5) {
break;
}
?>
<li><?=Users::format_username($ID, false, false, false)?> (<?=number_format($User['count'])?>)</li>
<?
}
?>
</ol>
</div>
</div>
<? if (check_perms('site_collages_manage') && !$PreventAdditions) { ?>
<div class="box box_addartist">
<div class="head"><strong>Add Artists</strong><span class="float_right"><a href="#" onclick="$('.add_artist_container').toggle_class('hidden'); this.innerHTML = (this.innerHTML == 'Batch add' ? 'Individual add' : 'Batch add'); return false;" class="brackets">Batch add</a></span></div>
<div class="pad add_artist_container">
<form class="add_form" name="artist" action="collages.php" method="post">
<input type="hidden" name="action" value="add_artist" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="collageid" value="<?=$CollageID?>" />
<input type="text" size="20" name="url" />
<input type="submit" value="+" />
<br />
<span style="font-style: italic;">Enter the URL of an artist on the site.</span>
</form>
</div>
<div class="pad hidden add_artist_container">
<form class="add_form" name="artists" action="collages.php" method="post">
<input type="hidden" name="action" value="add_artist_batch" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="collageid" value="<?=$CollageID?>" />
<textarea name="urls" rows="5" cols="25" style="white-space: nowrap;"></textarea><br />
<input type="submit" value="Add" />
<br />
<span style="font-style: italic;">Enter the URLs of artists on the site, one per line.</span>
</form>
</div>
</div>
<? } ?>
<h3>Comments</h3>
<?
if (empty($CommentList)) {
$DB->query("
SELECT
cc.ID,
cc.Body,
cc.UserID,
um.Username,
cc.Time
FROM collages_comments AS cc
LEFT JOIN users_main AS um ON um.ID=cc.UserID
WHERE CollageID='$CollageID'
ORDER BY ID DESC
LIMIT 15");
$CommentList = $DB->to_array(false, MYSQLI_NUM);
}
foreach ($CommentList as $Comment) {
list($CommentID, $Body, $UserID, $Username, $CommentTime) = $Comment;
?>
<div class="box comment">
<div class="head">
<?=Users::format_username($UserID, false, false, false) ?> <?=time_diff($CommentTime) ?>
<br />
<a href="reports.php?action=report&amp;type=collages_comment&amp;id=<?=$CommentID?>" class="brackets">Report</a>
</div>
<div class="pad"><?=$Text->full_format($Body)?></div>
</div>
<?
}
?>
<div class="box pad">
<a href="collages.php?action=comments&amp;collageid=<?=$CollageID?>" class="brackets">View all comments</a>
</div>
<?
if (!$LoggedUser['DisablePosting']) {
?>
<div class="box box_addcomment">
<div class="head"><strong>Add comment</strong></div>
<form class="send_form" name="comment" id="quickpostform" onsubmit="quickpostform.submit_button.disabled=true;" action="collages.php" method="post">
<input type="hidden" name="action" value="add_comment" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="collageid" value="<?=$CollageID?>" />
<div class="pad">
<textarea name="body" cols="24" rows="5"></textarea>
<br />
<input type="submit" id="submit_button" value="Add comment" />
</div>
</form>
</div>
<?
}
?>
</div>
<div class="main_column">
<?
if ($CollageCovers != 0) { ?>
<div id="coverart" class="box">
<div class="head" id="coverhead"><strong>Cover art</strong></div>
<ul class="collage_images" id="collage_page0">
<?
$Page1 = array_slice($Collage, 0, $CollageCovers);
foreach ($Page1 as $Group) {
echo $Group;
}?>
</ul>
</div>
<? if ($NumGroups > $CollageCovers) { ?>
<div class="linkbox pager" style="clear: left;" id="pageslinksdiv">
<span id="firstpage" class="invisible"><a href="#" class="pageslink" onclick="collageShow.page(0, this); return false;"><strong>&lt;&lt; First</strong></a> | </span>
<span id="prevpage" class="invisible"><a href="#" class="pageslink" onclick="collageShow.prevPage(); return false;"><strong>&lt; Prev</strong></a> | </span>
<? for ($i = 0; $i < $NumGroups / $CollageCovers; $i++) { ?>
<span id="pagelink<?=$i?>" class="<?=(($i > 4) ? 'hidden' : '')?><?=(($i == 0) ? 'selected' : '')?>"><a href="#" class="pageslink" onclick="collageShow.page(<?=$i?>, this); return false;"><strong><?=$CollageCovers * $i + 1?>-<?=min($NumGroups,$CollageCovers * ($i + 1))?></strong></a><?=(($i != ceil($NumGroups / $CollageCovers) - 1) ? ' | ' : '')?></span>
<? } ?>
<span id="nextbar" class="<?=($NumGroups / $CollageCovers > 5) ? 'hidden' : ''?>"> | </span>
<span id="nextpage"><a href="#" class="pageslink" onclick="collageShow.nextPage(); return false;"><strong>Next &gt;</strong></a></span>
<span id="lastpage" class="<?=(ceil($NumGroups / $CollageCovers) == 2 ? 'invisible' : '')?>"> | <a href="#" class="pageslink" onclick="collageShow.page(<?=ceil($NumGroups / $CollageCovers) - 1?>, this); return false;"><strong>Last &gt;&gt;</strong></a></span>
</div>
<script type="text/javascript">//<![CDATA[
collageShow.init(<?=json_encode($CollagePages)?>);
//]]></script>
<? }
} ?>
<table class="artist_table grouping cats" id="discog_table">
<tr class="colhead_dark">
<td><strong>Artists</strong></td>
</tr>
<?=$ArtistTable?>
</table>
</div>
</div>
<?
View::show_footer();
$Cache->cache_value('collage_'.$CollageID, array(array($Name, $Description, array(), array(), $CommentList, $Deleted, $CollageCategoryID, $CreatorID, $Locked, $MaxGroups, $MaxGroupsPerUser)), 3600);
?>

View File

@ -7,9 +7,9 @@
list($Page,$Limit) = Format::page_limit(COLLAGES_PER_PAGE);
$OrderVals = array('Time', 'Name', 'Torrents');
$OrderVals = array('Time', 'Name', 'Subscribers', 'Torrents', 'Updated');
$WayVals = array('Ascending', 'Descending');
$OrderTable = array('Time'=>'ID', 'Name'=>'c.Name', 'Torrents'=>'NumTorrents');
$OrderTable = array('Time'=>'ID', 'Name'=>'c.Name', 'Subscribers'=> 'c.Subscribers', 'Torrents'=>'NumTorrents', 'Updated' => 'c.Updated');
$WayTable = array('Ascending'=>'ASC', 'Descending'=>'DESC');
// Are we searching in bodies, or just names?
@ -45,7 +45,7 @@
}
$Categories = array_keys($Categories);
} else {
$Categories = array(1,2,3,4,5,6);
$Categories = array(1,2,3,4,5,6,7);
}
// Ordering
@ -77,7 +77,9 @@
c.NumTorrents,
c.TagList,
c.CategoryID,
c.UserID
c.UserID,
c.Subscribers,
c.Updated
FROM collages AS c
$BookmarkJoin
WHERE Deleted = '0'";
@ -286,12 +288,14 @@
<td>Category</td>
<td>Collage</td>
<td>Torrents</td>
<td>Subscribers</td>
<td>Updated</td>
<td>Author</td>
</tr>
<?
$Row = 'a'; // For the pretty colours
foreach ($Collages as $Collage) {
list($ID, $Name, $NumTorrents, $TagList, $CategoryID, $UserID) = $Collage;
list($ID, $Name, $NumTorrents, $TagList, $CategoryID, $UserID, $Subscribers, $Updated) = $Collage;
$Row = ($Row == 'a') ? 'b' : 'a';
$TorrentTags = new Tags($TagList);
@ -311,6 +315,8 @@
<div class="tags"><?=$TorrentTags->format('collages.php?action=search&amp;tags=')?></div>
</td>
<td><?=number_format((int)$NumTorrents)?></td>
<td><?=number_format((int)$Subscribers)?></td>
<td><?=time_diff($Updated)?></td>
<td><?=Users::format_username($UserID, false, false, false)?></td>
</tr>
<?

View File

@ -63,563 +63,9 @@ function compare($X, $Y) {
}
$DB->query("UPDATE users_collage_subs SET LastVisit=NOW() WHERE UserID = ".$LoggedUser['ID']." AND CollageID=$CollageID");
// Build the data for the collage and the torrent list
$DB->query("SELECT ct.GroupID,
tg.WikiImage,
tg.CategoryID,
um.ID,
um.Username
FROM collages_torrents AS ct
JOIN torrents_group AS tg ON tg.ID=ct.GroupID
LEFT JOIN users_main AS um ON um.ID=ct.UserID
WHERE ct.CollageID='$CollageID'
ORDER BY ct.Sort");
$GroupIDs = $DB->collect('GroupID');
$CollageDataList = $DB->to_array('GroupID', MYSQLI_ASSOC);
if (count($GroupIDs) > 0) {
$TorrentList = Torrents::get_groups($GroupIDs);
$TorrentList = $TorrentList['matches'];
if($CollageCategoryID == array_search(ARTIST_COLLAGE, $CollageCats)) {
include(SERVER_ROOT.'/sections/collages/artist_collage.php');
} else {
$TorrentList = array();
include(SERVER_ROOT.'/sections/collages/torrent_collage.php');
}
// Loop through the result set, building up $Collage and $TorrentTable
// Then we print them.
$Collage = array();
$TorrentTable = '';
$NumGroups = 0;
$NumGroupsByUser = 0;
$TopArtists = array();
$Users = array();
$Number = 0;
foreach ($TorrentList as $GroupID => $Group) {
extract(Torrents::array_group($Group));
list( , , , $UserID, $Username) = array_values($CollageDataList[$GroupID]);
$TorrentTags = new Tags($TagList);
// Handle stats and stuff
$Number++;
$NumGroups++;
if ($UserID == $LoggedUser['ID']) {
$NumGroupsByUser++;
}
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
$CountArtists = array_merge((array)$ExtendedArtists[1], (array)$ExtendedArtists[4], (array)$ExtendedArtists[5], (array)$ExtendedArtists[6]);
} else {
$CountArtists = $GroupArtists;
}
if ($CountArtists) {
foreach ($CountArtists as $Artist) {
if (!isset($TopArtists[$Artist['id']])) {
$TopArtists[$Artist['id']] = array('name'=>$Artist['name'], 'count'=>1);
} else {
$TopArtists[$Artist['id']]['count']++;
}
}
}
if ($Username) {
if (!isset($Users[$UserID])) {
$Users[$UserID] = array('name'=>$Username, 'count'=>1);
} else {
$Users[$UserID]['count']++;
}
}
$DisplayName = $Number.' - ';
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5])|| !empty($ExtendedArtists[6])) {
unset($ExtendedArtists[2]);
unset($ExtendedArtists[3]);
$DisplayName .= Artists::display_artists($ExtendedArtists);
} elseif (count($GroupArtists) > 0) {
$DisplayName .= Artists::display_artists(array('1'=>$GroupArtists));
}
$DisplayName .= '<a href="torrents.php?id='.$GroupID.'" title="View Torrent" dir="ltr">'.$GroupName.'</a>';
if ($GroupYear > 0) {
$DisplayName = "$DisplayName [$GroupYear]";
}
if ($GroupVanityHouse) {
$DisplayName .= ' [<abbr title="This is a Vanity House release">VH</abbr>]';
}
$SnatchedGroupClass = $GroupFlags['IsSnatched'] ? ' snatched_group' : '';
// Start an output buffer, so we can store this output in $TorrentTable
ob_start();
if (count($Torrents) > 1 || $GroupCategoryID == 1) {
// Grouped torrents
$ShowGroups = !(!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] == 1);
?>
<tr class="group discog<?=$SnatchedGroupClass?>" id="group_<?=$GroupID?>">
<td class="center">
<div title="View" id="showimg_<?=$GroupID?>" class="<?=($ShowGroups ? 'hide' : 'show')?>_torrents">
<a href="#" class="show_torrents_link" onclick="toggle_group(<?=$GroupID?>, this, event)" title="Collapse this group. Hold &quot;Ctrl&quot; while clicking to collapse all groups on this page."></a>
</div>
</td>
<td class="center">
<div title="<?=$TorrentTags->title()?>" class="<?=Format::css_category($GroupCategoryID)?> <?=$TorrentTags->css_name()?>"></div>
</td>
<td colspan="5">
<strong><?=$DisplayName?></strong> <?Votes::vote_link($GroupID,$UserVotes[$GroupID]['Type']);?>
<div class="tags"><?=$TorrentTags->format()?></div>
</td>
</tr>
<?
$LastRemasterYear = '-';
$LastRemasterTitle = '';
$LastRemasterRecordLabel = '';
$LastRemasterCatalogueNumber = '';
$LastMedia = '';
$EditionID = 0;
unset($FirstUnknown);
foreach ($Torrents as $TorrentID => $Torrent) {
if ($Torrent['Remastered'] && !$Torrent['RemasterYear']) {
$FirstUnknown = !isset($FirstUnknown);
}
$SnatchedTorrentClass = $Torrent['IsSnatched'] ? ' snatched_torrent' : '';
if ($Torrent['RemasterTitle'] != $LastRemasterTitle || $Torrent['RemasterYear'] != $LastRemasterYear ||
$Torrent['RemasterRecordLabel'] != $LastRemasterRecordLabel || $Torrent['RemasterCatalogueNumber'] != $LastRemasterCatalogueNumber || $FirstUnknown || $Torrent['Media'] != $LastMedia) {
$EditionID++;
?>
<tr class="group_torrent groupid_<?=$GroupID?> edition<?=$SnatchedGroupClass . (!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] == 1 ? ' hidden' : '')?>">
<td colspan="7" class="edition_info"><strong><a href="#" onclick="toggle_edition(<?=$GroupID?>, <?=$EditionID?>, this, event)" title="Collapse this edition. Hold &quot;Ctrl&quot; while clicking to collapse all editions in this torrent group.">&minus;</a> <?=Torrents::edition_string($Torrent, $Group)?></strong></td>
</tr>
<?
}
$LastRemasterTitle = $Torrent['RemasterTitle'];
$LastRemasterYear = $Torrent['RemasterYear'];
$LastRemasterRecordLabel = $Torrent['RemasterRecordLabel'];
$LastRemasterCatalogueNumber = $Torrent['RemasterCatalogueNumber'];
$LastMedia = $Torrent['Media'];
?>
<tr class="group_torrent torrent_row groupid_<?=$GroupID?> edition_<?=$EditionID?><?=$SnatchedTorrentClass . $SnatchedGroupClass . (!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] == 1 ? ' hidden' : '')?>">
<td colspan="3">
<span class="brackets">
<a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download">DL</a>
<? if (Torrents::can_use_token($Torrent)) { ?>
| <a href="torrents.php?action=download&amp;id=<?=$TorrentID ?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>&amp;usetoken=1" title="Use a FL Token" onclick="return confirm('Are you sure you want to use a freeleech token here?');">FL</a>
<? } ?>
| <a href="reportsv2.php?action=report&amp;id=<?=$TorrentID?>" title="Report">RP</a>
</span>
&nbsp;&nbsp;&raquo;&nbsp; <a href="torrents.php?id=<?=$GroupID?>&amp;torrentid=<?=$TorrentID?>"><?=Torrents::torrent_info($Torrent)?></a>
</td>
<td class="nobr"><?=Format::get_size($Torrent['Size'])?></td>
<td><?=number_format($Torrent['Snatched'])?></td>
<td<?=(($Torrent['Seeders'] == 0) ? ' class="r00"' : '')?>><?=number_format($Torrent['Seeders'])?></td>
<td><?=number_format($Torrent['Leechers'])?></td>
</tr>
<?
}
} else {
// Viewing a type that does not require grouping
list($TorrentID, $Torrent) = each($Torrents);
$DisplayName = '<a href="torrents.php?id='.$GroupID.'" title="View Torrent" dir="ltr">'.$GroupName.'</a>';
if ($Torrent['IsSnatched']) {
$DisplayName .= ' ' . Format::torrent_label('Snatched!');
}
if ($Torrent['FreeTorrent'] == '1') {
$DisplayName .= ' ' . Format::torrent_label('Freeleech!');
} elseif ($Torrent['FreeTorrent'] == '2') {
$DisplayName .= ' ' . Format::torrent_label('Neutral Leech!');
} elseif ($Torrent['PersonalFL']) {
$DisplayName .= ' ' . Format::torrent_label('Personal Freeleech!');
}
$SnatchedTorrentClass = $Torrent['IsSnatched'] ? ' snatched_torrent' : '';
?>
<tr class="torrent torrent_row<?=$SnatchedTorrentClass . $SnatchedGroupClass?>" id="group_<?=$GroupID?>">
<td></td>
<td class="center">
<div title="<?=$TorrentTags->title()?>" class="<?=Format::css_category($GroupCategoryID)?> <?=$TorrentTags->css_name()?>">
</div>
</td>
<td>
<span class="brackets">
<a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download">DL</a>
<? if (Torrents::can_use_token($Torrent)) { ?>
| <a href="torrents.php?action=download&amp;id=<?=$TorrentID ?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>&amp;usetoken=1" title="Use a FL Token" onclick="return confirm('Are you sure you want to use a freeleech token here?');">FL</a>
<? } ?>
| <a href="reportsv2.php?action=report&amp;id=<?=$TorrentID?>" title="Report">RP</a>
</span>
<strong><?=$DisplayName?></strong> <?Votes::vote_link($GroupID,$UserVotes[$GroupID]['Type']);?>
<div class="tags"><?=$TorrentTags->format()?></div>
</td>
<td class="nobr"><?=Format::get_size($Torrent['Size'])?></td>
<td><?=number_format($Torrent['Snatched'])?></td>
<td<?=($Torrent['Seeders'] == 0) ? ' class="r00"' : '' ?>><?=number_format($Torrent['Seeders'])?></td>
<td><?=number_format($Torrent['Leechers'])?></td>
</tr>
<?
}
$TorrentTable.=ob_get_clean();
// Album art
ob_start();
$DisplayName = '';
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5])|| !empty($ExtendedArtists[6])) {
unset($ExtendedArtists[2]);
unset($ExtendedArtists[3]);
$DisplayName .= Artists::display_artists($ExtendedArtists, false);
} elseif (count($GroupArtists) > 0) {
$DisplayName .= Artists::display_artists(array('1'=>$GroupArtists), false);
}
$DisplayName .= $GroupName;
if ($GroupYear > 0) {
$DisplayName = $DisplayName. " [$GroupYear]";
}
?>
<li class="image_group_<?=$GroupID?>">
<a href="torrents.php?id=<?=$GroupID?>">
<? if ($WikiImage) {
?>
<img src="<?=ImageTools::process($WikiImage, true)?>" alt="<?=$DisplayName?>" title="<?=$DisplayName?>" width="118" />
<? } else { ?>
<span style="width: 107px; padding: 5px;"><?=$DisplayName?></span>
<? } ?>
</a>
</li>
<?
$Collage[] = ob_get_clean();
}
if (!check_perms('site_collages_delete') && ($Locked || ($MaxGroups > 0 && $NumGroups >= $MaxGroups) || ($MaxGroupsPerUser > 0 && $NumGroupsByUser >= $MaxGroupsPerUser))) {
$PreventAdditions = true;
}
// Silly hack for people who are on the old setting
$CollageCovers = isset($LoggedUser['CollageCovers']) ? $LoggedUser['CollageCovers'] : 25 * (abs($LoggedUser['HideCollage'] - 1));
$CollagePages = array();
// Pad it out
if ($NumGroups > $CollageCovers) {
for ($i = $NumGroups + 1; $i <= ceil($NumGroups / $CollageCovers) * $CollageCovers; $i++) {
$Collage[] = '<li></li>';
}
}
for ($i = 0; $i < $NumGroups / $CollageCovers; $i++) {
$Groups = array_slice($Collage, $i * $CollageCovers, $CollageCovers);
$CollagePage = '';
foreach ($Groups as $Group) {
$CollagePage .= $Group;
}
$CollagePages[] = $CollagePage;
}
View::show_header($Name,'browse,collage,bbcode,voting,jquery,recommend');
?>
<div class="thin">
<div class="header">
<h2><?=$Name?></h2>
<div class="linkbox">
<a href="collages.php" class="brackets">List of collages</a>
<? if (check_perms('site_collages_create')) { ?>
<a href="collages.php?action=new" class="brackets">New collage</a>
<? } ?>
<br /><br />
<? if (check_perms('site_collages_subscribe')) { ?>
<a href="#" id="subscribelink<?=$CollageID?>" class="brackets" onclick="CollageSubscribe(<?=$CollageID?>);return false;"><?=(in_array($CollageID, $CollageSubscriptions) ? 'Unsubscribe' : 'Subscribe')?></a>
<? }
if (check_perms('site_collages_delete') || (check_perms('site_edit_wiki') && !$Locked)) { ?>
<a href="collages.php?action=edit&amp;collageid=<?=$CollageID?>" class="brackets">Edit description</a>
<? } else { ?>
<span class="brackets">Locked</span>
<? }
if (Bookmarks::has_bookmarked('collage', $CollageID)) {
?>
<a href="#" id="bookmarklink_collage_<?=$CollageID?>" class="brackets" onclick="Unbookmark('collage', <?=$CollageID?>,'Bookmark');return false;">Remove bookmark</a>
<? } else { ?>
<a href="#" id="bookmarklink_collage_<?=$CollageID?>" class="brackets" onclick="Bookmark('collage', <?=$CollageID?>,'Remove bookmark');return false;">Bookmark</a>
<? }
?>
<!-- <a href="#" id="recommend" class="brackets">Recommend</a> -->
<?
if (check_perms('site_collages_manage') && !$Locked) { ?>
<a href="collages.php?action=manage&amp;collageid=<?=$CollageID?>" class="brackets">Manage torrents</a>
<? } ?>
<a href="reports.php?action=report&amp;type=collage&amp;id=<?=$CollageID?>" class="brackets">Report collage</a>
<? if (check_perms('site_collages_delete') || $CreatorID == $LoggedUser['ID']) { ?>
<a href="collages.php?action=delete&amp;collageid=<?=$CollageID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets" onclick="return confirm('Are you sure you want to delete this collage?');">Delete</a>
<? } ?>
</div>
</div>
<? /* Misc::display_recommend($CollageID, "collage"); */ ?>
<div class="sidebar">
<div class="box box_category">
<div class="head"><strong>Category</strong></div>
<div class="pad"><a href="collages.php?action=search&amp;cats[<?=(int)$CollageCategoryID?>]=1"><?=$CollageCats[(int)$CollageCategoryID]?></a></div>
</div>
<div class="box box_description">
<div class="head"><strong>Description</strong></div>
<div class="pad"><?=$Text->full_format($Description)?></div>
</div>
<?
if (check_perms('zip_downloader')) {
if (isset($LoggedUser['Collector'])) {
list($ZIPList,$ZIPPrefs) = $LoggedUser['Collector'];
$ZIPList = explode(':',$ZIPList);
} else {
$ZIPList = array('00','11');
$ZIPPrefs = 1;
}
?>
<div class="box box_zipdownload">
<div class="head colhead_dark"><strong>Collector</strong></div>
<div class="pad">
<form class="download_form" name="zip" action="collages.php" method="post">
<input type="hidden" name="action" value="download" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="collageid" value="<?=$CollageID?>" />
<ul id="list" class="nobullet">
<? foreach ($ZIPList as $ListItem) { ?>
<li id="list<?=$ListItem?>">
<input type="hidden" name="list[]" value="<?=$ListItem?>" />
<span class="float_left"><?=$ZIPOptions[$ListItem]['2']?></span>
<span class="remove remove_collector"><a href="#" onclick="remove_selection('<?=$ListItem?>');return false;" class="float_right brackets">X</a></span>
<br style="clear: all;" />
</li>
<? } ?>
</ul>
<select id="formats" style="width:180px">
<?
$OpenGroup = false;
$LastGroupID = -1;
foreach ($ZIPOptions as $Option) {
list($GroupID,$OptionID,$OptName) = $Option;
if ($GroupID != $LastGroupID) {
$LastGroupID = $GroupID;
if ($OpenGroup) { ?>
</optgroup>
<? } ?>
<optgroup label="<?=$ZIPGroups[$GroupID]?>">
<? $OpenGroup = true;
}
?>
<option id="opt<?=$GroupID.$OptionID?>" value="<?=$GroupID.$OptionID?>"<? if (in_array($GroupID.$OptionID, $ZIPList)) { echo ' disabled="disabled"'; } ?>><?=$OptName?></option>
<?
}
?>
</optgroup>
</select>
<button type="button" onclick="add_selection()">+</button>
<select name="preference" style="width: 210px;">
<option value="0"<? if ($ZIPPrefs == 0) { echo ' selected="selected"'; } ?>>Prefer Original</option>
<option value="1"<? if ($ZIPPrefs == 1) { echo ' selected="selected"'; } ?>>Prefer Best Seeded</option>
<option value="2"<? if ($ZIPPrefs == 2) { echo ' selected="selected"'; } ?>>Prefer Bonus Tracks</option>
</select>
<input type="submit" style="width: 210px;" value="Download" />
</form>
</div>
</div>
<? } ?>
<div class="box box_info box_statistics_collage_torrents">
<div class="head"><strong>Stats</strong></div>
<ul class="stats nobullet">
<li>Torrents: <?=number_format($NumGroups)?></li>
<? if (!empty($TopArtists)) { ?>
<li>Artists: <?=number_format(count($TopArtists))?></li>
<? } ?>
<li>Built by <?=number_format(count($Users))?> user<?=(count($Users) > 1 ? 's' : '')?></li>
</ul>
</div>
<div class="box box_tags">
<div class="head"><strong>Top tags</strong></div>
<div class="pad">
<ol style="padding-left: 5px;">
<?
Tags::format_top(5, 'collages.php?action=search&amp;tags=');
?>
</ol>
</div>
</div>
<? if (!empty($TopArtists)) { ?>
<div class="box box_artists">
<div class="head"><strong>Top artists</strong></div>
<div class="pad">
<ol style="padding-left: 5px;">
<?
uasort($TopArtists, 'compare');
$i = 0;
foreach ($TopArtists as $ID => $Artist) {
$i++;
if ($i > 10) {
break;
}
?>
<li><a href="artist.php?id=<?=$ID?>"><?=$Artist['name']?></a> (<?=number_format($Artist['count'])?>)</li>
<?
}
?>
</ol>
</div>
</div>
<? } ?>
<div class="box box_contributors">
<div class="head"><strong>Top contributors</strong></div>
<div class="pad">
<ol style="padding-left: 5px;">
<?
uasort($Users, 'compare');
$i = 0;
foreach ($Users as $ID => $User) {
$i++;
if ($i > 5) {
break;
}
?>
<li><?=Users::format_username($ID, false, false, false)?> (<?=number_format($User['count'])?>)</li>
<?
}
?>
</ol>
</div>
</div>
<? if (check_perms('site_collages_manage') && !$PreventAdditions) { ?>
<div class="box box_addtorrent">
<div class="head"><strong>Add torrent</strong><span class="float_right"><a href="#" onclick="$('.add_torrent_container').toggle_class('hidden'); this.innerHTML = (this.innerHTML == 'Batch add' ? 'Individual add' : 'Batch add'); return false;" class="brackets">Batch add</a></span></div>
<div class="pad add_torrent_container">
<form class="add_form" name="torrent" action="collages.php" method="post">
<input type="hidden" name="action" value="add_torrent" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="collageid" value="<?=$CollageID?>" />
<input type="text" size="20" name="url" />
<input type="submit" value="+" />
<br />
<span style="font-style: italic;">Enter the URL of a torrent on the site.</span>
</form>
</div>
<div class="pad hidden add_torrent_container">
<form class="add_form" name="torrents" action="collages.php" method="post">
<input type="hidden" name="action" value="add_torrent_batch" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="collageid" value="<?=$CollageID?>" />
<textarea name="urls" rows="5" cols="25" style="white-space: nowrap;"></textarea><br />
<input type="submit" value="Add" />
<br />
<span style="font-style: italic;">Enter the URLs of torrents on the site, one per line.</span>
</form>
</div>
</div>
<? } ?>
<h3>Comments</h3>
<?
if (empty($CommentList)) {
$DB->query("
SELECT
cc.ID,
cc.Body,
cc.UserID,
um.Username,
cc.Time
FROM collages_comments AS cc
LEFT JOIN users_main AS um ON um.ID=cc.UserID
WHERE CollageID='$CollageID'
ORDER BY ID DESC
LIMIT 15");
$CommentList = $DB->to_array(false, MYSQLI_NUM);
}
foreach ($CommentList as $Comment) {
list($CommentID, $Body, $UserID, $Username, $CommentTime) = $Comment;
?>
<div class="box comment">
<div class="head">
<?=Users::format_username($UserID, false, false, false) ?> <?=time_diff($CommentTime) ?>
<br />
<a href="reports.php?action=report&amp;type=collages_comment&amp;id=<?=$CommentID?>" class="brackets">Report</a>
</div>
<div class="pad"><?=$Text->full_format($Body)?></div>
</div>
<?
}
?>
<div class="box pad">
<a href="collages.php?action=comments&amp;collageid=<?=$CollageID?>" class="brackets">View all comments</a>
</div>
<?
if (!$LoggedUser['DisablePosting']) {
?>
<div class="box box_addcomment">
<div class="head"><strong>Add comment</strong></div>
<form class="send_form" name="comment" id="quickpostform" onsubmit="quickpostform.submit_button.disabled=true;" action="collages.php" method="post">
<input type="hidden" name="action" value="add_comment" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="collageid" value="<?=$CollageID?>" />
<div class="pad">
<textarea name="body" cols="24" rows="5"></textarea>
<br />
<input type="submit" id="submit_button" value="Add comment" />
</div>
</form>
</div>
<?
}
?>
</div>
<div class="main_column">
<?
if ($CollageCovers != 0) { ?>
<div id="coverart" class="box">
<div class="head" id="coverhead"><strong>Cover art</strong></div>
<ul class="collage_images" id="collage_page0">
<?
$Page1 = array_slice($Collage, 0, $CollageCovers);
foreach ($Page1 as $Group) {
echo $Group;
} ?>
</ul>
</div>
<? if ($NumGroups > $CollageCovers) { ?>
<div class="linkbox pager" style="clear: left;" id="pageslinksdiv">
<span id="firstpage" class="invisible"><a href="#" class="pageslink" onclick="collageShow.page(0, this); return false;"><strong>&lt;&lt; First</strong></a> | </span>
<span id="prevpage" class="invisible"><a href="#" class="pageslink" onclick="collageShow.prevPage(); return false;"><strong>&lt; Prev</strong></a> | </span>
<? for ($i = 0; $i < $NumGroups / $CollageCovers; $i++) { ?>
<span id="pagelink<?=$i?>" class="<?=(($i > 4) ? 'hidden' : '')?><?=(($i == 0) ? 'selected' : '')?>"><a href="#" class="pageslink" onclick="collageShow.page(<?=$i?>, this); return false;"><strong><?=$CollageCovers * $i + 1?>-<?=min($NumGroups,$CollageCovers * ($i + 1))?></strong></a><?=(($i != ceil($NumGroups / $CollageCovers) - 1) ? ' | ' : '')?></span>
<? } ?>
<span id="nextbar" class="<?=($NumGroups / $CollageCovers > 5) ? 'hidden' : ''?>"> | </span>
<span id="nextpage"><a href="#" class="pageslink" onclick="collageShow.nextPage(); return false;"><strong>Next &gt;</strong></a></span>
<span id="lastpage" class="<?=(ceil($NumGroups / $CollageCovers) == 2 ? 'invisible' : '')?>"> | <a href="#" class="pageslink" onclick="collageShow.page(<?=ceil($NumGroups / $CollageCovers) - 1?>, this); return false;"><strong>Last &gt;&gt;</strong></a></span>
</div>
<script type="text/javascript">//<![CDATA[
collageShow.init(<?=json_encode($CollagePages)?>);
//]]></script>
<? }
} ?>
<table class="torrent_table grouping cats" id="discog_table">
<tr class="colhead_dark">
<td><!-- expand/collapse --></td>
<td><!-- Category --></td>
<td width="70%"><strong>Torrents</strong></td>
<td>Size</td>
<td class="sign"><img src="static/styles/<?=$LoggedUser['StyleName'] ?>/images/snatched.png" alt="Snatches" title="Snatches" /></td>
<td class="sign"><img src="static/styles/<?=$LoggedUser['StyleName'] ?>/images/seeders.png" alt="Seeders" title="Seeders" /></td>
<td class="sign"><img src="static/styles/<?=$LoggedUser['StyleName'] ?>/images/leechers.png" alt="Leechers" title="Leechers" /></td>
</tr>
<?=$TorrentTable?>
</table>
</div>
</div>
<?
View::show_footer();
$Cache->cache_value('collage_'.$CollageID, array(array($Name, $Description, array(), array(), $CommentList, $Deleted, $CollageCategoryID, $CreatorID, $Locked, $MaxGroups, $MaxGroupsPerUser)), 3600);
?>

View File

@ -1,4 +1,5 @@
<?
define('ARTIST_COLLAGE', 'Artists');
enforce_login();
if (empty($_REQUEST['action'])) {
@ -25,6 +26,13 @@
}
require(SERVER_ROOT.'/sections/collages/add_torrent.php');
break;
case 'add_artist':
case 'add_artist_batch':
if (!check_perms('site_collages_manage')) {
error(403);
}
require(SERVER_ROOT.'/sections/collages/add_artist.php');
break;
case 'manage':
if (!check_perms('site_collages_manage')) {
error(403);
@ -37,6 +45,18 @@
}
require(SERVER_ROOT.'/sections/collages/manage_handle.php');
break;
case 'manage_artists':
if (!check_perms('site_collages_manage')) {
error(403);
}
require(SERVER_ROOT.'/sections/collages/manage_artists.php');
break;
case 'manage_artists_handle':
if (!check_perms('site_collages_manage')) {
error(403);
}
require(SERVER_ROOT.'/sections/collages/manage_artists_handle.php');
break;
case 'edit':
if (!check_perms('site_edit_wiki')) {
error(403);

View File

@ -10,7 +10,6 @@
if ($CategoryID == 0 && $UserID != $LoggedUser['ID'] && !check_perms('site_collages_delete')) {
error(403);
}
$DB->query("
SELECT
ct.GroupID,
@ -69,13 +68,13 @@
<table id="manage_collage_table">
<thead>
<tr class="colhead">
<th style="width: 7%">Order</th>
<th style="width: 1%"><span><abbr title="Current Rank">#</abbr></span></th>
<th style="width: 7%"><span>Cat #</span></th>
<th style="width: 1%"><span>Year</span></th>
<th style="width: 15%"><span>Artist</span></th>
<th style="width: 7%;">Order</th>
<th style="width: 1%;"><span><abbr title="Current rank">#</abbr></span></th>
<th style="width: 7%;"><span>Cat #</span></th>
<th style="width: 1%;"><span>Year</span></th>
<th style="width: 15%;"><span>Artist</span></th>
<th><span>Torrent</span></th>
<th style="width: 1%"><span>User</span></th>
<th style="width: 1%;"><span>User</span></th>
<th style="width: 1%; text-align: right;" class="nobr"><span><abbr title="Modify an individual row.">Tweak</abbr></span></th>
</tr>
</thead>

View File

@ -0,0 +1,115 @@
<?
$CollageID = $_GET['collageid'];
if (!is_number($CollageID)) {
error(0);
}
$DB->query("SELECT Name, UserID, CategoryID FROM collages WHERE ID='$CollageID'");
list($Name, $UserID, $CategoryID) = $DB->next_record();
if ($CategoryID == 0 && $UserID != $LoggedUser['ID'] && !check_perms('site_collages_delete')) {
error(403);
}
if($CategoryID != array_search(ARTIST_COLLAGE, $CollageCats)) {
error(403);
}
$DB->query("SELECT
ca.ArtistID,
ag.Name,
um.ID AS UserID,
um.Username,
ca.Sort
FROM collages_artists AS ca
JOIN artists_group AS ag ON ag.ArtistID=ca.ArtistID
LEFT JOIN users_main AS um ON um.ID=ca.UserID
WHERE ca.CollageID='$CollageID'
ORDER BY ca.Sort");
$Artists = $DB->to_array('ArtistID', MYSQLI_ASSOC);
View::show_header('Manage collage '.$Name);
?>
<script src="static/functions/jquery.js" type="text/javascript"></script>
<script type="text/javascript">$.noConflict();</script>
<script src="static/functions/jquery-ui.js" type="text/javascript"></script>
<script src="static/functions/jquery.tablesorter.min.js" type="text/javascript"></script>
<script src="static/functions/sort.js" type="text/javascript"></script>
<div class="thin">
<div class="header">
<h2>Manage collage <a href="collages.php?id=<?=$CollageID?>"><?=$Name?></a></h2>
</div>
<table width="100%" class="layout">
<tr class="colhead"><td id="sorting_head">Sorting</td></tr>
<tr>
<td id="drag_drop_textnote">
<ul>
<li>Click on the headings to organize columns automatically.</li>
<li>Sort multiple columns simultaneously by holding down the shift key and clicking other column headers.</li>
<li>Click and drag any row to change its order.</li>
<li>Press "Save All Changes" when you are finished sorting.</li>
<li>Press "Edit" or "Remove" to simply modify one entry.</li>
</ul>
<noscript><ul><li><strong class="important_text">Note: Enable JavaScript!</strong></li></ul></noscript>
</td>
</tr>
</table>
<div class="drag_drop_save hidden">
<input type="button" name="submit" value="Save All Changes" title="Save your changes." class="save_sortable_collage" />
</div>
<table id="manage_collage_table">
<thead>
<tr class="colhead">
<th style="width: 7%">Order</th>
<th style="width: 1%"><span><abbr title="Current Rank">#</abbr></span></th>
<th style="text-align: left;"><span>Artist</span></th>
<th style="width: 7%"><span>User</span></th>
<th style="width: 7%; text-align: right;" class="nobr"><span><abbr title="Modify an individual row.">Tweak</abbr></span></th>
</tr>
</thead>
<tbody>
<?
$Number = 0;
foreach ($Artists as $Artist) {
$Number++;
$AltCSS = $Number % 2 === 0 ? 'rowa' : 'rowb';
?>
<tr class="drag <?=$AltCSS?>" id="li_<?=$Artist['ArtistID']?>">
<form class="manage_form" name="collage" action="collages.php" method="post">
<td>
<input class="sort_numbers" type="text" name="sort" value="<?=$Artist['Sort']?>" id="sort_<?=$Artist['ArtistID']?>" size="4" />
</td>
<td><?=$Number?></td>
<td><?=trim($Artist['Name']) ?: '&nbsp;'?></td>
<td class="nobr"><?=Users::format_username($Artist['UserID'], $$Artist['Username'], false, false, false)?></td>
<td class="nobr">
<input type="hidden" name="action" value="manage_artists_handle" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="collageid" value="<?=$CollageID?>" />
<input type="hidden" name="artistid" value="<?=$Artist['ArtistID']?>" />
<input type="submit" name="submit" value="Edit" />
<input type="submit" name="submit" value="Remove" />
</td>
</form>
</tr>
<? } ?>
</tbody>
</table>
<div class="drag_drop_save hidden">
<input type="button" name="submit" value="Save All Changes" title="Save your changes." class="save_sortable_collage" />
</div>
<form class="dragdrop_form hidden" name="collage" action="collages.php" method="post" id="drag_drop_collage_form">
<div>
<input type="hidden" name="action" value="manage_artists_handle" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="collageid" value="<?=$CollageID?>" />
<input type="hidden" name="artistid" value="1" />
<input type="hidden" name="drag_drop_collage_sort_order" id="drag_drop_collage_sort_order" readonly="readonly" value="" />
</div>
</form>
</div>
<? View::show_footer(); ?>

View File

@ -0,0 +1,59 @@
<?php
authorize();
$CollageID = $_POST['collageid'];
if (!is_number($CollageID)) {
error(404);
}
$DB->query("SELECT UserID, CategoryID FROM collages WHERE ID='$CollageID'");
list($UserID, $CategoryID) = $DB->next_record();
if ($CategoryID == 0 && $UserID != $LoggedUser['ID'] && !check_perms('site_collages_delete')) {
error(403);
}
if($CategoryID != array_search(ARTIST_COLLAGE, $CollageCats)) {
error(403);
}
$ArtistID = $_POST['artistid'];
if (!is_number($ArtistID)) {
error(404);
}
if ($_POST['submit'] == 'Remove') {
$DB->query("DELETE FROM collages_artists WHERE CollageID='$CollageID' AND ArtistID='$ArtistID'");
$Rows = $DB->affected_rows();
$DB->query("UPDATE collages SET NumTorrents=NumTorrents-$Rows WHERE ID='$CollageID'");
$Cache->delete_value('artists_collages_'.$ArtistID);
$Cache->delete_value('artists_collages_personal_'.$ArtistID);
} elseif (isset($_POST['drag_drop_collage_sort_order'])) {
@parse_str($_POST['drag_drop_collage_sort_order'], $Series);
$Series = @array_shift($Series);
if (is_array($Series)) {
$SQL = array();
foreach ($Series as $Sort => $ArtistID) {
if (is_number($Sort) && is_number($ArtistID)) {
$Sort = ($Sort + 1) * 10;
$SQL[] = sprintf('(%d, %d, %d)', $ArtistID, $Sort, $CollageID);
}
}
$SQL = 'INSERT INTO collages_artists (ArtistID, Sort, CollageID) VALUES '
. implode(', ', $SQL)
. ' ON DUPLICATE KEY UPDATE Sort = VALUES (Sort)';
$DB->query($SQL);
}
} else {
$Sort = $_POST['sort'];
if (!is_number($Sort)) {
error(404);
}
$DB->query("UPDATE collages_artists SET Sort='$Sort' WHERE CollageID='$CollageID' AND ArtistID='$ArtistID'");
}
$Cache->delete_value('collage_'.$CollageID);
header('Location: collages.php?action=manage_artists&collageid='.$CollageID);

View File

@ -13,6 +13,7 @@
error(403);
}
$GroupID = $_POST['groupid'];
if (!is_number($GroupID)) {
error(404);

View File

@ -0,0 +1,561 @@
<?
// Build the data for the collage and the torrent list
$DB->query("SELECT
ct.GroupID,
tg.WikiImage,
tg.CategoryID,
um.ID,
um.Username
FROM collages_torrents AS ct
JOIN torrents_group AS tg ON tg.ID=ct.GroupID
LEFT JOIN users_main AS um ON um.ID=ct.UserID
WHERE ct.CollageID='$CollageID'
ORDER BY ct.Sort");
$GroupIDs = $DB->collect('GroupID');
$CollageDataList = $DB->to_array('GroupID', MYSQLI_ASSOC);
if (count($GroupIDs) > 0) {
$TorrentList = Torrents::get_groups($GroupIDs);
$TorrentList = $TorrentList['matches'];
} else {
$TorrentList = array();
}
// Loop through the result set, building up $Collage and $TorrentTable
// Then we print them.
$Collage = array();
$TorrentTable = '';
$NumGroups = 0;
$NumGroupsByUser = 0;
$TopArtists = array();
$Users = array();
$Number = 0;
foreach ($TorrentList as $GroupID => $Group) {
extract(Torrents::array_group($Group));
list( , , , $UserID, $Username) = array_values($CollageDataList[$GroupID]);
$TorrentTags = new Tags($TagList);
// Handle stats and stuff
$Number++;
$NumGroups++;
if ($UserID == $LoggedUser['ID']) {
$NumGroupsByUser++;
}
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
$CountArtists = array_merge((array)$ExtendedArtists[1], (array)$ExtendedArtists[4], (array)$ExtendedArtists[5], (array)$ExtendedArtists[6]);
} else {
$CountArtists = $GroupArtists;
}
if ($CountArtists) {
foreach ($CountArtists as $Artist) {
if (!isset($TopArtists[$Artist['id']])) {
$TopArtists[$Artist['id']] = array('name'=>$Artist['name'], 'count'=>1);
} else {
$TopArtists[$Artist['id']]['count']++;
}
}
}
if ($Username) {
if (!isset($Users[$UserID])) {
$Users[$UserID] = array('name'=>$Username, 'count'=>1);
} else {
$Users[$UserID]['count']++;
}
}
$DisplayName = $Number.' - ';
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5])|| !empty($ExtendedArtists[6])) {
unset($ExtendedArtists[2]);
unset($ExtendedArtists[3]);
$DisplayName .= Artists::display_artists($ExtendedArtists);
} elseif (count($GroupArtists) > 0) {
$DisplayName .= Artists::display_artists(array('1'=>$GroupArtists));
}
$DisplayName .= '<a href="torrents.php?id='.$GroupID.'" title="View Torrent" dir="ltr">'.$GroupName.'</a>';
if ($GroupYear > 0) {
$DisplayName = "$DisplayName [$GroupYear]";
}
if ($GroupVanityHouse) {
$DisplayName .= ' [<abbr title="This is a Vanity House release">VH</abbr>]';
}
$SnatchedGroupClass = $GroupFlags['IsSnatched'] ? ' snatched_group' : '';
// Start an output buffer, so we can store this output in $TorrentTable
ob_start();
if (count($Torrents) > 1 || $GroupCategoryID == 1) {
// Grouped torrents
$ShowGroups = !(!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] == 1);
?>
<tr class="group discog<?=$SnatchedGroupClass?>" id="group_<?=$GroupID?>">
<td class="center">
<div title="View" id="showimg_<?=$GroupID?>" class="<?=($ShowGroups ? 'hide' : 'show')?>_torrents">
<a href="#" class="show_torrents_link" onclick="toggle_group(<?=$GroupID?>, this, event)" title="Collapse this group. Hold &quot;Ctrl&quot; while clicking to collapse all groups on this page."></a>
</div>
</td>
<td class="center">
<div title="<?=$TorrentTags->title()?>" class="<?=Format::css_category($GroupCategoryID)?> <?=$TorrentTags->css_name()?>"></div>
</td>
<td colspan="5">
<strong><?=$DisplayName?></strong> <?Votes::vote_link($GroupID,$UserVotes[$GroupID]['Type']);?>
<div class="tags"><?=$TorrentTags->format()?></div>
</td>
</tr>
<?
$LastRemasterYear = '-';
$LastRemasterTitle = '';
$LastRemasterRecordLabel = '';
$LastRemasterCatalogueNumber = '';
$LastMedia = '';
$EditionID = 0;
unset($FirstUnknown);
foreach ($Torrents as $TorrentID => $Torrent) {
if ($Torrent['Remastered'] && !$Torrent['RemasterYear']) {
$FirstUnknown = !isset($FirstUnknown);
}
$SnatchedTorrentClass = $Torrent['IsSnatched'] ? ' snatched_torrent' : '';
if ($Torrent['RemasterTitle'] != $LastRemasterTitle || $Torrent['RemasterYear'] != $LastRemasterYear ||
$Torrent['RemasterRecordLabel'] != $LastRemasterRecordLabel || $Torrent['RemasterCatalogueNumber'] != $LastRemasterCatalogueNumber || $FirstUnknown || $Torrent['Media'] != $LastMedia) {
$EditionID++;
?>
<tr class="group_torrent groupid_<?=$GroupID?> edition<?=$SnatchedGroupClass . (!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] == 1 ? ' hidden' : '')?>">
<td colspan="7" class="edition_info"><strong><a href="#" onclick="toggle_edition(<?=$GroupID?>, <?=$EditionID?>, this, event)" title="Collapse this edition. Hold &quot;Ctrl&quot; while clicking to collapse all editions in this torrent group.">&minus;</a> <?=Torrents::edition_string($Torrent, $Group)?></strong></td>
</tr>
<?
}
$LastRemasterTitle = $Torrent['RemasterTitle'];
$LastRemasterYear = $Torrent['RemasterYear'];
$LastRemasterRecordLabel = $Torrent['RemasterRecordLabel'];
$LastRemasterCatalogueNumber = $Torrent['RemasterCatalogueNumber'];
$LastMedia = $Torrent['Media'];
?>
<tr class="group_torrent torrent_row groupid_<?=$GroupID?> edition_<?=$EditionID?><?=$SnatchedTorrentClass . $SnatchedGroupClass . (!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] == 1 ? ' hidden' : '')?>">
<td colspan="3">
<span class="brackets">
<a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download">DL</a>
<? if (Torrents::can_use_token($Torrent)) { ?>
| <a href="torrents.php?action=download&amp;id=<?=$TorrentID ?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>&amp;usetoken=1" title="Use a FL Token" onclick="return confirm('Are you sure you want to use a freeleech token here?');">FL</a>
<? } ?>
| <a href="reportsv2.php?action=report&amp;id=<?=$TorrentID?>" title="Report">RP</a>
</span>
&nbsp;&nbsp;&raquo;&nbsp; <a href="torrents.php?id=<?=$GroupID?>&amp;torrentid=<?=$TorrentID?>"><?=Torrents::torrent_info($Torrent)?></a>
</td>
<td class="nobr"><?=Format::get_size($Torrent['Size'])?></td>
<td><?=number_format($Torrent['Snatched'])?></td>
<td<?=($Torrent['Seeders']==0)?' class="r00"':''?>><?=number_format($Torrent['Seeders'])?></td>
<td><?=number_format($Torrent['Leechers'])?></td>
</tr>
<?
}
} else {
// Viewing a type that does not require grouping
list($TorrentID, $Torrent) = each($Torrents);
$DisplayName = '<a href="torrents.php?id='.$GroupID.'" title="View Torrent" dir="ltr">'.$GroupName.'</a>';
if ($Torrent['IsSnatched']) {
$DisplayName .= ' ' . Format::torrent_label('Snatched!');
}
if ($Torrent['FreeTorrent'] == '1') {
$DisplayName .= ' ' . Format::torrent_label('Freeleech!');
} elseif ($Torrent['FreeTorrent'] == '2') {
$DisplayName .= ' ' . Format::torrent_label('Neutral Leech!');
} elseif ($Torrent['PersonalFL']) {
$DisplayName .= ' ' . Format::torrent_label('Personal Freeleech!');
}
$SnatchedTorrentClass = $Torrent['IsSnatched'] ? ' snatched_torrent' : '';
?>
<tr class="torrent torrent_row<?=$SnatchedTorrentClass . $SnatchedGroupClass?>" id="group_<?=$GroupID?>">
<td></td>
<td class="center">
<div title="<?=$TorrentTags->title()?>" class="<?=Format::css_category($GroupCategoryID)?> <?=$TorrentTags->css_name()?>">
</div>
</td>
<td>
<span class="brackets">
<a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download">DL</a>
<? if (Torrents::can_use_token($Torrent)) { ?>
| <a href="torrents.php?action=download&amp;id=<?=$TorrentID ?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>&amp;usetoken=1" title="Use a FL Token" onclick="return confirm('Are you sure you want to use a freeleech token here?');">FL</a>
<? } ?>
| <a href="reportsv2.php?action=report&amp;id=<?=$TorrentID?>" title="Report">RP</a>
</span>
<strong><?=$DisplayName?></strong> <?Votes::vote_link($GroupID,$UserVotes[$GroupID]['Type']);?>
<div class="tags"><?=$TorrentTags->format()?></div>
</td>
<td class="nobr"><?=Format::get_size($Torrent['Size'])?></td>
<td><?=number_format($Torrent['Snatched'])?></td>
<td<?=($Torrent['Seeders'] == 0) ? ' class="r00"' : '' ?>><?=number_format($Torrent['Seeders'])?></td>
<td><?=number_format($Torrent['Leechers'])?></td>
</tr>
<?
}
$TorrentTable.=ob_get_clean();
// Album art
ob_start();
$DisplayName = '';
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5])|| !empty($ExtendedArtists[6])) {
unset($ExtendedArtists[2]);
unset($ExtendedArtists[3]);
$DisplayName .= Artists::display_artists($ExtendedArtists, false);
} elseif (count($GroupArtists) > 0) {
$DisplayName .= Artists::display_artists(array('1'=>$GroupArtists), false);
}
$DisplayName .= $GroupName;
if ($GroupYear > 0) {
$DisplayName = $DisplayName. " [$GroupYear]";
}
?>
<li class="image_group_<?=$GroupID?>">
<a href="torrents.php?id=<?=$GroupID?>">
<? if ($WikiImage) {
?>
<img src="<?=ImageTools::process($WikiImage, true)?>" alt="<?=$DisplayName?>" title="<?=$DisplayName?>" width="118" />
<? } else { ?>
<span style="width: 107px; padding: 5px;"><?=$DisplayName?></span>
<? } ?>
</a>
</li>
<?
$Collage[] = ob_get_clean();
}
if (!check_perms('site_collages_delete') && ($Locked || ($MaxGroups > 0 && $NumGroups >= $MaxGroups) || ($MaxGroupsPerUser > 0 && $NumGroupsByUser >= $MaxGroupsPerUser))) {
$PreventAdditions = true;
}
// Silly hack for people who are on the old setting
$CollageCovers = isset($LoggedUser['CollageCovers']) ? $LoggedUser['CollageCovers'] : 25 * (abs($LoggedUser['HideCollage'] - 1));
$CollagePages = array();
// Pad it out
if ($NumGroups > $CollageCovers) {
for ($i = $NumGroups + 1; $i <= ceil($NumGroups / $CollageCovers) * $CollageCovers; $i++) {
$Collage[] = '<li></li>';
}
}
for ($i = 0; $i < $NumGroups / $CollageCovers; $i++) {
$Groups = array_slice($Collage, $i * $CollageCovers, $CollageCovers);
$CollagePage = '';
foreach ($Groups as $Group) {
$CollagePage .= $Group;
}
$CollagePages[] = $CollagePage;
}
View::show_header($Name,'browse,collage,bbcode,voting,jquery,recommend');
?>
<div class="thin">
<div class="header">
<h2><?=$Name?></h2>
<div class="linkbox">
<a href="collages.php" class="brackets">List of collages</a>
<? if (check_perms('site_collages_create')) { ?>
<a href="collages.php?action=new" class="brackets">New collage</a>
<? } ?>
<br /><br />
<? if (check_perms('site_collages_subscribe')) { ?>
<a href="#" id="subscribelink<?=$CollageID?>" class="brackets" onclick="CollageSubscribe(<?=$CollageID?>);return false;"><?=(in_array($CollageID, $CollageSubscriptions) ? 'Unsubscribe' : 'Subscribe')?></a>
<? }
if (check_perms('site_collages_delete') || (check_perms('site_edit_wiki') && !$Locked)) { ?>
<a href="collages.php?action=edit&amp;collageid=<?=$CollageID?>" class="brackets">Edit description</a>
<? } else { ?>
<span class="brackets">Locked</span>
<? }
if (Bookmarks::has_bookmarked('collage', $CollageID)) {
?>
<a href="#" id="bookmarklink_collage_<?=$CollageID?>" class="brackets" onclick="Unbookmark('collage', <?=$CollageID?>,'Bookmark');return false;">Remove bookmark</a>
<? } else { ?>
<a href="#" id="bookmarklink_collage_<?=$CollageID?>" class="brackets" onclick="Bookmark('collage', <?=$CollageID?>,'Remove bookmark');return false;">Bookmark</a>
<? }
?>
<!-- <a href="#" id="recommend" class="brackets">Recommend</a> -->
<?
if (check_perms('site_collages_manage') && !$Locked) { ?>
<a href="collages.php?action=manage&amp;collageid=<?=$CollageID?>" class="brackets">Manage torrents</a>
<? } ?>
<a href="reports.php?action=report&amp;type=collage&amp;id=<?=$CollageID?>" class="brackets">Report collage</a>
<? if (check_perms('site_collages_delete') || $CreatorID == $LoggedUser['ID']) { ?>
<a href="collages.php?action=delete&amp;collageid=<?=$CollageID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets" onclick="return confirm('Are you sure you want to delete this collage?');">Delete</a>
<? } ?>
</div>
</div>
<? /* Misc::display_recommend($CollageID, "collage"); */ ?>
<div class="sidebar">
<div class="box box_category">
<div class="head"><strong>Category</strong></div>
<div class="pad"><a href="collages.php?action=search&amp;cats[<?=(int)$CollageCategoryID?>]=1"><?=$CollageCats[(int)$CollageCategoryID]?></a></div>
</div>
<div class="box box_description">
<div class="head"><strong>Description</strong></div>
<div class="pad"><?=$Text->full_format($Description)?></div>
</div>
<?
if (check_perms('zip_downloader')) {
if (isset($LoggedUser['Collector'])) {
list($ZIPList,$ZIPPrefs) = $LoggedUser['Collector'];
$ZIPList = explode(':',$ZIPList);
} else {
$ZIPList = array('00','11');
$ZIPPrefs = 1;
}
?>
<div class="box box_zipdownload">
<div class="head colhead_dark"><strong>Collector</strong></div>
<div class="pad">
<form class="download_form" name="zip" action="collages.php" method="post">
<input type="hidden" name="action" value="download" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="collageid" value="<?=$CollageID?>" />
<ul id="list" class="nobullet">
<? foreach ($ZIPList as $ListItem) { ?>
<li id="list<?=$ListItem?>">
<input type="hidden" name="list[]" value="<?=$ListItem?>" />
<span class="float_left"><?=$ZIPOptions[$ListItem]['2']?></span>
<span class="remove remove_collector"><a href="#" onclick="remove_selection('<?=$ListItem?>');return false;" class="float_right brackets">X</a></span>
<br style="clear: all;" />
</li>
<? } ?>
</ul>
<select id="formats" style="width:180px">
<?
$OpenGroup = false;
$LastGroupID = -1;
foreach ($ZIPOptions as $Option) {
list($GroupID,$OptionID,$OptName) = $Option;
if ($GroupID != $LastGroupID) {
$LastGroupID = $GroupID;
if ($OpenGroup) { ?>
</optgroup>
<? } ?>
<optgroup label="<?=$ZIPGroups[$GroupID]?>">
<? $OpenGroup = true;
}
?>
<option id="opt<?=$GroupID.$OptionID?>" value="<?=$GroupID.$OptionID?>"<? if (in_array($GroupID.$OptionID,$ZIPList)) { echo ' disabled="disabled"'; }?>><?=$OptName?></option>
<?
}
?>
</optgroup>
</select>
<button type="button" onclick="add_selection()">+</button>
<select name="preference" style="width: 210px;">
<option value="0"<? if ($ZIPPrefs == 0) { echo ' selected="selected"'; } ?>>Prefer Original</option>
<option value="1"<? if ($ZIPPrefs == 1) { echo ' selected="selected"'; } ?>>Prefer Best Seeded</option>
<option value="2"<? if ($ZIPPrefs == 2) { echo ' selected="selected"'; } ?>>Prefer Bonus Tracks</option>
</select>
<input type="submit" style="width: 210px;" value="Download" />
</form>
</div>
</div>
<? } ?>
<div class="box box_info box_statistics_collage_torrents">
<div class="head"><strong>Stats</strong></div>
<ul class="stats nobullet">
<li>Torrents: <?=number_format($NumGroups)?></li>
<? if (!empty($TopArtists)) { ?>
<li>Artists: <?=number_format(count($TopArtists))?></li>
<? } ?>
<li>Built by <?=number_format(count($Users))?> user<?=(count($Users) > 1 ? 's' : '')?></li>
</ul>
</div>
<div class="box box_tags">
<div class="head"><strong>Top tags</strong></div>
<div class="pad">
<ol style="padding-left: 5px;">
<?
Tags::format_top(5, 'collages.php?action=search&amp;tags=');
?>
</ol>
</div>
</div>
<? if (!empty($TopArtists)) { ?>
<div class="box box_artists">
<div class="head"><strong>Top artists</strong></div>
<div class="pad">
<ol style="padding-left: 5px;">
<?
uasort($TopArtists, 'compare');
$i = 0;
foreach ($TopArtists as $ID => $Artist) {
$i++;
if ($i > 10) {
break;
}
?>
<li><a href="artist.php?id=<?=$ID?>"><?=$Artist['name']?></a> (<?=number_format($Artist['count'])?>)</li>
<?
}
?>
</ol>
</div>
</div>
<? } ?>
<div class="box box_contributors">
<div class="head"><strong>Top contributors</strong></div>
<div class="pad">
<ol style="padding-left: 5px;">
<?
uasort($Users, 'compare');
$i = 0;
foreach ($Users as $ID => $User) {
$i++;
if ($i > 5) {
break;
}
?>
<li><?=Users::format_username($ID, false, false, false)?> (<?=number_format($User['count'])?>)</li>
<?
}
?>
</ol>
</div>
</div>
<? if (check_perms('site_collages_manage') && !$PreventAdditions) { ?>
<div class="box box_addtorrent">
<div class="head"><strong>Add torrent</strong><span class="float_right"><a href="#" onclick="$('.add_torrent_container').toggle_class('hidden'); this.innerHTML = (this.innerHTML == 'Batch add' ? 'Individual add' : 'Batch add'); return false;" class="brackets">Batch add</a></span></div>
<div class="pad add_torrent_container">
<form class="add_form" name="torrent" action="collages.php" method="post">
<input type="hidden" name="action" value="add_torrent" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="collageid" value="<?=$CollageID?>" />
<input type="text" size="20" name="url" />
<input type="submit" value="+" />
<br />
<span style="font-style: italic;">Enter the URL of a torrent on the site.</span>
</form>
</div>
<div class="pad hidden add_torrent_container">
<form class="add_form" name="torrents" action="collages.php" method="post">
<input type="hidden" name="action" value="add_torrent_batch" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="collageid" value="<?=$CollageID?>" />
<textarea name="urls" rows="5" cols="25" style="white-space: nowrap;"></textarea><br />
<input type="submit" value="Add" />
<br />
<span style="font-style: italic;">Enter the URLs of torrents on the site, one per line.</span>
</form>
</div>
</div>
<? } ?>
<h3>Comments</h3>
<?
if (empty($CommentList)) {
$DB->query("
SELECT
cc.ID,
cc.Body,
cc.UserID,
um.Username,
cc.Time
FROM collages_comments AS cc
LEFT JOIN users_main AS um ON um.ID=cc.UserID
WHERE CollageID='$CollageID'
ORDER BY ID DESC
LIMIT 15");
$CommentList = $DB->to_array(false, MYSQLI_NUM);
}
foreach ($CommentList as $Comment) {
list($CommentID, $Body, $UserID, $Username, $CommentTime) = $Comment;
?>
<div class="box comment">
<div class="head">
<?=Users::format_username($UserID, false, false, false) ?> <?=time_diff($CommentTime) ?>
<br />
<a href="reports.php?action=report&amp;type=collages_comment&amp;id=<?=$CommentID?>" class="brackets">Report</a>
</div>
<div class="pad"><?=$Text->full_format($Body)?></div>
</div>
<?
}
?>
<div class="box pad">
<a href="collages.php?action=comments&amp;collageid=<?=$CollageID?>" class="brackets">View all comments</a>
</div>
<?
if (!$LoggedUser['DisablePosting']) {
?>
<div class="box box_addcomment">
<div class="head"><strong>Add comment</strong></div>
<form class="send_form" name="comment" id="quickpostform" onsubmit="quickpostform.submit_button.disabled=true;" action="collages.php" method="post">
<input type="hidden" name="action" value="add_comment" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="collageid" value="<?=$CollageID?>" />
<div class="pad">
<textarea name="body" cols="24" rows="5"></textarea>
<br />
<input type="submit" id="submit_button" value="Add comment" />
</div>
</form>
</div>
<?
}
?>
</div>
<div class="main_column">
<?
if ($CollageCovers != 0) { ?>
<div id="coverart" class="box">
<div class="head" id="coverhead"><strong>Cover art</strong></div>
<ul class="collage_images" id="collage_page0">
<?
$Page1 = array_slice($Collage, 0, $CollageCovers);
foreach ($Page1 as $Group) {
echo $Group;
}?>
</ul>
</div>
<? if ($NumGroups > $CollageCovers) { ?>
<div class="linkbox pager" style="clear: left;" id="pageslinksdiv">
<span id="firstpage" class="invisible"><a href="#" class="pageslink" onclick="collageShow.page(0, this); return false;"><strong>&lt;&lt; First</strong></a> | </span>
<span id="prevpage" class="invisible"><a href="#" class="pageslink" onclick="collageShow.prevPage(); return false;"><strong>&lt; Prev</strong></a> | </span>
<? for ($i = 0; $i < $NumGroups / $CollageCovers; $i++) { ?>
<span id="pagelink<?=$i?>" class="<?=(($i > 4) ? 'hidden' : '')?><?=(($i == 0) ? 'selected' : '')?>"><a href="#" class="pageslink" onclick="collageShow.page(<?=$i?>, this); return false;"><strong><?=$CollageCovers * $i + 1?>-<?=min($NumGroups,$CollageCovers * ($i + 1))?></strong></a><?=(($i != ceil($NumGroups / $CollageCovers) - 1) ? ' | ' : '')?></span>
<? } ?>
<span id="nextbar" class="<?=($NumGroups / $CollageCovers > 5) ? 'hidden' : ''?>"> | </span>
<span id="nextpage"><a href="#" class="pageslink" onclick="collageShow.nextPage(); return false;"><strong>Next &gt;</strong></a></span>
<span id="lastpage" class="<?=(ceil($NumGroups / $CollageCovers) == 2 ? 'invisible' : '')?>"> | <a href="#" class="pageslink" onclick="collageShow.page(<?=ceil($NumGroups / $CollageCovers) - 1?>, this); return false;"><strong>Last &gt;&gt;</strong></a></span>
</div>
<script type="text/javascript">//<![CDATA[
collageShow.init(<?=json_encode($CollagePages)?>);
//]]></script>
<? }
} ?>
<table class="torrent_table grouping cats" id="discog_table">
<tr class="colhead_dark">
<td><!-- expand/collapse --></td>
<td><!-- Category --></td>
<td width="70%"><strong>Torrents</strong></td>
<td>Size</td>
<td class="sign"><img src="static/styles/<?=$LoggedUser['StyleName'] ?>/images/snatched.png" alt="Snatches" title="Snatches" /></td>
<td class="sign"><img src="static/styles/<?=$LoggedUser['StyleName'] ?>/images/seeders.png" alt="Seeders" title="Seeders" /></td>
<td class="sign"><img src="static/styles/<?=$LoggedUser['StyleName'] ?>/images/leechers.png" alt="Leechers" title="Leechers" /></td>
</tr>
<?=$TorrentTable?>
</table>
</div>
</div>
<?
View::show_footer();
$Cache->cache_value('collage_'.$CollageID, array(array($Name, $Description, array(), array(), $CommentList, $Deleted, $CollageCategoryID, $CreatorID, $Locked, $MaxGroups, $MaxGroupsPerUser)), 3600);
?>

View File

@ -7,7 +7,7 @@
<h3 id="forums">Donation Complete</h3>
</div>
<div class="box pad" style="padding: 10px 10px 10px 20px;">
<p>Thank you for your donation! If this is your first time donating you will now have received 2 invitations and a <img src="<?=STATIC_SERVER?>common/symbols/donor.png" alt="Donor" />.</p>
<p>Thank you for your donation! If this is your first time donating you will now have received 2 invitations and a <img src="<?=(STATIC_SERVER)?>common/symbols/donor.png" alt="Donor" />.</p>
</div>
</div>
<? View::show_footer();?>

View File

@ -54,13 +54,13 @@ function toggle_visibility(id) {
<?
} else {
$nick = $_POST['username'];
$nick = preg_replace('/[^a-zA-Z0-9\[\]\\`\^\{\}\|_]/', '', $nick);
if (strlen($nick) == 0) {
$nick = 'WhatGuest????';
$Nick = $_POST['username'];
$Nick = preg_replace('/[^a-zA-Z0-9\[\]\\`\^\{\}\|_]/', '', $Nick);
if (strlen($Nick) == 0) {
$Nick = 'WhatGuest????';
} else {
if (is_numeric(substr($nick, 0, 1))) {
$nick = '_' . $nick;
if (is_numeric(substr($Nick, 0, 1))) {
$Nick = '_' . $Nick;
}
}
?>
@ -73,10 +73,10 @@ function toggle_visibility(id) {
<p>Please read the topic carefully.</p>
</div>
<applet codebase="static/irc/" code="IRCApplet.class" archive="irc.jar,sbox.jar" width="800" height="600" align="center">
<param name="nick" value="<?=$nick?>" />
<param name="nick" value="<?=($Nick)?>" />
<param name="alternatenick" value="WhatGuest????" />
<param name="name" value="Java IRC User" />
<param name="host" value="<?=BOT_SERVER?>" />
<param name="host" value="<?=(BOT_SERVER)?>" />
<param name="multiserver" value="false" />
<param name="autorejoin" value="false" />

View File

@ -2,8 +2,8 @@
View::show_header('Recover Password','validate');
echo $Validate->GenerateJS('recoverform');
?>
<script src="<?=STATIC_SERVER?>functions/jquery.js" type="text/javascript"></script>
<script src="<?=STATIC_SERVER?>functions/password_validate.js" type="text/javascript"></script>
<script src="<?=(STATIC_SERVER)?>functions/jquery.js" type="text/javascript"></script>
<script src="<?=(STATIC_SERVER)?>functions/password_validate.js" type="text/javascript"></script>
<form class="auth_form" name="recovery" id="recoverform" method="post" action="" onsubmit="return formVal();">
<input type="hidden" name="key" value="<?=display_str($_REQUEST['key'])?>" />
<div style="width: 500px;">

View File

@ -59,7 +59,6 @@
t.HasLog,
t.LogScore,
t.UserID AS UploaderID,
t.Tasted,
uploader.Username
FROM reportsv2 AS r
LEFT JOIN torrents AS t ON t.ID=r.TorrentID

View File

@ -37,9 +37,6 @@
case 'ajax_change_resolve':
include('ajax_change_resolve.php');
break;
case 'ajax_taste':
include('ajax_taste.php');
break;
case 'ajax_take_pm':
include('ajax_take_pm.php');
break;

View File

@ -206,41 +206,33 @@
</td>
<td style="vertical-align: top;">
<?
$DB->query("
SELECT
r.ResolverID,
um.Username,
COUNT(r.ID) AS Count,
COUNT(tasted.Tasted) AS Tasted
FROM reportsv2 AS r
LEFT JOIN users_main AS um ON r.ResolverID=um.ID
LEFT JOIN torrents AS tasted ON tasted.ID=r.TorrentID AND tasted.Tasted = '1'
WHERE r.Status = 'InProgress'
GROUP BY r.ResolverID");
$Staff = $DB->to_array();
?>
<strong>Currently assigned reports by staff member</strong>
<table>
<tr class="colhead">
<td>Staff member</td>
<td>Current count</td>
<td>Tasted count</td>
</tr>
<td>Current count</td> </tr>
<?
foreach ($Staff as $Array) { ?>
<tr>
<td>
<a href="reportsv2.php?view=staff&amp;id=<?=$Array['ResolverID']?>"><?=display_str($Array['Username'])?>'s reports</a>
</td>
<td><?=number_format($Array['Count'])?></td>
<td>
<a href="reportsv2.php?view=tasted&amp;id=<?=$Array['ResolverID']?>"><?=number_format($Array['Tasted'])?></a>
</td>
</tr>
<td><?=number_format($Array['Count'])?></td> </tr>
<?
}
?>
} ?>
</table>
<br />
<h3>Different view modes by report type</h3>

View File

@ -33,7 +33,7 @@
<br />
<br />
<div style="text-align:center"><strong>Required Ratio Table</strong><br /><br />
<div style="text-align: center;"><strong>Required Ratio Table</strong><br /><br />
<table class="ratio_table">
<tr class="colhead">
<td><span title="These units are actually in base 2, not base 10. For example, there are 1,024 MB in 1 GB.">Amount Downloaded</span></td>

View File

@ -56,9 +56,15 @@
</form>
<h2>News archive</h2>
<?
$DB->query('SELECT n.ID,n.Title,n.Body,n.Time FROM news AS n ORDER BY n.Time DESC');// LIMIT 20
$DB->query('
SELECT
n.ID,
n.Title,
n.Body,
n.Time
FROM news AS n
ORDER BY n.Time DESC');// LIMIT 20
while (list($NewsID, $Title, $Body, $NewsTime) = $DB->next_record()) {
?>
<div class="box vertical_space">

View File

@ -375,12 +375,12 @@ function generate_torrent_table($Caption, $Tag, $Details, $Limit) {
<td class="center" style="width: 15px;"></td>
<td class="cats_col"></td>
<td><strong>Name</strong></td>
<td style="text-align:right"><strong>Size</strong></td>
<td style="text-align:right"><strong>Data</strong></td>
<td style="text-align:right"><img src="static/styles/<?=$LoggedUser['StyleName']?>/images/snatched.png" alt="Snatches" title="Snatches" /></td>
<td style="text-align:right"><img src="static/styles/<?=$LoggedUser['StyleName']?>/images/seeders.png" alt="Seeders" title="Seeders" /></td>
<td style="text-align:right"><img src="static/styles/<?=$LoggedUser['StyleName']?>/images/leechers.png" alt="Leechers" title="Leechers" /></td>
<td style="text-align:right"><strong>Peers</strong></td>
<td style="text-align: right;"><strong>Size</strong></td>
<td style="text-align: right;"><strong>Data</strong></td>
<td style="text-align: right;"><img src="static/styles/<?=$LoggedUser['StyleName']?>/images/snatched.png" alt="Snatches" title="Snatches" /></td>
<td style="text-align: right;"><img src="static/styles/<?=$LoggedUser['StyleName']?>/images/seeders.png" alt="Seeders" title="Seeders" /></td>
<td style="text-align: right;"><img src="static/styles/<?=$LoggedUser['StyleName']?>/images/leechers.png" alt="Leechers" title="Leechers" /></td>
<td style="text-align: right;"><strong>Peers</strong></td>
</tr>
<?
// Server is already processing a top10 query. Starting another one will make things slow

View File

@ -273,7 +273,7 @@
</td>
</tr>
<tr>
<td class="label">PM Uploader</td>
<td class="label">PM uploader</td>
<td colspan="3">
<span title="Appended to the regular message unless using &quot;Send Now&quot;.">
<textarea name="uploader_pm" id="uploader_pm<?=$ReportID?>" cols="50" rows="1"></textarea>
@ -282,11 +282,11 @@
</td>
</tr>
<tr>
<td class="label"><strong>Extra</strong> Log Message:</td>
<td class="label"><strong>Extra</strong> log message:</td>
<td>
<input type="text" name="log_message" id="log_message<?=$ReportID?>" size="40" />
</td>
<td class="label"><strong>Extra</strong> Staff Notes:</td>
<td class="label"><strong>Extra</strong> staff notes:</td>
<td>
<input type="text" name="admin_message" id="admin_message<?=$ReportID?>" size="40" />
</td>

View File

@ -347,7 +347,7 @@ function compare($X, $Y) {
<span class="remove remove_tag"><a href="torrents.php?action=delete_tag&amp;groupid=<?=$GroupID?>&amp;tagid=<?=$Tag['id']?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets" title="Remove tag">X</a></span>
<? } ?>
</div>
<br style="clear:both" />
<br style="clear: both;" />
</li>
<?
}

View File

@ -34,59 +34,72 @@
list($Page,$Limit) = Format::page_limit(NOTIFICATIONS_PER_PAGE);
// The "order by x" links on columns headers
function header_link($SortKey, $DefaultWay = "desc") {
function header_link($SortKey, $DefaultWay = 'desc') {
global $OrderWay;
if ($SortKey == $_GET['order_by']) {
if ($OrderWay == "DESC") {
$NewWay = "asc";
if ($OrderWay == 'DESC') {
$NewWay = 'asc';
} else {
$NewWay = "desc";
$NewWay = 'desc';
}
} else {
$NewWay = $DefaultWay;
}
return "?action=notify&amp;order_way=".$NewWay."&amp;order_by=".$SortKey."&amp;".Format::get_url(array('page','order_way','order_by'));
return "?action=notify&amp;order_way=$NewWay&amp;order_by=$SortKey&amp;".Format::get_url(array('page', 'order_way', 'order_by'));
}
$UserID = $LoggedUser['ID'];
// Sorting by release year requires joining torrents_group, which is slow. Using a temporary table
// makes it speedy enough as long as there aren't too many records to create
if ($OrderTbl == 'tg') {
$DB->query("SELECT COUNT(*) FROM users_notify_torrents AS unt
$DB->query("
SELECT COUNT(*)
FROM users_notify_torrents AS unt
JOIN torrents AS t ON t.ID=unt.TorrentID
WHERE unt.UserID=$UserID".
($FilterID
? " AND FilterID=$FilterID"
: ""));
: ''));
list($TorrentCount) = $DB->next_record();
if ($TorrentCount > NOTIFICATIONS_MAX_SLOWSORT) {
error("Due to performance issues, torrent lists with more than ".number_format(NOTIFICATIONS_MAX_SLOWSORT)." items cannot be ordered by release year.");
error('Due to performance issues, torrent lists with more than '.number_format(NOTIFICATIONS_MAX_SLOWSORT).' items cannot be ordered by release year.');
}
$DB->query("CREATE TEMPORARY TABLE temp_notify_torrents
(TorrentID int, GroupID int, UnRead tinyint, FilterID int, Year smallint, PRIMARY KEY(GroupID, TorrentID), KEY(Year)) ENGINE=MyISAM");
$DB->query("INSERT IGNORE INTO temp_notify_torrents (TorrentID, GroupID, UnRead, FilterID)
$DB->query("
CREATE TEMPORARY TABLE temp_notify_torrents
(TorrentID int, GroupID int, UnRead tinyint, FilterID int, Year smallint, PRIMARY KEY(GroupID, TorrentID), KEY(Year))
ENGINE=MyISAM");
$DB->query("
INSERT IGNORE INTO temp_notify_torrents (TorrentID, GroupID, UnRead, FilterID)
SELECT t.ID, t.GroupID, unt.UnRead, unt.FilterID
FROM users_notify_torrents AS unt JOIN torrents AS t ON t.ID=unt.TorrentID
WHERE unt.UserID=$UserID".
($FilterID
? " AND unt.FilterID=$FilterID"
: ""));
$DB->query("UPDATE temp_notify_torrents AS tnt JOIN torrents_group AS tg ON tnt.GroupID=tg.ID SET tnt.Year=tg.Year");
$DB->query("SELECT TorrentID, GroupID, UnRead, FilterID
FROM temp_notify_torrents AS tnt
ORDER BY $OrderCol $OrderWay, GroupID $OrderWay LIMIT $Limit");
$Results = $DB->to_array(false, MYSQLI_ASSOC, false);
} else {
$DB->query("SELECT SQL_CALC_FOUND_ROWS unt.TorrentID, unt.UnRead, unt.FilterID, t.GroupID
FROM users_notify_torrents AS unt
JOIN torrents AS t ON t.ID=unt.TorrentID
WHERE unt.UserID=$UserID".
($FilterID
? " AND unt.FilterID=$FilterID"
: "")."
ORDER BY $OrderCol $OrderWay LIMIT $Limit");
: ''));
$DB->query("
UPDATE temp_notify_torrents AS tnt
JOIN torrents_group AS tg ON tnt.GroupID=tg.ID
SET tnt.Year=tg.Year");
$DB->query("
SELECT TorrentID, GroupID, UnRead, FilterID
FROM temp_notify_torrents AS tnt
ORDER BY $OrderCol $OrderWay, GroupID $OrderWay
LIMIT $Limit");
$Results = $DB->to_array(false, MYSQLI_ASSOC, false);
} else {
$DB->query("
SELECT SQL_CALC_FOUND_ROWS unt.TorrentID, unt.UnRead, unt.FilterID, t.GroupID
FROM users_notify_torrents AS unt
JOIN torrents AS t ON t.ID = unt.TorrentID
WHERE unt.UserID=$UserID".
($FilterID
? " AND unt.FilterID=$FilterID"
: '')."
ORDER BY $OrderCol $OrderWay
LIMIT $Limit");
$Results = $DB->to_array(false, MYSQLI_ASSOC, false);
$DB->query("SELECT FOUND_ROWS()");
list($TorrentCount) = $DB->next_record();
@ -109,7 +122,10 @@ function header_link($SortKey, $DefaultWay = "desc") {
$TorrentGroups = $TorrentGroups['matches'];
// Get the relevant filter labels
$DB->query("SELECT ID, Label, Artists FROM users_notify_filters WHERE ID IN (".implode(',', $FilterIDs).")");
$DB->query('
SELECT ID, Label, Artists
FROM users_notify_filters
WHERE ID IN ('.implode(',', $FilterIDs).')');
$Filters = $DB->to_array('ID', MYSQLI_ASSOC, array('Artists'));
foreach ($Filters as &$Filter) {
$Filter['Artists'] = explode('|', trim($Filter['Artists'], '|'));
@ -122,7 +138,11 @@ function header_link($SortKey, $DefaultWay = "desc") {
if (!empty($UnReadIDs)) {
//Clear before header but after query so as to not have the alert bar on this page load
$DB->query("UPDATE users_notify_torrents SET UnRead='0' WHERE UserID=".$LoggedUser['ID']." AND TorrentID IN (".implode(',', $UnReadIDs).")");
$DB->query("
UPDATE users_notify_torrents
SET UnRead='0'
WHERE UserID=".$LoggedUser['ID'].'
AND TorrentID IN ('.implode(',', $UnReadIDs).')');
$Cache->delete_value('notifications_new_'.$LoggedUser['ID']);
}
}
@ -191,7 +211,7 @@ function header_link($SortKey, $DefaultWay = "desc") {
<form class="manage_form" name="torrents" id="notificationform_<?=$FilterID?>" action="">
<table class="torrent_table cats checkboxes border">
<tr class="colhead">
<td style="text-align: center"><input type="checkbox" name="toggle" onclick="toggleBoxes(<?=$FilterID?>, this.checked)" /></td>
<td style="text-align: center;"><input type="checkbox" name="toggle" onclick="toggleBoxes(<?=$FilterID?>, this.checked)" /></td>
<td class="small cats_col"></td>
<td style="width: 100%;">Name<?=$TorrentCount <= NOTIFICATIONS_MAX_SLOWSORT ? ' / <a href="'.header_link('year').'">Year</a>' : ''?></td>
<td>Files</td>
@ -276,11 +296,11 @@ function header_link($SortKey, $DefaultWay = "desc") {
</div>
</td>
<td><?=$TorrentInfo['FileCount']?></td>
<td style="text-align:right" class="nobr"><?=time_diff($TorrentInfo['Time'])?></td>
<td class="nobr" style="text-align:right"><?=Format::get_size($TorrentInfo['Size'])?></td>
<td style="text-align:right"><?=number_format($TorrentInfo['Snatched'])?></td>
<td style="text-align:right"><?=number_format($TorrentInfo['Seeders'])?></td>
<td style="text-align:right"><?=number_format($TorrentInfo['Leechers'])?></td>
<td style="text-align: right;" class="nobr"><?=time_diff($TorrentInfo['Time'])?></td>
<td class="nobr" style="text-align: right;"><?=Format::get_size($TorrentInfo['Size'])?></td>
<td style="text-align: right;"><?=number_format($TorrentInfo['Snatched'])?></td>
<td style="text-align: right;"><?=number_format($TorrentInfo['Seeders'])?></td>
<td style="text-align: right;"><?=number_format($TorrentInfo['Leechers'])?></td>
</tr>
<?
}

View File

@ -99,7 +99,7 @@ function checked($Checked) {
<div id="css_gallery">
<? foreach ($Stylesheets as $Style) { ?>
<div class="preview_wrapper">
<div class="preview_image" name="<?=$Style['Name']?>" style="background: url('<?=STATIC_SERVER.'thumb_'.$Style['Name'].'.png'?>') no-repeat scroll center top #CCC"></div>
<div class="preview_image" name="<?=$Style['Name']?>" style="background: url('<?=STATIC_SERVER.'thumb_'.$Style['Name'].'.png'?>') no-repeat scroll center top #CCC;"></div>
<p class="preview_name"><input type="radio" name="stylesheet_gallery" value="<?=($Style['ID'])?>" /> <?=($Style['ProperName'])?></p>
</div>
<? } ?>

View File

@ -73,11 +73,11 @@
<a href="#" onclick="$('#filter_<?=$N['ID']?>').toggle(); return false;" class="brackets">Show</a>
</h3>
<? } ?>
<form class="<?=($i > $NumFilters) ? 'create_form' : 'edit_form'?>" name="notification" action="user.php" method="post">
<form class="<?=(($i > $NumFilters) ? 'create_form' : 'edit_form')?>" name="notification" action="user.php" method="post">
<input type="hidden" name="formid" value="<?=$i?>" />
<input type="hidden" name="action" value="notify_handle" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<table <?=($i <= $NumFilters) ? 'id="filter_'.$N['ID'].'" class="layout hidden"' : 'class="layout"'?>>
<table <?=(($i <= $NumFilters) ? 'id="filter_'.$N['ID'].'" class="layout hidden"' : 'class="layout"')?>>
<? if ($i > $NumFilters) { ?>
<tr>
<td class="label"><strong>Notification filter name</strong></td>
@ -106,7 +106,7 @@
<tr>
<td class="label"><strong>One of these users</strong></td>
<td>
<textarea name="users<?=$i?>" style="width:100%" rows="5"><?=display_str($Usernames)?></textarea>
<textarea name="users<?=$i?>" style="width: 100%;" rows="5"><?=display_str($Usernames)?></textarea>
<p class="min_padding">Comma-separated list of usernames</em></p>
</td>
</tr>

View File

@ -6,18 +6,23 @@
error(0);
}
$CollageID = (int) $_GET['collageid'];
if (!$UserSubscriptions = $Cache->get_value('collage_subs_user_'.$LoggedUser['ID'])) {
$DB->query('SELECT CollageID FROM users_collage_subs WHERE UserID = '.db_string($LoggedUser['ID']));
$UserSubscriptions = $DB->collect(0);
$Cache->cache_value('collage_subs_user_'.$LoggedUser['ID'],$UserSubscriptions,0);
}
if (($Key = array_search($_GET['collageid'],$UserSubscriptions)) !== false) {
$DB->query('DELETE FROM users_collage_subs WHERE UserID = '.db_string($LoggedUser['ID']).' AND CollageID = '.db_string($_GET['collageid']));
if (($Key = array_search($CollageID, $UserSubscriptions)) !== false) {
$DB->query('DELETE FROM users_collage_subs WHERE UserID = '.db_string($LoggedUser['ID']).' AND CollageID = '.$CollageID);
unset($UserSubscriptions[$Key]);
Collages::decrease_subscriptions($CollageID);
} else {
$DB->query("INSERT IGNORE INTO users_collage_subs (UserID, CollageID, LastVisit) VALUES ($LoggedUser[ID], ".db_string($_GET['collageid']).", NOW())");
array_push($UserSubscriptions, $_GET['collageid']);
$DB->query("INSERT IGNORE INTO users_collage_subs (UserID, CollageID, LastVisit) VALUES ($LoggedUser[ID], ".$CollageID.", NOW())");
array_push($UserSubscriptions, $CollageID);
Collages::increase_subscriptions($CollageID);
}
$Cache->replace_value('collage_subs_user_'.$LoggedUser['ID'], $UserSubscriptions, 0);
$Cache->delete_value('collage_subs_user_new_'.$LoggedUser['ID']);

View File

@ -1,3 +1,3 @@
<p>
<p>
<a href="index.php">Home</a>
</p>