Empty commit

This commit is contained in:
Git 2013-02-19 08:00:30 +00:00
parent dde2653aa2
commit 2c59a9e508
9 changed files with 93 additions and 92 deletions

View File

@ -17,7 +17,7 @@
WHERE ID = ".$RequestID);
list($UserID, $Title, $CategoryID, $GroupID) = $DB->next_record();
if($LoggedUser['ID'] != $UserID && !check_perms('site_moderate_requests')) {
if($LoggedUser['ID'] != $UserID && !check_perms('site_moderate_requests')) {
error(403);
}
@ -27,7 +27,7 @@
if($CategoryName == "Music") {
$ArtistForm = get_request_artists($RequestID);
$ArtistName = Artists::display_artists($ArtistForm, false, true);
$FullName = $ArtistName.$Title;
$FullName = $ArtistName.$Title;
} else {
$FullName = $Title;
}
@ -46,7 +46,7 @@
$DB->query("DELETE FROM requests_artists WHERE RequestID='$RequestID'");
if($UserID != $LoggedUser['ID']) {
Misc::send_pm($UserID, 0, db_string("A request you created has been deleted"), db_string("The request '".$FullName."' was deleted by [url=http://".NONSSL_SITE_URL."/user.php?id=".$LoggedUser['ID']."]".$LoggedUser['Username']."[/url] for the reason: ".$_POST['reason']));
Misc::send_pm($UserID, 0, db_string("A request you created has been deleted"), db_string("The request '".$FullName."' was deleted by [url=https://".SSL_SITE_URL."/user.php?id=".$LoggedUser['ID']."]".$LoggedUser['Username']."[/url] for the reason: ".$_POST['reason']));
}
Misc::write_log("Request $RequestID ($FullName) was deleted by user ".$LoggedUser['ID']." (".$LoggedUser['Username'].") for the reason: ".$_POST['reason']);

View File

@ -23,11 +23,11 @@
$TorrentID = $Matches[0];
}
}
if(!empty($Err)) {
error($Err);
}
preg_match("/torrentid=([0-9]+)/i", $Link, $Matches);
$TorrentID = $Matches[1];
if(!$TorrentID || !is_number($TorrentID)) {
@ -41,15 +41,15 @@
tg.ReleaseType,
t.Encoding,
t.Format,
t.Media,
t.HasLog,
t.HasCue,
t.Media,
t.HasLog,
t.HasCue,
t.LogScore,
tg.CategoryID,
IF(t.Remastered = '1', t.RemasterCatalogueNumber, tg.CatalogueNumber)
FROM torrents AS t
LEFT JOIN torrents_group AS tg ON t.GroupID=tg.ID
WHERE t.ID = ".$TorrentID."
WHERE t.ID = ".$TorrentID."
LIMIT 1");
@ -126,7 +126,7 @@
//if(strpos($LogCue, "Cue") && !$HasCue) {
// $Err = "This request requires a cue.";
//}
if(strpos($LogCue, "%")) {
preg_match("/\d+/", $LogCue, $Matches);
if((int) $LogScore < (int) $Matches[0]) {
@ -167,7 +167,7 @@
FillerID = ".$FillerID.",
TorrentID = ".$TorrentID.",
TimeFilled = '".sqltime()."'
WHERE ID = ".$RequestID);
WHERE ID = ".$RequestID);
if($CategoryName == "Music") {
$ArtistForm = get_request_artists($RequestID);
@ -181,7 +181,7 @@
$UserIDs = $DB->to_array();
foreach ($UserIDs as $User) {
list($VoterID) = $User;
Misc::send_pm($VoterID, 0, db_string("The request '".$FullName."' has been filled"), db_string("One of your requests - [url=http://".NONSSL_SITE_URL."/requests.php?action=view&amp;id=".$RequestID."]".$FullName."[/url] - has been filled. You can view it at [url]http://".NONSSL_SITE_URL."/torrents.php?torrentid=".$TorrentID."[/url]"), '');
Misc::send_pm($VoterID, 0, db_string("The request '".$FullName."' has been filled"), db_string("One of your requests - [url=https://".SSL_SITE_URL."/requests.php?action=view&amp;id=".$RequestID."]".$FullName."[/url] - has been filled. You can view it at [url]https://".SSL_SITE_URL."/torrents.php?torrentid=".$TorrentID."[/url]"), '');
}
$RequestVotes = get_votes_array($RequestID);
@ -189,7 +189,7 @@
// Give bounty
$DB->query("UPDATE users_main
SET Uploaded = (Uploaded + ".$RequestVotes['TotalBounty'].")
SET Uploaded = (Uploaded + ".$RequestVotes['TotalBounty'].")
WHERE ID = ".$FillerID);

View File

@ -25,25 +25,25 @@
if(!is_number($RequestID)) {
error(0);
}
$Request = Requests::get_requests(array($RequestID));
$Request = $Request['matches'][$RequestID];
if(empty($Request)) {
error(404);
}
list($RequestID, $RequestorID, $RequestorName, $TimeAdded, $LastVote, $CategoryID, $Title, $Year, $Image, $Description, $CatalogueNumber, $RecordLabel,
$ReleaseType, $BitrateList, $FormatList, $MediaList, $LogCue, $FillerID, $FillerName, $TorrentID, $TimeFilled, $GroupID, $OCLC) = $Request;
$VoteArray = get_votes_array($RequestID);
$VoteCount = count($VoteArray['Voters']);
$IsFilled = !empty($TorrentID);
$CategoryName = $Categories[$CategoryID - 1];
$ProjectCanEdit = (check_perms('project_team') && !$IsFilled && (($CategoryID == 0) || ($CategoryName == "Music" && $Year == 0)));
$CanEdit = ((!$IsFilled && $LoggedUser['ID'] == $RequestorID && $VoteCount < 2) || $ProjectCanEdit || check_perms('site_moderate_requests'));
if(!$CanEdit) {
error(403);
}
@ -111,13 +111,13 @@
$Artists = $_POST['artists'];
$Importance = $_POST['importance'];
}
if(!is_number($_POST['releasetype']) || !array_key_exists($_POST['releasetype'], $ReleaseTypes)) {
$Err = "Please pick a release type";
}
$ReleaseType = $_POST['releasetype'];
if(empty($_POST['all_formats']) && count($_POST['formats']) != count($Formats)) {
$FormatArray = $_POST['formats'];
if(count($FormatArray) < 1) {
@ -126,7 +126,7 @@
} else {
$AllFormats = true;
}
if(empty($_POST['all_bitrates']) && count($_POST['bitrates']) != count($Bitrates)) {
$BitrateArray = $_POST['bitrates'];
if(count($BitrateArray) < 1) {
@ -135,16 +135,16 @@
} else {
$AllBitrates = true;
}
if(empty($_POST['all_media']) && count($_POST['media']) != count($Media)) {
$MediaArray = $_POST['media'];
$MediaArray = $_POST['media'];
if(count($MediaArray) < 1) {
$Err = "You must require at least one type of media";
}
} else {
$AllMedia = true;
}
//$Bitrates[1] = FLAC
if(!empty($FormatArray) && in_array(1, $FormatArray)) {
$NeedLog = empty($_POST['needlog']) ? false : true;
@ -157,7 +157,7 @@
if(!is_number($MinLogScore)) {
$Err = "You've entered a minimum log score that isn't a number";
}
}
}
$NeedCue = empty($_POST['needcue']) ? false : true;
//FLAC was picked, require either Lossless or 24 bit Lossless
if(!$AllBitrates && !in_array(8, $BitrateArray) && !in_array(9, $BitrateArray)) {
@ -172,9 +172,9 @@
} else {
$NeedLog = false;
$NeedCue = false;
$MinLogScore = false;
$MinLogScore = false;
}
// GroupID
if (!empty($_POST['groupid'])) {
$GroupID = trim($_POST['groupid']);
@ -191,7 +191,7 @@
$Err = "Torrent Group, if entered, must correspond to a music group on the site.";
}
}
//Not required
if(!empty($_POST['editioninfo'])) {
$EditionInfo = trim($_POST['editioninfo']);
@ -308,7 +308,7 @@
} else {
$MediaList = "Any";
}
$LogCue = "";
if($NeedLog) {
$LogCue .= "Log";
@ -332,20 +332,20 @@
//Query time!
if($CategoryName == "Music") {
if($NewRequest) {
$DB->query("INSERT INTO requests (
$DB->query("INSERT INTO requests (
UserID, TimeAdded, LastVote, CategoryID, Title, Year, Image, Description, RecordLabel,
CatalogueNumber, ReleaseType, BitrateList, FormatList, MediaList, LogCue, Visible, GroupID, OCLC)
VALUES
(".$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', '".db_string($OCLC)."')");
$RequestID = $DB->inserted_id();
} else {
$DB->query("UPDATE requests
$DB->query("UPDATE requests
SET CategoryID = ".$CategoryID.",
Title = '".db_string($Title)."',
Year = ".$Year.",
Title = '".db_string($Title)."',
Year = ".$Year.",
Image = '".db_string($Image)."',
Description = '".db_string($Description)."',
CatalogueNumber = '".db_string($CatalogueNumber)."',
@ -358,7 +358,7 @@
GroupID = '".$GroupID."',
OCLC = '".db_string($OCLC)."'
WHERE ID = ".$RequestID);
//I almost didn't think of this, we need to be able to delete artists / tags
$DB->query("SELECT ArtistID FROM requests_artists WHERE RequestID = ".$RequestID);
$RequestArtists = $DB->to_array();
@ -368,17 +368,17 @@
$DB->query("DELETE FROM requests_artists WHERE RequestID = ".$RequestID);
$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:
* 1. See if each artist given already exists and if it does, grab the ID.
* 2. For each artist that didn't exist, create an artist.
* 3. Create a row in the requests_artists table for each artist, based on the ID.
* 3. Create a row in the requests_artists table for each artist, based on the ID.
*/
@ -393,7 +393,7 @@
aa.Redirect
FROM artists_alias AS aa
WHERE aa.Name = '".db_string($Artist['name'])."'");
while(list($ArtistID, $AliasID, $AliasName, $Redirect) = $DB->next_record(MYSQLI_NUM, false)) {
if(!strcasecmp($Artist['name'], $AliasName)) {
if($Redirect) {
@ -407,19 +407,19 @@
//2. For each artist that didn't exist, create an artist.
$DB->query("INSERT INTO artists_group (Name) VALUES ('".db_string($Artist['name'])."')");
$ArtistID = $DB->inserted_id();
$Cache->increment('stats_artist_count');
$DB->query("INSERT INTO artists_alias (ArtistID, Name) VALUES (".$ArtistID.", '".db_string($Artist['name'])."')");
$AliasID = $DB->inserted_id();
$ArtistForm[$Importance][$Num] = array('id' => $ArtistID, 'aliasid' => $AliasID, 'name' => $Artist['name']);
}
}
}
//3. Create a row in the requests_artists table for each artist, based on the ID.
//3. Create a row in the requests_artists table for each artist, based on the ID.
foreach($ArtistForm as $Importance => $Artists) {
foreach($Artists as $Num => $Artist) {
$DB->query("INSERT IGNORE INTO requests_artists (RequestID, ArtistID, AliasID, Importance) VALUES (".$RequestID.", ".$Artist['id'].", ".$Artist['aliasid'].", '".$Importance."')");
@ -427,9 +427,9 @@
$Cache->delete_value('artists_requests_'.$Artist['id']);
}
}
//End Music only
} else {
//Not a music request anymore, delete music only fields.
if(!$NewRequest) {
@ -439,14 +439,14 @@
if(empty($ArtistID)) { continue; }
//Get a count of how many groups or requests use the artist ID
$DB->query("SELECT COUNT(ag.ArtistID)
FROM artists_group as ag
LEFT JOIN requests_artists AS ra ON ag.ArtistID=ra.ArtistID
FROM artists_group as ag
LEFT JOIN requests_artists AS ra ON ag.ArtistID=ra.ArtistID
WHERE ra.ArtistID IS NOT NULL
AND ag.ArtistID = '$ArtistID'");
list($ReqCount) = $DB->next_record();
$DB->query("SELECT COUNT(ag.ArtistID)
FROM artists_group as ag
LEFT JOIN torrents_artists AS ta ON ag.ArtistID=ta.ArtistID
FROM artists_group as ag
LEFT JOIN torrents_artists AS ta ON ag.ArtistID=ta.ArtistID
WHERE ta.ArtistID IS NOT NULL
AND ag.ArtistID = '$ArtistID'");
list($GroupCount) = $DB->next_record();
@ -464,36 +464,36 @@
if($CategoryName == "Audiobooks" || $CategoryName == "Comedy") {
//These types require a year field.
if($NewRequest) {
$DB->query("INSERT INTO requests (
$DB->query("INSERT INTO requests (
UserID, TimeAdded, LastVote, CategoryID, Title, Year, Image, Description, Visible, OCLC)
VALUES
(".$LoggedUser['ID'].", '".sqltime()."', '".sqltime()."', ".$CategoryID.", '".db_string($Title)."', ".$Year.", '".db_string($Image)."', '".db_string($Description)."', '1', '".db_string($OCLC)."')");
$RequestID = $DB->inserted_id();
} else {
$DB->query("UPDATE requests
$DB->query("UPDATE requests
SET CategoryID = ".$CategoryID.",
Title = '".db_string($Title)."',
Year = ".$Year.",
Title = '".db_string($Title)."',
Year = ".$Year.",
Image = '".db_string($Image)."',
Description = '".db_string($Description)."',
OCLC = '".db_string($OCLC)."'
OCLC = '".db_string($OCLC)."'
WHERE ID = ".$RequestID);
}
} else {
if($NewRequest) {
$DB->query("INSERT INTO requests (
$DB->query("INSERT INTO requests (
UserID, TimeAdded, LastVote, CategoryID, Title, Image, Description, Visible, OCLC)
VALUES
(".$LoggedUser['ID'].", '".sqltime()."', '".sqltime()."', ".$CategoryID.", '".db_string($Title)."', '".db_string($Image)."', '".db_string($Description)."', '1', '".db_string($OCLC)."')");
$RequestID = $DB->inserted_id();
} else {
$DB->query("UPDATE requests
$DB->query("UPDATE requests
SET CategoryID = ".$CategoryID.",
Title = '".db_string($Title)."',
Title = '".db_string($Title)."',
Image = '".db_string($Image)."',
Description = '".db_string($Description)."',
OCLC = '".db_string($OCLC)."'
@ -512,39 +512,39 @@
$Tag = Misc::sanitize_tag($Tag);
$Tag = Misc::get_alias_tag($Tag);
$Tags[$Index] = $Tag; //For announce
$DB->query("INSERT INTO tags
$DB->query("INSERT INTO tags
(Name, UserID)
VALUES
('".$Tag."', ".$LoggedUser['ID'].")
VALUES
('".$Tag."', ".$LoggedUser['ID'].")
ON DUPLICATE KEY UPDATE Uses=Uses+1");
$TagID = $DB->inserted_id();
$DB->query("INSERT IGNORE INTO requests_tags
(TagID, RequestID)
VALUES
VALUES
(".$TagID.", ".$RequestID.")");
}
if($NewRequest) {
//Remove the bounty and create the vote
$DB->query("INSERT INTO requests_votes
$DB->query("INSERT INTO requests_votes
(RequestID, UserID, Bounty)
VALUES
(".$RequestID.", ".$LoggedUser['ID'].", ".($Bytes * (1 - $RequestTax)).")");
$DB->query("UPDATE users_main SET Uploaded = (Uploaded - ".$Bytes.") WHERE ID = ".$LoggedUser['ID']);
$Cache->delete_value('user_stats_'.$LoggedUser['ID']);
if($CategoryName == "Music") {
$Announce = "'".$Title."' - ".Artists::display_artists($ArtistForm, false, false)." http://".NONSSL_SITE_URL."/requests.php?action=view&id=".$RequestID." - ".implode(" ", $Tags);
$Announce = "'".$Title."' - ".Artists::display_artists($ArtistForm, false, false)." https://".SSL_SITE_URL."/requests.php?action=view&id=".$RequestID." - ".implode(" ", $Tags);
} else {
$Announce = "'".$Title."' - http://".NONSSL_SITE_URL."/requests.php?action=view&id=".$RequestID." - ".implode(" ", $Tags);
$Announce = "'".$Title."' - https://".SSL_SITE_URL."/requests.php?action=view&id=".$RequestID." - ".implode(" ", $Tags);
}
send_irc('PRIVMSG #'.NONSSL_SITE_URL.'-requests :'.$Announce);
send_irc('PRIVMSG #'.SSL_SITE_URL.'-requests :'.$Announce);
} else {
$Cache->delete_value('request_'.$RequestID);
$Cache->delete_value('request_artists_'.$RequestID);

View File

@ -11,12 +11,12 @@
$DB->query("SELECT
r.CategoryID,
r.UserID,
r.FillerID,
r.UserID,
r.FillerID,
r.Title,
u.Uploaded,
r.GroupID
FROM requests AS r
FROM requests AS r
LEFT JOIN users_main AS u ON u.ID=FillerID
WHERE r.ID= ".$RequestID);
list($CategoryID, $UserID, $FillerID, $Title, $Uploaded, $GroupID) = $DB->next_record();
@ -52,12 +52,12 @@
} else {
$DB->query("UPDATE users_main SET Uploaded = Uploaded - ".$RequestVotes['TotalBounty']." WHERE ID = ".$FillerID);
}
Misc::send_pm($FillerID, 0, db_string("A request you filled has been unfilled"), db_string("The request '[url=http://".NONSSL_SITE_URL."/requests.php?action=view&amp;id=".$RequestID."]".$FullName."[/url]' was unfilled by [url=http://".NONSSL_SITE_URL."/user.php?id=".$LoggedUser['ID']."]".$LoggedUser['Username']."[/url] for the reason: ".$_POST['reason']));
Misc::send_pm($FillerID, 0, db_string("A request you filled has been unfilled"), db_string("The request '[url=https://".SSL_SITE_URL."/requests.php?action=view&amp;id=".$RequestID."]".$FullName."[/url]' was unfilled by [url=https://".SSL_SITE_URL."/user.php?id=".$LoggedUser['ID']."]".$LoggedUser['Username']."[/url] for the reason: ".$_POST['reason']));
$Cache->delete_value('user_stats_'.$FillerID);
if($UserID != $LoggedUser['ID']) {
Misc::send_pm($UserID, 0, db_string("A request you created has been unfilled"), db_string("The request '[url=http://".NONSSL_SITE_URL."/requests.php?action=view&amp;id=".$RequestID."]".$FullName."[/url]' was unfilled by [url=http://".NONSSL_SITE_URL."/user.php?id=".$LoggedUser['ID']."]".$LoggedUser['Username']."[/url] for the reason: ".$_POST['reason']));
Misc::send_pm($UserID, 0, db_string("A request you created has been unfilled"), db_string("The request '[url=https://".SSL_SITE_URL."/requests.php?action=view&amp;id=".$RequestID."]".$FullName."[/url]' was unfilled by [url=https://".SSL_SITE_URL."/user.php?id=".$LoggedUser['ID']."]".$LoggedUser['Username']."[/url] for the reason: ".$_POST['reason']));
}
Misc::write_log("Request $RequestID ($FullName), with a ".Format::get_size($RequestVotes['TotalBounty'])." bounty, was unfilled by user ".$LoggedUser['ID']." (".$LoggedUser['Username'].") for the reason: ".$_POST['reason']);

View File

@ -9,8 +9,8 @@
authorize();
if(empty($_GET['id']) || !is_number($_GET['id'])) {
error(0);
if(empty($_GET['id']) || !is_number($_GET['id'])) {
error(0);
}
$RequestID = $_GET['id'];
@ -27,13 +27,13 @@
list($Filled) = $DB->next_record();
if($LoggedUser['BytesUploaded'] >= $Amount && $Filled == 0){
// Create vote!
$DB->query("INSERT IGNORE INTO requests_votes
(RequestID, UserID, Bounty)
VALUES
(".$RequestID.", ".$LoggedUser['ID'].", ".$Bounty.")");
if($DB->affected_rows() < 1) {
//Insert failed, probably a dupe vote, just increase their bounty.
$DB->query("UPDATE requests_votes
@ -47,7 +47,7 @@
$DB->query("UPDATE requests SET LastVote = NOW() WHERE ID = ".$RequestID);
$Cache->delete_value('request_'.$RequestID);
$Cache->delete_value('request_votes_'.$RequestID);

View File

@ -525,11 +525,12 @@ function header_link($SortKey,$DefaultWay="desc") {
$TorrentIDs = array_merge($TorrentIDs, array_keys($Group['Torrents']));
}
}
// Get a list of all torrent ids that match the search query
$SphQLTor->where('id', $TorrentIDs)->limit(0, count($TorrentIDs), count($TorrentIDs));
$SphQLResultTor = $SphQLTor->query();
$TorrentIDs = array_fill_keys($SphQLResultTor->collect('id'), true);
if (!empty($TorrentIDs)) {
// Get a list of all torrent ids that match the search query
$SphQLTor->where('id', $TorrentIDs)->limit(0, count($TorrentIDs), count($TorrentIDs));
$SphQLResultTor = $SphQLTor->query();
$TorrentIDs = array_fill_keys($SphQLResultTor->collect('id'), true);
}
}
}
/** End run search query and collect results **/

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

File diff suppressed because one or more lines are too long