Empty commit

This commit is contained in:
Git 2013-02-25 21:16:55 +00:00
parent eccff40de5
commit a17170b8c9
69 changed files with 1124 additions and 1054 deletions

View File

@ -299,14 +299,13 @@ public function file_list() {
$InfoDict =& $this->Dec['info'];
if (!isset($InfoDict['files'])) {
// Single-file torrent
$this->Files = array(
$this->Size = (Int64::is_int($InfoDict['length'])
? Int64::get($InfoDict['length'])
: $InfoDict['length']),
$this->Files = (isset($InfoDict['name.utf-8'])
? $InfoDict['name.utf-8']
: $InfoDict['name'])
);
$this->Size = (Int64::is_int($InfoDict['length'])
? Int64::get($InfoDict['length'])
: $InfoDict['length']);
$Name = (isset($InfoDict['name.utf-8'])
? $InfoDict['name.utf-8']
: $InfoDict['name']);
$this->Files[] = array($this->Size, $Name);
} else {
if (isset($InfoDict['path.utf-8']['files'][0])) {
$this->PathKey = 'path.utf-8';
@ -322,10 +321,10 @@ public function file_list() {
$this->Files[] = array($CurSize, implode('/', $TmpPath));
$this->Size += $CurSize;
}
uasort($this->Files, function($a, $b) {
return strnatcasecmp($a[1], $b[1]);
});
}
uasort($this->Files, function($a, $b) {
return strnatcasecmp($a[1], $b[1]);
});
return array($this->Size, $this->Files);
}

View File

@ -33,7 +33,7 @@ class CACHE extends Memcache
/**
* Torrent Group cache version
*/
const GROUP_VERSION = 4;
const GROUP_VERSION = 5;
public $CacheHits = array();
public $MemcacheDBArray = array();

View File

@ -1,77 +1,66 @@
<?php
$ComicsExtensions = array_fill_keys(array('cbr', 'cbz', 'gif', 'jpeg', 'jpg', 'pdf', 'png'), true);
$MusicExtensions = array_fill_keys(
array(
'ac3', 'accurip', 'azw3', 'chm', 'cue', 'djv', 'djvu', 'doc', 'dts', 'epub', 'ffp',
'flac', 'gif', 'htm', 'html', 'jpeg', 'jpg', 'lit', 'log', 'm3u', 'm3u8', 'm4a', 'm4b',
'md5', 'mobi', 'mp3', 'mp4', 'nfo', 'pdf', 'pls', 'png', 'rtf', 'sfv', 'txt'),
true);
$Keywords = array(
'ahashare.com', 'demonoid.com', 'demonoid.me', 'djtunes.com', 'h33t', 'housexclusive.net',
'limetorrents.com', 'mixesdb.com', 'mixfiend.blogstop', 'mixtapetorrent.blogspot',
'plixid.com', 'reggaeme.com' , 'scc.nfo', 'thepiratebay.org', 'torrentday');
$music_extensions = array("mp3","flac","mp4","m4a","m3u","m4b","pls","m3u8","log","txt",
"cue","jpg","jpeg","png","gif","dts","ac3","nfo",
"sfv","md5","accurip","ffp","pdf", "mobi", "epub", "htm", "html", "lit",
"chm", "rtf", "doc", "djv", "djvu", "azw3");
$comics_extensions = array("cbr", "cbz", "pdf", "jpg","jpeg","png","gif");
$keywords = array("scc.nfo", "torrentday", "demonoid.com", "demonoid.me", "djtunes.com", "mixesdb.com",
"housexclusive.net", "plixid.com", "h33t", "reggaeme.com" ,"ThePirateBay.org",
"Limetorrents.com", "AhaShare.com", "MixFiend.blogstop", "MixtapeTorrent.blogspot");
function check_file($Type, $Name) {
check_name(strtolower($Name));
check_extensions($Type, strtolower($Name));
check_name($Name);
check_extensions($Type, $Name);
}
function check_name($Name) {
global $keywords;
foreach ($keywords as &$value) {
if(preg_match('/'.$value.'/i', $Name)) {
global $Keywords;
$NameLC = strtolower($Name);
foreach ($Keywords as &$Value) {
if (strpos($NameLC, $Value) !== false) {
forbidden_error($Name);
}
}
}
if(preg_match('/INCOMPLETE~\*/i', $Name)) {
if (preg_match('/INCOMPLETE~\*/i', $Name)) {
forbidden_error($Name);
}
if(preg_match('/\?/i', $Name)) {
character_error();
}
if(preg_match('/\:/i', $Name)) {
character_error();
if (preg_match('/[:?]/', $Name, $Matches)) {
character_error($Matches[0]);
}
}
function check_extensions($Type, $Name) {
global $music_extensions, $comics_extensions;
if($Type == 'Music' || $Type == 'Audiobooks' || $Type == 'Comedy' || $Type == 'E-Books') {
if(!in_array(get_file_extension($Name), $music_extensions)) {
global $MusicExtensions, $ComicsExtensions;
if ($Type == 'Music' || $Type == 'Audiobooks' || $Type == 'Comedy' || $Type == 'E-Books') {
if (!isset($MusicExtensions[get_file_extension($Name)])) {
invalid_error($Name);
}
}
if($Type == 'Comics') {
if(!in_array(get_file_extension($Name), $comics_extensions)) {
}
}
elseif ($Type == 'Comics') {
if (!isset($ComicsExtensions[get_file_extension($Name)])) {
invalid_error($Name);
}
}
}
}
}
function get_file_extension($file_name) {
return substr(strrchr($file_name,'.'),1);
function get_file_extension($FileName) {
return strtolower(substr(strrchr($FileName, '.'), 1));
}
function invalid_error($Name) {
global $Err;
$Err = 'The torrent contained one or more invalid files ('.display_str($Name).')';
$Err = 'The torrent contained one or more invalid files (' . display_str($Name) . ')';
}
function forbidden_error($Name) {
global $Err;
$Err = 'The torrent contained one or more forbidden files ('.display_str($Name).')';
$Err = 'The torrent contained one or more forbidden files (' . display_str($Name) . ')';
}
function character_error() {
global $Err;
$Err = 'The torrent contains one or more files with a ?, which is a forbidden character. Please rename the files as necessary and recreate the torrent';
function character_error($Character) {
global $Err;
$Err = "One or more of the files in the torrent has a name that contains the forbidden character '$Character'. Please rename the files as necessary and recreate the torrent.";
}
?>

View File

@ -528,4 +528,17 @@ public static function torrent_label ($text, $class='')
return sprintf('<strong class="torrent_label %1$s" title="%2$s">%2$s</strong>',
display_str($class), display_str($text));
}
}
/**
* Formats a CSS class name from a Category ID
* @global array $Categories
* @param int|string $CategoryID This number will be subtracted by one
* @return string
*/
public static function css_category ($CategoryID = 1)
{
global $Categories;
return 'cats_' . strtolower(str_replace(array('-', ' '), '',
$Categories[$CategoryID - 1]));
}
}

View File

@ -1,100 +1,244 @@
<?
<?php
/**
* This class determines the thumbnail equivalent of an image's url after being passed the original
* ImageTools Class
* Thumbnail aide, mostly
*/
class ImageTools {
/**
* Store processed links to avoid repetition
* @var array 'URL' => 'Parsed URL'
*/
static private $Storage = array();
/**
* We use true as an extra property to make the domain an array key
* @var array $Hosts Array of image hosts
*/
static private $Hosts = array(
'whatimg.com' => true,
'imgur.com' => true
);
/**
* Blacklisted sites
* @var array $Blacklist Array of blacklisted hosts
*/
static private $Blacklist = array(
'tinypic.com'
);
/**
* Array of image hosts that provide thumbnailing
* @var array $Thumbs
*/
static private $Thumbs = array(
'i.imgur.com' => true,
'whatimg.com' => true
);
/**
* Array of extensions
* @var array $Extensions
*/
static private $Extensions = array(
'jpg' => true,
'jpeg' => true,
'png' => true,
'gif' => true
);
/**
* Checks from our list of valid hosts
* @param string $Host Domain/host to check
* @return boolean
*/
public static function valid_host($Host) {
return !empty(self::$Hosts[$Host]) && self::$Hosts[$Host] === true;
}
/**
* Checks if a link's host is (not) good, otherwise displays an error.
* @param string $Url Link to an image
* @return boolean
*/
public static function blacklisted($Url) {
foreach (self::$Blacklist as &$Value) {
if (stripos($Url, $Value)) {
$ParsedUrl = parse_url($Url);
error($ParsedUrl['host'] . ' is not an allowed image host. Please use a different host.');
return true;
}
}
return false;
}
/**
* Checks to see if a link has a thumbnail
* @param string $Url Link to an image
* @return string|false Matched host or false
*/
public static function thumbnailable($Url) {
$ParsedUrl = parse_url($Url);
return !empty(self::$Thumbs[$ParsedUrl['host']]);
}
/**
* Checks an extension
* @param string $Ext Extension to check
* @return boolean
*/
public static function valid_extension($Ext) {
// return @self::$Extensions[$Ext] === true;
return !empty(self::$Extensions[$Ext]) && self::$Extensions[$Ext] === true;
}
/**
* Stores a link with a (thumbnail) link
* @param type $Link
* @param type $Processed
*/
public static function store($Link, $Processed) {
self::$Storage[$Link] = $Processed;
}
/**
* Retrieves an entry from our storage
* @param type $Link
* @return boolean|string Returns false if no match
*/
public static function get_stored($Link) {
if (isset(self::$Storage[$Link])) {
return self::$Storage[$Link];
}
return false;
}
/**
* Turns link into thumbnail (if posible) or default group image (if missing)
* Automatically applies proxy when appropriate
*
* @global array $CategoryIcons
* @param string $Link Link to an image
* @param int $Groupid The torrent's group ID for a default image
* @param boolean $Thumb Thumbnail image
* @return string Link to image
*/
public static function wiki_image($Link, $GroupID = 0, $Thumb = true) {
global $CategoryIcons;
if ($Link && $Thumb) {
$Thumb = self::thumbnail($Link);
if (check_perms('site_proxy_images')) {
return self::proxy_url($Thumb);
}
return $Thumb;
}
return STATIC_SERVER . 'common/noartwork/' . $CategoryIcons[$GroupID];
}
/**
* The main function called to get a thumbnail link.
* Use wiki_image() instead of this method for more advanced options
*
* @param string $Link Image link
* @return string Image link
*/
public static function thumbnail($Link) {
if (($Found = self::get_stored($Link))) {
return $Found;
}
return self::process_thumbnail($Link);
}
/**
* Matches a hosts that thumbnails and stores link
* @param string $Link Image link
* @return string Thumbnail link or Image link
*/
static private function process_thumbnail($Link) {
$Thumb = $Link;
$Extension = pathinfo($Link, PATHINFO_EXTENSION);
if (self::thumbnailable($Link) && self::valid_extension($Extension)) {
if (contains('whatimg', $Link) && !has_whatimg_thumb($Link)) {
$Thumb = replace_extension($Link, '_thumb.' . $Extension);
} elseif (contains('imgur', $Link)) {
$Thumb = replace_extension(clean_imgur_url($Link), 'm.' . $Extension);
}
}
self::store($Link, $Thumb);
return $Thumb;
}
/**
* Creates an HTML thumbnail
* @param type $Source
* @param type $Category
* @param type $Size
*/
public static function cover_thumb($Source, $Category = 0, $Size = 90, $Title = 'Cover') {
$Img = self::wiki_image($Source, $Category);
if (!$Source) {
$Source = $Img;
} elseif (check_perms('site_proxy_images')) {
$Source = self::proxy_url($Source);
}
?>
<img src="<?=$Img?>" width="<?=$Size?>" height="<?=$Size?>" alt="<?=$Title?>" onclick="lightbox.init('<?=$Source?>', <?=$Size?>)" />
<?
}
/**
* Create image proxy URL
* @param string $Url Image url
* @return image peoxy URL
*/
public static function proxy_url($Url) {
global $SSL;
return ($SSL ? 'https' : 'http') . '://' . SITE_URL
. '/image.php?i=' . urlencode($Url);
}
}
/**
* This non-class determines the thumbnail equivalent of an image's url after being passed the original
*
**/
$blacklist = array("tinypic", "dsimg");
/**
* Checks if image host is good, otherwise displays an error.
*/
function check_imagehost($url) {
global $blacklist;
foreach ($blacklist as &$value) {
if(strpos(strtolower($url), $value)) {
$parsed_url = parse_url($url);
error($parsed_url['host'] . " is not an allowed imagehost. Please use a different imagehost.");
break;
}
}
}
/**
* The main function, called to get the thumbnail url.
*/
function to_thumbnail($url) {
$thumb = $url;
$extension = pathinfo($url, PATHINFO_EXTENSION);
if (contains('whatimg', $url)) {
if (hasWhatImgThumb($url)) {
if ($extension == 'jpeg') {
$thumb = replace_extension($url, '_thumb.jpeg');
}
if ($extension == 'jpg') {
$thumb = replace_extension($url, '_thumb.jpg');
}
if ($extension == 'png') {
$thumb = replace_extension($url, '_thumb.png');
}
if ($extension == 'gif') {
$thumb = replace_extension($url, '_thumb.gif');
}
}
} elseif (contains('imgur', $url)) {
$url = cleanImgurUrl($url);
if ($extension == 'jpeg') {
$thumb = replace_extension($url, 'm.jpeg');
}
if ($extension == 'jpg') {
$thumb = replace_extension($url, 'm.jpg');
}
if ($extension == 'png') {
$thumb = replace_extension($url, 'm.png');
}
if ($extension == 'gif') {
$thumb = replace_extension($url, 'm.gif');
}
}
return $thumb;
}
/**
* Replaces the extension.
*/
function replace_extension($string, $extension) {
$string = preg_replace('/\.[^.]*$/', '', $string);
$string = $string . $extension;
return $string;
function replace_extension($String, $Extension) {
return preg_replace('/\.[^.]*$/', $Extension, $String);
}
function contains($substring, $string) {
return $pos = strpos($string, $substring);
function contains($Substring, $String) {
return strpos($String, $Substring) !== false;
}
/**
* Checks if url points to a whatimg thumbnail.
*/
function hasWhatImgThumb($url) {
return !contains("_thumb", $url);
function has_whatimg_thumb($Url){
return contains("_thumb", $Url);
}
/**
* Cleans up imgur url if it already has a modifier attached to the end of it.
*/
function cleanImgurUrl($url) {
$extension = pathinfo($url, PATHINFO_EXTENSION);
$full = preg_replace('/\.[^.]*$/', '', $url);
$base = substr($full, 0, strrpos($full, '/'));
$path = substr($full, strrpos($full, '/') + 1);
if (strlen($path) == 6) {
$last = $path[strlen($path) - 1];
if ($last == 'm' || $last == 'l' || $last == 's' || $last == 'h' || $last == 'b') {
$path = substr($path, 0, -1);
function clean_imgur_url($Url){
$Extension = pathinfo($Url, PATHINFO_EXTENSION);
$Full = preg_replace('/\.[^.]*$/', '', $Url);
$Base = substr($Full, 0, strrpos($Full, '/'));
$Path = substr($Full, strrpos($Full, '/') + 1);
if (strlen($Path) == 6) {
$Last = $Path[strlen($Path) - 1];
if ($Last == 'm' || $Last == 'l' || $Last == 's' || $Last == 'h' || $Last == 'b') {
$Path = substr($Path, 0, -1);
}
}
return $base . "/" . $path . "." . $extension;
return $Base . "/" . $Path . "." . $Extension;
}
?>

View File

@ -17,7 +17,7 @@ public function __construct ($Table = 'bookmarks_torrents')
}
/**
* Runs a SQL query and clears the bookmarks_torrent_{$UserID}_full Cache key
* Runs a SQL query and clears the Cache key
*
* $Cache->delete_value didn't always work, but setting the key to null, did. (?)
*
@ -25,10 +25,8 @@ public function __construct ($Table = 'bookmarks_torrents')
*/
protected function query_and_clear_cache ($sql)
{
if (is_string($sql) && $this->DB->query($sql)) {
$this->Cache->cache_value('bookmarks_torrent_' . $this->UserID, null, 0);
$this->Cache->cache_value('bookmarks_torrent_' . $this->UserID . '_full', null, 0);
}
if (is_string($sql) && $this->DB->query($sql))
$this->Cache->delete_value('bookmarks_group_ids_' . $this->UserID);
}
/**

145
classes/class_tags.php Normal file
View File

@ -0,0 +1,145 @@
<?php
/**
* Tags Class
*
* Formatting and sorting methods for tags and tag lists
*
* Example:
* <pre>&lt;?php
* $Tags = new Tags('pop rock hip.hop');
* $Tags->Format(); // returns a tag link list
*
* $Tags2 = new Tags('pop rock indie');
*
* // returns a tag link list of tags ordered by amount
* Tags::format_top();
* ?></pre>
* eg:
* pop (2)
* rock (2)
* hip.hop (1)
* indie (1)
*
* Each time a new Tags object is instantiated, the tag list is merged with the
* overall total amount of tags to provide the top tags. Merging is optional.
*/
class Tags
{
/**
* Collects all tags processed by the Tags Class
* @static
* @var array $All Class Tags
*/
private static $All = array();
/**
* All tags in the current instance
* @var array $Tags Instance Tags
*/
private $Tags = null;
/**
* @var array $TagLink Tag link list
*/
private $TagLink = array();
/**
* @var string $Primary The primary tag
*/
private $Primary = '';
/**
* Filter tags array to remove empty spaces.
*
* @param string $TagList A string of tags separated by a space
* @param boolean $Merge Merge the tag list with the Class' tags
* Eg, compilations and soundtracks are skipped, so false
*/
public function __construct($TagList, $Merge = true) {
$this->Tags = array_filter(explode(' ', str_replace('_', '.', $TagList)));
if ($Merge) {
self::$All = array_merge(self::$All, $this->Tags);
}
$this->Primary = $this->Tags[0];
}
/**
* @return string Primary Tag
*/
public function get_primary() {
return $this->Primary;
}
/**
* Set the primary tag
* @param string $Primary
*/
public function set_primary($Primary) {
$this->Primary = (string) $Primary;
}
/**
* Formats primary tag as a title
* @return string Title
*/
public function title() {
return ucwords(str_replace('.', ' ', $this->Primary));
}
/**
* Formats primary tag as a CSS class
* @return string CSS Class Name
*/
public function css_name() {
return 'tags_' . str_replace('.', '_', $this->Primary);
}
/**
* @return array Tags
*/
public function get_tags() {
return $this->Tags;
}
/**
* @return array All tags
*/
public static function all() {
return self::$All;
}
/**
* Counts and sorts All tags
* @return array All tags sorted
*/
public static function sorted() {
$Sorted = array_count_values(self::$All);
arsort($Sorted);
return $Sorted;
}
/**
* Formats tags
* @param string $Link Link to a taglist page
* @return string List of tag links
*/
public function format($Link = 'torrents.php?taglist=') {
foreach ($this->Tags as $Tag) {
$this->TagLink[] = '<a href="' . $Link . $Tag . '">' . $Tag . '</a>';
}
return implode(', ', $this->TagLink);
}
/**
* Format a list of top tags
* @param int $Max Max number of items to get
*/
public static function format_top($Max = 5, $Link = 'torrents.php?taglist=') {
foreach (array_slice(self::sorted(), 0, $Max) as $TagName => $Total) { ?>
<li><a href="<?=$Link . display_str($TagName)?>"><?=display_str($TagName)?></a> (<?=$Total?>)</li>
<? }
}
}

View File

@ -14,6 +14,7 @@ class Torrents {
*
* @return array each row of the following format:
* GroupID => (
* ID
* Name
* Year
* RecordLabel
@ -21,6 +22,8 @@ class Torrents {
* TagList
* ReleaseType
* VanityHouse
* WikiImage
* CategoryID
* Torrents => {
* ID => {
* GroupID, Media, Format, Encoding, RemasterYear, Remastered,
@ -70,11 +73,12 @@ public static function get_groups($GroupIDs, $Return = true, $GetArtists = true,
Do not change what is returned or the order thereof without updating:
torrents, artists, collages, bookmarks, better, the front page,
and anywhere else the get_groups function is used.
Update self::array_group(), too
*/
if (count($NotFound) > 0) {
$DB->query("SELECT
g.ID, g.Name, g.Year, g.RecordLabel, g.CatalogueNumber, g.TagList, g.ReleaseType, g.VanityHouse
g.ID, g.Name, g.Year, g.RecordLabel, g.CatalogueNumber, g.TagList, g.ReleaseType, g.VanityHouse, g.WikiImage, g.CategoryID
FROM torrents_group AS g WHERE g.ID IN ($IDs)");
while($Group = $DB->next_record(MYSQLI_ASSOC, true)) {
@ -105,16 +109,16 @@ public static function get_groups($GroupIDs, $Return = true, $GetArtists = true,
}
// Cache it all
foreach ($Found as $GroupID=>$GroupInfo) {
foreach ($Found as $GroupID => $GroupInfo) {
$Cache->cache_value('torrent_group_'.$GroupID,
array('ver'=>4, 'd'=>$GroupInfo), 0);
array('ver' => CACHE::GROUP_VERSION, 'd' => $GroupInfo), 0);
$Cache->cache_value('torrent_group_light_'.$GroupID,
array('ver'=>4, 'd'=>$GroupInfo), 0);
array('ver' => CACHE::GROUP_VERSION, 'd' => $GroupInfo), 0);
}
} else {
foreach ($Found as $Group) {
$Cache->cache_value('torrent_group_light_'.$Group['ID'], array('ver'=>4, 'd'=>$Found[$Group['ID']]), 0);
$Cache->cache_value('torrent_group_light_'.$Group['ID'], array('ver' => CACHE::GROUP_VERSION, 'd' => $Found[$Group['ID']]), 0);
}
}
}
@ -152,6 +156,35 @@ public static function get_groups($GroupIDs, $Return = true, $GetArtists = true,
}
}
/**
* Returns a reconfigured array from a Torrent Group
*
* Use this with extract() instead of the volatile list($GroupID, ...)
* Then use the variables $GroupID, $GroupName, etc
*
* @example extract(Torrents::array_group($SomeGroup));
* @param array $Group torrent group
* @return array Re-key'd array
*/
public static function array_group (array &$Group)
{
return array(
'GroupID' => $Group['ID'],
'GroupName' => $Group['Name'],
'GroupYear' => $Group['Year'],
'GroupCategoryID' => $Group['CategoryID'],
'GroupRecordLabel' => $Group['RecordLabel'],
'GroupCatalogueNumber' => $Group['CatalogueNumber'],
'GroupVanityHouse' => $Group['VanityHouse'],
'GroupFlags' => $Group['Flags'],
'TagList' => $Group['TagList'],
'ReleaseType' => $Group['ReleaseType'],
'WikiImage' => $Group['WikiImage'],
'Torrents' => $Group['Torrents'],
'Artists' => $Group['Artists'],
'ExtendedArtists' => $Group['ExtendedArtists']
);
}
/**
* Supplements a torrent array with information that only concerns certain users and therefore cannot be cached
@ -440,15 +473,18 @@ public static function regenerate_filelist($TorrentID) {
JOIN torrents_group AS tg ON tg.ID=t.GroupID
WHERE tf.TorrentID = ".$TorrentID);
if($DB->record_count() > 0) {
require(SERVER_ROOT.'/classes/class_torrent.php');
list($GroupID, $Contents) = $DB->next_record(MYSQLI_NUM, false);
$Contents = unserialize(base64_decode($Contents));
$Tor = new TORRENT($Contents, true);
if (Misc::is_new_torrent($Contents)) {
$Tor = new BEncTorrent($Contents);
$FilePath = isset($Tor->Dec['info']['files']) ? Format::make_utf8($Tor->get_name()) : "";
} else {
$Tor = new TORRENT(unserialize(base64_decode($Contents)), true);
$FilePath = isset($Tor->Val['info']->Val['files']) ? Format::make_utf8($Tor->get_name()) : "";
}
list($TotalSize, $FileList) = $Tor->file_list();
foreach($FileList as $File) {
$TmpFileList[] = self::filelist_format_file($File);
}
$FilePath = isset($Tor->Val['info']->Val['files']) ? Format::make_utf8($Tor->get_name()) : "";
$FileString = implode("\n", $TmpFileList);
$DB->query("UPDATE torrents SET Size = ".$TotalSize.", FilePath = '".db_string($FilePath)."', FileList = '".db_string($FileString)."' WHERE ID = ".$TorrentID);
$Cache->delete_value('torrents_details_'.$GroupID);
@ -631,7 +667,7 @@ public static function has_token($TorrentID) {
* Check if the logged in user can use a freeleech token on this torrent
*
* @param int $Torrent
* @return true if user is allowed to use a token
* @return boolen True if user is allowed to use a token
*/
public static function can_use_token($Torrent) {
global $LoggedUser;

View File

@ -4,6 +4,7 @@
*/
class TorrentsDL {
const ChunkSize = 100;
const MaxPathLength = 200;
private $QueryResult;
private $QueryRowNum = 0;
private $Zip;
@ -13,19 +14,24 @@ class TorrentsDL {
private $NumFound = 0;
private $Size = 0;
private $Title;
private $Username;
private $AnnounceURL;
/**
* Create a Zip object and store the query results
*
* @param mysqli_result $QueryResult results from a query on the collector pages
* @param string $Title name of the collection that will be created
* @param string $AnnounceURL URL to add to the created torrents
*/
public function __construct(&$QueryResult, $Title) {
global $Cache;
global $Cache, $LoggedUser;
$Cache->InternalCache = false; // The internal cache is almost completely useless for this
Zip::unlimit(); // Need more memory and longer timeout
$this->QueryResult = $QueryResult;
$this->Title = $Title;
$this->User = $LoggedUser;
$this->AnnounceURL = ANNOUNCE_URL . "/$LoggedUser[torrent_pass]/announce";
$this->Zip = new Zip(Misc::file_string($Title));
}
@ -69,42 +75,43 @@ public function get_downloads($Key) {
/**
* Add a file to the zip archive
*
* @param string $Content file content
* @param array $FileInfo file info stored as an array with at least the keys
* @param string $TorrentData bencoded torrent without announce url (new format) or TORRENT object (old format)
* @param array $Info file info stored as an array with at least the keys
* Artist, Name, Year, Media, Format, Encoding and TorrentID
* @param string $FolderName folder name
*/
public function add_file($Content, $FileInfo, $FolderName = '') {
$FileName = self::construct_file_name($FileInfo['Artist'], $FileInfo['Name'], $FileInfo['Year'], $FileInfo['Media'], $FileInfo['Format'], $FileInfo['Encoding'], $FileInfo['TorrentID']);
$this->Size += $FileInfo['Size'];
public function add_file(&$TorrentData, $Info, $FolderName = '') {
$FolderName = Misc::file_string($FolderName);
$MaxPathLength = $FolderName ? (self::MaxPathLength - strlen($FolderName) - 1) : self::MaxPathLength;
$FileName = self::construct_file_name($Info['Artist'], $Info['Name'], $Info['Year'], $Info['Media'], $Info['Format'], $Info['Encoding'], $Info['TorrentID'], false, $MaxPathLength);
$this->Size += $Info['Size'];
$this->NumAdded++;
$this->Zip->add_file($Content, ($FolderName ? "$FolderName/" : "") . $FileName);
$this->Zip->add_file(self::get_file($TorrentData, $this->AnnounceURL), ($FolderName ? "$FolderName/" : "") . $FileName);
usleep(25000); // We don't want to send much faster than the client can receive
}
/**
* Add a file to the list of files that could not be downloaded
*
* @param array $FileInfo file info stored as an array with at least the keys Artist, Name and Year
* @param array $Info file info stored as an array with at least the keys Artist, Name and Year
*/
public function fail_file($FileInfo) {
$this->FailedFiles[] = $FileInfo['Artist'] . $FileInfo['Name'] . " $FileInfo[Year]";
public function fail_file($Info) {
$this->FailedFiles[] = $Info['Artist'] . $Info['Name'] . " $Info[Year]";
}
/**
* Add a file to the list of files that did not match the user's format or quality requirements
*
* @param array $FileInfo file info stored as an array with at least the keys Artist, Name and Year
* @param array $Info file info stored as an array with at least the keys Artist, Name and Year
*/
public function skip_file($FileInfo) {
$this->SkippedFiles[] = $FileInfo['Artist'] . $FileInfo['Name'] . " $FileInfo[Year]";
public function skip_file($Info) {
$this->SkippedFiles[] = $Info['Artist'] . $Info['Name'] . " $Info[Year]";
}
/**
* Add a summary to the archive and include a list of files that could not be added. Close the zip archive
*
* @param int $Analyzed number of files that were analyzed (e.g. number of groups in a collage)
* @param int $Skips number of files that did not match any of the user's criteria
* @param bool $FilterStats whether to include filter stats in the report
*/
public function finalize($FilterStats = true) {
$this->Zip->add_file($this->summary($FilterStats), "Summary.txt");
@ -121,15 +128,15 @@ public function finalize($FilterStats = true) {
* @return summary text
*/
public function summary($FilterStats) {
global $LoggedUser, $ScriptStartTime;
global $ScriptStartTime;
$Time = number_format(1000 * (microtime(true) - $ScriptStartTime), 2)." ms";
$Used = Format::get_size(memory_get_usage(true));
$Date = date("M d Y, H:i");
$NumSkipped = count($this->SkippedFiles);
return "Collector Download Summary for $this->Title - ".SITE_NAME."\r\n"
return "Collector Download Summary for $this->Title - " . SITE_NAME . "\r\n"
. "\r\n"
. "User: $LoggedUser[Username]\r\n"
. "Passkey: $LoggedUser[torrent_pass]\r\n"
. "User: {$this->User[Username]}\r\n"
. "Passkey: {$this->User[torrent_pass]}\r\n"
. "\r\n"
. "Time: $Time\r\n"
. "Used: $Used\r\n"
@ -164,12 +171,17 @@ public function errors() {
/**
* Combine a bunch of torrent info into a standardized file name
*
* @params most input variables are mostly self-explanatory
* @params most input variables are self-explanatory
* @param int $TorrentID if given, append "-TorrentID" to torrent name
* @param bool $TxtExtension whether to use .txt or .torrent as file extension
* @return file name with at most 180 characters that is valid on most systems
* @param bool $Txt whether to use .txt or .torrent as file extension
* @param int $MaxLength maximum file name length
* @return file name with at most $MaxLength characters
*/
public static function construct_file_name($Artist, $Album, $Year, $Media, $Format, $Encoding, $TorrentID = false, $TxtExtension = false) {
public static function construct_file_name($Artist, $Album, $Year, $Media, $Format, $Encoding, $TorrentID = false, $Txt = false, $MaxLength = self::MaxPathLength) {
$MaxLength -= ($Txt ? 4 : 8);
if ($TorrentID !== false) {
$MaxLength -= (strlen($TorrentID) + 1);
}
$TorrentArtist = Misc::file_string($Artist);
$TorrentName = Misc::file_string($Album);
if ($Year > 0) {
@ -193,22 +205,35 @@ public static function construct_file_name($Artist, $Album, $Year, $Media, $Form
if (!$TorrentName) {
$TorrentName = "No Name";
} else if (strlen($Artist . $TorrentName . $TorrentInfo) <= 196) {
$TorrentName = $Artist . $TorrentName;
} else if (mb_strlen($TorrentArtist . $TorrentName . $TorrentInfo, 'UTF-8') <= $MaxLength) {
$TorrentName = $TorrentArtist . $TorrentName;
}
// Leave some room to the user in case the file system limits the path length
$MaxLength = $TxtExtension ? 196 : 192;
if ($TorrentID) {
$MaxLength -= 8;
}
$TorrentName = Format::cut_string($TorrentName . $TorrentInfo, $MaxLength, true, false);
if ($TorrentID) {
if ($TorrentID !== false) {
$TorrentName .= "-$TorrentID";
}
if ($TxtExtension) {
if ($Txt) {
return "$TorrentName.txt";
}
return "$TorrentName.torrent";
}
/**
* Convert a stored torrent into a binary file that can be loaded in a torrent client
*
* @param mixed $TorrentData bencoded torrent without announce url (new format) or TORRENT object (old format)
* @return bencoded string
*/
public static function get_file(&$TorrentData, $AnnounceURL) {
if (Misc::is_new_torrent($TorrentData)) {
return BEncTorrent::add_announce_url($TorrentData, $AnnounceURL);
}
$Tor = new TORRENT(unserialize(base64_decode($TorrentData)), true);
$Tor->set_announce_url($AnnounceURL);
unset($Tor->Val['announce-list']);
unset($Tor->Val['url-list']);
unset($Tor->Val['libtorrent_resume']);
return $Tor->enc();
}
}

View File

@ -505,48 +505,32 @@ public static function make_class_string($ClassID) {
}
/**
* Returns an array with User Bookmark data: group ids, collage data list, etc
* Returns an array with User Bookmark data: group ids, collage data, torrent data
* @global CACHE $Cache
* @global DB_MYSQL $DB
* @param string|int $UserID
* @return array
* @return array Group IDs, Bookmark Data, Torrent List
*/
function bookmark_data ($UserID)
public static function get_bookmarks ($UserID)
{
global $Cache, $DB;
$UserID = (int) $UserID;
$Data = $Cache->get_value('bookmarks_torrent_'.$UserID.'_full');
if($Data) {
$Data = unserialize($Data);
list($K, list($TorrentList, $CollageDataList)) = each($Data);
if (($Data = $Cache->get_value('bookmarks_group_ids_' . $UserID))) {
list($GroupIDs, $BookmarkData) = $Data;
} else {
// Build the data for the collage and the torrent list
$DB->query("SELECT
bt.GroupID,
bt.Sort,
tg.WikiImage,
tg.CategoryID,
bt.Time
FROM bookmarks_torrents AS bt
JOIN torrents_group AS tg ON tg.ID=bt.GroupID
WHERE bt.UserID='$UserID'
ORDER BY bt.Sort ASC");
$DB->query("SELECT GroupID, Sort, `Time` FROM bookmarks_torrents WHERE UserID=$UserID ORDER BY Sort, `Time` ASC");
$GroupIDs = $DB->collect('GroupID');
$CollageDataList = $DB->to_array('GroupID', MYSQLI_ASSOC);
if(count($GroupIDs) > 0) {
$TorrentList = Torrents::get_groups($GroupIDs);
$TorrentList = $TorrentList['matches'];
} else {
$TorrentList = array();
}
$BookmarkData = $DB->to_array('GroupID', MYSQLI_ASSOC);
$Cache->cache_value('bookmarks_group_ids_' . $UserID,
array($GroupIDs, $BookmarkData), 3600);
}
return array($K, $GroupIDs, $CollageDataList, $TorrentList);
$TorrentList = Torrents::get_groups($GroupIDs);
$TorrentList = isset($TorrentList['matches']) ? $TorrentList['matches'] : array();
return array($GroupIDs, $BookmarkData, $TorrentList);
}
/**

View File

@ -87,9 +87,15 @@
case 'Artists':
$FileName = 'class_artists';
break;
case 'BEncTorrent':
$FileName = 'class_bencode';
break;
case 'Format':
$FileName = 'class_format';
break;
case 'ImageTools':
$FileName = 'class_image_tools';
break;
case 'LastFM':
$FileName = 'class_lastfm';
break;
@ -116,12 +122,20 @@
case 'SphinxQL_Result':
$FileName = 'class_sphinxql';
break;
case 'Tags':
$FileName = 'class_tags';
break;
case 'TEXTAREA_PREVIEW':
$FileName = 'class_textarea_preview';
break;
case 'Tools':
$FileName = 'class_tools';
break;
case 'TORRENT':
case 'BENCODE_DICT':
case 'BENCODE_LIST':
$FileName = 'class_torrent';
break;
case 'Torrents':
$FileName = 'class_torrents';
break;

View File

@ -168,8 +168,9 @@ function compare($X, $Y){
$JsonTorrents = array();
$Tags = array();
foreach ($TorrentList as $GroupID=>$Group) {
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Torrents, $Artists, $ExtendedArtists) = array_values($Group);
foreach ($TorrentList as $GroupID => $Group) {
extract(Torrents::array_group($Group));
$GroupVanityHouse = $Importances[$GroupID]['VanityHouse'];
$TagList = explode(' ',str_replace('_','.',$TagList));
@ -219,8 +220,10 @@ function compare($X, $Y){
'groupYear' => (int) $GroupYear,
'groupRecordLabel' => $GroupRecordLabel,
'groupCatalogueNumber' => $GroupCatalogueNumber,
'groupCategoryID' => $GroupCategoryID,
'tags' => $TagList,
'releaseType' => (int) $ReleaseType,
'wikiImage' => $WikiImage,
'groupVanityHouse' => $GroupVanityHouse == 1,
'hasBookmarked' => $hasBookmarked = has_bookmarked('torrent', $GroupID),
'torrent' => $InnerTorrents

View File

@ -19,7 +19,7 @@
$JsonResults = array();
foreach ($Results as $GroupID=>$Group) {
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Torrents, $Artists) = array_values($Group);
extract(Torrents::array_group($Group));
$FlacID = $GroupIDs[$GroupID]['TorrentID'];
$JsonArtists = array();

View File

@ -1,4 +1,5 @@
<?
ini_set('memory_limit', -1);
//~~~~~~~~~~~ Main bookmarks page ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
@ -21,34 +22,9 @@ function compare($X, $Y){
$Sneaky = ($UserID != $LoggedUser['ID']);
$Data = $Cache->get_value('bookmarks_torrent_'.$UserID.'_full');
if($Data) {
$Data = unserialize($Data);
list($K, list($TorrentList, $CollageDataList)) = each($Data);
} else {
// Build the data for the collage and the torrent list
$DB->query("SELECT
bt.GroupID,
tg.WikiImage,
tg.CategoryID,
bt.Time
FROM bookmarks_torrents AS bt
JOIN torrents_group AS tg ON tg.ID=bt.GroupID
WHERE bt.UserID='$UserID'
ORDER BY bt.Time");
$GroupIDs = $DB->collect('GroupID');
$CollageDataList=$DB->to_array('GroupID', MYSQLI_ASSOC);
if(count($GroupIDs)>0) {
$TorrentList = Torrents::get_groups($GroupIDs);
$TorrentList = $TorrentList['matches'];
} else {
$TorrentList = array();
}
}
$JsonBookmarks = array();
list(, $CollageDataList, $TorrentList) = Users::get_bookmarks($UserID);
foreach ($TorrentList as $Torrent) {
$JsonTorrents = array();
foreach ($Torrent['Torrents'] as $GroupTorrents) {
@ -100,4 +76,3 @@ function compare($X, $Y){
)
)
);
?>

View File

@ -1,5 +1,4 @@
<?
require(SERVER_ROOT.'/classes/class_torrent.php');
$TorrentID = $_GET['torrentid'];
if (!is_number($TorrentID)) {
echo('Invalid TorrentID');
@ -12,11 +11,15 @@
die();
}
list($Contents) = $DB->next_record(MYSQLI_NUM, array(0));
$Contents = unserialize(base64_decode($Contents));
$Tor = new TORRENT($Contents, true); // New TORRENT object
$Private = $Tor->make_private();
if (Misc::is_new_torrent($Contents)) {
$Tor = new BEncTorrent($Contents);
$Private = $Tor->is_private();
} else {
$Tor = new TORRENT(unserialize(base64_decode($Contents)), true); // New TORRENT object
$Private = $Tor->make_private();
}
if ($Private) {
if ($Private === true) {
echo '<span style="color: #0c0; font-weight: bold;">Private</span>';
} else {
echo '<span style="color: #c00; font-weight: bold;">Public</span>';

View File

@ -32,10 +32,6 @@
$TorrentGroups = Torrents::get_groups($GroupIDs);
$TorrentGroups = $TorrentGroups['matches'];
// Need some extra info that Torrents::get_groups() doesn't return
$DB->query("SELECT ID, CategoryID FROM torrents_group WHERE ID IN (".implode(',', $GroupIDs).")");
$GroupCategoryIDs = $DB->to_array('ID', MYSQLI_ASSOC, false);
$DB->query("UPDATE users_notify_torrents SET UnRead='0' WHERE UserID=".$LoggedUser['ID']);
$Cache->delete_value('notifications_new_'.$LoggedUser['ID']);
}
@ -62,10 +58,10 @@
unset($FilterResults['FilterLabel']);
foreach($FilterResults as $Result) {
$TorrentID = $Result['TorrentID'];
$GroupID = $Result['GroupID'];
$GroupCategoryID = $GroupCategoryIDs[$GroupID]['CategoryID'];
// $GroupID = $Result['GroupID'];
$GroupInfo = $TorrentGroups[$Result['GroupID']];
extract(Torrents::array_group($GroupInfo)); // all group data
$TorrentInfo = $GroupInfo['Torrents'][$TorrentID];
if ($Result['UnRead'] == 1) $NumNew++;
@ -73,16 +69,17 @@
$JsonNotifications[] = array(
'torrentId' => (int) $TorrentID,
'groupId' => (int) $GroupID,
'groupName' => $GroupInfo['Name'],
'groupName' => $GroupName,
'groupCategoryId' => (int) $GroupCategoryID,
'torrentTags' => $GroupInfo['TagList'],
'wikiImage' => $WikiImage,
'torrentTags' => $TagList,
'size' => (float) $TorrentInfo['Size'],
'fileCount' => (int) $TorrentInfo['FileCount'],
'format' => $TorrentInfo['Format'],
'encoding' => $TorrentInfo['Encoding'],
'media' => $TorrentInfo['Media'],
'scene' => $TorrentInfo['Scene'] == 1,
'groupYear' => (int) $GroupInfo['Year'],
'groupYear' => (int) $GroupYear,
'remasterYear' => (int) $TorrentInfo['RemasterYear'],
'remasterTitle' => $TorrentInfo['RemasterTitle'],
'snatched' => (int) $TorrentInfo['Snatched'],
@ -111,5 +108,3 @@
)
)
);
?>

View File

@ -15,8 +15,6 @@ function compare($X, $Y){
// Similar artist map
include(SERVER_ROOT.'/classes/class_artists_similar.php');
include(SERVER_ROOT.'/classes/class_image_tools.php');
$UserVotes = Votes::get_user_votes($LoggedUser['ID']);
$ArtistID = $_GET['id'];
@ -118,7 +116,7 @@ function compare($X, $Y){
}
}
if (count($GroupIDs) > 0) {
$TorrentList = Torrents::get_groups($GroupIDs, true,true);
$TorrentList = Torrents::get_groups($GroupIDs, true, true);
$TorrentList = $TorrentList['matches'];
} else {
$TorrentList = array();
@ -246,22 +244,11 @@ function compare($X, $Y){
$NumSnatches = 0;
foreach ($TorrentList as $GroupID => $Group) {
$TagList = explode(' ',str_replace('_','.',$Group['TagList']));
// $Tags array is for the sidebar on the right.
// Skip compilations and soundtracks.
$Skip = $Group['ReleaseType'] != 7 && $Group['ReleaseType'] != 3;
$TorrentTags = array();
// $Tags array is for the sidebar on the right. Skip compilations and soundtracks.
if ($Group['ReleaseType'] != 7 && $Group['ReleaseType'] != 3) {
foreach($TagList as $Tag) {
if(!isset($Tags[$Tag])) {
$Tags[$Tag] = array('name'=>$Tag, 'count'=>1);
} else {
$Tags[$Tag]['count']++;
}
}
}
$TorrentTags = implode(', ', $TorrentTags);
$TorrentTags = '<br /><div class="tags">'.$TorrentTags.'</div>';
$TorrentTags = new Tags($Group['TagList'], !$Skip);
foreach ($Group['Torrents'] as $TorrentID => $Torrent) {
$NumTorrents++;
@ -286,9 +273,7 @@ function compare($X, $Y){
$LastReleaseType = 0;
foreach ($Importances as $Group) {
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Torrents, $Artists, $ExtendedArtists, $GroupFlags) = array_values($TorrentList[$Group['GroupID']]);
$ReleaseType = $Group['ReleaseType'];
$GroupVanityHouse = $Group['VanityHouse'];
extract(Torrents::array_group($TorrentList[$Group['GroupID']]));
if ($GroupID == $OldGroupID && $ReleaseType == $OldReleaseType) {
continue;
@ -308,16 +293,7 @@ function compare($X, $Y){
$HideDiscog = '';
}
$TagList = explode(' ',str_replace('_','.',$TagList));
$TorrentTags = array();
// $Tags array is for the sidebar on the right. Skip compilations and soundtracks.
foreach($TagList as $Tag) {
$TorrentTags[] = '<a href="torrents.php?taglist='.$Tag.'">'.$Tag.'</a>';
}
$TorrentTags = implode(', ', $TorrentTags);
$TorrentTags = '<br /><div class="tags">'.$TorrentTags.'</div>';
$TorrentTags = new Tags($TagList);
if($ReleaseType!=$LastReleaseType) {
switch($ReleaseTypes[$ReleaseType]) {
@ -400,9 +376,16 @@ function compare($X, $Y){
<a href="#" class="show_torrents_link" onclick="toggle_group(<?=$GroupID?>, this, event)" title="Collapse this group. Hold &quot;Ctrl&quot; while clicking to collapse all groups in this release type."></a>
</div>
</td>
<td colspan="5">
<strong><?=$DisplayName?></strong> <?Votes::vote_link($GroupID,$UserVotes[$GroupID]['Type']);?>
<?=$TorrentTags?>
<td colspan="5" class="big_info">
<? if ($LoggedUser['CoverArt']) : ?>
<div class="group_image float_left clear">
<? ImageTools::cover_thumb($WikiImage, $GroupCategoryID - 1) ?>
</div>
<? endif; ?>
<div class="group_info clear">
<strong><?=$DisplayName?></strong> <?Votes::vote_link($GroupID,$UserVotes[$GroupID]['Type']);?>
<div class="tags"><?=$TorrentTags->format()?></div>
</div>
</td>
</tr>
<?
@ -554,7 +537,7 @@ function compare($X, $Y){
<div class="box box_image">
<div class="head"><strong><?=$Name?></strong></div>
<div style="text-align:center;padding:10px 0px;">
<img style="max-width: 220px;" src="<?=to_thumbnail($Image)?>" alt="<?=$Name?>" onclick="lightbox.init('<?=$Image?>',220);" />
<img style="max-width: 220px;" src="<?=ImageTools::thumbnail($Image)?>" alt="<?=$Name?>" onclick="lightbox.init('<?=$Image?>',220);" />
</div>
</div>
<? } ?>
@ -638,12 +621,7 @@ function compare($X, $Y){
<div class="head"><strong>Tags</strong></div>
<ul class="stats nobullet">
<?
uasort($Tags, 'compare');
foreach ($Tags as $TagName => $Tag) {
?>
<li><a href="torrents.php?taglist=<?=$TagName?>"><?=$TagName?></a> (<?=$Tag['count']?>)</li>
<?
}
$TorrentTags->format_top(50);
?>
</ul>
</div>
@ -778,16 +756,7 @@ function compare($X, $Y){
<tr class="row<?=$Row?>">
<td>
<?=$FullName?>
<div class="tags">
<?
$TagList = array();
foreach($Tags as $TagID => $TagName) {
$TagList[] = "<a href='requests.php?tags=".$TagName."'>".display_str($TagName)."</a>";
}
$TagList = implode(', ', $TagList);
?>
<?=$TagList?>
</div>
<div class="tags"><?=$TorrentTags->format('requests.php?tags=')?></div>
</td>
<td>
<span id="vote_count_<?=$RequestID?>"><?=$Votes?></span>

View File

@ -153,7 +153,7 @@ function compare($X, $Y){
reset($TorrentList);
if(!empty($UsedReleases)) { ?>
<div id="releasetypes"class="box center">
<div id="releasetypes" class="box center">
<span id="releasetype_links">
<?
foreach($ReleaseTypesOrder as $ReleaseID => $Torrents) {
@ -261,26 +261,13 @@ function display_name($ReleaseType) {
$OpenTable = true;
foreach($TorrentListForReleaseType as $GroupID => $Group) {
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $NewReleaseType, $GroupVanityHouse, $Torrents, $GroupArtists) = array_values($Group);
extract(Torrents::array_group($Group));
$GroupVanityHouse = $GroupMeta[$GroupID]['VanityHouse'];
$TagList = explode(' ',str_replace('_','.',$TagList));
$TorrentTags = array();
// $Tags array is for the sidebar on the right
foreach($TagList as $Tag) {
if(!isset($Tags[$Tag])) {
$Tags[$Tag] = array('name'=>$Tag, 'count'=>1);
} else {
$Tags[$Tag]['count']++;
}
$TorrentTags[]='<a href="torrents.php?taglist='.$Tag.'">'.$Tag.'</a>';
}
$TorrentTags = implode(', ', $TorrentTags);
$TorrentTags = '<br /><div class="tags">'.$TorrentTags.'</div>';
$TorrentTags = new Tags($TagList);
if (($ReleaseType == 1023) || ($ReleaseType == 1024)) {
$ArtistPrefix = Artists::display_artists(array(1 => $GroupArtists));
$ArtistPrefix = Artists::display_artists(array(1 => $Artists));
} else {
$ArtistPrefix = '';
}
@ -297,7 +284,7 @@ function display_name($ReleaseType) {
</td>
<td class="artist_normalcol" colspan="6">
<strong><?=$DisplayName?></strong>
<?=$TorrentTags?>
<div class="tags"><?=$TorrentTags->format()?></div>
</td>
</tr>
<?
@ -463,12 +450,7 @@ function display_name($ReleaseType) {
<div class="head"><strong>Tags</strong></div>
<ul class="stats nobullet">
<?
uasort($Tags, 'compare');
foreach ($Tags as $TagName => $Tag) {
?>
<li><a href="torrents.php?taglist=<?=$TagName?>"><?=$TagName?></a> (<?=$Tag['count']?>)</li>
<?
}
$TorrentTags->format_top(50);
?>
</ul>
</div>

View File

@ -61,9 +61,6 @@
error(403);
}
require(SERVER_ROOT.'/classes/class_bencode.php');
require(SERVER_ROOT.'/classes/class_torrent.php');
$Preferences = array('RemasterTitle DESC', 'Seeders ASC', 'Size ASC');
$ArtistID = $_REQUEST['artistid'];
@ -133,7 +130,6 @@
$DownloadsQ = $DB->query($SQL);
$Collector = new TorrentsDL($DownloadsQ, $ArtistName);
while (list($Downloads, $GroupIDs) = $Collector->get_downloads('GroupID')) {
$Artists = Artists::get_artists($GroupIDs);
$TorrentFilesQ = $DB->query("SELECT TorrentID, File FROM torrents_files WHERE TorrentID IN (".implode(',', array_keys($GroupIDs)).")", false);
@ -161,16 +157,7 @@
} else if ($Releases[$GroupID]['Importance'] == 3) {
$ReleaseTypeName = "Remixed By";
}
if (Misc::is_new_torrent($TorrentFile)) {
$TorEnc = BEncTorrent::add_announce_url($TorrentFile, ANNOUNCE_URL."/$LoggedUser[torrent_pass]/announce");
} else {
$Contents = unserialize(base64_decode($TorrentFile));
$Tor = new TORRENT($Contents, true);
$Tor->set_announce_url(ANNOUNCE_URL."/$LoggedUser[torrent_pass]/announce");
unset($Tor->Val['announce-list']);
$TorEnc = $Tor->enc();
}
$Collector->add_file($TorEnc, $Download, $ReleaseTypeName);
$Collector->add_file($TorrentFile, $Download, $ReleaseTypeName);
unset($Download);
}
}

View File

@ -3,7 +3,6 @@
The page that handles the backend of the 'edit artist' function.
\*********************************************************************/
include(SERVER_ROOT.'/classes/class_image_tools.php');
authorize();
if(!$_REQUEST['artistid'] || !is_number($_REQUEST['artistid'])) {
@ -28,7 +27,7 @@
$Body = db_string($_POST['body']);
$Summary = db_string($_POST['summary']);
$Image = db_string($_POST['image']);
check_imagehost($Image);
ImageTools::blacklisted($Image);
// Trickery
if(!preg_match("/^".IMAGE_REGEX."$/i", $Image)) {
$Image = '';

View File

@ -46,7 +46,9 @@
<table class="torrent_table">
<?
foreach ($TorrentsInfo as $TorrentID => $Info) {
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TorrentTags, $ReleaseType, $GroupVanityHouse, $Torrents, $Artists, $ExtendedArtists, $GroupFlags) = array_values($Results[$Info['GroupID']]);
extract(Torrents::array_group($Results[$Info['GroupID']]));
$TorrentTags = new Tags($TagList);
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
unset($ExtendedArtists[2]);
unset($ExtendedArtists[3]);
@ -62,18 +64,6 @@
if($ExtraInfo) {
$DisplayName.=' - '.$ExtraInfo;
}
$TagList=array();
if($TorrentTags!='') {
$TorrentTags=explode(' ',$TorrentTags);
foreach ($TorrentTags as $TagKey => $TagName) {
$TagName = str_replace('_','.',$TagName);
$TagList[]='<a href="torrents.php?taglist='.$TagName.'">'.$TagName.'</a>';
}
$PrimaryTag = $TorrentTags[0];
$TagList = implode(', ', $TagList);
$TorrentTags='<br /><div class="tags">'.$TagList.'</div>';
}
?>
<tr class="torrent torrent_row<?=$GroupFlags['IsSnatched'] ? ' snatched_torrent"' : ''?>">
<td>
@ -84,7 +74,7 @@
<? if (check_perms('admin_reports')) { ?>
<a href="better.php?method=files&amp;remove=<?=$TorrentID?>" class="brackets">X</a>
<? } ?>
<?=$TorrentTags?>
<div class="tags"><?=$TorrentTags->format()?></div>
</td>
</tr>
<? } ?>

View File

@ -46,7 +46,9 @@
<table class="torrent_table">
<?
foreach ($TorrentsInfo as $TorrentID => $Info) {
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TorrentTags, $ReleaseType, $GroupVanityHouse, $Torrents, $Artists, $ExtendedArtists, $GroupFlags) = array_values($Results[$Info['GroupID']]);
extract(Torrents::array_group($Results[$Info['GroupID']]));
$TorrentTags = new Tags($TagList);
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
unset($ExtendedArtists[2]);
unset($ExtendedArtists[3]);
@ -62,18 +64,6 @@
if($ExtraInfo) {
$DisplayName.=' - '.$ExtraInfo;
}
$TagList=array();
if($TorrentTags!='') {
$TorrentTags=explode(' ',$TorrentTags);
foreach ($TorrentTags as $TagKey => $TagName) {
$TagName = str_replace('_','.',$TagName);
$TagList[]='<a href="torrents.php?taglist='.$TagName.'">'.$TagName.'</a>';
}
$PrimaryTag = $TorrentTags[0];
$TagList = implode(', ', $TagList);
$TorrentTags='<br /><div class="tags">'.$TagList.'</div>';
}
?>
<tr class="torrent torrent_row<?=$Torrents[$TorrentID]['IsSnatched'] ? ' snatched_torrent' : ''?>">
<td>
@ -84,7 +74,7 @@
<? if (check_perms('admin_reports')) { ?>
<a href="better.php?method=folders&amp;remove=<?=$TorrentID?>" class="brackets">X</a>
<? } ?>
<?=$TorrentTags?>
<div class="tags"><?=$TorrentTags->format()?></div>
</td>
</tr>
<? } ?>

View File

@ -27,8 +27,10 @@
</tr>
<?
$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 ($Results as $GroupID => $Group) {
extract(Torrents::array_group($Group));
$TorrentTags = new Tags($TagList);
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
unset($ExtendedArtists[2]);
unset($ExtendedArtists[3]);
@ -46,18 +48,6 @@
if($ExtraInfo) {
$DisplayName.=' - '.$ExtraInfo;
}
$TagList=array();
if($TorrentTags!='') {
$TorrentTags=explode(' ',$TorrentTags);
foreach ($TorrentTags as $TagKey => $TagName) {
$TagName = str_replace('_','.',$TagName);
$TagList[]='<a href="torrents.php?taglist='.$TagName.'">'.$TagName.'</a>';
}
$PrimaryTag = $TorrentTags[0];
$TagList = implode(', ', $TagList);
$TorrentTags='<br /><div class="tags">'.$TagList.'</div>';
}
?>
<tr class="torrent torrent_row<?=$Torrents[$FlacID]['IsSnatched'] ? ' snatched_torrent' : ''?>">
<td>
@ -65,7 +55,7 @@
<a href="torrents.php?action=download&amp;id=<?=$FlacID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" class="brackets">DL</a>
</span>
<?=$DisplayName?>
<?=$TorrentTags?>
<div class="tags"><?=$TorrentTags->format()?></div>
</td>
</tr>
<? } ?>

View File

@ -174,13 +174,6 @@
$ArtistNames = '';
}
$TagList = array();
$TagList = explode(' ', str_replace('_', '.', $GroupInfo['TagList']));
$TorrentTags = array();
foreach ($TagList as $Tag) {
$TorrentTags[] = '<a href="torrents.php?taglist='.$Tag.'">'.$Tag.'</a>';
}
$TorrentTags = implode(', ', $TorrentTags);
foreach ($Editions as $RemIdent => $Edition) {
if (!$Edition['FlacID'] || count($Edition['Formats']) == 3) {
continue;
@ -212,6 +205,7 @@
if (!empty($Edition['RemasterYear'])) {
$ExtraInfo .= ' - ';
}
$TorrentTags = new Tags($GroupInfo['TagList']);
$ExtraInfo .= implode(' / ', $EditionInfo);
?>
<tr class="torrent torrent_row<?=$Edition['IsSnatched'] ? ' snatched_torrent' : ''?>">
@ -221,7 +215,7 @@
</span>
<?=$DisplayName?>
<div class="torrent_info"><?=$ExtraInfo?></div>
<div class="tags"><?=$TorrentTags?></div>
<div class="tags"><?=$TorrentTags->format()?></div>
</td>
<td><strong <?=isset($Edition['Formats']['V2 (VBR)']) ? 'class="important_text_alt">YES' : 'class="important_text">NO'?></strong></td>
<td><strong <?=isset($Edition['Formats']['V0 (VBR)']) ? 'class="important_text_alt">YES' : 'class="important_text">NO'?></strong></td>

View File

@ -47,7 +47,9 @@
<table class="torrent_table">
<?
foreach($TorrentsInfo as $TorrentID => $Info) {
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TorrentTags, $ReleaseType, $GroupVanityHouse, $Torrents, $Artists, $ExtendedArtists, $GroupFlags) = array_values($Results[$Info['GroupID']]);
extract(Torrents::array_group($Results[$Info['GroupID']]));
$TorrentTags = new Tags($TagList);
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
unset($ExtendedArtists[2]);
unset($ExtendedArtists[3]);
@ -63,18 +65,6 @@
if($ExtraInfo) {
$DisplayName.=' - '.$ExtraInfo;
}
$TagList=array();
if($TorrentTags!='') {
$TorrentTags=explode(' ',$TorrentTags);
foreach ($TorrentTags as $TagKey => $TagName) {
$TagName = str_replace('_','.',$TagName);
$TagList[]='<a href="torrents.php?taglist='.$TagName.'">'.$TagName.'</a>';
}
$PrimaryTag = $TorrentTags[0];
$TagList = implode(', ', $TagList);
$TorrentTags='<br /><div class="tags">'.$TagList.'</div>';
}
?>
<tr class="torrent torrent_row<?=$Torrents[$TorrentID]['IsSnatched'] ? ' snatched_torrent' : ''?>">
<td>
@ -85,7 +75,7 @@
<? if(check_perms('admin_reports')) { ?>
<a href="better.php?method=tags&amp;remove=<?=$TorrentID?>" class="brackets">X</a>
<? } ?>
<?=$TorrentTags?>
<div class="tags"><?=$TorrentTags->format()?></div>
</td>
</tr>
<?

View File

@ -128,14 +128,6 @@
} else {
$ArtistNames = '';
}
$TagList = array();
$TagList = explode(' ',str_replace('_','.',$GroupInfo['TagList']));
$TorrentTags = array();
foreach ($TagList as $Tag) {
$TorrentTags[] = '<a href="torrents.php?taglist='.$Tag.'">'.$Tag.'</a>';
}
$TorrentTags = implode(', ', $TorrentTags);
foreach ($Editions as $RemIdent => $Edition) {
if (!$Edition['FlacID'] //no FLAC in this group
|| !empty($Edition['Formats']) && $_GET['type'] == 3 //at least one transcode present when we only wanted groups containing no transcodes at all (type 3)
@ -174,6 +166,7 @@
if (!empty($Edition['RemasterYear'])) {
$ExtraInfo .= ' - ';
}
$TorrentTags = new Tags($GroupInfo['TagList']);
$ExtraInfo .= implode(' / ', $EditionInfo);
?>
<tr<?=$Edition['IsSnatched'] ? ' class="snatched_torrent"' : ''?>>
@ -183,7 +176,7 @@
</span>
<?=$DisplayName?>
<div class="torrent_info"><?=$ExtraInfo?></div>
<div class="tags"><?=$TorrentTags?></div>
<div class="tags"><?=$TorrentTags->format()?></div>
</td>
<td><strong <?=isset($Edition['Formats']['V2 (VBR)']) ? 'class="important_text_alt">YES' : 'class="important_text">NO'?></strong></td>
<td><strong <?=isset($Edition['Formats']['V0 (VBR)']) ? 'class="important_text_alt">YES' : 'class="important_text">NO'?></strong></td>

View File

@ -143,12 +143,7 @@
<?
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'];
extract(Torrents::array_group($GroupInfo));
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
unset($ExtendedArtists[2]);
@ -158,13 +153,6 @@
$ArtistNames = '';
}
$TagList = array();
$TagList = explode(' ', str_replace('_', '.', $GroupInfo['TagList']));
$TorrentTags = array();
foreach ($TagList as $Tag) {
$TorrentTags[] = '<a href="torrents.php?taglist='.$Tag.'">'.$Tag.'</a>';
}
$TorrentTags = implode(', ', $TorrentTags);
foreach ($Editions as $RemIdent => $Edition) {
if (!$Edition['FlacID'] || count($Edition['Formats']) == 3) {
continue;
@ -196,6 +184,7 @@
if (!empty($Edition['RemasterYear'])) {
$ExtraInfo .= ' - ';
}
$TorrentTags = new Tags($TagList);
$ExtraInfo .= implode(' / ', $EditionInfo);
?>
<tr class="torrent torrent_row<?=$Edition['IsSnatched'] ? ' snatched_torrent' : ''?>">
@ -205,7 +194,7 @@
</span>
<?=$DisplayName?>
<div class="torrent_info"><?=$ExtraInfo?></div>
<div class="tags"><?=$TorrentTags?></div>
<div class="tags"><?=$TorrentTags->format()?></div>
</td>
<td><strong <?=isset($Edition['Formats']['V2 (VBR)']) ? 'class="important_text_alt">YES' : 'class="important_text">NO'?></strong></td>
<td><strong <?=isset($Edition['Formats']['V0 (VBR)']) ? 'class="important_text_alt">YES' : 'class="important_text">NO'?></strong></td>

View File

@ -35,7 +35,7 @@
}
$Cache->delete_value('bookmarks_'.$Type.'_'.$LoggedUser['ID']);
if ($Type == 'torrent') {
$Cache->delete_value('bookmarks_torrent_'.$LoggedUser['ID'].'_full');
$Cache->delete_value('bookmarks_group_ids_' . $UserID);
$GroupID = (int) $_GET['id'];
$DB->query("SELECT Name, Year, WikiBody, TagList FROM torrents_group WHERE ID = '$GroupID'");

View File

@ -1,29 +1,29 @@
<?php
// ugly UserID code that should be turned into a function . . .
if(!empty($_GET['userid'])) {
if(!check_perms('users_override_paranoia')) {
error(403);
}
$UserID = $_GET['userid'];
if(!is_number($UserID)) { error(404); }
$DB->query("SELECT Username FROM users_main WHERE ID='$UserID'");
list($Username) = $DB->next_record();
} else {
$UserID = $LoggedUser['ID'];
}
// Finally we start
//Require the table class
// require_once SERVER_ROOT . '/classes/class_mass_user_torrents_table_view.php';
View::show_header('Organize Bookmarks', 'browse,jquery,jquery-ui,jquery.tablesorter,sort');
$EditType = isset($_GET['type']) ? $_GET['type'] : 'torrents';
list($K, $GroupIDs, $CollageDataList, $TorrentList) = Users::bookmark_data($UserID);
$TT = new MASS_USER_TORRENTS_TABLE_VIEW($TorrentList, $CollageDataList, $EditType, 'Organize Torrent Bookmarks');
$TT->render_all();
<?php
// ugly UserID code that should be turned into a function . . .
if(!empty($_GET['userid'])) {
if(!check_perms('users_override_paranoia')) {
error(403);
}
$UserID = $_GET['userid'];
if(!is_number($UserID)) { error(404); }
$DB->query("SELECT Username FROM users_main WHERE ID='$UserID'");
list($Username) = $DB->next_record();
} else {
$UserID = $LoggedUser['ID'];
}
// Finally we start
//Require the table class
// require_once SERVER_ROOT . '/classes/class_mass_user_torrents_table_view.php';
View::show_header('Organize Bookmarks', 'browse,jquery,jquery-ui,jquery.tablesorter,sort');
$EditType = isset($_GET['type']) ? $_GET['type'] : 'torrents';
list(, $CollageDataList, $TorrentList) = Users::get_bookmarks($UserID);
$TT = new MASS_USER_TORRENTS_TABLE_VIEW($TorrentList, $CollageDataList, $EditType, 'Organize Torrent Bookmarks');
$TT->render_all();
View::show_footer();

View File

@ -25,8 +25,7 @@
$DB->query("CREATE TEMPORARY TABLE snatched_groups_temp (GroupID int PRIMARY KEY)");
$DB->query("INSERT INTO snatched_groups_temp SELECT DISTINCT GroupID FROM torrents AS t JOIN xbt_snatched AS s ON s.fid=t.ID WHERE s.uid='$LoggedUser[ID]'");
$DB->query("DELETE b FROM bookmarks_torrents AS b JOIN snatched_groups_temp AS s USING(GroupID) WHERE b.UserID='$LoggedUser[ID]'");
$Cache->delete_value('bookmarks_torrent_'.$UserID);
$Cache->delete_value('bookmarks_torrent_'.$UserID.'_full');
$Cache->delete_value('bookmarks_group_ids_' . $UserID);
header('Location: bookmarks.php');
die();
break;

View File

@ -13,11 +13,11 @@
$DB->query("DELETE FROM $Table WHERE UserID='".$LoggedUser['ID']."' AND $Col='".db_string($_GET['id'])."'");
$Cache->delete_value('bookmarks_'.$Type.'_'.$UserID);
if ($Type == 'torrent') {
$Cache->delete_value('bookmarks_torrent_'.$UserID.'_full');
} elseif ($Type == 'request') {
if ($Type === 'torrent') {
$Cache->delete_value('bookmarks_group_ids_' . $UserID);
} elseif ($Type === 'request') {
$DB->query("SELECT UserID FROM $Table WHERE $Col='".db_string($_GET['id'])."'");
$Bookmarkers = $DB->collect('UserID');
$SS->UpdateAttributes('requests requests_delta', array('bookmarker'), array($_GET['id'] => array($Bookmarkers)), true);
}
?>

View File

@ -1,5 +1,4 @@
<?
include(SERVER_ROOT.'/classes/class_image_tools.php');
ini_set('max_execution_time',600);
set_time_limit(0);
@ -21,11 +20,8 @@ function compare($X, $Y){
$UserID = $LoggedUser['ID'];
}
$Sneaky = ($UserID != $LoggedUser['ID']);
list($K, $GroupIDs, $CollageDataList, $TorrentList) = Users::bookmark_data($UserID);
$Title = ($Sneaky)?"$Username's bookmarked torrents":'Your bookmarked torrents';
$Sneaky = $UserID != $LoggedUser['ID'];
$Title = $Sneaky ? "$Username's bookmarked torrents" : 'Your bookmarked torrents';
// Loop through the result set, building up $Collage and $TorrentTable
// Then we print them.
@ -33,47 +29,34 @@ function compare($X, $Y){
$TorrentTable = '';
$NumGroups = 0;
$Artists = array();
$Tags = array();
$ArtistCount = array();
foreach ($TorrentList as $GroupID=>$Group) {
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Torrents, $GroupArtists, $ExtendedArtists, $GroupFlags) = array_values($Group);
list($GroupID2, $Sort, $Image, $GroupCategoryID, $AddedTime) = array_values($CollageDataList[$GroupID]);
list(, $CollageDataList, $TorrentList) = Users::get_bookmarks($UserID);
foreach ($TorrentList as $GroupID => $Group) {
extract(Torrents::array_group($Group));
list(, $Sort, $AddedTime) = array_values($CollageDataList[$GroupID]);
// Handle stats and stuff
$NumGroups++;
if($GroupArtists) {
foreach($GroupArtists as $Artist) {
if(!isset($Artists[$Artist['id']])) {
$Artists[$Artist['id']] = array('name'=>$Artist['name'], 'count'=>1);
if($Artists) {
foreach($Artists as $Artist) {
if(!isset($ArtistCount[$Artist['id']])) {
$ArtistCount[$Artist['id']] = array('name'=>$Artist['name'], 'count'=>1);
} else {
$Artists[$Artist['id']]['count']++;
$ArtistCount[$Artist['id']]['count']++;
}
}
}
$TagList = explode(' ',str_replace('_','.',$TagList));
$TorrentTags = array();
foreach($TagList as $Tag) {
if(!isset($Tags[$Tag])) {
$Tags[$Tag] = array('name'=>$Tag, 'count'=>1);
} else {
$Tags[$Tag]['count']++;
}
$TorrentTags[]='<a href="torrents.php?taglist='.$Tag.'">'.$Tag.'</a>';
}
$PrimaryTag = $TagList[0];
$TorrentTags = implode(', ', $TorrentTags);
$TorrentTags='<br /><div class="tags">'.$TorrentTags.'</div>';
$TorrentTags = new Tags($TagList);
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
unset($ExtendedArtists[2]);
unset($ExtendedArtists[3]);
$DisplayName = Artists::display_artists($ExtendedArtists);
} elseif(count($GroupArtists)>0) {
$DisplayName = Artists::display_artists(array('1'=>$GroupArtists));
} elseif(count($Artists)>0) {
$DisplayName = Artists::display_artists(array('1'=>$Artists));
} else {
$DisplayName = '';
}
@ -95,18 +78,18 @@ function compare($X, $Y){
</div>
</td>
<td class="center">
<div title="<?=ucfirst(str_replace('_',' ',$PrimaryTag))?>" class="cats_<?=strtolower(str_replace(array('-',' '),array('',''),$Categories[$GroupCategoryID-1]))?> tags_<?=str_replace('.','_',$PrimaryTag)?>"></div>
<div title="<?=$TorrentTags->title()?>" class="<?=Format::css_category($GroupCategoryID)?> <?=$TorrentTags->css_name()?>"></div>
</td>
<td colspan="5">
<span style="float:left;"><strong><?=$DisplayName?></strong></span>
<span style="float:right;text-align:right">
<strong><?=$DisplayName?></strong>
<span style="text-align:right" class="float_right">
<? if(!$Sneaky){ ?>
<a href="#group_<?=$GroupID?>" class="brackets remove_bookmark" title="Remove bookmark" onclick="Unbookmark('torrent', <?=$GroupID?>, '');return false;">Unbookmark</a>
<br />
<? } ?>
<?=time_diff($AddedTime);?>
</span>
<br /><span style="float:left;"><?=$TorrentTags?></span>
<div class="tags"><?=$TorrentTags->format()?></div>
</td>
</tr>
<?
@ -206,7 +189,7 @@ function compare($X, $Y){
<tr class="torrent torrent_row<?=$SnatchedTorrentClass . $SnatchedGroupClass?>" id="group_<?=$GroupID?>">
<td></td>
<td class="center">
<div title="<?=ucfirst(str_replace('_',' ',$PrimaryTag))?>" class="cats_<?=strtolower(str_replace(array('-',' '),array('',''),$Categories[$GroupCategoryID-1]))?> tags_<?=str_replace('.','_',$PrimaryTag)?>">
<div title="<?=$TorrentTags->title()?>" class="<?=Format::css_category($GroupCategoryID)?> <?=$TorrentTags->css_name()?>">
</div>
</td>
<td>
@ -218,11 +201,11 @@ function compare($X, $Y){
| <a href="reportsv2.php?action=report&amp;id=<?=$TorrentID?>" title="Report">RP</a> ]
</span>
<strong><?=$DisplayName?></strong>
<?=$TorrentTags?>
<div class="tags"><?=$TorrentTags->format()?></div>
<? if(!$Sneaky){ ?>
<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 class="float_right float_clear"><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 class="float_right float_clear"><?=time_diff($AddedTime);?></span>
</td>
<td class="nobr"><?=Format::get_size($Torrent['Size'])?></td>
@ -243,20 +226,20 @@ function compare($X, $Y){
unset($ExtendedArtists[2]);
unset($ExtendedArtists[3]);
$DisplayName .= Artists::display_artists($ExtendedArtists, false);
} elseif(count($GroupArtists)>0) {
$DisplayName .= Artists::display_artists(array('1'=>$GroupArtists), false);
} elseif(count($Artists)>0) {
$DisplayName .= Artists::display_artists(array('1'=>$Artists), false);
}
$DisplayName .= $GroupName;
if($GroupYear>0) { $DisplayName = $DisplayName. ' ['. $GroupYear .']';}
?>
<li class="image_group_<?=$GroupID?>">
<a href="torrents.php?id=<?=$GroupID?>" class="bookmark_<?=$GroupID?>">
<? if($Image) {
<? if($WikiImage) {
if(check_perms('site_proxy_images')) {
$Image = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?i='.urlencode($Image);
$WikiImage = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?i='.urlencode($WikiImage);
}
?>
<img src="<?=to_thumbnail($Image)?>" alt="<?=$DisplayName?>" title="<?=$DisplayName?>" width="117" />
<img src="<?=ImageTools::thumbnail($WikiImage)?>" alt="<?=$DisplayName?>" title="<?=$DisplayName?>" width="117" />
<? } else { ?>
<div style="width:107px;padding:5px"><?=$DisplayName?></div>
<? } ?>
@ -309,24 +292,14 @@ function compare($X, $Y){
<div class="head"><strong>Stats</strong></div>
<ul class="stats nobullet">
<li>Torrents: <?=$NumGroups?></li>
<? if(count($Artists) >0) { ?> <li>Artists: <?=count($Artists)?></li> <? } ?>
<? if(count($ArtistCount) >0) { ?> <li>Artists: <?=count($ArtistCount)?></li> <? } ?>
</ul>
</div>
<div class="box box_tags">
<div class="head"><strong>Top tags</strong></div>
<div class="pad">
<ol style="padding-left:5px;">
<?
uasort($Tags, 'compare');
$i = 0;
foreach ($Tags as $TagName => $Tag) {
$i++;
if($i>5) { break; }
?>
<li><a href="torrents.php?taglist=<?=display_str($TagName)?>"><?=display_str($TagName)?></a> (<?=$Tag['count']?>)</li>
<?
}
?>
<? $TorrentTags->format_top(5) ?>
</ol>
</div>
</div>
@ -335,9 +308,9 @@ function compare($X, $Y){
<div class="pad">
<ol style="padding-left:5px;">
<?
uasort($Artists, 'compare');
uasort($ArtistCount, 'compare');
$i = 0;
foreach ($Artists as $ID => $Artist) {
foreach ($ArtistCount as $ID => $Artist) {
$i++;
if($i>10) { break; }
?>
@ -394,4 +367,3 @@ function compare($X, $Y){
</div>
<?
View::show_footer();
$Cache->cache_value('bookmarks_torrent_'.$UserID.'_full', serialize(array(array($TorrentList, $CollageDataList))), 3600);

View File

@ -289,13 +289,7 @@
foreach ($Collages as $Collage) {
list($ID, $Name, $NumTorrents, $TagList, $CategoryID, $UserID) = $Collage;
$Row = ($Row == 'a') ? 'b' : 'a';
$TagList = explode(' ', $TagList);
$Tags = array();
foreach($TagList as $Tag) {
if(!empty($Tag))
$Tags[]='<a href="collages.php?action=search&amp;tags='.$Tag.'">'.$Tag.'</a>';
}
$Tags = implode(', ', $Tags);
$TorrentTags = new Tags($TagList);
//Print results
?>
@ -309,13 +303,8 @@
<span style="float:right">
<a href="#" onclick="Unbookmark('collage', <?=$ID?>,'');return false;" class="brackets">Remove bookmark</a>
</span>
<? }
if(!empty($Tags)) {
?>
<div class="tags">
<?=$Tags?>
</div>
<? } ?>
<? } ?>
<div class="tags"><?=$TorrentTags->format('collages.php?action=search&amp;tags=')?></div>
</td>
<td><?=(int)$NumTorrents?></td>
<td><?=Users::format_username($UserID, false, false, false)?></td>

View File

@ -9,7 +9,6 @@ function compare($X, $Y){
include(SERVER_ROOT.'/sections/bookmarks/functions.php'); // has_bookmarked()
include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
include(SERVER_ROOT.'/classes/class_image_tools.php');
$Text = new TEXT;
@ -96,13 +95,14 @@ function compare($X, $Y){
$NumGroups = 0;
$NumGroupsByUser = 0;
$Artists = array();
$Tags = array();
$Users = array();
$Number = 0;
foreach ($TorrentList as $GroupID=>$Group) {
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Torrents, $GroupArtists, $ExtendedArtists, $GroupFlags) = array_values($Group);
list($GroupID2, $Image, $GroupCategoryID, $UserID, $Username) = array_values($CollageDataList[$GroupID]);
foreach ($TorrentList as $GroupID => $Group) {
extract(Torrents::array_group($Group));
list( , , , $UserID, $Username) = array_values($CollageDataList[$GroupID]);
$TorrentTags = new Tags($TagList);
// Handle stats and stuff
$Number++;
@ -135,21 +135,6 @@ function compare($X, $Y){
}
}
$TagList = explode(' ',str_replace('_','.',$TagList));
$TorrentTags = array();
foreach($TagList as $Tag) {
if(!isset($Tags[$Tag])) {
$Tags[$Tag] = array('name'=>$Tag, 'count'=>1);
} else {
$Tags[$Tag]['count']++;
}
$TorrentTags[]='<a href="torrents.php?taglist='.$Tag.'">'.$Tag.'</a>';
}
$PrimaryTag = $TagList[0];
$TorrentTags = implode(', ', $TorrentTags);
$TorrentTags='<br /><div class="tags">'.$TorrentTags.'</div>';
$DisplayName = $Number.' - ';
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5])|| !empty($ExtendedArtists[6])) {
@ -178,11 +163,11 @@ function compare($X, $Y){
</div>
</td>
<td class="center">
<div title="<?=ucfirst(str_replace('_',' ',$PrimaryTag))?>" class="cats_<?=strtolower(str_replace(array('-',' '),array('',''),$Categories[$GroupCategoryID-1]))?> tags_<?=str_replace('.','_',$PrimaryTag)?>"></div>
<div title="<?=$TorrentTags->title()?>" class="<?=Format::css_category($GroupCategoryID)?> <?=$TorrentTags->css_name()?>"></div>
</td>
<td colspan="5">
<strong><?=$DisplayName?></strong> <?Votes::vote_link($GroupID,$UserVotes[$GroupID]['Type']);?>
<?=$TorrentTags?>
<div class="tags"><?=$TorrentTags->format()?></div>
</td>
</tr>
<?
@ -281,7 +266,7 @@ function compare($X, $Y){
<tr class="torrent torrent_row<?=$SnatchedTorrentClass . $SnatchedGroupClass?>" id="group_<?=$GroupID?>">
<td></td>
<td class="center">
<div title="<?=ucfirst(str_replace('_',' ',$PrimaryTag))?>" class="cats_<?=strtolower(str_replace(array('-',' '),array('',''),$Categories[$GroupCategoryID-1]))?> tags_<?=str_replace('.','_',$PrimaryTag)?>">
<div title="<?=$TorrentTags->title()?>" class="<?=Format::css_category($GroupCategoryID)?> <?=$TorrentTags->css_name()?>">
</div>
</td>
<td>
@ -293,7 +278,7 @@ function compare($X, $Y){
| <a href="reportsv2.php?action=report&amp;id=<?=$TorrentID?>" title="Report">RP</a> ]
</span>
<strong><?=$DisplayName?></strong> <?Votes::vote_link($GroupID,$UserVotes[$GroupID]['Type']);?>
<?=$TorrentTags?>
<div class="tags"><?=$TorrentTags->format()?></div>
</td>
<td class="nobr"><?=Format::get_size($Torrent['Size'])?></td>
<td><?=number_format($Torrent['Snatched'])?></td>
@ -321,12 +306,12 @@ function compare($X, $Y){
?>
<li class="image_group_<?=$GroupID?>">
<a href="torrents.php?id=<?=$GroupID?>">
<? if($Image) {
<? if($WikiImage) {
if(check_perms('site_proxy_images')) {
$Image = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?i='.urlencode($Image);
$WikiImage = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?i='.urlencode($WikiImage);
}
?>
<img src="<?=to_thumbnail($Image)?>" alt="<?=$DisplayName?>" title="<?=$DisplayName?>" width="118" />
<img src="<?=ImageTools::thumbnail($WikiImage)?>" alt="<?=$DisplayName?>" title="<?=$DisplayName?>" width="118" />
<? } else { ?>
<span style="width:107px;padding:5px"><?=$DisplayName?></span>
<? } ?>
@ -425,9 +410,9 @@ function compare($X, $Y){
<ul id="list" class="nobullet">
<? foreach ($ZIPList as $ListItem) { ?>
<li id="list<?=$ListItem?>">
<input type="hidden" name="list[]" value="<?=$ListItem?>" />
<span style="float:left;"><?=$ZIPOptions[$ListItem]['2']?></span>
<span class="remove remove_collector"><a href="#" onclick="remove_selection('<?=$ListItem?>');return false;" style="float:right;" class="brackets">X</a></span>
<input type="hidden" name="list[]" value="<?=$ListItem?>" />
<span class="float_left"><?=$ZIPOptions[$ListItem]['2']?></span>
<span class="remove remove_collector"><a href="#" onclick="remove_selection('<?=$ListItem?>');return false;" class="float_right brackets">X</a></span>
<br style="clear:all;" />
</li>
<? } ?>
@ -481,15 +466,9 @@ function compare($X, $Y){
<div class="pad">
<ol style="padding-left:5px;">
<?
uasort($Tags, 'compare');
$i = 0;
foreach ($Tags as $TagName => $Tag) {
$i++;
if($i>5) { break; }
?>
<li><a href="collages.php?action=search&amp;tags=<?=$TagName?>"><?=$TagName?></a> (<?=$Tag['count']?>)</li>
<?
}
if (isset($TorrentTags)) {
$TorrentTags->format_top(5, 'collages.php?action=search&amp;tags=');
}
?>
</ol>
</div>
@ -535,7 +514,7 @@ function compare($X, $Y){
</div>
<? if(check_perms('site_collages_manage') && !$PreventAdditions) { ?>
<div class="box box_addtorrent">
<div class="head"><strong>Add torrent</strong><span style="float: right"><a href="#" onclick="$('.add_torrent_container').toggle_class('hidden'); this.innerHTML = (this.innerHTML == 'Batch add'?'Individual add':'Batch add'); return false;" class="brackets">Batch add</a></span></div>
<div class="head"><strong>Add torrent</strong><span class="float_right"><a href="#" onclick="$('.add_torrent_container').toggle_class('hidden'); this.innerHTML = (this.innerHTML == 'Batch add'?'Individual add':'Batch add'); return false;" class="brackets">Batch add</a></span></div>
<div class="pad add_torrent_container">
<form class="add_form" name="torrent" action="collages.php" method="post">
<input type="hidden" name="action" value="add_torrent" />

View File

@ -61,9 +61,6 @@
error(403);
}
require(SERVER_ROOT.'/classes/class_bencode.php');
require(SERVER_ROOT.'/classes/class_torrent.php');
$Preferences = array('RemasterTitle DESC', 'Seeders ASC', 'Size ASC');
$CollageID = $_REQUEST['collageid'];
@ -147,16 +144,7 @@
$Collector->skip_file($Download);
continue;
}
if (Misc::is_new_torrent($TorrentFile)) {
$TorEnc = BEncTorrent::add_announce_url($TorrentFile, ANNOUNCE_URL."/$LoggedUser[torrent_pass]/announce");
} else {
$Contents = unserialize(base64_decode($TorrentFile));
$Tor = new TORRENT($Contents, true);
$Tor->set_announce_url(ANNOUNCE_URL."/$LoggedUser[torrent_pass]/announce");
unset($Tor->Val['announce-list']);
$TorEnc = $Tor->enc();
}
$Collector->add_file($TorEnc, $Download);
$Collector->add_file($TorrentFile, $Download);
unset($Download);
}
}

View File

@ -77,9 +77,9 @@
<?
$Number = 0;
foreach ($TorrentList as $GroupID=>$Group) {
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Torrents, $GroupArtists, $ExtendedArtists) = array_values($Group);
list($GroupID2, $UserID, $Username, $Sort, $CatNum) = array_values($CollageDataList[$GroupID]);
foreach ($TorrentList as $GroupID => $Group) {
extract(Torrents::array_group($Group));
list(, $UserID, $Username, $Sort, $CatNum) = array_values($CollageDataList[$GroupID]);
$Number++;
@ -88,8 +88,8 @@
unset($ExtendedArtists[2]);
unset($ExtendedArtists[3]);
$DisplayName .= Artists::display_artists($ExtendedArtists, true, false);
} elseif(count($GroupArtists)>0) {
$DisplayName .= Artists::display_artists(array('1'=>$GroupArtists), true, false);
} elseif(count($Artists)>0) {
$DisplayName .= Artists::display_artists(array('1'=>$Artists), true, false);
}
$TorrentLink = '<a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$GroupName.'</a>';
$GroupYear = $GroupYear > 0 ? $GroupYear : '';

View File

@ -11,7 +11,7 @@
<div class="box">
<div class="head colhead_dark"><strong>Featured Album</strong></div>
<div class="center pad"><?=Artists::display_artists($Artists, true, true)?><a href="torrents.php?id=<?=$FeaturedAlbum['GroupID']?>"><?=$FeaturedAlbum['Name']?></a></div>
<div class="center"><a href="torrents.php?id=<?=$FeaturedAlbum['GroupID']?>" title="<?=Artists::display_artists($Artists, false, false)?> - <?=$FeaturedAlbum['Name']?>"><img src="<?=$FeaturedAlbum['WikiImage']?>" alt="<?=Artists::display_artists($Artists, false, false)?> - <?=$FeaturedAlbum['Name']?>" width="100%" /></a></div>
<div class="center"><a href="torrents.php?id=<?=$FeaturedAlbum['GroupID']?>" title="<?=Artists::display_artists($Artists, false, false)?> - <?=$FeaturedAlbum['Name']?>"><img src="<?=ImageTools::thumbnail($FeaturedAlbum['WikiImage'])?>" alt="<?=Artists::display_artists($Artists, false, false)?> - <?=$FeaturedAlbum['Name']?>" width="100%" /></a></div>
<div class="center pad"><a href="forums.php?action=viewthread&amp;threadid=<?=$FeaturedAlbum['ThreadID']?>"><em>Read the interview with the artist, discuss here</em></a></div>
</div>
<?

View File

@ -6,7 +6,6 @@
include(SERVER_ROOT.'/sections/bookmarks/functions.php'); // has_bookmarked()
include(SERVER_ROOT.'/classes/class_text.php');
include(SERVER_ROOT.'/classes/class_image_tools.php');
$Text = new TEXT;
@ -133,7 +132,7 @@
$Image = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?i='.urlencode($Image);
}
?>
<p align="center"><img style="max-width: 220px;" src="<?=to_thumbnail($Image)?>" alt="<?=$FullName?>" onclick="lightbox.init('<?=$Image?>',220);" /></p>
<p align="center"><img style="max-width: 220px;" src="<?=ImageTools::thumbnail($Image)?>" alt="<?=$FullName?>" onclick="lightbox.init('<?=$Image?>',220);" /></p>
<? } else { ?>
<p align="center"><img src="<?=STATIC_SERVER?>common/noartwork/<?=$CategoryIcons[$CategoryID-1]?>" alt="<?=$CategoryName?>" title="<?=$CategoryName?>" width="220" height="220" border="0" /></p>
<? } ?>

View File

@ -2,7 +2,6 @@
//******************************************************************************//
//----------------- Take request -----------------------------------------------//
include(SERVER_ROOT.'/classes/class_image_tools.php');
authorize();
@ -90,7 +89,7 @@
if(empty($_POST['image'])) {
$Image = "";
} else {
check_imagehost($_POST['image']);
ImageTools::blacklisted($_POST['image']);
if(preg_match("/".IMAGE_REGEX."/", trim($_POST['image'])) > 0) {
$Image = trim($_POST['image']);
} else {

View File

@ -139,38 +139,20 @@
}
$DisplayName .= $ExtraInfo;
$TorrentTags = explode(' ',$TorrentTags);
$TorrentTags = new Tags($TorrentTags);
} else {
$DisplayName = $TitleString." (Deleted)";
$TorrentTags = $TagString;
$TorrentTags = new Tags($TagString);
}
$TagList=array();
$PrimaryTag = '';
if($TorrentTags!='') {
foreach ($TorrentTags as $TagKey => $TagName) {
$TagName = str_replace('_','.',$TagName);
$TagList[]='<a href="torrents.php?taglist='.$TagName.'">'.$TagName.'</a>';
}
$PrimaryTag = $TorrentTags[0];
$TagList = implode(', ', $TagList);
$TorrentTags='<br /><div class="tags">'.$TagList.'</div>';
}
$TorrentTags = '<br /><div class="tags">'.$TagList.'</div>';
?>
<tr class="group_torrent row<?=$Highlight?>">
<td style="padding:8px;text-align:center;"><strong><?=$Rank?></strong></td>
<?
//fix array offset php error
if ($GroupCategoryID > 0) {
$GroupCatOffset = $GroupCategoryID - 1;
}
?>
<td class="center cats_col"><div title="<?=ucfirst(str_replace('_',' ',$PrimaryTag))?>" class="cats_<?=strtolower(str_replace(array('-',' '),array('',''),$Categories[$GroupCatOffset]))?> tags_<?=str_replace('.','_',$PrimaryTag)?>"></div></td>
<td class="center cats_col"><div title="<?=$TorrentTags->title()?>" class="<?=Format::css_category($GroupCategoryID)?> <?=$TorrentTags->css_name()?>"></div></td>
<td>
<span><?=($GroupID ? '<a href="torrents.php?action=download&amp;id='.$TorrentID.'&amp;authkey='.$LoggedUser['AuthKey'].'&amp;torrent_pass='.$LoggedUser['torrent_pass'].' title="Download" class="brackets">DL</a>' : '(Deleted)')?></span>
<?=$DisplayName?>
<?=$TorrentTags?>
<div class="tags"><?=$TorrentTags->format()?></div>
</td>
</tr>
<?

View File

@ -12,7 +12,6 @@
die();
}
if(empty($_GET['type']) || $_GET['type'] == 'torrents') {
include(SERVER_ROOT.'/sections/top10/torrents.php');
} else {

View File

@ -140,6 +140,7 @@
g.ID,
g.Name,
g.CategoryID,
g.wikiImage,
g.TagList,
t.Format,
t.Encoding,
@ -413,7 +414,7 @@ function generate_torrent_table($Caption, $Tag, $Details, $Limit) {
$Artists = Artists::get_artists($GroupIDs);
foreach ($Details as $Detail) {
list($TorrentID,$GroupID,$GroupName,$GroupCategoryID,$TorrentTags,
list($TorrentID,$GroupID,$GroupName,$GroupCategoryID,$WikiImage,$TagsList,
$Format,$Encoding,$Media,$Scene,$HasLog,$HasCue,$LogScore,$Year,$GroupYear,
$RemasterTitle,$Snatched,$Seeders,$Leechers,$Data,$ReleaseType) = $Detail;
@ -458,46 +459,36 @@ function generate_torrent_table($Caption, $Tag, $Details, $Limit) {
$ExtraInfo = "- [$ExtraInfo]";
}
$TagList=array();
$PrimaryTag = '';
if($TorrentTags!='') {
$TorrentTags=explode(' ',$TorrentTags);
foreach ($TorrentTags as $TagKey => $TagName) {
$TagName = str_replace('_','.',$TagName);
$TagList[]='<a href="torrents.php?taglist='.$TagName.'">'.$TagName.'</a>';
}
$PrimaryTag = $TorrentTags[0];
$TagList = implode(', ', $TagList);
$TorrentTags='<br /><div class="tags">'.$TagList.'</div>';
}
$TorrentTags = new Tags($TagsList);
// print row
?>
<tr class="torrent row<?=$Highlight . ($IsBookmarked ? ' bookmarked' : '') . ($IsSnatched ? ' snatched_torrent' : '')?>">
<td style="padding:8px;text-align:center;"><strong><?=$Rank?></strong></td>
<?
//fix array offset php error
if ($GroupCategoryID > 0) {
$GroupCatOffset = $GroupCategoryID - 1;
}
?>
<td class="center cats_col"><div title="<?=ucfirst(str_replace('_',' ',$PrimaryTag))?>" class="cats_<?=strtolower(str_replace(array('-',' '),array('',''),$Categories[$GroupCatOffset]))?> tags_<?=str_replace('.','_',$PrimaryTag)?>"></div></td>
<td>
<span><a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download" class="brackets">DL</a></span>
<td class="center cats_col"><div title="<?=$TorrentTags->title()?>" class="<?=Format::css_category($GroupCategoryID)?> <?=$TorrentTags->css_name()?>"></div></td>
<td class="big_info">
<? if ($LoggedUser['CoverArt']) : ?>
<div class="group_image float_left clear">
<? ImageTools::cover_thumb($WikiImage, $GroupCategoryID - 1) ?>
</div>
<? endif; ?>
<div class="group_info clear">
<strong><?=$DisplayName?></strong> <?=$ExtraInfo?>
<span class="bookmark" style="float:right;">
<span>[ <a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download">DL</a> ]</span>
<strong><?=$DisplayName?></strong> <?=$ExtraInfo?>
<span class="bookmark" style="float:right;">
<?
if($IsBookmarked) {
?>
<a href="#" class="bookmarklink_torrent_<?=$GroupID?> brackets remove_bookmark" title="Remove bookmark" onclick="Unbookmark('torrent',<?=$GroupID?>,'Bookmark');return false;">Unbookmark</a>
<a href="#" id="bookmarklink_torrent_<?=$GroupID?>" class="remove_bookmark" title="Remove bookmark" onclick="Unbookmark('torrent',<?=$GroupID?>,'Bookmark');return false;">Unbookmark</a>
<? } else { ?>
<a href="#" class="bookmarklink_torrent_<?=$GroupID?> brackets add_bookmark" title="Add bookmark" onclick="Bookmark('torrent',<?=$GroupID?>,'Unbookmark');return false;">Bookmark</a>
<a href="#" id="bookmarklink_torrent_<?=$GroupID?>" class="add_bookmark" title="Add bookmark" onclick="Bookmark('torrent',<?=$GroupID?>,'Unbookmark');return false;">Bookmark</a>
<? } ?>
</span>
</span>
<div class="tags"><?=$TorrentTags->format()?></div>
<?=$TorrentTags?>
</div>
</td>
<td style="text-align:right" class="nobr"><?=Format::get_size($Data)?></td>
<td style="text-align:right"><?=number_format((double) $Snatched)?></td>

View File

@ -64,16 +64,10 @@
$Data = $DB->to_array('GroupID');
$Groups = Torrents::get_groups($Results);
if (count($Results) > 0) {
$DB->query('SELECT ID, CategoryID FROM torrents_group
WHERE ID IN ('.implode(',', $Results).')');
$Cats = $DB->to_array('ID');
}
// Make sure it's still in order.
$TopVotes = array();
foreach ($Results as $GroupID) {
$TopVotes[$GroupID] = $Groups['matches'][$GroupID];
$TopVotes[$GroupID]['CategoryID'] = $Cats[$GroupID]['CategoryID'];
$TopVotes[$GroupID]['Ups'] = $Data[$GroupID]['Ups'];
$TopVotes[$GroupID]['Total'] = $Data[$GroupID]['Total'];
$TopVotes[$GroupID]['Score'] = $Data[$GroupID]['Score'];
@ -163,10 +157,11 @@
// This code was copy-pasted from collages and should die in a fire
$Number = 0;
$NumGroups = 0;
foreach ($TopVotes as $GroupID=>$Group) {
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel,
$GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse,
$Torrents, $GroupArtists, $ExtendedArtists, $GroupFlags, $GroupCategoryID,$Ups,$Total,$Score) = array_values($Group);
foreach ($TopVotes as $GroupID => $Group) {
extract(Torrents::array_group($Group));
$Ups = $Group['Ups'];
$Total = $Group['Total'];
$Score = $Group['Score'];
$IsBookmarked = in_array($GroupID, $Bookmarks);
@ -174,14 +169,7 @@
$Number++;
$NumGroups++;
$TagList = explode(' ',str_replace('_','.',$TagList));
$TorrentTags = array();
foreach($TagList as $Tag) {
$TorrentTags[]='<a href="torrents.php?taglist='.$Tag.'">'.$Tag.'</a>';
}
$PrimaryTag = $TagList[0];
$TorrentTags = implode(', ', $TorrentTags);
$TorrentTags='<br /><div class="tags">'.$TorrentTags.'</div>';
$TorrentTags = new Tags($TagList);
$DisplayName = $Number.' - ';
@ -199,7 +187,7 @@
// Start an output buffer, so we can store this output in $TorrentTable
ob_start();
if(count($Torrents)>1 || $GroupCategoryID==1) {
if(count($Torrents) > 1 || $GroupCategoryID == 1) {
// Grouped torrents
$GroupSnatched = false;
foreach ($Torrents as &$Torrent) {
@ -217,16 +205,25 @@
</div>
</td>
<td class="center">
<div title="<?=ucfirst(str_replace('_',' ',$PrimaryTag))?>" class="cats_<?=strtolower(str_replace(array('-',' '),array('',''),$Categories[$GroupCategoryID-1]))?> tags_<?=str_replace('.','_',$PrimaryTag)?>"></div>
<div title="<?=$TorrentTags->title()?>" class="<?=Format::css_category($GroupCategoryID)?> <?=$TorrentTags->css_name()?>"></div>
</td>
<td>
<strong><?=$DisplayName?></strong> <!--<?Votes::vote_link($GroupID,$UserVotes[$GroupID]['Type']);?>-->
<td class="big_info">
<? if ($LoggedUser['CoverArt']) : ?>
<div class="group_image float_left clear">
<? ImageTools::cover_thumb($WikiImage, $GroupCategoryID - 1) ?>
</div>
<? endif; ?>
<div class="group_info clear">
<strong><?=$DisplayName?></strong> <!--<?Votes::vote_link($GroupID,$UserVotes[$GroupID]['Type']);?>-->
<? if($IsBookmarked) { ?>
<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>
<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 { ?>
<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>
<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?>
<div class="tags"><?=$TorrentTags->format()?></div>
</div>
</td>
<td colspan="4" class="votes_info_td"><strong><?=number_format($Ups)?></strong> upvotes out of <strong><?=number_format($Total)?></strong> total (<span title="Score: <?=number_format($Score*100,4)?>">Score: <?=number_format($Score*100)?></span>).</td>
</tr>
@ -325,25 +322,32 @@
<tr class="torrent torrent_row<?=$SnatchedTorrentClass . $SnatchedGroupClass?>" id="group_<?=$GroupID?>">
<td></td>
<td class="center">
<div title="<?=ucfirst(str_replace('_',' ',$PrimaryTag))?>" class="cats_<?=strtolower(str_replace(array('-',' '),array('',''),$Categories[$GroupCategoryID-1]))?> tags_<?=str_replace('.','_',$PrimaryTag)?>">
<div title="<?=$TorrentTags->title()?>" class="<?=Format::css_category($GroupCategoryID)?> <?=$TorrentTags->css_name()?>">
</div>
</td>
<td class="nobr">
<span>
[ <a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download">DL</a>
<td class="nobr big_info">
<? if ($LoggedUser['CoverArt']) : ?>
<div class="group_image float_left clear">
<? ImageTools::cover_thumb($WikiImage, $GroupCategoryID - 1) ?>
</div>
<? endif; ?>
<div class="group_info clear">
<span>
[ <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($Torrent)) { ?>
| <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>
<? if($IsBookmarked) { ?>
| <a href="#" id="bookmarklink_torrent_<?=$GroupID?>" class="remove_bookmark" title="Remove bookmark" onclick="Unbookmark('torrent',<?=$GroupID?>,'Bookmark');return false;">Unbookmark</a>
| <a href="#" id="bookmarklink_torrent_<?=$GroupID?>" class="remove_bookmark" title="Remove bookmark" onclick="Unbookmark('torrent',<?=$GroupID?>,'Bookmark');return false;">Unbookmark</a>
<? } else { ?>
| <a href="#" id="bookmarklink_torrent_<?=$GroupID?>" class="add_bookmark" title="Add bookmark" onclick="Bookmark('torrent',<?=$GroupID?>,'Unbookmark');return false;">Bookmark</a>
| <a href="#" id="bookmarklink_torrent_<?=$GroupID?>" class="add_bookmark" title="Add bookmark" onclick="Bookmark('torrent',<?=$GroupID?>,'Unbookmark');return false;">Bookmark</a>
<? } ?>
]
</span>
<strong><?=$DisplayName?></strong> <!--<?Votes::vote_link($GroupID,$UserVotes[$GroupID]['Type']);?>-->
<?=$TorrentTags?>
]
</span>
<strong><?=$DisplayName?></strong> <!--<?Votes::vote_link($GroupID,$UserVotes[$GroupID]['Type']);?>-->
<div class="tags"><?=$TorrentTags->format()?></div>
</div>
</td>
<td class="nobr"><?=Format::get_size($Torrent['Size'])?></td>
<td><?=number_format($Torrent['Snatched'])?></td>

View File

@ -812,7 +812,7 @@ function header_link($SortKey,$DefaultWay="DESC") {
}
$Artists = Artists::get_artists($GroupIDs);
foreach ($TorrentList as $Key => $Properties) {
list($GroupID,$GroupName,$GroupYear,$GroupCategoryID,$GroupTime,$MaxSize,$TotalSnatched,$TotalSeeders,$TotalLeechers,$TorrentsID,$TorrentTags,$TorrentsMedia,$TorrentsFormat,$TorrentsEncoding,$TorrentsYear,$TorrentsRemastered,$TorrentsRemasterTitle,$TorrentsScene,$TorrentsLog,$TorrentsCue,$TorrentsLogScores,$TorrentsFileCount,$TorrentsFreeTorrent,$TorrentsSize,$TorrentsLeechers,$TorrentsSeeders,$TorrentsSnatched,$TorrentsTime) = $Properties;
list($GroupID,$GroupName,$GroupYear,$GroupCategoryID,$GroupTime,$MaxSize,$TotalSnatched,$TotalSeeders,$TotalLeechers,$TorrentsID,$TagsList,$TorrentsMedia,$TorrentsFormat,$TorrentsEncoding,$TorrentsYear,$TorrentsRemastered,$TorrentsRemasterTitle,$TorrentsScene,$TorrentsLog,$TorrentsCue,$TorrentsLogScores,$TorrentsFileCount,$TorrentsFreeTorrent,$TorrentsSize,$TorrentsLeechers,$TorrentsSeeders,$TorrentsSnatched,$TorrentsTime) = $Properties;
$Torrents['id'] =explode('|',$TorrentsID);
$Torrents['media'] =explode('|',$TorrentsMedia);
$Torrents['format'] =explode('|',$TorrentsFormat);
@ -859,17 +859,7 @@ function header_link($SortKey,$DefaultWay="DESC") {
$Torrents['snatched'][0]=$TotalSnatched;
}
$TagList=array();
if($TorrentTags!='') {
$TorrentTags=explode(' ',$TorrentTags);
foreach ($TorrentTags as $TagKey => $TagName) {
$TagName = str_replace('_','.',$TagName);
$TagList[]='<a href="torrents.php?searchtags='.$TagName.'">'.$TagName.'</a>';
}
$PrimaryTag = $TorrentTags[0];
$TagList = implode(', ', $TagList);
$TorrentTags='<br /><div class="tags">'.$TagList.'</div>';
}
$TorrentTags = new Tags($TagsList);
if ($GroupName=='') { $GroupName="- None -"; }
$DisplayName = Artists::display_artists($Artists[$GroupID]);
@ -880,11 +870,23 @@ function header_link($SortKey,$DefaultWay="DESC") {
?>
<tr class="group">
<td class="center"><div title="<?=$ActionTitle?>" id="showimg_<?=$GroupID?>" class="<?=$ActionURL?>_torrents"><a href="#" class="show_torrents_link" onclick="$('.groupid_<?=$GroupID?>').toggle(); return false;"></a></div></td>
<td class="center cats_col"><div title="<?=ucfirst(str_replace('_',' ',$PrimaryTag))?>" class="cats_<?=strtolower(str_replace(array('-',' '),array('',''),$Categories[$GroupCategoryID-1]))?> tags_<?=str_replace('.','_',$PrimaryTag)?>"></div></td>
<td colspan="2">
<?=$DisplayName?>
<span style="float:right;"><a href="#showimg_<?=$GroupID?>" onclick="Bookmark(<?=$GroupID?>);this.innerHTML='Bookmarked';return false;" class="brackets">Bookmark</a></span>
<?=$TorrentTags?>
<td class="center cats_col"><div title="<?=$TorrentTags->title()?>" class="<?=Format::css_category($GroupCategoryID)?> <?=$TorrentTags->css_name()?>"></div></td>
<td colspan="2" class="big_info">
<?
// Image cover art requires WikiImage
/*
if ($LoggedUser['CoverArt']) : ?>
<div class="group_image float_left clear">
<? ImageTools::cover_thumb('', $GroupCategoryID - 1) ?>
</div>
<? endif;
*/
?>
<div class="group_info clear">
<?=$DisplayName?>
<span style="float:right;"><a href="#showimg_<?=$GroupID?>" onclick="Bookmark(<?=$GroupID?>);this.innerHTML='Bookmarked';return false;" class="brackets">Bookmark</a></span>
<div class="tags"><?=$TorrentTags->format('torrents.php?searchtags=')?></div>
</div>
</td>
<td class="nobr"><?=time_diff($GroupTime,1)?></td>
<td class="nobr"><?=Format::get_size($MaxSize)?> (Max)</td>
@ -998,12 +1000,19 @@ function header_link($SortKey,$DefaultWay="DESC") {
<? if(!$DisableGrouping) { ?>
<td></td>
<? } ?>
<td class="center cats_col"><div title="<?=ucfirst(str_replace('.',' ',$PrimaryTag))?>" class="cats_<?=strtolower(str_replace(array('-',' '),array('',''),$Categories[$GroupCategoryID-1]))?> tags_<?=str_replace('.','_',$PrimaryTag)?>"></div></td>
<td>
<span>[ <a href="torrents.php?action=download&amp;id=<?=$Torrents['id'][0].$DownloadString?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download">DL</a> | <a href="reportsv2.php?action=report&amp;id=<?=$Torrents['id'][0]?>" title="Report">RP</a> ]</span>
<?=$DisplayName?>
<?=$ExtraInfo?>
<?=$TorrentTags?>
<td class="center cats_col"><div title="<?=$TorrentTags->title()?>" class="<?=Format::css_category($GroupCategoryID)?> <?=$TorrentTags->css_name()?>"></div></td>
<td class="big_info">
<? /* if ($LoggedUser['CoverArt']) : ?>
<div class="group_image float_left clear">
<? ImageTools::cover_thumb('', $GroupCategoryID - 1) ?>
</div>
<? endif; */ ?>
<div class="group_info">
<span>[ <a href="torrents.php?action=download&amp;id=<?=$Torrents['id'][0].$DownloadString?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download">DL</a> | <a href="reportsv2.php?action=report&amp;id=<?=$Torrents['id'][0]?>" title="Report">RP</a> ]</span>
<?=$DisplayName?>
<?=$ExtraInfo?>
<div class="tags"><?=$TorrentTags->format()?></div>
</div>
</td>
<td><?=$Torrents['filecount'][0]?></td>
<td class="nobr"><?=time_diff($GroupTime,1)?></td>

View File

@ -540,7 +540,6 @@ function header_link($SortKey,$DefaultWay="desc") {
$AdvancedSearch = !empty($_GET['action']) && $_GET['action'] == "advanced";
$AdvancedSearch |= !empty($LoggedUser['SearchType']) && (empty($_GET['action']) || $_GET['action'] == "advanced");
$AdvancedSearch &= check_perms('site_advanced_search');
if ($AdvancedSearch) {
$Action = 'action=advanced';
$HideBasic = ' hidden';
@ -579,7 +578,6 @@ function header_link($SortKey,$DefaultWay="desc") {
<td class="label">Artist name:</td>
<td colspan="3" class="ft_artistname">
<input type="text" spellcheck="false" size="40" name="artistname" class="inputtext smaller fti_advanced" value="<?Format::form('artistname')?>" />
<input type="hidden" name="action" value="advanced" class="fti_advanced"<?=$AdvancedSearch ? '' : ' disabled="disabled"'?> />
</td>
</tr>
<tr id="album_torrent_name" class="ftr_advanced<?=$HideAdvanced?>">
@ -709,9 +707,6 @@ function header_link($SortKey,$DefaultWay="desc") {
<td class="label">Search terms:</td>
<td colspan="3" class="ftb_searchstr">
<input type="text" spellcheck="false" size="40" name="searchstr" class="inputtext fti_basic" value="<?Format::form('searchstr')?>" />
<? if (!empty($LoggedUser['SearchType'])) { ?>
<input type="hidden" name="action" value="basic" class="fti_basic" />
<? } ?>
</td>
</tr>
<tr id="tagfilter">
@ -812,6 +807,7 @@ function header_link($SortKey,$DefaultWay="desc") {
<div class="submit ft_submit">
<span style="float:left;"><?=number_format($TorrentCount)?> Results</span>
<input type="submit" value="Filter Torrents" />
<input type="hidden" name="action" id="ft_type" value="<?=$AdvancedSearch ? 'advanced' : 'basic'?>" />
<input type="hidden" name="searchsubmit" value="1" />
<input type="button" value="Reset" onclick="location.href='torrents.php<? if (isset($_GET['action']) && $_GET['action']=="advanced") { ?>?action=advanced<? } ?>'" />
&nbsp;&nbsp;
@ -925,13 +921,8 @@ function header_link($SortKey,$DefaultWay="desc") {
} else {
$Torrents = array($Result['id'] => $GroupInfo['Torrents'][$Result['id']]);
}
$TagList = explode(' ',str_replace('_','.',$GroupInfo['TagList']));
$TorrentTags = array();
foreach ($TagList as $Tag) {
$TorrentTags[]='<a href="torrents.php?'.$Action.'&amp;taglist='.$Tag.'">'.$Tag.'</a>';
}
$TorrentTags = implode(', ', $TorrentTags);
$TorrentTags = new Tags($GroupInfo['TagList']);
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
unset($ExtendedArtists[2]);
@ -963,19 +954,24 @@ function header_link($SortKey,$DefaultWay="desc") {
</div>
</td>
<td class="center cats_col">
<div title="<?=ucfirst(str_replace('_',' ',$TagList[0]))?>" class="cats_<?=strtolower(str_replace(array('-',' '),array('',''),$Categories[$CategoryID-1]))?> tags_<?=str_replace('.','_',$TagList[0])?>">
<div title="<?=$TorrentTags->title()?>" class="<?=Format::css_category($CategoryID)?> <?=$TorrentTags->css_name()?>">
</div>
</td>
<td colspan="2">
<?=$DisplayName?>
<td colspan="2" class="big_info">
<? if ($LoggedUser['CoverArt']) : ?>
<div class="group_image float_left clear">
<? ImageTools::cover_thumb($GroupInfo['WikiImage'], $GroupInfo['CategoryID'] - 1) ?>
</div>
<? endif; ?>
<div class="group_info clear">
<?=$DisplayName?>
<? if (in_array($GroupID, $Bookmarks)) { ?>
<span class="remove_bookmark" style="float:right;"><a href="#" id="bookmarklink_torrent_<?=$GroupID?>" class="brackets" title="Remove bookmark" onclick="Unbookmark('torrent',<?=$GroupID?>,'Bookmark');return false;">Unbookmark</a></span>
<span class="remove_bookmark float_right"><a href="#" id="bookmarklink_torrent_<?=$GroupID?>" class="brackets" title="Remove bookmark" onclick="Unbookmark('torrent',<?=$GroupID?>,'Bookmark');return false;">Unbookmark</a></span>
<? } else { ?>
<span class="add_bookmark" style="float:right;"><a href="#" id="bookmarklink_torrent_<?=$GroupID?>" class="brackets" title="Add bookmark" onclick="Bookmark('torrent',<?=$GroupID?>,'Unbookmark');return false;">Bookmark</a></span>
<span class="add_bookmark float_right"><a href="#" id="bookmarklink_torrent_<?=$GroupID?>" class="brackets" title="Add bookmark" onclick="Bookmark('torrent',<?=$GroupID?>,'Unbookmark');return false;">Bookmark</a></span>
<? } ?>
<br />
<div class="tags">
<?=$TorrentTags?>
<br />
<div class="tags"><?=$TorrentTags->format('torrents.php?'.$Action.'&amp;taglist=')?></div>
</div>
</td>
<td class="nobr"><?=time_diff($GroupTime,1)?></td>
@ -1098,19 +1094,26 @@ function header_link($SortKey,$DefaultWay="desc") {
<td></td>
<? } ?>
<td class="center cats_col">
<div title="<?=ucfirst(str_replace('.',' ',$TagList[0]))?>" class="cats_<?=strtolower(str_replace(array('-',' '),array('',''),$Categories[$CategoryID-1]))?> tags_<?=str_replace('.','_',$TagList[0])?>"></div>
<div title="<?=$TorrentTags->title()?>" class="<?=Format::css_category($CategoryID)?> <?=$TorrentTags->css_name()?>"></div>
</td>
<td>
<span>
[ <a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download">DL</a>
<td class="big_info">
<? if ($LoggedUser['CoverArt']) : ?>
<div class="group_image float_left clear">
<? ImageTools::cover_thumb($GroupInfo['WikiImage'], $CategoryID - 1) ?>
</div>
<? endif; ?>
<div class="group_info clear">
<span>
[ <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)) { ?>
| <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> ]
</span>
<?=$DisplayName?>
<div class="torrent_info"><?=$ExtraInfo?></div>
<div class="tags"><?=$TorrentTags?></div>
| <a href="reportsv2.php?action=report&amp;id=<?=$TorrentID?>" title="Report">RP</a> ]
</span>
<?=$DisplayName?>
<div class="torrent_info"><?=$ExtraInfo?></div>
<div class="tags"><?=$TorrentTags->format('torrents.php?'.$Action.'&amp;taglist=')?></div>
</div>
</td>
<td><?=$Data['FileCount']?></td>
<td class="nobr"><?=time_diff($Data['Time'],1)?></td>

View File

@ -9,7 +9,6 @@ function compare($X, $Y){
include(SERVER_ROOT.'/sections/bookmarks/functions.php'); // has_bookmarked()
include(SERVER_ROOT.'/classes/class_text.php');
include(SERVER_ROOT.'/classes/class_image_tools.php');
$Text = NEW TEXT;
@ -114,11 +113,12 @@ function compare($X, $Y){
<div class="head"><strong>Cover</strong></div>
<?
if ($WikiImage!="") {
$WikiImageThumb = ImageTools::wiki_image($WikiImage);
if(check_perms('site_proxy_images')) {
$WikiImage = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?i='.urlencode($WikiImage);
$WikiImage = ImageTools::proxy_url($WikiImage);
}
?>
<p align="center"><img style="max-width: 220px;" src="<?=to_thumbnail($WikiImage)?>" alt="<?=$AltName?>" onclick="lightbox.init('<?=$WikiImage?>',220);" /></p>
<p align="center"><img style="max-width: 220px;" src="<?=$WikiImageThumb?>" alt="<?=$AltName?>" onclick="lightbox.init('<?=$WikiImage?>',220);" /></p>
<?
} else {
?>

View File

@ -147,32 +147,15 @@
$DB->query("SELECT File FROM torrents_files WHERE TorrentID='$TorrentID'");
list($Contents) = $DB->next_record(MYSQLI_NUM, false);
if (Misc::is_new_torrent($Contents)) {
require(SERVER_ROOT.'/classes/class_bencode.php');
$TorEnc = BEncTorrent::add_announce_url($Contents, ANNOUNCE_URL."/$TorrentPass/announce");
} else {
require(SERVER_ROOT.'/classes/class_torrent.php');
$Contents = unserialize(base64_decode($Contents));
$Tor = new TORRENT($Contents, true); // New TORRENT object
// Set torrent announce URL
$Tor->set_announce_url(ANNOUNCE_URL."/$TorrentPass/announce");
// Remove multiple trackers from torrent
unset($Tor->Val['announce-list']);
// Remove web seeds (put here for old torrents not caught by previous commit
unset($Tor->Val['url-list']);
// Remove libtorrent resume info
unset($Tor->Val['libtorrent_resume']);
$TorEnc = $Tor->enc();
}
$FileName = TorrentsDL::construct_file_name($Info['PlainArtists'], $Name, $Year, $Media, $Format, $Encoding, false, $DownloadAlt);
if($DownloadAlt) {
if ($DownloadAlt) {
header('Content-Type: text/plain; charset=utf-8');
} elseif(!$DownloadAlt || $Failed) {
} else if (!$DownloadAlt || $Failed) {
header('Content-Type: application/x-bittorrent; charset=utf-8');
}
header('Content-disposition: attachment; filename="'.$FileName.'"');
echo $TorEnc;
echo TorrentsDL::get_file($Contents, ANNOUNCE_URL."/$TorrentPass/announce");
define('IE_WORKAROUND_NO_CACHE_HEADERS', 1);

View File

@ -108,10 +108,6 @@ function header_link($SortKey, $DefaultWay = "desc") {
$TorrentGroups = Torrents::get_groups($GroupIDs);
$TorrentGroups = $TorrentGroups['matches'];
// Need some extra info that Torrents::get_groups() doesn't return
$DB->query("SELECT ID, CategoryID FROM torrents_group WHERE ID IN (".implode(',', $GroupIDs).")");
$GroupCategoryIDs = $DB->to_array('ID', MYSQLI_ASSOC, false);
// Get the relevant filter labels
$DB->query("SELECT ID, Label, Artists FROM users_notify_filters WHERE ID IN (".implode(',', $FilterIDs).")");
$Filters = $DB->to_array('ID', MYSQLI_ASSOC, array('Artists'));
@ -234,7 +230,7 @@ function header_link($SortKey, $DefaultWay = "desc") {
}
$DisplayName .= "<a href='torrents.php?id=$GroupID&amp;torrentid=$TorrentID#torrent$TorrentID' title='View Torrent'>".$GroupInfo['Name']."</a>";
$GroupCategoryID = $GroupCategoryIDs[$GroupID]['CategoryID'];
$GroupCategoryID = $GroupInfo['CategoryID'];
if ($GroupCategoryID == 1) {
if ($GroupInfo['Year'] > 0) {
$DisplayName .= " [$GroupInfo[Year]]";
@ -247,42 +243,39 @@ function header_link($SortKey, $DefaultWay = "desc") {
// append extra info to torrent title
$ExtraInfo = Torrents::torrent_info($TorrentInfo, true, true);
$TagLinks = array();
if ($GroupInfo['TagList'] != '') {
$TorrentTags = array();
$TagList = explode(' ', $GroupInfo['TagList']);
$MainTag = $TagList[0];
foreach ($TagList as $Tag) {
$Tag = str_replace('_', '.', $Tag);
$TorrentTags[] = '<a href="torrents.php?taglist='.$Tag.'">'.$Tag.'</a>';
}
$TorrentTags = implode(', ', $TorrentTags);
} else {
$TorrentTags = '';
$MainTag = $Categories[$GroupCategoryID-1];
}
$TorrentTags = new Tags($GroupInfo['TagList']);
if ($GroupInfo['TagList'] == '')
$TorrentTags->set_primary($Categories[$GroupCategoryID-1]);
// print row
?>
<tr class="torrent torrent_row<?=($TorrentInfo['IsSnatched'] ? ' snatched_torrent' : '') . ($GroupInfo['Flags']['IsSnatched'] ? ' snatched_group' : '')?>" id="torrent<?=$TorrentID?>"<?=$MatchingArtistsText ? 'title="'.display_str($MatchingArtistsText).'"' : ''?>>
<td style="text-align: center"><input type="checkbox" class="notify_box notify_box_<?=$FilterID?>" value="<?=$TorrentID?>" id="clear_<?=$TorrentID?>" /></td>
<td class="center cats_col"><div title="<?=ucfirst(str_replace('_',' ',$MainTag))?>" class="cats_<?=strtolower(str_replace(array('-',' '),array('',''),$Categories[$GroupCategoryID-1])).' tags_'.str_replace('.','_',$MainTag)?>"></div></td>
<td>
<span>
[ <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($TorrentInfo)) { ?>
| <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="#" onclick="Clear(<?=$TorrentID?>);return false;" title="Remove from notifications list">CL</a> ]
</span>
<strong><?=$DisplayName?></strong>
<div class="torrent_info">
<?=$ExtraInfo?>
<? if ($Result['UnRead']) {
echo '<strong class="new">New!</strong>';
} ?>
<td class="center cats_col"><div title="<?=$TorrentTags->title()?>"class="<?=Format::css_category($GroupCategoryID)?> <?=$TorrentTags->css_name()?>"></div></td>
<td class="big_info">
<? if ($LoggedUser['CoverArt']) : ?>
<div class="group_image float_left clear">
<? ImageTools::cover_thumb($GroupInfo['WikiImage'], $GroupCategoryID - 1) ?>
</div>
<? endif; ?>
<div class="group_info clear">
<span>
[ <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($TorrentInfo)) { ?>
| <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="#" onclick="clearItem(<?=$TorrentID?>);return false;" title="Remove from notifications list">CL</a>
</span>
<strong><?=$DisplayName?></strong>
<div class="torrent_info">
<?=$ExtraInfo?>
<? if ($Result['UnRead']) {
echo '<strong class="new">New!</strong>';
} ?>
</div>
<div class="tags"><?=$TorrentTags->format()?></div>
</div>
<div class="tags"><?=$TorrentTags?></div>
</td>
<td><?=$TorrentInfo['FileCount']?></td>
<td style="text-align:right" class="nobr"><?=time_diff($TorrentInfo['Time'])?></td>

View File

@ -14,9 +14,6 @@
$UserClass = $Perms['Class'];
list($UserID, $Username) = array_values($User);
require(SERVER_ROOT.'/classes/class_bencode.php');
require(SERVER_ROOT.'/classes/class_torrent.php');
if (empty($_GET['type'])) {
error(0);
} else {
@ -81,16 +78,7 @@
while (list($TorrentID, $TorrentFile) = $DB->next_record(MYSQLI_NUM, false)) {
$Download =& $Downloads[$TorrentID];
$Download['Artist'] = Artists::display_artists($Artists[$Download['GroupID']], false, true, false);
if (Misc::is_new_torrent($TorrentFile)) {
$TorEnc = BEncTorrent::add_announce_url($TorrentFile, ANNOUNCE_URL."/$LoggedUser[torrent_pass]/announce");
} else {
$Contents = unserialize(base64_decode($TorrentFile));
$Tor = new TORRENT($Contents, true);
$Tor->set_announce_url(ANNOUNCE_URL."/$LoggedUser[torrent_pass]/announce");
unset($Tor->Val['announce-list']);
$TorEnc = $Tor->enc();
}
$Collector->add_file($TorEnc, $Download, $Download['Month']);
$Collector->add_file($TorrentFile, $Download, $Download['Month']);
unset($Download);
}
}

View File

@ -14,10 +14,10 @@
$Group = Torrents::get_groups(array($GroupID));
$Group = array_pop($Group['matches']);
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Torrents, $GroupArtists) = array_values($Group);
extract(Torrents::array_group($Group));
$Name = '';
$Name .= Artists::display_artists(array('1'=>$GroupArtists), false, true);
$Name .= Artists::display_artists(array('1'=>$Artists), false, true);
$Name .= $GroupName;
$DB->query("SELECT uid, tstamp FROM xbt_snatched WHERE fid='$TorrentID' ORDER BY tstamp DESC LIMIT 10");

View File

@ -11,7 +11,6 @@
require(SERVER_ROOT.'/classes/class_validate.php');
include(SERVER_ROOT.'/classes/class_image_tools.php');
$Validate = new VALIDATE;
@ -225,7 +224,7 @@
if (preg_match($RegX, $Properties['Image'], $Matches)) {
$Properties['Image'] = $Matches[1].'.jpg';
}
check_imagehost($Properties['Image']);
ImageTools::blacklisted($Properties['Image']);
if($Err){ // Show the upload form, with the data the user entered
if(check_perms('site_debug')) {

View File

@ -3,7 +3,6 @@
authorize();
include(SERVER_ROOT.'/classes/class_text.php');
include(SERVER_ROOT.'/classes/class_image_tools.php');
$Text = new TEXT;
// Quick SQL injection check
@ -76,7 +75,7 @@
if(!preg_match("/^".IMAGE_REGEX."$/i", $Image)) {
$Image = '';
}
check_imagehost($Image);
ImageTools::blacklisted($Image);
$Summary = db_string($_POST['summary']);
}

View File

@ -1,5 +1,4 @@
<?
$Orders = array('Time', 'Name', 'Seeders', 'Leechers', 'Snatched', 'Size');
$Ways = array('ASC'=>'Ascending', 'DESC'=>'Descending');
$UserVotes = Votes::get_user_votes($LoggedUser['ID']);
@ -421,19 +420,14 @@ function header_link($SortKey,$DefaultWay="DESC") {
</tr>
<?
$Results = $Results['matches'];
foreach($TorrentsInfo as $TorrentID=>$Info) {
list($GroupID,, $Time, $CategoryID) = array_values($Info);
foreach($TorrentsInfo as $TorrentID => $Info) {
list($GroupID, , $Time) = array_values($Info);
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Torrents, $Artists, $ExtendedArtists, $GroupFlags) = array_values($Results[$GroupID]);
extract(Torrents::array_group($Results[$GroupID]));
$Torrent = $Torrents[$TorrentID];
$TagList = explode(' ',str_replace('_','.',$TagList));
$TorrentTags = array();
foreach($TagList as $Tag) {
$TorrentTags[]='<a href="torrents.php?type='.$Action.'&amp;userid='.$UserID.'&amp;tags='.$Tag.'">'.$Tag.'</a>';
}
$TorrentTags = implode(', ', $TorrentTags);
$TorrentTags = new Tags($TagList);
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5])) {
unset($ExtendedArtists[2]);
@ -455,17 +449,21 @@ function header_link($SortKey,$DefaultWay="DESC") {
?>
<tr class="torrent torrent_row<?=($Torrent['IsSnatched'] ? ' snatched_torrent' : '') . ($GroupFlags['IsSnatched'] ? ' snatched_group' : '')?>">
<td class="center cats_col">
<div title="<?=ucfirst(str_replace('.',' ',$TagList[0]))?>" class="cats_<?=strtolower(str_replace(array('-',' '),array('',''),$Categories[$CategoryID-1]))?> tags_<?=str_replace('.','_',$TagList[0])?>"></div>
<div title="<?=$TorrentTags->title()?>" class="<?=Format::css_category($GroupCategoryID)?> <?=$TorrentTags->css_name()?>"></div>
</td>
<td>
<span class="torrent_links_block">
[ <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="reportsv2.php?action=report&amp;id=<?=$TorrentID?>" title="Report">RP</a> ]
</span>
<?=$DisplayName?> <?Votes::vote_link($GroupID,$UserVotes[$GroupID]['Type']);?>
<br />
<div class="tags">
<?=$TorrentTags?>
<td class="big_info">
<? if ($LoggedUser['CoverArt']) : ?>
<div class="group_image float_left clear">
<? ImageTools::cover_thumb($WikiImage, $GroupCategoryID - 1) ?>
</div>
<? endif; ?>
<div class="group_info clear">
<span class="torrent_links_block">
[ <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="reportsv2.php?action=report&amp;id=<?=$TorrentID?>" title="Report">RP</a> ]
</span>
<?=$DisplayName?> <?Votes::vote_link($GroupID,$UserVotes[$GroupID]['Type']);?>
<div class="tags"><?=$TorrentTags->format('torrents.php?type='.$Action.'&amp;userid='.$UserID.'&amp;tags=')?></div>
</div>
</td>
<td class="nobr"><?=time_diff($Time,1)?></td>

View File

@ -2,33 +2,23 @@
$ExtraTorrentsInsert = array();
foreach ($ExtraTorrents as $ExtraTorrent) {
$Name = $ExtraTorrent['Name'];
$ExtraTorrentsInsert[$Name] = array();
$ExtraTorrentsInsert[$Name] = $ExtraTorrent;
$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'])) {
$ThisInsert =& $ExtraTorrentsInsert[$Name];
$ExtraTor = new BEncTorrent($Name, true);
if (isset($ExtraTor->Dec['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,
// so long as it's not useful to any leet hax0rs looking in an unprotected /torrents/ directory
$ExtraTor->set_announce_url('ANNOUNCE_URL'); // We just use the string "ANNOUNCE_URL"
// $ExtraPrivate is true or false. true means that the uploaded torrent was private, false means that it wasn't.
$ExtraPrivate = $ExtraTor->make_private();
// The torrent is now private.
if (!$ExtraTor->is_private()) {
$ExtraTor->make_private(); // The torrent is now private.
$PublicTorrent = true;
}
// File list and size
list($ExtraTotalSize, $ExtraFileList) = $ExtraTor->file_list();
$ExtraTorrentsInsert[$Name]['TotalSize'] = $ExtraTotalSize;
$ExtraDirName = isset($ExtraTor->Val['info']->Val['files']) ? Format::make_utf8($ExtraTor->get_name()) : "";
$ExtraTmpFileList = array();
foreach ($ExtraFileList as $ExtraFile) {
list($ExtraSize, $ExtraName) = $ExtraFile;
@ -37,29 +27,22 @@
// Make sure the filename is not too long
if (mb_strlen($ExtraName, 'UTF-8') + mb_strlen($ExtraDirName, 'UTF-8') + 1 > MAX_FILENAME_LENGTH) {
$Err = 'The torrent contained one or more files with too long a name (' . $ExtraName . ')';
break;
}
// Add file and size to array
$ExtraTmpFileList[] = Torrents::filelist_format_file($ExtraFile);
}
// To be stored in the database
$ExtraFilePath = db_string($ExtraDirName);
$ExtraTorrentsInsert[$Name]['FilePath'] = $ExtraFilePath;
$ExtraFileString = db_string(implode("\n", $ExtraTmpFileList));
$ExtraTorrentsInsert[$Name]['FileString'] = $ExtraFileString;
// Number of files described in torrent
$ExtraNumFiles = count($ExtraFileList);
$ExtraTorrentsInsert[$Name]['NumFiles'] = $ExtraNumFiles;
// The string that will make up the final torrent file
$ExtraTorrentText = $ExtraTor->enc();
$ThisInsert['FilePath'] = db_string($ExtraDirName);
$ThisInsert['FileString'] = db_string(implode("\n", $ExtraTmpFileList));
$ThisInsert['InfoHash'] = pack('H*', $ExtraTor->info_hash());
$ThisInsert['NumFiles'] = count($ExtraFileList);
$ThisInsert['TorEnc'] = db_string($ExtraTor->encode());
$ThisInsert['TotalSize'] = $ExtraTotalSize;
// Infohash
$ExtraInfoHash = pack("H*", sha1($ExtraTor->Val['info']->enc()));
$ExtraTorrentsInsert[$Name]['InfoHash'] = $ExtraInfoHash;
$DB->query("SELECT ID FROM torrents WHERE info_hash='" . db_string($ExtraInfoHash) . "'");
$Debug->set_flag('upload: torrent decoded');
$DB->query("SELECT ID FROM torrents WHERE info_hash='" . db_string($ThisInsert['InfoHash']) . "'");
if ($DB->record_count() > 0) {
list($ExtraID) = $DB->next_record();
$DB->query("SELECT TorrentID FROM torrents_files WHERE TorrentID = " . $ExtraID);
@ -67,11 +50,10 @@
$Err = '<a href="torrents.php?torrentid=' . $ExtraID . '">The exact same torrent file already exists on the site!</a>';
} else {
//One of the lost torrents.
$DB->query("INSERT INTO torrents_files (TorrentID, File) VALUES ($ExtraID, '" . db_string($ExtraTor->dump_data()) . "')");
$Err = '<a href="torrents.php?torrentid=' . $ExtraID . '">Thankyou for fixing this torrent</a>';
$DB->query("INSERT INTO torrents_files (TorrentID, File) VALUES ($ExtraID, '$ThisInsert[TorEnc]')");
$Err = "<a href=\"torrents.php?torrentid=$ExtraID\">Thank you for fixing this torrent</a>";
}
}
$ExtraTorrentsInsert[$Name]['Tor'] = $ExtraTor;
}
?>
unset($ThisInsert);
?>

View File

@ -23,17 +23,17 @@
$Err = "Missing format for extra torrent.";
break;
} else {
$ExtraTorrents[$ExtraTorrentName]['Format'] = "'" . db_string(trim($ExtraFormat)) . "'";
$ExtraTorrents[$ExtraTorrentName]['Format'] = db_string(trim($ExtraFormat));
}
$ExtraBitrate = $_POST['extra_bitrate'][$j];
if (empty($ExtraBitrate)) {
$Err = "Missing bitrate for extra torrent.";
break;
} else {
$ExtraTorrents[$ExtraTorrentName]['Encoding'] = "'" . db_string(trim($ExtraBitrate)) . "'";
$ExtraTorrents[$ExtraTorrentName]['Encoding'] = db_string(trim($ExtraBitrate));
}
$ExtraReleaseDescription = $_POST['extra_release_desc'][$j];
$ExtraTorrents[$ExtraTorrentName]['TorrentDescription'] = "'" . db_string(trim($ExtraReleaseDescription)) . "'";
$ExtraTorrents[$ExtraTorrentName]['TorrentDescription'] = db_string(trim($ExtraReleaseDescription));
$DupeNames[] = $ExtraFile['name'];
}
}

View File

@ -1,8 +1,8 @@
<?
foreach ($ExtraTorrentsInsert as $ExtraTorrent) {
$ExtraHasLog = "'0'";
$ExtraHasCue = "'0'";
$ExtraHasLog = 0;
$ExtraHasCue = 0;
$LogScore = ($HasLog == 1 ? $LogScoreAverage : 0);
// Torrent
$DB->query("
INSERT INTO torrents
@ -11,9 +11,11 @@
HasLog, HasCue, info_hash, FileCount, FileList, FilePath, Size, Time,
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() . "',
" . $ExtraTorrent['TorrentDescription'] . ", '" . (($HasLog == "'1'") ? $LogScoreAverage : 0) . "', '" . $T['FreeLeech'] . "', '" . $T['FreeLeechType'] . "')");
($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()."', " .
"'$ExtraTorrent[TorrentDescription]', $LogScore, '$T[FreeLeech]', '$T[FreeLeechType]')");
$Cache->increment('stats_torrent_count');
$ExtraTorrentID = $DB->inserted_id();
@ -25,7 +27,7 @@
//******************************************************************************//
//--------------- Write torrent file -------------------------------------------//
$DB->query("INSERT INTO torrents_files (TorrentID, File) VALUES ($ExtraTorrentID, '" . db_string($ExtraTorrent['Tor']->dump_data()) . "')");
$DB->query("INSERT INTO torrents_files (TorrentID, File) VALUES ($ExtraTorrentID, '$ExtraTorrent[TorEnc]')");
Misc::write_log("Torrent $ExtraTorrentID ($LogName) (" . number_format($ExtraTorrent['TotalSize'] / (1024 * 1024), 2) . " MB) was uploaded by " . $LoggedUser['Username']);
Torrents::write_group_log($GroupID, $ExtraTorrentID, $LoggedUser['ID'], "uploaded (" . number_format($ExtraTorrent['TotalSize'] / (1024 * 1024), 2) . " MB)", 0);

View File

@ -9,14 +9,12 @@
ini_set('upload_max_filesize',2097152);
ini_set('max_file_uploads',100);
define(MAX_FILENAME_LENGTH, 180);
require(SERVER_ROOT.'/classes/class_torrent.php');
include(SERVER_ROOT.'/classes/class_validate.php');
include(SERVER_ROOT.'/classes/class_feed.php');
include(SERVER_ROOT.'/classes/class_text.php');
include(SERVER_ROOT.'/sections/torrents/functions.php');
include(SERVER_ROOT.'/classes/class_file_checker.php');
include(SERVER_ROOT.'/classes/class_image_tools.php');
enforce_login();
authorize();
@ -326,7 +324,7 @@
if (preg_match($RegX, $Properties['Image'], $Matches)) {
$Properties['Image'] = $Matches[1].'.jpg';
}
check_imagehost($Properties['Image']);
ImageTools::blacklisted($Properties['Image']);
//******************************************************************************//
//--------------- Make variables ready for database input ----------------------//
@ -346,94 +344,72 @@
//******************************************************************************//
//--------------- Generate torrent file ----------------------------------------//
$Tor = new BEncTorrent($TorrentName, true);
$PublicTorrent = $Tor->make_private(); // The torrent is now private.
$TorEnc = db_string($Tor->encode());
$InfoHash = pack('H*', $Tor->info_hash());
$File = fopen($TorrentName, 'rb'); // open file for reading
$Contents = fread($File, 10000000);
$Tor = new TORRENT($Contents); // New TORRENT object
$DB->query("SELECT ID FROM torrents WHERE info_hash='".db_string($InfoHash)."'");
if ($DB->record_count() > 0) {
list($ID) = $DB->next_record();
$DB->query("SELECT TorrentID FROM torrents_files WHERE TorrentID = ".$ID);
if ($DB->record_count() > 0) {
$Err = '<a href="torrents.php?torrentid='.$ID.'">The exact same torrent file already exists on the site!</a>';
} else {
// A lost torrent
$DB->query("INSERT INTO torrents_files (TorrentID, File) VALUES ($ID, '$TorEnc')");
$Err = '<a href="torrents.php?torrentid='.$ID.'">Thank you for fixing this torrent</a>';
}
}
if (isset($Tor->Val['info']->Val['encrypted_files'])) {
if (isset($Tor->Dec['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
$Tor->set_announce_url('ANNOUNCE_URL'); // We just use the string "ANNOUNCE_URL"
// $Private is true or false. true means that the uploaded torrent was private, false means that it wasn't.
$Private = $Tor->make_private();
// The torrent is now private.
// File list and size
list($TotalSize, $FileList) = $Tor->file_list();
$DirName = isset($Tor->Val['info']->Val['files']) ? Format::make_utf8($Tor->get_name()) : "";
$NumFiles = count($FileList);
$HasLog = 0;
$HasCue = 0;
$TmpFileList = array();
$HasLog = "'0'";
$HasCue = "'0'";
$TooLongPaths = array();
foreach($FileList as $File) {
$DirName = isset($Tor->Dec['info']['files']) ? Format::make_utf8($Tor->get_name()) : "";
foreach ($FileList as $File) {
list($Size, $Name) = $File;
// add +log to encoding
if($T['Encoding'] == "'Lossless'" && preg_match('/(?<!audiochecker)\.log$/i', $Name)) {
$HasLog = "'1'";
if ($T['Encoding'] == "'Lossless'" && preg_match('/(?<!audiochecker)\.log$/i', $Name)) {
$HasLog = 1;
}
// add +cue to encoding
if($T['Encoding'] == "'Lossless'" && preg_match('/\.cue$/i', $Name)) {
$HasCue = "'1'";
if ($T['Encoding'] == "'Lossless'" && preg_match('/\.cue$/i', $Name)) {
$HasCue = 1;
}
// Check file name and extension against blacklist/whitelist
check_file($Type, $Name);
// Make sure the filename is not too long
if(mb_strlen($Name, 'UTF-8') + mb_strlen($DirName, 'UTF-8') + 1 > MAX_FILENAME_LENGTH) {
if (mb_strlen($Name, 'UTF-8') + mb_strlen($DirName, 'UTF-8') + 1 > MAX_FILENAME_LENGTH) {
$TooLongPaths[] = $Name;
}
// Add file info to array
$TmpFileList[] = Torrents::filelist_format_file($File);
}
if(count($TooLongPaths)!=0) {
if (count($TooLongPaths) > 0) {
$Names = '';
foreach($TooLongPaths as $Name) {
foreach ($TooLongPaths as $Name) {
$Names .= '<br>'.$Name;
}
$Err = 'The torrent contained one or more files with too long a name:'.$Names;
}
// To be stored in the database
$FilePath = db_string($DirName);
$FileString = db_string(implode("\n", $TmpFileList));
// Number of files described in torrent
$NumFiles = count($FileList);
// 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) {
list($ID) = $DB->next_record();
$DB->query("SELECT TorrentID FROM torrents_files WHERE TorrentID = ".$ID);
if($DB->record_count() > 0) {
$Err = '<a href="torrents.php?torrentid='.$ID.'">The exact same torrent file already exists on the site!</a>';
} else {
//One of the lost torrents.
$DB->query("INSERT INTO torrents_files (TorrentID, File) VALUES ($ID, '".db_string($Tor->dump_data())."')");
$Err = '<a href="torrents.php?torrentid='.$ID.'">Thankyou for fixing this torrent</a>';
}
}
if($Type == 'Music') {
if ($Type == 'Music') {
include(SERVER_ROOT.'/sections/upload/generate_extra_torrents.php');
}
if(!empty($Err)) { // Show the upload form, with the data the user entered
$UploadForm=$Type;
if (!empty($Err)) { // Show the upload form, with the data the user entered
$UploadForm = $Type;
include(SERVER_ROOT.'/sections/upload/upload.php');
die();
}
@ -633,7 +609,7 @@
// Use this section to control freeleeches
$T['FreeLeech'] = 0;
$T['FreeLeechType'] = 0;
$LogScore = ($HasLog == 1 ? $LogScoreAverage : 0);
// Torrent
$DB->query("
INSERT INTO torrents
@ -642,10 +618,10 @@
Scene, HasLog, HasCue, info_hash, FileCount, FileList, FilePath, Size, Time,
Description, LogScore, FreeTorrent, FreeLeechType)
VALUES
(".$GroupID.", ".$LoggedUser['ID'].", ".$T['Media'].", ".$T['Format'].", ".$T['Encoding'].",
".$T['Remastered'].", ".$T['RemasterYear'].", ".$T['RemasterTitle'].", ".$T['RemasterRecordLabel'].", ".$T['RemasterCatalogueNumber'].",
".$T['Scene'].", ".$HasLog.", ".$HasCue.", '".db_string($InfoHash)."', ".$NumFiles.", '".$FileString."', '".$FilePath."', ".$TotalSize.", '".sqltime()."',
".$T['TorrentDescription'].", '".(($HasLog == "'1'") ? $LogScoreAverage : 0)."', '".$T['FreeLeech']."', '".$T['FreeLeechType']."')");
($GroupID, $LoggedUser[ID], $T[Media], $T[Format], $T[Encoding], " .
"$T[Remastered], $T[RemasterYear], $T[RemasterTitle], $T[RemasterRecordLabel], $T[RemasterCatalogueNumber], " .
"$T[Scene], '$HasLog', '$HasCue', '".db_string($InfoHash)."', $NumFiles, '$FileString', '$FilePath', " .
"$TotalSize, '".sqltime()."', $T[TorrentDescription], $LogScore, $T[FreeLeech], $T[FreeLeechType])");
$Cache->increment('stats_torrent_count');
$TorrentID = $DB->inserted_id();
@ -656,12 +632,12 @@
//******************************************************************************//
//--------------- Write torrent file -------------------------------------------//
$DB->query("INSERT INTO torrents_files (TorrentID, File) VALUES ($TorrentID, '".db_string($Tor->dump_data())."')");
$DB->query("INSERT INTO torrents_files (TorrentID, File) VALUES ($TorrentID, '$TorEnc')");
Misc::write_log("Torrent $TorrentID ($LogName) (".number_format($TotalSize/(1024*1024), 2)." MB) was uploaded by " . $LoggedUser['Username']);
Torrents::write_group_log($GroupID, $TorrentID, $LoggedUser['ID'], "uploaded (".number_format($TotalSize/(1024*1024), 2)." MB)", 0);
Torrents::update_hash($GroupID);
$Debug->set_flag('upload: sphinx updated');
if($Type == 'Music') {
include(SERVER_ROOT.'/sections/upload/insert_extra_torrents.php');
@ -712,6 +688,34 @@
VALUES (0, ".$TorrentID.", 'library', '".db_string(($Properties['MultiDisc'] ? "Multi-disc" : ""))."', 'New', '".sqltime()."', '', '".db_string($Properties['LibraryImage'])."', '', '')");
}
//******************************************************************************//
//--------------- Post-processing ----------------------------------------------//
/* Because tracker updates and notifications can be slow, we're
* redirecting the user to the destination page and flushing the buffers
* to make it seem like the PHP process is working in the background.
*/
if ($PublicTorrent) {
View::show_header("Warning");
?>
<h1>Warning</h1>
<p><strong>Your torrent has been uploaded; however, you must download your torrent from <a href="torrents.php?id=<?=$GroupID?>">here</a> because you didn't make your torrent using the "private" option.</strong></p>
<?
View::show_footer();
} else if ($RequestID) {
header("Location: requests.php?action=takefill&requestid=".$RequestID."&torrentid=".$TorrentID."&auth=".$LoggedUser['AuthKey']);
} else {
header("Location: torrents.php?id=$GroupID");
}
if (function_exists('fastcgi_finish_request')) {
fastcgi_finish_request();
} else {
ignore_user_abort(true);
ob_flush();
flush();
ob_start(); // So we don't keep sending data to the client
}
//******************************************************************************//
//--------------- IRC announce and feeds ---------------------------------------//
$Announce = "";
@ -723,9 +727,9 @@
if (($Type == 'Music') && ($Properties['ReleaseType'] > 0)) { $Announce .= ' ['.$ReleaseTypes[$Properties['ReleaseType']].']'; }
$Announce .= " - ";
$Announce .= trim($Properties['Format'])." / ".trim($Properties['Bitrate']);
if ($HasLog == "'1'") { $Announce .= " / Log"; }
if ($HasLog == 1) { $Announce .= " / Log"; }
if ($LogInDB) { $Announce .= " / ".$LogScoreAverage.'%'; }
if ($HasCue == "'1'") { $Announce .= " / Cue"; }
if ($HasCue == 1) { $Announce .= " / Cue"; }
$Announce .= " / ".trim($Properties['Media']);
if ($Properties['Scene'] == "1") { $Announce .= " / Scene"; }
if ($T['FreeLeech'] == "1") { $Announce .= " / Freeleech!"; }
@ -940,18 +944,3 @@
// Clear Cache
$Cache->delete('torrents_details_'.$GroupID);
if (!$Private) {
View::show_header("Warning");
?>
<h1>Warning</h1>
<p><strong>Your torrent has been uploaded; however, you must download your torrent from <a href="torrents.php?id=<?=$GroupID?>">here</a> because you didn't make your torrent using the "private" option.</strong></p>
<?
View::show_footer();
die();
} elseif($RequestID) {
header("Location: requests.php?action=takefill&requestid=".$RequestID."&torrentid=".$TorrentID."&auth=".$LoggedUser['AuthKey']);
} else {
header("Location: torrents.php?id=$GroupID");
}
?>

View File

@ -173,6 +173,14 @@ function checked($Checked) {
</select>
</td>
</tr>-->
<tr>
<td class="label"><strong>Cover Art</strong></td>
<td>
<input type="hidden" name="coverart" value="" />
<input type="checkbox" name="coverart" id="coverart" <?=$SiteOptions['CoverArt']?'checked="checked"':''?> />
<label for="coverart">Show covers next to torrent information</label>
</td>
</tr>
<tr>
<td class="label"><strong>Collage album covers to show per page</strong></td>
<td>

View File

@ -199,6 +199,7 @@
$Options['DisableAutoSave'] = (!empty($_POST['disableautosave']) ? 1 : 0);
$Options['NoVoteLinks'] = (!empty($_POST['novotelinks']) ? 1 : 0);
$Options['CoverArt'] = (int) !empty($_POST['coverart']);
if(isset($LoggedUser['DisableFreeTorrentTop10'])) {
$Options['DisableFreeTorrentTop10'] = $LoggedUser['DisableFreeTorrentTop10'];

View File

@ -4,7 +4,6 @@
$Text = new TEXT;
include(SERVER_ROOT.'/sections/requests/functions.php');
include(SERVER_ROOT.'/classes/class_image_tools.php');
if (empty($_GET['id']) || !is_numeric($_GET['id']))
error(404);
@ -534,7 +533,7 @@ function check_paranoia_here($Setting) {
<?
foreach($RecentSnatches as $RS) { ?>
<td>
<a href="torrents.php?id=<?=$RS['ID']?>" title="<?=display_str($RS['Artist'])?><?=display_str($RS['Name'])?>"><img src="<?=to_thumbnail($RS['WikiImage'])?>" alt="<?=display_str($RS['Artist'])?><?=display_str($RS['Name'])?>" width="107" /></a>
<a href="torrents.php?id=<?=$RS['ID']?>" title="<?=display_str($RS['Artist'])?><?=display_str($RS['Name'])?>"><img src="<?=ImageTools::thumbnail($RS['WikiImage'])?>" alt="<?=display_str($RS['Artist'])?><?=display_str($RS['Name'])?>" width="107" /></a>
</td>
<? } ?>
</tr>
@ -573,7 +572,7 @@ function check_paranoia_here($Setting) {
<tr>
<? foreach($RecentUploads as $RU) { ?>
<td>
<a href="torrents.php?id=<?=$RU['ID']?>" title="<?=$RU['Artist']?><?=$RU['Name']?>"><img src="<?=to_thumbnail($RU['WikiImage'])?>" alt="<?=$RU['Artist']?><?=$RU['Name']?>" width="107" /></a>
<a href="torrents.php?id=<?=$RU['ID']?>" title="<?=$RU['Artist']?><?=$RU['Name']?>"><img src="<?=ImageTools::thumbnail($RU['WikiImage'])?>" alt="<?=$RU['Artist']?><?=$RU['Name']?>" width="107" /></a>
</td>
<? } ?>
</tr>
@ -610,14 +609,14 @@ function check_paranoia_here($Setting) {
<? foreach($Collage as $C) {
$Group = Torrents::get_groups(array($C['GroupID']));
$Group = array_pop($Group['matches']);
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Torrents, $GroupArtists) = array_values($Group);
extract(Torrents::array_group($Group));
$Name = '';
$Name .= Artists::display_artists(array('1'=>$GroupArtists), false, true);
$Name .= Artists::display_artists(array('1'=>$Artists), false, true);
$Name .= $GroupName;
?>
<td>
<a href="torrents.php?id=<?=$GroupID?>" title="<?=$Name?>"><img src="<?=to_thumbnail($C['WikiImage'])?>" alt="<?=$Name?>" width="107" /></a>
<a href="torrents.php?id=<?=$GroupID?>" title="<?=$Name?>"><img src="<?=ImageTools::thumbnail($C['WikiImage'])?>" alt="<?=$Name?>" width="107" /></a>
</td>
<? } ?>
</tr>

View File

@ -19,8 +19,8 @@
FROM collages AS c
JOIN users_collage_subs AS s ON s.CollageID = c.ID
JOIN collages_torrents AS ct ON ct.CollageID = c.ID
WHERE s.UserID = ".$LoggedUser['ID']." AND c.Deleted='0'
AND ct.AddedOn > s.LastVisit
WHERE s.UserID=$LoggedUser[ID] AND c.Deleted='0'
AND ct.AddedOn>s.LastVisit
GROUP BY c.ID";
} else {
$sql = "SELECT c.ID,
@ -30,7 +30,7 @@
FROM collages AS c
JOIN users_collage_subs AS s ON s.CollageID = c.ID
LEFT JOIN collages_torrents AS ct ON ct.CollageID = c.ID
WHERE s.UserID = ".$LoggedUser['ID']." AND c.Deleted='0'
WHERE s.UserID=$LoggedUser[ID] AND c.Deleted='0'
GROUP BY c.ID";
}
@ -63,7 +63,7 @@
if(!$NumResults) {
?>
<div class="center">
No subscribed collages<?=($ShowAll?'':' with new additions')?>
No subscribed collages<?=($ShowAll ? '' : ' with new additions')?>
</div>
<?
} else {
@ -76,20 +76,15 @@
unset($TorrentTable);
list($CollageID, $CollageName, $CollageSize, $LastVisit) = $Collage;
$RS = $DB->query("SELECT ct.GroupID,
tg.WikiImage,
tg.CategoryID
FROM collages_torrents AS ct
JOIN torrents_group AS tg ON ct.GroupID = tg.ID
WHERE ct.CollageID = $CollageID
AND ct.AddedOn > '$LastVisit'
ORDER BY ct.AddedOn");
$RS = $DB->query("SELECT GroupID FROM collages_torrents
WHERE CollageID=$CollageID
AND AddedOn>'" . db_string($LastVisit) . "'
ORDER BY AddedOn");
$NewTorrentCount = $DB->record_count();
//$NewTorrents = $DB->to_array();
//$Artists = Artists::get_artists($GroupID);
$GroupIDs = $DB->collect('GroupID');
$CollageDataList=$DB->to_array('GroupID', MYSQLI_ASSOC);
if(count($GroupIDs)>0) {
$TorrentList = Torrents::get_groups($GroupIDs);
$TorrentList = $TorrentList['matches'];
@ -105,32 +100,18 @@
// $DisplayName = Artists::display_artists($Artists[$GroupID]);
// $AltName=$GroupName;
foreach ($TorrentList as $GroupID => $Group) {
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Torrents, $GroupArtists, $ExtendedArtists, $GroupFlags) = array_values($Group);
list($GroupID2, $Image, $GroupCategoryID) = array_values($CollageDataList[$GroupID]);
extract(Torrents::array_group($Group));
unset($DisplayName);
$DisplayName = '';
$TagList = explode(' ',str_replace('_','.',$TagList));
$TorrentTags = array();
foreach($TagList as $Tag) {
if(!isset($Tags[$Tag])) {
$Tags[$Tag] = array('name'=>$Tag, 'count'=>1);
} else {
$Tags[$Tag]['count']++;
}
$TorrentTags[]='<a href="torrents.php?taglist='.$Tag.'">'.$Tag.'</a>';
}
$PrimaryTag = $TagList[0];
$TorrentTags = implode(', ', $TorrentTags);
$TorrentTags='<br /><div class="tags">'.$TorrentTags.'</div>';
$TorrentTags = new Tags($TagList);
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
unset($ExtendedArtists[2]);
unset($ExtendedArtists[3]);
$DisplayName .= Artists::display_artists($ExtendedArtists);
} elseif(count($GroupArtists)>0) {
$DisplayName .= Artists::display_artists(array('1'=>$GroupArtists));
} elseif(count($Artists)>0) {
$DisplayName .= Artists::display_artists(array('1'=>$Artists));
}
$DisplayName .= '<a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$GroupName.'</a>';
if($GroupYear>0) { $DisplayName = $DisplayName. ' ['. $GroupYear .']';}
@ -148,22 +129,16 @@
<a href="#" class="show_torrents_link" onclick="toggle_group(<?=$CollageID?><?=$GroupID?>, this, event)" title="Collapse this group"></a>
</div>
</td>
<? if (!$LoggedUser['HideCollage']) {?>
<td style="width: 60px; padding: 0;">
<? if ($Image) {
if(check_perms('site_proxy_images')) {
$Image = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?i='.urlencode($Image);
}
?>
<img style="max-width: 60px; max-height: 60px" src="<?=$Image?>" alt="<?=$AltName?>" onclick="lightbox.init(this,60);" />
<? } else { ?>
<img src="<?=STATIC_SERVER?>common/noartwork/<?=$CategoryIcons[$GroupCategoryID-1]?>" alt="<?=$Categories[$GroupCategoryID-1]?>" title="<?=$Categories[$GroupCategoryID-1]?>" width="60" height="60" border="0" />
<? } ?>
</td>
<? } ?>
<td colspan="5" style="vertical-align: middle;">
<strong><?=$DisplayName?></strong>
<?=$TorrentTags?>
<td colspan="5" class="big_info">
<? if ($LoggedUser['CoverArt']) : ?>
<div class="group_image float_left clear">
<? ImageTools::cover_thumb($WikiImage, $GroupCategoryID - 1) ?>
</div>
<? endif; ?>
<div class="group_info clear">
<strong><?=$DisplayName?></strong>
<div class="tags"><?=$TorrentTags->format()?></tags>
</div>
</td>
</tr>
<?
@ -198,7 +173,7 @@
?>
<tr class="group_torrent groupid_<?=$CollageID . $GroupID?> edition<?=$SnatchedGroupClass?> hidden">
<td colspan="<?=($LoggedUser['HideCollage']?'6':'7')?>" class="edition_info"><strong><a href="#" onclick="toggle_edition(<?=$CollageID?><?=$GroupID?>, <?=$EditionID?>, this, event)" title="Collapse this edition. Hold &quot;Ctrl&quot; while clicking to collapse all editions in this torrent group.">&minus;</a> <?=$RemasterName?></strong></td>
<td colspan="6" class="edition_info"><strong><a href="#" onclick="toggle_edition(<?=$CollageID?><?=$GroupID?>, <?=$EditionID?>, this, event)" title="Collapse this edition. Hold &quot;Ctrl&quot; while clicking to collapse all editions in this torrent group.">&minus;</a> <?=$RemasterName?></strong></td>
</tr>
<?
} else {
@ -213,7 +188,7 @@
$MasterName .= $AddExtra.display_str($Torrent['Media']);
?>
<tr class="group_torrent groupid_<?=$CollageID . $GroupID?> edition<?=$SnatchedGroupClass?> hidden">
<td colspan="<?=($LoggedUser['HideCollage']?'6':'7')?>" class="edition_info"><strong><a href="#" onclick="toggle_edition(<?=$CollageID?><?=$GroupID?>, <?=$EditionID?>, this, event)" title="Collapse this edition. Hold &quot;Ctrl&quot; while clicking to collapse all editions in this torrent group.">&minus;</a> <?=$MasterName?></strong></td>
<td colspan="6" class="edition_info"><strong><a href="#" onclick="toggle_edition(<?=$CollageID?><?=$GroupID?>, <?=$EditionID?>, this, event)" title="Collapse this edition. Hold &quot;Ctrl&quot; while clicking to collapse all editions in this torrent group.">&minus;</a> <?=$MasterName?></strong></td>
</tr>
<?
}
@ -225,7 +200,7 @@
$LastMedia = $Torrent['Media'];
?>
<tr class="group_torrent groupid_<?=$CollageID . $GroupID?> edition_<?=$EditionID?> hidden<?=$SnatchedTorrentClass . $SnatchedGroupClass?>">
<td colspan="<?=($LoggedUser['HideCollage']?'2':'3')?>">
<td colspan="2">
<span>
<a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download" class="brackets">DL</a>
</span>
@ -256,16 +231,23 @@
<tr class="torrent<?=$SnatchedTorrentClass?>" id="group_<?=$CollageID . $GroupID?>">
<td></td>
<td class="center">
<div title="<?=ucfirst(str_replace('_',' ',$PrimaryTag))?>" class="cats_<?=strtolower(str_replace(array('-',' '),array('',''),$Categories[$GroupCategoryID-1]))?> tags_<?=str_replace('.','_',$PrimaryTag)?>">
<div title="<?=$TorrentTags->title()?>" class="<?=Format::css_category($GroupCategoryID)?> <?=$TorrentTags->css_name()?>">
</div>
</td>
<td>
<span>
[ <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="reportsv2.php?action=report&amp;id=<?=$TorrentID?>" title="Report">RP</a> ]
</span>
<strong><?=$DisplayName?></strong>
<?=$TorrentTags?>
<td class="big_info">
<? if ($LoggedUser['CoverArt']) : ?>
<div class="group_image float_left clear">
<? ImageTools::cover_thumb($WikiImage, $GroupCategoryID - 1) ?>
</div>
<? endif; ?>
<div class="group_info clear">
<span>
[ <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="reportsv2.php?action=report&amp;id=<?=$TorrentID?>" title="Report">RP</a> ]
</span>
<strong><?=$DisplayName?></strong>
<div class="tags"><?=$TorrentTags->format()?></div>
</div>
</td>
<td class="nobr"><?=Format::get_size($Torrent['Size'])?></td>
<td><?=number_format($Torrent['Snatched'])?></td>
@ -291,12 +273,9 @@
</tr>
</table>
<!--</div>-->
<table class="torrent_table grouped<?=!$LoggedUser['HideCollage']?' artwork':''?><?=$ShowAll?' hidden':''?>" id="discog_table_<?=$CollageID?>">
<table class="torrent_table<?=$ShowAll?' hidden':''?>" id="discog_table_<?=$CollageID?>">
<tr class="colhead">
<td><!-- expand/collapse --></td>
<? if(!$LoggedUser['HideCollage']) {?>
<td style="padding: 0"><!-- image --></td>
<? } ?>
<td width="1%"><!-- expand/collapse --></td>
<td width="70%"><strong>Torrents</strong></td>
<td>Size</td>
<td class="sign"><img src="static/styles/<?=$LoggedUser['StyleName'] ?>/images/snatched.png" alt="Snatches" title="Snatches" /></td>

View File

@ -160,12 +160,13 @@ function toggleTorrentSearch(mode) {
} if (mode == 'basic') {
$('.fti_advanced').disable();
$('.fti_basic').enable();
$('.ftr_advanced').hide();
$('.ftr_advanced').hide(true);
$('.ftr_basic').show();
$('#ft_advanced_link').show();
$('#ft_advanced_text').hide();
$('#ft_basic_link').hide();
$('#ft_basic_text').show();
$('#ft_type').raw().value = 'basic';
} else if (mode == 'advanced') {
$('.fti_advanced').enable();
$('.fti_basic').disable();
@ -175,6 +176,7 @@ function toggleTorrentSearch(mode) {
$('#ft_advanced_text').show();
$('#ft_basic_link').show();
$('#ft_basic_text').hide();
$('#ft_type').raw().value = 'advanced';
}
return false;
}

View File

@ -1988,3 +1988,7 @@ tr.torrent .bookmark > a:after { content:""; }
.top10_quantity_links .brackets:after {
color: #878787;
}
.group_image + .group_info { margin: 0; padding: 0 5px; display: table-cell; vertical-align: middle; height: 90px; }
#torrents .group_image + .group_info { width: 450px; }
#top10 .group_image + .group_info { width: 585px; }

View File

@ -405,3 +405,22 @@ tr.torrent .bookmark>a:after {
#userinfo .brackets:before, #userinfo .brackets:after {
content: "";
}
.group_image {
overflow:hidden;
}
.float_left {
float:left;
}
.float_right {
float:right;
}
.float_clear {
clear:both;
}
.group_image + .group_info {
margin-left: 100px;
}
.group_image img {
cursor: pointer;
}

View File

@ -550,3 +550,7 @@ tr.torrent .bookmark > a:after { content: ""; }
.top10_quantity_links .brackets:after {
color: #757575;
}
.group_image + .group_info { margin: 0; padding: 0 5px; display: table-cell; vertical-align: middle; height: 90px; }
#torrents .group_image + .group_info { width: 520px; }
#top10 .group_image + .group_info { width: 585px; }

View File

@ -473,3 +473,7 @@ h3{margin:10px 0}
.top10_quantity_links .brackets:after {
color: #757575;
}
.group_image + .group_info { margin: 0; padding: 0 5px; display: table-cell; vertical-align: middle; height: 90px; }
#torrents .group_image + .group_info { width: 520px; }
#top10 .group_image + .group_info { width: 585px; }

View File

@ -1331,3 +1331,7 @@ form.manage_form[name=friends] .left input[type=submit] {
.top10_quantity_links .brackets:after {
color: #444;
}
.group_image + .group_info { margin: 0; padding: 0 5px; display: table-cell; vertical-align: middle; height: 90px; }
#torrents .group_image + .group_info { width: 450px; }
#top10 .group_image + .group_info { width: 585px; }

View File

@ -458,7 +458,7 @@ table.no_grouping>tbody>tr.torrent>td:first-child+td,
table.grouping>tbody>tr.group>td:first-child+td+td,
table.grouping>tbody>tr.colhead>td:first-child+td+td,
table.no_grouping>tbody>tr.group>td:first-child+td,
table.no_grouping>tbody>tr.colhead>td:first-child+td { text-indent:-20px; border-left: none;}
table.no_grouping>tbody>tr.colhead>td:first-child+td { /*text-indent:-20px;*/ border-left: none;}
.last_read {width: 15px; height: 15px; background: url('images/go_last_read.png') no-repeat center center; margin-left: 5px;}
.last_read a { border: none; width: 100%; height: 100%; display: block; }

View File

@ -1749,3 +1749,7 @@ tr.torrent .bookmark > a:after { content:""; }
.top10_quantity_links .brackets:after {
color: #575757;
}
.group_image + .group_info { margin: 0; padding: 0 5px; display: table-cell; vertical-align: middle; height: 90px; }
#torrents .group_image + .group_info { width: 450px; }
#top10 .group_image + .group_info { width: 585px; }