86 changes from Wed Jul 27 01:50:24 2011 -0400 to Tue Aug 9 12:47:47 2011 -0400

fix typo I introduced in schedule.php
Print to LAB_CHAN if sphinx connection fails
nice bitcoin display
Corrects [#] tag for Mono  [hateradio]
bitcoin donation
Fix torrent unbookmarking
upgraded sphinxapi.php to r2876 as the site is running r2902
Added options to block Tor, Opera Turbo and Opera Mini
check for stale cache
vanity house  [clone00]
bookmark almost anything  [patapper]
new torrent edit flags  [rattvis]
permissions stuff from patappatch c
[BBCode] new [important] tag  [DutchDude]
Fixed images flowing past their boxes  [hateradio]
[BBCode] Tag for ordered lists.  [hateradio]
finally fixed that annoying textarea-resizing thing
renamed temporary tables

fixes http://what.cd/forums.php?action=viewthread&threadid=137432&page=1#post3408738
implements http://what.cd/forums.php?action=viewthread&threadid=122832
fixes http://what.cd/forums.php?action=viewthread&threadid=136553
fixes http://what.cd/forums.php?action=viewthread&threadid=112967
implements http://what.cd/forums.php?action=viewthread&threadid=110395
This commit is contained in:
What.CD 2011-08-09 21:03:28 +00:00
parent 269d2b9a69
commit 6273679d49
54 changed files with 796 additions and 231 deletions

View File

@ -63,9 +63,8 @@ function search($Query='', $CachePrefix='', $CacheLength=0, $ReturnData=array(),
if($this->_connerror && !$Cache->get_value('sphinx_crash_reported')) {
send_irc('PRIVMSG '.ADMIN_CHAN.' :!dev Connection to searchd failed');
$Cache->cache_value('sphinx_crash_reported', 1, 3600);
} else {
send_irc('PRIVMSG '.LAB_CHAN.' :Search for "'.$Query.'" ('.str_replace("\n",'',print_r($this->Filters, true)).') failed: '.$this->GetLastError());
}
send_irc('PRIVMSG '.LAB_CHAN.' :Search for "'.$Query.'" ('.str_replace("\n",'',print_r($this->Filters, true)).') failed: '.$this->GetLastError());
}
$this->TotalResults = $Result['total'];

View File

@ -1,7 +1,7 @@
<?
class TEXT {
// tag=>max number of attributes
private $ValidTags = array('b'=>0, 'u'=>0, 'i'=>0, 's'=>0, '*'=>0, 'artist'=>0, 'user'=>0, 'n'=>0, 'inlineurl'=>0, 'inlinesize'=>1, 'align'=>1, 'color'=>1, 'colour'=>1, 'size'=>1, 'url'=>1, 'img'=>1, 'quote'=>1, 'pre'=>1, 'code'=>1, 'tex'=>0, 'hide'=>1, 'plain'=>0
private $ValidTags = array('b'=>0, 'u'=>0, 'i'=>0, 's'=>0, '*'=>0, '#'=>0, 'artist'=>0, 'user'=>0, 'n'=>0, 'inlineurl'=>0, 'inlinesize'=>1, 'align'=>1, 'color'=>1, 'colour'=>1, 'size'=>1, 'url'=>1, 'img'=>1, 'quote'=>1, 'pre'=>1, 'code'=>1, 'tex'=>0, 'hide'=>1, 'plain'=>0, 'important'=>0
);
private $Smileys = array(
':angry:' => 'angry.gif',
@ -196,7 +196,7 @@ function parse($Str) {
// 1) Find the next tag (regex)
// [name(=attribute)?]|[[wiki-link]]
$IsTag = preg_match("/((\[[a-zA-Z*]+)(=(?:[^\n'\"\[\]]|\[\d*\])+)?\])|(\[\[[^\n\"'\[\]]+\]\])/", $Str, $Tag, PREG_OFFSET_CAPTURE, $i);
$IsTag = preg_match("/((\[[a-zA-Z*#]+)(=(?:[^\n'\"\[\]]|\[\d*\])+)?\])|(\[\[[^\n\"'\[\]]+\]\])/", $Str, $Tag, PREG_OFFSET_CAPTURE, $i);
// 1a) If there aren't any tags left, write everything remaining to a block
if(!$IsTag) {
@ -276,12 +276,12 @@ function parse($Str) {
$i += $CloseTag; // 5d) Move the pointer past the end of the [/close] tag.
} elseif($WikiLink == true || $TagName == 'n') {
// Don't need to do anything - empty tag with no closing
} elseif($TagName == '*') {
} elseif($TagName === '*' || $TagName === '#') {
// We're in a list. Find where it ends
$NewLine = $i;
do { // Look for \n[*]
$NewLine = strpos($Str, "\n", $NewLine+1);
} while($NewLine!== false && substr($Str, $NewLine+1, 3) == '[*]');
} while($NewLine!== false && substr($Str, $NewLine+1, 3) == '['.$TagName.']');
$CloseTag = $NewLine;
if($CloseTag === false) { // block finishes with list
@ -386,9 +386,12 @@ function parse($Str) {
case 'hide':
$Array[$ArrayPos] = array('Type'=>'hide', 'Attr'=>$Attrib, 'Val'=>$this->parse($Block));
break;
case '#':
case '*':
$Array[$ArrayPos] = array('Type'=>'list');
$Array[$ArrayPos]['Val'] = explode('[*]', $Block);
$Array[$ArrayPos]['Val'] = explode('['.$TagName.']', $Block);
$Array[$ArrayPos]['ListType'] = $TagName === '*' ? 'ul' : 'ol';
$Array[$ArrayPos]['Tag'] = $TagName;
foreach($Array[$ArrayPos]['Val'] as $Key=>$Val) {
$Array[$ArrayPos]['Val'][$Key] = $this->parse(trim($Val));
}
@ -438,6 +441,9 @@ function to_html($Array) {
case 's':
$Str.='<span style="text-decoration: line-through">'.$this->to_html($Block['Val']).'</span>';
break;
case 'important':
$Str.='<strong class="important_text">'.$this->to_html($Block['Val']).'</strong>';
break;
case 'user':
$Str.='<a href="user.php?action=search&amp;search='.urlencode($Block['Val']).'">'.$Block['Val'].'</a>';
break;
@ -460,12 +466,12 @@ function to_html($Array) {
$Str.='<code>'.$Block['Val'].'</code>';
break;
case 'list':
$Str .= '<ul>';
$Str .= '<'.$Block['ListType'].'>';
foreach($Block['Val'] as $Line) {
$Str.='<li>'.$this->to_html($Line).'</li>';
}
$Str.='</ul>';
$Str.='</'.$Block['ListType'].'>';
break;
case 'align':
$ValidAttribs = array('left', 'center', 'right');
@ -514,9 +520,9 @@ function to_html($Array) {
$Str.='[img]'.$Block['Val'].'[/img]';
} else {
if(check_perms('site_proxy_images')) {
$Str.='<img style="max-width: 500px;" onclick="lightbox.init(this,500);" alt="'.$Block['Val'].'" src="http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?i='.urlencode($Block['Val']).'" />';
$Str.='<img class="scale_image" onclick="lightbox.init(this,500);" alt="'.$Block['Val'].'" src="http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?i='.urlencode($Block['Val']).'" />';
} else {
$Str.='<img style="max-width: 500px;" onclick="lightbox.init(this,500);" alt="'.$Block['Val'].'" src="'.$Block['Val'].'" />';
$Str.='<img class="scale_image" onclick="lightbox.init(this,500);" alt="'.$Block['Val'].'" src="'.$Block['Val'].'" />';
}
}
break;
@ -614,7 +620,7 @@ function raw_text($Array) {
break;
case 'list':
foreach($Block['Val'] as $Line) {
$Str.='*'.$this->raw_text($Line);
$Str.=$Block['Tag'].$this->raw_text($Line);
}
break;

View File

@ -182,6 +182,8 @@ function music_form($GenreTags) {
$BadTags = $Torrent['BadTags'];
$BadFolders = $Torrent['BadFolders'];
$BadFiles = $Torrent['BadFiles'];
$CassetteApproved = $Torrent['CassetteApproved'];
$LossymasterApproved = $Torrent['LossymasterApproved'];
global $ReleaseTypes;
?>
<table cellpadding="3" cellspacing="1" border="0" class="border<? if($this->NewTorrent) { echo ' slice'; }?>" width="100%">
@ -376,6 +378,16 @@ function music_form($GenreTags) {
</span>
</td>
</tr>
<tr>
<td class="label">Vanity House</td>
<td>
<label><input type="checkbox" id="vanity_house" name="vanity_house" <?=( check_perms('torrents_edit_vanityhouse') ? $this->DisabledInputA : 'disabled="disabled"' )?> <? if($Torrent['VanityHouse']){ echo "checked='checked' ";}?>/>
Check this only if you are the submitting artist or submitting on behalf of the artist and this is intended to be a Vanity House release. Checking this will also automatically add the group as a recommendation.</label>
<? if ( ! check_perms('torrents_edit_vanityhouse') ) { ?>
<p>You do not have permission to mark albums as vanity house. <a href="wiki.php?action=article&id=282">More information about vanity house</a></p>
<? } ?>
</td>
</tr>
<tr>
<td class="label">Media</td>
<td>
@ -473,6 +485,18 @@ function music_form($GenreTags) {
<input type="checkbox" id="bad_files" name="bad_files"<? if ($BadFiles) {echo " checked='checked'";}?>/> Check this box if the torrent has bad file names.
</td>
</tr>
<tr>
<td class="label">Cassette Approved</td>
<td>
<input type="checkbox" id="cassette_approved" name="cassette_approved"<? if ($CassetteApproved) {echo " checked='checked'";}?>/> Check this box if the torrent is an approved cassette rip.
</td>
</tr>
<tr>
<td class="label">Lossy master Approved</td>
<td>
<input type="checkbox" id="lossymaster_approved" name="lossymaster_approved"<? if ($LossymasterApproved) {echo " checked='checked'";}?>/> Check this box if the torrent is an approved lossy master.
</td>
</tr>
<? } ?>
<? if($this->NewTorrent) { ?>
<tr>

View File

@ -9,18 +9,18 @@ class USER_RANK {
function build_table($MemKey, $Query) {
global $Cache,$DB;
$DB->query("DROP TEMPORARY TABLE IF EXISTS stats");
$DB->query("DROP TEMPORARY TABLE IF EXISTS temp_stats");
$DB->query("CREATE TEMPORARY TABLE stats
$DB->query("CREATE TEMPORARY TABLE temp_stats
(ID int(10) NOT NULL PRIMARY KEY AUTO_INCREMENT,
Val bigint(20) NOT NULL);");
$DB->query("INSERT INTO stats (Val) ".$Query);
$DB->query("INSERT INTO temp_stats (Val) ".$Query);
$DB->query("SELECT COUNT(ID) FROM stats");
$DB->query("SELECT COUNT(ID) FROM temp_stats");
list($UserCount) = $DB->next_record();
$DB->query("SELECT MIN(Val) FROM stats GROUP BY CEIL(ID/(".(int)$UserCount."/100));");
$DB->query("SELECT MIN(Val) FROM temp_stats GROUP BY CEIL(ID/(".(int)$UserCount."/100));");
$Table = $DB->to_array();

View File

@ -5,6 +5,7 @@ date_default_timezone_set('UTC');
define('SITE_NAME', ''); //The name of your site
define('NONSSL_SITE_URL', ''); //The FQDN of your site
define('SSL_SITE_URL', ''); //The FQDN of your site, make this different if you are using a subdomain for ssl
define('SITE_IP', ''); //The IP address by which your site can be publicly accessed
define('SERVER_ROOT', '/path'); //The root of the server, used for includes, purpose is to shorten the path string
define('ANNOUNCE_URL', 'http://'.NONSSL_SITE_URL.':2710'); //Announce URL
@ -56,6 +57,8 @@ define('DEBUG_MODE', false); //Set to false if you dont want everyone to see deb
define('OPEN_REGISTRATION', true); //Set to false to disable open regirstration, true to allow anyone to register
define('USER_LIMIT', 5000); //The maximum number of users the site can have, 0 for no limit
define('STARTING_INVITES', 0); //# of invites to give to newly registered users
define('BLOCK_TOR', false); //Set to true to block Tor users
define('BLOCK_OPERA_MINI', false); //Set to true to block Opera Mini proxy
define('DONOR_INVITES', 2);
// User class IDs needed for automatic promotions. Found in the 'permissions' table

View File

@ -101,7 +101,9 @@
'edit_unknowns' => 'Can edit unknown release information.',
'forums_polls_create' => 'Can create polls in the forums.',
'forums_polls_moderate' => 'Can feature and close polls.',
'project_team' => 'Is part of the project team.'
'project_team' => 'Is part of the project team.',
'torrents_edit_vanityhouse' => 'Can mark groups as part of Vanity House.',
'artist_edit_vanityhouse' => 'Can mark Artists as part of Vanity House.'
);
@ -213,6 +215,8 @@ function permissions_form(){ ?>
<? display_perm('torrents_search_fast', 'Unlimit search frequency (for scripts).'); ?>
<? display_perm('torrents_add_artist', 'Can add artists to any group.'); ?>
<? display_perm('edit_unknowns', 'Can edit unknown release information.'); ?>
<? display_perm('torrents_edit_vanityhouse', 'Can mark groups as part of Vanity House.'); ?>
<? display_perm('artist_edit_vanityhouse', 'Can mark Artists as part of Vanity House.'); ?>
<? display_perm('site_add_logs', 'Can add logs to torrents after upload'); ?>
</td>
</tr>

View File

@ -162,27 +162,8 @@
($LoggedUser['BytesDownloaded']*$LoggedUser['RequiredRatio'])>$LoggedUser['BytesUploaded']
);
// Manage 'special' inherited permissions
if($LoggedUser['Artist']) {
$ArtistPerms = get_permissions(ARTIST);
} else {
$ArtistPerms['Permissions'] = array();
}
if($LoggedUser['Donor']) {
$DonorPerms = get_permissions(DONOR);
} else {
$DonorPerms['Permissions'] = array();
}
if(is_array($LoggedUser['CustomPermissions'])) {
$CustomPerms = $LoggedUser['CustomPermissions'];
} else {
$CustomPerms = array();
}
//Load in the permissions
$LoggedUser['Permissions'] = array_merge($LoggedUser['Permissions'], $DonorPerms['Permissions'], $ArtistPerms['Permissions'], $CustomPerms);
$LoggedUser['Permissions'] = get_permissions_for_user($LoggedUser['ID'], $LoggedUser['CustomPermissions']);
//Change necessary triggers in external components
$Cache->CanClear = check_perms('admin_clear_cache');
@ -355,6 +336,8 @@ function user_heavy_info($UserID) {
if (!empty($HeavyInfo['CustomPermissions'])) {
$HeavyInfo['CustomPermissions'] = unserialize($HeavyInfo['CustomPermissions']);
} else {
$HeavyInfo['CustomPermissions'] = array();
}
if (!empty($HeavyInfo['RestrictedForums'])) {
@ -387,9 +370,51 @@ function get_permissions($PermissionID) {
return $Permission;
}
function get_permissions_for_user($UserID, $CustomPermissions = false) {
global $DB;
$UserInfo = user_info($UserID);
if ($CustomPermissions === false) {
$DB->query('SELECT um.CustomPermissions FROM users_main AS um WHERE um.ID = '.((int)$UserID));
list($CustomPermissions) = $DB->next_record(MYSQLI_NUM, false);
}
if (!empty($CustomPermissions) && !is_array($CustomPermissions)) {
$CustomPermissions = unserialize($CustomPermissions);
}
$Permissions = get_permissions($UserInfo['PermissionID']);
// Manage 'special' inherited permissions
if($UserInfo['Artist']) {
$ArtistPerms = get_permissions(ARTIST);
} else {
$ArtistPerms = array('Permissions' => array());
}
if($UserInfo['Donor']) {
$DonorPerms = get_permissions(DONOR);
} else {
$DonorPerms = array('Permissions' => array());
}
if(!empty($CustomPermissions)) {
$CustomPerms = $CustomPermissions;
} else {
$CustomPerms = array();
}
//Combine the permissions
return array_merge($Permissions['Permissions'], $DonorPerms['Permissions'], $ArtistPerms['Permissions'], $CustomPerms);
}
// This function is slow. Don't call it unless somebody's logging in.
function site_ban_ip($IP) {
global $DB, $Cache;
$IP = ip2unsigned($IP);
$IPNum = ip2unsigned($IP);
$IPBans = $Cache->get_value('ip_bans');
if(!is_array($IPBans)) {
$DB->query("SELECT ID, FromIP, ToIP FROM ip_bans");
@ -398,7 +423,17 @@ function site_ban_ip($IP) {
}
foreach($IPBans as $Index => $IPBan) {
list($ID, $FromIP, $ToIP) = $IPBan;
if($IP >= $FromIP && $IP <= $ToIP) {
if($IPNum >= $FromIP && $IPNum <= $ToIP) {
return true;
}
}
if (BLOCK_TOR) {
$TorIPs = $Cache->get_value('tor_ips');
if (!is_array($TorIPs)) {
$TorIPs = file('https://check.torproject.org/cgi-bin/TorBulkExitList.py?ip=' . SITE_IP, FILE_IGNORE_NEW_LINES);
$Cache->cache_value('tor_ips', $TorIPs, 3600 * 4);
}
if (in_array($IP, $TorIPs)) {
return true;
}
}
@ -480,6 +515,21 @@ function get_host($IP) {
return '<span id="host_'.$ID.'">Resolving host...<script type="text/javascript">ajax.get(\'tools.php?action=get_host&ip='.$IP.'\',function(host){$(\'#host_'.$ID.'\').raw().innerHTML=host;});</script></span>';
}
function lookup_ip($IP) {
//TODO: use the $Cache
$Output = explode(' ',shell_exec('host -W 1 '.escapeshellarg($IP)));
if(count($Output) == 1 && empty($Output[0])) {
//No output at all implies the command failed
return '';
}
if(count($Output) != 5) {
return false;
} else {
return $Output[4];
}
}
function get_cc($IP) {
static $ID = 0;
++$ID;
@ -1044,6 +1094,8 @@ function delete_torrent($ID, $GroupID=0) {
$DB->query("DELETE FROM torrents_bad_tags WHERE TorrentID = ".$ID);
$DB->query("DELETE FROM torrents_bad_folders WHERE TorrentID = ".$ID);
$DB->query("DELETE FROM torrents_bad_files WHERE TorrentID = ".$ID);
$DB->query("DELETE FROM torrents_cassette_approved WHERE TorrentID = ".$ID);
$DB->query("DELETE FROM torrents_lossymaster_approved WHERE TorrentID = ".$ID);
$Cache->delete_value('torrent_download_'.$ID);
$Cache->delete_value('torrent_group_'.$GroupID);
$Cache->delete_value('torrents_details_'.$GroupID);
@ -1582,7 +1634,7 @@ function get_groups($GroupIDs, $Return = true, $GetArtists = true) {
*/
if(count($NotFound)>0) {
$DB->query("SELECT g.ID, g.Name, g.Year, g.RecordLabel, g.CatalogueNumber, g.TagList, g.ReleaseType FROM torrents_group AS g WHERE g.ID IN ($IDs)");
$DB->query("SELECT g.ID, g.Name, g.Year, g.RecordLabel, g.CatalogueNumber, g.TagList, g.ReleaseType, g.VanityHouse FROM torrents_group AS g WHERE g.ID IN ($IDs)");
while($Group = $DB->next_record(MYSQLI_ASSOC, true)) {
unset($NotFound[$Group['ID']]);

View File

@ -1,7 +1,7 @@
<?php
//
// $Id: sphinxapi.php 2758 2011-04-04 11:10:44Z kevg $
// $Id: sphinxapi.php 2876 2011-07-08 15:23:04Z tomat $
//
//
@ -29,7 +29,7 @@
define ( "SEARCHD_COMMAND_FLUSHATTRS", 7 );
/// current client-side command implementation versions
define ( "VER_COMMAND_SEARCH", 0x118 );
define ( "VER_COMMAND_SEARCH", 0x119 );
define ( "VER_COMMAND_EXCERPT", 0x103 );
define ( "VER_COMMAND_UPDATE", 0x102 );
define ( "VER_COMMAND_KEYWORDS", 0x100 );
@ -84,7 +84,8 @@
define ( "SPH_ATTR_FLOAT", 5 );
define ( "SPH_ATTR_BIGINT", 6 );
define ( "SPH_ATTR_STRING", 7 );
define ( "SPH_ATTR_MULTI", 0x40000000 );
define ( "SPH_ATTR_MULTI", 0x40000001 );
define ( "SPH_ATTR_MULTI64", 0x40000002 );
/// known grouping functions
define ( "SPH_GROUPBY_DAY", 0 );
@ -1234,7 +1235,7 @@ function _ParseSearchResponse ( $response, $nreqs )
// handle everything else as unsigned ints
list(,$val) = unpack ( "N*", substr ( $response, $p, 4 ) ); $p += 4;
if ( $type & SPH_ATTR_MULTI )
if ( $type==SPH_ATTR_MULTI )
{
$attrvals[$attr] = array ();
$nvalues = $val;
@ -1243,6 +1244,16 @@ function _ParseSearchResponse ( $response, $nreqs )
list(,$val) = unpack ( "N*", substr ( $response, $p, 4 ) ); $p += 4;
$attrvals[$attr][] = sphFixUint($val);
}
} else if ( $type==SPH_ATTR_MULTI64 )
{
$attrvals[$attr] = array ();
$nvalues = $val;
while ( $nvalues>0 && $p<$max )
{
$val = sphUnpackU64 ( substr ( $response, $p, 8 ) ); $p += 8;
$attrvals[$attr][] = strval( $val ); // FIXME!!! sphFixUint returns MVA values as string so It to
$nvalues -= 2;
}
} else if ( $type==SPH_ATTR_STRING )
{
$attrvals[$attr] = substr ( $response, $p, $val );
@ -1687,5 +1698,5 @@ function FlushAttributes ()
}
//
// $Id: sphinxapi.php 2758 2011-04-04 11:10:44Z kevg $
// $Id: sphinxapi.php 2876 2011-07-08 15:23:04Z tomat $
//

View File

@ -64,16 +64,31 @@
<?
$Scripts=explode(',',$JSIncludes);
foreach ($Scripts as $Script) {
if (empty($Script)) { continue; }
if (empty($Script)) { continue; }
?>
<script src="<?=STATIC_SERVER?>functions/<?=$Script?>.js?v=<?=filemtime(SERVER_ROOT.'/static/functions/'.$Script.'.js')?>" type="text/javascript"></script>
<? }
<?
if ($Script == 'jquery') { ?>
<script type="text/javascript">
$.noConflict();
</script>
<?
} ?>
<?
}
if ($Mobile) { ?>
<script src="<?=STATIC_SERVER?>styles/mobile/style.js" type="text/javascript"></script>
<? } ?>
<?
}
?>
</head>
<body id="<?=$Document == 'collages' ? 'collage' : $Document?>" <?= ((!$Mobile && $LoggedUser['Rippy'] == 'On') ? 'onload="say()"' : '') ?>>
<?
} ?>
<div id="wrapper">
<h1 class="hidden"><?=SITE_NAME?></h1>
@ -111,7 +126,7 @@
<li id="nav_inbox"><a onmousedown="Stats('inbox');" href="inbox.php">Inbox</a></li>
<li id="nav_staffinbox"><a onmousedown="Stats('staffpm');" href="staffpm.php">Staff Inbox</a></li>
<li id="nav_uploaded"><a onmousedown="Stats('uploads');" href="torrents.php?type=uploaded&amp;userid=<?=$LoggedUser['ID']?>">Uploads</a></li>
<li id="nav_bookmarks"><a onmousedown="Stats('bookmarks');" href="bookmarks.php">Bookmarks</a></li>
<li id="nav_bookmarks"><a onmousedown="Stats('bookmarks');" href="bookmarks.php?type=torrents">Bookmarks</a></li>
<? if (check_perms('site_torrents_notify')) { ?>
<li id="nav_notifications"><a onmousedown="Stats('notifications');" href="user.php?action=notify">Notifications</a></li>
<? }

File diff suppressed because one or more lines are too long

View File

@ -6,6 +6,7 @@ function compare($X, $Y){
return($Y['count'] - $X['count']);
}
include(SERVER_ROOT.'/sections/bookmarks/functions.php'); // has_bookmarked()
include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
$Text = new TEXT;
@ -36,7 +37,8 @@ function compare($X, $Y){
$sql = "SELECT
a.Name,
wiki.Image,
wiki.Body
wiki.body,
a.VanityHouse
FROM wiki_artists AS wiki
LEFT JOIN artists_group AS a ON wiki.RevisionID=a.RevisionID
WHERE wiki.RevisionID='$RevisionID' ";
@ -44,7 +46,8 @@ function compare($X, $Y){
$sql = "SELECT
a.Name,
wiki.Image,
wiki.body
wiki.body,
a.VanityHouse
FROM artists_group AS a
LEFT JOIN wiki_artists AS wiki ON wiki.RevisionID=a.RevisionID
WHERE a.ArtistID='$ArtistID' ";
@ -54,7 +57,7 @@ function compare($X, $Y){
if($DB->record_count()==0) { error(404); }
list($Name, $Image, $Body) = $DB->next_record(MYSQLI_NUM, array(0));
list($Name, $Image, $Body, $VanityHouseArtist) = $DB->next_record(MYSQLI_NUM, array(0));
}
//----------------- Build list and get stats
@ -92,7 +95,7 @@ function compare($X, $Y){
$LastReleaseType = 0;
if(empty($Importances) || empty($TorrentList)) {
$DB->query("SELECT
DISTINCT ta.GroupID, ta.Importance
DISTINCT ta.GroupID, ta.Importance, tg.VanityHouse
FROM torrents_artists AS ta
JOIN torrents_group AS tg ON tg.ID=ta.GroupID
WHERE ta.ArtistID='$ArtistID'
@ -174,7 +177,8 @@ function compare($X, $Y){
$OpenTable = false;
foreach ($TorrentList as $GroupID=>$Group) {
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $Torrents, $Artists) = array_values($Group);
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Torrents, $Artists) = array_values($Group);
$GroupVanityHouse = $Importances[$GroupID]['VanityHouse'];
@ -242,6 +246,8 @@ function compare($X, $Y){
if($GroupYear>0) { $DisplayName = $GroupYear. ' - '.$DisplayName; }
if($GroupVanityHouse) { $DisplayName .= ' [<abbr title="This is a vanity house release">VH</abbr>]'; }
?>
<tr class="releases_<?=$ReleaseType?> group discog<?=$HideDiscog?>">
<td colspan="5">
@ -325,7 +331,7 @@ function compare($X, $Y){
show_header($Name, 'requests,bbcode');
?>
<div class="thin">
<h2><?=display_str($Name)?><? if ($RevisionID) { ?> (Revision #<?=$RevisionID?>)<? } ?></h2>
<h2><?=display_str($Name)?><? if ($RevisionID) { ?> (Revision #<?=$RevisionID?>)<? } if ($VanityHouseArtist) { ?> [Vanity House] <? } ?></h2>
<div class="linkbox">
<? if (check_perms('site_submit_requests')) { ?>
<a href="requests.php?action=new&amp;artistid=<?=$ArtistID?>">[Add Request]</a>
@ -348,6 +354,17 @@ function compare($X, $Y){
}
}
if (has_bookmarked('artist', $ArtistID)) {
?>
<a href="#" id="bookmarklink_artist_<?=$ArtistID?>" onclick="Unbookmark('artist', <?=$ArtistID?>,'[Bookmark]');return false;">[Remove bookmark]</a>
<?
} else {
?>
<a href="#" id="bookmarklink_artist_<?=$ArtistID?>" onclick="Bookmark('artist', <?=$ArtistID?>,'[Remove bookmark]');return false;">[Bookmark]</a>
<?
}
if (check_perms('site_edit_wiki')) {
?>
<a href="artist.php?action=edit&amp;artistid=<?=$ArtistID?>">[Edit]</a>

View File

@ -17,7 +17,8 @@
$DB->query("SELECT
Name,
Image,
Body
Body,
VanityHouse
FROM artists_group AS a
LEFT JOIN wiki_artists ON wiki_artists.RevisionID=a.RevisionID
WHERE a.ArtistID='$ArtistID'");
@ -26,7 +27,7 @@
error("Cannot find the artist with the ID ".$ArtistID.': See the <a href="log.php?search=Artist+'.$ArtistID.'">log</a>.');
}
list($Name, $Image, $Body) = $DB->next_record(MYSQLI_NUM, true);
list($Name, $Image, $Body, $VanityHouse) = $DB->next_record(MYSQLI_NUM, true);
// Start printing form
show_header('Edit artist');
@ -43,6 +44,7 @@
<input type="text" name="image" size="92" value="<?=$Image?>" /><br />
<h3>Artist info</h3>
<textarea name="body" cols="91" rows="20"><?=$Body?></textarea> <br />
<h3>Vanity House <input type="checkbox" name="vanity_house" value="1" <?=( check_perms('artist_edit_vanityhouse') ? '' : 'disabled="disabled"' )?> <?=($VanityHouse ? 'checked="checked"' : '')?>" /></h3>
<h3>Edit summary</h3>
<input type="text" name="summary" size="92" /><br />
<div style="text-align: center;">

View File

@ -14,6 +14,10 @@
// Variables for database input
$UserID = $LoggedUser['ID'];
$ArtistID = $_REQUEST['artistid'];
if ( check_perms('artist_edit_vanityhouse') ) {
$VanityHouse = ( isset($_POST['vanity_house']) ? 1 : 0 );
}
if($_GET['action'] == 'revert') { // if we're reverting to a previous revision
authorize();
@ -42,7 +46,11 @@
$RevisionID=$DB->inserted_id();
// Update artists table (technically, we don't need the RevisionID column, but we can use it for a join which is nice and fast)
$DB->query("UPDATE artists_group SET RevisionID='$RevisionID' WHERE ArtistID='$ArtistID'");
$DB->query("UPDATE artists_group
SET
". ( isset($VanityHouse) ? "VanityHouse='$VanityHouse'," : '' ) ."
RevisionID='$RevisionID'
WHERE ArtistID='$ArtistID'");
// There we go, all done!
$Cache->delete_value('artist_'.$ArtistID); // Delete artist cache

View File

@ -31,7 +31,7 @@
if(count($SnatchedGroupIDs) == 0) { error(($SeedingOnly ? "You aren't seeding any 100% FLACs!" : "You haven't snatched any 100% FLACs!")); }
// Create hash table
$DB->query("CREATE TEMPORARY TABLE t
$DB->query("CREATE TEMPORARY TABLE temp_sections_better_snatch
SELECT t.GroupID,
GROUP_CONCAT(t.Encoding SEPARATOR ' ') AS EncodingList
FROM torrents AS t
@ -40,7 +40,7 @@
//$DB->query('SELECT * FROM t');
$DB->query("SELECT GroupID FROM t
$DB->query("SELECT GroupID FROM temp_sections_better_snatch
WHERE EncodingList NOT LIKE '%V0 (VBR)%'
OR EncodingList NOT LIKE '%V2 (VBR)%'
OR EncodingList NOT LIKE '%320%'");
@ -71,7 +71,7 @@
<?
$Results = $Results['matches'];
foreach ($Results as $GroupID=>$Group) {
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $Torrents, $Artists) = array_values($Group);
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Torrents, $Artists) = array_values($Group);
$FlacID = $Snatches[$GroupID]['fid'];
$DisplayName = '';

View File

@ -94,7 +94,7 @@
</tr>
<?
foreach($Results as $GroupID=>$Data) {
list($Artists, $GroupCatalogueNumber, $GroupID2, $GroupName, $GroupRecordLabel, $ReleaseType, $TagList, $Torrents, $GroupYear, $CategoryID, $FreeTorrent, $HasCue, $HasLog, $TotalLeechers, $LogScore, $ReleaseType, $ReleaseType, $TotalSeeders, $MaxSize, $TotalSnatched, $GroupTime) = array_values($Data);
list($Artists, $GroupCatalogueNumber, $GroupID2, $GroupName, $GroupRecordLabel, $ReleaseType, $TagList, $GroupVanityHouse, $Torrents, $GroupYear, $CategoryID, $FreeTorrent, $HasCue, $HasLog, $TotalLeechers, $LogScore, $ReleaseType, $ReleaseType, $TotalSeeders, $MaxSize, $TotalSnatched, $GroupTime) = array_values($Data);
$DisplayName = '';
if(count($Artists)>0) {

View File

@ -25,16 +25,16 @@
if(count($UploadedGroupIDs) == 0) { error('You haven\'t uploaded any 100% flacs!'); }
// Create hash table
$DB->query("CREATE TEMPORARY TABLE t
$DB->query("CREATE TEMPORARY TABLE temp_sections_better_upload
SELECT t.GroupID,
GROUP_CONCAT(t.Encoding SEPARATOR ' ') AS EncodingList
FROM torrents AS t
WHERE t.GroupID IN(".implode(',',$UploadedGroupIDs).")
GROUP BY t.GroupID");
$DB->query('SELECT * FROM t');
//$DB->query('SELECT * FROM t');
$DB->query("SELECT GroupID FROM t
$DB->query("SELECT GroupID FROM temp_sections_better_upload
WHERE EncodingList NOT LIKE '%V0 (VBR)%'
OR EncodingList NOT LIKE '%V2 (VBR)%'
OR EncodingList NOT LIKE '%320%'");
@ -58,7 +58,7 @@
<?
$Results = $Results['matches'];
foreach ($Results as $GroupID=>$Group) {
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $Torrents, $Artists) = array_values($Group);
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Torrents, $Artists) = array_values($Group);
$FlacID = $Uploads[$GroupID]['ID'];
$DisplayName = '';

View File

@ -1,15 +1,30 @@
<?
authorize();
if(!is_number($_GET['groupid'])) {
if (!can_bookmark($_GET['type'])) { error(404); }
$Type = $_GET['type'];
list($Table, $Col) = bookmark_schema($Type);
if(!is_number($_GET['id'])) {
error(0);
}
$DB->query("SELECT GroupID FROM bookmarks_torrents WHERE UserID='$LoggedUser[ID]' AND GroupID='".db_string($_GET['groupid'])."'");
$DB->query("SELECT UserID FROM $Table WHERE UserID='$LoggedUser[ID]' AND $Col='".db_string($_GET['id'])."'");
if($DB->record_count() == 0) {
$DB->query("INSERT IGNORE INTO bookmarks_torrents
(UserID, GroupID, Time)
$DB->query("INSERT IGNORE INTO $Table
(UserID, $Col, Time)
VALUES
('$LoggedUser[ID]', '".db_string($_GET['groupid'])."', '".sqltime()."')");
$Cache->delete_value('bookmarks_'.$LoggedUser['ID']);
$Cache->delete_value('bookmarks_'.$LoggedUser['ID'].'_groups');
('$LoggedUser[ID]', '".db_string($_GET['id'])."', '".sqltime()."')");
$Cache->delete_value('bookmarks_'.$Type.'_'.$LoggedUser['ID']);
if ($Type == 'torrent') {
$Cache->delete_value('bookmarks_torrent_'.$LoggedUser['ID'].'_full');
} elseif ($Type == 'request') {
$DB->query("SELECT UserID FROM $Table WHERE $Col='".db_string($_GET['id'])."'");
$Bookmarkers = $DB->collect('UserID');
$Bookmarkers = array(1);
$SS->UpdateAttributes('requests', array('bookmarker'), array($_GET['id'] => array($Bookmarkers)), true);
}
}
?>

View File

@ -0,0 +1,93 @@
<?
if(!empty($_GET['userid'])) {
if(!check_perms('users_override_paranoia')) {
error(403);
}
$UserID = $_GET['userid'];
$Sneaky = ($UserID != $LoggedUser['ID']);
if(!is_number($UserID)) { error(404); }
$DB->query("SELECT Username FROM users_main WHERE ID='$UserID'");
list($Username) = $DB->next_record();
} else {
$UserID = $LoggedUser['ID'];
}
$Sneaky = ($UserID != $LoggedUser['ID']);
//$ArtistList = all_bookmarks('artist', $UserID);
$DB->query('SELECT ag.ArtistID, ag.Name
FROM bookmarks_artists AS ba
INNER JOIN artists_group AS ag ON ba.ArtistID = ag.ArtistID
WHERE ba.UserID = '.$UserID);
$ArtistList = $DB->to_array();
$Title = ($Sneaky)?"$Username's bookmarked artists":'Your bookmarked artists';
show_header($Title,'browse');
?>
<div class="thin">
<h2><?=$Title?></h2>
<div class="linkbox">
<a href="bookmarks.php?type=torrents">[Torrents]</a>
<a href="bookmarks.php?type=artists">[Artists]</a>
<a href="bookmarks.php?type=collages">[Collages]</a>
<a href="bookmarks.php?type=requests">[Requests]</a>
</div>
<div class="box pad" align="center">
<? if (count($ArtistList) == 0) { ?>
<h2>You have not bookmarked any artists.</h2>
</div>
<?
show_footer();
die();
} ?>
<table width="100%">
<tr class="colhead">
<td>Artist</td>
</tr>
<?
$Row = 'a';
foreach ($ArtistList as $Artist) {
$Row = ($Row == 'a') ? 'b' : 'a';
list($ArtistID, $Name) = $Artist;
?>
<tr class="row<?=$Row?> bookmark_<?=$ArtistID?>">
<td>
<a href="artist.php?id=<?=$ArtistID?>"><?=$Name?></a>
<span style="float: right">
<?
if (check_perms('site_torrents_notify')) {
if (($Notify = $Cache->get_value('notify_artists_'.$LoggedUser['ID'])) === FALSE) {
$DB->query("SELECT ID, Artists FROM users_notify_filters WHERE UserID='$LoggedUser[ID]' AND Label='Artist notifications' LIMIT 1");
$Notify = $DB->next_record(MYSQLI_ASSOC);
$Cache->cache_value('notify_artists_'.$LoggedUser['ID'], $Notify, 0);
}
if (stripos($Notify['Artists'], '|'.$Name.'|') === FALSE) {
?>
<a href="artist.php?action=notify&amp;artistid=<?=$ArtistID?>&amp;auth=<?=$LoggedUser['AuthKey']?>">[Notify of new uploads]</a>
<?
} else {
?>
<a href="artist.php?action=notifyremove&amp;artistid=<?=$ArtistID?>&amp;auth=<?=$LoggedUser['AuthKey']?>">[Do not notify of new uploads]</a>
<?
}
}
?>
<a href="#" id="bookmarklink_artist_<?=$ArtistID?>" onclick="Unbookmark('artist', <?=$ArtistID?>,'[Bookmark]');return false;">[Remove bookmark]</a>
</span>
</td>
</tr>
<?
}
?>
</table>
</div>
</div>
<?
show_footer();
$Cache->cache_value('bookmarks_'.$UserID, serialize(array(array($Username, $TorrentList, $CollageDataList))), 3600);
?>

View File

@ -1,32 +1,54 @@
<?
enforce_login();
include(SERVER_ROOT.'/sections/bookmarks/functions.php');
// Number of users per page
define('BOOKMARKS_PER_PAGE', '20');
if(!empty($_REQUEST['action'])) {
switch($_REQUEST['action']) {
case 'add':
require(SERVER_ROOT.'/sections/bookmarks/add.php');
break;
case 'remove':
authorize();
$DB->query("DELETE FROM bookmarks_torrents WHERE UserID='".$LoggedUser['ID']."' AND GroupID='".db_string($_GET['groupid'])."'");
$Cache->delete_value('bookmarks_'.$UserID);
$Cache->delete_value('bookmarks_'.$UserID.'_groups');
break;
case 'remove_snatched':
//error(0); // disable this for now as it's the heaviest part of the entire site
authorize();
$DB->query("DELETE b FROM bookmarks_torrents AS b WHERE b.UserID='".$LoggedUser['ID']."' AND b.GroupID IN(SELECT DISTINCT t.GroupID FROM torrents AS t INNER JOIN xbt_snatched AS s ON s.fid=t.ID AND s.uid='".$LoggedUser['ID']."')");
$Cache->delete_value('bookmarks_'.$UserID);
$Cache->delete_value('bookmarks_'.$UserID.'_groups');
header('Location: bookmarks.php');
die();
break;
default:
error(0);
}
} else {
require(SERVER_ROOT.'/sections/bookmarks/torrents.php');
if (empty($_REQUEST['action'])) { $_REQUEST['action'] = 'view'; }
switch($_REQUEST['action']) {
case 'add':
require(SERVER_ROOT.'/sections/bookmarks/add.php');
break;
case 'remove':
require(SERVER_ROOT.'/sections/bookmarks/remove.php');
break;
case 'remove_snatched':
error(0); // disable this for now as it's the heaviest part of the entire site
authorize();
$DB->query("DELETE b FROM bookmarks_torrents AS b WHERE b.UserID='".$LoggedUser['ID']."' AND b.GroupID IN(SELECT DISTINCT t.GroupID FROM torrents AS t INNER JOIN xbt_snatched AS s ON s.fid=t.ID AND s.uid='".$LoggedUser['ID']."')");
$Cache->delete_value('bookmarks_torrents_'.$UserID);
$Cache->delete_value('bookmarks_torrents_'.$UserID.'_full');
header('Location: bookmarks.php');
die();
break;
case 'view':
if (empty($_REQUEST['type'])) { $_REQUEST['type'] = 'torrents'; }
switch ($_REQUEST['type']) {
case 'torrents':
require(SERVER_ROOT.'/sections/bookmarks/torrents.php');
break;
case 'artists':
require(SERVER_ROOT.'/sections/bookmarks/artists.php');
break;
case 'collages':
$_GET['bookmarks'] = 1;
require(SERVER_ROOT.'/sections/collages/browse.php');
break;
case 'requests':
include(SERVER_ROOT.'/sections/requests/functions.php');
$_GET['type'] = 'bookmarks';
require(SERVER_ROOT.'/sections/requests/requests.php');
break;
default:
error(404);
}
break;
default:
error(404);
}
?>

View File

@ -0,0 +1,23 @@
<?
authorize();
if (!can_bookmark($_GET['type'])) { error(404); }
$Type = $_GET['type'];
list($Table, $Col) = bookmark_schema($Type);
if(!is_number($_GET['id'])) {
error(0);
}
$DB->query("DELETE FROM $Table WHERE UserID='".$LoggedUser['ID']."' AND $Col='".db_string($_GET['id'])."'");
$Cache->delete_value('bookmarks_'.$Type.'_'.$UserID);
if ($Type == 'torrent') {
$Cache->delete_value('bookmarks_torrent_'.$UserID.'_full');
} elseif ($Type == 'request') {
$DB->query("SELECT UserID FROM $Table WHERE $Col='".db_string($_GET['id'])."'");
$Bookmarkers = $DB->collect('UserID');
$SS->UpdateAttributes('requests', array('bookmarker'), array($_GET['id'] => array($Bookmarkers)), true);
}
?>

View File

@ -7,24 +7,25 @@ function compare($X, $Y){
}
if(!empty($_GET['userid'])) {
if(!check_perms('users_mod')) {
if(!check_perms('users_override_paranoia')) {
error(403);
}
$UserID = $_GET['userid'];
$Sneaky = true;
if(!is_number($UserID)) { error(404); }
$DB->query("SELECT Username FROM users_main WHERE ID='$UserID'");
list($Username) = $DB->next_record();
} else {
$UserID = $LoggedUser['ID'];
}
$Data = $Cache->get_value('bookmarks_'.$UserID);
$Sneaky = ($UserID != $LoggedUser['ID']);
$Data = $Cache->get_value('bookmarks_torrent_'.$UserID.'_full');
if($Data) {
$Data = unserialize($Data);
list($K, list($Username, $TorrentList, $CollageDataList)) = each($Data);
list($K, list($TorrentList, $CollageDataList)) = each($Data);
} else {
$DB->query("SELECT Username FROM users_main WHERE ID='$UserID'");
list($Username) = $DB->next_record();
// Build the data for the collage and the torrent list
$DB->query("SELECT
bt.GroupID,
@ -46,11 +47,9 @@ function compare($X, $Y){
}
}
if(empty($TorrentList)) {
error("You do not have any bookmarks yet!");
}
$Title = ($Sneaky)?"$Username's bookmarked torrents":'Your bookmarked torrents';
show_header($Username."'s Bookmarks",'browse');
show_header($Title, 'browse');
// Loop through the result set, building up $Collage and $TorrentTable
// Then we print them.
@ -62,7 +61,7 @@ function compare($X, $Y){
$Tags = array();
foreach ($TorrentList as $GroupID=>$Group) {
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $Torrents, $GroupArtists) = array_values($Group);
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Torrents, $GroupArtists) = array_values($Group);
list($GroupID2, $Image, $GroupCategoryID, $AddedTime) = array_values($CollageDataList[$GroupID]);
// Handle stats and stuff
@ -99,6 +98,7 @@ function compare($X, $Y){
}
$DisplayName .= '<a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$GroupName.'</a>';
if($GroupYear>0) { $DisplayName = $DisplayName. ' ['. $GroupYear .']';}
if($GroupVanityHouse) { $DisplayName .= ' [<abbr title="This is a vanity house release">VH</abbr>]'; }
// Start an output buffer, so we can store this output in $TorrentTable
ob_start();
@ -117,11 +117,14 @@ function compare($X, $Y){
</td>
<td colspan="5">
<span style="float:left;"><strong><?=$DisplayName?></strong></span>
<? if(!isset($Sneaky)){ ?>
<span style="float:right;"><a href="#group_<?=$GroupID?>" onclick="unbookmark(<?=$GroupID?>);return false;">Remove Bookmark</a></span>
<span style="float:right;text-align:right">
<? if(!$Sneaky){ ?>
<a href="#group_<?=$GroupID?>" onclick="Unbookmark('torrent', <?=$GroupID?>, '');return false;">Remove Bookmark</a>
<br />
<? } ?>
<?=time_diff($AddedTime);?>
</span>
<br /><span style="float:left;"><?=$TorrentTags?></span>
<span style="float:right;"><?=time_diff($AddedTime);?></span>
</td>
</tr>
<?
@ -202,8 +205,8 @@ function compare($X, $Y){
</span>
<strong><?=$DisplayName?></strong>
<?=$TorrentTags?>
<? if(empty($Sneaky)){ ?>
<span style="float:left;"><a href="#group_<?=$GroupID?>" onclick="unbookmark(<?=$GroupID?>);return false;">Remove Bookmark</a></span>
<? if(!$Sneaky){ ?>
<span style="float:left;"><a href="#group_<?=$GroupID?>" onclick="Unbookmark('torrent', <?=$GroupID?>, '');return false;">Remove Bookmark</a></span>
<? } ?>
<span style="float:right;"><?=time_diff($AddedTime);?></span>
@ -229,7 +232,7 @@ function compare($X, $Y){
if($GroupYear>0) { $DisplayName = $DisplayName. ' ['. $GroupYear .']';}
?>
<li class="image_group_<?=$GroupID?>">
<a href="#group_<?=$GroupID?>">
<a href="#group_<?=$GroupID?>" class="bookmark_<?=$GroupID?>">
<? if($Image) { ?>
<img src="<?=$Image?>" alt="<?=$DisplayName?>" title="<?=$DisplayName?>" width="117" />
<? } else { ?>
@ -244,10 +247,25 @@ function compare($X, $Y){
?>
<div class="thin">
<h2><?=$Username?>'s Bookmarks</h2>
<h2><?=$Title?></h2>
<div class="linkbox">
<a href="bookmarks.php?type=torrents">[Torrents]</a>
<a href="bookmarks.php?type=artists">[Artists]</a>
<a href="bookmarks.php?type=collages">[Collages]</a>
<a href="bookmarks.php?type=requests">[Requests]</a>
<? if (count($TorrentList) > 0) { ?>
<br /><br />
<a href="bookmarks.php?action=remove_snatched&amp;auth=<?=$LoggedUser['AuthKey']?>" onclick="return confirm('Are you sure you want to remove the bookmarks for all items you\'ve snatched?');">[Remove Snatched]</a>
<? } ?>
</div>
<? if (count($TorrentList) == 0) { ?>
<div class="box pad" align="center">
<h2>You have not bookmarked any torrents.</h2>
</div>
<?
show_footer();
die();
} ?>
<div class="sidebar">
<div class="box">
<div class="head"><strong>Stats</strong></div>
@ -295,9 +313,9 @@ function compare($X, $Y){
</div>
<div class="main_column">
<? if(empty($LoggedUser['HideCollage'])) { ?>
<ul class="collage_images">
<ul class="collage_images">
<? foreach($Collage as $Group) { ?>
<?=$Group?>
<?=$Group?>
<? } ?>
</ul>
<? } ?>
@ -318,5 +336,5 @@ function compare($X, $Y){
</div>
<?
show_footer();
$Cache->cache_value('bookmarks_'.$UserID, serialize(array(array($Username, $TorrentList, $CollageDataList))), 3600);
$Cache->cache_value('bookmarks_torrent_'.$UserID.'_full', serialize(array(array($TorrentList, $CollageDataList))), 3600);
?>

View File

@ -59,6 +59,14 @@
$Way = 'DESC';
}
$BookmarkView = !empty($_GET['bookmarks']);
if ($BookmarkView) {
$BookmarkJoin = 'INNER JOIN bookmarks_collages AS bc ON c.ID = bc.CollageID';
} else {
$BookmarkJoin = '';
}
$SQL = "SELECT SQL_CALC_FOUND_ROWS
c.ID,
c.Name,
@ -68,9 +76,14 @@
c.UserID,
um.Username
FROM collages AS c
$BookmarkJoin
LEFT JOIN users_main AS um ON um.ID=c.UserID
WHERE Deleted = '0'";
if ($BookmarkView) {
$SQL .= " AND bc.UserID = '" . $LoggedUser['ID'] . "'";
}
if(!empty($Search)) {
$SQL .= " AND $Type LIKE '%";
$SQL .= implode("%' AND $Type LIKE '%", $Words);
@ -119,11 +132,16 @@
$DB->query("SELECT FOUND_ROWS()");
list($NumResults) = $DB->next_record();
show_header('Browse collages');
show_header(($BookmarkView)?'Your bookmarked collages':'Browse collages');
?>
<div class="thin">
<? if ($BookmarkView) { ?>
<h2>Your bookmarked collages</h2>
<? } else { ?>
<h2>Browse collages<?=(!empty($UserLink) ? (isset($CollageIDs) ? ' with contributions by '.$UserLink : ' started by '.$UserLink) : '')?></h2>
<? } ?>
<div>
<? if (!$BookmarkView) { ?>
<form action="" method="get">
<div><input type="hidden" name="action" value="search" /></div>
<table cellpadding="6" cellspacing="1" border="0" class="border" width="100%">
@ -177,7 +195,9 @@
</table>
</form>
</div>
<? } // if (!$BookmarkView) ?>
<div class="linkbox">
<? if (!$BookmarkView) { ?>
<?
if (check_perms('site_collages_create')) { ?>
<a href="collages.php?action=new">[New collage]</a>
@ -196,12 +216,39 @@
}
if (check_perms('site_collages_recover')) { ?>
<a href="collages.php?action=recover">[Recover collage]</a>
<? } ?><br /><br />
<?
}
if (check_perms('site_collages_create') || check_perms('site_collages_personal') || check_perms('site_collages_recover')) {
?>
<br /><br />
<?
}
?>
<a href="collages.php?userid=<?=$LoggedUser['ID']?>">[Collages you started]</a>
<a href="collages.php?userid=<?=$LoggedUser['ID']?>&amp;contrib=1">[Collages you've contributed to]</a>
<? } else { ?>
<a href="bookmarks.php?type=torrents">[Torrents]</a>
<a href="bookmarks.php?type=artists">[Artists]</a>
<a href="bookmarks.php?type=collages">[Collages]</a>
<a href="bookmarks.php?type=requests">[Requests]</a>
<? } ?>
<br /><br />
<?
$Pages=get_pages($Page,$NumResults,COLLAGES_PER_PAGE,9);
echo $Pages;
?>
</div>
<? if (count($Collages) == 0) { ?>
<div class="box pad" align="center">
<? if ($BookmarkView) { ?>
<h2>You have not bookmarked any collages.</h2>
<? } else { ?>
<h2>Your search did not match anything.</h2>
<p>Make sure all names are spelled correctly, or try making your search less specific.</p>
<? } ?>
</div>
<? show_footer(); die();
} ?>
<table width="100%">
<tr class="colhead">
<td>Category</td>
@ -223,12 +270,17 @@
//Print results
?>
<tr class="row<?=$Row?>">
<tr class="row<?=$Row?> <?=($BookmarkView)?'bookmark_'.$ID:''?>">
<td>
<a href="collages.php?action=search&amp;cats[<?=(int)$CategoryID?>]=1"><?=$CollageCats[(int)$CategoryID]?></a>
</td>
<td>
<a href="collages.php?id=<?=$ID?>"><?=$Name?></a>
<? if ($BookmarkView) { ?>
<span style="float:right">
<a href="#" onclick="Unbookmark('collage', <?=$ID?>,'');return false;">[Remove bookmark]</a>
</span>
<? } ?>
<div class="tags">
<?=$Tags?>
</div>

View File

@ -5,6 +5,7 @@ function compare($X, $Y){
return($Y['count'] - $X['count']);
}
include(SERVER_ROOT.'/sections/bookmarks/functions.php'); // has_bookmarked()
include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
$Text = new TEXT;
@ -76,7 +77,7 @@ function compare($X, $Y){
$Number = 0;
foreach ($TorrentList as $GroupID=>$Group) {
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $Torrents, $GroupArtists) = array_values($Group);
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Torrents, $GroupArtists) = array_values($Group);
list($GroupID2, $Image, $GroupCategoryID, $UserID, $Username) = array_values($CollageDataList[$GroupID]);
// Handle stats and stuff
@ -125,7 +126,7 @@ function compare($X, $Y){
}
$DisplayName .= '<a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$GroupName.'</a>';
if($GroupYear>0) { $DisplayName = $DisplayName. ' ['. $GroupYear .']';}
if($GroupVanityHouse) { $DisplayName .= ' [<abbr title="This is a vanity house release">VH</abbr>]'; }
// Start an output buffer, so we can store this output in $TorrentTable
ob_start();
if(count($Torrents)>1 || $GroupCategoryID==1) {
@ -244,6 +245,7 @@ function compare($X, $Y){
}
$DisplayName .= $GroupName;
if($GroupYear>0) { $DisplayName = $DisplayName. ' ['. $GroupYear .']';}
if($GroupVanityHouse) { $DisplayName .= ' [<abbr title="This is a vanity house release">VH</abbr>]'; }
?>
<td>
<a href="#group_<?=$GroupID?>">
@ -271,10 +273,18 @@ function compare($X, $Y){
<? if (check_perms('site_collages_create')) { ?>
<a href="collages.php?action=new">[New collage]</a>
<? } ?>
<br /><br />
<? if (check_perms('site_edit_wiki') && !$Locked) { ?>
<a href="collages.php?action=edit&amp;collageid=<?=$CollageID?>">[Edit description]</a>
<? } ?>
<? if (check_perms('site_collages_manage') && !$Locked) { ?>
<? }
if(has_bookmarked('collage', $CollageID)) {
?>
<a href="#" id="bookmarklink_collage_<?=$CollageID?>" onclick="Unbookmark('collage', <?=$CollageID?>,'[Bookmark]');return false;">[Remove bookmark]</a>
<? } else { ?>
<a href="#" id="bookmarklink_collage_<?=$CollageID?>" onclick="Bookmark('collage', <?=$CollageID?>,'[Remove bookmark]');return false;">[Bookmark]</a>
<? }
if (check_perms('site_collages_manage') && !$Locked) { ?>
<a href="collages.php?action=manage&amp;collageid=<?=$CollageID?>">[Manage torrents]</a>
<? } ?>
<a href="reports.php?action=report&amp;type=collage&amp;id=<?=$CollageID?>">[Report Collage]</a>

View File

@ -42,7 +42,7 @@
$Number = 0;
foreach ($TorrentList as $GroupID=>$Group) {
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $Torrents, $GroupArtists) = array_values($Group);
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Torrents, $GroupArtists) = array_values($Group);
list($GroupID2, $UserID, $Username, $Sort) = array_values($CollageDataList[$GroupID]);
@ -54,6 +54,7 @@
}
$DisplayName .= '<a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$GroupName.'</a>';
if($GroupYear>0) { $DisplayName = $DisplayName. ' ['. $GroupYear .']';}
if($GroupVanityHouse) { $DisplayName .= ' [<abbr title="This is a vanity house release">VH</abbr>]'; }
?>
<tr>

View File

@ -3,4 +3,29 @@
define('PAYPAL_CURRENCY','EUR');
define('PAYPAL_SYMBOL','&#8364;');
define('PAYPAL_MINIMUM',5);
function btc_received() {
}
function btc_balance() {
}
// This will be rarely called, so let's go directly to the database
function btc_address($UserID, $GenAddress = false) {
global $DB;
$UserID = (int)$UserID;
$DB->query("SELECT BitcoinAddress FROM users_info WHERE UserID = '$UserID'");
list($Addr) = $DB->next_record();
if (!empty($Addr)) { return $Addr; }
elseif ($GenAddress) {
$DB->query("UPDATE users_info SET BitcoinAddress = '".db_string($NewAddr)."' WHERE UserID = '".$UserID."' AND BitcoinAddress IS NULL");
return $NewAddr;
} else {
return false;
}
}
?>

View File

@ -15,6 +15,7 @@
$DonorPerms = get_permissions(DONOR);
if ($_GET['miner']) { $LoggedUser['BitcoinMiner'] = 1; $_GET['showminer'] = 1; }
show_header('Donate');
@ -68,7 +69,7 @@
</div>
?>
<h3>What you will receive for a 5&euro; minimum donation</h3>
<h3>What you will receive for a 5&euro; or 1 BTC minimum donation</h3>
<div class="box pad" style="padding:10px 10px 10px 20px;">
<ul>
<? if($LoggedUser['Donor']) { ?>

View File

@ -9,9 +9,12 @@
die();
}
if (BLOCK_OPERA_MINI && isset($_SERVER['HTTP_X_OPERAMINI_PHONE'])) {
error('Opera Mini is banned, please use another browser.');
}
// Check if IP is banned
if($BanID = site_ban_ip($_SERVER['REMOTE_ADDR'])) {
if(site_ban_ip($_SERVER['REMOTE_ADDR'])) {
error('Your IP has been banned.');
}

View File

@ -4,6 +4,7 @@
* This is the page that displays the request to the end user after being created.
*/
include(SERVER_ROOT.'/sections/bookmarks/functions.php'); // has_bookmarked()
include(SERVER_ROOT.'/classes/class_text.php');
$Text = new TEXT;
@ -90,6 +91,11 @@
if($UserCanEdit || check_perms('users_mod')) { //check_perms('site_moderate_requests')) { ?>
<a href="requests.php?action=delete&amp;id=<?=$RequestID?>">[Delete]</a>
<? } ?>
<? if(has_bookmarked('request', $RequestID)) { ?>
<a href="#" id="bookmarklink_request_<?=$RequestID?>" onclick="Unbookmark('request', <?=$RequestID?>,'[Bookmark]');return false;">[Remove bookmark]</a>
<? } else { ?>
<a href="#" id="bookmarklink_request_<?=$RequestID?>" onclick="Bookmark('request', <?=$RequestID?>,'[Remove bookmark]');return false;">[Bookmark]</a>
<? } ?>
<a href="reports.php?action=report&amp;type=request&amp;id=<?=$RequestID?>">[Report Request]</a>
<a href="upload.php?requestid=<?=$RequestID?>">[Upload Request]</a>
<? if(!$IsFilled && (($CategoryID == 0) || ($CategoryName == "Music" && $Year == 0))) { ?>

View File

@ -11,6 +11,8 @@
$Perms = get_permissions($UserInfo['PermissionID']);
$UserClass = $Perms['Class'];
$BookmarkView = false;
if(empty($_GET['type'])) {
$Title = 'Requests';
if(!check_perms('site_see_old_requests') || empty($_GET['showall'])) {
@ -51,6 +53,11 @@
$SS->set_filter('fillerid', array($_GET['userid']));
}
break;
case 'bookmarks':
$Title = 'Your bookmarked requests';
$BookmarkView = true;
$SS->set_filter('bookmarker', array($LoggedUser['ID']));
break;
default:
error(404);
}
@ -283,18 +290,30 @@
<div class="thin">
<h2><?=$Title?></h2>
<div class="linkbox">
<? if(check_perms('site_submit_requests')){ ?>
<? if (!$BookmarkView) { ?>
<? if(check_perms('site_submit_requests')){ ?>
<a href="requests.php?action=new">[New request]</a>
<a href="requests.php?type=created">[My requests]</a>
<? }
if(check_perms('site_vote')){?>
<? }
if(check_perms('site_vote')){?>
<a href="requests.php?type=voted">[Requests I've voted on]</a>
<? } ?>
<? } ?>
<? } else { ?>
<a href="bookmarks.php?type=torrents">[Torrents]</a>
<a href="bookmarks.php?type=artists">[Artists]</a>
<a href="bookmarks.php?type=collages">[Collages]</a>
<a href="bookmarks.php?type=requests">[Requests]</a>
<? } ?>
</div>
<div>
<form action="" method="get">
<input type="hidden" name="submit" value="true" />
<? if ($BookmarkView) { ?>
<input type="hidden" name="action" value="view" />
<input type="hidden" name="type" value="requests" />
<? } else { ?>
<input type="hidden" name="type" value="<?=$_GET['type']?>" />
<? } ?>
<input type="hidden" name="submit" value="true" />
<? if(!empty($_GET['userid']) && is_number($_GET['userid'])) { ?>
<input type="hidden" name="userid" value="<?=$_GET['userid']?>" />
<? } ?>

View File

@ -918,14 +918,14 @@ function next_hour() {
// Since MySQL doesn't like subselecting from the target table during an update, we must create a temporary table.
$DB->query("CREATE TEMPORARY TABLE u
$DB->query("CREATE TEMPORARY TABLE temp_sections_schedule_index
SELECT SUM(Uploaded) AS Upload,SUM(Downloaded) AS Download,Inviter
FROM users_main AS um JOIN users_info AS ui ON ui.UserID=um.ID
GROUP BY Inviter");
foreach ($BonusReqs as $BonusReq) {
list($Ratio, $Upload) = $BonusReq;
$DB->query("SELECT ID FROM users_main AS um JOIN users_info AS ui on ui.UserID=um.ID JOIN u ON u.Inviter = um.ID WHERE u.Upload>$Upload AND u.Upload/u.Download>$Ratio AND um.PermissionID IN (".POWER.", ".ELITE.") AND um.Enabled = '1' AND ui.DisableInvites = '0' AND um.Invites<10");
$DB->query("SELECT ID FROM users_main AS um JOIN users_info AS ui on ui.UserID=um.ID JOIN temp_sections_schedule_index AS u ON u.Inviter = um.ID WHERE u.Upload>$Upload AND u.Upload/u.Download>$Ratio AND um.PermissionID IN (".POWER.", ".ELITE.") AND um.Enabled = '1' AND ui.DisableInvites = '0' AND um.Invites<10");
$UserIDs = $DB->collect('ID');
if (count($UserIDs) > 0) {
foreach($UserIDs as $UserID) {

View File

@ -0,0 +1,39 @@
<?
if(!check_perms('admin_donor_log')) { error(403); }
include(SERVER_ROOT.'/sections/donate/config.php');
show_header('Bitcoin donation balance');
$Balance = btc_balance() . " BTC";
$Receiveds = btc_received();
$DB->query("SELECT m.ID, m.Username, i.Donor, i.BitcoinAddress FROM users_main m INNER JOIN users_info i ON m.ID = i.UserID WHERE BitcoinAddress IS NOT NULL");
?>
<div class="thin">
<h3><?=$Balance?></h3>
<table>
<tr>
<th>Username</th>
<th>Receiving bitcoin address</th>
<th>Amount</th>
</tr>
<?
while ($row = $DB->next_record()) {
$amount = "&nbsp;";
foreach ($Receiveds as $R) {
if ($R->address == $row['BitcoinAddress']) {
$amount = $R->amount . ' BTC';
}
}
?>
<tr>
<td><?=format_username($row['ID'],$row['Username'],$row['Donor'])?></td>
<td><tt><?=$row['BitcoinAddress']?></tt></td>
<td><?=$amount?></td>
</tr>
<?
}
?>
</table>
</div>
<? show_footer(); ?>

View File

@ -27,15 +27,13 @@
die('Invalid IP.');
}
$Output = explode(' ',shell_exec('host -W 1 '.escapeshellarg($_GET['ip'])));
if(count($Output) == 1 && empty($Output[0])) {
//No output at all implies the command failed
$Host = lookup_ip($_GET['ip']);
if ($Host === '') {
trigger_error("get_host() command failed with no output, ensure that the host command exists on your system and accepts the argument -W");
}
if(count($Output)!=5) {
die('Could not retrieve host.');
} elseif ($Host === false) {
print 'Could not retrieve host.';
} else {
die($Output[4]);
print $Host;
}

View File

@ -36,6 +36,7 @@
<?
if (check_perms('admin_donor_log')) { ?>
<tr><td><a href="tools.php?action=donation_log">Donation Log</a></td></tr>
<tr><td><a href="tools.php?action=bitcoin_balance">Bitcoin donation balance</a></td></tr>
<? } if (check_perms('users_view_ips') && check_perms('users_view_email')) { ?>
<tr><td><a href="tools.php?action=registration_log">Registration Log</a></td></tr>
<? } if (check_perms('users_view_invites')) { ?>

View File

@ -20,6 +20,7 @@
*
*************************************************************************/
include(SERVER_ROOT.'/sections/bookmarks/functions.php');
include(SERVER_ROOT.'/sections/torrents/functions.php');
@ -238,7 +239,7 @@ function header_link($SortKey,$DefaultWay="desc") {
}
}
foreach(array('hascue','scene','freetorrent','releasetype') as $Search) {
foreach(array('hascue','scene','vanityhouse','freetorrent','releasetype') as $Search) {
if(isset($_GET[$Search]) && $_GET[$Search]!=='') {
if($Search == 'freetorrent') {
switch($_GET[$Search]) {
@ -487,6 +488,11 @@ function header_link($SortKey,$DefaultWay="desc") {
<option value="1" <?selected('scene',1)?>>Yes</option>
<option value="0" <?selected('scene',0)?>>No</option>
</select>
<select name="vanityhouse">
<option value="">Vanity House</option>
<option value="1" <?selected('vanityhouse',1)?>>Yes</option>
<option value="0" <?selected('vanityhouse',0)?>>No</option>
</select>
<select name="freetorrent">
<option value="">Leech Status</option>
<option value="1" <?selected('freetorrent',1)?>>Freeleech</option>
@ -641,17 +647,7 @@ function header_link($SortKey,$DefaultWay="desc") {
show_footer();die();
}
// Get array of bookmarks
if(($Bookmarks = $Cache->get_value('bookmarks_'.$LoggedUser['ID'])) === FALSE) {
if(($Bookmarks = $Cache->get_value('bookmarks_'.$LoggedUser['ID'].'_groups')) === FALSE) {
$DB->query("SELECT GroupID FROM bookmarks_torrents WHERE UserID = $LoggedUser[ID]");
$Bookmarks = $DB->collect('GroupID');
$Cache->cache_value('bookmarks_'.$LoggedUser['ID'].'_groups', $Bookmarks, 0);
}
} else {
$Bookmarks = unserialize($Bookmarks);
$Bookmarks = array_keys($Bookmarks[0][1]);
}
$Bookmarks = all_bookmarks('torrent');
?>
@ -672,7 +668,7 @@ function header_link($SortKey,$DefaultWay="desc") {
// Start printing torrent list
foreach($Results as $GroupID=>$Data) {
list($Artists, $GroupCatalogueNumber, $GroupID2, $GroupName, $GroupRecordLabel, $ReleaseType, $TagList, $Torrents, $GroupYear, $CategoryID, $FreeTorrent, $HasCue, $HasLog, $TotalLeechers, $LogScore, $ReleaseType, $ReleaseType, $TotalSeeders, $MaxSize, $TotalSnatched, $GroupTime) = array_values($Data);
list($Artists, $GroupCatalogueNumber, $GroupID2, $GroupName, $GroupRecordLabel, $ReleaseType, $TagList, $Torrents, $GroupVanityHouse, $GroupYear, $CategoryID, $FreeTorrent, $HasCue, $HasLog, $TotalLeechers, $LogScore, $ReleaseType, $ReleaseType, $TotalSeeders, $MaxSize, $TotalSnatched, $GroupTime) = array_values($Data);
$TagList = explode(' ',str_replace('_','.',$TagList));
@ -691,6 +687,7 @@ function header_link($SortKey,$DefaultWay="desc") {
}
$DisplayName.='<a href="torrents.php?id='.$GroupID.'" title="View Torrent" dir="ltr">'.$GroupName.'</a>';
if($GroupYear>0) { $DisplayName.=" [".$GroupYear."]"; }
if($GroupVanityHouse) { $DisplayName .= ' [<abbr title="This is a vanity house release">VH</abbr>]'; }
?>
<tr class="group">
<td class="center">
@ -708,9 +705,9 @@ function header_link($SortKey,$DefaultWay="desc") {
<td colspan="2">
<?=$DisplayName?>
<? if(in_array($GroupID, $Bookmarks)) { ?>
<span style="float:right;"><a href="#showimg_<?=$GroupID?>" id="bookmarklink<?=$GroupID?>" onclick="unbookmark(<?=$GroupID?>,'Bookmark');return false;">Unbookmark</a></span>
<span style="float:right;"><a href="#showimg_<?=$GroupID?>" id="bookmarklink_torrent_<?=$GroupID?>" onclick="Unbookmark('torrent',<?=$GroupID?>,'Bookmark');return false;">Unbookmark</a></span>
<? } else { ?>
<span style="float:right;"><a href="#showimg_<?=$GroupID?>" id="bookmarklink<?=$GroupID?>" onclick="Bookmark(<?=$GroupID?>,'Unbookmark');return false;">Bookmark</a></span>
<span style="float:right;"><a href="#showimg_<?=$GroupID?>" id="bookmarklink_torrent_<?=$GroupID?>" onclick="Bookmark('torrent',<?=$GroupID?>,'Unbookmark');return false;">Bookmark</a></span>
<? } ?>
<br />
<div class="tags">
@ -793,6 +790,12 @@ function header_link($SortKey,$DefaultWay="desc") {
$Pass = true;
}
}
if(isset($_GET['vanityhouse']) && $_GET['vanityhouse']!=='') {
$Filter = true;
if((int)$Data['VanityHouse']==$_GET['vanityhouse']) {
$Pass = true;
}
}
if(isset($_GET['freetorrent']) && $_GET['freetorrent']!=='') {
$Filter = true;
if((int)$Data['FreeTorrent'] & $_GET['freetorrent'] || (int)$Data['FreeTorrent'] == $_GET['freetorrent']) {

View File

@ -4,6 +4,7 @@ function compare($X, $Y){
return($Y['score'] - $X['score']);
}
include(SERVER_ROOT.'/sections/bookmarks/functions.php'); // has_bookmarked()
include(SERVER_ROOT.'/classes/class_text.php');
$Text = NEW TEXT;
@ -20,7 +21,7 @@ function compare($X, $Y){
// Group details
list($WikiBody, $WikiImage, $GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $ReleaseType, $GroupCategoryID,
$GroupTime, $TorrentTags, $TorrentTagIDs, $TorrentTagUserIDs, $TagPositiveVotes, $TagNegativeVotes) = array_shift($TorrentDetails);
$GroupTime, $GroupVanityHouse, $TorrentTags, $TorrentTagIDs, $TorrentTagUserIDs, $TagPositiveVotes, $TagNegativeVotes) = array_shift($TorrentDetails);
$DisplayName=$GroupName;
$AltName=$GroupName; // Goes in the alt text of the image
@ -39,6 +40,10 @@ function compare($X, $Y){
$DisplayName.=' ['.$GroupYear.']';
$AltName.=' ['.$GroupYear.']';
}
if($GroupVanityHouse){
$DisplayName.=' [Vanity House]';
$AltName.=' [VanityHouse]';
}
if($GroupCategoryID == 1) {
$DisplayName.=' ['.$ReleaseTypes[$ReleaseType].']';
$AltName.=' ['.$ReleaseTypes[$ReleaseType].']';
@ -81,22 +86,11 @@ function compare($X, $Y){
<? if($RevisionID && check_perms('site_edit_wiki')) { ?>
<a href="/torrents.php?action=revert&amp;groupid=<?=$GroupID ?>&amp;revisionid=<?=$RevisionID ?>&amp;auth=<?=$LoggedUser['AuthKey']?>">[Revert to this revision]</a>
<? }
if(($Bookmarks = $Cache->get_value('bookmarks_'.$LoggedUser['ID'])) === FALSE) {
if(($Bookmarks = $Cache->get_value('bookmarks_'.$LoggedUser['ID'].'_groups')) === FALSE) {
$DB->query("SELECT GroupID FROM bookmarks_torrents WHERE UserID = ".$LoggedUser['ID']);
$Bookmarks = $DB->collect('GroupID');
$Cache->cache_value('bookmarks_'.$LoggedUser['ID'].'_groups', $Bookmarks, 0);
}
$Bookmarked = in_array($GroupID,$Bookmarks);
} else {
$Bookmarks = unserialize($Bookmarks);
$Bookmarked = array_key_exists($GroupID, $Bookmarks[0][1]);
}
if($Bookmarked) {
if(has_bookmarked('torrent', $GroupID)) {
?>
<a href="#" id="bookmarklink<?=$GroupID?>" onclick="unbookmark(<?=$GroupID?>,'[Bookmark]');return false;">[Remove bookmark]</a>
<a href="#" id="bookmarklink_torrent_<?=$GroupID?>" onclick="Unbookmark('torrent', <?=$GroupID?>,'[Bookmark]');return false;">[Remove bookmark]</a>
<? } else { ?>
<a href="#" id="bookmarklink<?=$GroupID?>" onclick="Bookmark(<?=$GroupID?>,'[Remove bookmark]');return false;">[Bookmark]</a>
<a href="#" id="bookmarklink_torrent_<?=$GroupID?>" onclick="Bookmark('torrent', <?=$GroupID?>,'[Remove bookmark]');return false;">[Bookmark]</a>
<? }
if($Categories[$GroupCategoryID-1] == 'Music') { ?>
<a href="upload.php?groupid=<?=$GroupID?>">[Add format]</a>
@ -289,11 +283,13 @@ function filelist($Str) {
//t.ID, t.Media, t.Format, t.Encoding, t.Remastered, t.RemasterYear, t.RemasterTitle, t.RemasterRecordLabel,t.RemasterCatalogueNumber,
//t.Scene, t.HasLog, t.HasCue, t.LogScore, t.FileCount, t.Size, t.Seeders, t.Leechers, t.Snatched, t.FreeTorrent, t.Time, t.Description,
//t.FileList, t.FilePath, t.UserID, um.Username, t.last_action
//t.FileList, t.FilePath, t.UserID, um.Username, t.last_action,
//(bad tags), (bad folders), (bad filenames), (cassette approved), (lossy master approved), t.LastReseedRequest, LogInDB
list($TorrentID, $Media, $Format, $Encoding, $Remastered, $RemasterYear, $RemasterTitle, $RemasterRecordLabel, $RemasterCatalogueNumber,
$Scene, $HasLog, $HasCue, $LogScore, $FileCount, $Size, $Seeders, $Leechers, $Snatched, $FreeTorrent, $TorrentTime, $Description,
$FileList, $FilePath, $UserID, $Username, $LastActive, $BadTags, $BadFolders, $BadFiles, $LastReseedRequest, $LogInDB, $HasFile) = $Torrent;
$FileList, $FilePath, $UserID, $Username, $LastActive,
$BadTags, $BadFolders, $BadFiles, $CassetteApproved, $LossymasterApproved, $LastReseedRequest, $LogInDB, $HasFile) = $Torrent;
if($Remastered && !$RemasterYear) {
if(!isset($FirstUnknown)) {
@ -371,6 +367,8 @@ function filelist($Str) {
if($Reported) { $ExtraInfo.=$AddExtra.'<strong>Reported</strong>'; $AddExtra=' / '; }
if(!empty($BadTags)) { $ExtraInfo.=$AddExtra.'<strong>Bad Tags</strong>'; $AddExtra=' / '; }
if(!empty($BadFolders)) { $ExtraInfo.=$AddExtra.'<strong>Bad Folders</strong>'; $AddExtra=' / '; }
if(!empty($CassetteApproved)) { $ExtraInfo.=$AddExtra.'<strong>Cassette Approved</strong>'; $AddExtra=' / '; }
if(!empty($LossymasterApproved)) { $ExtraInfo.=$AddExtra.'<strong>Lossy master Approved</strong>'; $AddExtra=' / '; }
if(!empty($BadFiles)) { $ExtraInfo.=$AddExtra.'<strong>Bad File Names</strong>'; $AddExtra=' / '; }
if($GroupCategoryID == 1

View File

@ -33,6 +33,7 @@
tg.Name AS Title,
tg.Year,
tg.ArtistID,
tg.VanityHouse,
ag.Name AS ArtistName,
t.GroupID,
t.UserID,
@ -41,13 +42,17 @@
t.LogScore,
bt.TorrentID AS BadTags,
bf.TorrentID AS BadFolders,
bfi.TorrentID AS BadFiles
bfi.TorrentID AS BadFiles,
ca.TorrentID AS CassetteApproved,
lma.TorrentID AS LossymasterApproved
FROM torrents AS t
LEFT JOIN torrents_group AS tg ON tg.ID=t.GroupID
LEFT JOIN artists_group AS ag ON ag.ArtistID=tg.ArtistID
LEFT JOIN torrents_bad_tags AS bt ON bt.TorrentID=t.ID
LEFT JOIN torrents_bad_folders AS bf ON bf.TorrentID=t.ID
LEFT JOIN torrents_bad_files AS bfi ON bfi.TorrentID=t.ID
LEFT JOIN torrents_cassette_approved AS ca ON ca.TorrentID=t.ID
LEFT JOIN torrents_lossymaster_approved AS lma ON lma.TorrentID=t.ID
WHERE t.ID='$TorrentID'");
list($Properties) = $DB->to_array(false,MYSQLI_BOTH);

View File

@ -27,12 +27,13 @@
tg.RecordLabel,
tg.CatalogueNumber,
tg.ReleaseType,
tg.CategoryID
tg.CategoryID,
tg.VanityHouse
FROM torrents_group AS tg
LEFT JOIN wiki_torrents AS wt ON wt.RevisionID=tg.RevisionID
WHERE tg.ID='$GroupID'");
if($DB->record_count() == 0) { error(404); }
list($Name, $Image, $Body, $WikiImage, $WikiBody, $Year, $RecordLabel, $CatalogueNumber, $ReleaseType, $CategoryID) = $DB->next_record();
list($Name, $Image, $Body, $WikiImage, $WikiBody, $Year, $RecordLabel, $CatalogueNumber, $ReleaseType, $CategoryID, $VanityHouse) = $DB->next_record();
if(!$Body) { $Body = $WikiBody; $Image = $WikiImage; }
@ -60,6 +61,7 @@
</option>
<? } ?>
</select><br />
<h3>Vanity House <input type="checkbox" name="vanity_house" value="1" <?=( check_perms('torrents_edit_vanityhouse') ? '' : 'disabled="disabled"' )?> <?=($VanityHouse ? 'checked="checked"' : '')?> /></h3>
<? } ?>
<h3>Edit summary</h3>
<input type="text" name="summary" size="92" /><br />

View File

@ -7,7 +7,7 @@ function get_group_info($GroupID, $Return = true, $RevisionID = 0) {
}
//TODO: Remove LogInDB at a much later date.
if($RevisionID || !is_array($TorrentCache) || !isset($TorrentCache[1][0]['LogInDB'])) {
if($RevisionID || !is_array($TorrentCache) || !isset($TorrentCache[1][0]['LogInDB']) || !isset($TorrentCache[1][0]['VanityHouse'])) {
// Fetch the group details
$SQL = "SELECT ";
@ -31,6 +31,7 @@ function get_group_info($GroupID, $Return = true, $RevisionID = 0) {
g.ReleaseType,
g.CategoryID,
g.Time,
g.VanityHouse,
GROUP_CONCAT(DISTINCT tags.Name SEPARATOR '|'),
GROUP_CONCAT(DISTINCT tags.ID SEPARATOR '|'),
GROUP_CONCAT(tt.UserID SEPARATOR '|'),
@ -85,6 +86,8 @@ function get_group_info($GroupID, $Return = true, $RevisionID = 0) {
tbt.TorrentID,
tbf.TorrentID,
tfi.TorrentID,
ca.TorrentID,
lma.TorrentID,
t.LastReseedRequest,
tln.TorrentID AS LogInDB,
t.ID AS HasFile
@ -92,8 +95,10 @@ function get_group_info($GroupID, $Return = true, $RevisionID = 0) {
LEFT JOIN users_main AS um ON um.ID=t.UserID
LEFT JOIN torrents_bad_tags AS tbt ON tbt.TorrentID=t.ID
LEFT JOIN torrents_bad_folders AS tbf on tbf.TorrentID=t.ID
LEFT JOIN torrents_logs_new AS tln ON tln.TorrentID=t.ID
LEFT JOIN torrents_bad_files AS tfi on tfi.TorrentID=t.ID
LEFT JOIN torrents_cassette_approved AS ca on ca.TorrentID=t.ID
LEFT JOIN torrents_lossymaster_approved AS lma on lma.TorrentID=t.ID
LEFT JOIN torrents_logs_new AS tln ON tln.TorrentID=t.ID
WHERE t.GroupID='".db_string($GroupID)."'
AND flags != 1
GROUP BY t.ID

View File

@ -13,7 +13,7 @@
$Group = get_groups(array($GroupID));
$Group = array_pop($Group['matches']);
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $Torrents, $GroupArtists) = array_values($Group);
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Torrents, $GroupArtists) = array_values($Group);
$Name = '';
$Name .= display_artists(array('1'=>$GroupArtists), false, true);

View File

@ -44,6 +44,8 @@
$Properties['BadTags'] = (isset($_POST['bad_tags']))? 1 : 0;
$Properties['BadFolders'] = (isset($_POST['bad_folders']))? 1 : 0;
$Properties['BadFiles'] = (isset($_POST['bad_files'])) ? 1 : 0;
$Properties['CassetteApproved'] = (isset($_POST['cassette_approved']))? 1 : 0;
$Properties['LossymasterApproved'] = (isset($_POST['lossymaster_approved']))? 1 : 0;
$Properties['Format'] = $_POST['format'];
$Properties['Media'] = $_POST['media'];
$Properties['Bitrate'] = $_POST['bitrate'];
@ -318,6 +320,26 @@
if ($bfiID && !$Properties['BadFiles']) {
$DB->query("DELETE FROM torrents_bad_files WHERE TorrentID='$TorrentID'");
}
$DB->query("SELECT TorrentID FROM torrents_cassette_approved WHERE TorrentID='$TorrentID'");
list($caID) = $DB->next_record();
if (!$caID && $Properties['CassetteApproved']) {
$DB->query("INSERT INTO torrents_cassette_approved VALUES($TorrentID, $LoggedUser[ID], '".sqltime()."')");
}
if ($caID && !$Properties['CassetteApproved']) {
$DB->query("DELETE FROM torrents_cassette_approved WHERE TorrentID='$TorrentID'");
}
$DB->query("SELECT TorrentID FROM torrents_lossymaster_approved WHERE TorrentID='$TorrentID'");
list($lmaID) = $DB->next_record();
if (!$lmaID && $Properties['LossymasterApproved']) {
$DB->query("INSERT INTO torrents_lossymaster_approved VALUES($TorrentID, $LoggedUser[ID], '".sqltime()."')");
}
if ($lmaID && !$Properties['LossymasterApproved']) {
$DB->query("DELETE FROM torrents_lossymaster_approved WHERE TorrentID='$TorrentID'");
}
}
$SQL .= "

View File

@ -24,6 +24,11 @@
$Body = $_POST['body'];
$Image = $_POST['image'];
$ReleaseType = (int)$_POST['releasetype'];
if ( $_POST['vanity_house'] && check_perms('torrents_edit_vanityhouse') ) {
$VanityHouse = ( isset($_POST['vanity_house']) ? 1 : 0 );
} else {
$VanityHouse = 0;
}
if($GroupInfo = $Cache->get_value('torrents_details_'.$GroupID)) {
$GroupCategoryID = $GroupInfo[0][0]['CategoryID'];
@ -75,6 +80,7 @@
// Update torrents table (technically, we don't need the RevisionID column, but we can use it for a join which is nice and fast)
$DB->query("UPDATE torrents_group SET
RevisionID='$RevisionID',
".((isset($VanityHouse)) ? "VanityHouse='$VanityHouse'," : "")."
WikiBody='$Body',
WikiImage='$Image'
WHERE ID='$GroupID'");

View File

@ -64,6 +64,10 @@ function header_link($SortKey,$DefaultWay="DESC") {
$SearchWhere[]="t.Scene='".db_string($_GET['scene'])."'";
}
if(isset($_GET['vanityhouse']) && in_array($_GET['vanityhouse'], array('1','0'))) {
$SearchWhere[]="tg.VanityHouse='".db_string($_GET['vanityhouse'])."'";
}
if(isset($_GET['cue']) && in_array($_GET['cue'], array('1','0'))) {
$SearchWhere[]="t.HasCue='".db_string($_GET['cue'])."'";
}
@ -183,7 +187,7 @@ function header_link($SortKey,$DefaultWay="DESC") {
GROUP BY ".$GroupBy."
ORDER BY $Order $Way LIMIT $Limit";
} else {
$DB->query("CREATE TEMPORARY TABLE t (
$DB->query("CREATE TEMPORARY TABLE temp_sections_torrents_user (
GroupID int(10) unsigned not null,
TorrentID int(10) unsigned not null,
Time int(12) unsigned not null,
@ -194,7 +198,7 @@ function header_link($SortKey,$DefaultWay="DESC") {
Name mediumtext,
Size bigint(12) unsigned,
PRIMARY KEY (TorrentID)) CHARSET=utf8");
$DB->query("INSERT IGNORE INTO t SELECT
$DB->query("INSERT IGNORE INTO temp_sections_torrents_user SELECT
t.GroupID,
t.ID AS TorrentID,
$Time AS Time,
@ -217,7 +221,7 @@ function header_link($SortKey,$DefaultWay="DESC") {
$SQL = "SELECT SQL_CALC_FOUND_ROWS
GroupID, TorrentID, Time, CategoryID
FROM t";
FROM temp_sections_torrents_user";
if(!empty($Words)) {
$SQL .= "
WHERE Name LIKE '%".implode("%' AND Name LIKE '%", $Words)."%'";
@ -308,6 +312,11 @@ function header_link($SortKey,$DefaultWay="DESC") {
<option value="1" <?selected('scene',1)?>>Yes</option>
<option value="0" <?selected('scene',0)?>>No</option>
</select>
<select name="vanityhouse">
<option value="">Vanity House</option>
<option value="1" <?selected('scene',1)?>>Yes</option>
<option value="0" <?selected('scene',0)?>>No</option>
</select>
</td>
</tr>
<tr>
@ -390,7 +399,7 @@ function header_link($SortKey,$DefaultWay="DESC") {
foreach($TorrentsInfo as $TorrentID=>$Info) {
list($GroupID,, $Time, $CategoryID) = array_values($Info);
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $Torrents, $Artists) = array_values($Results[$GroupID]);
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Torrents, $Artists) = array_values($Results[$GroupID]);
$Torrent = $Torrents[$TorrentID];
@ -409,6 +418,7 @@ function header_link($SortKey,$DefaultWay="DESC") {
}
$DisplayName.='<a href="torrents.php?id='.$GroupID.'&amp;torrentid='.$TorrentID.'" title="View Torrent">'.$GroupName.'</a>';
if($GroupYear>0) { $DisplayName.=" [".$GroupYear."]"; }
if($GroupVanityHouse) { $DisplayName .= ' [<abbr title="This is a vanity house release">VH</abbr>]'; }
$ExtraInfo = torrent_info($Torrent);
if($ExtraInfo) {

View File

@ -22,7 +22,8 @@
tg.CatalogueNumber,
tg.WikiImage AS Image,
tg.WikiBody AS GroupDescription,
tg.ReleaseType
tg.ReleaseType,
tg.VanityHouse
FROM torrents_group AS tg
LEFT JOIN torrents AS t ON t.GroupID = tg.ID
WHERE tg.ID=".$_GET['groupid']."

View File

@ -61,6 +61,11 @@
$Properties['TagList'] = $_POST['tags'];
$Properties['Image'] = $_POST['image'];
$Properties['GroupDescription'] = trim($_POST['album_desc']);
if ($_POST['vanity_house'] && check_perms('torrents_edit_vanityhouse') ) {
$Properties['VanityHouse'] = 1;
} else {
$Properties['VanityHouse'] = 0;
}
$Properties['TorrentDescription'] = $_POST['release_desc'];
if($_POST['album_desc']) {
$Properties['GroupDescription'] = trim($_POST['album_desc']);
@ -531,8 +536,8 @@
// Create torrent group
$DB->query("
INSERT INTO torrents_group
(ArtistID, CategoryID, Name, Year, RecordLabel, CatalogueNumber, Time, WikiBody, WikiImage, SearchText, ReleaseType) VALUES
(0, ".$TypeID.", ".$T['Title'].", $T[Year], $T[RecordLabel], $T[CatalogueNumber], '".sqltime()."', '".db_string($Body)."', $T[Image], '$SearchText', $T[ReleaseType])");
(ArtistID, CategoryID, Name, Year, RecordLabel, CatalogueNumber, Time, WikiBody, WikiImage, SearchText, ReleaseType, VanityHouse) VALUES
(0, ".$TypeID.", ".$T['Title'].", $T[Year], $T[RecordLabel], $T[CatalogueNumber], '".sqltime()."', '".db_string($Body)."', $T[Image], '$SearchText', $T[ReleaseType], $T[VanityHouse])");
$GroupID = $DB->inserted_id();
if($Type == 'Music') {
foreach($ArtistForm as $Importance => $Artists) {

View File

@ -8,16 +8,14 @@
list($UserID, $Username, $PermissionID) = array_values(user_info($_REQUEST['userid']));
$DB->query("SELECT
p.Values,
u.CustomPermissions
FROM users_main AS u
LEFT JOIN permissions AS p ON u.PermissionID=p.ID
WHERE u.ID='$UserID'");
list($Defaults,$Customs)=$DB->next_record(MYSQLI_NUM, array(0,1));
list($Customs)=$DB->next_record(MYSQLI_NUM, false);
$Defaults = unserialize($Defaults);
$Defaults = get_permissions_for_user($UserID, array());
$Delta=array();
if (isset($_POST['action'])) {
@ -67,7 +65,7 @@ function reset() {
[<a href="#" onclick="reset();return false;">Defaults</a>]
</div>
<div class="box pad">
Before using permissions, please understand that it allows you to both add and remove access to specific features. If you think that to add access to a feature, you need to uncheck everything else, <strong>YOU ARE WRONG</strong>. The checkmarks on the left, which are grayed out, are the standard permissions granted by their class, any changes you make to the right side will overwrite this. It's not complicated, and if you screw up, click the defaults link at the top. It will reset the user to their respective features granted by class, then you can check or uncheck the one or two things you want to change. <strong>DO NOT UNCHECK EVERYTHING.</strong> If you need further clarification, ask A9 before using this tool.
Before using permissions, please understand that it allows you to both add and remove access to specific features. If you think that to add access to a feature, you need to uncheck everything else, <strong>YOU ARE WRONG</strong>. The checkmarks on the left, which are grayed out, are the standard permissions granted by their class (and donor/artist status), any changes you make to the right side will overwrite this. It's not complicated, and if you screw up, click the defaults link at the top. It will reset the user to their respective features granted by class, then you can check or uncheck the one or two things you want to change. <strong>DO NOT UNCHECK EVERYTHING.</strong> If you need further clarification, ask A9 before using this tool.
</div>
<form name="permform" id="permform" method="post" action="">
<input type="hidden" name="action" value="permissions" />

View File

@ -651,7 +651,7 @@ function check_paranoia_here($Setting) {
<? foreach($Collage as $C) {
$Group = get_groups(array($C['GroupID']));
$Group = array_pop($Group['matches']);
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $Torrents, $GroupArtists) = array_values($Group);
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Torrents, $GroupArtists) = array_values($Group);
$Name = '';
$Name .= display_artists(array('1'=>$GroupArtists), false, true);

View File

@ -16,13 +16,14 @@ source torrents {
sql_query_pre = INSERT INTO sphinx_hash ( \
ID, GroupName, TagList, Year, RecordLabel, CatalogueNumber, CategoryID, Time, ReleaseType, \
Size, Snatched, Seeders, Leechers, LogScore, Scene, HasLog, HasCue, FreeTorrent, Media, Format, \
Size, Snatched, Seeders, Leechers, LogScore, Scene, VanityHouse, HasLog, HasCue, FreeTorrent, Media, Format, \
Encoding, RemasterYear, RemasterTitle, RemasterRecordLabel, RemasterCatalogueNumber, FileList ) \
SELECT \
g.ID AS ID, g.Name AS GroupName, g.TagList, g.Year, g.RecordLabel, \
g.CatalogueNumber, g.CategoryID, UNIX_TIMESTAMP(g.Time) AS Time, g.ReleaseType, \
MAX(CEIL(t.Size/1024)) AS Size, SUM(t.Snatched) AS Snatched, SUM(t.Seeders) AS Seeders, \
SUM(t.Leechers) AS Leechers, MAX(t.LogScore) AS LogScore, MAX(t.Scene) AS Scene, \
MAX(g.VanityHouse) AS VanityHouse, \
MAX(t.HasLog) AS HasLog, MAX(t.HasCue) AS HasCue, BIT_OR(t.FreeTorrent-1) AS FreeTorrent, \
GROUP_CONCAT(DISTINCT t.Media SEPARATOR ' ') AS Media, \
GROUP_CONCAT(DISTINCT t.Format SEPARATOR ' ') AS Format, \
@ -49,7 +50,7 @@ source torrents {
sql_query = SELECT ID, GroupName, ArtistName, TagList, Year, \
Year AS YearFullText, RecordLabel, CatalogueNumber, \
CategoryID, Time, ReleaseType, Size, Snatched, Seeders, \
Leechers, LogScore, Scene, HasLog, HasCue, FreeTorrent, \
Leechers, LogScore, Scene, VanityHouse, HasLog, HasCue, FreeTorrent, \
Media, Format, Encoding, RemasterYear, RemasterTitle, \
RemasterRecordLabel, RemasterCatalogueNumber, FileList \
FROM sphinx_hash
@ -66,6 +67,7 @@ source torrents {
sql_attr_uint = logscore
sql_attr_uint = year
sql_attr_bool = scene
sql_attr_bool = vanityhouse
sql_attr_bool = haslog
sql_attr_bool = hascue
sql_attr_uint = freetorrent
@ -77,7 +79,7 @@ source delta : torrents {
sql_query_pre = SHOW STATUS
sql_query = SELECT ID, GroupName, ArtistName, TagList, Year, Year AS YearFullText, \
RecordLabel, CatalogueNumber, CategoryID, Time, ReleaseType, Size, \
Snatched, Seeders, Leechers, LogScore, Scene, HasLog, HasCue, \
Snatched, Seeders, Leechers, LogScore, Scene, VanityHouse, HasLog, HasCue, \
FreeTorrent, Media, Format, Encoding, RemasterYear, RemasterTitle, \
RemasterRecordLabel, RemasterCatalogueNumber, FileList \
FROM sphinx_delta
@ -361,6 +363,10 @@ source requests : torrents {
sql_attr_multi = uint Voter from query; \
SELECT RequestID AS ID, UserID FROM requests_votes
sql_attr_multi = uint Bookmarker from query; \
SELECT RequestID AS ID, UserID FROM bookmarks_requests
}
source requests_delta : requests {
@ -393,4 +399,5 @@ searchd {
query_log = /var/log/searchd/query.log
pid_file = /var/log/searchd/searchd.pid
max_matches = 500000
mva_updates_pool = 16M
}

View File

@ -151,33 +151,6 @@ function toggle_edition(groupid, editionid, lnk, event) {
if (event.preventDefault) { event.preventDefault(); } else { event.returnValue = false; }
}
// Bookmarks
function Bookmark(groupid,newname) {
var lnk = $('#bookmarklink'+groupid).raw();
lnk.setAttribute('newname', lnk.innerHTML);
ajax.get("bookmarks.php?action=add&auth=" + authkey + "&groupid=" + groupid, function() {
lnk.onclick = function() { unbookmark(groupid,this.getAttribute('newname')); return false; };
lnk.innerHTML = newname;
});
}
function unbookmark(groupid,newname) {
if(window.location.pathname.indexOf('bookmarks.php') != -1) {
ajax.get("bookmarks.php?action=remove&auth=" + authkey + "&groupid=" + groupid,function() {
$('#group_' + groupid).remove();
$('.groupid_' + groupid).remove();
$('.image_group_' + groupid).remove();
});
} else {
var lnk = $('#bookmarklink'+groupid).raw();
lnk.setAttribute('newname', lnk.innerHTML);
ajax.get("bookmarks.php?action=remove&auth=" + authkey + "&groupid=" + groupid, function() {
lnk.onclick = function() { Bookmark(groupid,this.getAttribute('newname')); return false; };
lnk.innerHTML = newname;
});
}
}
// For /sections/torrents/browse.php (not browse2.php)
function Bitrate() {
$('#other_bitrate').raw().value = '';

View File

@ -114,3 +114,29 @@ var ajax = {
return query.substr(0, query.length - 1);
}
};
//Bookmarks
function Bookmark(type, id, newName) {
var lnk = $('#bookmarklink_' + type + '_' + id).raw();
var oldName = lnk.innerHTML;
ajax.get("bookmarks.php?action=add&type=" + type + "&auth=" + authkey + "&id=" + id, function() {
lnk.onclick = function() { Unbookmark(type, id, oldName); return false; };
lnk.innerHTML = newName;
});
}
function Unbookmark(type, id, newName) {
if(window.location.pathname.indexOf('bookmarks.php') != -1) {
ajax.get("bookmarks.php?action=remove&type=" + type + "&auth=" + authkey + "&id=" + id, function() {
$('#group_' + id).remove();
$('.groupid_' + id).remove();
$('.bookmark_' + id).remove();
});
} else {
var lnk = $('#bookmarklink_' + type + '_' + id).raw();
var oldName = lnk.innerHTML;
ajax.get("bookmarks.php?action=remove&type=" + type + "&auth=" + authkey + "&id=" + id, function() {
lnk.onclick = function() { Bookmark(type, id, oldName); return false; };
lnk.innerHTML = newName;
});
}
}

View File

@ -64,8 +64,8 @@ function hexify(str) {
function resize(id) {
var textarea = document.getElementById(id);
if (textarea.scrollHeight > textarea.clientHeight) {
textarea.style.overflowY = 'hidden';
textarea.style.height = textarea.scrollHeight + textarea.style.fontSize + 'px';
//textarea.style.overflowY = 'hidden';
textarea.style.height = Math.min(1000, textarea.scrollHeight + textarea.style.fontSize) + 'px';
}
}

18
static/functions/jquery.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -97,7 +97,10 @@ a.beta {
font-weight: bold;
color: #ff0000;
}
strong.important_text {
color: red;
font-weight: bold;
}
.invalid, .warning, .error {
color: #ff0000;
}
@ -125,6 +128,18 @@ div#AddArtists a {
font-weight: bold;
}
.scale_image {
max-width: 500px;
}
#torrents .scale_image {
max-width: 400px;
}
.sidebar .scale_image {
max-width: 100%;
}
.rippywrap { z-index:25; display: block; position: fixed; background: transparent url('../rippy/rippy.png') no-repeat bottom center; color: black; text-align: center; width: 190px; height: 180px; bottom: 0px; right: 0px; }
.rippywrap div.rippy { z-index: 25; height: 111px; width: 190px; position: fixed; bottom: 0px; right: 0px; }
span.rbt { display: block; padding: 8px 0 0; background: url('../rippy/rippy_top.gif') no-repeat top; }

View File

@ -1103,7 +1103,7 @@ div.permission_container>table {
width: 100%;
}
div.pad ul,div.body ul,table.torrent_table blockquote>ul {
div.pad ul,div.body ul,table.torrent_table blockquote>ul,div.pad ol,div.body ol {
padding-left: 15px;
}

3
upgrade.php Normal file
View File

@ -0,0 +1,3 @@
SET @vhid = (SELECT `ID` FROM `tags` WHERE `name` = 'vanity.house');
UPDATE torrents_group SET VanityHouse = (SELECT COUNT(*) FROM torrents_tags WHERE torrents_tags.TagID = @vhid AND torrents_tags.GroupID = torrents_group.ID);