Empty commit

This commit is contained in:
Git 2012-10-03 08:00:16 +00:00
parent c7259b0d25
commit 923d4d4521
12 changed files with 20 additions and 335 deletions

View File

@ -17,7 +17,7 @@
require(SERVER_ROOT.'/classes/class_cache.php'); //Require the caching class
require(SERVER_ROOT.'/classes/class_debug.php'); //Require the debug class
$Cache = NEW CACHE; //Load the caching class
$Cache = NEW CACHE($MemcachedServers); //Load the caching class
$Debug = new DEBUG;
$Debug->handle_errors();

View File

@ -5,7 +5,7 @@
require(SERVER_ROOT.'/classes/class_encrypt.php'); //Require the caching class
$Debug = new DEBUG;
$Cache = NEW CACHE; //Load the caching class
$Cache = NEW CACHE($MemcachedServers); //Load the caching class
$Enc = NEW CRYPT; //Load the encryption class
$SSL = ($_SERVER['SERVER_PORT'] === '443');

View File

@ -43,10 +43,10 @@ class CACHE extends Memcache {
public $CanClear = false;
public $InternalCache = true;
function __construct() {
$this->pconnect(MEMCACHED_HOST, MEMCACHED_PORT);
//$this->connect('localhost', 11211);
function __construct($Servers) {
foreach ($Servers as $Server) {
$this->addServer($Server['host'], $Server['port'], true, $Server['buckets']);
}
}
//---------- Caching functions ----------//

View File

@ -28,8 +28,10 @@ define('SQLPORT', 3306); //The MySQL port to connect on
define('SQLSOCK', '/var/run/mysqld/mysql.sock');
// Memcached details
define('MEMCACHED_HOST', 'unix:///var/run/memcached.sock'); // unix sockets are fast, and other people can't telnet into them
define('MEMCACHED_PORT', 0);
$MemcachedServers = array(
// unix sockets are fast, and other people can't telnet into them
array('host' => 'unix:///var/run/memcached.sock', 'port' => 0, 'buckets' => 1),
);
// Sphinx details
define('SPHINX_HOST', 'localhost');

View File

@ -54,7 +54,7 @@
$Debug->set_flag('Debug constructed');
$DB = new DB_MYSQL;
$Cache = new CACHE;
$Cache = new CACHE($MemcachedServers);
$Enc = new CRYPT;
$UA = new USER_AGENT;
$SS = new SPHINX_SEARCH;

View File

@ -15,7 +15,7 @@
require(SERVER_ROOT.'/classes/class_cache.php'); //Require the caching class
require(SERVER_ROOT.'/classes/class_feed.php'); //Require the caching class
$Cache = NEW CACHE; //Load the caching class
$Cache = NEW CACHE($MemcachedServers); //Load the caching class
$Feed = NEW FEED; //Lead the time class
function check_perms() {

View File

@ -1339,7 +1339,8 @@ CREATE TABLE `users_notify_torrents` (
`TorrentID` int(10) NOT NULL,
`UnRead` tinyint(4) NOT NULL DEFAULT '1',
PRIMARY KEY (`UserID`,`TorrentID`),
KEY `TorrentID` (`TorrentID`)
KEY `TorrentID` (`TorrentID`),
KEY `UserID_Unread` (`UserID`,`UnRead`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `users_points` (

View File

@ -23,7 +23,7 @@
require(SERVER_ROOT.'/classes/class_encrypt.php'); //Require the encryption class
require(SERVER_ROOT.'/classes/regex.php');
$Cache = NEW CACHE; //Load the caching class
$Cache = NEW CACHE($MemcachedServers); //Load the caching class
$Enc = NEW CRYPT; //Load the encryption class
if (isset($_COOKIE['session'])) { $LoginCookie=$Enc->decrypt($_COOKIE['session']); }

View File

@ -21,7 +21,7 @@
}
$Reason = "[b]Year[/b]: ".$_POST['year'].".\n\n";
// If the release type is somehow invalid, return "Not given"; otherwise, return the release type.
$Reason .= "[b]Release Type[/b]: ".((empty($_POST['releasetype']) || !is_number($_POST['releasetype']) || $_POST['releasetype'] == 0) ? 'Not given' : $ReleaseTypes[$_POST['releasetype']]).".\n\n";
$Reason .= "[b]Release Type[/b]: ".((empty($_POST['releasetype']) || !is_number($_POST['releasetype']) || $_POST['releasetype'] == 0) ? 'Not given' : $ReleaseTypes[$_POST['releasetype']]).". \n\n";
$Reason .= "[b]Additional Comments[/b]: ".$_POST['comment'];
} else {
$Reason = $_POST['reason'];

File diff suppressed because one or more lines are too long

View File

@ -458,326 +458,7 @@ function check_paranoia_here($Setting) {
</ul>
</div>
<?
// These stats used to be all together in one UNION'd query
// But we broke them up because they had a habit of locking each other to death.
// They all run really quickly anyways.
$DB->query("SELECT COUNT(x.uid), COUNT(DISTINCT x.fid) FROM xbt_snatched AS x INNER JOIN torrents AS t ON t.ID=x.fid WHERE x.uid='$UserID'");
list($Snatched, $UniqueSnatched) = $DB->next_record();
$DB->query("SELECT COUNT(ID) FROM torrents_comments WHERE AuthorID='$UserID'");
list($NumComments) = $DB->next_record();
$DB->query("SELECT COUNT(ID) FROM collages WHERE Deleted='0' AND UserID='$UserID'");
list($NumCollages) = $DB->next_record();
$DB->query("SELECT COUNT(DISTINCT CollageID) FROM collages_torrents AS ct JOIN collages ON CollageID = ID WHERE Deleted='0' AND ct.UserID='$UserID'");
list($NumCollageContribs) = $DB->next_record();
$DB->query("SELECT COUNT(DISTINCT GroupID) FROM torrents WHERE UserID = '$UserID'");
list($UniqueGroups) = $DB->next_record();
$DB->query("SELECT COUNT(ID) FROM torrents WHERE ((LogScore = 100 AND Format = 'FLAC') OR (Media = 'Vinyl' AND Format = 'FLAC') OR (Media = 'WEB' AND Format = 'FLAC') OR (Media = 'DVD' AND Format = 'FLAC') OR (Media = 'Soundboard' AND Format = 'FLAC') OR (Media = 'Cassette' AND Format = 'FLAC') OR (Media = 'SACD' AND Format = 'FLAC') OR (Media = 'Blu-ray' AND Format = 'FLAC') OR (Media = 'DAT' AND Format = 'FLAC')) AND UserID = '$UserID'");
list($PerfectFLACs) = $DB->next_record();
?>
<div class="box box_info box_userinfo_community">
<div class="head colhead_dark">Community</div>
<ul class="stats nobullet">
<li>Forum Posts: <?=number_format($ForumPosts)?> [<a href="userhistory.php?action=posts&amp;userid=<?=$UserID?>" title="View">View</a>]</li>
<? if (($Override=check_paranoia_here('torrentcomments+'))) { ?>
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?> >Torrent Comments: <?=number_format($NumComments)?>
<? if($Override=check_paranoia_here('torrentcomments')) { ?>[<a href="comments.php?id=<?=$UserID?>" <?= $Override===2 ? 'class="paranoia_override"'
: ''
?> title="View">View</a>]
<? } ?>
</li>
<? }
if (($Override=check_paranoia_here('collages+'))) { ?>
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?> >Collages started: <?=number_format($NumCollages)?>
<? if(($Override=check_paranoia_here('collages'))) { ?>[<a <?= ($Override===2) ? 'class="paranoia_override"'
:'' ?>
href="collages.php?userid=<?=$UserID?>" title="View">View</a>]
<? } ?>
</li>
<? }
if (($Override=check_paranoia_here('collagecontribs+'))) { ?>
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?> >Collages contributed to: <? echo number_format($NumCollageContribs);
if (($Override=check_paranoia_here('collagecontribs'))) {
?> [<a <?= ($Override===2) ?
'class="paranoia_override"' : ''?> href="collages.php?userid=<?=$UserID?>&amp;contrib=1" title="View">View</a>]
<? } ?>
</li>
<? }
//Let's see if we can view requests because of reasons
$ViewAll = check_paranoia_here('requestsfilled_list');
$ViewCount = check_paranoia_here('requestsfilled_count');
$ViewBounty = check_paranoia_here('requestsfilled_bounty');
if ($ViewCount && !$ViewBounty && !$ViewAll) { ?>
<li>Requests filled: <?=number_format($RequestsFilled)?></li>
<? } elseif(!$ViewCount && $ViewBounty && !$ViewAll) { ?>
<li>Requests voted: <?=get_size($TotalSpent)?> collected</li>
<? } elseif($ViewCount && $ViewBounty && !$ViewAll) { ?>
<li>Requests filled: <?=number_format($RequestsFilled)?> for <?=get_size($TotalBounty)?></li>
<? } elseif($ViewAll) { ?>
<li>
<span <?= ($ViewCount===2) ? 'class="paranoia_override"' : ''?> >Requests filled: <?=number_format($RequestsFilled)?> </span>
<span <?= ($ViewBounty===2) ? 'class="paranoia_override"' : ''?>> for <?=get_size($TotalBounty) ?> </span>
[<a href="requests.php?type=filled&amp;userid=<?=$UserID?>" <?= ($ViewAll===2) ? 'class="paranoia_override"' : ''?> title="View">View</a>]
</li>
<? }
//Let's see if we can view requests because of reasons
$ViewAll = check_paranoia_here('requestsvoted_list');
$ViewCount = check_paranoia_here('requestsvoted_count');
$ViewBounty = check_paranoia_here('requestsvoted_bounty');
if ($ViewCount && !$ViewBounty && !$ViewAll) { ?>
<li>Requests voted: <?=number_format($RequestsVoted)?></li>
<? } elseif(!$ViewCount && $ViewBounty && !$ViewAll) { ?>
<li>Requests voted: <?=get_size($TotalSpent)?> spent</li>
<? } elseif($ViewCount && $ViewBounty && !$ViewAll) { ?>
<li>Requests voted: <?=number_format($RequestsVoted)?> for <?=get_size($TotalSpent)?></li>
<? } elseif($ViewAll) { ?>
<li>
<span <?= ($ViewCount===2) ? 'class="paranoia_override"' : ''?> >Requests voted: <?=number_format($RequestsVoted)?> </span>
<span <?= ($ViewBounty===2) ? 'class="paranoia_override"' : ''?>> for <?=get_size($TotalSpent)?> </span>
[<a href="requests.php?type=voted&amp;userid=<?=$UserID?>" <?= ($ViewAll===2) ? 'class="paranoia_override"' : ''?> title="View">View</a>]
</li>
<? }
if (($Override=check_paranoia_here('uploads+'))) { ?>
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?> >Uploaded: <?=number_format($Uploads)?>
<? if(($Override=check_paranoia_here('uploads'))) { ?>[<a <?= $Override===2 ? 'class="paranoia_override"' :'' ?> href="torrents.php?type=uploaded&amp;userid=<?=$UserID?>" title="View">View</a>]<? if(check_perms('zip_downloader')) { ?> [<a href="torrents.php?action=redownload&amp;type=uploads&amp;userid=<?=$UserID?>"
onclick="return confirm('If you no longer have the content, your ratio WILL be affected; be sure to check the size of all albums before redownloading.');">Download</a>]<? } } ?>
</li>
<? }
if (($Override=check_paranoia_here('uniquegroups+'))) { ?>
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?> >
Unique Groups: <?echo number_format($UniqueGroups);
if(($Override=check_paranoia_here('uniquegroups'))) {?>
[<a <?= $Override===2 ? 'class="paranoia_override"' :'' ?> href="torrents.php?type=uploaded&amp;userid=<?=$UserID?>&amp;filter=uniquegroup">View</a>]
<?}?>
</li>
<? }
if (($Override=check_paranoia_here('perfectflacs+'))) { ?>
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?> >"Perfect" FLACs: <?echo number_format($PerfectFLACs);
if (($Override=check_paranoia_here('perfectflacs'))) { ?>
[<a <?= $Override===2 ? 'class="paranoia_override"' :'' ?> href="torrents.php?type=uploaded&amp;userid=<?=$UserID?>&amp;filter=perfectflac">View</a>]</li>
<? }
}
if (check_paranoia_here('seeding+') || check_paranoia_here('leeching+')) {
$DB->query("SELECT IF(remaining=0,'Seeding','Leeching') AS Type, COUNT(x.uid) FROM xbt_files_users AS x INNER JOIN torrents AS t ON t.ID=x.fid WHERE x.uid='$UserID' AND x.active=1 GROUP BY Type");
$PeerCount = $DB->to_array(0, MYSQLI_NUM, false);
$Seeding = isset($PeerCount['Seeding'][1]) ? $PeerCount['Seeding'][1] : 0;
$Leeching = isset($PeerCount['Leeching'][1]) ? $PeerCount['Leeching'][1] : 0;
}
?>
<? if (($Override=check_paranoia_here('seeding+'))) { ?>
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?> >Seeding: <?=number_format($Seeding)?> <?
if(($AOverride=check_paranoia_here('seeding'))) {
echo ((($Override=check_paranoia_here('snatched')) && $UniqueSnatched > 0 )
? '<span ' .($Override===2 ? 'class="paranoia_override" ' : '').' >(' . 100*min(1,round($Seeding/$UniqueSnatched,2)).'%)</span> '
: ''); ?>
[<a href="torrents.php?type=seeding&amp;userid=<?=$UserID?>" <?= $AOverride===2 ? 'class="paranoia_override"' :'' ?> title="View">View</a>]
<? if (check_perms('zip_downloader')) { ?>
[<a href="torrents.php?action=redownload&amp;type=seeding&amp;userid=<?=$UserID?>" onclick="return confirm('If you no longer have the content, your ratio WILL be affected; be sure to check the size of all albums before redownloading.');">Download</a>]
<? } ?>
<?} ?>
</li>
<? }
if (($Override=check_paranoia_here('leeching+'))) { ?>
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?> >Leeching: <? echo number_format($Leeching);
if(($Override=check_paranoia_here('leeching'))) { ?>
[<a <?= $Override===2 ? 'class="paranoia_override"' : ''?> href="torrents.php?type=leeching&amp;userid=<?=$UserID?>" title="View">View</a>]
<? }
echo ($DisableLeech == 0 && check_perms('users_view_ips')) ? "<strong> (Disabled)</strong>" : ""?>
</li>
<? }
?>
<? if (($Override=check_paranoia_here('snatched+'))) { ?>
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?> >Snatched: <?=number_format($Snatched)?>
<? if(($Override=check_perms('site_view_torrent_snatchlist', $Class))) { ?>
(<?= $Override === 2 ? '<span class="paranoia_override">'.number_format($UniqueSnatched).'</span>' : number_format($UniqueSnatched) ?>)
<? } ?>
<? } ?>
<? if (($Override=check_paranoia_here('snatched'))) { ?>
[<a href="torrents.php?type=snatched&amp;userid=<?=$UserID?>" <?= $Override===2 ? 'class="paranoia_override"' : ''?> title="View">View</a>]<? if(check_perms('zip_downloader')) { ?> [<a href="torrents.php?action=redownload&amp;type=snatches&amp;userid=<?=$UserID?>" onclick="return confirm('If you no longer have the content, your ratio WILL be affected, be sure to check the size of all albums before redownloading.');">Download</a>]<? } ?>
</li>
<? }
if(($Override=check_perms('site_view_torrent_snatchlist', $Class))) {
$DB->query("SELECT COUNT(ud.UserID), COUNT(DISTINCT ud.TorrentID) FROM users_downloads AS ud INNER JOIN torrents AS t ON t.ID=ud.TorrentID WHERE ud.UserID='$UserID'");
list($NumDownloads, $UniqueDownloads) = $DB->next_record();
?>
<li <?= $Override===2 ? 'class="paranoia_override"' : ''?> >Downloaded: <?=number_format($NumDownloads)?> (<?=number_format($UniqueDownloads)?>) [<a href="torrents.php?type=downloaded&amp;userid=<?=$UserID?>" title="View">View</a>]</li>
<?
}
if(($Override=check_paranoia_here('invitedcount'))) {
$DB->query("SELECT COUNT(UserID) FROM users_info WHERE Inviter='$UserID'");
list($Invited) = $DB->next_record();
?>
<li>Invited: <?=number_format($Invited)?></li>
<?
} ?>
</ul>
</div>
</div>
<div class="main_column">
<?
if ($RatioWatchEnds!='0000-00-00 00:00:00'
&& (time() < strtotime($RatioWatchEnds))
&& ($Downloaded*$RequiredRatio)>$Uploaded
) {
?>
<div class="box">
<div class="head">Ratio watch</div>
<div class="pad">This user is currently on ratio watch and must upload <?=get_size(($Downloaded*$RequiredRatio)-$Uploaded)?> in the next <?=time_diff($RatioWatchEnds)?>, or their leeching privileges will be revoked. Amount downloaded while on ratio watch: <?=get_size($Downloaded-$RatioWatchDownload)?></div>
</div>
<? } ?>
<div class="box">
<div class="head">
<span style="float:left;">Profile<? if ($CustomTitle) { echo " - ".html_entity_decode($DisplayCustomTitle); } ?></span>
<span style="float:right;"><?=!empty($Badges)?"$Badges&nbsp;&nbsp;":''?><a href="#" onclick="$('#profilediv').toggle(); this.innerHTML=(this.innerHTML=='(Hide)'?'(Show)':'(Hide)'); return false;">(Hide)</a></span>&nbsp;
</div>
<div class="pad" id="profilediv">
<? if (!$Info) { ?>
This profile is currently empty.
<?
} else {
echo $Text->full_format($Info);
}
?>
</div>
</div>
<?
if ($Snatched > 4 && check_paranoia_here('snatched')) {
$RecentSnatches = $Cache->get_value('recent_snatches_'.$UserID);
if(!is_array($RecentSnatches)){
$DB->query("SELECT
g.ID,
g.Name,
g.WikiImage
FROM xbt_snatched AS s
INNER JOIN torrents AS t ON t.ID=s.fid
INNER JOIN torrents_group AS g ON t.GroupID=g.ID
WHERE s.uid='$UserID'
AND g.CategoryID='1'
AND g.WikiImage <> ''
GROUP BY g.ID
ORDER BY s.tstamp DESC
LIMIT 5");
$RecentSnatches = $DB->to_array();
$Artists = get_artists($DB->collect('ID'));
foreach($RecentSnatches as $Key => $SnatchInfo) {
$RecentSnatches[$Key]['Artist'] = display_artists($Artists[$SnatchInfo['ID']], false, true);
}
$Cache->cache_value('recent_snatches_'.$UserID, $RecentSnatches, 0); //inf cache
}
?>
<table class="layout recent" id="recent_snatches" cellpadding="0" cellspacing="0" border="0">
<tr class="colhead">
<td colspan="5">Recent Snatches</td>
</tr>
<tr>
<?
foreach($RecentSnatches as $RS) { ?>
<td>
<a href="torrents.php?id=<?=$RS['ID']?>" title="<?=display_str($RS['Artist'])?><?=display_str($RS['Name'])?>"><img src="<?=to_thumbnail($RS['WikiImage'])?>" alt="<?=display_str($RS['Artist'])?><?=display_str($RS['Name'])?>" width="107" /></a>
</td>
<? } ?>
</tr>
</table>
<?
}
if(!isset($Uploads)) { $Uploads = 0; }
if ($Uploads > 4 && check_paranoia_here('uploads')) {
$RecentUploads = $Cache->get_value('recent_uploads_'.$UserID);
if(!is_array($RecentUploads)){
$DB->query("SELECT
g.ID,
g.Name,
g.WikiImage
FROM torrents_group AS g
INNER JOIN torrents AS t ON t.GroupID=g.ID
WHERE t.UserID='$UserID'
AND g.CategoryID='1'
AND g.WikiImage <> ''
GROUP BY g.ID
ORDER BY t.Time DESC
LIMIT 5");
$RecentUploads = $DB->to_array();
$Artists = get_artists($DB->collect('ID'));
foreach($RecentUploads as $Key => $UploadInfo) {
$RecentUploads[$Key]['Artist'] = display_artists($Artists[$UploadInfo['ID']], false, true);
}
$Cache->cache_value('recent_uploads_'.$UserID, $RecentUploads, 0); //inf cache
}
?>
<table class="layout recent" id="recent_uploads" cellpadding="0" cellspacing="0" border="0">
<tr class="colhead">
<td colspan="5">Recent Uploads</td>
</tr>
<tr>
<? foreach($RecentUploads as $RU) { ?>
<td>
<a href="torrents.php?id=<?=$RU['ID']?>" title="<?=$RU['Artist']?><?=$RU['Name']?>"><img src="<?=to_thumbnail($RU['WikiImage'])?>" alt="<?=$RU['Artist']?><?=$RU['Name']?>" width="107" /></a>
</td>
<? } ?>
</tr>
</table>
<?
}
$DB->query("SELECT ID, Name FROM collages WHERE UserID='$UserID' AND CategoryID='0' AND Deleted='0' ORDER BY Featured DESC, Name ASC");
$Collages = $DB->to_array();
$FirstCol = true;
foreach ($Collages as $CollageInfo) {
list($CollageID, $CName) = $CollageInfo;
$DB->query("SELECT ct.GroupID,
tg.WikiImage,
tg.CategoryID
FROM collages_torrents AS ct
JOIN torrents_group AS tg ON tg.ID=ct.GroupID
WHERE ct.CollageID='$CollageID'
ORDER BY ct.Sort LIMIT 5");
$Collage = $DB->to_array();
?>
<table class="layout recent" id="collage<?=$CollageID?>" cellpadding="0" cellspacing="0" border="0">
<tr class="colhead">
<td colspan="5">
<span style="float:left;">
<?=display_str($CName)?> - <a href="collages.php?id=<?=$CollageID?>">see full</a>
</span>
<span style="float:right;">
<a href="#" onclick="$('#collage<?=$CollageID?> .images').toggle(); this.innerHTML=(this.innerHTML=='(Hide)'?'(Show)':'(Hide)'); return false;"><?=$FirstCol?'(Hide)':'(Show)'?></a>
</span>
</td>
</tr>
<tr class="images <?=$FirstCol?'':' hidden'?>">
<? foreach($Collage as $C) {
$Group = get_groups(array($C['GroupID']));
$Group = array_pop($Group['matches']);
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Torrents, $GroupArtists) = array_values($Group);
$Name = '';
$Name .= display_artists(array('1'=>$GroupArtists), false, true);
$Name .= $GroupName;
?>
<td>
<a href="torrents.php?id=<?=$GroupID?>" title="<?=$Name?>"><img src="<?=to_thumbnail($C['WikiImage'])?>" alt="<?=$Name?>" width="107" /></a>
</td>
<? } ?>
</tr>
</table>
<?
$FirstCol = false;
}
include(SERVER_ROOT.'/sections/user/community_stats.php');
// Linked accounts

View File

@ -679,8 +679,8 @@ td.avatar {
padding: 0px;
}
table.forum_post td.body {
width:690px;
table.forum_post td.body div {
width: 677px;
}
blockquote {