diff --git a/classes/class_torrent.php b/classes/class_torrent.php
index 72377c52..537f7f04 100644
--- a/classes/class_torrent.php
+++ b/classes/class_torrent.php
@@ -131,6 +131,9 @@ function encode($Val){
class BENCODE_LIST extends BENCODE {
function enc(){
+ if(empty($this->Val)) {
+ return 'le';
+ }
$Str = 'l';
reset($this->Val);
foreach ($this->Val as $Value) {
diff --git a/classes/class_wiki.php b/classes/class_wiki.php
index 301670dc..e732491b 100644
--- a/classes/class_wiki.php
+++ b/classes/class_wiki.php
@@ -48,16 +48,16 @@ function revision_history(){
RevisionID,
Summary,
Time,
- UserID,
- users.Username
+ UserID
FROM ".$this->Table." AS wiki
- JOIN users_main AS users ON users.ID = wiki.UserID
WHERE wiki.PageID = ".$this->PageID."
ORDER BY RevisionID DESC");
//----------------------------------------------- ?>
Revision |
+ Date |
+ User |
Summary |
//-----------------------------------------
@@ -68,11 +68,15 @@ function revision_history(){
= "#$RevisionID" ?>
-
|
- Edited by =$Username ?>
- Reason: =$Summary?>
+ =$Time?>
+ |
+
+ =Users::format_username($UserID, false, false, false)?>
+ |
+
+ =($Summary ? $Summary : '(empty)')?>
|
//---------------------------------------------------
diff --git a/classes/config.template b/classes/config.template
index 12c51832..c77e6234 100644
--- a/classes/config.template
+++ b/classes/config.template
@@ -56,7 +56,13 @@ if (!empty($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 80) {
}
// Site settings
-define('CRYPT_HASH_PREFIX', '$2y$07$'); // Crypt salt prefix for hash settings. See http://php.net/crypt for details
+if (PHP_VERSION_ID < 50307) {
+ die("PHP version 5.3.7 or later is highly recommended for gazelle's password hashing methods.".
+ " Uncomment line ".__LINE__." in file ".__FILE__." if you want to continue to use this version.");
+ define('CRYPT_HASH_PREFIX', '$2a$07$'); // Crypt salt prefix for hash settings. See http://php.net/crypt for details
+} else {
+ define('CRYPT_HASH_PREFIX', '$2y$07$');
+}
define('DEBUG_MODE', false); //Set to false if you dont want everyone to see debug information, can be overriden with 'site_debug'
define('OPEN_REGISTRATION', true); //Set to false to disable open regirstration, true to allow anyone to register
define('USER_LIMIT', 5000); //The maximum number of users the site can have, 0 for no limit
@@ -67,11 +73,10 @@ define('DONOR_INVITES', 2);
// User class IDs needed for automatic promotions. Found in the 'permissions' table
// Name of class Class ID (NOT level)
+define('ADMIN', '1');
define('USER', '2');
define('MEMBER', '3');
define('POWER', '4');
-define('ARTIST', '19');
-define('DONOR', '20');
define('ELITE', '5');
define('VIP', '6');
define('TORRENT_MASTER','7');
@@ -80,8 +85,12 @@ define('CELEB', '9');
define('MOD', '11');
define('DESIGNER', '13');
define('CODER', '14');
-define('ADMIN', '1');
define('SYSOP', '15');
+define('ARTIST', '19');
+define('DONOR', '20');
+define('FLS_TEAM', '21');
+define('POWER_TM', '22');
+define('ELITE_TM', '23');
//Pagination
define('TORRENT_COMMENTS_PER_PAGE', 10);
diff --git a/sections/better/snatch.php b/sections/better/snatch.php
index c640e50b..3c0e33e2 100644
--- a/sections/better/snatch.php
+++ b/sections/better/snatch.php
@@ -24,7 +24,7 @@
JOIN torrents AS t ON t.ID=x.fid
WHERE t.Format='FLAC'
AND ((t.LogScore = '100' AND t.Media = 'CD')
- OR t.Media = 'Vinyl')
+ OR t.Media != 'CD')
AND x.uid='$UserID'");
$SnatchedTorrentIDs = array_fill_keys($DB->collect('fid'), true);
@@ -35,7 +35,7 @@
}
if (count($SnatchedGroupIDs) == 0) {
- error(($SeedingOnly ? "You aren't seeding any 100% FLACs!" : "You haven't snatched any 100% FLACs!"));
+ error(($SeedingOnly ? "You aren't seeding any perfect FLACs!" : "You haven't snatched any perfect FLACs!"));
}
// Create hash table
@@ -104,6 +104,26 @@
}
}
}
+// count how many FLAC torrents we have in this list totally (key 'total')
+// how many transcodes there are missing totally (key 'miss_total')
+// and for each format (keys , 'miss_V0 (VBR)', 'miss_V2 (VBR)', 'miss_320')
+// the latter happens by counting the number of existing transcodes and then subtracting because that's easier
+$Counter = array();
+$Counter['total'] = 0;
+foreach($TorrentGroups as $Editions) {
+ foreach($Editions as $Edition) {
+ if($Edition['FlacID'] == 0) { continue; } // no FLAC in this edition
+ $edition_miss = 0; //number of transcodes missing in this edition
+ foreach($Encodings as $Encoding) {
+ if(!isset($Edition['Formats'][$Encoding])) {
+ ++$edition_miss;
+ ++$Counter['miss_'.$Encoding];
+ }
+ }
+ $Counter['miss_total'] += $edition_miss;
+ $Counter['total'] += (bool)$edition_miss;
+ }
+}
View::show_header('Transcode Snatches');
?>
@@ -115,6 +135,16 @@
} ?>
+
Transcode =($SeedingOnly ? 'seeding' : 'snatched')?> torrents
+
Stats
+
+
+ Number of perfect FLACs you can transcode: =$Counter['total']?>
+ Number of missing transcodes: =$Counter['miss_total']?>
+ Number of missing V2 / V0 / 320 transcodes: =$Counter['miss_V2 (VBR)']?> / =$Counter['miss_V0 (VBR)']?> / =$Counter['miss_320']?>
+
+
+
List
Torrent |
diff --git a/sections/better/transcode.php b/sections/better/transcode.php
index 78086e4f..eb0ebdd1 100644
--- a/sections/better/transcode.php
+++ b/sections/better/transcode.php
@@ -74,7 +74,7 @@
}
if (isset($EncodingKeys[$Torrent['Encoding']])) {
$TorrentGroups[$Group['ID']][$TorRemIdent]['Formats'][$Torrent['Encoding']] = true;
- } elseif ($TorrentGroups[$Group['ID']][$TorRemIdent]['FlacID'] == 0 && $Torrent['Format'] == 'FLAC' && $Torrent['LogScore'] == 100) {
+ } elseif ($TorrentGroups[$Group['ID']][$TorRemIdent]['FlacID'] == 0 && $Torrent['Format'] == 'FLAC' && ($Torrent['LogScore'] == 100 || $Torrent['Media'] != 'CD')) {
$TorrentGroups[$Group['ID']][$TorRemIdent]['FlacID'] = $Torrent['ID'];
$TorrentGroups[$Group['ID']][$TorRemIdent]['IsSnatched'] = $Torrent['IsSnatched'];
}
diff --git a/sections/better/upload.php b/sections/better/upload.php
index 8b78382e..944d9583 100644
--- a/sections/better/upload.php
+++ b/sections/better/upload.php
@@ -1,7 +1,5 @@
-// Get list of FLAC uploads
-
-if(!empty($_GET['userid']) && is_number($_GET['userid'])) {
+if (!empty($_GET['userid']) && is_number($_GET['userid'])) {
if (check_perms('users_override_paranoia')) {
$UserID = $_GET['userid'];
} else {
@@ -11,43 +9,123 @@
$UserID = $LoggedUser['ID'];
}
+$Encodings = array('V0 (VBR)', 'V2 (VBR)', '320');
+$EncodingKeys = array_fill_keys($Encodings, true);
+
+// Get list of FLAC uploads
$DB->query("SELECT t.GroupID, t.ID
FROM torrents AS t
WHERE
t.Format='FLAC'
AND ((t.LogScore = '100' AND t.Media = 'CD')
- OR t.Media = 'Vinyl')
+ OR t.Media != 'CD')
AND t.UserID='$UserID'");
+$UploadedTorrentIDs = array_fill_keys($DB->collect('ID'), true);
$UploadedGroupIDs = $DB->collect('GroupID');
-$Uploads = $DB->to_array('GroupID');
-if(count($UploadedGroupIDs) == 0) { error('You haven\'t uploaded any 100% flacs!'); }
+if (count($UploadedGroupIDs) == 0) {
+ error("You haven't uploaded any perfect FLACs!");
+}
+
// Create hash table
-
$DB->query("CREATE TEMPORARY TABLE temp_sections_better_upload
SELECT t.GroupID,
- GROUP_CONCAT(t.Encoding SEPARATOR ' ') AS EncodingList
+ GROUP_CONCAT(t.Encoding SEPARATOR ' ') AS EncodingList,
+ CRC32(CONCAT_WS(' ', Media, Remasteryear, Remastertitle,
+ Remasterrecordlabel, Remastercataloguenumber)) AS RemIdent
FROM torrents AS t
WHERE t.GroupID IN(".implode(',',$UploadedGroupIDs).")
- GROUP BY t.GroupID");
-
-//$DB->query('SELECT * FROM t');
+ GROUP BY t.GroupID, RemIdent");
$DB->query("SELECT GroupID FROM temp_sections_better_upload
WHERE EncodingList NOT LIKE '%V0 (VBR)%'
OR EncodingList NOT LIKE '%V2 (VBR)%'
OR EncodingList NOT LIKE '%320%'");
-$GroupIDs = $DB->collect('GroupID');
+$GroupIDs = array_fill_keys($DB->collect('GroupID'), true);
-if(count($GroupIDs) == 0) { error('No results found'); }
+if (count($GroupIDs) == 0) {
+ error('No results found.');
+}
-$Results = Torrents::get_groups($GroupIDs);
+$Groups = Torrents::get_groups(array_keys($GroupIDs));
+$Groups = $Groups['matches'];
+
+$TorrentGroups = array();
+foreach ($Groups as $GroupID => $Group) {
+ if (empty($Group['Torrents'])) {
+ unset($Groups[$GroupID]);
+ continue;
+ }
+ foreach ($Group['Torrents'] as $Torrent) {
+ $TorRemIdent = "$Torrent[Media] $Torrent[RemasterYear] $Torrent[RemasterTitle] $Torrent[RemasterRecordLabel] $Torrent[RemasterCatalogueNumber]";
+ if (!isset($TorrentGroups[$Group['ID']])) {
+ $TorrentGroups[$Group['ID']] = array(
+ $TorRemIdent => array(
+ 'FlacID' => 0,
+ 'Formats' => array(),
+ 'IsSnatched' => $Torrent['IsSnatched'],
+ 'Medium' => $Torrent['Media'],
+ 'RemasterTitle' => $Torrent['RemasterTitle'],
+ 'RemasterYear' => $Torrent['RemasterYear'],
+ 'RemasterRecordLabel' => $Torrent['RemasterRecordLabel'],
+ 'RemasterCatalogueNumber' => $Torrent['RemasterCatalogueNumber']
+ )
+ );
+ } elseif (!isset($TorrentGroups[$Group['ID']][$TorRemIdent])) {
+ $TorrentGroups[$Group['ID']][$TorRemIdent] = array(
+ 'FlacID' => 0,
+ 'Formats' => array(),
+ 'IsSnatched' => $Torrent['IsSnatched'],
+ 'Medium' => $Torrent['Media'],
+ 'RemasterTitle' => $Torrent['RemasterTitle'],
+ 'RemasterYear' => $Torrent['RemasterYear'],
+ 'RemasterRecordLabel' => $Torrent['RemasterRecordLabel'],
+ 'RemasterCatalogueNumber' => $Torrent['RemasterCatalogueNumber']
+ );
+ }
+ if (isset($EncodingKeys[$Torrent['Encoding']])) {
+ $TorrentGroups[$Group['ID']][$TorRemIdent]['Formats'][$Torrent['Encoding']] = true;
+ $Counter['existing'][$Torrent['Encoding']] += 1;
+ } elseif (isset($UploadedTorrentIDs[$Torrent['ID']])) {
+ $TorrentGroups[$Group['ID']][$TorRemIdent]['FlacID'] = $Torrent['ID'];
+ }
+ }
+}
+// count how many FLAC torrents we have in this list totally (key 'total')
+// how many transcodes there are missing totally (key 'miss_total')
+// and for each format (keys , 'miss_V0 (VBR)', 'miss_V2 (VBR)', 'miss_320')
+// the latter happens by counting the number of existing transcodes and then subtracting because that's easier
+$Counter = array();
+$Counter['total'] = 0;
+foreach($TorrentGroups as $Editions) {
+ foreach($Editions as $Edition) {
+ if($Edition['FlacID'] == 0) { continue; } // no FLAC in this edition
+ $edition_miss = 0; //number of transcodes missing in this edition
+ foreach($Encodings as $Encoding) {
+ if(!isset($Edition['Formats'][$Encoding])) {
+ ++$edition_miss;
+ ++$Counter['miss_'.$Encoding];
+ }
+ }
+ $Counter['miss_total'] += $edition_miss;
+ $Counter['total'] += (bool)$edition_miss;
+ }
+}
View::show_header('Transcode Uploads');
?>
+
Stats
+
+
+ Number of perfect FLACs you can transcode: =$Counter['total']?>
+ Number of missing transcodes: =$Counter['miss_total']?>
+ Number of missing V2 / V0 / 320 transcodes: =$Counter['miss_V2 (VBR)']?> / =$Counter['miss_V0 (VBR)']?> / =$Counter['miss_320']?>
+
+
+
List
Torrent |
@@ -56,64 +134,80 @@
320 |
-$Results = $Results['matches'];
-foreach ($Results as $GroupID=>$Group) {
- list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TorrentTags, $ReleaseType, $GroupVanityHouse, $Torrents, $Artists, $ExtendedArtists, $GroupFlags) = array_values($Group);
+foreach ($TorrentGroups as $GroupID => $Editions) {
+ $GroupInfo = $Groups[$GroupID];
+ $GroupYear = $GroupInfo['Year'];
+ $ExtendedArtists = $GroupInfo['ExtendedArtists'];
+ $GroupCatalogueNumber = $GroupInfo['CatalogueNumber'];
+ $GroupName = $GroupInfo['Name'];
+ $GroupRecordLabel = $GroupInfo['RecordLabel'];
+ $ReleaseType = $GroupInfo['ReleaseType'];
+
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
unset($ExtendedArtists[2]);
unset($ExtendedArtists[3]);
- $DisplayName = Artists::display_artists($ExtendedArtists);
+ $ArtistNames = Artists::display_artists($ExtendedArtists);
} else {
- $DisplayName = '';
- }
- $FlacID = $Uploads[$GroupID]['ID'];
-
- $DisplayName = '';
- if(count($Artists)>0) {
- $DisplayName = Artists::display_artists(array('1'=>$Artists));
- }
- $DisplayName.=''.$GroupName.'';
- if($GroupYear>0) { $DisplayName.=" [".$GroupYear."]"; }
- if($ReleaseType>0) { $DisplayName.=" [".$ReleaseTypes[$ReleaseType]."]"; }
-
- $ExtraInfo = Torrents::torrent_info($Torrents[$FlacID]);
- if($ExtraInfo) {
- $DisplayName.=' - '.$ExtraInfo;
+ $ArtistNames = '';
}
- $MissingEncodings = array('V0 (VBR)'=>1, 'V2 (VBR)'=>1, '320'=>1);
-
- foreach($Torrents as $Torrent) {
- if(!empty($MissingEncodings[$Torrent['Encoding']])) {
- $MissingEncodings[$Torrent['Encoding']] = 0;
+ $TagList = array();
+ $TagList = explode(' ', str_replace('_', '.', $GroupInfo['TagList']));
+ $TorrentTags = array();
+ foreach ($TagList as $Tag) {
+ $TorrentTags[] = ''.$Tag.'';
+ }
+ $TorrentTags = implode(', ', $TorrentTags);
+ foreach ($Editions as $RemIdent => $Edition) {
+ if (!$Edition['FlacID'] || count($Edition['Formats']) == 3) {
+ continue;
}
- }
-
- $TagList=array();
- if($TorrentTags!='') {
- $TorrentTags=explode(' ',$TorrentTags);
- foreach ($TorrentTags as $TagKey => $TagName) {
- $TagName = str_replace('_','.',$TagName);
- $TagList[]=''.$TagName.'';
+ $DisplayName = $ArtistNames . ''.$GroupName.'';
+ if($GroupYear > 0) {
+ $DisplayName .= " [".$GroupYear."]";
}
- $PrimaryTag = $TorrentTags[0];
- $TagList = implode(', ', $TagList);
- $TorrentTags='
'.$TagList.'
';
- }
+ if ($ReleaseType > 0) {
+ $DisplayName .= " [".$ReleaseTypes[$ReleaseType]."]";
+ }
+ $DisplayName .= ' ['.$Edition['Medium'].']';
+
+ $EditionInfo = array();
+ if (!empty($Edition['RemasterYear'])) {
+ $ExtraInfo = $Edition['RemasterYear'];
+ } else {
+ $ExtraInfo = '';
+ }
+ if (!empty($Edition['RemasterRecordLabel'])) {
+ $EditionInfo[] = $Edition['RemasterRecordLabel'];
+ }
+ if (!empty($Edition['RemasterTitle'])) {
+ $EditionInfo[] = $Edition['RemasterTitle'];
+ }
+ if (!empty($Edition['RemasterCatalogueNumber'])) {
+ $EditionInfo[] = $Edition['RemasterCatalogueNumber'];
+ }
+ if (!empty($Edition['RemasterYear'])) {
+ $ExtraInfo .= ' - ';
+ }
+ $ExtraInfo .= implode(' / ', $EditionInfo);
?>
- >
+
- DL
+ DL
=$DisplayName?>
- =$TorrentTags?>
+ =$ExtraInfo?>
+ =$TorrentTags?>
|
- =($MissingEncodings['V2 (VBR)'] == 0) ? 'YES' : 'NO'?> |
- =($MissingEncodings['V0 (VBR)'] == 0) ? 'YES' : 'NO'?> |
- =($MissingEncodings['320'] == 0) ? 'YES' : 'NO'?> |
+ =isset($Edition['Formats']['V2 (VBR)'])?'YES':'NO'?> |
+ =isset($Edition['Formats']['V0 (VBR)'])?'YES':'NO'?> |
+ =isset($Edition['Formats']['320'])?'YES':'NO'?> |
- } ?>
+
+ }
+}
+?>
diff --git a/sections/upload/upload_handle.php b/sections/upload/upload_handle.php
index 3ad1e8ec..3356c4a5 100644
--- a/sections/upload/upload_handle.php
+++ b/sections/upload/upload_handle.php
@@ -396,8 +396,9 @@
if(count($TooLongPaths)!=0) {
$Names = '';
- foreach($TooLongPaths as $Name) {$Names .= '
'.$Name;}
- /* $Err = 'The torrent contained one or more files with too long a name ('.$Name.')'; */
+ foreach($TooLongPaths as $Name) {
+ $Names .= '
'.$Name;
+ }
$Err = 'The torrent contained one or more files with too long a name:'.$Names;
}
@@ -411,10 +412,9 @@
// The string that will make up the final torrent file
$TorrentText = $Tor->enc();
-
+$Debug->set_flag('upload: torrent decoded');
// Infohash
-
$InfoHash = pack("H*", sha1($Tor->Val['info']->enc()));
$DB->query("SELECT ID FROM torrents WHERE info_hash='".db_string($InfoHash)."'");
if($DB->record_count()>0) {
@@ -650,10 +650,8 @@
$Cache->increment('stats_torrent_count');
$TorrentID = $DB->inserted_id();
-
Tracker::update_tracker('add_torrent', array('id' => $TorrentID, 'info_hash' => rawurlencode($InfoHash), 'freetorrent' => $T['FreeLeech']));
-
-
+$Debug->set_flag('upload: ocelot updated');
//******************************************************************************//
//--------------- Write torrent file -------------------------------------------//
@@ -743,7 +741,7 @@
send_irc('PRIVMSG #'.NONSSL_SITE_URL.'-announce :'.html_entity_decode($Announce));
send_irc('PRIVMSG #'.NONSSL_SITE_URL.'-announce-ssl :'.$AnnounceSSL);
//send_irc('PRIVMSG #'.NONSSL_SITE_URL.'-announce :'.html_entity_decode($Announce));
-
+$Debug->set_flag('upload: announced on irc');
// Manage notifications
$UsedFormatBitrates = array();
@@ -890,7 +888,7 @@
$SQL.=" AND UserID != '".$LoggedUser['ID']."' ";
$DB->query($SQL);
-
+$Debug->set_flag('upload: notification query finished');
if($DB->record_count()>0){
$UserArray = $DB->to_array('UserID');
@@ -906,7 +904,7 @@
}
$InsertSQL.=implode(',', $Rows);
$DB->query($InsertSQL);
-
+ $Debug->set_flag('upload: notification inserts finished');
foreach ($FilterArray as $Filter) {
list($FilterID, $UserID, $Passkey) = $Filter;
@@ -924,7 +922,7 @@
}
$Feed->populate('torrents_all',$Item);
-
+$Debug->set_flag('upload: notifications handled');
if($Type == 'Music'){
$Feed->populate('torrents_music',$Item);
if($Properties['Media'] == 'Vinyl') { $Feed->populate('torrents_vinyl',$Item); }