Empty commit

This commit is contained in:
Git 2013-02-16 08:00:57 +00:00
parent 7c7573eb48
commit a49bc32a52
23 changed files with 300 additions and 258 deletions

View File

@ -139,7 +139,7 @@ function foot() {
<td colspan="2" style="text-align: center;"> <td colspan="2" style="text-align: center;">
<p>Be sure that your torrent is approved by the <a href="rules.php?p=upload" target="_blank">rules</a>. Not doing this will result in a <strong class="important_text">warning</strong> or <strong class="important_text">worse</strong>.</p> <p>Be sure that your torrent is approved by the <a href="rules.php?p=upload" target="_blank">rules</a>. Not doing this will result in a <strong class="important_text">warning</strong> or <strong class="important_text">worse</strong>.</p>
<? if($this->NewTorrent) { ?> <? if($this->NewTorrent) { ?>
<p>After uploading the torrent, you will have a one hour grace period during which no one other than you can fill requests with this torrent. Make use of this time wisely, and search the requests.</p> <p>After uploading the torrent, you will have a one hour grace period during which no one other than you can fill requests with this torrent. Make use of this time wisely, and <a href="requests.php">search the list of requests</a>.</p>
<? } ?> <? } ?>
<input id="post" type="submit" <? if($this->NewTorrent) { echo "value=\"Upload torrent\""; } else { echo "value=\"Edit torrent\"";} ?> /> <input id="post" type="submit" <? if($this->NewTorrent) { echo "value=\"Upload torrent\""; } else { echo "value=\"Edit torrent\"";} ?> />
</td> </td>
@ -588,17 +588,17 @@ function show() {
<? } ?> <? } ?>
<input type="text" id="tags" name="tags" size="40" value="<?=display_str($Torrent['TagList']) ?>" <?=$this->Disabled?>/> <input type="text" id="tags" name="tags" size="40" value="<?=display_str($Torrent['TagList']) ?>" <?=$this->Disabled?>/>
<br /> <br />
Tags should be comma separated, and you should use a period ('.') to separate words inside a tag - eg. '<strong class="important_text_alt">hip.hop</strong>'. Tags should be comma-separated, and you should use a period (".") to separate words inside a tag &mdash; e.g. "<strong class="important_text_alt">hip.hop</strong>".
<br /><br /> <br /><br />
There is a list of official tags to the left of the text box. Please use these tags instead of 'unofficial' tags (e.g. use the official '<strong class="important_text_alt">drum.and.bass</strong>' tag, instead of an unofficial '<strong class="important_text">dnb</strong>' tag). <strong>Please note that the '2000s' tag refers to music produced between 2000 and 2009.</strong> There is a list of official tags to the left of the text box. Please use these tags instead of "unofficial" tags (e.g. use the official "<strong class="important_text_alt">drum.and.bass</strong>" tag, instead of an unofficial "<strong class="important_text">dnb</strong>" tag). <strong>Please note that the "<strong class="important_text_alt">2000s</strong>" tag refers to music produced between 2000 and 2009.</strong>
<br /><br /> <br /><br />
Avoid abbreviations if at all possible. So instead of tagging an album as '<strong class="important_text">alt</strong>', tag it as '<strong class="important_text_alt">alternative</strong>'. Make sure that you use correct spelling. Avoid abbreviations if at all possible. So instead of tagging an album as "<strong class="important_text">alt</strong>", tag it as "<strong class="important_text_alt">alternative</strong>". Make sure that you use correct spelling.
<br /><br /> <br /><br />
Avoid using multiple synonymous tags. Using both '<strong class="important_text">prog.rock</strong>' and '<strong class="important_text_alt">progressive.rock</strong>' is redundant and annoying - just use the official '<strong class="important_text_alt">progressive.rock</strong>' tag. Avoid using multiple synonymous tags. Using both "<strong class="important_text">prog.rock</strong>" and "<strong class="important_text_alt">progressive.rock</strong>" is redundant and annoying&mdash;just use the official "<strong class="important_text_alt">progressive.rock</strong>" tag.
<br /><br /> <br /><br />
Don't use 'useless' tags, such as '<strong class="important_text">seen.live</strong>', '<strong class="important_text">awesome</strong>', '<strong class="important_text">rap</strong>' (is encompassed by '<strong class="important_text_alt">hip.hop</strong>'), etc. If an album is live, you can tag it as '<strong class="important_text_alt">live</strong>'. Do not add "useless" tags, such as "<strong class="important_text">seen.live</strong>", "<strong class="important_text">awesome</strong>", "<strong class="important_text">rap</strong>" (is encompassed by "<strong class="important_text_alt">hip.hop</strong>"), etc. If an album is live, you can tag it as "<strong class="important_text_alt">live</strong>".
<br /><br /> <br /><br />
Only tag information on the album itself - NOT THE INDIVIDUAL RELEASE. Tags such as '<strong class="important_text">v0</strong>', '<strong class="important_text">eac</strong>', '<strong class="important_text">vinyl</strong>', '<strong class="important_text">from.oink</strong>' etc. are strictly forbidden. Remember that these tags will be used for other versions of the same album. Only tag information on the album itself&mdash;NOT THE INDIVIDUAL RELEASE. Tags such as "<strong class="important_text">v0</strong>", "<strong class="important_text">eac</strong>", "<strong class="important_text">vinyl</strong>", "<strong class="important_text">from.oink</strong>", etc. are strictly forbidden. Remember that these tags will be used for other versions of the same album.
<br /><br /> <br /><br />
<strong>You should be able to build up a list of tags using only the official tags to the left of the text box. If you are in any doubt about whether or not a tag is acceptable, do not add it.</strong> <strong>You should be able to build up a list of tags using only the official tags to the left of the text box. If you are in any doubt about whether or not a tag is acceptable, do not add it.</strong>
</td> </td>

View File

@ -10,16 +10,16 @@ public static function vote_link($GroupID, $Vote = '') {
global $LoggedUser; global $LoggedUser;
if (!$LoggedUser['NoVoteLinks'] && check_perms('site_album_votes')) { ?> 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: Vote:
<a href="#" onclick="UpVoteGroup(<?=$GroupID?>, '<?=$LoggedUser['AuthKey']?>'); return false;" class="small_upvote vote_link_<?=$GroupID?><?=(!empty($Vote)?' hidden':'')?>"></a> <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':'')?>"></span> <span class="voted_type small_upvoted voted_up_<?=$GroupID?><?=(($Vote == 'Down' || empty($Vote))?' hidden':'')?>" title="Upvoted"></span>
<a href="#" onclick="DownVoteGroup(<?=$GroupID?>, '<?=$LoggedUser['AuthKey']?>'); return false;" class="small_downvote vote_link_<?=$GroupID?><?=(!empty($Vote)?' hidden':'')?>"></a> <a href="#" onclick="DownVoteGroup(<?=$GroupID?>, '<?=$LoggedUser['AuthKey']?>'); return false;" class="small_downvote vote_link_<?=$GroupID?><?=(!empty($Vote)?' hidden':'')?>" title="Downvote"></a>
<span class="voted_type small_downvoted voted_down_<?=$GroupID?><?=(($Vote == 'Up'|| empty($Vote))?' hidden':'')?>"></span> <span class="voted_type small_downvoted voted_down_<?=$GroupID?><?=(($Vote == 'Up'|| empty($Vote))?' hidden':'')?>" title="Downvoted"></span>
<a href="#" onclick="UnvoteGroup(<?=$GroupID?>, '<?=$LoggedUser['AuthKey']?>'); return false;" class="small_clearvote vote_clear_<?=$GroupID?><?=(empty($Vote)?' hidden':'')?>">x</a> <a href="#" onclick="UnvoteGroup(<?=$GroupID?>, '<?=$LoggedUser['AuthKey']?>'); return false;" class="small_clearvote vote_clear_<?=$GroupID?><?=(empty($Vote)?' hidden':'')?>" title="Clear your vote">x</a>
</span> </span>
<? } <? }
} }
/** /**
* Returns an array with User Vote data: GroupID and vote type * Returns an array with User Vote data: GroupID and vote type
* @global CACHE $Cache * @global CACHE $Cache
@ -29,11 +29,11 @@ public static function vote_link($GroupID, $Vote = '') {
*/ */
public static function get_user_votes($UserID) { public static function get_user_votes($UserID) {
global $DB, $Cache; global $DB, $Cache;
if ((int)$UserID == 0) { if ((int)$UserID == 0) {
return array(); return array();
} }
$UserVotes = $Cache->get_value('voted_albums_'.$UserID); $UserVotes = $Cache->get_value('voted_albums_'.$UserID);
if ($UserVotes === FALSE) { if ($UserVotes === FALSE) {
$DB->query('SELECT GroupID, Type FROM users_votes WHERE UserID='.$UserID); $DB->query('SELECT GroupID, Type FROM users_votes WHERE UserID='.$UserID);
@ -42,7 +42,7 @@ public static function get_user_votes($UserID) {
} }
return $UserVotes; return $UserVotes;
} }
/** /**
* Returns an array with torrent group vote data * Returns an array with torrent group vote data
* @global CACHE $Cache * @global CACHE $Cache
@ -52,7 +52,7 @@ public static function get_user_votes($UserID) {
*/ */
public static function get_group_votes($GroupID) { public static function get_group_votes($GroupID) {
global $DB, $Cache; global $DB, $Cache;
$GroupVotes = $Cache->get_value('votes_'.$GroupID); $GroupVotes = $Cache->get_value('votes_'.$GroupID);
if ($GroupVotes === FALSE) { if ($GroupVotes === FALSE) {
$DB->query("SELECT Ups AS Ups, Total AS Total FROM torrents_votes WHERE GroupID=$GroupID"); $DB->query("SELECT Ups AS Ups, Total AS Total FROM torrents_votes WHERE GroupID=$GroupID");
@ -65,7 +65,7 @@ public static function get_group_votes($GroupID) {
} }
return $GroupVotes; return $GroupVotes;
} }
/** /**
* Computes the inverse normal CDF of a p-value * Computes the inverse normal CDF of a p-value
* @param float $GroupID * @param float $GroupID
@ -157,12 +157,12 @@ private function inverse_ncdf($p) {
* @param int $Total Number of total votes * @param int $Total Number of total votes
* @return float Ranking score * @return float Ranking score
*/ */
public static function binomial_score($Ups, $Total) { public static function binomial_score($Ups, $Total) {
// Confidence level for binomial scoring (p-value .95) // Confidence level for binomial scoring (p-value .95)
//define(Z_VAL, 1.645211440143815); //define(Z_VAL, 1.645211440143815);
// Confidence level for binomial scoring (p-value .90) // Confidence level for binomial scoring (p-value .90)
define(Z_VAL, 1.281728756502709); define(Z_VAL, 1.281728756502709);
if (($Total <= 0) || ($Ups < 0)) { if (($Total <= 0) || ($Ups < 0)) {
return 0; return 0;
} }
@ -187,7 +187,7 @@ public static function get_ranking($GroupID, $Year) {
'year' =>Votes::get_rank_year($GroupID, $Year), 'year' =>Votes::get_rank_year($GroupID, $Year),
'decade' =>Votes::get_rank_decade($GroupID, $Year)); 'decade' =>Votes::get_rank_decade($GroupID, $Year));
} }
/** /**
* Gets where this album ranks overall. * Gets where this album ranks overall.
* @global CACHE $Cache * @global CACHE $Cache
@ -197,12 +197,12 @@ public static function get_ranking($GroupID, $Year) {
*/ */
public static function get_rank_all($GroupID) { public static function get_rank_all($GroupID) {
global $Cache, $DB; global $Cache, $DB;
$GroupID = (int)$GroupID; $GroupID = (int)$GroupID;
if ($GroupID <= 0) { if ($GroupID <= 0) {
return false; return false;
} }
$Rankings = $Cache->get_value('voting_ranks_overall'); $Rankings = $Cache->get_value('voting_ranks_overall');
if ($Rankings === FALSE) { if ($Rankings === FALSE) {
$Rankings = array(); $Rankings = array();
@ -213,10 +213,10 @@ public static function get_rank_all($GroupID) {
} }
$Cache->cache_value('voting_ranks_overall', $Rankings); $Cache->cache_value('voting_ranks_overall', $Rankings);
} }
return isset($Rankings[$GroupID])?$Rankings[$GroupID]:false; return isset($Rankings[$GroupID])?$Rankings[$GroupID]:false;
} }
/** /**
* Gets where this album ranks in its year. * Gets where this album ranks in its year.
* @global CACHE $Cache * @global CACHE $Cache
@ -227,18 +227,18 @@ public static function get_rank_all($GroupID) {
*/ */
public static function get_rank_year($GroupID, $Year) { public static function get_rank_year($GroupID, $Year) {
global $Cache, $DB; global $Cache, $DB;
$GroupID = (int)$GroupID; $GroupID = (int)$GroupID;
$Year = (int)$Year; $Year = (int)$Year;
if ($GroupID <= 0 || $Year <= 0) { if ($GroupID <= 0 || $Year <= 0) {
return false; return false;
} }
$Rankings = $Cache->get_value('voting_ranks_year_'.$Year); $Rankings = $Cache->get_value('voting_ranks_year_'.$Year);
if ($Rankings === FALSE) { if ($Rankings === FALSE) {
$Rankings = array(); $Rankings = array();
$i = 0; $i = 0;
$DB->query("SELECT GroupID $DB->query("SELECT GroupID
FROM torrents_votes AS v FROM torrents_votes AS v
JOIN torrents_group AS g ON g.ID = v.GroupID JOIN torrents_group AS g ON g.ID = v.GroupID
WHERE g.Year = $Year WHERE g.Year = $Year
@ -248,7 +248,7 @@ public static function get_rank_year($GroupID, $Year) {
} }
$Cache->cache_value('voting_ranks_year_'.$Year , $Rankings); $Cache->cache_value('voting_ranks_year_'.$Year , $Rankings);
} }
return isset($Rankings[$GroupID])?$Rankings[$GroupID]:false; return isset($Rankings[$GroupID])?$Rankings[$GroupID]:false;
} }
@ -262,22 +262,22 @@ public static function get_rank_year($GroupID, $Year) {
*/ */
public static function get_rank_decade($GroupID, $Year) { public static function get_rank_decade($GroupID, $Year) {
global $Cache, $DB; global $Cache, $DB;
$GroupID = (int)$GroupID; $GroupID = (int)$GroupID;
$Year = (int)$Year; $Year = (int)$Year;
$Year = (int)$Year; $Year = (int)$Year;
if ((int)$GroupID <= 0 || (int)$Year <= 0) { if ((int)$GroupID <= 0 || (int)$Year <= 0) {
return false; return false;
} }
// First year of the decade // First year of the decade
$Year = $Year - ($Year % 10); $Year = $Year - ($Year % 10);
$Rankings = $Cache->get_value('voting_ranks_decade_'.$Year); $Rankings = $Cache->get_value('voting_ranks_decade_'.$Year);
if ($Rankings === FALSE) { if ($Rankings === FALSE) {
$Rankings = array(); $Rankings = array();
$i = 0; $i = 0;
$DB->query("SELECT GroupID $DB->query("SELECT GroupID
FROM torrents_votes AS v FROM torrents_votes AS v
JOIN torrents_group AS g ON g.ID = v.GroupID JOIN torrents_group AS g ON g.ID = v.GroupID
WHERE g.Year BETWEEN $Year AND ".($Year+9)." WHERE g.Year BETWEEN $Year AND ".($Year+9)."
@ -288,8 +288,8 @@ public static function get_rank_decade($GroupID, $Year) {
} }
$Cache->cache_value('voting_ranks_decade_'.$Year , $Rankings); $Cache->cache_value('voting_ranks_decade_'.$Year , $Rankings);
} }
return isset($Rankings[$GroupID])?$Rankings[$GroupID]:false; return isset($Rankings[$GroupID])?$Rankings[$GroupID]:false;
} }
} }
?> ?>

View File

@ -11,7 +11,7 @@ function header_link($SortKey,$DefaultWay="desc") {
if($OrderWay=="desc") { $NewWay="asc"; } if($OrderWay=="desc") { $NewWay="asc"; }
else { $NewWay="desc"; } else { $NewWay="desc"; }
} else { $NewWay=$DefaultWay; } } else { $NewWay=$DefaultWay; }
return "torrents.php?order_way=".$NewWay."&amp;order_by=".$SortKey."&amp;".Format::get_url(array('order_way','order_by')); return "torrents.php?order_way=".$NewWay."&amp;order_by=".$SortKey."&amp;".Format::get_url(array('order_way','order_by'));
} }
@ -113,7 +113,6 @@ function header_link($SortKey,$DefaultWay="desc") {
foreach ($SearchBitrates as $ID=>$Val) { foreach ($SearchBitrates as $ID=>$Val) {
$SearchBitrates[$ID] = strtolower($Val); $SearchBitrates[$ID] = strtolower($Val);
} }
foreach ($Formats as $ID => $Val) { foreach ($Formats as $ID => $Val) {
$SearchFormats[$ID] = strtolower($Val); $SearchFormats[$ID] = strtolower($Val);
} }
@ -490,12 +489,12 @@ function header_link($SortKey,$DefaultWay="desc") {
if($TorrentCount == 0) { if($TorrentCount == 0) {
$DB->query("SELECT $DB->query("SELECT
tags.Name, tags.Name,
((COUNT(tags.Name)-2)*(SUM(tt.PositiveVotes)-SUM(tt.NegativeVotes)))/(tags.Uses*0.8) AS Score ((COUNT(tags.Name)-2)*(SUM(tt.PositiveVotes)-SUM(tt.NegativeVotes)))/(tags.Uses*0.8) AS Score
FROM xbt_snatched AS s FROM xbt_snatched AS s
INNER JOIN torrents AS t ON t.ID=s.fid INNER JOIN torrents AS t ON t.ID=s.fid
INNER JOIN torrents_group AS g ON t.GroupID=g.ID INNER JOIN torrents_group AS g ON t.GroupID=g.ID
INNER JOIN torrents_tags AS tt ON tt.GroupID=g.ID INNER JOIN torrents_tags AS tt ON tt.GroupID=g.ID
INNER JOIN tags ON tags.ID=tt.TagID INNER JOIN tags ON tags.ID=tt.TagID
WHERE s.uid='$LoggedUser[ID]' WHERE s.uid='$LoggedUser[ID]'
@ -557,7 +556,7 @@ function header_link($SortKey,$DefaultWay="desc") {
} else { } else {
$Torrents = array($Result['id'] => $GroupInfo['Torrents'][$Result['id']]); $Torrents = array($Result['id'] => $GroupInfo['Torrents'][$Result['id']]);
} }
$TagList = explode(' ',str_replace('_','.',$GroupInfo['TagList'])); $TagList = explode(' ',str_replace('_','.',$GroupInfo['TagList']));
$JsonArtists = array(); $JsonArtists = array();
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) { if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
@ -590,14 +589,14 @@ function header_link($SortKey,$DefaultWay="desc") {
$LastRemasterRecordLabel = ''; $LastRemasterRecordLabel = '';
$LastRemasterCatalogueNumber = ''; $LastRemasterCatalogueNumber = '';
$LastMedia = ''; $LastMedia = '';
$EditionID = 0; $EditionID = 0;
unset($FirstUnknown); unset($FirstUnknown);
$JsonTorrents = array(); $JsonTorrents = array();
foreach($Torrents as $TorrentID => $Data) { foreach($Torrents as $TorrentID => $Data) {
// All of the individual torrents in the group // All of the individual torrents in the group
// If they're using the advanced search and have chosen enabled grouping, we just skip the torrents that don't check out // If they're using the advanced search and have chosen enabled grouping, we just skip the torrents that don't check out
if (!isset($TorrentIDs[$TorrentID])) { if (!isset($TorrentIDs[$TorrentID])) {
continue; continue;
@ -606,7 +605,7 @@ function header_link($SortKey,$DefaultWay="desc") {
if ($Data['Remastered'] && !$Data['RemasterYear']) { if ($Data['Remastered'] && !$Data['RemasterYear']) {
$FirstUnknown = !isset($FirstUnknown); $FirstUnknown = !isset($FirstUnknown);
} }
if (isset($GroupedCategories[$CategoryID-1]) if (isset($GroupedCategories[$CategoryID-1])
&& ($Data['RemasterTitle'] != $LastRemasterTitle && ($Data['RemasterTitle'] != $LastRemasterTitle
|| $Data['RemasterYear'] != $LastRemasterYear || $Data['RemasterYear'] != $LastRemasterYear
@ -617,7 +616,7 @@ function header_link($SortKey,$DefaultWay="desc") {
$EditionID++; $EditionID++;
if ($Data['Remastered'] && $Data['RemasterYear'] != 0) { if ($Data['Remastered'] && $Data['RemasterYear'] != 0) {
$RemasterName = $Data['RemasterYear']; $RemasterName = $Data['RemasterYear'];
$AddExtra = " - "; $AddExtra = " - ";
if ($Data['RemasterRecordLabel']) { $RemasterName .= $AddExtra.display_str($Data['RemasterRecordLabel']); $AddExtra=' / '; } if ($Data['RemasterRecordLabel']) { $RemasterName .= $AddExtra.display_str($Data['RemasterRecordLabel']); $AddExtra=' / '; }
@ -641,7 +640,7 @@ function header_link($SortKey,$DefaultWay="desc") {
$LastRemasterRecordLabel = $Data['RemasterRecordLabel']; $LastRemasterRecordLabel = $Data['RemasterRecordLabel'];
$LastRemasterCatalogueNumber = $Data['RemasterCatalogueNumber']; $LastRemasterCatalogueNumber = $Data['RemasterCatalogueNumber'];
$LastMedia = $Data['Media']; $LastMedia = $Data['Media'];
$JsonTorrents[] = array( $JsonTorrents[] = array(
'torrentId' => (int) $TorrentID, 'torrentId' => (int) $TorrentID,
'editionId' => (int) $EditionID, 'editionId' => (int) $EditionID,
@ -671,7 +670,7 @@ function header_link($SortKey,$DefaultWay="desc") {
'hasSnatched' => $Data['IsSnatched'] 'hasSnatched' => $Data['IsSnatched']
); );
} }
$JsonGroups[] = array( $JsonGroups[] = array(
'groupId' => (int) $GroupID, 'groupId' => (int) $GroupID,
'groupName' => $GroupName, 'groupName' => $GroupName,
@ -691,9 +690,9 @@ function header_link($SortKey,$DefaultWay="desc") {
} }
else { else {
// Viewing a type that does not require grouping // Viewing a type that does not require grouping
list($TorrentID, $Data) = each($Torrents); list($TorrentID, $Data) = each($Torrents);
$JsonGroups[] = array( $JsonGroups[] = array(
'groupId' => (int) $GroupID, 'groupId' => (int) $GroupID,
'groupName' => $GroupName, 'groupName' => $GroupName,

View File

@ -57,6 +57,7 @@
$JsonTorrentList = array(); $JsonTorrentList = array();
foreach ($TorrentList as $Torrent) { foreach ($TorrentList as $Torrent) {
$Userinfo = Users::user_info($Torrent['UserID']);
$JsonTorrentList[] = array( $JsonTorrentList[] = array(
'id' => (int) $Torrent['ID'], 'id' => (int) $Torrent['ID'],
'media' => $Torrent['Media'], 'media' => $Torrent['Media'],
@ -82,7 +83,7 @@
'fileList' => $Torrent['FileList'], 'fileList' => $Torrent['FileList'],
'filePath' => $Torrent['FilePath'], 'filePath' => $Torrent['FilePath'],
'userId' => (int) $Torrent['UserID'], 'userId' => (int) $Torrent['UserID'],
'username' => $Torrent['Username'] 'username' => $Userinfo['Username']
); );
} }

View File

@ -1,37 +1,36 @@
<? <?
//TODO: freeleech in ratio hit calculations, in addition to a warning of whats freeleech in the Summary.txt //TODO: freeleech in ratio hit calculations, in addition to a warning of whats freeleech in the Summary.txt
/* /*
This page is something of a hack so those This page is something of a hack so those
easily scared off by funky solutions, don't easily scared off by funky solutions, don't
touch it! :P touch it! :P
There is a central problem to this page, it's There is a central problem to this page, it's
impossible to order before grouping in SQL, and impossible to order before grouping in SQL, and
it's slow to run sub queries, so we had to get it's slow to run sub queries, so we had to get
creative for this one. creative for this one.
The solution I settled on abuses the way The solution I settled on abuses the way
$DB->to_array() works. What we've done, is $DB->to_array() works. What we've done, is
backwards ordering. The results returned by the backwards ordering. The results returned by the
query have the best one for each GroupID last, query have the best one for each GroupID last,
and while to_array traverses the results, it and while to_array traverses the results, it
overwrites the keys and leaves us with only the overwrites the keys and leaves us with only the
desired result. This does mean however, that desired result. This does mean however, that
the SQL has to be done in a somewhat backwards the SQL has to be done in a somewhat backwards
fashion. fashion.
Thats all you get for a disclaimer, just Thats all you get for a disclaimer, just
remember, this page isn't for the faint of remember, this page isn't for the faint of
heart. -A9 heart. -A9
SQL template: SQL template:
SELECT SELECT
CASE CASE
WHEN t.Format='Ogg Vorbis' THEN 0 WHEN t.Format='MP3' AND t.Encoding='V0 (VBR)' THEN 1
WHEN t.Format='MP3' AND t.Encoding='V0 (VBR)' THEN 1 WHEN t.Format='MP3' AND t.Encoding='V2 (VBR)' THEN 2
WHEN t.Format='MP3' AND t.Encoding='V2 (VBR)' THEN 2 ELSE 100
ELSE 100 END AS Rank,
END AS Rank,
t.GroupID, t.GroupID,
t.Media, t.Media,
t.Format, t.Format,
@ -40,7 +39,7 @@
tg.Name, tg.Name,
a.Name, a.Name,
t.Size t.Size
FROM torrents AS t FROM torrents AS t
INNER JOIN torrents_group AS tg ON tg.ID=t.GroupID AND tg.CategoryID='1' INNER JOIN torrents_group AS tg ON tg.ID=t.GroupID AND tg.CategoryID='1'
INNER JOIN artists_group AS a ON a.ArtistID=tg.ArtistID AND a.ArtistID='59721' INNER JOIN artists_group AS a ON a.ArtistID=tg.ArtistID AND a.ArtistID='59721'
LEFT JOIN torrents_files AS f ON t.ID=f.TorrentID LEFT JOIN torrents_files AS f ON t.ID=f.TorrentID
@ -48,10 +47,10 @@
*/ */
if( if(
!isset($_REQUEST['artistid']) || !isset($_REQUEST['artistid']) ||
!isset($_REQUEST['preference']) || !isset($_REQUEST['preference']) ||
!is_number($_REQUEST['preference']) || !is_number($_REQUEST['preference']) ||
!is_number($_REQUEST['artistid']) || !is_number($_REQUEST['artistid']) ||
$_REQUEST['preference'] > 2 || $_REQUEST['preference'] > 2 ||
count($_REQUEST['list']) == 0 count($_REQUEST['list']) == 0
) { error(0); } ) { error(0); }
@ -100,7 +99,6 @@
case '36': $SQL .= "t.Format='FLAC' AND t.Encoding='Lossless' AND HasLog='1'"; break; case '36': $SQL .= "t.Format='FLAC' AND t.Encoding='Lossless' AND HasLog='1'"; break;
case '37': $SQL .= "t.Format='FLAC' AND t.Encoding='Lossless'"; break; case '37': $SQL .= "t.Format='FLAC' AND t.Encoding='Lossless'"; break;
case '40': $SQL .= "t.Format='DTS'"; break; case '40': $SQL .= "t.Format='DTS'"; break;
case '41': $SQL .= "t.Format='Ogg Vorbis'"; break;
case '42': $SQL .= "t.Format='AAC' AND t.Encoding='320'"; break; case '42': $SQL .= "t.Format='AAC' AND t.Encoding='320'"; break;
case '43': $SQL .= "t.Format='AAC' AND t.Encoding='256'"; break; case '43': $SQL .= "t.Format='AAC' AND t.Encoding='256'"; break;
case '44': $SQL .= "t.Format='AAC' AND t.Encoding='q5.5'"; break; case '44': $SQL .= "t.Format='AAC' AND t.Encoding='q5.5'"; break;
@ -120,7 +118,7 @@
IF(t.RemasterYear=0,tg.Year,t.RemasterYear), IF(t.RemasterYear=0,tg.Year,t.RemasterYear),
tg.Name, tg.Name,
t.Size t.Size
FROM torrents AS t FROM torrents AS t
JOIN torrents_group AS tg ON tg.ID=t.GroupID AND tg.CategoryID='1' AND tg.ID IN (".implode(',',$GroupIDs).") JOIN torrents_group AS tg ON tg.ID=t.GroupID AND tg.CategoryID='1' AND tg.ID IN (".implode(',',$GroupIDs).")
ORDER BY t.GroupID ASC, Rank DESC, t.$Preference"; ORDER BY t.GroupID ASC, Rank DESC, t.$Preference";
@ -159,7 +157,7 @@
$Tor = new TORRENT($Contents, true); $Tor = new TORRENT($Contents, true);
$Tor->set_announce_url(ANNOUNCE_URL.'/'.$LoggedUser['torrent_pass'].'/announce'); $Tor->set_announce_url(ANNOUNCE_URL.'/'.$LoggedUser['torrent_pass'].'/announce');
unset($Tor->Val['announce-list']); unset($Tor->Val['announce-list']);
// We need this section for long file names :/ // We need this section for long file names :/
$TorrentName=''; $TorrentName='';
$TorrentInfo=''; $TorrentInfo='';
@ -179,7 +177,7 @@
$TorrentName = Misc::file_string($Album).(($Year>0)?(' - '.Misc::file_string($Year)):''); $TorrentName = Misc::file_string($Album).(($Year>0)?(' - '.Misc::file_string($Year)):'');
} }
$FileName = Format::cut_string($TorrentName.$TorrentInfo, 180, true, false); $FileName = Format::cut_string($TorrentName.$TorrentInfo, 180, true, false);
$Zip->add_file($Tor->enc(), $ReleaseTypeName.'/'.$FileName.'.torrent'); $Zip->add_file($Tor->enc(), $ReleaseTypeName.'/'.$FileName.'.torrent');
} }
$Analyzed = count($Downloads); $Analyzed = count($Downloads);

View File

@ -101,7 +101,7 @@ function compare($X, $Y){
<span style="float:left;"><strong><?=$DisplayName?></strong></span> <span style="float:left;"><strong><?=$DisplayName?></strong></span>
<span style="float:right;text-align:right"> <span style="float:right;text-align:right">
<? if(!$Sneaky){ ?> <? if(!$Sneaky){ ?>
<a href="#group_<?=$GroupID?>" class="remove_bookmark" title="Remove bookmark" onclick="Unbookmark('torrent', <?=$GroupID?>, '');return false;">Unbookmark</a> <a href="#group_<?=$GroupID?>" class="brackets remove_bookmark" title="Remove bookmark" onclick="Unbookmark('torrent', <?=$GroupID?>, '');return false;">Unbookmark</a>
<br /> <br />
<? } ?> <? } ?>
<?=time_diff($AddedTime);?> <?=time_diff($AddedTime);?>
@ -220,7 +220,7 @@ function compare($X, $Y){
<strong><?=$DisplayName?></strong> <strong><?=$DisplayName?></strong>
<?=$TorrentTags?> <?=$TorrentTags?>
<? if(!$Sneaky){ ?> <? if(!$Sneaky){ ?>
<span style="float:left;"><a href="#group_<?=$GroupID?>" class="remove_bookmark" title="Remove bookmark" onclick="Unbookmark('torrent', <?=$GroupID?>, '');return false;">Unbookmark</a></span> <span style="float:left;"><a href="#group_<?=$GroupID?>" class="brackets remove_bookmark" title="Remove bookmark" onclick="Unbookmark('torrent', <?=$GroupID?>, '');return false;">Unbookmark</a></span>
<? } ?> <? } ?>
<span style="float:right;"><?=time_diff($AddedTime);?></span> <span style="float:right;"><?=time_diff($AddedTime);?></span>

View File

@ -50,6 +50,10 @@ function AddTorrent($CollageID, $GroupID) {
if ($MaxGroups > 0 && $NumTorrents >= $MaxGroups) { if ($MaxGroups > 0 && $NumTorrents >= $MaxGroups) {
$Err = "This collage already holds its maximum allowed number of torrents"; $Err = "This collage already holds its maximum allowed number of torrents";
} }
if (isset($Err)) {
error($Err);
}
} }
if ($MaxGroupsPerUser > 0) { if ($MaxGroupsPerUser > 0) {
@ -134,4 +138,4 @@ function AddTorrent($CollageID, $GroupID) {
AddTorrent($CollageID, $GroupID); AddTorrent($CollageID, $GroupID);
} }
} }
header('Location: collages.php?id='.$CollageID); header('Location: collages.php?id='.$CollageID);

View File

@ -1,36 +1,35 @@
<? <?
/* /*
This page is something of a hack so those This page is something of a hack so those
easily scared off by funky solutions, don't easily scared off by funky solutions, don't
touch it! :P touch it! :P
There is a central problem to this page, it's There is a central problem to this page, it's
impossible to order before grouping in SQL, and impossible to order before grouping in SQL, and
it's slow to run sub queries, so we had to get it's slow to run sub queries, so we had to get
creative for this one. creative for this one.
The solution I settled on abuses the way The solution I settled on abuses the way
$DB->to_array() works. What we've done, is $DB->to_array() works. What we've done, is
backwards ordering. The results returned by the backwards ordering. The results returned by the
query have the best one for each GroupID last, query have the best one for each GroupID last,
and while to_array traverses the results, it and while to_array traverses the results, it
overwrites the keys and leaves us with only the overwrites the keys and leaves us with only the
desired result. This does mean however, that desired result. This does mean however, that
the SQL has to be done in a somewhat backwards the SQL has to be done in a somewhat backwards
fashion. fashion.
Thats all you get for a disclaimer, just Thats all you get for a disclaimer, just
remember, this page isn't for the faint of remember, this page isn't for the faint of
heart. -A9 heart. -A9
SQL template: SQL template:
SELECT SELECT
CASE CASE
WHEN t.Format='Ogg Vorbis' THEN 0 WHEN t.Format='MP3' AND t.Encoding='V0 (VBR)' THEN 1
WHEN t.Format='MP3' AND t.Encoding='V0 (VBR)' THEN 1 WHEN t.Format='MP3' AND t.Encoding='V2 (VBR)' THEN 2
WHEN t.Format='MP3' AND t.Encoding='V2 (VBR)' THEN 2 ELSE 100
ELSE 100 END AS Rank,
END AS Rank,
t.GroupID, t.GroupID,
t.Media, t.Media,
t.Format, t.Format,
@ -39,7 +38,7 @@
tg.Name, tg.Name,
a.Name, a.Name,
t.Size t.Size
FROM torrents AS t FROM torrents AS t
INNER JOIN collages_torrents AS c ON t.GroupID=c.GroupID AND c.CollageID='8' INNER JOIN collages_torrents AS c ON t.GroupID=c.GroupID AND c.CollageID='8'
INNER JOIN torrents_group AS tg ON tg.ID=t.GroupID AND tg.CategoryID='1' INNER JOIN torrents_group AS tg ON tg.ID=t.GroupID AND tg.CategoryID='1'
LEFT JOIN artists_group AS a ON a.ArtistID=tg.ArtistID LEFT JOIN artists_group AS a ON a.ArtistID=tg.ArtistID
@ -48,10 +47,10 @@
*/ */
if( if(
!isset($_REQUEST['collageid']) || !isset($_REQUEST['collageid']) ||
!isset($_REQUEST['preference']) || !isset($_REQUEST['preference']) ||
!is_number($_REQUEST['preference']) || !is_number($_REQUEST['preference']) ||
!is_number($_REQUEST['collageid']) || !is_number($_REQUEST['collageid']) ||
$_REQUEST['preference'] > 2 || $_REQUEST['preference'] > 2 ||
count($_REQUEST['list']) == 0 count($_REQUEST['list']) == 0
) { error(0); } ) { error(0); }
@ -95,7 +94,6 @@
case '36': $SQL .= "t.Format='FLAC' AND t.Encoding='Lossless' AND HasLog='1'"; break; case '36': $SQL .= "t.Format='FLAC' AND t.Encoding='Lossless' AND HasLog='1'"; break;
case '37': $SQL .= "t.Format='FLAC' AND t.Encoding='Lossless'"; break; case '37': $SQL .= "t.Format='FLAC' AND t.Encoding='Lossless'"; break;
case '40': $SQL .= "t.Format='DTS'"; break; case '40': $SQL .= "t.Format='DTS'"; break;
case '41': $SQL .= "t.Format='Ogg Vorbis'"; break;
case '42': $SQL .= "t.Format='AAC' AND t.Encoding='320'"; break; case '42': $SQL .= "t.Format='AAC' AND t.Encoding='320'"; break;
case '43': $SQL .= "t.Format='AAC' AND t.Encoding='256'"; break; case '43': $SQL .= "t.Format='AAC' AND t.Encoding='256'"; break;
case '44': $SQL .= "t.Format='AAC' AND t.Encoding='q5.5'"; break; case '44': $SQL .= "t.Format='AAC' AND t.Encoding='q5.5'"; break;
@ -114,7 +112,7 @@
IF(t.RemasterYear=0,tg.Year,t.RemasterYear), IF(t.RemasterYear=0,tg.Year,t.RemasterYear),
tg.Name, tg.Name,
t.Size t.Size
FROM torrents AS t FROM torrents AS t
INNER JOIN collages_torrents AS c ON t.GroupID=c.GroupID AND c.CollageID='$CollageID' INNER JOIN collages_torrents AS c ON t.GroupID=c.GroupID AND c.CollageID='$CollageID'
INNER JOIN torrents_group AS tg ON tg.ID=t.GroupID AND tg.CategoryID='1' INNER JOIN torrents_group AS tg ON tg.ID=t.GroupID AND tg.CategoryID='1'
ORDER BY t.GroupID ASC, Rank DESC, t.$Preference"; ORDER BY t.GroupID ASC, Rank DESC, t.$Preference";
@ -148,7 +146,7 @@
$Tor = new TORRENT($Contents, true); $Tor = new TORRENT($Contents, true);
$Tor->set_announce_url(ANNOUNCE_URL.'/'.$LoggedUser['torrent_pass'].'/announce'); $Tor->set_announce_url(ANNOUNCE_URL.'/'.$LoggedUser['torrent_pass'].'/announce');
unset($Tor->Val['announce-list']); unset($Tor->Val['announce-list']);
// We need this section for long file names :/ // We need this section for long file names :/
$TorrentName=''; $TorrentName='';
$TorrentInfo=''; $TorrentInfo='';
@ -169,7 +167,7 @@
} }
$FileName = $TorrentName.$TorrentInfo; $FileName = $TorrentName.$TorrentInfo;
$FileName = Format::cut_string($FileName, 192, true, false); $FileName = Format::cut_string($FileName, 192, true, false);
$Zip->add_file($Tor->enc(), $FileName.'.torrent'); $Zip->add_file($Tor->enc(), $FileName.'.torrent');
} }
$Analyzed = count($Downloads); $Analyzed = count($Downloads);

View File

@ -53,22 +53,26 @@
} }
// Searching for posts in a specific thread // Searching for posts in a specific thread
if(!empty($_GET['threadid'])) { if (!empty($_GET['threadid']) && is_number($_GET['threadid'])) {
$ThreadID = db_string($_GET['threadid']); $ThreadID = $_GET['threadid'];
$Type='body'; $Type = 'body';
$SQL = "SELECT Title FROM forums_topics AS t $SQL = "SELECT Title FROM forums_topics AS t
JOIN forums AS f ON f.ID=t.ForumID JOIN forums AS f ON f.ID=t.ForumID
WHERE f.MinClassRead <= '$LoggedUser[Class]' WHERE t.ID=$ThreadID
AND t.ID=$ThreadID"; AND ((f.MinClassRead <= '$LoggedUser[Class]'";
if(!empty($RestrictedForums)) { if (!empty($RestrictedForums)) {
$SQL .= " AND f.ID NOT IN ('".$RestrictedForums."')"; $SQL .= " AND f.ID NOT IN ('$RestrictedForums')";
} }
$SQL .= ")";
if (!empty($PermittedForums)) {
$SQL .= " OR f.ID IN ('$PermittedForums')";
}
$SQL .= ")";
$DB->query($SQL); $DB->query($SQL);
if (list($Title) = $DB->next_record()) { if (list($Title) = $DB->next_record()) {
$Title = " &gt; <a href=\"forums.php?action=viewthread&amp;threadid=$ThreadID\">$Title</a>"; $Title = " &gt; <a href=\"forums.php?action=viewthread&amp;threadid=$ThreadID\">$Title</a>";
} else { } else {
$Title = ''; error(404);
$ThreadID = '';
} }
} else { } else {
$ThreadID = ''; $ThreadID = '';

View File

@ -456,26 +456,6 @@
</td> </td>
</tr> </tr>
<? } ?> <? } ?>
<?
//<strip>
if(check_perms("users_mod")) {
$RequestLog = Requests::get_request_log($RequestID);
if($RequestLog) {
?>
<tr>
<td colspan="2" class="center"><strong><a href="#" onclick="$('#request_log').toggle(); return false;">Request log</a></strong></td>
</tr>
<tr>
<td colspan="2">
<div id="request_log" class="hidden padding">
<?=$Text->full_format($RequestLog)?>
</div>
</td>
</tr>
<? }
}
//<strip>
?>
<tr> <tr>
<td colspan="2" class="center"><strong>Description</strong></td> <td colspan="2" class="center"><strong>Description</strong></td>
</tr> </tr>

View File

@ -491,9 +491,9 @@ function generate_torrent_table($Caption, $Tag, $Details, $Limit) {
<? <?
if($IsBookmarked) { if($IsBookmarked) {
?> ?>
<a href="#" id="bookmarklink_torrent_<?=$GroupID?>" class="brackets remove_bookmark" title="Remove bookmark" onclick="Unbookmark('torrent',<?=$GroupID?>,'Bookmark');return false;">Unbookmark</a> <a href="#" class="bookmarklink_torrent_<?=$GroupID?> brackets remove_bookmark" title="Remove bookmark" onclick="Unbookmark('torrent',<?=$GroupID?>,'Bookmark');return false;">Unbookmark</a>
<? } else { ?> <? } else { ?>
<a href="#" id="bookmarklink_torrent_<?=$GroupID?>" class="brackets add_bookmark" title="Add bookmark" onclick="Bookmark('torrent',<?=$GroupID?>,'Unbookmark');return false;">Bookmark</a> <a href="#" class="bookmarklink_torrent_<?=$GroupID?> brackets add_bookmark" title="Add bookmark" onclick="Bookmark('torrent',<?=$GroupID?>,'Unbookmark');return false;">Bookmark</a>
<? } ?> <? } ?>
</span> </span>

View File

@ -221,9 +221,9 @@
<td> <td>
<strong><?=$DisplayName?></strong> <!--<?Votes::vote_link($GroupID,$UserVotes[$GroupID]['Type']);?>--> <strong><?=$DisplayName?></strong> <!--<?Votes::vote_link($GroupID,$UserVotes[$GroupID]['Type']);?>-->
<? if($IsBookmarked) { ?> <? if($IsBookmarked) { ?>
<span class="bookmark" style="float:right;"><a href="#" id="bookmarklink_torrent_<?=$GroupID?>" class="brackets remove_bookmark" title="Remove bookmark" onclick="Unbookmark('torrent',<?=$GroupID?>,'Bookmark');return false;">Unbookmark</a></span> <span class="bookmark" style="float:right;"><a href="#" class="bookmarklink_torrent_<?=$GroupID?> brackets remove_bookmark" title="Remove bookmark" onclick="Unbookmark('torrent',<?=$GroupID?>,'Bookmark');return false;">Unbookmark</a></span>
<? } else { ?> <? } else { ?>
<span class="bookmark" style="float:right;"><a href="#" id="bookmarklink_torrent_<?=$GroupID?>" class="brackets add_bookmark" title="Add bookmark" onclick="Bookmark('torrent',<?=$GroupID?>,'Unbookmark');return false;">Bookmark</a></span> <span class="bookmark" style="float:right;"><a href="#" class="bookmarklink_torrent_<?=$GroupID?> brackets add_bookmark" title="Add bookmark" onclick="Bookmark('torrent',<?=$GroupID?>,'Unbookmark');return false;">Bookmark</a></span>
<? } ?> <? } ?>
<?=$TorrentTags?> <?=$TorrentTags?>
</td> </td>

View File

@ -151,7 +151,6 @@ function header_link($SortKey,$DefaultWay="desc") {
foreach ($SearchBitrates as $ID=>$Val) { foreach ($SearchBitrates as $ID=>$Val) {
$SearchBitrates[$ID] = strtolower($Val); $SearchBitrates[$ID] = strtolower($Val);
} }
foreach ($Formats as $ID => $Val) { foreach ($Formats as $ID => $Val) {
$SearchFormats[$ID] = strtolower($Val); $SearchFormats[$ID] = strtolower($Val);
} }
@ -595,7 +594,7 @@ function header_link($SortKey,$DefaultWay="desc") {
<td colspan="4" class="center ft_edition_expand"><a href="#" class="brackets" onclick="ToggleEditionRows();return false;">Click here to toggle searching for specific remaster information</a></td> <td colspan="4" class="center ft_edition_expand"><a href="#" class="brackets" onclick="ToggleEditionRows();return false;">Click here to toggle searching for specific remaster information</a></td>
</tr> </tr>
<? <?
if (Format::form('remastertitle', true) == "" && Format::form('remasteryear', true) == "" && if (Format::form('remastertitle', true) == "" && Format::form('remasteryear', true) == "" &&
Format::form('remasterrecordlabel', true) == "" && Format::form('remastercataloguenumber', true) == "") { Format::form('remasterrecordlabel', true) == "" && Format::form('remastercataloguenumber', true) == "") {
$Hidden = 'hidden'; $Hidden = 'hidden';
} else { } else {
@ -999,7 +998,7 @@ function header_link($SortKey,$DefaultWay="desc") {
$FirstUnknown = !isset($FirstUnknown); $FirstUnknown = !isset($FirstUnknown);
} }
$SnatchedTorrentClass = $Data['IsSnatched'] ? ' snatched_torrent' : ''; $SnatchedTorrentClass = $Data['IsSnatched'] ? ' snatched_torrent' : '';
if (isset($GroupedCategories[$CategoryID-1]) if (isset($GroupedCategories[$CategoryID-1])
&& ($Data['RemasterTitle'] != $LastRemasterTitle && ($Data['RemasterTitle'] != $LastRemasterTitle
|| $Data['RemasterYear'] != $LastRemasterYear || $Data['RemasterYear'] != $LastRemasterYear
@ -1098,7 +1097,7 @@ function header_link($SortKey,$DefaultWay="desc") {
[ <a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download">DL</a> [ <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($Data)) { ?> <? if (Torrents::can_use_token($Data)) { ?>
| <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="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> ] | <a href="reportsv2.php?action=report&amp;id=<?=$TorrentID?>" title="Report">RP</a> ]
</span> </span>
<?=$DisplayName?> <?=$DisplayName?>

View File

@ -79,8 +79,6 @@
$Properties['FreeLeechType'] = $FreeType; $Properties['FreeLeechType'] = $FreeType;
} }
//******************************************************************************// //******************************************************************************//
//--------------- Validate data in edit form -----------------------------------// //--------------- Validate data in edit form -----------------------------------//
@ -120,7 +118,7 @@
header("Location: torrents.php?action=edit&id=$TorrentID"); header("Location: torrents.php?action=edit&id=$TorrentID");
die(); die();
} }
$Validate->SetFields('remaster_title', $Validate->SetFields('remaster_title',
'0','string','Remaster title must be between 2 and 80 characters.',array('maxlength'=>80, 'minlength'=>2)); '0','string','Remaster title must be between 2 and 80 characters.',array('maxlength'=>80, 'minlength'=>2));
@ -129,43 +127,43 @@
header("Location: torrents.php?action=edit&id=$TorrentID"); header("Location: torrents.php?action=edit&id=$TorrentID");
die(); die();
} }
$Validate->SetFields('remaster_record_label', $Validate->SetFields('remaster_record_label',
'0','string','Remaster record label must be between 2 and 80 characters.',array('maxlength'=>80, 'minlength'=>2)); '0','string','Remaster record label must be between 2 and 80 characters.',array('maxlength'=>80, 'minlength'=>2));
$Validate->SetFields('remaster_catalogue_number', $Validate->SetFields('remaster_catalogue_number',
'0','string','Remaster catalogue number must be between 2 and 80 characters.',array('maxlength'=>80, 'minlength'=>2)); '0','string','Remaster catalogue number must be between 2 and 80 characters.',array('maxlength'=>80, 'minlength'=>2));
$Validate->SetFields('format', $Validate->SetFields('format',
'1','inarray','Not a valid format.',array('inarray'=>$Formats)); '1','inarray','Not a valid format.',array('inarray'=>$Formats));
$Validate->SetFields('bitrate', $Validate->SetFields('bitrate',
'1','inarray','You must choose a bitrate.', array('inarray'=>$Bitrates)); '1','inarray','You must choose a bitrate.', array('inarray'=>$Bitrates));
// Handle 'other' bitrates // Handle 'other' bitrates
if($Properties['Encoding'] == 'Other') { if($Properties['Encoding'] == 'Other') {
$Validate->SetFields('other_bitrate', $Validate->SetFields('other_bitrate',
'1','text','You must enter the other bitrate (max length: 9 characters).', array('maxlength'=>9)); '1','text','You must enter the other bitrate (max length: 9 characters).', array('maxlength'=>9));
$enc = trim($_POST['other_bitrate']); $enc = trim($_POST['other_bitrate']);
if(isset($_POST['vbr'])) { $enc.=' (VBR)'; } if(isset($_POST['vbr'])) { $enc.=' (VBR)'; }
$Properties['Encoding'] = $enc; $Properties['Encoding'] = $enc;
$Properties['Bitrate'] = $enc; $Properties['Bitrate'] = $enc;
} else { } else {
$Validate->SetFields('bitrate', $Validate->SetFields('bitrate',
'1','inarray','You must choose a bitrate.', array('inarray'=>$Bitrates)); '1','inarray','You must choose a bitrate.', array('inarray'=>$Bitrates));
} }
$Validate->SetFields('media', $Validate->SetFields('media',
'1','inarray','Not a valid media.',array('inarray'=>$Media)); '1','inarray','Not a valid media.',array('inarray'=>$Media));
$Validate->SetFields('release_desc', $Validate->SetFields('release_desc',
'0','string','Invalid release description.',array('maxlength'=>1000000, 'minlength'=>0)); '0','string','Invalid release description.',array('maxlength'=>1000000, 'minlength'=>0));
break; break;
case 'Audiobooks': case 'Audiobooks':
case 'Comedy': case 'Comedy':
/*$Validate->SetFields('title', /*$Validate->SetFields('title',
@ -173,33 +171,33 @@
^ this is commented out because there is no title field on these pages*/ ^ this is commented out because there is no title field on these pages*/
$Validate->SetFields('year', $Validate->SetFields('year',
'1','number','The year of the release must be entered.'); '1','number','The year of the release must be entered.');
$Validate->SetFields('format', $Validate->SetFields('format',
'1','inarray','Not a valid format.',array('inarray'=>$Formats)); '1','inarray','Not a valid format.',array('inarray'=>$Formats));
$Validate->SetFields('bitrate', $Validate->SetFields('bitrate',
'1','inarray','You must choose a bitrate.', array('inarray'=>$Bitrates)); '1','inarray','You must choose a bitrate.', array('inarray'=>$Bitrates));
// Handle 'other' bitrates // Handle 'other' bitrates
if($Properties['Encoding'] == 'Other') { if($Properties['Encoding'] == 'Other') {
$Validate->SetFields('other_bitrate', $Validate->SetFields('other_bitrate',
'1','text','You must enter the other bitrate (max length: 9 characters).', array('maxlength'=>9)); '1','text','You must enter the other bitrate (max length: 9 characters).', array('maxlength'=>9));
$enc = trim($_POST['other_bitrate']); $enc = trim($_POST['other_bitrate']);
if(isset($_POST['vbr'])) { $enc.=' (VBR)'; } if(isset($_POST['vbr'])) { $enc.=' (VBR)'; }
$Properties['Encoding'] = $enc; $Properties['Encoding'] = $enc;
$Properties['Bitrate'] = $enc; $Properties['Bitrate'] = $enc;
} else { } else {
$Validate->SetFields('bitrate', $Validate->SetFields('bitrate',
'1','inarray','You must choose a bitrate.', array('inarray'=>$Bitrates)); '1','inarray','You must choose a bitrate.', array('inarray'=>$Bitrates));
} }
$Validate->SetFields('release_desc', $Validate->SetFields('release_desc',
'0','string','The release description has a minimum length of 10 characters.',array('maxlength'=>1000000, 'minlength'=>10)); '0','string','The release description has a minimum length of 10 characters.',array('maxlength'=>1000000, 'minlength'=>10));
break; break;
case 'Applications': case 'Applications':
case 'Comics': case 'Comics':
case 'E-Books': case 'E-Books':
@ -278,15 +276,15 @@
// Update info for the torrent // Update info for the torrent
$SQL = " $SQL = "
UPDATE torrents SET UPDATE torrents SET
Media=$T[Media], Media=$T[Media],
Format=$T[Format], Format=$T[Format],
Encoding=$T[Encoding], Encoding=$T[Encoding],
RemasterYear=$T[RemasterYear], RemasterYear=$T[RemasterYear],
Remastered=$T[Remastered], Remastered=$T[Remastered],
RemasterTitle=$T[RemasterTitle], RemasterTitle=$T[RemasterTitle],
RemasterRecordLabel=$T[RemasterRecordLabel], RemasterRecordLabel=$T[RemasterRecordLabel],
RemasterCatalogueNumber=$T[RemasterCatalogueNumber], RemasterCatalogueNumber=$T[RemasterCatalogueNumber],
Scene=$T[Scene], Scene=$T[Scene],
Description=$T[TorrentDescription],"; Description=$T[TorrentDescription],";
if(check_perms('torrents_freeleech')) { if(check_perms('torrents_freeleech')) {
@ -357,7 +355,7 @@
if ($caID && !$Properties['CassetteApproved']) { if ($caID && !$Properties['CassetteApproved']) {
$DB->query("DELETE FROM torrents_cassette_approved WHERE TorrentID='$TorrentID'"); $DB->query("DELETE FROM torrents_cassette_approved WHERE TorrentID='$TorrentID'");
} }
$DB->query("SELECT TorrentID FROM torrents_lossymaster_approved WHERE TorrentID='$TorrentID'"); $DB->query("SELECT TorrentID FROM torrents_lossymaster_approved WHERE TorrentID='$TorrentID'");
list($lmaID) = $DB->next_record(); list($lmaID) = $DB->next_record();

View File

@ -27,6 +27,31 @@
if(!empty($_GET['action']) && $_GET['action'] == 'revert') { // if we're reverting to a previous revision if(!empty($_GET['action']) && $_GET['action'] == 'revert') { // if we're reverting to a previous revision
$RevisionID=$_GET['revisionid']; $RevisionID=$_GET['revisionid'];
if(!is_number($RevisionID)) { error(0); } if(!is_number($RevisionID)) { error(0); }
// to cite from merge: "Everything is legit, let's just confim they're not retarded"
if(empty($_GET['confirm'])) {
View::show_header();
?>
<div class="center thin">
<div class="header">
<h2>Revert Confirm!</h2>
</div>
<div class="box pad">
<form class="confirm_form" name="torrent_group" action="torrents.php" method="get">
<input type="hidden" name="action" value="revert" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="confirm" value="true" />
<input type="hidden" name="groupid" value="<?=$GroupID?>" />
<input type="hidden" name="revisionid" value="<?=$RevisionID?>" />
<h3>You are attempting to revert to the revision <a href="torrents.php?id=<?=$GroupID?>&revisionid=<?=$RevisionID?>"><?=$RevisionID?></a>.</h3>
<input type="submit" value="Confirm" />
</form>
</div>
</div>
<?
View::show_footer();
die();
}
} else { // with edit, the variables are passed with POST } else { // with edit, the variables are passed with POST
$Body = $_POST['body']; $Body = $_POST['body'];
$Image = $_POST['image']; $Image = $_POST['image'];

View File

@ -19,47 +19,75 @@
error(0); error(0);
} }
$DB->query("SELECT ArtistID, AliasID, Redirect, Name FROM artists_alias WHERE Name = '$ArtistName'"); //Everything is legit, let's just confim they're not retarded
if($DB->record_count() == 0) { if(empty($_POST['confirm'])) {
$Redirect = 0; View::show_header();
$DB->query("INSERT INTO artists_group (Name) VALUES ('$ArtistName')"); ?>
$ArtistID = $DB->inserted_id(); <div class="center thin">
$DB->query("INSERT INTO artists_alias (ArtistID, Name) VALUES ('$ArtistID', '$ArtistName')"); <div class="header">
list($AliasID) = $DB->next_record(); <h2>Split Confirm!</h2>
} else { </div>
list($ArtistID, $AliasID, $Redirect, $ArtistName) = $DB->next_record(); <div class="box pad">
if($Redirect) { <form class="confirm_form" name="torrent_group" action="torrents.php" method="post">
$AliasID = $Redirect; <input type="hidden" name="action" value="newgroup" />
} <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
} <input type="hidden" name="confirm" value="true" />
<input type="hidden" name="torrentid" value="<?=$TorrentID?>" />
$DB->query("INSERT INTO torrents_group <input type="hidden" name="oldgroupid" value="<?=$OldGroupID?>" />
(ArtistID, NumArtists, CategoryID, Name, Year, Time, WikiBody, WikiImage, SearchText) <input type="hidden" name="artist" value="<?=display_str($_POST['artist'])?>" />
VALUES <input type="hidden" name="title" value="<?=display_str($_POST['title'])?>" />
($ArtistID, '1', '1', '$Title', '$Year', '".sqltime()."', '', '', '$SearchText')"); <input type="hidden" name="year" value="<?=$Year?>" />
$GroupID = $DB->inserted_id(); <h3>You are attempting to split the torrent <a href="torrents.php?torrentid=<?=$TorrentID?>"><?=$TorrentID?></a> off into a new group:</h3>
<ul><li><?=display_str($_POST['artist'])?> - <?=display_str($_POST['title'])?> [<?=$Year?>]</li></ul>
$DB->query("INSERT INTO torrents_artists <input type="submit" value="Confirm" />
(GroupID, ArtistID, AliasID, Importance, UserID) VALUES </form>
('$GroupID', '$ArtistID', '$AliasID', '1', '$LoggedUser[ID]')"); </div>
</div>
$DB->query("UPDATE torrents SET <?
GroupID='$GroupID' View::show_footer();
WHERE ID='$TorrentID'"); } else {
$DB->query("SELECT ArtistID, AliasID, Redirect, Name FROM artists_alias WHERE Name = '$ArtistName'");
// Delete old group if needed if($DB->record_count() == 0) {
$DB->query("SELECT ID FROM torrents WHERE GroupID='$OldGroupID'"); $Redirect = 0;
if($DB->record_count() == 0) { $DB->query("INSERT INTO artists_group (Name) VALUES ('$ArtistName')");
Torrents::delete_group($OldGroupID); $ArtistID = $DB->inserted_id();
} else { $DB->query("INSERT INTO artists_alias (ArtistID, Name) VALUES ('$ArtistID', '$ArtistName')");
Torrents::update_hash($OldGroupID); $AliasID = $DB->inserted_id();
} } else {
list($ArtistID, $AliasID, $Redirect, $ArtistName) = $DB->next_record();
Torrents::update_hash($GroupID); if($Redirect) {
$AliasID = $Redirect;
$Cache->delete_value('torrent_download_'.$TorrentID); }
}
Misc::write_log("Torrent $TorrentID was edited by " . $LoggedUser['Username']);
$DB->query("INSERT INTO torrents_group
header("Location: torrents.php?id=$GroupID"); (ArtistID, NumArtists, CategoryID, Name, Year, Time, WikiBody, WikiImage, SearchText)
VALUES
($ArtistID, '1', '1', '$Title', '$Year', '".sqltime()."', '', '', '$SearchText')");
$GroupID = $DB->inserted_id();
$DB->query("INSERT INTO torrents_artists
(GroupID, ArtistID, AliasID, Importance, UserID) VALUES
('$GroupID', '$ArtistID', '$AliasID', '1', '$LoggedUser[ID]')");
$DB->query("UPDATE torrents SET
GroupID='$GroupID'
WHERE ID='$TorrentID'");
// Delete old group if needed
$DB->query("SELECT ID FROM torrents WHERE GroupID='$OldGroupID'");
if($DB->record_count() == 0) {
Torrents::delete_group($OldGroupID);
} else {
Torrents::update_hash($OldGroupID);
}
Torrents::update_hash($GroupID);
$Cache->delete_value('torrent_download_'.$TorrentID);
Misc::write_log("Torrent $TorrentID was edited by " . $LoggedUser['Username']);
header("Location: torrents.php?id=$GroupID");
}
?> ?>

View File

@ -11,7 +11,7 @@ function header_link($SortKey,$DefaultWay="DESC") {
if($Way=="DESC") { $NewWay="ASC"; } if($Way=="DESC") { $NewWay="ASC"; }
else { $NewWay="DESC"; } else { $NewWay="DESC"; }
} else { $NewWay=$DefaultWay; } } else { $NewWay=$DefaultWay; }
return "torrents.php?way=".$NewWay."&amp;order=".$SortKey."&amp;".Format::get_url(array('way','order')); return "torrents.php?way=".$NewWay."&amp;order=".$SortKey."&amp;".Format::get_url(array('way','order'));
} }
@ -40,7 +40,6 @@ function header_link($SortKey,$DefaultWay="DESC") {
} }
$SearchWhere = array(); $SearchWhere = array();
if(!empty($_GET['format'])) { if(!empty($_GET['format'])) {
if(in_array($_GET['format'], $Formats)) { if(in_array($_GET['format'], $Formats)) {
$SearchWhere[]="t.Format='".db_string($_GET['format'])."'"; $SearchWhere[]="t.Format='".db_string($_GET['format'])."'";
@ -222,9 +221,9 @@ function header_link($SortKey,$DefaultWay="DESC") {
Size bigint(12) unsigned, Size bigint(12) unsigned,
PRIMARY KEY (TorrentID)) CHARSET=utf8"); PRIMARY KEY (TorrentID)) CHARSET=utf8");
$DB->query("INSERT IGNORE INTO temp_sections_torrents_user SELECT $DB->query("INSERT IGNORE INTO temp_sections_torrents_user SELECT
t.GroupID, t.GroupID,
t.ID AS TorrentID, t.ID AS TorrentID,
$Time AS Time, $Time AS Time,
tg.CategoryID, tg.CategoryID,
t.Seeders, t.Seeders,
t.Leechers, t.Leechers,
@ -235,14 +234,14 @@ function header_link($SortKey,$DefaultWay="DESC") {
JOIN torrents_group AS tg ON tg.ID=t.GroupID JOIN torrents_group AS tg ON tg.ID=t.GroupID
LEFT JOIN torrents_artists AS ta ON ta.GroupID=tg.ID LEFT JOIN torrents_artists AS ta ON ta.GroupID=tg.ID
LEFT JOIN artists_alias AS aa ON aa.AliasID=ta.AliasID LEFT JOIN artists_alias AS aa ON aa.AliasID=ta.AliasID
WHERE $UserField='$UserID' $ExtraWhere $SearchWhere WHERE $UserField='$UserID' $ExtraWhere $SearchWhere
GROUP BY TorrentID, Time"); GROUP BY TorrentID, Time");
if(!empty($_GET['search']) && trim($_GET['search']) != '') { if(!empty($_GET['search']) && trim($_GET['search']) != '') {
$Words = array_unique(explode(' ', db_string($_GET['search']))); $Words = array_unique(explode(' ', db_string($_GET['search'])));
} }
$SQL = "SELECT SQL_CALC_FOUND_ROWS $SQL = "SELECT SQL_CALC_FOUND_ROWS
GroupID, TorrentID, Time, CategoryID GroupID, TorrentID, Time, CategoryID
FROM temp_sections_torrents_user"; FROM temp_sections_torrents_user";
if(!empty($Words)) { if(!empty($Words)) {
@ -294,12 +293,12 @@ function header_link($SortKey,$DefaultWay="DESC") {
<? foreach($Bitrates as $BitrateName) { ?> <? foreach($Bitrates as $BitrateName) { ?>
<option value="<?=display_str($BitrateName); ?>" <?Format::selected('bitrate', $BitrateName)?>><?=display_str($BitrateName); ?></option> <option value="<?=display_str($BitrateName); ?>" <?Format::selected('bitrate', $BitrateName)?>><?=display_str($BitrateName); ?></option>
<? } ?> </select> <? } ?> </select>
<select name="format" class="ft_format"> <select name="format" class="ft_format">
<option value="">Format</option> <option value="">Format</option>
<? foreach($Formats as $FormatName) { ?> <? foreach($Formats as $FormatName) { ?>
<option value="<?=display_str($FormatName); ?>" <?Format::selected('format', $FormatName)?>><?=display_str($FormatName); ?></option> <option value="<?=display_str($FormatName); ?>" <?Format::selected('format', $FormatName)?>><?=display_str($FormatName); ?></option>
<? } ?> <? } ?>
<option value="perfectflac" <?Format::selected('filter', 'perfectflac')?>>Perfect FLACs</option> <option value="perfectflac" <?Format::selected('filter', 'perfectflac')?>>Perfect FLACs</option>
</select> </select>
<select name="media" class="ft_media"> <select name="media" class="ft_media">
@ -351,7 +350,7 @@ function header_link($SortKey,$DefaultWay="DESC") {
<input type="radio" name="tags_type" id="tags_type1" value="1" <?Format::selected('tags_type',1,'checked')?> /><label for="tags_type1"> All</label> <input type="radio" name="tags_type" id="tags_type1" value="1" <?Format::selected('tags_type',1,'checked')?> /><label for="tags_type1"> All</label>
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="label"><strong>Order by</strong></td> <td class="label"><strong>Order by</strong></td>
<td> <td>
@ -368,7 +367,7 @@ function header_link($SortKey,$DefaultWay="DESC") {
</td> </td>
</tr> </tr>
</table> </table>
<table class="layout cat_list"> <table class="layout cat_list">
<? <?
$x=0; $x=0;
@ -424,10 +423,10 @@ function header_link($SortKey,$DefaultWay="DESC") {
$Results = $Results['matches']; $Results = $Results['matches'];
foreach($TorrentsInfo as $TorrentID=>$Info) { foreach($TorrentsInfo as $TorrentID=>$Info) {
list($GroupID,, $Time, $CategoryID) = array_values($Info); list($GroupID,, $Time, $CategoryID) = array_values($Info);
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Torrents, $Artists, $ExtendedArtists, $GroupFlags) = array_values($Results[$GroupID]); list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Torrents, $Artists, $ExtendedArtists, $GroupFlags) = array_values($Results[$GroupID]);
$Torrent = $Torrents[$TorrentID]; $Torrent = $Torrents[$TorrentID];
$TagList = explode(' ',str_replace('_','.',$TagList)); $TagList = explode(' ',str_replace('_','.',$TagList));
$TorrentTags = array(); $TorrentTags = array();
@ -435,7 +434,7 @@ function header_link($SortKey,$DefaultWay="DESC") {
$TorrentTags[]='<a href="torrents.php?type='.$Action.'&amp;userid='.$UserID.'&amp;tags='.$Tag.'">'.$Tag.'</a>'; $TorrentTags[]='<a href="torrents.php?type='.$Action.'&amp;userid='.$UserID.'&amp;tags='.$Tag.'">'.$Tag.'</a>';
} }
$TorrentTags = implode(', ', $TorrentTags); $TorrentTags = implode(', ', $TorrentTags);
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5])) { if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5])) {
unset($ExtendedArtists[2]); unset($ExtendedArtists[2]);
unset($ExtendedArtists[3]); unset($ExtendedArtists[3]);
@ -448,7 +447,7 @@ function header_link($SortKey,$DefaultWay="DESC") {
$DisplayName.='<a href="torrents.php?id='.$GroupID.'&amp;torrentid='.$TorrentID.'" title="View Torrent">'.$GroupName.'</a>'; $DisplayName.='<a href="torrents.php?id='.$GroupID.'&amp;torrentid='.$TorrentID.'" title="View Torrent">'.$GroupName.'</a>';
if($GroupYear>0) { $DisplayName.=" [".$GroupYear."]"; } if($GroupYear>0) { $DisplayName.=" [".$GroupYear."]"; }
if($GroupVanityHouse) { $DisplayName .= ' [<abbr title="This is a vanity house release">VH</abbr>]'; } if($GroupVanityHouse) { $DisplayName .= ' [<abbr title="This is a vanity house release">VH</abbr>]'; }
$ExtraInfo = Torrents::torrent_info($Torrent); $ExtraInfo = Torrents::torrent_info($Torrent);
if($ExtraInfo) { if($ExtraInfo) {
$DisplayName.=' - '.$ExtraInfo; $DisplayName.=' - '.$ExtraInfo;

View File

@ -8,6 +8,10 @@
$ExtraFile = fopen($Name, 'rb'); // open file for reading $ExtraFile = fopen($Name, 'rb'); // open file for reading
$ExtraContents = fread($ExtraFile, 10000000); $ExtraContents = fread($ExtraFile, 10000000);
$ExtraTor = new TORRENT($ExtraContents); // New TORRENT object $ExtraTor = new TORRENT($ExtraContents); // New TORRENT object
if (isset($ExtraTor->Val['info']->Val['encrypted_files'])) {
$Err = "At least one of the torrents contain an encrypted file list which is not supported here";
break;
}
// Remove uploader's passkey from the torrent. // Remove uploader's passkey from the torrent.
// We put the downloader's passkey in on download, so it doesn't matter what's in there now, // We put the downloader's passkey in on download, so it doesn't matter what's in there now,
@ -36,14 +40,13 @@
} }
// Add file and size to array // Add file and size to array
$ExtraTmpFileList[] = $ExtraName . '{{{' . $ExtraSize . '}}}'; // Name {{{Size}}} $ExtraTmpFileList[] = Torrents::filelist_format_file($ExtraFile);
} }
// To be stored in the database // To be stored in the database
$ExtraFilePath = isset($ExtraTor->Val['info']->Val['files']) ? db_string(Format::make_utf8($ExtraDirName)) : ""; $ExtraFilePath = isset($ExtraTor->Val['info']->Val['files']) ? db_string(Format::make_utf8($ExtraDirName)) : "";
$ExtraTorrentsInsert[$Name]['FilePath'] = $ExtraFilePath; $ExtraTorrentsInsert[$Name]['FilePath'] = $ExtraFilePath;
// Name {{{Size}}}|||Name {{{Size}}}|||Name {{{Size}}}|||Name {{{Size}}} $ExtraFileString = db_string(implode("\n", $ExtraTmpFileList));
$ExtraFileString = "'" . db_string(Format::make_utf8(implode('|||', $ExtraTmpFileList))) . "'";
$ExtraTorrentsInsert[$Name]['FileString'] = $ExtraFileString; $ExtraTorrentsInsert[$Name]['FileString'] = $ExtraFileString;
// Number of files described in torrent // Number of files described in torrent
$ExtraNumFiles = count($ExtraFileList); $ExtraNumFiles = count($ExtraFileList);

View File

@ -12,7 +12,7 @@
Description, LogScore, FreeTorrent, FreeLeechType) Description, LogScore, FreeTorrent, FreeLeechType)
VALUES VALUES
(" . $GroupID . ", " . $LoggedUser['ID'] . ", " . $T['Media'] . ", " . $ExtraTorrent['Format'] . ", " . $ExtraTorrent['Encoding'] . ", (" . $GroupID . ", " . $LoggedUser['ID'] . ", " . $T['Media'] . ", " . $ExtraTorrent['Format'] . ", " . $ExtraTorrent['Encoding'] . ",
" . $T['Remastered'] . ", " . $T['RemasterYear'] . ", " . $T['RemasterTitle'] . ", " . $T['RemasterRecordLabel'] . ", " . $T['RemasterCatalogueNumber'] . ", " . $ExtraHasLog . ", " . $ExtraHasCue . ", '" . db_string($ExtraTorrent['InfoHash']) . "', " . $ExtraTorrent['NumFiles'] . ", " . $ExtraTorrent['FileString'] . ", '" . $ExtraTorrent['FilePath'] . "', " . $ExtraTorrent['TotalSize'] . ", '" . sqltime() . "', " . $T['Remastered'] . ", " . $T['RemasterYear'] . ", " . $T['RemasterTitle'] . ", " . $T['RemasterRecordLabel'] . ", " . $T['RemasterCatalogueNumber'] . ", " . $ExtraHasLog . ", " . $ExtraHasCue . ", '" . db_string($ExtraTorrent['InfoHash']) . "', " . $ExtraTorrent['NumFiles'] . ", '" . $ExtraTorrent['FileString'] . "', '" . $ExtraTorrent['FilePath'] . "', " . $ExtraTorrent['TotalSize'] . ", '" . sqltime() . "',
" . $ExtraTorrent['TorrentDescription'] . ", '" . (($HasLog == "'1'") ? $LogScoreAverage : 0) . "', '" . $T['FreeLeech'] . "', '" . $T['FreeLeechType'] . "')"); " . $ExtraTorrent['TorrentDescription'] . ", '" . (($HasLog == "'1'") ? $LogScoreAverage : 0) . "', '" . $T['FreeLeech'] . "', '" . $T['FreeLeechType'] . "')");
$Cache->increment('stats_torrent_count'); $Cache->increment('stats_torrent_count');

View File

@ -351,6 +351,9 @@
$Contents = fread($File, 10000000); $Contents = fread($File, 10000000);
$Tor = new TORRENT($Contents); // New TORRENT object $Tor = new TORRENT($Contents); // New TORRENT object
if (isset($Tor->Val['info']->Val['encrypted_files'])) {
$Err = "This torrent contains an encrypted file list which is not supported here";
}
// Remove uploader's passkey from the torrent. // Remove uploader's passkey from the torrent.
// We put the downloader's passkey in on download, so it doesn't matter what's in there now, // We put the downloader's passkey in on download, so it doesn't matter what's in there now,
// so long as it's not useful to any leet hax0rs looking in an unprotected /torrents/ directory // so long as it's not useful to any leet hax0rs looking in an unprotected /torrents/ directory

View File

@ -51,7 +51,7 @@
<? if (($Override=check_paranoia_here('collagecontribs+'))) { ?> <? if (($Override=check_paranoia_here('collagecontribs+'))) { ?>
<li<?= $Override===2 ? ' class="paranoia_override"' : ''?>>Collages contributed to: <? echo number_format($NumCollageContribs); ?> <li<?= $Override===2 ? ' class="paranoia_override"' : ''?>>Collages contributed to: <? echo number_format($NumCollageContribs); ?>
<? if (($Override=check_paranoia_here('collagecontribs'))) { ?> <? if (($Override=check_paranoia_here('collagecontribs'))) { ?>
<a href="collages.php?userid=<?$UserID?>&amp;contrib=1" class="brackets<?= ($Override===2) ? ' paranoia_override' : '' ?>" title="View">View</a> <a href="collages.php?userid=<?=$UserID?>&amp;contrib=1" class="brackets<?= ($Override===2) ? ' paranoia_override' : '' ?>" title="View">View</a>
<? } ?> <? } ?>
</li> </li>
<? } ?> <? } ?>

View File

@ -4,7 +4,10 @@
?> ?>
<div class="thin"> <div class="thin">
<div class="header"> <div class="header">
<h2>Notify me of all new torrents with...<a href="torrents.php?action=notify">(View)</a></h2> <h2>Notify me of all new torrents with...</h2>
<div class="linkbox">
<a href="torrents.php?action=notify" class="brackets">View notifications</a>
</div>
</div> </div>
<? <?
$DB->query("SELECT ID, Label, Artists, ExcludeVA, NewGroupsOnly, Tags, NotTags, ReleaseTypes, Categories, Formats, Encodings, Media, FromYear, ToYear FROM users_notify_filters WHERE UserID='$LoggedUser[ID]' UNION ALL SELECT NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL"); $DB->query("SELECT ID, Label, Artists, ExcludeVA, NewGroupsOnly, Tags, NotTags, ReleaseTypes, Categories, Formats, Encodings, Media, FromYear, ToYear FROM users_notify_filters WHERE UserID='$LoggedUser[ID]' UNION ALL SELECT NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL");
@ -15,7 +18,7 @@
foreach($Notifications as $N) { //$N stands for Notifications foreach($Notifications as $N) { //$N stands for Notifications
$N['Artists'] = implode(', ', explode('|', substr($N['Artists'],1,-1))); $N['Artists'] = implode(', ', explode('|', substr($N['Artists'],1,-1)));
$N['Tags'] = implode(', ', explode('|', substr($N['Tags'],1,-1))); $N['Tags'] = implode(', ', explode('|', substr($N['Tags'],1,-1)));
$N['NotTags'] = implode(', ', explode('|', substr($N['NotTags'],1,-1))); $N['NotTags'] = implode(', ', explode('|', substr($N['NotTags'],1,-1)));
$N['ReleaseTypes'] = explode('|', substr($N['ReleaseTypes'],1,-1)); $N['ReleaseTypes'] = explode('|', substr($N['ReleaseTypes'],1,-1));
$N['Categories'] = explode('|', substr($N['Categories'],1,-1)); $N['Categories'] = explode('|', substr($N['Categories'],1,-1));
@ -46,7 +49,7 @@
<td class="label"><strong>Label</strong></td> <td class="label"><strong>Label</strong></td>
<td> <td>
<input type="text" name="label<?=$i?>" style="width: 100%" /> <input type="text" name="label<?=$i?>" style="width: 100%" />
<p class="min_padding">A label for the filter set, to tell different filters apart.</p> <p class="min_padding">A label/name for the filter set to tell different filters apart.</p>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -61,7 +64,7 @@
<td class="label"><strong>One of these artists</strong></td> <td class="label"><strong>One of these artists</strong></td>
<td> <td>
<textarea name="artists<?=$i?>" style="width:100%" rows="5"><?=display_str($N['Artists'])?></textarea> <textarea name="artists<?=$i?>" style="width:100%" rows="5"><?=display_str($N['Artists'])?></textarea>
<p class="min_padding">Comma-separated list - eg. <em>Pink Floyd, Led Zeppelin, Neil Young</em></p> <p class="min_padding">Comma-separated list &mdash; e.g. <em>Pink Floyd, Led Zeppelin, Neil Young</em></p>
<input type="checkbox" name="excludeva<?=$i?>" id="excludeva_<?=$N['ID']?>"<? if($N['ExcludeVA']=="1") { echo ' checked="checked"';} ?> /> <input type="checkbox" name="excludeva<?=$i?>" id="excludeva_<?=$N['ID']?>"<? if($N['ExcludeVA']=="1") { echo ' checked="checked"';} ?> />
<label for="excludeva_<?=$N['ID']?>">Exclude Various Artists releases</label> <label for="excludeva_<?=$N['ID']?>">Exclude Various Artists releases</label>
</td> </td>
@ -70,14 +73,14 @@
<td class="label"><strong>At least one of these tags</strong></td> <td class="label"><strong>At least one of these tags</strong></td>
<td> <td>
<textarea name="tags<?=$i?>" style="width:100%" rows="2"><?=display_str($N['Tags'])?></textarea> <textarea name="tags<?=$i?>" style="width:100%" rows="2"><?=display_str($N['Tags'])?></textarea>
<p class="min_padding">Comma-separated list - eg. <em>rock, jazz, pop</em></p> <p class="min_padding">Comma-separated list &mdash; e.g. <em>rock, jazz, pop</em></p>
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="label"><strong>None of these tags</strong></td> <td class="label"><strong>None of these tags</strong></td>
<td> <td>
<textarea name="nottags<?=$i?>" style="width:100%" rows="2"><?=display_str($N['NotTags'])?></textarea> <textarea name="nottags<?=$i?>" style="width:100%" rows="2"><?=display_str($N['NotTags'])?></textarea>
<p class="min_padding">Comma-separated list - eg. <em>rock, jazz, pop</em></p> <p class="min_padding">Comma-separated list &mdash; e.g. <em>rock, jazz, pop</em></p>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -152,4 +155,4 @@
<? } <? }
} ?> } ?>
</div> </div>
<? View::show_footer(); ?> <? View::show_footer(); ?>

View File

@ -199,11 +199,11 @@ function check_paranoia_here($Setting) {
<? } <? }
if (check_perms('users_mod')) { if (check_perms('users_mod')) {
?> ?>
<a href="userhistory.php?action=token_history&amp;userid=<?=$UserID?>" class="brackets">FL Tokens</a> <a href="userhistory.php?action=token_history&amp;userid=<?=$UserID?>" class="brackets">FL tokens</a>
<? } <? }
if (check_perms('admin_clear_cache') && check_perms('users_override_paranoia')) { if (check_perms('admin_clear_cache') && check_perms('users_override_paranoia')) {
?> ?>
<a href="user.php?action=clearcache&amp;id=<?=$UserID?>" class="brackets">Clear Cache</a> <a href="user.php?action=clearcache&amp;id=<?=$UserID?>" class="brackets">Clear cache</a>
<? } ?> <? } ?>
</div> </div>
@ -311,17 +311,17 @@ function check_paranoia_here($Setting) {
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?> title="<?=Format::get_size($Downloaded)?>">Data downloaded: <?=$DownloadedRank === false ? 'Server busy' : number_format($DownloadedRank)?></li> <li <?= $Override===2 ? 'class="paranoia_override"' : ''?> title="<?=Format::get_size($Downloaded)?>">Data downloaded: <?=$DownloadedRank === false ? 'Server busy' : number_format($DownloadedRank)?></li>
<? } ?> <? } ?>
<? if (($Override=check_paranoia_here('uploads+'))) { ?> <? if (($Override=check_paranoia_here('uploads+'))) { ?>
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?> title="<?=$Uploads?>">Torrents uploaded: <?=$UploadsRank === false ? 'Server busy' : number_format($UploadsRank)?></li> <li <?= $Override===2 ? 'class="paranoia_override"' : ''?> title="<?=number_format($Uploads)?>">Torrents uploaded: <?=$UploadsRank === false ? 'Server busy' : number_format($UploadsRank)?></li>
<? } ?> <? } ?>
<? if (($Override=check_paranoia_here('requestsfilled_count'))) { ?> <? if (($Override=check_paranoia_here('requestsfilled_count'))) { ?>
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?> title="<?=$RequestsFilled?>">Requests filled: <?=$RequestRank === false ? 'Server busy' : number_format($RequestRank)?></li> <li <?= $Override===2 ? 'class="paranoia_override"' : ''?> title="<?=number_format($RequestsFilled)?>">Requests filled: <?=$RequestRank === false ? 'Server busy' : number_format($RequestRank)?></li>
<? } ?> <? } ?>
<? if (($Override=check_paranoia_here('requestsvoted_bounty'))) { ?> <? if (($Override=check_paranoia_here('requestsvoted_bounty'))) { ?>
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?> title="<?=Format::get_size($TotalSpent)?>">Bounty spent: <?=$BountyRank === false ? 'Server busy' : number_format($BountyRank)?></li> <li <?= $Override===2 ? 'class="paranoia_override"' : ''?> title="<?=Format::get_size($TotalSpent)?>">Bounty spent: <?=$BountyRank === false ? 'Server busy' : number_format($BountyRank)?></li>
<? } ?> <? } ?>
<li title="<?=$ForumPosts?>">Posts made: <?=$PostRank === false ? 'Server busy' : number_format($PostRank)?></li> <li title="<?=number_format($ForumPosts)?>">Posts made: <?=$PostRank === false ? 'Server busy' : number_format($PostRank)?></li>
<? if (($Override=check_paranoia_here('artistsadded'))) { ?> <? if (($Override=check_paranoia_here('artistsadded'))) { ?>
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?> title="<?=$ArtistsAdded?>">Artists added: <?=$ArtistsRank === false ? 'Server busy' : number_format($ArtistsRank)?></li> <li <?= $Override===2 ? 'class="paranoia_override"' : ''?> title="<?=number_format($ArtistsAdded)?>">Artists added: <?=$ArtistsRank === false ? 'Server busy' : number_format($ArtistsRank)?></li>
<? } ?> <? } ?>
<? if (check_paranoia_here(array('uploaded', 'downloaded', 'uploads+', 'requestsfilled_count', 'requestsvoted_bounty', 'artistsadded'))) { ?> <? if (check_paranoia_here(array('uploaded', 'downloaded', 'uploads+', 'requestsfilled_count', 'requestsvoted_bounty', 'artistsadded'))) { ?>
<li><strong>Overall rank: <?=$OverallRank === false ? 'Server busy' : number_format($OverallRank)?></strong></li> <li><strong>Overall rank: <?=$OverallRank === false ? 'Server busy' : number_format($OverallRank)?></strong></li>