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

View File

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

View File

@ -1,77 +1,66 @@
<?php <?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) { function check_file($Type, $Name) {
check_name(strtolower($Name)); check_name($Name);
check_extensions($Type, strtolower($Name)); check_extensions($Type, $Name);
} }
function check_name($Name) { function check_name($Name) {
global $keywords; global $Keywords;
foreach ($keywords as &$value) { $NameLC = strtolower($Name);
if(preg_match('/'.$value.'/i', $Name)) { foreach ($Keywords as &$Value) {
if (strpos($NameLC, $Value) !== false) {
forbidden_error($Name); forbidden_error($Name);
} }
} }
if(preg_match('/INCOMPLETE~\*/i', $Name)) { if (preg_match('/INCOMPLETE~\*/i', $Name)) {
forbidden_error($Name); forbidden_error($Name);
}
if(preg_match('/\?/i', $Name)) {
character_error();
} }
if(preg_match('/\:/i', $Name)) { if (preg_match('/[:?]/', $Name, $Matches)) {
character_error(); character_error($Matches[0]);
} }
} }
function check_extensions($Type, $Name) { function check_extensions($Type, $Name) {
global $MusicExtensions, $ComicsExtensions;
global $music_extensions, $comics_extensions; if ($Type == 'Music' || $Type == 'Audiobooks' || $Type == 'Comedy' || $Type == 'E-Books') {
if (!isset($MusicExtensions[get_file_extension($Name)])) {
if($Type == 'Music' || $Type == 'Audiobooks' || $Type == 'Comedy' || $Type == 'E-Books') {
if(!in_array(get_file_extension($Name), $music_extensions)) {
invalid_error($Name); invalid_error($Name);
} }
} }
elseif ($Type == 'Comics') {
if($Type == 'Comics') { if (!isset($ComicsExtensions[get_file_extension($Name)])) {
if(!in_array(get_file_extension($Name), $comics_extensions)) {
invalid_error($Name); invalid_error($Name);
} }
} }
} }
function get_file_extension($file_name) { function get_file_extension($FileName) {
return substr(strrchr($file_name,'.'),1); return strtolower(substr(strrchr($FileName, '.'), 1));
} }
function invalid_error($Name) { function invalid_error($Name) {
global $Err; 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) { function forbidden_error($Name) {
global $Err; 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() { function character_error($Character) {
global $Err; 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'; $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>', return sprintf('<strong class="torrent_label %1$s" title="%2$s">%2$s</strong>',
display_str($class), display_str($text)); 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. * Replaces the extension.
*/ */
function replace_extension($string, $extension) { function replace_extension($String, $Extension) {
$string = preg_replace('/\.[^.]*$/', '', $string); return preg_replace('/\.[^.]*$/', $Extension, $String);
$string = $string . $extension;
return $string;
} }
function contains($substring, $string) { function contains($Substring, $String) {
return $pos = strpos($string, $substring); return strpos($String, $Substring) !== false;
} }
/** /**
* Checks if url points to a whatimg thumbnail. * Checks if url points to a whatimg thumbnail.
*/ */
function hasWhatImgThumb($url) { function has_whatimg_thumb($Url){
return !contains("_thumb", $url); return contains("_thumb", $Url);
} }
/** /**
* Cleans up imgur url if it already has a modifier attached to the end of it. * Cleans up imgur url if it already has a modifier attached to the end of it.
*/ */
function cleanImgurUrl($url) { function clean_imgur_url($Url){
$extension = pathinfo($url, PATHINFO_EXTENSION); $Extension = pathinfo($Url, PATHINFO_EXTENSION);
$full = preg_replace('/\.[^.]*$/', '', $url); $Full = preg_replace('/\.[^.]*$/', '', $Url);
$base = substr($full, 0, strrpos($full, '/')); $Base = substr($Full, 0, strrpos($Full, '/'));
$path = substr($full, strrpos($full, '/') + 1); $Path = substr($Full, strrpos($Full, '/') + 1);
if (strlen($path) == 6) { if (strlen($Path) == 6) {
$last = $path[strlen($path) - 1]; $Last = $Path[strlen($Path) - 1];
if ($last == 'm' || $last == 'l' || $last == 's' || $last == 'h' || $last == 'b') { if ($Last == 'm' || $Last == 'l' || $Last == 's' || $Last == 'h' || $Last == 'b') {
$path = substr($path, 0, -1); $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. (?) * $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) protected function query_and_clear_cache ($sql)
{ {
if (is_string($sql) && $this->DB->query($sql)) { if (is_string($sql) && $this->DB->query($sql))
$this->Cache->cache_value('bookmarks_torrent_' . $this->UserID, null, 0); $this->Cache->delete_value('bookmarks_group_ids_' . $this->UserID);
$this->Cache->cache_value('bookmarks_torrent_' . $this->UserID . '_full', null, 0);
}
} }
/** /**

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: * @return array each row of the following format:
* GroupID => ( * GroupID => (
* ID
* Name * Name
* Year * Year
* RecordLabel * RecordLabel
@ -21,6 +22,8 @@ class Torrents {
* TagList * TagList
* ReleaseType * ReleaseType
* VanityHouse * VanityHouse
* WikiImage
* CategoryID
* Torrents => { * Torrents => {
* ID => { * ID => {
* GroupID, Media, Format, Encoding, RemasterYear, Remastered, * 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: Do not change what is returned or the order thereof without updating:
torrents, artists, collages, bookmarks, better, the front page, torrents, artists, collages, bookmarks, better, the front page,
and anywhere else the get_groups function is used. and anywhere else the get_groups function is used.
Update self::array_group(), too
*/ */
if (count($NotFound) > 0) { if (count($NotFound) > 0) {
$DB->query("SELECT $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)"); FROM torrents_group AS g WHERE g.ID IN ($IDs)");
while($Group = $DB->next_record(MYSQLI_ASSOC, true)) { 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 // Cache it all
foreach ($Found as $GroupID=>$GroupInfo) { foreach ($Found as $GroupID => $GroupInfo) {
$Cache->cache_value('torrent_group_'.$GroupID, $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, $Cache->cache_value('torrent_group_light_'.$GroupID,
array('ver'=>4, 'd'=>$GroupInfo), 0); array('ver' => CACHE::GROUP_VERSION, 'd' => $GroupInfo), 0);
} }
} else { } else {
foreach ($Found as $Group) { 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 * 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 JOIN torrents_group AS tg ON tg.ID=t.GroupID
WHERE tf.TorrentID = ".$TorrentID); WHERE tf.TorrentID = ".$TorrentID);
if($DB->record_count() > 0) { if($DB->record_count() > 0) {
require(SERVER_ROOT.'/classes/class_torrent.php');
list($GroupID, $Contents) = $DB->next_record(MYSQLI_NUM, false); list($GroupID, $Contents) = $DB->next_record(MYSQLI_NUM, false);
$Contents = unserialize(base64_decode($Contents)); if (Misc::is_new_torrent($Contents)) {
$Tor = new TORRENT($Contents, true); $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(); list($TotalSize, $FileList) = $Tor->file_list();
foreach($FileList as $File) { foreach($FileList as $File) {
$TmpFileList[] = self::filelist_format_file($File); $TmpFileList[] = self::filelist_format_file($File);
} }
$FilePath = isset($Tor->Val['info']->Val['files']) ? Format::make_utf8($Tor->get_name()) : "";
$FileString = implode("\n", $TmpFileList); $FileString = implode("\n", $TmpFileList);
$DB->query("UPDATE torrents SET Size = ".$TotalSize.", FilePath = '".db_string($FilePath)."', FileList = '".db_string($FileString)."' WHERE ID = ".$TorrentID); $DB->query("UPDATE torrents SET Size = ".$TotalSize.", FilePath = '".db_string($FilePath)."', FileList = '".db_string($FileString)."' WHERE ID = ".$TorrentID);
$Cache->delete_value('torrents_details_'.$GroupID); $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 * Check if the logged in user can use a freeleech token on this torrent
* *
* @param int $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) { public static function can_use_token($Torrent) {
global $LoggedUser; global $LoggedUser;

View File

@ -4,6 +4,7 @@
*/ */
class TorrentsDL { class TorrentsDL {
const ChunkSize = 100; const ChunkSize = 100;
const MaxPathLength = 200;
private $QueryResult; private $QueryResult;
private $QueryRowNum = 0; private $QueryRowNum = 0;
private $Zip; private $Zip;
@ -13,19 +14,24 @@ class TorrentsDL {
private $NumFound = 0; private $NumFound = 0;
private $Size = 0; private $Size = 0;
private $Title; private $Title;
private $Username;
private $AnnounceURL;
/** /**
* Create a Zip object and store the query results * Create a Zip object and store the query results
* *
* @param mysqli_result $QueryResult results from a query on the collector pages * @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 $Title name of the collection that will be created
* @param string $AnnounceURL URL to add to the created torrents
*/ */
public function __construct(&$QueryResult, $Title) { public function __construct(&$QueryResult, $Title) {
global $Cache; global $Cache, $LoggedUser;
$Cache->InternalCache = false; // The internal cache is almost completely useless for this $Cache->InternalCache = false; // The internal cache is almost completely useless for this
Zip::unlimit(); // Need more memory and longer timeout Zip::unlimit(); // Need more memory and longer timeout
$this->QueryResult = $QueryResult; $this->QueryResult = $QueryResult;
$this->Title = $Title; $this->Title = $Title;
$this->User = $LoggedUser;
$this->AnnounceURL = ANNOUNCE_URL . "/$LoggedUser[torrent_pass]/announce";
$this->Zip = new Zip(Misc::file_string($Title)); $this->Zip = new Zip(Misc::file_string($Title));
} }
@ -69,42 +75,43 @@ public function get_downloads($Key) {
/** /**
* Add a file to the zip archive * Add a file to the zip archive
* *
* @param string $Content file content * @param string $TorrentData bencoded torrent without announce url (new format) or TORRENT object (old format)
* @param array $FileInfo file info stored as an array with at least the keys * @param array $Info file info stored as an array with at least the keys
* Artist, Name, Year, Media, Format, Encoding and TorrentID * Artist, Name, Year, Media, Format, Encoding and TorrentID
* @param string $FolderName folder name * @param string $FolderName folder name
*/ */
public function add_file($Content, $FileInfo, $FolderName = '') { public function add_file(&$TorrentData, $Info, $FolderName = '') {
$FileName = self::construct_file_name($FileInfo['Artist'], $FileInfo['Name'], $FileInfo['Year'], $FileInfo['Media'], $FileInfo['Format'], $FileInfo['Encoding'], $FileInfo['TorrentID']); $FolderName = Misc::file_string($FolderName);
$this->Size += $FileInfo['Size']; $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->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 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 * 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) { public function fail_file($Info) {
$this->FailedFiles[] = $FileInfo['Artist'] . $FileInfo['Name'] . " $FileInfo[Year]"; $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 * 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) { public function skip_file($Info) {
$this->SkippedFiles[] = $FileInfo['Artist'] . $FileInfo['Name'] . " $FileInfo[Year]"; $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 * 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 bool $FilterStats whether to include filter stats in the report
* @param int $Skips number of files that did not match any of the user's criteria
*/ */
public function finalize($FilterStats = true) { public function finalize($FilterStats = true) {
$this->Zip->add_file($this->summary($FilterStats), "Summary.txt"); $this->Zip->add_file($this->summary($FilterStats), "Summary.txt");
@ -121,15 +128,15 @@ public function finalize($FilterStats = true) {
* @return summary text * @return summary text
*/ */
public function summary($FilterStats) { public function summary($FilterStats) {
global $LoggedUser, $ScriptStartTime; global $ScriptStartTime;
$Time = number_format(1000 * (microtime(true) - $ScriptStartTime), 2)." ms"; $Time = number_format(1000 * (microtime(true) - $ScriptStartTime), 2)." ms";
$Used = Format::get_size(memory_get_usage(true)); $Used = Format::get_size(memory_get_usage(true));
$Date = date("M d Y, H:i"); $Date = date("M d Y, H:i");
$NumSkipped = count($this->SkippedFiles); $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" . "\r\n"
. "User: $LoggedUser[Username]\r\n" . "User: {$this->User[Username]}\r\n"
. "Passkey: $LoggedUser[torrent_pass]\r\n" . "Passkey: {$this->User[torrent_pass]}\r\n"
. "\r\n" . "\r\n"
. "Time: $Time\r\n" . "Time: $Time\r\n"
. "Used: $Used\r\n" . "Used: $Used\r\n"
@ -164,12 +171,17 @@ public function errors() {
/** /**
* Combine a bunch of torrent info into a standardized file name * 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 int $TorrentID if given, append "-TorrentID" to torrent name
* @param bool $TxtExtension whether to use .txt or .torrent as file extension * @param bool $Txt whether to use .txt or .torrent as file extension
* @return file name with at most 180 characters that is valid on most systems * @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); $TorrentArtist = Misc::file_string($Artist);
$TorrentName = Misc::file_string($Album); $TorrentName = Misc::file_string($Album);
if ($Year > 0) { if ($Year > 0) {
@ -193,22 +205,35 @@ public static function construct_file_name($Artist, $Album, $Year, $Media, $Form
if (!$TorrentName) { if (!$TorrentName) {
$TorrentName = "No Name"; $TorrentName = "No Name";
} else if (strlen($Artist . $TorrentName . $TorrentInfo) <= 196) { } else if (mb_strlen($TorrentArtist . $TorrentName . $TorrentInfo, 'UTF-8') <= $MaxLength) {
$TorrentName = $Artist . $TorrentName; $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); $TorrentName = Format::cut_string($TorrentName . $TorrentInfo, $MaxLength, true, false);
if ($TorrentID) { if ($TorrentID !== false) {
$TorrentName .= "-$TorrentID"; $TorrentName .= "-$TorrentID";
} }
if ($TxtExtension) { if ($Txt) {
return "$TorrentName.txt"; return "$TorrentName.txt";
} }
return "$TorrentName.torrent"; 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 CACHE $Cache
* @global DB_MYSQL $DB * @global DB_MYSQL $DB
* @param string|int $UserID * @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; global $Cache, $DB;
$UserID = (int) $UserID; $UserID = (int) $UserID;
$Data = $Cache->get_value('bookmarks_torrent_'.$UserID.'_full'); if (($Data = $Cache->get_value('bookmarks_group_ids_' . $UserID))) {
list($GroupIDs, $BookmarkData) = $Data;
if($Data) {
$Data = unserialize($Data);
list($K, list($TorrentList, $CollageDataList)) = each($Data);
} else { } else {
// Build the data for the collage and the torrent list $DB->query("SELECT GroupID, Sort, `Time` FROM bookmarks_torrents WHERE UserID=$UserID ORDER BY Sort, `Time` ASC");
$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");
$GroupIDs = $DB->collect('GroupID'); $GroupIDs = $DB->collect('GroupID');
$CollageDataList = $DB->to_array('GroupID', MYSQLI_ASSOC); $BookmarkData = $DB->to_array('GroupID', MYSQLI_ASSOC);
$Cache->cache_value('bookmarks_group_ids_' . $UserID,
if(count($GroupIDs) > 0) { array($GroupIDs, $BookmarkData), 3600);
$TorrentList = Torrents::get_groups($GroupIDs);
$TorrentList = $TorrentList['matches'];
} else {
$TorrentList = array();
}
} }
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': case 'Artists':
$FileName = 'class_artists'; $FileName = 'class_artists';
break; break;
case 'BEncTorrent':
$FileName = 'class_bencode';
break;
case 'Format': case 'Format':
$FileName = 'class_format'; $FileName = 'class_format';
break; break;
case 'ImageTools':
$FileName = 'class_image_tools';
break;
case 'LastFM': case 'LastFM':
$FileName = 'class_lastfm'; $FileName = 'class_lastfm';
break; break;
@ -116,12 +122,20 @@
case 'SphinxQL_Result': case 'SphinxQL_Result':
$FileName = 'class_sphinxql'; $FileName = 'class_sphinxql';
break; break;
case 'Tags':
$FileName = 'class_tags';
break;
case 'TEXTAREA_PREVIEW': case 'TEXTAREA_PREVIEW':
$FileName = 'class_textarea_preview'; $FileName = 'class_textarea_preview';
break; break;
case 'Tools': case 'Tools':
$FileName = 'class_tools'; $FileName = 'class_tools';
break; break;
case 'TORRENT':
case 'BENCODE_DICT':
case 'BENCODE_LIST':
$FileName = 'class_torrent';
break;
case 'Torrents': case 'Torrents':
$FileName = 'class_torrents'; $FileName = 'class_torrents';
break; break;

View File

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

View File

@ -19,7 +19,7 @@
$JsonResults = array(); $JsonResults = array();
foreach ($Results as $GroupID=>$Group) { 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']; $FlacID = $GroupIDs[$GroupID]['TorrentID'];
$JsonArtists = array(); $JsonArtists = array();

View File

@ -1,4 +1,5 @@
<? <?
ini_set('memory_limit', -1); ini_set('memory_limit', -1);
//~~~~~~~~~~~ Main bookmarks page ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// //~~~~~~~~~~~ Main bookmarks page ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
@ -21,34 +22,9 @@ function compare($X, $Y){
$Sneaky = ($UserID != $LoggedUser['ID']); $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(); $JsonBookmarks = array();
list(, $CollageDataList, $TorrentList) = Users::get_bookmarks($UserID);
foreach ($TorrentList as $Torrent) { foreach ($TorrentList as $Torrent) {
$JsonTorrents = array(); $JsonTorrents = array();
foreach ($Torrent['Torrents'] as $GroupTorrents) { 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']; $TorrentID = $_GET['torrentid'];
if (!is_number($TorrentID)) { if (!is_number($TorrentID)) {
echo('Invalid TorrentID'); echo('Invalid TorrentID');
@ -12,11 +11,15 @@
die(); die();
} }
list($Contents) = $DB->next_record(MYSQLI_NUM, array(0)); list($Contents) = $DB->next_record(MYSQLI_NUM, array(0));
$Contents = unserialize(base64_decode($Contents)); if (Misc::is_new_torrent($Contents)) {
$Tor = new TORRENT($Contents, true); // New TORRENT object $Tor = new BEncTorrent($Contents);
$Private = $Tor->make_private(); $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>'; echo '<span style="color: #0c0; font-weight: bold;">Private</span>';
} else { } else {
echo '<span style="color: #c00; font-weight: bold;">Public</span>'; echo '<span style="color: #c00; font-weight: bold;">Public</span>';

View File

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

View File

@ -15,8 +15,6 @@ function compare($X, $Y){
// Similar artist map // Similar artist map
include(SERVER_ROOT.'/classes/class_artists_similar.php'); include(SERVER_ROOT.'/classes/class_artists_similar.php');
include(SERVER_ROOT.'/classes/class_image_tools.php');
$UserVotes = Votes::get_user_votes($LoggedUser['ID']); $UserVotes = Votes::get_user_votes($LoggedUser['ID']);
$ArtistID = $_GET['id']; $ArtistID = $_GET['id'];
@ -118,7 +116,7 @@ function compare($X, $Y){
} }
} }
if (count($GroupIDs) > 0) { if (count($GroupIDs) > 0) {
$TorrentList = Torrents::get_groups($GroupIDs, true,true); $TorrentList = Torrents::get_groups($GroupIDs, true, true);
$TorrentList = $TorrentList['matches']; $TorrentList = $TorrentList['matches'];
} else { } else {
$TorrentList = array(); $TorrentList = array();
@ -246,22 +244,11 @@ function compare($X, $Y){
$NumSnatches = 0; $NumSnatches = 0;
foreach ($TorrentList as $GroupID => $Group) { 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(); $TorrentTags = new Tags($Group['TagList'], !$Skip);
// $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>';
foreach ($Group['Torrents'] as $TorrentID => $Torrent) { foreach ($Group['Torrents'] as $TorrentID => $Torrent) {
$NumTorrents++; $NumTorrents++;
@ -286,9 +273,7 @@ function compare($X, $Y){
$LastReleaseType = 0; $LastReleaseType = 0;
foreach ($Importances as $Group) { foreach ($Importances as $Group) {
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Torrents, $Artists, $ExtendedArtists, $GroupFlags) = array_values($TorrentList[$Group['GroupID']]); extract(Torrents::array_group($TorrentList[$Group['GroupID']]));
$ReleaseType = $Group['ReleaseType'];
$GroupVanityHouse = $Group['VanityHouse'];
if ($GroupID == $OldGroupID && $ReleaseType == $OldReleaseType) { if ($GroupID == $OldGroupID && $ReleaseType == $OldReleaseType) {
continue; continue;
@ -308,16 +293,7 @@ function compare($X, $Y){
$HideDiscog = ''; $HideDiscog = '';
} }
$TagList = explode(' ',str_replace('_','.',$TagList)); $TorrentTags = new Tags($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>';
if($ReleaseType!=$LastReleaseType) { if($ReleaseType!=$LastReleaseType) {
switch($ReleaseTypes[$ReleaseType]) { 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> <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> </div>
</td> </td>
<td colspan="5"> <td colspan="5" class="big_info">
<strong><?=$DisplayName?></strong> <?Votes::vote_link($GroupID,$UserVotes[$GroupID]['Type']);?> <? if ($LoggedUser['CoverArt']) : ?>
<?=$TorrentTags?> <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> </td>
</tr> </tr>
<? <?
@ -554,7 +537,7 @@ function compare($X, $Y){
<div class="box box_image"> <div class="box box_image">
<div class="head"><strong><?=$Name?></strong></div> <div class="head"><strong><?=$Name?></strong></div>
<div style="text-align:center;padding:10px 0px;"> <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>
</div> </div>
<? } ?> <? } ?>
@ -638,12 +621,7 @@ function compare($X, $Y){
<div class="head"><strong>Tags</strong></div> <div class="head"><strong>Tags</strong></div>
<ul class="stats nobullet"> <ul class="stats nobullet">
<? <?
uasort($Tags, 'compare'); $TorrentTags->format_top(50);
foreach ($Tags as $TagName => $Tag) {
?>
<li><a href="torrents.php?taglist=<?=$TagName?>"><?=$TagName?></a> (<?=$Tag['count']?>)</li>
<?
}
?> ?>
</ul> </ul>
</div> </div>
@ -778,16 +756,7 @@ function compare($X, $Y){
<tr class="row<?=$Row?>"> <tr class="row<?=$Row?>">
<td> <td>
<?=$FullName?> <?=$FullName?>
<div class="tags"> <div class="tags"><?=$TorrentTags->format('requests.php?tags=')?></div>
<?
$TagList = array();
foreach($Tags as $TagID => $TagName) {
$TagList[] = "<a href='requests.php?tags=".$TagName."'>".display_str($TagName)."</a>";
}
$TagList = implode(', ', $TagList);
?>
<?=$TagList?>
</div>
</td> </td>
<td> <td>
<span id="vote_count_<?=$RequestID?>"><?=$Votes?></span> <span id="vote_count_<?=$RequestID?>"><?=$Votes?></span>

View File

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

View File

@ -61,9 +61,6 @@
error(403); error(403);
} }
require(SERVER_ROOT.'/classes/class_bencode.php');
require(SERVER_ROOT.'/classes/class_torrent.php');
$Preferences = array('RemasterTitle DESC', 'Seeders ASC', 'Size ASC'); $Preferences = array('RemasterTitle DESC', 'Seeders ASC', 'Size ASC');
$ArtistID = $_REQUEST['artistid']; $ArtistID = $_REQUEST['artistid'];
@ -133,7 +130,6 @@
$DownloadsQ = $DB->query($SQL); $DownloadsQ = $DB->query($SQL);
$Collector = new TorrentsDL($DownloadsQ, $ArtistName); $Collector = new TorrentsDL($DownloadsQ, $ArtistName);
while (list($Downloads, $GroupIDs) = $Collector->get_downloads('GroupID')) { while (list($Downloads, $GroupIDs) = $Collector->get_downloads('GroupID')) {
$Artists = Artists::get_artists($GroupIDs); $Artists = Artists::get_artists($GroupIDs);
$TorrentFilesQ = $DB->query("SELECT TorrentID, File FROM torrents_files WHERE TorrentID IN (".implode(',', array_keys($GroupIDs)).")", false); $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) { } else if ($Releases[$GroupID]['Importance'] == 3) {
$ReleaseTypeName = "Remixed By"; $ReleaseTypeName = "Remixed By";
} }
if (Misc::is_new_torrent($TorrentFile)) { $Collector->add_file($TorrentFile, $Download, $ReleaseTypeName);
$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);
unset($Download); unset($Download);
} }
} }

View File

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

View File

@ -46,7 +46,9 @@
<table class="torrent_table"> <table class="torrent_table">
<? <?
foreach ($TorrentsInfo as $TorrentID => $Info) { 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])) { if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
unset($ExtendedArtists[2]); unset($ExtendedArtists[2]);
unset($ExtendedArtists[3]); unset($ExtendedArtists[3]);
@ -62,18 +64,6 @@
if($ExtraInfo) { if($ExtraInfo) {
$DisplayName.=' - '.$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"' : ''?>"> <tr class="torrent torrent_row<?=$GroupFlags['IsSnatched'] ? ' snatched_torrent"' : ''?>">
<td> <td>
@ -84,7 +74,7 @@
<? if (check_perms('admin_reports')) { ?> <? if (check_perms('admin_reports')) { ?>
<a href="better.php?method=files&amp;remove=<?=$TorrentID?>" class="brackets">X</a> <a href="better.php?method=files&amp;remove=<?=$TorrentID?>" class="brackets">X</a>
<? } ?> <? } ?>
<?=$TorrentTags?> <div class="tags"><?=$TorrentTags->format()?></div>
</td> </td>
</tr> </tr>
<? } ?> <? } ?>

View File

@ -46,7 +46,9 @@
<table class="torrent_table"> <table class="torrent_table">
<? <?
foreach ($TorrentsInfo as $TorrentID => $Info) { 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])) { if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
unset($ExtendedArtists[2]); unset($ExtendedArtists[2]);
unset($ExtendedArtists[3]); unset($ExtendedArtists[3]);
@ -62,18 +64,6 @@
if($ExtraInfo) { if($ExtraInfo) {
$DisplayName.=' - '.$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' : ''?>"> <tr class="torrent torrent_row<?=$Torrents[$TorrentID]['IsSnatched'] ? ' snatched_torrent' : ''?>">
<td> <td>
@ -84,7 +74,7 @@
<? if (check_perms('admin_reports')) { ?> <? if (check_perms('admin_reports')) { ?>
<a href="better.php?method=folders&amp;remove=<?=$TorrentID?>" class="brackets">X</a> <a href="better.php?method=folders&amp;remove=<?=$TorrentID?>" class="brackets">X</a>
<? } ?> <? } ?>
<?=$TorrentTags?> <div class="tags"><?=$TorrentTags->format()?></div>
</td> </td>
</tr> </tr>
<? } ?> <? } ?>

View File

@ -27,8 +27,10 @@
</tr> </tr>
<? <?
$Results = $Results['matches']; $Results = $Results['matches'];
foreach ($Results as $GroupID=>$Group) { foreach ($Results as $GroupID => $Group) {
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TorrentTags, $ReleaseType, $GroupVanityHouse, $Torrents, $Artists, $ExtendedArtists, $GroupFlags) = array_values($Group); extract(Torrents::array_group($Group));
$TorrentTags = new Tags($TagList);
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) { if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
unset($ExtendedArtists[2]); unset($ExtendedArtists[2]);
unset($ExtendedArtists[3]); unset($ExtendedArtists[3]);
@ -46,18 +48,6 @@
if($ExtraInfo) { if($ExtraInfo) {
$DisplayName.=' - '.$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' : ''?>"> <tr class="torrent torrent_row<?=$Torrents[$FlacID]['IsSnatched'] ? ' snatched_torrent' : ''?>">
<td> <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> <a href="torrents.php?action=download&amp;id=<?=$FlacID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" class="brackets">DL</a>
</span> </span>
<?=$DisplayName?> <?=$DisplayName?>
<?=$TorrentTags?> <div class="tags"><?=$TorrentTags->format()?></div>
</td> </td>
</tr> </tr>
<? } ?> <? } ?>

View File

@ -174,13 +174,6 @@
$ArtistNames = ''; $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) { foreach ($Editions as $RemIdent => $Edition) {
if (!$Edition['FlacID'] || count($Edition['Formats']) == 3) { if (!$Edition['FlacID'] || count($Edition['Formats']) == 3) {
continue; continue;
@ -212,6 +205,7 @@
if (!empty($Edition['RemasterYear'])) { if (!empty($Edition['RemasterYear'])) {
$ExtraInfo .= ' - '; $ExtraInfo .= ' - ';
} }
$TorrentTags = new Tags($GroupInfo['TagList']);
$ExtraInfo .= implode(' / ', $EditionInfo); $ExtraInfo .= implode(' / ', $EditionInfo);
?> ?>
<tr class="torrent torrent_row<?=$Edition['IsSnatched'] ? ' snatched_torrent' : ''?>"> <tr class="torrent torrent_row<?=$Edition['IsSnatched'] ? ' snatched_torrent' : ''?>">
@ -221,7 +215,7 @@
</span> </span>
<?=$DisplayName?> <?=$DisplayName?>
<div class="torrent_info"><?=$ExtraInfo?></div> <div class="torrent_info"><?=$ExtraInfo?></div>
<div class="tags"><?=$TorrentTags?></div> <div class="tags"><?=$TorrentTags->format()?></div>
</td> </td>
<td><strong <?=isset($Edition['Formats']['V2 (VBR)']) ? 'class="important_text_alt">YES' : 'class="important_text">NO'?></strong></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> <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"> <table class="torrent_table">
<? <?
foreach($TorrentsInfo as $TorrentID => $Info) { 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])) { if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
unset($ExtendedArtists[2]); unset($ExtendedArtists[2]);
unset($ExtendedArtists[3]); unset($ExtendedArtists[3]);
@ -63,18 +65,6 @@
if($ExtraInfo) { if($ExtraInfo) {
$DisplayName.=' - '.$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' : ''?>"> <tr class="torrent torrent_row<?=$Torrents[$TorrentID]['IsSnatched'] ? ' snatched_torrent' : ''?>">
<td> <td>
@ -85,7 +75,7 @@
<? if(check_perms('admin_reports')) { ?> <? if(check_perms('admin_reports')) { ?>
<a href="better.php?method=tags&amp;remove=<?=$TorrentID?>" class="brackets">X</a> <a href="better.php?method=tags&amp;remove=<?=$TorrentID?>" class="brackets">X</a>
<? } ?> <? } ?>
<?=$TorrentTags?> <div class="tags"><?=$TorrentTags->format()?></div>
</td> </td>
</tr> </tr>
<? <?

View File

@ -128,14 +128,6 @@
} else { } else {
$ArtistNames = ''; $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) { foreach ($Editions as $RemIdent => $Edition) {
if (!$Edition['FlacID'] //no FLAC in this group 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) || !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'])) { if (!empty($Edition['RemasterYear'])) {
$ExtraInfo .= ' - '; $ExtraInfo .= ' - ';
} }
$TorrentTags = new Tags($GroupInfo['TagList']);
$ExtraInfo .= implode(' / ', $EditionInfo); $ExtraInfo .= implode(' / ', $EditionInfo);
?> ?>
<tr<?=$Edition['IsSnatched'] ? ' class="snatched_torrent"' : ''?>> <tr<?=$Edition['IsSnatched'] ? ' class="snatched_torrent"' : ''?>>
@ -183,7 +176,7 @@
</span> </span>
<?=$DisplayName?> <?=$DisplayName?>
<div class="torrent_info"><?=$ExtraInfo?></div> <div class="torrent_info"><?=$ExtraInfo?></div>
<div class="tags"><?=$TorrentTags?></div> <div class="tags"><?=$TorrentTags->format()?></div>
</td> </td>
<td><strong <?=isset($Edition['Formats']['V2 (VBR)']) ? 'class="important_text_alt">YES' : 'class="important_text">NO'?></strong></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> <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) { foreach ($TorrentGroups as $GroupID => $Editions) {
$GroupInfo = $Groups[$GroupID]; $GroupInfo = $Groups[$GroupID];
$GroupYear = $GroupInfo['Year']; extract(Torrents::array_group($GroupInfo));
$ExtendedArtists = $GroupInfo['ExtendedArtists'];
$GroupCatalogueNumber = $GroupInfo['CatalogueNumber'];
$GroupName = $GroupInfo['Name'];
$GroupRecordLabel = $GroupInfo['RecordLabel'];
$ReleaseType = $GroupInfo['ReleaseType'];
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) { if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
unset($ExtendedArtists[2]); unset($ExtendedArtists[2]);
@ -158,13 +153,6 @@
$ArtistNames = ''; $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) { foreach ($Editions as $RemIdent => $Edition) {
if (!$Edition['FlacID'] || count($Edition['Formats']) == 3) { if (!$Edition['FlacID'] || count($Edition['Formats']) == 3) {
continue; continue;
@ -196,6 +184,7 @@
if (!empty($Edition['RemasterYear'])) { if (!empty($Edition['RemasterYear'])) {
$ExtraInfo .= ' - '; $ExtraInfo .= ' - ';
} }
$TorrentTags = new Tags($TagList);
$ExtraInfo .= implode(' / ', $EditionInfo); $ExtraInfo .= implode(' / ', $EditionInfo);
?> ?>
<tr class="torrent torrent_row<?=$Edition['IsSnatched'] ? ' snatched_torrent' : ''?>"> <tr class="torrent torrent_row<?=$Edition['IsSnatched'] ? ' snatched_torrent' : ''?>">
@ -205,7 +194,7 @@
</span> </span>
<?=$DisplayName?> <?=$DisplayName?>
<div class="torrent_info"><?=$ExtraInfo?></div> <div class="torrent_info"><?=$ExtraInfo?></div>
<div class="tags"><?=$TorrentTags?></div> <div class="tags"><?=$TorrentTags->format()?></div>
</td> </td>
<td><strong <?=isset($Edition['Formats']['V2 (VBR)']) ? 'class="important_text_alt">YES' : 'class="important_text">NO'?></strong></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> <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']); $Cache->delete_value('bookmarks_'.$Type.'_'.$LoggedUser['ID']);
if ($Type == 'torrent') { if ($Type == 'torrent') {
$Cache->delete_value('bookmarks_torrent_'.$LoggedUser['ID'].'_full'); $Cache->delete_value('bookmarks_group_ids_' . $UserID);
$GroupID = (int) $_GET['id']; $GroupID = (int) $_GET['id'];
$DB->query("SELECT Name, Year, WikiBody, TagList FROM torrents_group WHERE ID = '$GroupID'"); $DB->query("SELECT Name, Year, WikiBody, TagList FROM torrents_group WHERE ID = '$GroupID'");

View File

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

View File

@ -25,8 +25,7 @@
$DB->query("CREATE TEMPORARY TABLE snatched_groups_temp (GroupID int PRIMARY KEY)"); $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("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]'"); $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_group_ids_' . $UserID);
$Cache->delete_value('bookmarks_torrent_'.$UserID.'_full');
header('Location: bookmarks.php'); header('Location: bookmarks.php');
die(); die();
break; break;

View File

@ -13,11 +13,11 @@
$DB->query("DELETE FROM $Table WHERE UserID='".$LoggedUser['ID']."' AND $Col='".db_string($_GET['id'])."'"); $DB->query("DELETE FROM $Table WHERE UserID='".$LoggedUser['ID']."' AND $Col='".db_string($_GET['id'])."'");
$Cache->delete_value('bookmarks_'.$Type.'_'.$UserID); $Cache->delete_value('bookmarks_'.$Type.'_'.$UserID);
if ($Type == 'torrent') {
$Cache->delete_value('bookmarks_torrent_'.$UserID.'_full'); if ($Type === 'torrent') {
} elseif ($Type == 'request') { $Cache->delete_value('bookmarks_group_ids_' . $UserID);
} elseif ($Type === 'request') {
$DB->query("SELECT UserID FROM $Table WHERE $Col='".db_string($_GET['id'])."'"); $DB->query("SELECT UserID FROM $Table WHERE $Col='".db_string($_GET['id'])."'");
$Bookmarkers = $DB->collect('UserID'); $Bookmarkers = $DB->collect('UserID');
$SS->UpdateAttributes('requests requests_delta', array('bookmarker'), array($_GET['id'] => array($Bookmarkers)), true); $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); ini_set('max_execution_time',600);
set_time_limit(0); set_time_limit(0);
@ -21,11 +20,8 @@ function compare($X, $Y){
$UserID = $LoggedUser['ID']; $UserID = $LoggedUser['ID'];
} }
$Sneaky = ($UserID != $LoggedUser['ID']); $Sneaky = $UserID != $LoggedUser['ID'];
$Title = $Sneaky ? "$Username's bookmarked torrents" : 'Your bookmarked torrents';
list($K, $GroupIDs, $CollageDataList, $TorrentList) = Users::bookmark_data($UserID);
$Title = ($Sneaky)?"$Username's bookmarked torrents":'Your bookmarked torrents';
// Loop through the result set, building up $Collage and $TorrentTable // Loop through the result set, building up $Collage and $TorrentTable
// Then we print them. // Then we print them.
@ -33,47 +29,34 @@ function compare($X, $Y){
$TorrentTable = ''; $TorrentTable = '';
$NumGroups = 0; $NumGroups = 0;
$Artists = array(); $ArtistCount = array();
$Tags = array();
foreach ($TorrentList as $GroupID=>$Group) { list(, $CollageDataList, $TorrentList) = Users::get_bookmarks($UserID);
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Torrents, $GroupArtists, $ExtendedArtists, $GroupFlags) = array_values($Group); foreach ($TorrentList as $GroupID => $Group) {
list($GroupID2, $Sort, $Image, $GroupCategoryID, $AddedTime) = array_values($CollageDataList[$GroupID]); extract(Torrents::array_group($Group));
list(, $Sort, $AddedTime) = array_values($CollageDataList[$GroupID]);
// Handle stats and stuff // Handle stats and stuff
$NumGroups++; $NumGroups++;
if($GroupArtists) { if($Artists) {
foreach($GroupArtists as $Artist) { foreach($Artists as $Artist) {
if(!isset($Artists[$Artist['id']])) { if(!isset($ArtistCount[$Artist['id']])) {
$Artists[$Artist['id']] = array('name'=>$Artist['name'], 'count'=>1); $ArtistCount[$Artist['id']] = array('name'=>$Artist['name'], 'count'=>1);
} else { } else {
$Artists[$Artist['id']]['count']++; $ArtistCount[$Artist['id']]['count']++;
} }
} }
} }
$TagList = explode(' ',str_replace('_','.',$TagList)); $TorrentTags = new Tags($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>';
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) { if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
unset($ExtendedArtists[2]); unset($ExtendedArtists[2]);
unset($ExtendedArtists[3]); unset($ExtendedArtists[3]);
$DisplayName = Artists::display_artists($ExtendedArtists); $DisplayName = Artists::display_artists($ExtendedArtists);
} elseif(count($GroupArtists)>0) { } elseif(count($Artists)>0) {
$DisplayName = Artists::display_artists(array('1'=>$GroupArtists)); $DisplayName = Artists::display_artists(array('1'=>$Artists));
} else { } else {
$DisplayName = ''; $DisplayName = '';
} }
@ -95,18 +78,18 @@ function compare($X, $Y){
</div> </div>
</td> </td>
<td class="center"> <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>
<td colspan="5"> <td colspan="5">
<span style="float:left;"><strong><?=$DisplayName?></strong></span> <strong><?=$DisplayName?></strong>
<span style="float:right;text-align:right"> <span style="text-align:right" class="float_right">
<? if(!$Sneaky){ ?> <? if(!$Sneaky){ ?>
<a href="#group_<?=$GroupID?>" class="brackets remove_bookmark" title="Remove bookmark" onclick="Unbookmark('torrent', <?=$GroupID?>, '');return false;">Unbookmark</a> <a href="#group_<?=$GroupID?>" class="brackets remove_bookmark" title="Remove bookmark" onclick="Unbookmark('torrent', <?=$GroupID?>, '');return false;">Unbookmark</a>
<br /> <br />
<? } ?> <? } ?>
<?=time_diff($AddedTime);?> <?=time_diff($AddedTime);?>
</span> </span>
<br /><span style="float:left;"><?=$TorrentTags?></span> <div class="tags"><?=$TorrentTags->format()?></div>
</td> </td>
</tr> </tr>
<? <?
@ -206,7 +189,7 @@ function compare($X, $Y){
<tr class="torrent torrent_row<?=$SnatchedTorrentClass . $SnatchedGroupClass?>" id="group_<?=$GroupID?>"> <tr class="torrent torrent_row<?=$SnatchedTorrentClass . $SnatchedGroupClass?>" id="group_<?=$GroupID?>">
<td></td> <td></td>
<td class="center"> <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> </div>
</td> </td>
<td> <td>
@ -218,11 +201,11 @@ function compare($X, $Y){
| <a href="reportsv2.php?action=report&amp;id=<?=$TorrentID?>" title="Report">RP</a> ] | <a href="reportsv2.php?action=report&amp;id=<?=$TorrentID?>" title="Report">RP</a> ]
</span> </span>
<strong><?=$DisplayName?></strong> <strong><?=$DisplayName?></strong>
<?=$TorrentTags?> <div class="tags"><?=$TorrentTags->format()?></div>
<? if(!$Sneaky){ ?> <? 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>
<td class="nobr"><?=Format::get_size($Torrent['Size'])?></td> <td class="nobr"><?=Format::get_size($Torrent['Size'])?></td>
@ -243,20 +226,20 @@ function compare($X, $Y){
unset($ExtendedArtists[2]); unset($ExtendedArtists[2]);
unset($ExtendedArtists[3]); unset($ExtendedArtists[3]);
$DisplayName .= Artists::display_artists($ExtendedArtists, false); $DisplayName .= Artists::display_artists($ExtendedArtists, false);
} elseif(count($GroupArtists)>0) { } elseif(count($Artists)>0) {
$DisplayName .= Artists::display_artists(array('1'=>$GroupArtists), false); $DisplayName .= Artists::display_artists(array('1'=>$Artists), false);
} }
$DisplayName .= $GroupName; $DisplayName .= $GroupName;
if($GroupYear>0) { $DisplayName = $DisplayName. ' ['. $GroupYear .']';} if($GroupYear>0) { $DisplayName = $DisplayName. ' ['. $GroupYear .']';}
?> ?>
<li class="image_group_<?=$GroupID?>"> <li class="image_group_<?=$GroupID?>">
<a href="torrents.php?id=<?=$GroupID?>" class="bookmark_<?=$GroupID?>"> <a href="torrents.php?id=<?=$GroupID?>" class="bookmark_<?=$GroupID?>">
<? if($Image) { <? if($WikiImage) {
if(check_perms('site_proxy_images')) { 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 { ?> <? } else { ?>
<div style="width:107px;padding:5px"><?=$DisplayName?></div> <div style="width:107px;padding:5px"><?=$DisplayName?></div>
<? } ?> <? } ?>
@ -309,24 +292,14 @@ function compare($X, $Y){
<div class="head"><strong>Stats</strong></div> <div class="head"><strong>Stats</strong></div>
<ul class="stats nobullet"> <ul class="stats nobullet">
<li>Torrents: <?=$NumGroups?></li> <li>Torrents: <?=$NumGroups?></li>
<? if(count($Artists) >0) { ?> <li>Artists: <?=count($Artists)?></li> <? } ?> <? if(count($ArtistCount) >0) { ?> <li>Artists: <?=count($ArtistCount)?></li> <? } ?>
</ul> </ul>
</div> </div>
<div class="box box_tags"> <div class="box box_tags">
<div class="head"><strong>Top tags</strong></div> <div class="head"><strong>Top tags</strong></div>
<div class="pad"> <div class="pad">
<ol style="padding-left:5px;"> <ol style="padding-left:5px;">
<? <? $TorrentTags->format_top(5) ?>
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>
<?
}
?>
</ol> </ol>
</div> </div>
</div> </div>
@ -335,9 +308,9 @@ function compare($X, $Y){
<div class="pad"> <div class="pad">
<ol style="padding-left:5px;"> <ol style="padding-left:5px;">
<? <?
uasort($Artists, 'compare'); uasort($ArtistCount, 'compare');
$i = 0; $i = 0;
foreach ($Artists as $ID => $Artist) { foreach ($ArtistCount as $ID => $Artist) {
$i++; $i++;
if($i>10) { break; } if($i>10) { break; }
?> ?>
@ -394,4 +367,3 @@ function compare($X, $Y){
</div> </div>
<? <?
View::show_footer(); 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) { foreach ($Collages as $Collage) {
list($ID, $Name, $NumTorrents, $TagList, $CategoryID, $UserID) = $Collage; list($ID, $Name, $NumTorrents, $TagList, $CategoryID, $UserID) = $Collage;
$Row = ($Row == 'a') ? 'b' : 'a'; $Row = ($Row == 'a') ? 'b' : 'a';
$TagList = explode(' ', $TagList); $TorrentTags = new Tags($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);
//Print results //Print results
?> ?>
@ -309,13 +303,8 @@
<span style="float:right"> <span style="float:right">
<a href="#" onclick="Unbookmark('collage', <?=$ID?>,'');return false;" class="brackets">Remove bookmark</a> <a href="#" onclick="Unbookmark('collage', <?=$ID?>,'');return false;" class="brackets">Remove bookmark</a>
</span> </span>
<? } <? } ?>
if(!empty($Tags)) { <div class="tags"><?=$TorrentTags->format('collages.php?action=search&amp;tags=')?></div>
?>
<div class="tags">
<?=$Tags?>
</div>
<? } ?>
</td> </td>
<td><?=(int)$NumTorrents?></td> <td><?=(int)$NumTorrents?></td>
<td><?=Users::format_username($UserID, false, false, false)?></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.'/sections/bookmarks/functions.php'); // has_bookmarked()
include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
include(SERVER_ROOT.'/classes/class_image_tools.php');
$Text = new TEXT; $Text = new TEXT;
@ -96,13 +95,14 @@ function compare($X, $Y){
$NumGroups = 0; $NumGroups = 0;
$NumGroupsByUser = 0; $NumGroupsByUser = 0;
$Artists = array(); $Artists = array();
$Tags = array();
$Users = array(); $Users = array();
$Number = 0; $Number = 0;
foreach ($TorrentList as $GroupID=>$Group) { foreach ($TorrentList as $GroupID => $Group) {
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Torrents, $GroupArtists, $ExtendedArtists, $GroupFlags) = array_values($Group); extract(Torrents::array_group($Group));
list($GroupID2, $Image, $GroupCategoryID, $UserID, $Username) = array_values($CollageDataList[$GroupID]);
list( , , , $UserID, $Username) = array_values($CollageDataList[$GroupID]);
$TorrentTags = new Tags($TagList);
// Handle stats and stuff // Handle stats and stuff
$Number++; $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.' - '; $DisplayName = $Number.' - ';
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5])|| !empty($ExtendedArtists[6])) { if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5])|| !empty($ExtendedArtists[6])) {
@ -178,11 +163,11 @@ function compare($X, $Y){
</div> </div>
</td> </td>
<td class="center"> <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>
<td colspan="5"> <td colspan="5">
<strong><?=$DisplayName?></strong> <?Votes::vote_link($GroupID,$UserVotes[$GroupID]['Type']);?> <strong><?=$DisplayName?></strong> <?Votes::vote_link($GroupID,$UserVotes[$GroupID]['Type']);?>
<?=$TorrentTags?> <div class="tags"><?=$TorrentTags->format()?></div>
</td> </td>
</tr> </tr>
<? <?
@ -281,7 +266,7 @@ function compare($X, $Y){
<tr class="torrent torrent_row<?=$SnatchedTorrentClass . $SnatchedGroupClass?>" id="group_<?=$GroupID?>"> <tr class="torrent torrent_row<?=$SnatchedTorrentClass . $SnatchedGroupClass?>" id="group_<?=$GroupID?>">
<td></td> <td></td>
<td class="center"> <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> </div>
</td> </td>
<td> <td>
@ -293,7 +278,7 @@ function compare($X, $Y){
| <a href="reportsv2.php?action=report&amp;id=<?=$TorrentID?>" title="Report">RP</a> ] | <a href="reportsv2.php?action=report&amp;id=<?=$TorrentID?>" title="Report">RP</a> ]
</span> </span>
<strong><?=$DisplayName?></strong> <?Votes::vote_link($GroupID,$UserVotes[$GroupID]['Type']);?> <strong><?=$DisplayName?></strong> <?Votes::vote_link($GroupID,$UserVotes[$GroupID]['Type']);?>
<?=$TorrentTags?> <div class="tags"><?=$TorrentTags->format()?></div>
</td> </td>
<td class="nobr"><?=Format::get_size($Torrent['Size'])?></td> <td class="nobr"><?=Format::get_size($Torrent['Size'])?></td>
<td><?=number_format($Torrent['Snatched'])?></td> <td><?=number_format($Torrent['Snatched'])?></td>
@ -321,12 +306,12 @@ function compare($X, $Y){
?> ?>
<li class="image_group_<?=$GroupID?>"> <li class="image_group_<?=$GroupID?>">
<a href="torrents.php?id=<?=$GroupID?>"> <a href="torrents.php?id=<?=$GroupID?>">
<? if($Image) { <? if($WikiImage) {
if(check_perms('site_proxy_images')) { 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 { ?> <? } else { ?>
<span style="width:107px;padding:5px"><?=$DisplayName?></span> <span style="width:107px;padding:5px"><?=$DisplayName?></span>
<? } ?> <? } ?>
@ -425,9 +410,9 @@ function compare($X, $Y){
<ul id="list" class="nobullet"> <ul id="list" class="nobullet">
<? foreach ($ZIPList as $ListItem) { ?> <? foreach ($ZIPList as $ListItem) { ?>
<li id="list<?=$ListItem?>"> <li id="list<?=$ListItem?>">
<input type="hidden" name="list[]" value="<?=$ListItem?>" /> <input type="hidden" name="list[]" value="<?=$ListItem?>" />
<span style="float:left;"><?=$ZIPOptions[$ListItem]['2']?></span> <span class="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> <span class="remove remove_collector"><a href="#" onclick="remove_selection('<?=$ListItem?>');return false;" class="float_right brackets">X</a></span>
<br style="clear:all;" /> <br style="clear:all;" />
</li> </li>
<? } ?> <? } ?>
@ -481,15 +466,9 @@ function compare($X, $Y){
<div class="pad"> <div class="pad">
<ol style="padding-left:5px;"> <ol style="padding-left:5px;">
<? <?
uasort($Tags, 'compare'); if (isset($TorrentTags)) {
$i = 0; $TorrentTags->format_top(5, 'collages.php?action=search&amp;tags=');
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>
<?
}
?> ?>
</ol> </ol>
</div> </div>
@ -535,7 +514,7 @@ function compare($X, $Y){
</div> </div>
<? if(check_perms('site_collages_manage') && !$PreventAdditions) { ?> <? if(check_perms('site_collages_manage') && !$PreventAdditions) { ?>
<div class="box box_addtorrent"> <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"> <div class="pad add_torrent_container">
<form class="add_form" name="torrent" action="collages.php" method="post"> <form class="add_form" name="torrent" action="collages.php" method="post">
<input type="hidden" name="action" value="add_torrent" /> <input type="hidden" name="action" value="add_torrent" />

View File

@ -61,9 +61,6 @@
error(403); error(403);
} }
require(SERVER_ROOT.'/classes/class_bencode.php');
require(SERVER_ROOT.'/classes/class_torrent.php');
$Preferences = array('RemasterTitle DESC', 'Seeders ASC', 'Size ASC'); $Preferences = array('RemasterTitle DESC', 'Seeders ASC', 'Size ASC');
$CollageID = $_REQUEST['collageid']; $CollageID = $_REQUEST['collageid'];
@ -147,16 +144,7 @@
$Collector->skip_file($Download); $Collector->skip_file($Download);
continue; continue;
} }
if (Misc::is_new_torrent($TorrentFile)) { $Collector->add_file($TorrentFile, $Download);
$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);
unset($Download); unset($Download);
} }
} }

View File

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

View File

@ -11,7 +11,7 @@
<div class="box"> <div class="box">
<div class="head colhead_dark"><strong>Featured Album</strong></div> <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 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 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> </div>
<? <?

View File

@ -6,7 +6,6 @@
include(SERVER_ROOT.'/sections/bookmarks/functions.php'); // has_bookmarked() include(SERVER_ROOT.'/sections/bookmarks/functions.php'); // has_bookmarked()
include(SERVER_ROOT.'/classes/class_text.php'); include(SERVER_ROOT.'/classes/class_text.php');
include(SERVER_ROOT.'/classes/class_image_tools.php');
$Text = new TEXT; $Text = new TEXT;
@ -133,7 +132,7 @@
$Image = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?i='.urlencode($Image); $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 { ?> <? } else { ?>
<p align="center"><img src="<?=STATIC_SERVER?>common/noartwork/<?=$CategoryIcons[$CategoryID-1]?>" alt="<?=$CategoryName?>" title="<?=$CategoryName?>" width="220" height="220" border="0" /></p> <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 -----------------------------------------------// //----------------- Take request -----------------------------------------------//
include(SERVER_ROOT.'/classes/class_image_tools.php');
authorize(); authorize();
@ -90,7 +89,7 @@
if(empty($_POST['image'])) { if(empty($_POST['image'])) {
$Image = ""; $Image = "";
} else { } else {
check_imagehost($_POST['image']); ImageTools::blacklisted($_POST['image']);
if(preg_match("/".IMAGE_REGEX."/", trim($_POST['image'])) > 0) { if(preg_match("/".IMAGE_REGEX."/", trim($_POST['image'])) > 0) {
$Image = trim($_POST['image']); $Image = trim($_POST['image']);
} else { } else {

View File

@ -139,38 +139,20 @@
} }
$DisplayName .= $ExtraInfo; $DisplayName .= $ExtraInfo;
$TorrentTags = explode(' ',$TorrentTags); $TorrentTags = new Tags($TorrentTags);
} else { } else {
$DisplayName = $TitleString." (Deleted)"; $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?>"> <tr class="group_torrent row<?=$Highlight?>">
<td style="padding:8px;text-align:center;"><strong><?=$Rank?></strong></td> <td style="padding:8px;text-align:center;"><strong><?=$Rank?></strong></td>
<? <td class="center cats_col"><div title="<?=$TorrentTags->title()?>" class="<?=Format::css_category($GroupCategoryID)?> <?=$TorrentTags->css_name()?>"></div></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> <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> <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?> <?=$DisplayName?>
<?=$TorrentTags?> <div class="tags"><?=$TorrentTags->format()?></div>
</td> </td>
</tr> </tr>
<? <?

View File

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

View File

@ -140,6 +140,7 @@
g.ID, g.ID,
g.Name, g.Name,
g.CategoryID, g.CategoryID,
g.wikiImage,
g.TagList, g.TagList,
t.Format, t.Format,
t.Encoding, t.Encoding,
@ -413,7 +414,7 @@ function generate_torrent_table($Caption, $Tag, $Details, $Limit) {
$Artists = Artists::get_artists($GroupIDs); $Artists = Artists::get_artists($GroupIDs);
foreach ($Details as $Detail) { 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, $Format,$Encoding,$Media,$Scene,$HasLog,$HasCue,$LogScore,$Year,$GroupYear,
$RemasterTitle,$Snatched,$Seeders,$Leechers,$Data,$ReleaseType) = $Detail; $RemasterTitle,$Snatched,$Seeders,$Leechers,$Data,$ReleaseType) = $Detail;
@ -458,46 +459,36 @@ function generate_torrent_table($Caption, $Tag, $Details, $Limit) {
$ExtraInfo = "- [$ExtraInfo]"; $ExtraInfo = "- [$ExtraInfo]";
} }
$TagList=array(); $TorrentTags = new Tags($TagsList);
$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>';
}
// print row // print row
?> ?>
<tr class="torrent row<?=$Highlight . ($IsBookmarked ? ' bookmarked' : '') . ($IsSnatched ? ' snatched_torrent' : '')?>"> <tr class="torrent row<?=$Highlight . ($IsBookmarked ? ' bookmarked' : '') . ($IsSnatched ? ' snatched_torrent' : '')?>">
<td style="padding:8px;text-align:center;"><strong><?=$Rank?></strong></td> <td style="padding:8px;text-align:center;"><strong><?=$Rank?></strong></td>
<? <td class="center cats_col"><div title="<?=$TorrentTags->title()?>" class="<?=Format::css_category($GroupCategoryID)?> <?=$TorrentTags->css_name()?>"></div></td>
//fix array offset php error <td class="big_info">
if ($GroupCategoryID > 0) { <? if ($LoggedUser['CoverArt']) : ?>
$GroupCatOffset = $GroupCategoryID - 1; <div class="group_image float_left clear">
} <? ImageTools::cover_thumb($WikiImage, $GroupCategoryID - 1) ?>
?> </div>
<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> <? endif; ?>
<td> <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" class="brackets">DL</a></span>
<strong><?=$DisplayName?></strong> <?=$ExtraInfo?> <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>
<span class="bookmark" style="float:right;">
<strong><?=$DisplayName?></strong> <?=$ExtraInfo?>
<span class="bookmark" style="float:right;">
<? <?
if($IsBookmarked) { 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 { ?> <? } 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>
<td style="text-align:right" class="nobr"><?=Format::get_size($Data)?></td> <td style="text-align:right" class="nobr"><?=Format::get_size($Data)?></td>
<td style="text-align:right"><?=number_format((double) $Snatched)?></td> <td style="text-align:right"><?=number_format((double) $Snatched)?></td>

View File

@ -64,16 +64,10 @@
$Data = $DB->to_array('GroupID'); $Data = $DB->to_array('GroupID');
$Groups = Torrents::get_groups($Results); $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(); $TopVotes = array();
foreach ($Results as $GroupID) { foreach ($Results as $GroupID) {
$TopVotes[$GroupID] = $Groups['matches'][$GroupID]; $TopVotes[$GroupID] = $Groups['matches'][$GroupID];
$TopVotes[$GroupID]['CategoryID'] = $Cats[$GroupID]['CategoryID'];
$TopVotes[$GroupID]['Ups'] = $Data[$GroupID]['Ups']; $TopVotes[$GroupID]['Ups'] = $Data[$GroupID]['Ups'];
$TopVotes[$GroupID]['Total'] = $Data[$GroupID]['Total']; $TopVotes[$GroupID]['Total'] = $Data[$GroupID]['Total'];
$TopVotes[$GroupID]['Score'] = $Data[$GroupID]['Score']; $TopVotes[$GroupID]['Score'] = $Data[$GroupID]['Score'];
@ -163,10 +157,11 @@
// This code was copy-pasted from collages and should die in a fire // This code was copy-pasted from collages and should die in a fire
$Number = 0; $Number = 0;
$NumGroups = 0; $NumGroups = 0;
foreach ($TopVotes as $GroupID=>$Group) { foreach ($TopVotes as $GroupID => $Group) {
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, extract(Torrents::array_group($Group));
$GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Ups = $Group['Ups'];
$Torrents, $GroupArtists, $ExtendedArtists, $GroupFlags, $GroupCategoryID,$Ups,$Total,$Score) = array_values($Group); $Total = $Group['Total'];
$Score = $Group['Score'];
$IsBookmarked = in_array($GroupID, $Bookmarks); $IsBookmarked = in_array($GroupID, $Bookmarks);
@ -174,14 +169,7 @@
$Number++; $Number++;
$NumGroups++; $NumGroups++;
$TagList = explode(' ',str_replace('_','.',$TagList)); $TorrentTags = new Tags($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>';
$DisplayName = $Number.' - '; $DisplayName = $Number.' - ';
@ -199,7 +187,7 @@
// Start an output buffer, so we can store this output in $TorrentTable // Start an output buffer, so we can store this output in $TorrentTable
ob_start(); ob_start();
if(count($Torrents)>1 || $GroupCategoryID==1) { if(count($Torrents) > 1 || $GroupCategoryID == 1) {
// Grouped torrents // Grouped torrents
$GroupSnatched = false; $GroupSnatched = false;
foreach ($Torrents as &$Torrent) { foreach ($Torrents as &$Torrent) {
@ -217,16 +205,25 @@
</div> </div>
</td> </td>
<td class="center"> <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>
<td> <td class="big_info">
<strong><?=$DisplayName?></strong> <!--<?Votes::vote_link($GroupID,$UserVotes[$GroupID]['Type']);?>--> <? 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) { ?> <? 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 { ?> <? } 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>
<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> <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> </tr>
@ -325,25 +322,32 @@
<tr class="torrent torrent_row<?=$SnatchedTorrentClass . $SnatchedGroupClass?>" id="group_<?=$GroupID?>"> <tr class="torrent torrent_row<?=$SnatchedTorrentClass . $SnatchedGroupClass?>" id="group_<?=$GroupID?>">
<td></td> <td></td>
<td class="center"> <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> </div>
</td> </td>
<td class="nobr"> <td class="nobr big_info">
<span> <? if ($LoggedUser['CoverArt']) : ?>
[ <a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download">DL</a> <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)) { ?> <? 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) { ?> <? 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 { ?> <? } 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> </span>
<strong><?=$DisplayName?></strong> <!--<?Votes::vote_link($GroupID,$UserVotes[$GroupID]['Type']);?>--> <strong><?=$DisplayName?></strong> <!--<?Votes::vote_link($GroupID,$UserVotes[$GroupID]['Type']);?>-->
<?=$TorrentTags?> <div class="tags"><?=$TorrentTags->format()?></div>
</div>
</td> </td>
<td class="nobr"><?=Format::get_size($Torrent['Size'])?></td> <td class="nobr"><?=Format::get_size($Torrent['Size'])?></td>
<td><?=number_format($Torrent['Snatched'])?></td> <td><?=number_format($Torrent['Snatched'])?></td>

View File

@ -812,7 +812,7 @@ function header_link($SortKey,$DefaultWay="DESC") {
} }
$Artists = Artists::get_artists($GroupIDs); $Artists = Artists::get_artists($GroupIDs);
foreach ($TorrentList as $Key => $Properties) { 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['id'] =explode('|',$TorrentsID);
$Torrents['media'] =explode('|',$TorrentsMedia); $Torrents['media'] =explode('|',$TorrentsMedia);
$Torrents['format'] =explode('|',$TorrentsFormat); $Torrents['format'] =explode('|',$TorrentsFormat);
@ -859,17 +859,7 @@ function header_link($SortKey,$DefaultWay="DESC") {
$Torrents['snatched'][0]=$TotalSnatched; $Torrents['snatched'][0]=$TotalSnatched;
} }
$TagList=array(); $TorrentTags = new Tags($TagsList);
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>';
}
if ($GroupName=='') { $GroupName="- None -"; } if ($GroupName=='') { $GroupName="- None -"; }
$DisplayName = Artists::display_artists($Artists[$GroupID]); $DisplayName = Artists::display_artists($Artists[$GroupID]);
@ -880,11 +870,23 @@ function header_link($SortKey,$DefaultWay="DESC") {
?> ?>
<tr class="group"> <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"><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 class="center cats_col"><div title="<?=$TorrentTags->title()?>" class="<?=Format::css_category($GroupCategoryID)?> <?=$TorrentTags->css_name()?>"></div></td>
<td colspan="2"> <td colspan="2" class="big_info">
<?=$DisplayName?> <?
<span style="float:right;"><a href="#showimg_<?=$GroupID?>" onclick="Bookmark(<?=$GroupID?>);this.innerHTML='Bookmarked';return false;" class="brackets">Bookmark</a></span> // Image cover art requires WikiImage
<?=$TorrentTags?> /*
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>
<td class="nobr"><?=time_diff($GroupTime,1)?></td> <td class="nobr"><?=time_diff($GroupTime,1)?></td>
<td class="nobr"><?=Format::get_size($MaxSize)?> (Max)</td> <td class="nobr"><?=Format::get_size($MaxSize)?> (Max)</td>
@ -998,12 +1000,19 @@ function header_link($SortKey,$DefaultWay="DESC") {
<? if(!$DisableGrouping) { ?> <? if(!$DisableGrouping) { ?>
<td></td> <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 class="center cats_col"><div title="<?=$TorrentTags->title()?>" class="<?=Format::css_category($GroupCategoryID)?> <?=$TorrentTags->css_name()?>"></div></td>
<td> <td class="big_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> <? /* if ($LoggedUser['CoverArt']) : ?>
<?=$DisplayName?> <div class="group_image float_left clear">
<?=$ExtraInfo?> <? ImageTools::cover_thumb('', $GroupCategoryID - 1) ?>
<?=$TorrentTags?> </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>
<td><?=$Torrents['filecount'][0]?></td> <td><?=$Torrents['filecount'][0]?></td>
<td class="nobr"><?=time_diff($GroupTime,1)?></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($_GET['action']) && $_GET['action'] == "advanced";
$AdvancedSearch |= !empty($LoggedUser['SearchType']) && (empty($_GET['action']) || $_GET['action'] == "advanced"); $AdvancedSearch |= !empty($LoggedUser['SearchType']) && (empty($_GET['action']) || $_GET['action'] == "advanced");
$AdvancedSearch &= check_perms('site_advanced_search'); $AdvancedSearch &= check_perms('site_advanced_search');
if ($AdvancedSearch) { if ($AdvancedSearch) {
$Action = 'action=advanced'; $Action = 'action=advanced';
$HideBasic = ' hidden'; $HideBasic = ' hidden';
@ -579,7 +578,6 @@ function header_link($SortKey,$DefaultWay="desc") {
<td class="label">Artist name:</td> <td class="label">Artist name:</td>
<td colspan="3" class="ft_artistname"> <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="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> </td>
</tr> </tr>
<tr id="album_torrent_name" class="ftr_advanced<?=$HideAdvanced?>"> <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 class="label">Search terms:</td>
<td colspan="3" class="ftb_searchstr"> <td colspan="3" class="ftb_searchstr">
<input type="text" spellcheck="false" size="40" name="searchstr" class="inputtext fti_basic" value="<?Format::form('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> </td>
</tr> </tr>
<tr id="tagfilter"> <tr id="tagfilter">
@ -812,6 +807,7 @@ function header_link($SortKey,$DefaultWay="desc") {
<div class="submit ft_submit"> <div class="submit ft_submit">
<span style="float:left;"><?=number_format($TorrentCount)?> Results</span> <span style="float:left;"><?=number_format($TorrentCount)?> Results</span>
<input type="submit" value="Filter Torrents" /> <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="hidden" name="searchsubmit" value="1" />
<input type="button" value="Reset" onclick="location.href='torrents.php<? if (isset($_GET['action']) && $_GET['action']=="advanced") { ?>?action=advanced<? } ?>'" /> <input type="button" value="Reset" onclick="location.href='torrents.php<? if (isset($_GET['action']) && $_GET['action']=="advanced") { ?>?action=advanced<? } ?>'" />
&nbsp;&nbsp; &nbsp;&nbsp;
@ -925,13 +921,8 @@ function header_link($SortKey,$DefaultWay="desc") {
} else { } else {
$Torrents = array($Result['id'] => $GroupInfo['Torrents'][$Result['id']]); $Torrents = array($Result['id'] => $GroupInfo['Torrents'][$Result['id']]);
} }
$TagList = explode(' ',str_replace('_','.',$GroupInfo['TagList']));
$TorrentTags = array(); $TorrentTags = new Tags($GroupInfo['TagList']);
foreach ($TagList as $Tag) {
$TorrentTags[]='<a href="torrents.php?'.$Action.'&amp;taglist='.$Tag.'">'.$Tag.'</a>';
}
$TorrentTags = implode(', ', $TorrentTags);
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) { if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
unset($ExtendedArtists[2]); unset($ExtendedArtists[2]);
@ -963,19 +954,24 @@ function header_link($SortKey,$DefaultWay="desc") {
</div> </div>
</td> </td>
<td class="center cats_col"> <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> </div>
</td> </td>
<td colspan="2"> <td colspan="2" class="big_info">
<?=$DisplayName?> <? 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)) { ?> <? 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 { ?> <? } 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 /> <br />
<div class="tags"> <div class="tags"><?=$TorrentTags->format('torrents.php?'.$Action.'&amp;taglist=')?></div>
<?=$TorrentTags?>
</div> </div>
</td> </td>
<td class="nobr"><?=time_diff($GroupTime,1)?></td> <td class="nobr"><?=time_diff($GroupTime,1)?></td>
@ -1098,19 +1094,26 @@ function header_link($SortKey,$DefaultWay="desc") {
<td></td> <td></td>
<? } ?> <? } ?>
<td class="center cats_col"> <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>
<td> <td class="big_info">
<span> <? if ($LoggedUser['CoverArt']) : ?>
[ <a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download">DL</a> <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)) { ?> <? if (Torrents::can_use_token($Data)) { ?>
| <a href="torrents.php?action=download&amp;id=<?=$TorrentID ?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>&amp;usetoken=1" title="Use a FL Token" onclick="return confirm('Are you sure you want to use a freeleech token here?');">FL</a> | <a href="torrents.php?action=download&amp;id=<?=$TorrentID ?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>&amp;usetoken=1" title="Use a FL Token" onclick="return confirm('Are you sure you want to use a freeleech token here?');">FL</a>
<? } ?> <? } ?>
| <a href="reportsv2.php?action=report&amp;id=<?=$TorrentID?>" title="Report">RP</a> ] | <a href="reportsv2.php?action=report&amp;id=<?=$TorrentID?>" title="Report">RP</a> ]
</span> </span>
<?=$DisplayName?> <?=$DisplayName?>
<div class="torrent_info"><?=$ExtraInfo?></div> <div class="torrent_info"><?=$ExtraInfo?></div>
<div class="tags"><?=$TorrentTags?></div> <div class="tags"><?=$TorrentTags->format('torrents.php?'.$Action.'&amp;taglist=')?></div>
</div>
</td> </td>
<td><?=$Data['FileCount']?></td> <td><?=$Data['FileCount']?></td>
<td class="nobr"><?=time_diff($Data['Time'],1)?></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.'/sections/bookmarks/functions.php'); // has_bookmarked()
include(SERVER_ROOT.'/classes/class_text.php'); include(SERVER_ROOT.'/classes/class_text.php');
include(SERVER_ROOT.'/classes/class_image_tools.php');
$Text = NEW TEXT; $Text = NEW TEXT;
@ -114,11 +113,12 @@ function compare($X, $Y){
<div class="head"><strong>Cover</strong></div> <div class="head"><strong>Cover</strong></div>
<? <?
if ($WikiImage!="") { if ($WikiImage!="") {
$WikiImageThumb = ImageTools::wiki_image($WikiImage);
if(check_perms('site_proxy_images')) { 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 { } else {
?> ?>

View File

@ -147,32 +147,15 @@
$DB->query("SELECT File FROM torrents_files WHERE TorrentID='$TorrentID'"); $DB->query("SELECT File FROM torrents_files WHERE TorrentID='$TorrentID'");
list($Contents) = $DB->next_record(MYSQLI_NUM, false); 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); $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'); 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-Type: application/x-bittorrent; charset=utf-8');
} }
header('Content-disposition: attachment; filename="'.$FileName.'"'); header('Content-disposition: attachment; filename="'.$FileName.'"');
echo $TorEnc; echo TorrentsDL::get_file($Contents, ANNOUNCE_URL."/$TorrentPass/announce");
define('IE_WORKAROUND_NO_CACHE_HEADERS', 1); 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 = Torrents::get_groups($GroupIDs);
$TorrentGroups = $TorrentGroups['matches']; $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 // Get the relevant filter labels
$DB->query("SELECT ID, Label, Artists FROM users_notify_filters WHERE ID IN (".implode(',', $FilterIDs).")"); $DB->query("SELECT ID, Label, Artists FROM users_notify_filters WHERE ID IN (".implode(',', $FilterIDs).")");
$Filters = $DB->to_array('ID', MYSQLI_ASSOC, array('Artists')); $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>"; $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 ($GroupCategoryID == 1) {
if ($GroupInfo['Year'] > 0) { if ($GroupInfo['Year'] > 0) {
$DisplayName .= " [$GroupInfo[Year]]"; $DisplayName .= " [$GroupInfo[Year]]";
@ -247,42 +243,39 @@ function header_link($SortKey, $DefaultWay = "desc") {
// append extra info to torrent title // append extra info to torrent title
$ExtraInfo = Torrents::torrent_info($TorrentInfo, true, true); $ExtraInfo = Torrents::torrent_info($TorrentInfo, true, true);
$TagLinks = array(); $TorrentTags = new Tags($GroupInfo['TagList']);
if ($GroupInfo['TagList'] != '') {
$TorrentTags = array(); if ($GroupInfo['TagList'] == '')
$TagList = explode(' ', $GroupInfo['TagList']); $TorrentTags->set_primary($Categories[$GroupCategoryID-1]);
$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];
}
// print row // print row
?> ?>
<tr class="torrent torrent_row<?=($TorrentInfo['IsSnatched'] ? ' snatched_torrent' : '') . ($GroupInfo['Flags']['IsSnatched'] ? ' snatched_group' : '')?>" id="torrent<?=$TorrentID?>"<?=$MatchingArtistsText ? 'title="'.display_str($MatchingArtistsText).'"' : ''?>> <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 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 class="center cats_col"><div title="<?=$TorrentTags->title()?>"class="<?=Format::css_category($GroupCategoryID)?> <?=$TorrentTags->css_name()?>"></div></td>
<td> <td class="big_info">
<span> <? if ($LoggedUser['CoverArt']) : ?>
[ <a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download">DL</a> <div class="group_image float_left clear">
<? if (Torrents::can_use_token($TorrentInfo)) { ?> <? ImageTools::cover_thumb($GroupInfo['WikiImage'], $GroupCategoryID - 1) ?>
| <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> </div>
<? } ?> <? endif; ?>
| <a href="#" onclick="Clear(<?=$TorrentID?>);return false;" title="Remove from notifications list">CL</a> ] <div class="group_info clear">
</span> <span>
<strong><?=$DisplayName?></strong> [ <a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download">DL</a>
<div class="torrent_info"> <? if (Torrents::can_use_token($TorrentInfo)) { ?>
<?=$ExtraInfo?> | <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>
<? if ($Result['UnRead']) { <? } ?>
echo '<strong class="new">New!</strong>'; | <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>
<div class="tags"><?=$TorrentTags?></div>
</td> </td>
<td><?=$TorrentInfo['FileCount']?></td> <td><?=$TorrentInfo['FileCount']?></td>
<td style="text-align:right" class="nobr"><?=time_diff($TorrentInfo['Time'])?></td> <td style="text-align:right" class="nobr"><?=time_diff($TorrentInfo['Time'])?></td>

View File

@ -14,9 +14,6 @@
$UserClass = $Perms['Class']; $UserClass = $Perms['Class'];
list($UserID, $Username) = array_values($User); list($UserID, $Username) = array_values($User);
require(SERVER_ROOT.'/classes/class_bencode.php');
require(SERVER_ROOT.'/classes/class_torrent.php');
if (empty($_GET['type'])) { if (empty($_GET['type'])) {
error(0); error(0);
} else { } else {
@ -81,16 +78,7 @@
while (list($TorrentID, $TorrentFile) = $DB->next_record(MYSQLI_NUM, false)) { while (list($TorrentID, $TorrentFile) = $DB->next_record(MYSQLI_NUM, false)) {
$Download =& $Downloads[$TorrentID]; $Download =& $Downloads[$TorrentID];
$Download['Artist'] = Artists::display_artists($Artists[$Download['GroupID']], false, true, false); $Download['Artist'] = Artists::display_artists($Artists[$Download['GroupID']], false, true, false);
if (Misc::is_new_torrent($TorrentFile)) { $Collector->add_file($TorrentFile, $Download, $Download['Month']);
$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']);
unset($Download); unset($Download);
} }
} }

View File

@ -14,10 +14,10 @@
$Group = Torrents::get_groups(array($GroupID)); $Group = Torrents::get_groups(array($GroupID));
$Group = array_pop($Group['matches']); $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 = '';
$Name .= Artists::display_artists(array('1'=>$GroupArtists), false, true); $Name .= Artists::display_artists(array('1'=>$Artists), false, true);
$Name .= $GroupName; $Name .= $GroupName;
$DB->query("SELECT uid, tstamp FROM xbt_snatched WHERE fid='$TorrentID' ORDER BY tstamp DESC LIMIT 10"); $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'); require(SERVER_ROOT.'/classes/class_validate.php');
include(SERVER_ROOT.'/classes/class_image_tools.php');
$Validate = new VALIDATE; $Validate = new VALIDATE;
@ -225,7 +224,7 @@
if (preg_match($RegX, $Properties['Image'], $Matches)) { if (preg_match($RegX, $Properties['Image'], $Matches)) {
$Properties['Image'] = $Matches[1].'.jpg'; $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($Err){ // Show the upload form, with the data the user entered
if(check_perms('site_debug')) { if(check_perms('site_debug')) {

View File

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

View File

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

View File

@ -2,33 +2,23 @@
$ExtraTorrentsInsert = array(); $ExtraTorrentsInsert = array();
foreach ($ExtraTorrents as $ExtraTorrent) { foreach ($ExtraTorrents as $ExtraTorrent) {
$Name = $ExtraTorrent['Name']; $Name = $ExtraTorrent['Name'];
$ExtraTorrentsInsert[$Name] = array();
$ExtraTorrentsInsert[$Name] = $ExtraTorrent; $ExtraTorrentsInsert[$Name] = $ExtraTorrent;
$ThisInsert =& $ExtraTorrentsInsert[$Name];
$ExtraFile = fopen($Name, 'rb'); // open file for reading $ExtraTor = new BEncTorrent($Name, true);
$ExtraContents = fread($ExtraFile, 10000000); if (isset($ExtraTor->Dec['encrypted_files'])) {
$ExtraTor = new TORRENT($ExtraContents); // New TORRENT object
if (isset($ExtraTor->Val['info']->Val['encrypted_files'])) {
$Err = "At least one of the torrents contain an encrypted file list which is not supported here"; $Err = "At least one of the torrents contain an encrypted file list which is not supported here";
break; break;
} }
if (!$ExtraTor->is_private()) {
// Remove uploader's passkey from the torrent. $ExtraTor->make_private(); // The torrent is now private.
// We put the downloader's passkey in on download, so it doesn't matter what's in there now, $PublicTorrent = true;
// 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.
// File list and size // File list and size
list($ExtraTotalSize, $ExtraFileList) = $ExtraTor->file_list(); list($ExtraTotalSize, $ExtraFileList) = $ExtraTor->file_list();
$ExtraTorrentsInsert[$Name]['TotalSize'] = $ExtraTotalSize;
$ExtraDirName = isset($ExtraTor->Val['info']->Val['files']) ? Format::make_utf8($ExtraTor->get_name()) : ""; $ExtraDirName = isset($ExtraTor->Val['info']->Val['files']) ? Format::make_utf8($ExtraTor->get_name()) : "";
$ExtraTmpFileList = array(); $ExtraTmpFileList = array();
foreach ($ExtraFileList as $ExtraFile) { foreach ($ExtraFileList as $ExtraFile) {
list($ExtraSize, $ExtraName) = $ExtraFile; list($ExtraSize, $ExtraName) = $ExtraFile;
@ -37,29 +27,22 @@
// Make sure the filename is not too long // Make sure the filename is not too long
if (mb_strlen($ExtraName, 'UTF-8') + mb_strlen($ExtraDirName, 'UTF-8') + 1 > MAX_FILENAME_LENGTH) { 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 . ')'; $Err = 'The torrent contained one or more files with too long a name (' . $ExtraName . ')';
break;
} }
// Add file and size to array // Add file and size to array
$ExtraTmpFileList[] = Torrents::filelist_format_file($ExtraFile); $ExtraTmpFileList[] = Torrents::filelist_format_file($ExtraFile);
} }
// To be stored in the database // To be stored in the database
$ExtraFilePath = db_string($ExtraDirName); $ThisInsert['FilePath'] = db_string($ExtraDirName);
$ExtraTorrentsInsert[$Name]['FilePath'] = $ExtraFilePath; $ThisInsert['FileString'] = db_string(implode("\n", $ExtraTmpFileList));
$ExtraFileString = db_string(implode("\n", $ExtraTmpFileList)); $ThisInsert['InfoHash'] = pack('H*', $ExtraTor->info_hash());
$ExtraTorrentsInsert[$Name]['FileString'] = $ExtraFileString; $ThisInsert['NumFiles'] = count($ExtraFileList);
// Number of files described in torrent $ThisInsert['TorEnc'] = db_string($ExtraTor->encode());
$ExtraNumFiles = count($ExtraFileList); $ThisInsert['TotalSize'] = $ExtraTotalSize;
$ExtraTorrentsInsert[$Name]['NumFiles'] = $ExtraNumFiles;
// The string that will make up the final torrent file
$ExtraTorrentText = $ExtraTor->enc();
// Infohash $Debug->set_flag('upload: torrent decoded');
$DB->query("SELECT ID FROM torrents WHERE info_hash='" . db_string($ThisInsert['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) . "'");
if ($DB->record_count() > 0) { if ($DB->record_count() > 0) {
list($ExtraID) = $DB->next_record(); list($ExtraID) = $DB->next_record();
$DB->query("SELECT TorrentID FROM torrents_files WHERE TorrentID = " . $ExtraID); $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>'; $Err = '<a href="torrents.php?torrentid=' . $ExtraID . '">The exact same torrent file already exists on the site!</a>';
} else { } else {
//One of the lost torrents. //One of the lost torrents.
$DB->query("INSERT INTO torrents_files (TorrentID, File) VALUES ($ExtraID, '" . db_string($ExtraTor->dump_data()) . "')"); $DB->query("INSERT INTO torrents_files (TorrentID, File) VALUES ($ExtraID, '$ThisInsert[TorEnc]')");
$Err = '<a href="torrents.php?torrentid=' . $ExtraID . '">Thankyou for fixing this torrent</a>'; $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."; $Err = "Missing format for extra torrent.";
break; break;
} else { } else {
$ExtraTorrents[$ExtraTorrentName]['Format'] = "'" . db_string(trim($ExtraFormat)) . "'"; $ExtraTorrents[$ExtraTorrentName]['Format'] = db_string(trim($ExtraFormat));
} }
$ExtraBitrate = $_POST['extra_bitrate'][$j]; $ExtraBitrate = $_POST['extra_bitrate'][$j];
if (empty($ExtraBitrate)) { if (empty($ExtraBitrate)) {
$Err = "Missing bitrate for extra torrent."; $Err = "Missing bitrate for extra torrent.";
break; break;
} else { } else {
$ExtraTorrents[$ExtraTorrentName]['Encoding'] = "'" . db_string(trim($ExtraBitrate)) . "'"; $ExtraTorrents[$ExtraTorrentName]['Encoding'] = db_string(trim($ExtraBitrate));
} }
$ExtraReleaseDescription = $_POST['extra_release_desc'][$j]; $ExtraReleaseDescription = $_POST['extra_release_desc'][$j];
$ExtraTorrents[$ExtraTorrentName]['TorrentDescription'] = "'" . db_string(trim($ExtraReleaseDescription)) . "'"; $ExtraTorrents[$ExtraTorrentName]['TorrentDescription'] = db_string(trim($ExtraReleaseDescription));
$DupeNames[] = $ExtraFile['name']; $DupeNames[] = $ExtraFile['name'];
} }
} }

View File

@ -1,8 +1,8 @@
<? <?
foreach ($ExtraTorrentsInsert as $ExtraTorrent) { foreach ($ExtraTorrentsInsert as $ExtraTorrent) {
$ExtraHasLog = "'0'"; $ExtraHasLog = 0;
$ExtraHasCue = "'0'"; $ExtraHasCue = 0;
$LogScore = ($HasLog == 1 ? $LogScoreAverage : 0);
// Torrent // Torrent
$DB->query(" $DB->query("
INSERT INTO torrents INSERT INTO torrents
@ -11,9 +11,11 @@
HasLog, HasCue, info_hash, FileCount, FileList, FilePath, Size, Time, HasLog, HasCue, info_hash, FileCount, FileList, FilePath, Size, Time,
Description, LogScore, FreeTorrent, FreeLeechType) Description, LogScore, FreeTorrent, FreeLeechType)
VALUES VALUES
(" . $GroupID . ", " . $LoggedUser['ID'] . ", " . $T['Media'] . ", " . $ExtraTorrent['Format'] . ", " . $ExtraTorrent['Encoding'] . ", ($GroupID, $LoggedUser[ID], $T[Media], '$ExtraTorrent[Format]', '$ExtraTorrent[Encoding]', " .
" . $T['Remastered'] . ", " . $T['RemasterYear'] . ", " . $T['RemasterTitle'] . ", " . $T['RemasterRecordLabel'] . ", " . $T['RemasterCatalogueNumber'] . ", " . $ExtraHasLog . ", " . $ExtraHasCue . ", '" . db_string($ExtraTorrent['InfoHash']) . "', " . $ExtraTorrent['NumFiles'] . ", '" . $ExtraTorrent['FileString'] . "', '" . $ExtraTorrent['FilePath'] . "', " . $ExtraTorrent['TotalSize'] . ", '" . sqltime() . "', "$T[Remastered], $T[RemasterYear], $T[RemasterTitle], $T[RemasterRecordLabel], $T[RemasterCatalogueNumber], " .
" . $ExtraTorrent['TorrentDescription'] . ", '" . (($HasLog == "'1'") ? $LogScoreAverage : 0) . "', '" . $T['FreeLeech'] . "', '" . $T['FreeLeechType'] . "')"); "$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'); $Cache->increment('stats_torrent_count');
$ExtraTorrentID = $DB->inserted_id(); $ExtraTorrentID = $DB->inserted_id();
@ -25,7 +27,7 @@
//******************************************************************************// //******************************************************************************//
//--------------- Write torrent file -------------------------------------------// //--------------- 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']); 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); 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('upload_max_filesize',2097152);
ini_set('max_file_uploads',100); ini_set('max_file_uploads',100);
define(MAX_FILENAME_LENGTH, 180); define(MAX_FILENAME_LENGTH, 180);
require(SERVER_ROOT.'/classes/class_torrent.php');
include(SERVER_ROOT.'/classes/class_validate.php'); include(SERVER_ROOT.'/classes/class_validate.php');
include(SERVER_ROOT.'/classes/class_feed.php'); include(SERVER_ROOT.'/classes/class_feed.php');
include(SERVER_ROOT.'/classes/class_text.php'); include(SERVER_ROOT.'/classes/class_text.php');
include(SERVER_ROOT.'/sections/torrents/functions.php'); include(SERVER_ROOT.'/sections/torrents/functions.php');
include(SERVER_ROOT.'/classes/class_file_checker.php'); include(SERVER_ROOT.'/classes/class_file_checker.php');
include(SERVER_ROOT.'/classes/class_image_tools.php');
enforce_login(); enforce_login();
authorize(); authorize();
@ -326,7 +324,7 @@
if (preg_match($RegX, $Properties['Image'], $Matches)) { if (preg_match($RegX, $Properties['Image'], $Matches)) {
$Properties['Image'] = $Matches[1].'.jpg'; $Properties['Image'] = $Matches[1].'.jpg';
} }
check_imagehost($Properties['Image']); ImageTools::blacklisted($Properties['Image']);
//******************************************************************************// //******************************************************************************//
//--------------- Make variables ready for database input ----------------------// //--------------- Make variables ready for database input ----------------------//
@ -346,94 +344,72 @@
//******************************************************************************// //******************************************************************************//
//--------------- Generate torrent file ----------------------------------------// //--------------- 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 $DB->query("SELECT ID FROM torrents WHERE info_hash='".db_string($InfoHash)."'");
$Contents = fread($File, 10000000); if ($DB->record_count() > 0) {
$Tor = new TORRENT($Contents); // New TORRENT object 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"; $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 // File list and size
list($TotalSize, $FileList) = $Tor->file_list(); 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(); $TmpFileList = array();
$HasLog = "'0'";
$HasCue = "'0'";
$TooLongPaths = array(); $TooLongPaths = array();
$DirName = isset($Tor->Dec['info']['files']) ? Format::make_utf8($Tor->get_name()) : "";
foreach($FileList as $File) { foreach ($FileList as $File) {
list($Size, $Name) = $File; list($Size, $Name) = $File;
// add +log to encoding // add +log to encoding
if($T['Encoding'] == "'Lossless'" && preg_match('/(?<!audiochecker)\.log$/i', $Name)) { if ($T['Encoding'] == "'Lossless'" && preg_match('/(?<!audiochecker)\.log$/i', $Name)) {
$HasLog = "'1'"; $HasLog = 1;
} }
// add +cue to encoding // add +cue to encoding
if($T['Encoding'] == "'Lossless'" && preg_match('/\.cue$/i', $Name)) { if ($T['Encoding'] == "'Lossless'" && preg_match('/\.cue$/i', $Name)) {
$HasCue = "'1'"; $HasCue = 1;
} }
// Check file name and extension against blacklist/whitelist
check_file($Type, $Name); check_file($Type, $Name);
// Make sure the filename is not too long // 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; $TooLongPaths[] = $Name;
} }
// Add file info to array // Add file info to array
$TmpFileList[] = Torrents::filelist_format_file($File); $TmpFileList[] = Torrents::filelist_format_file($File);
} }
if (count($TooLongPaths) > 0) {
if(count($TooLongPaths)!=0) {
$Names = ''; $Names = '';
foreach($TooLongPaths as $Name) { foreach ($TooLongPaths as $Name) {
$Names .= '<br>'.$Name; $Names .= '<br>'.$Name;
} }
$Err = 'The torrent contained one or more files with too long a name:'.$Names; $Err = 'The torrent contained one or more files with too long a name:'.$Names;
} }
// To be stored in the database
$FilePath = db_string($DirName); $FilePath = db_string($DirName);
$FileString = db_string(implode("\n", $TmpFileList)); $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'); $Debug->set_flag('upload: torrent decoded');
// Infohash if ($Type == 'Music') {
$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') {
include(SERVER_ROOT.'/sections/upload/generate_extra_torrents.php'); include(SERVER_ROOT.'/sections/upload/generate_extra_torrents.php');
} }
if(!empty($Err)) { // Show the upload form, with the data the user entered if (!empty($Err)) { // Show the upload form, with the data the user entered
$UploadForm=$Type; $UploadForm = $Type;
include(SERVER_ROOT.'/sections/upload/upload.php'); include(SERVER_ROOT.'/sections/upload/upload.php');
die(); die();
} }
@ -633,7 +609,7 @@
// Use this section to control freeleeches // Use this section to control freeleeches
$T['FreeLeech'] = 0; $T['FreeLeech'] = 0;
$T['FreeLeechType'] = 0; $T['FreeLeechType'] = 0;
$LogScore = ($HasLog == 1 ? $LogScoreAverage : 0);
// Torrent // Torrent
$DB->query(" $DB->query("
INSERT INTO torrents INSERT INTO torrents
@ -642,10 +618,10 @@
Scene, HasLog, HasCue, info_hash, FileCount, FileList, FilePath, Size, Time, Scene, HasLog, HasCue, info_hash, FileCount, FileList, FilePath, Size, Time,
Description, LogScore, FreeTorrent, FreeLeechType) Description, LogScore, FreeTorrent, FreeLeechType)
VALUES VALUES
(".$GroupID.", ".$LoggedUser['ID'].", ".$T['Media'].", ".$T['Format'].", ".$T['Encoding'].", ($GroupID, $LoggedUser[ID], $T[Media], $T[Format], $T[Encoding], " .
".$T['Remastered'].", ".$T['RemasterYear'].", ".$T['RemasterTitle'].", ".$T['RemasterRecordLabel'].", ".$T['RemasterCatalogueNumber'].", "$T[Remastered], $T[RemasterYear], $T[RemasterTitle], $T[RemasterRecordLabel], $T[RemasterCatalogueNumber], " .
".$T['Scene'].", ".$HasLog.", ".$HasCue.", '".db_string($InfoHash)."', ".$NumFiles.", '".$FileString."', '".$FilePath."', ".$TotalSize.", '".sqltime()."', "$T[Scene], '$HasLog', '$HasCue', '".db_string($InfoHash)."', $NumFiles, '$FileString', '$FilePath', " .
".$T['TorrentDescription'].", '".(($HasLog == "'1'") ? $LogScoreAverage : 0)."', '".$T['FreeLeech']."', '".$T['FreeLeechType']."')"); "$TotalSize, '".sqltime()."', $T[TorrentDescription], $LogScore, $T[FreeLeech], $T[FreeLeechType])");
$Cache->increment('stats_torrent_count'); $Cache->increment('stats_torrent_count');
$TorrentID = $DB->inserted_id(); $TorrentID = $DB->inserted_id();
@ -656,12 +632,12 @@
//******************************************************************************// //******************************************************************************//
//--------------- Write torrent file -------------------------------------------// //--------------- 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']); 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::write_group_log($GroupID, $TorrentID, $LoggedUser['ID'], "uploaded (".number_format($TotalSize/(1024*1024), 2)." MB)", 0);
Torrents::update_hash($GroupID); Torrents::update_hash($GroupID);
$Debug->set_flag('upload: sphinx updated');
if($Type == 'Music') { if($Type == 'Music') {
include(SERVER_ROOT.'/sections/upload/insert_extra_torrents.php'); 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'])."', '', '')"); 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 ---------------------------------------// //--------------- IRC announce and feeds ---------------------------------------//
$Announce = ""; $Announce = "";
@ -723,9 +727,9 @@
if (($Type == 'Music') && ($Properties['ReleaseType'] > 0)) { $Announce .= ' ['.$ReleaseTypes[$Properties['ReleaseType']].']'; } if (($Type == 'Music') && ($Properties['ReleaseType'] > 0)) { $Announce .= ' ['.$ReleaseTypes[$Properties['ReleaseType']].']'; }
$Announce .= " - "; $Announce .= " - ";
$Announce .= trim($Properties['Format'])." / ".trim($Properties['Bitrate']); $Announce .= trim($Properties['Format'])." / ".trim($Properties['Bitrate']);
if ($HasLog == "'1'") { $Announce .= " / Log"; } if ($HasLog == 1) { $Announce .= " / Log"; }
if ($LogInDB) { $Announce .= " / ".$LogScoreAverage.'%'; } if ($LogInDB) { $Announce .= " / ".$LogScoreAverage.'%'; }
if ($HasCue == "'1'") { $Announce .= " / Cue"; } if ($HasCue == 1) { $Announce .= " / Cue"; }
$Announce .= " / ".trim($Properties['Media']); $Announce .= " / ".trim($Properties['Media']);
if ($Properties['Scene'] == "1") { $Announce .= " / Scene"; } if ($Properties['Scene'] == "1") { $Announce .= " / Scene"; }
if ($T['FreeLeech'] == "1") { $Announce .= " / Freeleech!"; } if ($T['FreeLeech'] == "1") { $Announce .= " / Freeleech!"; }
@ -940,18 +944,3 @@
// Clear Cache // Clear Cache
$Cache->delete('torrents_details_'.$GroupID); $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> </select>
</td> </td>
</tr>--> </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> <tr>
<td class="label"><strong>Collage album covers to show per page</strong></td> <td class="label"><strong>Collage album covers to show per page</strong></td>
<td> <td>

View File

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

View File

@ -4,7 +4,6 @@
$Text = new TEXT; $Text = new TEXT;
include(SERVER_ROOT.'/sections/requests/functions.php'); include(SERVER_ROOT.'/sections/requests/functions.php');
include(SERVER_ROOT.'/classes/class_image_tools.php');
if (empty($_GET['id']) || !is_numeric($_GET['id'])) if (empty($_GET['id']) || !is_numeric($_GET['id']))
error(404); error(404);
@ -534,7 +533,7 @@ function check_paranoia_here($Setting) {
<? <?
foreach($RecentSnatches as $RS) { ?> foreach($RecentSnatches as $RS) { ?>
<td> <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> </td>
<? } ?> <? } ?>
</tr> </tr>
@ -573,7 +572,7 @@ function check_paranoia_here($Setting) {
<tr> <tr>
<? foreach($RecentUploads as $RU) { ?> <? foreach($RecentUploads as $RU) { ?>
<td> <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> </td>
<? } ?> <? } ?>
</tr> </tr>
@ -610,14 +609,14 @@ function check_paranoia_here($Setting) {
<? foreach($Collage as $C) { <? foreach($Collage as $C) {
$Group = Torrents::get_groups(array($C['GroupID'])); $Group = Torrents::get_groups(array($C['GroupID']));
$Group = array_pop($Group['matches']); $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 = '';
$Name .= Artists::display_artists(array('1'=>$GroupArtists), false, true); $Name .= Artists::display_artists(array('1'=>$Artists), false, true);
$Name .= $GroupName; $Name .= $GroupName;
?> ?>
<td> <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> </td>
<? } ?> <? } ?>
</tr> </tr>

View File

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

View File

@ -1988,3 +1988,7 @@ tr.torrent .bookmark > a:after { content:""; }
.top10_quantity_links .brackets:after { .top10_quantity_links .brackets:after {
color: #878787; 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 { #userinfo .brackets:before, #userinfo .brackets:after {
content: ""; 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 { .top10_quantity_links .brackets:after {
color: #757575; 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 { .top10_quantity_links .brackets:after {
color: #757575; 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 { .top10_quantity_links .brackets:after {
color: #444; 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.group>td:first-child+td+td,
table.grouping>tbody>tr.colhead>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.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 {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; } .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 { .top10_quantity_links .brackets:after {
color: #575757; 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; }