diff --git a/api.php b/api.php
index 0b234fac..45985bca 100644
--- a/api.php
+++ b/api.php
@@ -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();
diff --git a/classes/ajax_start.php b/classes/ajax_start.php
index f3a2ae60..2c6e0487 100644
--- a/classes/ajax_start.php
+++ b/classes/ajax_start.php
@@ -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');
diff --git a/classes/class_cache.php b/classes/class_cache.php
index 0974e635..88952b12 100644
--- a/classes/class_cache.php
+++ b/classes/class_cache.php
@@ -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 ----------//
diff --git a/classes/config.template b/classes/config.template
index fe867b6c..12c51832 100644
--- a/classes/config.template
+++ b/classes/config.template
@@ -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');
diff --git a/classes/script_start.php b/classes/script_start.php
index 3f74607c..18d28b52 100644
--- a/classes/script_start.php
+++ b/classes/script_start.php
@@ -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;
diff --git a/feeds.php b/feeds.php
index f69e69f1..fdf9373c 100644
--- a/feeds.php
+++ b/feeds.php
@@ -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() {
diff --git a/gazelle.sql b/gazelle.sql
index 8a3e7a2d..a3f6d803 100644
--- a/gazelle.sql
+++ b/gazelle.sql
@@ -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` (
diff --git a/image.php b/image.php
index c1f76dfe..67fd9c2e 100644
--- a/image.php
+++ b/image.php
@@ -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']); }
diff --git a/sections/reports/takereport.php b/sections/reports/takereport.php
index 4a7bb7ff..4b291860 100644
--- a/sections/reports/takereport.php
+++ b/sections/reports/takereport.php
@@ -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'];
diff --git a/sections/user/community_stats.php b/sections/user/community_stats.php
new file mode 100644
index 00000000..e63bf9c4
--- /dev/null
+++ b/sections/user/community_stats.php
@@ -0,0 +1 @@
+
// 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();
?>
\ No newline at end of file
diff --git a/sections/user/user.php b/sections/user/user.php
index 563134b9..a239f410 100644
--- a/sections/user/user.php
+++ b/sections/user/user.php
@@ -458,326 +458,7 @@ function check_paranoia_here($Setting) {
-// 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();
-?>
-
-
-
-
-if ($RatioWatchEnds!='0000-00-00 00:00:00'
- && (time() < strtotime($RatioWatchEnds))
- && ($Downloaded*$RequiredRatio)>$Uploaded
- ) {
-?>
-
-
Ratio watch
-
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)?>
-
- } ?>
-
-
-
Profile if ($CustomTitle) { echo " - ".html_entity_decode($DisplayCustomTitle); } ?>
-
=!empty($Badges)?"$Badges ":''?>(Hide)
-
-
- if (!$Info) { ?>
- This profile is currently empty.
-
-} else {
- echo $Text->full_format($Info);
-}
-
-?>
-
-
-
-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
- }
-?>
-
-
- Recent Snatches |
-
-
-
- foreach($RecentSnatches as $RS) { ?>
-
-
- |
- } ?>
-
-
-
-}
-
-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
- }
-?>
-
-
- Recent Uploads |
-
-
- foreach($RecentUploads as $RU) { ?>
-
-
- |
- } ?>
-
-
-
-}
-
-$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();
-?>
-
-
-
-
- =display_str($CName)?> - see full
-
-
- =$FirstCol?'(Hide)':'(Show)'?>
-
- |
-
-
- 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;
-?>
-
-
- |
- } ?>
-
-
-
- $FirstCol = false;
-}
-
+include(SERVER_ROOT.'/sections/user/community_stats.php');
// Linked accounts
diff --git a/static/styles/anorex/style.css b/static/styles/anorex/style.css
index f78d85bf..b52ec054 100644
--- a/static/styles/anorex/style.css
+++ b/static/styles/anorex/style.css
@@ -679,8 +679,8 @@ td.avatar {
padding: 0px;
}
-table.forum_post td.body {
- width:690px;
+table.forum_post td.body div {
+ width: 677px;
}
blockquote {