From a49bc32a52a6668951389585406a0c1abc1ff58f Mon Sep 17 00:00:00 2001 From: Git Date: Sat, 16 Feb 2013 08:00:57 +0000 Subject: [PATCH] Empty commit --- classes/class_torrent_form.php | 14 +-- classes/class_votes.php | 58 +++++----- sections/ajax/browse.php | 29 +++-- sections/ajax/torrentgroup.php | 3 +- sections/artist/download.php | 56 +++++----- sections/bookmarks/torrents.php | 4 +- sections/collages/add_torrent.php | 6 +- sections/collages/download.php | 56 +++++----- sections/forums/search.php | 22 ++-- sections/requests/request.php | 20 ---- sections/top10/torrents.php | 4 +- sections/top10/votes.php | 4 +- sections/torrents/browse2.php | 7 +- sections/torrents/takeedit.php | 60 +++++------ sections/torrents/takegroupedit.php | 25 +++++ sections/torrents/takenewgroup.php | 114 ++++++++++++-------- sections/torrents/user.php | 31 +++--- sections/upload/generate_extra_torrents.php | 9 +- sections/upload/insert_extra_torrents.php | 2 +- sections/upload/upload_handle.php | 3 + sections/user/community_stats.php | 2 +- sections/user/notify_edit.php | 17 +-- sections/user/user.php | 12 +-- 23 files changed, 300 insertions(+), 258 deletions(-) diff --git a/classes/class_torrent_form.php b/classes/class_torrent_form.php index f87349a2..9a87b80d 100644 --- a/classes/class_torrent_form.php +++ b/classes/class_torrent_form.php @@ -139,7 +139,7 @@ function foot() {

Be sure that your torrent is approved by the rules. Not doing this will result in a warning or worse.

NewTorrent) { ?> -

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.

+

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 list of requests.

NewTorrent) { echo "value=\"Upload torrent\""; } else { echo "value=\"Edit torrent\"";} ?> /> @@ -588,17 +588,17 @@ function show() { Disabled?>/>
- Tags should be comma separated, and you should use a period ('.') to separate words inside a tag - eg. 'hip.hop'. + Tags should be comma-separated, and you should use a period (".") to separate words inside a tag — e.g. "hip.hop".

- 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 'drum.and.bass' tag, instead of an unofficial 'dnb' tag). Please note that the '2000s' tag refers to music produced between 2000 and 2009. + 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 "drum.and.bass" tag, instead of an unofficial "dnb" tag). Please note that the "2000s" tag refers to music produced between 2000 and 2009.

- Avoid abbreviations if at all possible. So instead of tagging an album as 'alt', tag it as 'alternative'. Make sure that you use correct spelling. + Avoid abbreviations if at all possible. So instead of tagging an album as "alt", tag it as "alternative". Make sure that you use correct spelling.

- Avoid using multiple synonymous tags. Using both 'prog.rock' and 'progressive.rock' is redundant and annoying - just use the official 'progressive.rock' tag. + Avoid using multiple synonymous tags. Using both "prog.rock" and "progressive.rock" is redundant and annoying—just use the official "progressive.rock" tag.

- Don't use 'useless' tags, such as 'seen.live', 'awesome', 'rap' (is encompassed by 'hip.hop'), etc. If an album is live, you can tag it as 'live'. + Do not add "useless" tags, such as "seen.live", "awesome", "rap" (is encompassed by "hip.hop"), etc. If an album is live, you can tag it as "live".

- Only tag information on the album itself - NOT THE INDIVIDUAL RELEASE. Tags such as 'v0', 'eac', 'vinyl', 'from.oink' 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—NOT THE INDIVIDUAL RELEASE. Tags such as "v0", "eac", "vinyl", "from.oink", etc. are strictly forbidden. Remember that these tags will be used for other versions of the same album.

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. diff --git a/classes/class_votes.php b/classes/class_votes.php index bc270b2e..dc2992fc 100644 --- a/classes/class_votes.php +++ b/classes/class_votes.php @@ -10,16 +10,16 @@ public static function vote_link($GroupID, $Vote = '') { global $LoggedUser; if (!$LoggedUser['NoVoteLinks'] && check_perms('site_album_votes')) { ?> - Vote: - - - - - x + Vote: + + + + + x get_value('voted_albums_'.$UserID); if ($UserVotes === FALSE) { $DB->query('SELECT GroupID, Type FROM users_votes WHERE UserID='.$UserID); @@ -42,7 +42,7 @@ public static function get_user_votes($UserID) { } return $UserVotes; } - + /** * Returns an array with torrent group vote data * @global CACHE $Cache @@ -52,7 +52,7 @@ public static function get_user_votes($UserID) { */ public static function get_group_votes($GroupID) { global $DB, $Cache; - + $GroupVotes = $Cache->get_value('votes_'.$GroupID); if ($GroupVotes === FALSE) { $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; } - + /** * Computes the inverse normal CDF of a p-value * @param float $GroupID @@ -157,12 +157,12 @@ private function inverse_ncdf($p) { * @param int $Total Number of total votes * @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) //define(Z_VAL, 1.645211440143815); // Confidence level for binomial scoring (p-value .90) define(Z_VAL, 1.281728756502709); - + if (($Total <= 0) || ($Ups < 0)) { return 0; } @@ -187,7 +187,7 @@ public static function get_ranking($GroupID, $Year) { 'year' =>Votes::get_rank_year($GroupID, $Year), 'decade' =>Votes::get_rank_decade($GroupID, $Year)); } - + /** * Gets where this album ranks overall. * @global CACHE $Cache @@ -197,12 +197,12 @@ public static function get_ranking($GroupID, $Year) { */ public static function get_rank_all($GroupID) { global $Cache, $DB; - + $GroupID = (int)$GroupID; if ($GroupID <= 0) { return false; } - + $Rankings = $Cache->get_value('voting_ranks_overall'); if ($Rankings === FALSE) { $Rankings = array(); @@ -213,10 +213,10 @@ public static function get_rank_all($GroupID) { } $Cache->cache_value('voting_ranks_overall', $Rankings); } - + return isset($Rankings[$GroupID])?$Rankings[$GroupID]:false; } - + /** * Gets where this album ranks in its year. * @global CACHE $Cache @@ -227,18 +227,18 @@ public static function get_rank_all($GroupID) { */ public static function get_rank_year($GroupID, $Year) { global $Cache, $DB; - + $GroupID = (int)$GroupID; $Year = (int)$Year; if ($GroupID <= 0 || $Year <= 0) { return false; } - + $Rankings = $Cache->get_value('voting_ranks_year_'.$Year); if ($Rankings === FALSE) { $Rankings = array(); $i = 0; - $DB->query("SELECT GroupID + $DB->query("SELECT GroupID FROM torrents_votes AS v JOIN torrents_group AS g ON g.ID = v.GroupID WHERE g.Year = $Year @@ -248,7 +248,7 @@ public static function get_rank_year($GroupID, $Year) { } $Cache->cache_value('voting_ranks_year_'.$Year , $Rankings); } - + 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) { global $Cache, $DB; - + $GroupID = (int)$GroupID; $Year = (int)$Year; $Year = (int)$Year; if ((int)$GroupID <= 0 || (int)$Year <= 0) { return false; } - + // First year of the decade $Year = $Year - ($Year % 10); - + $Rankings = $Cache->get_value('voting_ranks_decade_'.$Year); if ($Rankings === FALSE) { $Rankings = array(); $i = 0; - $DB->query("SELECT GroupID + $DB->query("SELECT GroupID FROM torrents_votes AS v JOIN torrents_group AS g ON g.ID = v.GroupID 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); } - + return isset($Rankings[$GroupID])?$Rankings[$GroupID]:false; } } -?> \ No newline at end of file +?> diff --git a/sections/ajax/browse.php b/sections/ajax/browse.php index dae430fc..efd3f633 100644 --- a/sections/ajax/browse.php +++ b/sections/ajax/browse.php @@ -11,7 +11,7 @@ function header_link($SortKey,$DefaultWay="desc") { if($OrderWay=="desc") { $NewWay="asc"; } else { $NewWay="desc"; } } else { $NewWay=$DefaultWay; } - + return "torrents.php?order_way=".$NewWay."&order_by=".$SortKey."&".Format::get_url(array('order_way','order_by')); } @@ -113,7 +113,6 @@ function header_link($SortKey,$DefaultWay="desc") { foreach ($SearchBitrates as $ID=>$Val) { $SearchBitrates[$ID] = strtolower($Val); } - foreach ($Formats as $ID => $Val) { $SearchFormats[$ID] = strtolower($Val); } @@ -490,12 +489,12 @@ function header_link($SortKey,$DefaultWay="desc") { if($TorrentCount == 0) { -$DB->query("SELECT +$DB->query("SELECT tags.Name, ((COUNT(tags.Name)-2)*(SUM(tt.PositiveVotes)-SUM(tt.NegativeVotes)))/(tags.Uses*0.8) AS Score - FROM xbt_snatched AS s - INNER JOIN torrents AS t ON t.ID=s.fid - INNER JOIN torrents_group AS g ON t.GroupID=g.ID + FROM xbt_snatched AS s + INNER JOIN torrents AS t ON t.ID=s.fid + INNER JOIN torrents_group AS g ON t.GroupID=g.ID INNER JOIN torrents_tags AS tt ON tt.GroupID=g.ID INNER JOIN tags ON tags.ID=tt.TagID WHERE s.uid='$LoggedUser[ID]' @@ -557,7 +556,7 @@ function header_link($SortKey,$DefaultWay="desc") { } else { $Torrents = array($Result['id'] => $GroupInfo['Torrents'][$Result['id']]); } - + $TagList = explode(' ',str_replace('_','.',$GroupInfo['TagList'])); $JsonArtists = array(); if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) { @@ -590,14 +589,14 @@ function header_link($SortKey,$DefaultWay="desc") { $LastRemasterRecordLabel = ''; $LastRemasterCatalogueNumber = ''; $LastMedia = ''; - + $EditionID = 0; unset($FirstUnknown); $JsonTorrents = array(); foreach($Torrents as $TorrentID => $Data) { // 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 (!isset($TorrentIDs[$TorrentID])) { continue; @@ -606,7 +605,7 @@ function header_link($SortKey,$DefaultWay="desc") { if ($Data['Remastered'] && !$Data['RemasterYear']) { $FirstUnknown = !isset($FirstUnknown); } - + if (isset($GroupedCategories[$CategoryID-1]) && ($Data['RemasterTitle'] != $LastRemasterTitle || $Data['RemasterYear'] != $LastRemasterYear @@ -617,7 +616,7 @@ function header_link($SortKey,$DefaultWay="desc") { $EditionID++; if ($Data['Remastered'] && $Data['RemasterYear'] != 0) { - + $RemasterName = $Data['RemasterYear']; $AddExtra = " - "; if ($Data['RemasterRecordLabel']) { $RemasterName .= $AddExtra.display_str($Data['RemasterRecordLabel']); $AddExtra=' / '; } @@ -641,7 +640,7 @@ function header_link($SortKey,$DefaultWay="desc") { $LastRemasterRecordLabel = $Data['RemasterRecordLabel']; $LastRemasterCatalogueNumber = $Data['RemasterCatalogueNumber']; $LastMedia = $Data['Media']; - + $JsonTorrents[] = array( 'torrentId' => (int) $TorrentID, 'editionId' => (int) $EditionID, @@ -671,7 +670,7 @@ function header_link($SortKey,$DefaultWay="desc") { 'hasSnatched' => $Data['IsSnatched'] ); } - + $JsonGroups[] = array( 'groupId' => (int) $GroupID, 'groupName' => $GroupName, @@ -691,9 +690,9 @@ function header_link($SortKey,$DefaultWay="desc") { } else { // Viewing a type that does not require grouping - + list($TorrentID, $Data) = each($Torrents); - + $JsonGroups[] = array( 'groupId' => (int) $GroupID, 'groupName' => $GroupName, diff --git a/sections/ajax/torrentgroup.php b/sections/ajax/torrentgroup.php index 17aaea49..95385c1f 100644 --- a/sections/ajax/torrentgroup.php +++ b/sections/ajax/torrentgroup.php @@ -57,6 +57,7 @@ $JsonTorrentList = array(); foreach ($TorrentList as $Torrent) { + $Userinfo = Users::user_info($Torrent['UserID']); $JsonTorrentList[] = array( 'id' => (int) $Torrent['ID'], 'media' => $Torrent['Media'], @@ -82,7 +83,7 @@ 'fileList' => $Torrent['FileList'], 'filePath' => $Torrent['FilePath'], 'userId' => (int) $Torrent['UserID'], - 'username' => $Torrent['Username'] + 'username' => $Userinfo['Username'] ); } diff --git a/sections/artist/download.php b/sections/artist/download.php index 70226cf1..274af3a3 100644 --- a/sections/artist/download.php +++ b/sections/artist/download.php @@ -1,37 +1,36 @@ to_array() works. What we've done, is +The solution I settled on abuses the way +$DB->to_array() works. What we've done, is backwards ordering. The results returned by the -query have the best one for each GroupID last, -and while to_array traverses the results, it +query have the best one for each GroupID last, +and while to_array traverses the results, it overwrites the keys and leaves us with only the -desired result. This does mean however, that -the SQL has to be done in a somewhat backwards +desired result. This does mean however, that +the SQL has to be done in a somewhat backwards fashion. -Thats all you get for a disclaimer, just -remember, this page isn't for the faint of +Thats all you get for a disclaimer, just +remember, this page isn't for the faint of heart. -A9 SQL template: -SELECT - 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='V2 (VBR)' THEN 2 - ELSE 100 - END AS Rank, +SELECT + CASE + WHEN t.Format='MP3' AND t.Encoding='V0 (VBR)' THEN 1 + WHEN t.Format='MP3' AND t.Encoding='V2 (VBR)' THEN 2 + ELSE 100 + END AS Rank, t.GroupID, t.Media, t.Format, @@ -40,7 +39,7 @@ tg.Name, a.Name, 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 artists_group AS a ON a.ArtistID=tg.ArtistID AND a.ArtistID='59721' LEFT JOIN torrents_files AS f ON t.ID=f.TorrentID @@ -48,10 +47,10 @@ */ if( - !isset($_REQUEST['artistid']) || - !isset($_REQUEST['preference']) || - !is_number($_REQUEST['preference']) || - !is_number($_REQUEST['artistid']) || + !isset($_REQUEST['artistid']) || + !isset($_REQUEST['preference']) || + !is_number($_REQUEST['preference']) || + !is_number($_REQUEST['artistid']) || $_REQUEST['preference'] > 2 || count($_REQUEST['list']) == 0 ) { error(0); } @@ -100,7 +99,6 @@ 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 '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 '43': $SQL .= "t.Format='AAC' AND t.Encoding='256'"; 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), tg.Name, 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).") ORDER BY t.GroupID ASC, Rank DESC, t.$Preference"; @@ -159,7 +157,7 @@ $Tor = new TORRENT($Contents, true); $Tor->set_announce_url(ANNOUNCE_URL.'/'.$LoggedUser['torrent_pass'].'/announce'); unset($Tor->Val['announce-list']); - + // We need this section for long file names :/ $TorrentName=''; $TorrentInfo=''; @@ -179,7 +177,7 @@ $TorrentName = Misc::file_string($Album).(($Year>0)?(' - '.Misc::file_string($Year)):''); } $FileName = Format::cut_string($TorrentName.$TorrentInfo, 180, true, false); - + $Zip->add_file($Tor->enc(), $ReleaseTypeName.'/'.$FileName.'.torrent'); } $Analyzed = count($Downloads); diff --git a/sections/bookmarks/torrents.php b/sections/bookmarks/torrents.php index 032de971..f70f41ff 100644 --- a/sections/bookmarks/torrents.php +++ b/sections/bookmarks/torrents.php @@ -101,7 +101,7 @@ function compare($X, $Y){ - Unbookmark + Unbookmark
@@ -220,7 +220,7 @@ function compare($X, $Y){ - Unbookmark + Unbookmark diff --git a/sections/collages/add_torrent.php b/sections/collages/add_torrent.php index 14b389a7..07e711a4 100644 --- a/sections/collages/add_torrent.php +++ b/sections/collages/add_torrent.php @@ -50,6 +50,10 @@ function AddTorrent($CollageID, $GroupID) { if ($MaxGroups > 0 && $NumTorrents >= $MaxGroups) { $Err = "This collage already holds its maximum allowed number of torrents"; } + + if (isset($Err)) { + error($Err); + } } if ($MaxGroupsPerUser > 0) { @@ -134,4 +138,4 @@ function AddTorrent($CollageID, $GroupID) { AddTorrent($CollageID, $GroupID); } } -header('Location: collages.php?id='.$CollageID); \ No newline at end of file +header('Location: collages.php?id='.$CollageID); diff --git a/sections/collages/download.php b/sections/collages/download.php index 97ffd3d8..780894d3 100644 --- a/sections/collages/download.php +++ b/sections/collages/download.php @@ -1,36 +1,35 @@ to_array() works. What we've done, is +The solution I settled on abuses the way +$DB->to_array() works. What we've done, is backwards ordering. The results returned by the -query have the best one for each GroupID last, -and while to_array traverses the results, it +query have the best one for each GroupID last, +and while to_array traverses the results, it overwrites the keys and leaves us with only the -desired result. This does mean however, that -the SQL has to be done in a somewhat backwards +desired result. This does mean however, that +the SQL has to be done in a somewhat backwards fashion. -Thats all you get for a disclaimer, just -remember, this page isn't for the faint of +Thats all you get for a disclaimer, just +remember, this page isn't for the faint of heart. -A9 SQL template: -SELECT - 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='V2 (VBR)' THEN 2 - ELSE 100 - END AS Rank, +SELECT + CASE + WHEN t.Format='MP3' AND t.Encoding='V0 (VBR)' THEN 1 + WHEN t.Format='MP3' AND t.Encoding='V2 (VBR)' THEN 2 + ELSE 100 + END AS Rank, t.GroupID, t.Media, t.Format, @@ -39,7 +38,7 @@ tg.Name, a.Name, 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 torrents_group AS tg ON tg.ID=t.GroupID AND tg.CategoryID='1' LEFT JOIN artists_group AS a ON a.ArtistID=tg.ArtistID @@ -48,10 +47,10 @@ */ if( - !isset($_REQUEST['collageid']) || - !isset($_REQUEST['preference']) || - !is_number($_REQUEST['preference']) || - !is_number($_REQUEST['collageid']) || + !isset($_REQUEST['collageid']) || + !isset($_REQUEST['preference']) || + !is_number($_REQUEST['preference']) || + !is_number($_REQUEST['collageid']) || $_REQUEST['preference'] > 2 || count($_REQUEST['list']) == 0 ) { error(0); } @@ -95,7 +94,6 @@ 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 '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 '43': $SQL .= "t.Format='AAC' AND t.Encoding='256'"; 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), tg.Name, 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 torrents_group AS tg ON tg.ID=t.GroupID AND tg.CategoryID='1' ORDER BY t.GroupID ASC, Rank DESC, t.$Preference"; @@ -148,7 +146,7 @@ $Tor = new TORRENT($Contents, true); $Tor->set_announce_url(ANNOUNCE_URL.'/'.$LoggedUser['torrent_pass'].'/announce'); unset($Tor->Val['announce-list']); - + // We need this section for long file names :/ $TorrentName=''; $TorrentInfo=''; @@ -169,7 +167,7 @@ } $FileName = $TorrentName.$TorrentInfo; $FileName = Format::cut_string($FileName, 192, true, false); - + $Zip->add_file($Tor->enc(), $FileName.'.torrent'); } $Analyzed = count($Downloads); diff --git a/sections/forums/search.php b/sections/forums/search.php index 66eb1b48..42e1a1c6 100644 --- a/sections/forums/search.php +++ b/sections/forums/search.php @@ -53,22 +53,26 @@ } // Searching for posts in a specific thread -if(!empty($_GET['threadid'])) { - $ThreadID = db_string($_GET['threadid']); - $Type='body'; +if (!empty($_GET['threadid']) && is_number($_GET['threadid'])) { + $ThreadID = $_GET['threadid']; + $Type = 'body'; $SQL = "SELECT Title FROM forums_topics AS t JOIN forums AS f ON f.ID=t.ForumID - WHERE f.MinClassRead <= '$LoggedUser[Class]' - AND t.ID=$ThreadID"; - if(!empty($RestrictedForums)) { - $SQL .= " AND f.ID NOT IN ('".$RestrictedForums."')"; + WHERE t.ID=$ThreadID + AND ((f.MinClassRead <= '$LoggedUser[Class]'"; + if (!empty($RestrictedForums)) { + $SQL .= " AND f.ID NOT IN ('$RestrictedForums')"; } + $SQL .= ")"; + if (!empty($PermittedForums)) { + $SQL .= " OR f.ID IN ('$PermittedForums')"; + } + $SQL .= ")"; $DB->query($SQL); if (list($Title) = $DB->next_record()) { $Title = " > $Title"; } else { - $Title = ''; - $ThreadID = ''; + error(404); } } else { $ThreadID = ''; diff --git a/sections/requests/request.php b/sections/requests/request.php index bdd56ace..d6d7f40d 100644 --- a/sections/requests/request.php +++ b/sections/requests/request.php @@ -456,26 +456,6 @@ - -if(check_perms("users_mod")) { -$RequestLog = Requests::get_request_log($RequestID); - if($RequestLog) { -?> - - Request log - - - - - - - -?> Description diff --git a/sections/top10/torrents.php b/sections/top10/torrents.php index 613493d2..3f9a2b08 100644 --- a/sections/top10/torrents.php +++ b/sections/top10/torrents.php @@ -491,9 +491,9 @@ function generate_torrent_table($Caption, $Tag, $Details, $Limit) { - Unbookmark + Unbookmark - Bookmark + Bookmark
diff --git a/sections/top10/votes.php b/sections/top10/votes.php index a87f8a28..bdeaa840 100644 --- a/sections/top10/votes.php +++ b/sections/top10/votes.php @@ -221,9 +221,9 @@ - Unbookmark + Unbookmark - Bookmark + Bookmark diff --git a/sections/torrents/browse2.php b/sections/torrents/browse2.php index f773b571..58980268 100644 --- a/sections/torrents/browse2.php +++ b/sections/torrents/browse2.php @@ -151,7 +151,6 @@ function header_link($SortKey,$DefaultWay="desc") { foreach ($SearchBitrates as $ID=>$Val) { $SearchBitrates[$ID] = strtolower($Val); } - foreach ($Formats as $ID => $Val) { $SearchFormats[$ID] = strtolower($Val); } @@ -595,7 +594,7 @@ function header_link($SortKey,$DefaultWay="desc") { Click here to toggle searching for specific remaster information &authkey=&torrent_pass=" title="Download">DL | FL - + | RP ] diff --git a/sections/torrents/takeedit.php b/sections/torrents/takeedit.php index ef0bc546..ebca3b9b 100644 --- a/sections/torrents/takeedit.php +++ b/sections/torrents/takeedit.php @@ -79,8 +79,6 @@ $Properties['FreeLeechType'] = $FreeType; } - - //******************************************************************************// //--------------- Validate data in edit form -----------------------------------// @@ -120,7 +118,7 @@ header("Location: torrents.php?action=edit&id=$TorrentID"); die(); } - + $Validate->SetFields('remaster_title', '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"); die(); } - + $Validate->SetFields('remaster_record_label', '0','string','Remaster record label must be between 2 and 80 characters.',array('maxlength'=>80, 'minlength'=>2)); - + $Validate->SetFields('remaster_catalogue_number', '0','string','Remaster catalogue number must be between 2 and 80 characters.',array('maxlength'=>80, 'minlength'=>2)); - - + + $Validate->SetFields('format', '1','inarray','Not a valid format.',array('inarray'=>$Formats)); - + $Validate->SetFields('bitrate', '1','inarray','You must choose a bitrate.', array('inarray'=>$Bitrates)); - - + + // Handle 'other' bitrates if($Properties['Encoding'] == 'Other') { $Validate->SetFields('other_bitrate', '1','text','You must enter the other bitrate (max length: 9 characters).', array('maxlength'=>9)); $enc = trim($_POST['other_bitrate']); if(isset($_POST['vbr'])) { $enc.=' (VBR)'; } - + $Properties['Encoding'] = $enc; $Properties['Bitrate'] = $enc; } else { $Validate->SetFields('bitrate', '1','inarray','You must choose a bitrate.', array('inarray'=>$Bitrates)); } - + $Validate->SetFields('media', '1','inarray','Not a valid media.',array('inarray'=>$Media)); - + $Validate->SetFields('release_desc', '0','string','Invalid release description.',array('maxlength'=>1000000, 'minlength'=>0)); - + break; - + case 'Audiobooks': case 'Comedy': /*$Validate->SetFields('title', @@ -173,33 +171,33 @@ ^ this is commented out because there is no title field on these pages*/ $Validate->SetFields('year', '1','number','The year of the release must be entered.'); - + $Validate->SetFields('format', '1','inarray','Not a valid format.',array('inarray'=>$Formats)); - + $Validate->SetFields('bitrate', '1','inarray','You must choose a bitrate.', array('inarray'=>$Bitrates)); - - + + // Handle 'other' bitrates if($Properties['Encoding'] == 'Other') { $Validate->SetFields('other_bitrate', '1','text','You must enter the other bitrate (max length: 9 characters).', array('maxlength'=>9)); $enc = trim($_POST['other_bitrate']); if(isset($_POST['vbr'])) { $enc.=' (VBR)'; } - + $Properties['Encoding'] = $enc; $Properties['Bitrate'] = $enc; } else { $Validate->SetFields('bitrate', '1','inarray','You must choose a bitrate.', array('inarray'=>$Bitrates)); } - + $Validate->SetFields('release_desc', '0','string','The release description has a minimum length of 10 characters.',array('maxlength'=>1000000, 'minlength'=>10)); - + break; - + case 'Applications': case 'Comics': case 'E-Books': @@ -278,15 +276,15 @@ // Update info for the torrent $SQL = " UPDATE torrents SET - Media=$T[Media], - Format=$T[Format], + Media=$T[Media], + Format=$T[Format], Encoding=$T[Encoding], - RemasterYear=$T[RemasterYear], - Remastered=$T[Remastered], - RemasterTitle=$T[RemasterTitle], - RemasterRecordLabel=$T[RemasterRecordLabel], + RemasterYear=$T[RemasterYear], + Remastered=$T[Remastered], + RemasterTitle=$T[RemasterTitle], + RemasterRecordLabel=$T[RemasterRecordLabel], RemasterCatalogueNumber=$T[RemasterCatalogueNumber], - Scene=$T[Scene], + Scene=$T[Scene], Description=$T[TorrentDescription],"; if(check_perms('torrents_freeleech')) { @@ -357,7 +355,7 @@ if ($caID && !$Properties['CassetteApproved']) { $DB->query("DELETE FROM torrents_cassette_approved WHERE TorrentID='$TorrentID'"); } - + $DB->query("SELECT TorrentID FROM torrents_lossymaster_approved WHERE TorrentID='$TorrentID'"); list($lmaID) = $DB->next_record(); diff --git a/sections/torrents/takegroupedit.php b/sections/torrents/takegroupedit.php index 53dcccb3..ca7d7663 100644 --- a/sections/torrents/takegroupedit.php +++ b/sections/torrents/takegroupedit.php @@ -27,6 +27,31 @@ if(!empty($_GET['action']) && $_GET['action'] == 'revert') { // if we're reverting to a previous revision $RevisionID=$_GET['revisionid']; 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(); +?> +
+
+

Revert Confirm!

+
+
+
+ + + + + +

You are attempting to revert to the revision .

+ +
+
+
+query("SELECT ArtistID, AliasID, Redirect, Name FROM artists_alias WHERE Name = '$ArtistName'"); -if($DB->record_count() == 0) { - $Redirect = 0; - $DB->query("INSERT INTO artists_group (Name) VALUES ('$ArtistName')"); - $ArtistID = $DB->inserted_id(); - $DB->query("INSERT INTO artists_alias (ArtistID, Name) VALUES ('$ArtistID', '$ArtistName')"); - list($AliasID) = $DB->next_record(); -} else { - list($ArtistID, $AliasID, $Redirect, $ArtistName) = $DB->next_record(); - if($Redirect) { - $AliasID = $Redirect; - } -} - -$DB->query("INSERT INTO torrents_group - (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"); +//Everything is legit, let's just confim they're not retarded +if(empty($_POST['confirm'])) { + View::show_header(); +?> +
+
+

Split Confirm!

+
+
+
+ + + + + + + + +

You are attempting to split the torrent off into a new group:

+
  • - []
+ +
+
+
+query("SELECT ArtistID, AliasID, Redirect, Name FROM artists_alias WHERE Name = '$ArtistName'"); + if($DB->record_count() == 0) { + $Redirect = 0; + $DB->query("INSERT INTO artists_group (Name) VALUES ('$ArtistName')"); + $ArtistID = $DB->inserted_id(); + $DB->query("INSERT INTO artists_alias (ArtistID, Name) VALUES ('$ArtistID', '$ArtistName')"); + $AliasID = $DB->inserted_id(); + } else { + list($ArtistID, $AliasID, $Redirect, $ArtistName) = $DB->next_record(); + if($Redirect) { + $AliasID = $Redirect; + } + } + + $DB->query("INSERT INTO torrents_group + (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"); +} ?> diff --git a/sections/torrents/user.php b/sections/torrents/user.php index 3807fccb..c16ba4f0 100644 --- a/sections/torrents/user.php +++ b/sections/torrents/user.php @@ -11,7 +11,7 @@ function header_link($SortKey,$DefaultWay="DESC") { if($Way=="DESC") { $NewWay="ASC"; } else { $NewWay="DESC"; } } else { $NewWay=$DefaultWay; } - + return "torrents.php?way=".$NewWay."&order=".$SortKey."&".Format::get_url(array('way','order')); } @@ -40,7 +40,6 @@ function header_link($SortKey,$DefaultWay="DESC") { } $SearchWhere = array(); - if(!empty($_GET['format'])) { if(in_array($_GET['format'], $Formats)) { $SearchWhere[]="t.Format='".db_string($_GET['format'])."'"; @@ -222,9 +221,9 @@ function header_link($SortKey,$DefaultWay="DESC") { Size bigint(12) unsigned, PRIMARY KEY (TorrentID)) CHARSET=utf8"); $DB->query("INSERT IGNORE INTO temp_sections_torrents_user SELECT - t.GroupID, - t.ID AS TorrentID, - $Time AS Time, + t.GroupID, + t.ID AS TorrentID, + $Time AS Time, tg.CategoryID, t.Seeders, t.Leechers, @@ -235,14 +234,14 @@ function header_link($SortKey,$DefaultWay="DESC") { JOIN torrents_group AS tg ON tg.ID=t.GroupID LEFT JOIN torrents_artists AS ta ON ta.GroupID=tg.ID 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"); - + if(!empty($_GET['search']) && trim($_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 FROM temp_sections_torrents_user"; if(!empty($Words)) { @@ -294,12 +293,12 @@ function header_link($SortKey,$DefaultWay="DESC") { - + /> - + Order by @@ -368,7 +367,7 @@ function header_link($SortKey,$DefaultWay="DESC") { - + $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]); $Torrent = $Torrents[$TorrentID]; - + $TagList = explode(' ',str_replace('_','.',$TagList)); $TorrentTags = array(); @@ -435,7 +434,7 @@ function header_link($SortKey,$DefaultWay="DESC") { $TorrentTags[]=''.$Tag.''; } $TorrentTags = implode(', ', $TorrentTags); - + if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5])) { unset($ExtendedArtists[2]); unset($ExtendedArtists[3]); @@ -448,7 +447,7 @@ function header_link($SortKey,$DefaultWay="DESC") { $DisplayName.=''.$GroupName.''; if($GroupYear>0) { $DisplayName.=" [".$GroupYear."]"; } if($GroupVanityHouse) { $DisplayName .= ' [VH]'; } - + $ExtraInfo = Torrents::torrent_info($Torrent); if($ExtraInfo) { $DisplayName.=' - '.$ExtraInfo; diff --git a/sections/upload/generate_extra_torrents.php b/sections/upload/generate_extra_torrents.php index 68b9657e..18554956 100644 --- a/sections/upload/generate_extra_torrents.php +++ b/sections/upload/generate_extra_torrents.php @@ -8,6 +8,10 @@ $ExtraFile = fopen($Name, 'rb'); // open file for reading $ExtraContents = fread($ExtraFile, 10000000); $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. // 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 - $ExtraTmpFileList[] = $ExtraName . '{{{' . $ExtraSize . '}}}'; // Name {{{Size}}} + $ExtraTmpFileList[] = Torrents::filelist_format_file($ExtraFile); } // To be stored in the database $ExtraFilePath = isset($ExtraTor->Val['info']->Val['files']) ? db_string(Format::make_utf8($ExtraDirName)) : ""; $ExtraTorrentsInsert[$Name]['FilePath'] = $ExtraFilePath; - // Name {{{Size}}}|||Name {{{Size}}}|||Name {{{Size}}}|||Name {{{Size}}} - $ExtraFileString = "'" . db_string(Format::make_utf8(implode('|||', $ExtraTmpFileList))) . "'"; + $ExtraFileString = db_string(implode("\n", $ExtraTmpFileList)); $ExtraTorrentsInsert[$Name]['FileString'] = $ExtraFileString; // Number of files described in torrent $ExtraNumFiles = count($ExtraFileList); diff --git a/sections/upload/insert_extra_torrents.php b/sections/upload/insert_extra_torrents.php index 03e23fc5..efb358a9 100644 --- a/sections/upload/insert_extra_torrents.php +++ b/sections/upload/insert_extra_torrents.php @@ -12,7 +12,7 @@ Description, LogScore, FreeTorrent, FreeLeechType) VALUES (" . $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'] . "')"); $Cache->increment('stats_torrent_count'); diff --git a/sections/upload/upload_handle.php b/sections/upload/upload_handle.php index e42bfb06..3ad1e8ec 100644 --- a/sections/upload/upload_handle.php +++ b/sections/upload/upload_handle.php @@ -351,6 +351,9 @@ $Contents = fread($File, 10000000); $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. // 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 diff --git a/sections/user/community_stats.php b/sections/user/community_stats.php index db8a243e..19dc3219 100644 --- a/sections/user/community_stats.php +++ b/sections/user/community_stats.php @@ -51,7 +51,7 @@ >Collages contributed to: - View + View diff --git a/sections/user/notify_edit.php b/sections/user/notify_edit.php index 287a3207..49db37b6 100644 --- a/sections/user/notify_edit.php +++ b/sections/user/notify_edit.php @@ -4,7 +4,10 @@ ?>
-

Notify me of all new torrents with...(View)

+

Notify me of all new torrents with...

+
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 $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['ReleaseTypes'] = explode('|', substr($N['ReleaseTypes'],1,-1)); $N['Categories'] = explode('|', substr($N['Categories'],1,-1)); @@ -46,7 +49,7 @@
@@ -61,7 +64,7 @@ @@ -70,14 +73,14 @@ @@ -152,4 +155,4 @@ - \ No newline at end of file + diff --git a/sections/user/user.php b/sections/user/user.php index 9a6ff8c3..e944d0e8 100644 --- a/sections/user/user.php +++ b/sections/user/user.php @@ -199,11 +199,11 @@ function check_paranoia_here($Setting) { - FL Tokens + FL tokens - Clear Cache + Clear cache @@ -311,17 +311,17 @@ function check_paranoia_here($Setting) {
  • title="">Data downloaded:
  • -
  • title="">Torrents uploaded:
  • +
  • title="">Torrents uploaded:
  • -
  • title="">Requests filled:
  • +
  • title="">Requests filled:
  • title="">Bounty spent:
  • -
  • Posts made:
  • +
  • Posts made:
  • -
  • title="">Artists added:
  • +
  • title="">Artists added:
  • Overall rank:
  • Label -

    A label for the filter set, to tell different filters apart.

    +

    A label/name for the filter set to tell different filters apart.

    One of these artists -

    Comma-separated list - eg. Pink Floyd, Led Zeppelin, Neil Young

    +

    Comma-separated list — e.g. Pink Floyd, Led Zeppelin, Neil Young

    />
    At least one of these tags -

    Comma-separated list - eg. rock, jazz, pop

    +

    Comma-separated list — e.g. rock, jazz, pop

    None of these tags -

    Comma-separated list - eg. rock, jazz, pop

    +

    Comma-separated list — e.g. rock, jazz, pop