Empty commit

This commit is contained in:
Git 2012-02-03 08:00:22 +00:00
parent d34618314d
commit a868ce13ba
9 changed files with 160 additions and 18 deletions

View File

@ -454,7 +454,7 @@ function to_html($Array) {
$Str.='<a href="artist.php?artistname='.urlencode(undisplay_str($Block['Val'])).'">'.$Block['Val'].'</a>';
break;
case 'torrent':
$Pattern = '/('.NONSSL_SITE_URL.'\/torrents\.php?.*id=)?(\d+)($|&|#)/';
$Pattern = '/('.NONSSL_SITE_URL.'\/torrents\.php?.*id=)?(\d+)($|&|#)/i';
$Matches = array();
if (preg_match($Pattern, $Block['Val'], $Matches)) {
if (isset($Matches[2])) {

View File

@ -1861,6 +1861,7 @@ function get_requests($RequestIDs, $Return = true) {
r.Image,
r.Description,
r.CatalogueNumber,
r.RecordLabel,
r.ReleaseType,
r.BitrateList,
r.FormatList,
@ -1869,7 +1870,8 @@ function get_requests($RequestIDs, $Return = true) {
r.FillerID,
filler.Username,
r.TorrentID,
r.TimeFilled
r.TimeFilled,
r.GroupID
FROM requests AS r
LEFT JOIN users_main AS u ON u.ID=r.UserID
LEFT JOIN users_main AS filler ON filler.ID=FillerID AND FillerID!=0
@ -1896,13 +1898,13 @@ function update_sphinx_requests($RequestID) {
$DB->query("REPLACE INTO sphinx_requests_delta (
ID, UserID, TimeAdded, LastVote, CategoryID, Title,
Year, ReleaseType, CatalogueNumber, BitrateList,
Year, ReleaseType, RecordLabel, CatalogueNumber, BitrateList,
FormatList, MediaList, LogCue, FillerID, TorrentID,
TimeFilled, Visible, Votes, Bounty)
SELECT
ID, r.UserID, UNIX_TIMESTAMP(TimeAdded) AS TimeAdded,
UNIX_TIMESTAMP(LastVote) AS LastVote, CategoryID,
Title, Year, ReleaseType, CatalogueNumber, BitrateList,
Title, Year, ReleaseType, RecordLabel, CatalogueNumber, BitrateList,
FormatList, MediaList, LogCue, FillerID, TorrentID,
UNIX_TIMESTAMP(TimeFilled) AS TimeFilled, Visible,
COUNT(rv.UserID) AS Votes, SUM(rv.Bounty) >> 10 AS Bounty

View File

@ -206,6 +206,12 @@ CREATE TABLE `drives` (
KEY `Name` (`Name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `dupe_groups` (
`ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
`Comments` text,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `email_blacklist` (
`ID` int(10) NOT NULL AUTO_INCREMENT,
`UserID` int(10) NOT NULL,
@ -531,6 +537,7 @@ CREATE TABLE `requests` (
`TimeFilled` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`Visible` binary(1) NOT NULL DEFAULT '1',
`RecordLabel` varchar(80) DEFAULT NULL,
`GroupID` int(10) DEFAULT NULL,
PRIMARY KEY (`ID`),
KEY `Userid` (`UserID`),
KEY `Name` (`Title`),
@ -539,7 +546,8 @@ CREATE TABLE `requests` (
KEY `TimeAdded` (`TimeAdded`),
KEY `Year` (`Year`),
KEY `TimeFilled` (`TimeFilled`),
KEY `LastVote` (`LastVote`)
KEY `LastVote` (`LastVote`),
KEY `GroupID` (`GroupID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `requests_artists` (
@ -1075,6 +1083,15 @@ CREATE TABLE `users_downloads` (
KEY `TorrentID_2` (`TorrentID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `users_dupes` (
`GroupID` int(10) unsigned NOT NULL,
`UserID` int(10) unsigned NOT NULL,
UNIQUE KEY `UserID` (`UserID`),
KEY `GroupID` (`GroupID`),
CONSTRAINT `users_dupes_ibfk_1` FOREIGN KEY (`UserID`) REFERENCES `users_main` (`ID`) ON DELETE CASCADE,
CONSTRAINT `users_dupes_ibfk_2` FOREIGN KEY (`GroupID`) REFERENCES `dupe_groups` (`ID`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `users_freeleeches` (
`UserID` int(10) NOT NULL,
`TorrentID` int(10) NOT NULL,

View File

@ -30,8 +30,8 @@
error(404);
}
list($RequestID, $RequestorID, $RequestorName, $TimeAdded, $LastVote, $CategoryID, $Title, $Year, $Image, $Description, $CatalogueNumber, $ReleaseType,
$BitrateList, $FormatList, $MediaList, $LogCue, $FillerID, $FillerName, $TorrentID, $TimeFilled) = $Request;
list($RequestID, $RequestorID, $RequestorName, $TimeAdded, $LastVote, $CategoryID, $Title, $Year, $Image, $Description, $CatalogueNumber, $RecordLabel,
$ReleaseType, $BitrateList, $FormatList, $MediaList, $LogCue, $FillerID, $FillerName, $TorrentID, $TimeFilled, $GroupID) = $Request;
$VoteArray = get_votes_array($RequestID);
$VoteCount = count($VoteArray['Voters']);
@ -111,7 +111,9 @@
JOIN torrents_tags AS tt ON tt.GroupID=tg.ID
JOIN tags AS t ON t.ID=tt.TagID
WHERE tg.ID = ".$_GET['groupid']);
list($Title, $Year, $ReleaseType, $Image, $Tags) = $DB->next_record();
if(list($Title, $Year, $ReleaseType, $Image, $Tags) = $DB->next_record()) {
$GroupID = trim($_REQUEST['groupid']);
}
}
show_header(($NewRequest ? "Create a request" : "Edit a request"), 'requests');
@ -193,6 +195,12 @@
<input type="text" name="title" size="45" value="<?=(!empty($Title) ? display_str($Title) : '')?>" />
</td>
</tr>
<tr id="cataloguenumber_tr">
<td class="label">Record Label</td>
<td>
<input type="text" name="recordlabel" size="45" value="<?=(!empty($RecordLabel) ? display_str($RecordLabel) : '')?>" />
</td>
</tr>
<tr id="cataloguenumber_tr">
<td class="label">Catalogue Number</td>
<td>
@ -308,7 +316,29 @@
<textarea name="description" cols="70" rows="7"><?=(!empty($Description) ? $Description : '')?></textarea> <br />
</td>
</tr>
<? if($NewRequest) { ?>
<? if(check_perms('site_moderate_requests')) { ?>
<tr>
<td class="label">Torrent Group</td>
<td>
http://what.cd/torrents.php?id=<input type="text" name="groupid" value="<?=$GroupID?>" size="15"><br />
If this request matches a torrent group <span style="font-weight: bold;">already existing</span> on the site, please indicate that here.
</td>
</tr>
<? } elseif ($GroupID) {
?>
<tr>
<td class="label">Torrent Group</td>
<td>
<a href="torrents.php?id=<?=$GroupID?>">http://what.cd/torrents.php?id=<?=$GroupID?></a><br />
This request <?=($NewRequest?'will be':'is')?> associated with the above torrent group.
<? if (!$NewRequest) { ?>
If this is incorrect, please <a href="reports.php?action=report&type=request&id=<?=$RequestID?>">report this request</a> so that staff can fix it.
<? } ?>
<input type="hidden" name="groupid" value="<?=$GroupID?>" />
</td>
</tr>
<? }
if($NewRequest) { ?>
<tr id="voting">
<td class="label">Bounty (MB)</td>
<td>

View File

@ -22,7 +22,7 @@
error(404);
}
list($RequestID, $RequestorID, $RequestorName, $TimeAdded, $LastVote, $CategoryID, $Title, $Year, $Image, $Description, $CatalogueNumber, $ReleaseType,
list($RequestID, $RequestorID, $RequestorName, $TimeAdded, $LastVote, $CategoryID, $Title, $Year, $Image, $Description, $CatalogueNumber, $RecordLabel, $ReleaseType,
$BitrateList, $FormatList, $MediaList, $LogCue, $FillerID, $FillerName, $TorrentID, $TimeFilled) = $Request;
//Convenience variables
@ -247,6 +247,14 @@
</td>
</tr>
<? if($CategoryName == "Music") {
if(!empty($RecordLabel)) { ?>
<tr>
<td class="label">Record Label</td>
<td>
<?=$RecordLabel?>
</td>
</tr>
<? }
if(!empty($CatalogueNumber)) { ?>
<tr>
<td class="label">Catalogue Number</td>

View File

@ -32,8 +32,8 @@
error(404);
}
list($RequestID, $RequestorID, $RequestorName, $TimeAdded, $LastVote, $CategoryID, $Title, $Year, $Image, $Description, $CatalogueNumber, $ReleaseType,
$BitrateList, $FormatList, $MediaList, $LogCue, $FillerID, $FillerName, $TorrentID, $TimeFilled) = $Request;
list($RequestID, $RequestorID, $RequestorName, $TimeAdded, $LastVote, $CategoryID, $Title, $Year, $Image, $Description, $CatalogueNumber, $RecordLabel,
$ReleaseType, $BitrateList, $FormatList, $MediaList, $LogCue, $FillerID, $FillerName, $TorrentID, $TimeFilled, $GroupID) = $Request;
$VoteArray = get_votes_array($RequestID);
$VoteCount = count($VoteArray['Voters']);
@ -174,6 +174,23 @@
$MinLogScore = false;
}
// GroupID
if (!empty($_POST['groupid'])) {
$GroupID = trim($_POST['groupid']);
$URLRegex = '/^https?:\/\/(www\.|ssl\.)?'.NONSSL_SITE_URL.'\/torrents\.php\?(page=[0-9]+&)?id=([0-9]+)/i';
if (preg_match($URLRegex, $GroupID, $Matches)) {
$GroupID = $Matches[3];
}
if (is_number($GroupID)) {
$DB->query("SELECT 1 FROM torrents_group WHERE ID = '$GroupID'");
if ($DB->record_count() == 0) {
$Err = "Torrent Group, if entered, must correspond to a group on the site.";
}
} else {
$Err = "Torrent Group, if entered, must correspond to a group on the site.";
}
}
//Not required
if(!empty($_POST['editioninfo'])) {
$EditionInfo = trim($_POST['editioninfo']);
@ -185,6 +202,11 @@
} else {
$CatalogueNumber = "";
}
if(!empty($_POST['recordlabel'])) {
$RecordLabel = trim($_POST['recordlabel']);
} else {
$RecordLabel = "";
}
}
if($CategoryName == "Music" || $CategoryName == "Audiobooks" || $CategoryName == "Comedy") {
@ -302,11 +324,11 @@
if($CategoryName == "Music") {
if($NewRequest) {
$DB->query("INSERT INTO requests (
UserID, TimeAdded, LastVote, CategoryID, Title, Year, Image, Description,
CatalogueNumber, ReleaseType, BitrateList, FormatList, MediaList, LogCue, Visible)
UserID, TimeAdded, LastVote, CategoryID, Title, Year, Image, Description, RecordLabel,
CatalogueNumber, ReleaseType, BitrateList, FormatList, MediaList, LogCue, Visible, GroupID)
VALUES
(".$LoggedUser['ID'].", '".sqltime()."', '".sqltime()."', ".$CategoryID.", '".db_string($Title)."', ".$Year.", '".db_string($Image)."', '".db_string($Description)."',
'".db_string($CatalogueNumber)."', ".$ReleaseType.", '".$BitrateList."','".$FormatList."', '".$MediaList."', '".$LogCue."', '1')");
(".$LoggedUser['ID'].", '".sqltime()."', '".sqltime()."', ".$CategoryID.", '".db_string($Title)."', ".$Year.", '".db_string($Image)."', '".db_string($Description)."','".db_string($RecordLabel)."',
'".db_string($CatalogueNumber)."', ".$ReleaseType.", '".$BitrateList."','".$FormatList."', '".$MediaList."', '".$LogCue."', '1', '$GroupID')");
$RequestID = $DB->inserted_id();
} else {
@ -317,11 +339,13 @@
Image = '".db_string($Image)."',
Description = '".db_string($Description)."',
CatalogueNumber = '".db_string($CatalogueNumber)."',
RecordLabel = '".db_string($RecordLabel)."',
ReleaseType = ".$ReleaseType.",
BitrateList = '".$BitrateList."',
FormatList = '".$FormatList."',
MediaList = '".$MediaList."',
LogCue = '".$LogCue."'
LogCue = '".$LogCue."',
GroupID = '".$GroupID."'
WHERE ID = ".$RequestID);
//I almost didn't think of this, we need to be able to delete artists / tags
@ -334,6 +358,10 @@
$Cache->delete_value('request_artists_'.$RequestID);
}
if ($GroupID) {
$Cache->delete_value('requests_group_'.$GroupID);
}
/*
* Multiple Artists!
* For the multiple artists system, we have 3 steps:

View File

@ -81,7 +81,7 @@ function compare($X, $Y){
}
// Start output
show_header($Title,'browse,comments,torrent,bbcode');
show_header($Title,'browse,comments,torrent,bbcode,requests');
?>
<div class="thin">
<h2><?=$DisplayName?></h2>
@ -565,6 +565,48 @@ function filelist($Str) {
<? } ?>
</table>
<?
$Requests = get_group_requests($GroupID);
if (count($Requests) > 0) {
$i = 0;
?>
<div class="box">
<div class="head"><span style="font-weight: bold;">Requests (<?=count($Requests)?>)</span> <span style="float:right;"><a href="#" onClick="$('#requests').toggle(); this.innerHTML=(this.innerHTML=='(Hide)'?'(Show)':'(Hide)'); return false;">(Show)</a></span></div>
<table id="requests" class="hidden">
<tr class="colhead">
<td>Format / Bitrate / Media</td>
<td>Votes</td>
<td>Bounty</td>
</tr>
<? foreach($Requests as $Request) {
$RequestVotes = get_votes_array($Request['ID']);
if($Request['BitrateList'] != "") {
$BitrateString = implode(", ", explode("|", $Request['BitrateList']));
$FormatString = implode(", ", explode("|", $Request['FormatList']));
$MediaString = implode(", ", explode("|", $Request['MediaList']));
} else {
$BitrateString = "Unknown";
$FormatString = "Unknown";
$MediaString = "Unknown";
}
?>
<tr class="requestrows <?=(++$i%2?'rowa':'rowb')?>">
<td><a href="requests.php?action=view&id=<?=$Request['ID']?>"><?=$FormatString?> / <?=$BitrateString?> / <?=$MediaString?></a></td>
<td>
<form id="form_<?=$Request['ID']?>">
<span id="vote_count_<?=$Request['ID']?>"><?=count($RequestVotes['Voters'])?></span>
<input type="hidden" id="requestid_<?=$Request['ID']?>" name="requestid" value="<?=$Request['ID']?>" />
<input type="hidden" id="auth" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
&nbsp;&nbsp; <a href="javascript:Vote(0, <?=$Request['ID']?>)"><strong>(+)</strong></a>
</form>
</td>
<td><?=get_size($RequestVotes['TotalBounty'])?></td>
</tr>
<? } ?>
</table>
</div>
<?
}
$Collages = $Cache->get_value('torrent_collages_'.$GroupID);
if(!is_array($Collages)) {
$DB->query("SELECT c.Name, c.NumTorrents, c.ID FROM collages AS c JOIN collages_torrents AS ct ON ct.CollageID=c.ID WHERE ct.GroupID='$GroupID' AND Deleted='0' AND CategoryID!='0'");

View File

@ -1,4 +1,5 @@
<?
include(SERVER_ROOT.'/sections/requests/functions.php'); // get_request_tags()
function get_group_info($GroupID, $Return = true, $RevisionID = 0) {
global $Cache, $DB;
@ -149,3 +150,16 @@ function set_torrent_logscore($TorrentID) {
global $DB;
$DB->query("UPDATE torrents SET LogScore = (SELECT FLOOR(AVG(Score)) FROM torrents_logs_new WHERE TorrentID = ".$TorrentID.") WHERE ID = ".$TorrentID);
}
function get_group_requests($GroupID) {
global $DB, $Cache;
$Requests = $Cache->get_value('requests_group_'.$GroupID);
if ($Requests === FALSE) {
$DB->query("SELECT ID FROM requests WHERE GroupID = $GroupID");
$Requests = $DB->collect('ID');
$Cache->cache_value('requests_group_'.$GroupID, $Requests, 0);
}
$Requests = get_requests($Requests);
return $Requests['matches'];
}

View File

@ -49,6 +49,7 @@
r.CategoryID,
r.Title AS Title,
r.Year,
r.RecordLabel,
r.CatalogueNumber,
r.ReleaseType,
r.Image