Empty commit

This commit is contained in:
Git 2013-05-16 16:15:57 +00:00
parent 4889f1f7cf
commit d9a653c45d
68 changed files with 1727 additions and 1273 deletions

View File

@ -30,16 +30,21 @@ function make_tree() {
if (!$TreeID) {
return;
}
$DB->query("SELECT
TreePosition FROM invite_tree
WHERE TreeID=$TreeID AND TreeLevel=$TreeLevel AND TreePosition>$TreePosition
ORDER BY TreePosition ASC LIMIT 1");
$DB->query("
SELECT TreePosition
FROM invite_tree
WHERE TreeID=$TreeID
AND TreeLevel=$TreeLevel
AND TreePosition>$TreePosition
ORDER BY TreePosition ASC
LIMIT 1");
if ($DB->record_count()) {
list($MaxPosition) = $DB->next_record(MYSQLI_NUM, false);
} else {
$MaxPosition = false;
}
$TreeQuery = $DB->query("SELECT
$TreeQuery = $DB->query("
SELECT
it.UserID,
Enabled,
PermissionID,
@ -108,20 +113,18 @@ function make_tree() {
// Manage tree depth
if ($TreeLevel > $PreviousTreeLevel) {
for ($i = 0; $i < $TreeLevel - $PreviousTreeLevel; $i++) {
echo '<ul class="invitetree"><li>';
echo "<ul class=\"invitetree\">\n\t<li>";
}
} elseif ($TreeLevel < $PreviousTreeLevel) {
for ($i = 0; $i < $PreviousTreeLevel - $TreeLevel; $i++) {
echo '</li></ul>';
echo "\t</li>\n</ul>";
}
echo '</li>';
echo '<li>';
echo "\t</li>\n<li>";
} else {
echo '</li>';
echo '<li>';
echo "\t</li>\n<li>";
}
?>
<strong><?=Users::format_username($ID, true, true, $Enabled != 2 ? false : true, true)?></strong>
<strong><?=Users::format_username($ID, true, true, ($Enabled != 2 ? false : true), true)?></strong>
<?
if (check_paranoia(array('uploaded', 'downloaded'), $Paranoia, $UserClass)) {
$TotalUpload += $Uploaded;
@ -145,13 +148,13 @@ function make_tree() {
$Tree = ob_get_clean();
for ($i = 0; $i < $PreviousTreeLevel - $OriginalTreeLevel; $i++) {
$Tree .= "</li></ul>\n";
$Tree .= "\t</li>\n</ul>\n";
}
if ($Count) {
?> <p style="font-weight: bold;">
This tree has <?=$Count?> entries, <?=$Branches?> branches, and a depth of <?=$MaxTreeLevel - $OriginalTreeLevel?>.
This tree has <?=number_format($Count)?> entries, <?=number_format($Branches)?> branches, and a depth of <?=number_format($MaxTreeLevel - $OriginalTreeLevel)?>.
It has
<?
$ClassStrings = array();

View File

@ -72,7 +72,9 @@ public static function send_pm($ToID,$FromID,$Subject,$Body,$ConvID='') {
WHERE UserID IN (".implode(',', $ToID).")
AND ConvID='$ConvID'");
$DB->query("UPDATE pm_conversations_users SET
$DB->query("
UPDATE pm_conversations_users
SET
InSentbox='1',
SentDate='".sqltime()."'
WHERE UserID='$FromID'
@ -80,13 +82,20 @@ public static function send_pm($ToID,$FromID,$Subject,$Body,$ConvID='') {
}
// Now that we have a $ConvID for sure, send the message.
$DB->query("INSERT INTO pm_messages
(SenderID, ConvID, SentDate, Body) VALUES
('$FromID', '$ConvID', '".sqltime()."', '".$Body."')");
$DB->query("
INSERT INTO pm_messages
(SenderID, ConvID, SentDate, Body)
VALUES
('$FromID', '$ConvID', '".sqltime()."', '$Body')");
// Update the cached new message count.
foreach ($ToID as $ID) {
$DB->query("SELECT COUNT(ConvID) FROM pm_conversations_users WHERE UnRead = '1' and UserID='$ID' AND InInbox = '1'");
$DB->query("
SELECT COUNT(ConvID)
FROM pm_conversations_users
WHERE UnRead = '1'
AND UserID='$ID'
AND InInbox = '1'");
list($UnRead) = $DB->next_record();
$Cache->cache_value('inbox_new_'.$ID, $UnRead);
}
@ -94,7 +103,12 @@ public static function send_pm($ToID,$FromID,$Subject,$Body,$ConvID='') {
$DB->query("SELECT Username FROM users_main WHERE ID = '$FromID'");
list($SenderName) = $DB->next_record();
foreach ($ToID as $ID) {
$DB->query("SELECT COUNT(ConvID) FROM pm_conversations_users WHERE UnRead = '1' and UserID='$ID' AND InInbox = '1'");
$DB->query("
SELECT COUNT(ConvID)
FROM pm_conversations_users
WHERE UnRead = '1'
AND UserID='$ID'
AND InInbox = '1'");
list($UnRead) = $DB->next_record();
$Cache->cache_value('inbox_new_'.$ID, $UnRead);
@ -129,32 +143,38 @@ public static function create_thread($ForumID, $AuthorID, $Title, $PostBody) {
$ThreadInfo['IsLocked'] = 0;
$ThreadInfo['IsSticky'] = 0;
$DB->query("INSERT INTO forums_topics
$DB->query("
INSERT INTO forums_topics
(Title, AuthorID, ForumID, LastPostTime, LastPostAuthorID)
Values
('".$Title."', '".$AuthorID."', '$ForumID', '".sqltime()."', '".$AuthorID."')");
VALUES
('$Title', '$AuthorID', '$ForumID', '".sqltime()."', '$AuthorID')");
$TopicID = $DB->inserted_id();
$Posts = 1;
$DB->query("INSERT INTO forums_posts
$DB->query("
INSERT INTO forums_posts
(TopicID, AuthorID, AddedTime, Body)
VALUES
('$TopicID', '".$AuthorID."', '".sqltime()."', '".$PostBody."')");
('$TopicID', '$AuthorID', '".sqltime()."', '$PostBody')");
$PostID = $DB->inserted_id();
$DB->query("UPDATE forums SET
$DB->query("
UPDATE forums
SET
NumPosts = NumPosts+1,
NumTopics = NumTopics+1,
LastPostID = '$PostID',
LastPostAuthorID = '".$AuthorID."',
LastPostAuthorID = '$AuthorID',
LastPostTopicID = '$TopicID',
LastPostTime = '".sqltime()."'
WHERE ID = '$ForumID'");
$DB->query("UPDATE forums_topics SET
$DB->query("
UPDATE forums_topics
SET
NumPosts = NumPosts+1,
LastPostID = '$PostID',
LastPostAuthorID = '".$AuthorID."',
LastPostAuthorID = '$AuthorID',
LastPostTime = '".sqltime()."'
WHERE ID = '$TopicID'");
@ -164,12 +184,14 @@ public static function create_thread($ForumID, $AuthorID, $Title, $PostBody) {
if (count($Forum) == TOPICS_PER_PAGE && $Stickies < TOPICS_PER_PAGE) {
array_pop($Forum);
}
$DB->query("SELECT f.IsLocked, f.IsSticky, f.NumPosts FROM forums_topics AS f
$DB->query("
SELECT f.IsLocked, f.IsSticky, f.NumPosts
FROM forums_topics AS f
WHERE f.ID ='$TopicID'");
list($IsLocked,$IsSticky,$NumPosts) = $DB->next_record();
$Part1 = array_slice($Forum,0,$Stickies,true); //Stickys
list($IsLocked, $IsSticky, $NumPosts) = $DB->next_record();
$Part1 = array_slice($Forum, 0, $Stickies, true); //Stickys
$Part2 = array(
$TopicID=>array(
$TopicID => array(
'ID' => $TopicID,
'Title' => $Title,
'AuthorID' => $AuthorID,
@ -181,10 +203,10 @@ public static function create_thread($ForumID, $AuthorID, $Title, $PostBody) {
'LastPostAuthorID' => $AuthorID,
)
); //Bumped thread
$Part3 = array_slice($Forum,$Stickies,TOPICS_PER_PAGE,true); //Rest of page
$Part3 = array_slice($Forum, $Stickies, TOPICS_PER_PAGE, true); //Rest of page
if ($Stickies > 0) {
$Part1 = array_slice($Forum,0,$Stickies,true); //Stickies
$Part3 = array_slice($Forum,$Stickies,TOPICS_PER_PAGE-$Stickies-1,true); //Rest of page
$Part1 = array_slice($Forum, 0, $Stickies, true); //Stickies
$Part3 = array_slice($Forum, $Stickies, TOPICS_PER_PAGE - $Stickies - 1, true); //Rest of page
} else {
$Part1 = array();
$Part3 = $Forum;
@ -192,7 +214,7 @@ public static function create_thread($ForumID, $AuthorID, $Title, $PostBody) {
if (is_null($Part1)) { $Part1 = array(); }
if (is_null($Part3)) { $Part3 = array(); }
$Forum = $Part1 + $Part2 + $Part3;
$Cache->cache_value('forums_'.$ForumID, array($Forum,'',0,$Stickies), 0);
$Cache->cache_value('forums_'.$ForumID, array($Forum, '', 0, $Stickies), 0);
}
//Update the forum root
@ -209,12 +231,12 @@ public static function create_thread($ForumID, $AuthorID, $Title, $PostBody) {
'IsSticky'=>$ThreadInfo['IsSticky']
);
$UpdateArray['NumTopics']='+1';
$UpdateArray['NumTopics'] = '+1';
$Cache->update_row($ForumID, $UpdateArray);
$Cache->commit_transaction(0);
$CatalogueID = floor((POSTS_PER_PAGE*ceil($Posts/POSTS_PER_PAGE)-POSTS_PER_PAGE)/THREAD_CATALOGUE);
$CatalogueID = floor((POSTS_PER_PAGE * ceil($Posts / POSTS_PER_PAGE) - POSTS_PER_PAGE) / THREAD_CATALOGUE);
$Cache->begin_transaction('thread_'.$TopicID.'_catalogue_'.$CatalogueID);
$Post = array(
'ID'=>$PostID,
@ -271,7 +293,7 @@ public static function in_array_partial($Needle, $Haystack) {
}
foreach ($Haystack as $String) {
if (substr($String, -1) == '*') {
if (!strncmp($Needle, $String, strlen($String)-1)) {
if (!strncmp($Needle, $String, strlen($String) - 1)) {
$Searches[$Needle] = true;
return true;
}
@ -293,7 +315,7 @@ public static function in_array_partial($Needle, $Haystack) {
* @param boolean $AllowEmpty If set to true, a key that is in the request but blank will not throw an error.
* @param int $Error The error code to throw if one of the keys isn't in the array.
*/
public static function assert_isset_request($Request, $Keys=NULL, $AllowEmpty = False, $Error=0) {
public static function assert_isset_request($Request, $Keys = NULL, $AllowEmpty = False, $Error = 0) {
if (isset($Keys)) {
foreach ($Keys as $K) {
if (!isset($Request[$K]) || ($AllowEmpty == False && $Request[$K] == '')) {
@ -329,7 +351,10 @@ public static function get_tags($TagNames) {
}
}
if (count($TagNames) > 0) {
$DB->query("SELECT ID, Name FROM tags WHERE Name IN ('".implode("', '", $TagNames)."')");
$DB->query("
SELECT ID, Name
FROM tags
WHERE Name IN ('".implode("', '", $TagNames)."')");
$SQLTagIDs = $DB->to_array();
foreach ($SQLTagIDs as $Tag) {
$TagIDs[$Tag['ID']] = $Tag['Name'];
@ -365,8 +390,9 @@ public static function get_alias_tag($BadTag) {
*/
public static function write_log($Message) {
global $DB,$Time;
$DB->query('INSERT INTO log (Message, Time) VALUES (\''
.db_string($Message).'\', \''.sqltime().'\')');
$DB->query("
INSERT INTO log (Message, Time)
VALUES ('" . db_string($Message) . "', '" . sqltime() . "')");
}
@ -417,10 +443,10 @@ public static function is_new_torrent(&$Data) {
public static function display_recommend($ID, $Type, $Hide = true) {
global $DB, $LoggedUser;
if ($Hide) {
$Hide = 'style="display: none;"';
$Hide = ' style="display: none;"';
}
?>
<div id="recommendation_div" data-id="<?=$ID?>" data-type="<?=$Type?>" <?=$Hide?> class="center">
<div id="recommendation_div" data-id="<?=$ID?>" data-type="<?=$Type?>"<?=$Hide?> class="center">
<div style="display: inline-block;">
<strong>Recommend to:</strong>
<select id="friend" name="friend">
@ -431,7 +457,7 @@ public static function display_recommend($ID, $Type, $Hide = true) {
</div>
<div class="new" id="recommendation_status"><br /></div>
</div>
<?
<?
}
}
?>

View File

@ -600,7 +600,6 @@ function to_html($Array) {
$Str.='<a rel="noreferrer" target="_blank" href="'.$Block['Attr'].'">'.$Block['Attr'].'</a>';
}
}
break;
}

View File

@ -161,7 +161,7 @@ public static function disable_users($UserIDs, $AdminComment, $BanReason = 1) {
m.can_leech='0',
i.AdminComment = CONCAT('".sqltime()." - ".($AdminComment ? $AdminComment : 'Disabled by system')."\n\n', i.AdminComment),
i.BanDate='".sqltime()."',
i.BanReason='".$BanReason."',
i.BanReason='$BanReason',
i.RatioWatchDownload=".($BanReason == 2 ? 'm.Downloaded' : "'0'")."
WHERE m.ID IN(".implode(',',$UserIDs).") ");
$Cache->decrement('stats_user_count',$DB->affected_rows());
@ -183,7 +183,7 @@ public static function disable_users($UserIDs, $AdminComment, $BanReason = 1) {
}
// Remove the users from the tracker.
$DB->query("SELECT torrent_pass FROM users_main WHERE ID in (".implode(", ",$UserIDs).")");
$DB->query("SELECT torrent_pass FROM users_main WHERE ID in (".implode(', ',$UserIDs).')');
$PassKeys = $DB->collect('torrent_pass');
$Concat = '';
foreach ($PassKeys as $PassKey) {
@ -223,7 +223,9 @@ public static function warn_user($UserID, $Duration, $Reason) {
$AdminComment = date('Y-m-d').' - Warning (Clash) extended to expire at '.$NewExpDate.' by '.$LoggedUser['Username']."\nReason: $Reason\n\n";
$DB->query('UPDATE users_info SET
$DB->query('
UPDATE users_info
SET
Warned=\''.db_string($NewExpDate).'\',
WarnedTimes=WarnedTimes+1,
AdminComment=CONCAT(\''.db_string($AdminComment).'\',AdminComment)
@ -238,7 +240,9 @@ public static function warn_user($UserID, $Duration, $Reason) {
$AdminComment = date('Y-m-d').' - Warned until '.$WarnTime.' by '.$LoggedUser['Username']."\nReason: $Reason\n\n";
$DB->query('UPDATE users_info SET
$DB->query('
UPDATE users_info
SET
Warned=\''.db_string($WarnTime).'\',
WarnedTimes=WarnedTimes+1,
AdminComment=CONCAT(\''.db_string($AdminComment).'\',AdminComment)
@ -253,8 +257,9 @@ public static function warn_user($UserID, $Duration, $Reason) {
*/
public static function update_user_notes($UserID, $AdminComment) {
global $DB;
$DB->query('UPDATE users_info SET
AdminComment=CONCAT(\''.db_string($AdminComment).'\',AdminComment)
$DB->query('
UPDATE users_info
SET AdminComment=CONCAT(\''.db_string($AdminComment).'\',AdminComment)
WHERE UserID=\''.db_string($UserID).'\'');
}
}

View File

@ -49,7 +49,6 @@ function table_query($TableName) {
break;
case 'bounty':
$Query = "SELECT SUM(rv.Bounty) AS Bounty FROM users_main AS um JOIN requests_votes AS rv ON rv.UserID=um.ID WHERE um.Enabled='1' GROUP BY um.ID ORDER BY Bounty;";
break;

View File

@ -49,7 +49,8 @@ public static function user_info($UserID) {
$OldQueryID = $DB->get_query_id();
$DB->query("SELECT
$DB->query("
SELECT
m.ID,
m.Username,
m.PermissionID,
@ -121,7 +122,8 @@ public static function user_heavy_info($UserID) {
if (empty($HeavyInfo)) {
$DB->query("SELECT
$DB->query("
SELECT
m.Invites,
m.torrent_pass,
m.IP,

View File

@ -11,7 +11,9 @@
/********************************************************/
require 'config.php'; //The config contains all site wide configuration information
//Deal with dumbasses
if (isset($_REQUEST['info_hash']) && isset($_REQUEST['peer_id'])) { die('d14:failure reason40:Invalid .torrent, try downloading again.e'); }
if (isset($_REQUEST['info_hash']) && isset($_REQUEST['peer_id'])) {
die('d14:failure reason40:Invalid .torrent, try downloading again.e');
}
require(SERVER_ROOT.'/classes/class_proxies.php');
@ -221,7 +223,8 @@
$UserSessions = $Cache->get_value('users_sessions_'.$UserID);
if (!is_array($UserSessions)) {
$DB->query("SELECT
$DB->query("
SELECT
SessionID,
Browser,
OperatingSystem,
@ -243,20 +246,21 @@
$Enabled = $Cache->get_value('enabled_'.$LoggedUser['ID']);
if ($Enabled === false) {
$DB->query("SELECT Enabled FROM users_main WHERE ID='$LoggedUser[ID]'");
list($Enabled)=$DB->next_record();
list($Enabled) = $DB->next_record();
$Cache->cache_value('enabled_'.$LoggedUser['ID'], $Enabled, 0);
}
if ($Enabled==2) {
if ($Enabled == 2) {
logout();
}
// Up/Down stats
$UserStats = $Cache->get_value('user_stats_'.$LoggedUser['ID']);
if (!is_array($UserStats)) {
$DB->query("SELECT Uploaded AS BytesUploaded, Downloaded AS BytesDownloaded, RequiredRatio FROM users_main WHERE ID='$LoggedUser[ID]'");
$DB->query("
SELECT Uploaded AS BytesUploaded, Downloaded AS BytesDownloaded, RequiredRatio
FROM users_main
WHERE ID='$LoggedUser[ID]'");
$UserStats = $DB->next_record(MYSQLI_ASSOC);
$Cache->cache_value('user_stats_'.$LoggedUser['ID'], $UserStats, 3600);
}
@ -273,11 +277,11 @@
$LoggedUser['RSS_Auth']=md5($LoggedUser['ID'].RSS_HASH.$LoggedUser['torrent_pass']);
//$LoggedUser['RatioWatch'] as a bool to disable things for users on Ratio Watch
// $LoggedUser['RatioWatch'] as a bool to disable things for users on Ratio Watch
$LoggedUser['RatioWatch'] = (
$LoggedUser['RatioWatchEnds'] != '0000-00-00 00:00:00' &&
time() < strtotime($LoggedUser['RatioWatchEnds']) &&
($LoggedUser['BytesDownloaded']*$LoggedUser['RequiredRatio'])>$LoggedUser['BytesUploaded']
($LoggedUser['BytesDownloaded'] * $LoggedUser['RequiredRatio']) > $LoggedUser['BytesUploaded']
);
if (!isset($LoggedUser['ID'])) {
$Debug->log_var($LightInfo, 'LightInfo');
@ -286,19 +290,30 @@
$Debug->log_var($UserStats, 'UserStats');
}
//Load in the permissions
// Load in the permissions
$LoggedUser['Permissions'] = Permissions::get_permissions_for_user($LoggedUser['ID'], $LoggedUser['CustomPermissions']);
//Change necessary triggers in external components
// Change necessary triggers in external components
$Cache->CanClear = check_perms('admin_clear_cache');
// Because we <3 our staff
if (check_perms('site_disable_ip_history')) { $_SERVER['REMOTE_ADDR'] = '127.0.0.1'; }
// Update LastUpdate every 10 minutes
if (strtotime($UserSessions[$SessionID]['LastUpdate'])+600<time()) {
$DB->query("UPDATE users_main SET LastAccess='".sqltime()."' WHERE ID='$LoggedUser[ID]'");
$DB->query("UPDATE users_sessions SET IP='".$_SERVER['REMOTE_ADDR']."', Browser='".$Browser."', OperatingSystem='".$OperatingSystem."', LastUpdate='".sqltime()."' WHERE UserID='$LoggedUser[ID]' AND SessionID='".db_string($SessionID)."'");
if (strtotime($UserSessions[$SessionID]['LastUpdate']) + 600 < time()) {
$DB->query("
UPDATE users_main
SET LastAccess='".sqltime()."'
WHERE ID='$LoggedUser[ID]'");
$DB->query("
UPDATE users_sessions
SET
IP='".$_SERVER['REMOTE_ADDR']."',
Browser='$Browser',
OperatingSystem='$OperatingSystem',
LastUpdate='".sqltime()."'
WHERE UserID='$LoggedUser[ID]'
AND SessionID='".db_string($SessionID)."'");
$Cache->begin_transaction('users_sessions_'.$UserID);
$Cache->delete_row($SessionID);
$Cache->insert_front($SessionID,array(
@ -332,18 +347,21 @@
if ($LoggedUser['IP'] != $_SERVER['REMOTE_ADDR'] && !check_perms('site_disable_ip_history')) {
if (Tools::site_ban_ip($_SERVER['REMOTE_ADDR'])) {
error('Your IP has been banned.');
error('Your IP address has been banned.');
}
$CurIP = db_string($LoggedUser['IP']);
$NewIP = db_string($_SERVER['REMOTE_ADDR']);
$DB->query("UPDATE users_history_ips SET
EndTime='".sqltime()."'
$DB->query("
UPDATE users_history_ips
SET EndTime='".sqltime()."'
WHERE EndTime IS NULL
AND UserID='$LoggedUser[ID]'
AND IP='$CurIP'");
$DB->query("INSERT IGNORE INTO users_history_ips
(UserID, IP, StartTime) VALUES
$DB->query("
INSERT IGNORE INTO users_history_ips
(UserID, IP, StartTime)
VALUES
('$LoggedUser[ID]', '$NewIP', '".sqltime()."')");
$ipcc = Tools::geoip($NewIP);
@ -356,7 +374,6 @@
}
// Get stylesheets
$Stylesheets = $Cache->get_value('stylesheets');
if (!is_array($Stylesheets)) {

View File

@ -110,7 +110,7 @@
<?
if (check_perms('site_send_unlimited_invites')) {
$Invites = ' (∞)';
} elseif ($LoggedUser['Invites']>0) {
} elseif ($LoggedUser['Invites'] > 0) {
$Invites = ' ('.$LoggedUser['Invites'].')';
} else {
$Invites = '';
@ -139,7 +139,8 @@
$RestrictedForums = implode("','", array_keys($LoggedUser['CustomForums'], 0));
$PermittedForums = implode("','", array_keys($LoggedUser['CustomForums'], 1));
}
$DB->query("SELECT COUNT(s.TopicID)
$DB->query("
SELECT COUNT(s.TopicID)
FROM users_subscriptions AS s
JOIN forums_last_read_topics AS l ON s.UserID = l.UserID AND s.TopicID = l.TopicID
JOIN forums_topics AS t ON l.TopicID = t.ID
@ -148,11 +149,11 @@
AND l.PostID < t.LastPostID
AND s.UserID = ".$LoggedUser['ID'].
(!empty($RestrictedForums) ? "
AND f.ID NOT IN ('".$RestrictedForums."')" : ""));
AND f.ID NOT IN ('$RestrictedForums')" : ''));
list($NewSubscriptions) = $DB->next_record();
$Cache->cache_value('subscriptions_user_new_'.$LoggedUser['ID'], $NewSubscriptions, 0);
} ?>
<ul id="userinfo_minor"<?=$NewSubscriptions ? ' class="highlite"' : ''?>>
<ul id="userinfo_minor"<?=($NewSubscriptions ? ' class="highlite"' : '')?>>
<li id="nav_inbox"<?=Format::add_class($PageID, array('inbox'), 'active', true)?>><a onmousedown="Stats('inbox');" href="inbox.php">Inbox</a></li>
<li id="nav_staffinbox"<?=Format::add_class($PageID, array('staffpm'), 'active', true)?>><a onmousedown="Stats('staffpm');" href="staffpm.php">Staff Inbox</a></li>
<li id="nav_uploaded"<?=Format::add_class($PageID, array('torrents',false,'uploaded'), 'active', true, 'userid')?>><a onmousedown="Stats('uploads');" href="torrents.php?type=uploaded&amp;userid=<?=$LoggedUser['ID']?>">Uploads</a></li>
@ -194,11 +195,15 @@
$RestrictedForums = implode("','", array_keys($LoggedUser['CustomForums'], 0));
$PermittedForums = implode("','", array_keys($LoggedUser['CustomForums'], 1));
}
$sql = "SELECT COUNT(q.UnRead)
$sql = "
SELECT COUNT(q.UnRead)
FROM users_notify_quoted AS q
LEFT JOIN forums_topics AS t ON t.ID = q.PageID
LEFT JOIN forums AS f ON f.ID = t.ForumID
WHERE q.UserID=$LoggedUser[ID] AND q.UnRead=1 AND q.Page = 'forums' AND ((f.MinClassRead<='$LoggedUser[Class]'";
WHERE q.UserID=$LoggedUser[ID]
AND q.UnRead=1
AND q.Page = 'forums'
AND ((f.MinClassRead<='$LoggedUser[Class]'";
if (!empty($RestrictedForums)) {
$sql .= " AND f.ID NOT IN ('$RestrictedForums')";
}

View File

@ -886,7 +886,7 @@ function require(file, callback) {
</div>
<div id="body" class="body"><?=$Text->full_format($Body)?></div>
</div>
<!-- -->
<!---->
<?php
// --- Comments ---
@ -909,9 +909,9 @@ function require(file, callback) {
WHERE ArtistID = $ArtistID
AND ID <= $_GET[postid]");
list($PostNum) = $DB->next_record();
list($Page,$Limit) = Format::page_limit(TORRENT_COMMENTS_PER_PAGE,$PostNum);
list($Page, $Limit) = Format::page_limit(TORRENT_COMMENTS_PER_PAGE, $PostNum);
} else {
list($Page,$Limit) = Format::page_limit(TORRENT_COMMENTS_PER_PAGE,$Results);
list($Page, $Limit) = Format::page_limit(TORRENT_COMMENTS_PER_PAGE, $Results);
}
//Get the cache catalogue
@ -937,12 +937,12 @@ function require(file, callback) {
WHERE c.ArtistID = '$ArtistID'
ORDER BY c.ID
LIMIT $CatalogueLimit");
$Catalogue = $DB->to_array(false,MYSQLI_ASSOC);
$Catalogue = $DB->to_array(false, MYSQLI_ASSOC);
$Cache->cache_value('artist_comments_'.$ArtistID.'_catalogue_'.$CatalogueID, $Catalogue, 0);
}
//This is a hybrid to reduce the catalogue down to the page elements: We use the page limit % catalogue
$Thread = array_slice($Catalogue,((TORRENT_COMMENTS_PER_PAGE * $Page - TORRENT_COMMENTS_PER_PAGE) % THREAD_CATALOGUE),TORRENT_COMMENTS_PER_PAGE,true);
$Thread = array_slice($Catalogue, ((TORRENT_COMMENTS_PER_PAGE * $Page - TORRENT_COMMENTS_PER_PAGE) % THREAD_CATALOGUE), TORRENT_COMMENTS_PER_PAGE, true);
?>
<div id="artistcomments" class="linkbox">
<a name="comments"></a>

View File

@ -61,7 +61,8 @@
}
}
$DB->query("INSERT INTO blog (UserID, Title, Body, Time, ThreadID, Important)
$DB->query("
INSERT INTO blog (UserID, Title, Body, Time, ThreadID, Important)
VALUES ('".$LoggedUser['ID']."',
'".db_string($_POST['title'])."',
'".db_string($_POST['body'])."',
@ -76,7 +77,6 @@
$DB->query("INSERT IGNORE INTO users_subscriptions VALUES ('$LoggedUser[ID]', $ThreadID)");
$Cache->delete_value('subscriptions_user_'.$LoggedUser['ID']);
}
header('Location: blog.php');
break;
}

View File

@ -143,7 +143,7 @@ function compare($X, $Y) {
</td>
<td class="nobr"><?=Format::get_size($Torrent['Size'])?></td>
<td><?=number_format($Torrent['Snatched'])?></td>
<td<?=($Torrent['Seeders']==0)?' class="r00"':''?>><?=number_format($Torrent['Seeders'])?></td>
<td<?=(($Torrent['Seeders'] == 0) ? ' class="r00"' : '')?>><?=number_format($Torrent['Seeders'])?></td>
<td><?=number_format($Torrent['Leechers'])?></td>
</tr>
<?

View File

@ -218,7 +218,7 @@ function compare($X, $Y) {
</td>
<td class="nobr"><?=Format::get_size($Torrent['Size'])?></td>
<td><?=number_format($Torrent['Snatched'])?></td>
<td<?=($Torrent['Seeders']==0)?' class="r00"':''?>><?=number_format($Torrent['Seeders'])?></td>
<td<?=(($Torrent['Seeders'] == 0) ? ' class="r00"' : '')?>><?=number_format($Torrent['Seeders'])?></td>
<td><?=number_format($Torrent['Leechers'])?></td>
</tr>
<?

View File

@ -66,7 +66,7 @@
<td class="label">Tags</td>
<td><input type="text" name="tags" size="60" value="<?=$TagList?>" /></td>
</tr>
<? if ($CategoryID == 0) { // CategoryID==0 is for "personal" collages ?>
<? if ($CategoryID == 0) { // CategoryID == 0 is for "personal" collages ?>
<tr>
<td class="label"><span title="A &quot;featured&quot; personal collage will be listed first on your profile, along with a preview of the included torrents.">Featured</span></td>
<td><input type="checkbox" name="featured"<?=($Featured ? ' checked="checked"' : '')?> /></td>

View File

@ -26,7 +26,7 @@
$GroupIDs = $DB->collect('GroupID');
$CollageDataList=$DB->to_array('GroupID', MYSQLI_ASSOC);
$CollageDataList = $DB->to_array('GroupID', MYSQLI_ASSOC);
if (count($GroupIDs) > 0) {
$TorrentList = Torrents::get_groups($GroupIDs);
$TorrentList = $TorrentList['matches'];

View File

@ -56,8 +56,7 @@
comment_body($UserID, $PostID, $postheader, $permalink, $Body, $EditorID, $AddedTime, $EditedTime);
} /* end while loop*/ ?>
<div class="linkbox"><?= $Pages; ?></div>
<div class="linkbox"><?=($Pages)?></div>
</div>
<?
View::show_footer();

View File

@ -83,7 +83,7 @@
comment_body($UserID, $PostID, $postheader, $permalink, $Body, $EditorID, $AddedTime, $EditedTime);
} /* end while loop*/ ?>
<div class="linkbox"><?= $Pages; ?></div>
<div class="linkbox"><?=($Pages)?></div>
</div>
<?

View File

@ -22,9 +22,9 @@ function btc_address($UserID, $GenAddress = false) {
$DB->query("SELECT BitcoinAddress FROM users_info WHERE UserID = '$UserID'");
list($Addr) = $DB->next_record();
if (!empty($Addr)) { return $Addr; }
elseif ($GenAddress) {
if (!empty($Addr)) {
return $Addr;
} elseif ($GenAddress) {
if (empty($NewAddr)) {
error(0);
}

View File

@ -9,7 +9,6 @@
case 'ipn': // PayPal hits this page when a donation is received
include(SERVER_ROOT.'/sections/donate/ipn.php');
break;
case 'complete':
include(SERVER_ROOT.'/sections/donate/complete.php');
break;

View File

@ -66,7 +66,10 @@
} else {
//Failed pending donation
$Message = "User https://".SSL_SITE_URL."/user.php?id=".$_POST['custom']." had donation of ".$TotalDonated." ".PAYPAL_CURRENCY." at ".$DonationTime." UTC from ".$_POST['payer_email']." returned.";
$DB->query('SELECT SUM(Amount), MIN(Time) FROM donations WHERE UserID=\''.$_POST['custom'].'\';');
$DB->query('
SELECT SUM(Amount), MIN(Time)
FROM donations
WHERE UserID=\''.$_POST['custom'].'\';');
list($TotalDonated,$DonationTime) = $DB->next_record();
if ($TotalDonated+$_POST['mc_gross'] == 0) {
$DB->query("SELECT Invites FROM users_main WHERE ID='".$_POST['custom']."'");
@ -92,16 +95,21 @@
}
}
}
$DB->query("UPDATE users_info
$DB->query("
UPDATE users_info
SET
AdminComment=CONCAT('".sqltime()." - User donated ".db_string($_POST['mc_gross'])." ".db_string(PAYPAL_CURRENCY)." from ".db_string($_POST['payer_email']).".\n',AdminComment)
WHERE UserID='".$_POST['custom']."'");
$DB->query("INSERT INTO donations
(UserID, Amount, Email, Time) VALUES
$DB->query("
INSERT INTO donations
(UserID, Amount, Email, Time)
VALUES
('".$_POST['custom']."', '".db_string($_POST['mc_gross'])."', '".db_string($_POST['payer_email'])."', '".sqltime()."')");
} else {
$DB->query("INSERT INTO ip_bans
(FromIP, ToIP, Reason) VALUES
$DB->query("
INSERT INTO ip_bans
(FromIP, ToIP, Reason)
VALUES
('".Tools::ip_to_unsigned($_SERVER['REMOTE_ADDR'])."','".ip2long($_SERVER['REMOTE_ADDR'])."', 'Attempted to exploit donation system.')");
}
fclose ($Socket);

View File

@ -56,7 +56,6 @@
}
}
if (!isset($Forums[$ForumID])) {
error(404);
}
@ -68,7 +67,6 @@
}
$ForumName = display_str($Forums[$ForumID]['Name']);
if ($LoggedUser['CustomForums'][$ForumID] != 1 && $Forums[$ForumID]['MinClassRead'] > $LoggedUser['Class']) {
error(403);

View File

@ -123,7 +123,7 @@
<tr class="colhead">
<td width="10"><input type="checkbox" onclick="toggleChecks('messageform',this)" /></td>
<td width="50%">Subject</td>
<td><?=(($Section == 'sentbox')? 'Receiver' : 'Sender')?></td>
<td><?=(($Section == 'sentbox') ? 'Receiver' : 'Sender')?></td>
<td>Date</td>
<? if (check_perms('users_mod')) { ?>
<td>Forwarded to</td>

View File

@ -182,9 +182,11 @@ function log_attempt($UserID) {
$IP = Tools::ip_to_unsigned($IPStr);
if ($AttemptID) { // User has attempted to log in recently
$Attempts++;
if ($Attempts>5) { // Only 6 allowed login attempts, ban user's IP
$BannedUntil=time_plus(60*60*6);
$DB->query("UPDATE login_attempts SET
if ($Attempts > 5) { // Only 6 allowed login attempts, ban user's IP
$BannedUntil = time_plus(60 * 60 * 6);
$DB->query("
UPDATE login_attempts
SET
LastAttempt='".sqltime()."',
Attempts='".db_string($Attempts)."',
BannedUntil='".db_string($BannedUntil)."',
@ -197,31 +199,34 @@ function log_attempt($UserID) {
//Ban exists already, only add new entry if not for same reason
list($Reason) = $DB->next_record(MYSQLI_BOTH, false);
if ($Reason != 'Automated ban per >60 failed login attempts') {
$DB->query("UPDATE ip_bans
$DB->query("
UPDATE ip_bans
SET Reason = CONCAT('Automated ban per >60 failed login attempts AND ', Reason)
WHERE FromIP = ".$IP." AND ToIP = ".$IP);
WHERE FromIP = $IP AND ToIP = $IP");
}
} else {
//No ban
$DB->query("INSERT IGNORE INTO ip_bans
(FromIP, ToIP, Reason) VALUES
('$IP','$IP', 'Automated ban per >60 failed login attempts')");
$DB->query("
INSERT IGNORE INTO ip_bans (FromIP, ToIP, Reason)
VALUES ('$IP','$IP', 'Automated ban per >60 failed login attempts')");
$Cache->delete_value('ip_bans_'.$IPA);
}
}
} else {
// User has attempted fewer than 6 logins
$DB->query("UPDATE login_attempts SET
$DB->query("
UPDATE login_attempts
SET
LastAttempt='".sqltime()."',
Attempts='".db_string($Attempts)."',
BannedUntil='0000-00-00 00:00:00'
WHERE ID='".db_string($AttemptID)."'");
}
} else { // User has not attempted to log in recently
$Attempts=1;
$DB->query("INSERT INTO login_attempts
(UserID,IP,LastAttempt,Attempts) VALUES
('".db_string($UserID)."','".db_string($IPStr)."','".sqltime()."',1)");
$Attempts = 1;
$DB->query("
INSERT INTO login_attempts (UserID,IP,LastAttempt,Attempts)
VALUES ('".db_string($UserID)."','".db_string($IPStr)."','".sqltime()."',1)");
}
} // end log_attempt function
@ -231,7 +236,7 @@ function log_attempt($UserID) {
header("Location: login.php");
die();
}
$Err=$Validate->ValidateForm($_POST);
$Err = $Validate->ValidateForm($_POST);
if (!$Err) {
// Passes preliminary validation (username and password "look right")
@ -290,7 +295,8 @@ function log_attempt($UserID) {
));
$Cache->commit_transaction(0);
$Sql = "UPDATE users_main
$Sql = "
UPDATE users_main
SET
LastLogin='".sqltime()."',
LastAccess='".sqltime()."'";

View File

@ -14,7 +14,8 @@
$DB->query("SELECT
$DB->query("
SELECT
r.ID,
r.ReporterID,
reporter.Username,
@ -73,7 +74,6 @@
ORDER BY ReportedTime ASC
LIMIT 1");
if ($DB->record_count() < 1) {
die();
}
@ -85,8 +85,10 @@
if (!$GroupID) {
//Torrent already deleted
$DB->query("UPDATE reportsv2
SET Status='Resolved',
$DB->query("
UPDATE reportsv2
SET
Status='Resolved',
LastChangeTime='".sqltime()."',
ModComment='Report already dealt with (torrent deleted)'
WHERE ID=".$ReportID);
@ -250,7 +252,6 @@
$Extras = explode(' ', $ExtraIDs);
foreach ($Extras as $ExtraID) {
$DB->query("
SELECT
tg.Name,

View File

@ -114,7 +114,7 @@
}
foreach ($TypeList as $Type => $Data) {
?>
<option value="<?= $Type ?>"><?= $Data['title'] ?></option>
<option value="<?=($Type)?>"><?=($Data['title'])?></option>
<? } ?>
</select>
</td>
@ -126,7 +126,7 @@
<br />
<div id="dynamic_form">
<?
<?
/*
* THIS IS WHERE SEXY AJAX COMES IN
* The following malarky is needed so that if you get sent back here the fields are filled in

View File

@ -122,7 +122,8 @@
$DB->query("SELECT SQL_CALC_FOUND_ROWS
$DB->query("
SELECT SQL_CALC_FOUND_ROWS
r.ID,
r.ReporterID,
reporter.Username,
@ -174,17 +175,17 @@
LEFT JOIN artists_alias AS aa ON aa.AliasID=ta.AliasID
LEFT JOIN users_main AS resolver ON resolver.ID=r.ResolverID
LEFT JOIN users_main AS reporter ON reporter.ID=r.ReporterID
LEFT JOIN users_main AS uploader ON uploader.ID=t.UserID "
.$Where."
GROUP BY r.ID "
.$Order."
LIMIT ".$Limit);
LEFT JOIN users_main AS uploader ON uploader.ID=t.UserID
$Where
GROUP BY r.ID
$Order
LIMIT $Limit");
$Reports = $DB->to_array();
$DB->query('SELECT FOUND_ROWS()');
list($Results) = $DB->next_record();
$PageLinks=Format::get_pages($Page,$Results,REPORTS_PER_PAGE,11);
$PageLinks = Format::get_pages($Page, $Results, REPORTS_PER_PAGE, 11);
View::show_header('Reports V2!', 'reportsv2,bbcode');
@ -230,7 +231,9 @@
if (!$GroupID && $Status != 'Resolved') {
//Torrent already deleted
$DB->query("UPDATE reportsv2 SET
$DB->query("
UPDATE reportsv2
SET
Status='Resolved',
LastChangeTime='".sqltime()."',
ModComment='Report already dealt with (torrent deleted)'
@ -406,8 +409,8 @@
$Extras = explode(' ', $ExtraIDs);
foreach ($Extras as $ExtraID) {
$DB->query("SELECT
$DB->query("
SELECT
tg.Name,
tg.ID,
CASE COUNT(ta.GroupID)

View File

@ -361,7 +361,7 @@
</ul>
</li>
</ul>
<span style="font-style: italic;">Note: The "Year" tag is optional, but strongly encouraged. However, if missing or incorrect, this is not grounds for trumping a torrent.</span>
<span style="font-style: italic;">Note: The "Year" tag is optional but strongly encouraged. However, if missing or incorrect, this is not grounds for trumping a torrent.</span>
</li>
<li id="r2.3.17"><a href="#h2.3"><strong>&uarr;_</strong></a> <a href="#r2.3.17">2.3.17.</a> <strong>The torrent artist for classical works should use the full composer name.</strong> Before uploading see <a href="wiki.php?action=article&amp;id=700">this wiki</a> for guidelines on uploading classical music torrents. Also, consult <a href="wiki.php?action=article&amp;id=691">this wiki</a> for a full explanation of the classical music tagging system.</li>
<li id="r2.3.18"><a href="#h2.3"><strong>&uarr;_</strong></a> <a href="#r2.3.18">2.3.18.</a> <strong>Newly re-tagged torrents trumping badly tagged torrents must reflect a substantial improvement over the previous tags.</strong> Small changes that include replacing ASCII characters with proper foreign language characters with diacritical marks, fixing slight misspellings, or missing an alternate spelling of an artist (e.g., excluding "The" before a band name) are insufficient grounds for replacing other torrents. Artist names that are misspelled in the tags are grounds for trumping; this includes character accents and characters that mean one letter in one language and a different letter in another language. Improper capitalization in the tags is grounds for trumping; this includes artist tags (or composer tags) that contain names that are all capitalized or track titles that are all capitalized. Tags with multiple entries in the same tag (e.g., track number and track title in the track title tags; or track number, artist, and track title in the artist tags) are subject to trumping. You may trump a release if the tags do not follow the data from a reputable music cataloguing service such as <a href="https://musicbrainz.org/" target="_blank">MusicBrainz</a> or <a href="http://www.discogs.com/" target="_blank">Discogs</a>. In the case of a conflict between reputable listings, either tagged version is equally preferred on the site and cannot trump the other. For example, an album is tagged differently in <a href="https://musicbrainz.org/" target="_blank">MusicBrainz</a> and in <a href="http://www.discogs.com/" target="_blank">Discogs</a>. Either style of tagging is permitted; neither is "better" than the other. In that case, any newly tagged torrents replacing an already properly tagged torrent, which follows good tagging convention, will result in a dupe. Note: For classical music, please follow these <a href="wiki.php?action=article&amp;id=691">tagging guidelines</a>.</li>

View File

@ -1,7 +1,7 @@
<?
if ($Message = db_string($_POST['message'])) {
if ($Subject = db_string($_POST['subject'])) {
// New staff pm conversation
// New staff PM conversation
$Level = db_string($_POST['level']);
$DB->query("
INSERT INTO staff_pm_conversations
@ -26,8 +26,6 @@
$DB->query("SELECT UserID, AssignedToUser FROM staff_pm_conversations WHERE ID=$ConvID");
list($UserID, $AssignedToUser) = $DB->next_record();
if ($UserID == $LoggedUser['ID'] || $IsFLS || $UserID == $AssignedToUser) {
// Response to existing conversation
$DB->query("
@ -40,11 +38,17 @@
// Update conversation
if ($IsFLS) {
// FLS/Staff
$DB->query("UPDATE staff_pm_conversations SET Date='".sqltime()."', Unread=true, Status='Open' WHERE ID=$ConvID");
$DB->query("
UPDATE staff_pm_conversations
SET Date='".sqltime()."', Unread=true, Status='Open'
WHERE ID=$ConvID");
$Cache->delete_value('num_staff_pms_'.$LoggedUser['ID']);
} else {
// User
$DB->query("UPDATE staff_pm_conversations SET Date='".sqltime()."', Unread=true, Status='Unanswered' WHERE ID=$ConvID");
$DB->query("
UPDATE staff_pm_conversations
SET Date='".sqltime()."', Unread=true, Status='Unanswered'
WHERE ID=$ConvID");
}
// Clear cache for user
@ -56,18 +60,17 @@
// User is trying to respond to conversation that does no belong to them
error(403);
}
} else {
// Message but no subject or conversation id
// Message but no subject or conversation ID
header("Location: staffpm.php?action=viewconv&id=$ConvID");
}
} elseif ($ConvID = (int)$_POST['convid']) {
// No message, but conversation id
// No message, but conversation ID
header("Location: staffpm.php?action=viewconv&id=$ConvID");
} else {
// No message or conversation id
// No message or conversation ID
header('Location: staffpm.php');
}

View File

@ -1018,7 +1018,7 @@ function header_link($SortKey,$DefaultWay="desc") {
<td class="nobr"><?=time_diff($GroupTime,1)?></td>
<td class="nobr"><?=Format::get_size($MaxSize)?> (Max)</td>
<td><?=number_format($TotalSnatched)?></td>
<td<?=($TotalSeeders==0)?' class="r00"':''?>><?=number_format($TotalSeeders)?></td>
<td<?=(($TotalSeeders == 0) ? ' class="r00"' : '')?>><?=number_format($TotalSeeders)?></td>
<td><?=number_format($TotalLeechers)?></td>
</tr>
<?

View File

@ -542,11 +542,10 @@ function filelist($Str) {
| <a href="reportsv2.php?action=report&amp;id=<?=$TorrentID?>" title="Report">RP</a>
<? if ($CanEdit) { ?>
| <a href="torrents.php?action=edit&amp;id=<?=$TorrentID ?>" title="Edit">ED</a>
<? } ?>
<? if (check_perms('torrents_delete') || $UserID == $LoggedUser['ID']) { ?>
<? }
if (check_perms('torrents_delete') || $UserID == $LoggedUser['ID']) { ?>
| <a href="torrents.php?action=delete&amp;torrentid=<?=$TorrentID ?>" title="Remove">RM</a>
<? } ?>
<? }?>
| <a href="torrents.php?torrentid=<?=$TorrentID ?>" title="Permalink">PL</a>
]</span>
&raquo; <a href="#" onclick="$('#torrent_<?=$TorrentID?>').toggle(); return false;"><?=$ExtraInfo; ?></a>
@ -561,8 +560,7 @@ function filelist($Str) {
<div id="release_<?=$TorrentID?>" class="no_overflow">
<blockquote>
Uploaded by <?=Users::format_username($UserID, false, false, false)?> <?=time_diff($TorrentTime);?>
<? if ($Seeders == 0) { ?>
<?
<? if ($Seeders == 0) {
if ($LastActive != '0000-00-00 00:00:00' && time() - strtotime($LastActive) >= 1209600) { ?>
<br /><strong>Last active: <?=time_diff($LastActive); ?></strong>
<? } else { ?>
@ -572,7 +570,7 @@ function filelist($Str) {
<br /><a href="torrents.php?action=reseed&amp;torrentid=<?=$TorrentID?>&amp;groupid=<?=$GroupID?>" class="brackets">Request re-seed</a>
<? } ?>
<? } ?>
<? }?>
</blockquote>
</div>
<? if (check_perms('site_moderate_requests')) { ?>
@ -585,7 +583,7 @@ function filelist($Str) {
<? if (check_perms('site_view_torrent_snatchlist')) { ?>
<a href="#" class="brackets" onclick="show_downloads('<?=$TorrentID?>', 0);return false;" title="View the list of users that have clicked the &quot;DL&quot; button.">View download list</a>
<a href="#" class="brackets" onclick="show_snatches('<?=$TorrentID?>', 0);return false;" title="View the list of users that have reported a snatch to the tracker.">View snatch list</a>
<? } ?>
<? }?>
<a href="#" class="brackets" onclick="show_files('<?=$TorrentID?>');return false;">View file list</a>
<? if ($Reported) { ?>
<a href="#" class="brackets" onclick="show_reported('<?=$TorrentID?>');return false;">View report information</a>

View File

@ -458,8 +458,8 @@ function filelist($Str) {
$EditionID++;
?>
<tr class="releases_<?= $ReleaseType ?> groupid_<?= $GroupID ?> edition group_torrent">
<td colspan="5" class="edition_info"><strong><a href="#" onclick="toggle_edition(<?= $GroupID ?>, <?= $EditionID ?>, this, event)" title="Collapse this edition. Hold &quot;Ctrl&quot; while clicking to collapse all editions in this torrent group.">&minus;</a> <?= Torrents::edition_string($Torrent, $TorrentDetails) ?></strong></td>
<tr class="releases_<?=($ReleaseType)?> groupid_<?=($GroupID)?> edition group_torrent">
<td colspan="5" class="edition_info"><strong><a href="#" onclick="toggle_edition(<?=($GroupID)?>, <?=($EditionID)?>, this, event)" title="Collapse this edition. Hold &quot;Ctrl&quot; while clicking to collapse all editions in this torrent group.">&minus;</a> <?= Torrents::edition_string($Torrent, $TorrentDetails) ?></strong></td>
</tr>
<?
}
@ -469,65 +469,65 @@ function filelist($Str) {
$LastRemasterCatalogueNumber = $RemasterCatalogueNumber;
$LastMedia = $Media;
?>
<tr class="torrent_row releases_<?= $ReleaseType ?> groupid_<?= $GroupID ?> edition_<?= $EditionID ?> group_torrent<?= $IsSnatched ? ' snatched_torrent' : '' ?>" style="font-weight: normal;" id="torrent<?= $TorrentID ?>">
<tr class="torrent_row releases_<?=($ReleaseType)?> groupid_<?=($GroupID)?> edition_<?=($EditionID)?> group_torrent<?=($IsSnatched ? ' snatched_torrent' : '')?>" style="font-weight: normal;" id="torrent<?=($TorrentID)?>">
<td>
<span>[ <a href="torrents.php?action=download&amp;id=<?= $TorrentID ?>&amp;authkey=<?= $LoggedUser['AuthKey'] ?>&amp;torrent_pass=<?= $LoggedUser['torrent_pass'] ?>" title="Download"><?= $HasFile ? 'DL' : 'Missing' ?></a>
<span>[ <a href="torrents.php?action=download&amp;id=<?=($TorrentID)?>&amp;authkey=<?=($LoggedUser['AuthKey'])?>&amp;torrent_pass=<?=($LoggedUser['torrent_pass'])?>" title="Download"><?=($HasFile ? 'DL' : 'Missing')?></a>
<? if (Torrents::can_use_token($Torrent)) { ?>
| <a href="torrents.php?action=download&amp;id=<?= $TorrentID ?>&amp;authkey=<?= $LoggedUser['AuthKey'] ?>&amp;torrent_pass=<?= $LoggedUser['torrent_pass'] ?>&amp;usetoken=1" title="Use a FL Token" onclick="return confirm('Are you sure you want to use a freeleech token here?');">FL</a>
| <a href="torrents.php?action=download&amp;id=<?=($TorrentID)?>&amp;authkey=<?=($LoggedUser['AuthKey'])?>&amp;torrent_pass=<?=($LoggedUser['torrent_pass'])?>&amp;usetoken=1" title="Use a FL Token" onclick="return confirm('Are you sure you want to use a freeleech token here?');">FL</a>
<? } ?>
| <a href="reportsv2.php?action=report&amp;id=<?= $TorrentID ?>" title="Report">RP</a>
| <a href="reportsv2.php?action=report&amp;id=<?=($TorrentID)?>" title="Report">RP</a>
<? if ($CanEdit) { ?>
| <a href="torrents.php?action=edit&amp;id=<?= $TorrentID ?>" title="Edit">ED</a>
| <a href="torrents.php?action=edit&amp;id=<?=($TorrentID)?>" title="Edit">ED</a>
<? }
if (check_perms('torrents_delete') || $UserID == $LoggedUser['ID']) { ?>
| <a href="torrents.php?action=delete&amp;torrentid=<?= $TorrentID ?>" title="Remove">RM</a>
| <a href="torrents.php?action=delete&amp;torrentid=<?=($TorrentID)?>" title="Remove">RM</a>
<? } ?>
| <a href="torrents.php?torrentid=<?= $TorrentID ?>" title="Permalink">PL</a>
| <a href="torrents.php?torrentid=<?=($TorrentID)?>" title="Permalink">PL</a>
]</span>
&raquo; <a href="#" onclick="$('#torrent_<?= $TorrentID ?>').toggle(); return false;"><?= $ExtraInfo; ?></a>
&raquo; <a href="#" onclick="$('#torrent_<?=($TorrentID)?>').toggle(); return false;"><?=($ExtraInfo)?></a>
</td>
<td class="nobr"><?= Format::get_size($Size) ?></td>
<td><?= number_format($Snatched) ?></td>
<td><?= number_format($Seeders) ?></td>
<td><?= number_format($Leechers) ?></td>
<td class="nobr"><?=(Format::get_size($Size))?></td>
<td><?=(number_format($Snatched))?></td>
<td><?=(number_format($Seeders))?></td>
<td><?=(number_format($Leechers))?></td>
</tr>
<tr class="releases_<?= $ReleaseType ?> groupid_<?= $GroupID ?> edition_<?= $EditionID ?> torrentdetails pad<? if (!isset($_GET['torrentid']) || $_GET['torrentid'] != $TorrentID) { ?> hidden<? } ?>" id="torrent_<?= $TorrentID; ?>">
<tr class="releases_<?=($ReleaseType)?> groupid_<?=($GroupID)?> edition_<?=($EditionID)?> torrentdetails pad<? if (!isset($_GET['torrentid']) || $_GET['torrentid'] != $TorrentID) { ?> hidden<? } ?>" id="torrent_<?=($TorrentID)?>">
<td colspan="5">
<blockquote>
Uploaded by <?= Users::format_username($UserID, false, false, false) ?> <?= time_diff($TorrentTime); ?>
Uploaded by <?=(Users::format_username($UserID, false, false, false))?> <?=time_diff($TorrentTime);?>
<? if ($Seeders == 0) {
if ($LastActive != '0000-00-00 00:00:00' && time() - strtotime($LastActive) >= 1209600) { ?>
<br /><strong>Last active: <?= time_diff($LastActive); ?></strong>
<br /><strong>Last active: <?=time_diff($LastActive);?></strong>
<? } else { ?>
<br />Last active: <?= time_diff($LastActive); ?>
<br />Last active: <?=time_diff($LastActive);?>
<? }
if ($LastActive != '0000-00-00 00:00:00' && time() - strtotime($LastActive) >= 345678 && time() - strtotime($LastReseedRequest) >= 864000) { ?>
<br /><a href="torrents.php?action=reseed&amp;torrentid=<?= $TorrentID ?>&amp;groupid=<?= $GroupID ?>" class="brackets">Request re-seed</a>
<br /><a href="torrents.php?action=reseed&amp;torrentid=<?=($TorrentID)?>&amp;groupid=<?=($GroupID)?>" class="brackets">Request re-seed</a>
<? }
} ?>
</blockquote>
<? if (check_perms('site_moderate_requests')) { ?>
<div class="linkbox">
<a href="torrents.php?action=masspm&amp;id=<?= $GroupID ?>&amp;torrentid=<?= $TorrentID ?>" class="brackets">Mass PM snatchers</a>
<a href="torrents.php?action=masspm&amp;id=<?=($GroupID)?>&amp;torrentid=<?=($TorrentID)?>" class="brackets">Mass PM snatchers</a>
</div>
<? } ?>
<div class="linkbox">
<a href="#" class="brackets" onclick="show_peers('<?= $TorrentID ?>', 0);return false;">View peer list</a>
<a href="#" class="brackets" onclick="show_peers('<?=($TorrentID)?>', 0);return false;">View peer list</a>
<? if (check_perms('site_view_torrent_snatchlist')) { ?>
<a href="#" class="brackets" onclick="show_downloads('<?= $TorrentID ?>', 0);return false;" title="View the list of users that have clicked the &quot;DL&quot; button.">View download list</a>
<a href="#" class="brackets" onclick="show_snatches('<?= $TorrentID ?>', 0);return false;" title="View the list of users that have reported a snatch to the tracker.">View snatch list</a>
<a href="#" class="brackets" onclick="show_downloads('<?=($TorrentID)?>', 0);return false;" title="View the list of users that have clicked the &quot;DL&quot; button.">View download list</a>
<a href="#" class="brackets" onclick="show_snatches('<?=($TorrentID)?>', 0);return false;" title="View the list of users that have reported a snatch to the tracker.">View snatch list</a>
<? } ?>
<a href="#" class="brackets" onclick="show_files('<?= $TorrentID ?>');return false;">View file list</a>
<a href="#" class="brackets" onclick="show_files('<?=($TorrentID)?>');return false;">View file list</a>
<? if ($Reported) { ?>
<a href="#" class="brackets" onclick="show_reported('<?= $TorrentID ?>');return false;">View report information</a>
<a href="#" class="brackets" onclick="show_reported('<?=($TorrentID)?>');return false;">View report information</a>
<? } ?>
</div>
<div id="peers_<?= $TorrentID ?>" class="hidden"></div>
<div id="downloads_<?= $TorrentID ?>" class="hidden"></div>
<div id="snatches_<?= $TorrentID ?>" class="hidden"></div>
<div id="files_<?= $TorrentID ?>" class="hidden"><?= $FileTable ?></div>
<div id="peers_<?=($TorrentID)?>" class="hidden"></div>
<div id="downloads_<?=($TorrentID)?>" class="hidden"></div>
<div id="snatches_<?=($TorrentID)?>" class="hidden"></div>
<div id="files_<?=($TorrentID)?>" class="hidden"><?=($FileTable)?></div>
<? if ($Reported) { ?>
<div id="reported_<?= $TorrentID ?>" class="hidden"><?= $ReportInfo ?></div>
<div id="reported_<?=($TorrentID)?>" class="hidden"><?=($ReportInfo)?></div>
<? }
if (!empty($Description)) {
echo '<blockquote>' . $Text->full_format($Description) . '</blockquote>';

View File

@ -247,16 +247,21 @@ function js_pages($Action, $TorrentID, $NumResults, $CurrentPage) {
}
// Mainly
$DB->query("SELECT
$DB->query("
SELECT
tc.Body,
tc.AuthorID,
tc.GroupID,
tc.AddedTime
FROM torrents_comments AS tc
WHERE tc.ID='".db_string($_POST['post'])."'");
list($OldBody, $AuthorID,$GroupID,$AddedTime)=$DB->next_record();
list($OldBody, $AuthorID,$GroupID,$AddedTime) = $DB->next_record();
$DB->query("SELECT ceil(COUNT(ID) / ".TORRENT_COMMENTS_PER_PAGE.") AS Page FROM torrents_comments WHERE GroupID = $GroupID AND ID <= $_POST[post]");
$DB->query("
SELECT ceil(COUNT(ID) / ".TORRENT_COMMENTS_PER_PAGE.") AS Page
FROM torrents_comments
WHERE GroupID = $GroupID
AND ID <= $_POST[post]");
list($Page) = $DB->next_record();
if ($LoggedUser['ID'] != $AuthorID && !check_perms('site_moderate_forums')) {
@ -267,7 +272,9 @@ function js_pages($Action, $TorrentID, $NumResults, $CurrentPage) {
}
// Perform the update
$DB->query("UPDATE torrents_comments SET
$DB->query("
UPDATE torrents_comments
SET
Body = '".db_string($_POST['body'])."',
EditedUserID = '".db_string($LoggedUser['ID'])."',
EditedTime = '".sqltime()."'

View File

@ -45,9 +45,10 @@
}
}
$DownloadsQ = $DB->query("SELECT
$DownloadsQ = $DB->query("
SELECT
t.ID AS TorrentID,
DATE_FORMAT(".$Month.",'%Y - %m') AS Month,
DATE_FORMAT($Month,'%Y - %m') AS Month,
t.GroupID,
t.Media,
t.Format,
@ -57,7 +58,7 @@
t.Size
FROM torrents as t
JOIN torrents_group AS tg ON t.GroupID=tg.ID
".$SQL."
$SQL
GROUP BY TorrentID");
$Collector = new TorrentsDL($DownloadsQ, "$Username's ".ucfirst($_GET['type']));
@ -65,7 +66,10 @@
while (list($Downloads, $GroupIDs) = $Collector->get_downloads('TorrentID')) {
$Artists = Artists::get_artists($GroupIDs);
$TorrentIDs = array_keys($GroupIDs);
$TorrentFilesQ = $DB->query("SELECT TorrentID, File FROM torrents_files WHERE TorrentID IN (".implode(',', $TorrentIDs).")", false);
$TorrentFilesQ = $DB->query('
SELECT TorrentID, File
FROM torrents_files
WHERE TorrentID IN ('.implode(',', $TorrentIDs).')', false);
if (is_int($TorrentFilesQ)) {
// Query failed. Let's not create a broken zip archive
foreach ($TorrentIDs as $TorrentID) {

View File

@ -28,7 +28,7 @@ function header_link($SortKey,$DefaultWay="DESC") {
if (!empty($_GET['page']) && is_number($_GET['page']) && $_GET['page'] > 0) {
$Page = $_GET['page'];
$Limit = ($Page-1)*TORRENTS_PER_PAGE.', '.TORRENTS_PER_PAGE;
$Limit = ($Page - 1) * TORRENTS_PER_PAGE.', '.TORRENTS_PER_PAGE;
} else {
$Page = 1;
$Limit = TORRENTS_PER_PAGE;
@ -512,7 +512,7 @@ function header_link($SortKey,$DefaultWay="DESC") {
<td<?=($Torrent['Seeders'] == 0) ? ' class="r00"' : ''?>><?=number_format($Torrent['Seeders'])?></td>
<td><?=number_format($Torrent['Leechers'])?></td>
</tr>
<? } ?>
<? }?>
</table>
<? } ?>
<div class="linkbox"><?=$Pages?></div>

View File

@ -5,12 +5,12 @@
$TotalVotes = $GroupVotes['Total'];
$UpVotes = $GroupVotes['Ups'];
$Voted = isset($UserVotes[$GroupID])?$UserVotes[$GroupID]['Type']:false;
$Voted = isset($UserVotes[$GroupID]) ? $UserVotes[$GroupID]['Type'] : false;
?>
<div class="box" id="votes">
<div class="head"><strong>Album votes</strong></div>
<div class="album_votes body">
This has <span id="upvotes" class="favoritecount"><?=number_format($UpVotes)?></span> <?=(($UpVotes==1) ? 'upvote' : 'upvotes')?> out of <span id="totalvotes" class="favoritecount"><?=number_format($TotalVotes)?></span> total<span id="upvoted"<?=(($Voted!='Up') ? ' class="hidden"' : '')?>>, including your upvote</span><span id="downvoted"<?=(($Voted!='Down') ? ' class="hidden"' : '')?>>, including your downvote</span>.
This has <span id="upvotes" class="favoritecount"><?=number_format($UpVotes)?></span> <?=(($UpVotes == 1) ? 'upvote' : 'upvotes')?> out of <span id="totalvotes" class="favoritecount"><?=number_format($TotalVotes)?></span> total<span id="upvoted"<?=(($Voted != 'Up') ? ' class="hidden"' : '')?>>, including your upvote</span><span id="downvoted"<?=(($Voted != 'Down') ? ' class="hidden"' : '')?>>, including your downvote</span>.
<br /><br />
<? if (check_perms('site_album_votes')) { ?>
<span<?=($Voted ? ' class="hidden"' : '')?> id="vote_message"><a href="#" class="brackets upvote" onclick="UpVoteGroup(<?=$GroupID?>, '<?=$LoggedUser['AuthKey']?>'); return false;">Upvote</a> - <a href="#" class="brackets downvote" onclick="DownVoteGroup(<?=$GroupID?>, '<?=$LoggedUser['AuthKey']?>'); return false;">Downvote</a></span>

View File

@ -195,7 +195,8 @@ function num_compare($Field, $Operand, $Num1, $Num2 = '') {
$Order = '';
$SQL = 'SQL_CALC_FOUND_ROWS
$SQL = '
SQL_CALC_FOUND_ROWS
um1.ID,
um1.Username,
um1.Uploaded,
@ -205,7 +206,8 @@ function num_compare($Field, $Operand, $Num1, $Num2 = '') {
} else {
$SQL .= "(SELECT COUNT(uid) FROM xbt_snatched AS xs WHERE xs.uid=um1.ID) AS Snatches,";
}
$SQL .= 'um1.PermissionID,
$SQL .= '
um1.PermissionID,
um1.Email,
um1.Enabled,
um1.IP,
@ -215,7 +217,8 @@ function num_compare($Field, $Operand, $Num1, $Num2 = '') {
ui1.Donor,
ui1.JoinDate,
um1.LastAccess
FROM users_main AS um1 JOIN users_info AS ui1 ON ui1.UserID=um1.ID ';
FROM users_main AS um1
JOIN users_info AS ui1 ON ui1.UserID=um1.ID ';
if (!empty($_GET['username'])) {
@ -225,17 +228,19 @@ function num_compare($Field, $Operand, $Num1, $Num2 = '') {
if (!empty($_GET['email'])) {
if (isset($_GET['email_history'])) {
$Distinct = 'DISTINCT ';
$Join['he']=' JOIN users_history_emails AS he ON he.UserID=um1.ID ';
$Where[]= ' he.Email '.$Match.wrap($_GET['email']);
$Join['he'] = ' JOIN users_history_emails AS he ON he.UserID=um1.ID ';
$Where[] = ' he.Email '.$Match.wrap($_GET['email']);
} else {
$Where[]='um1.Email'.$Match.wrap($_GET['email']);
$Where[] = 'um1.Email'.$Match.wrap($_GET['email']);
}
}
if (!empty($_GET['email_cnt']) && is_number($_GET['email_cnt'])) {
$Query = "SELECT UserID FROM users_history_emails GROUP BY UserID HAVING COUNT(DISTINCT Email) ";
$Query = "
SELECT UserID
FROM users_history_emails
GROUP BY UserID
HAVING COUNT(DISTINCT Email) ";
if ($_GET['emails_opt'] === 'equal') {
$operator = '=';
}
@ -249,7 +254,7 @@ function num_compare($Field, $Operand, $Num1, $Num2 = '') {
$DB->query($Query);
$Users = implode(',', $DB->collect('UserID'));
if (!empty($Users)) {
$Where[] = "um1.ID IN (".$Users.")";
$Where[] = "um1.ID IN ($Users)";
}
}
@ -257,37 +262,35 @@ function num_compare($Field, $Operand, $Num1, $Num2 = '') {
if (!empty($_GET['ip'])) {
if (isset($_GET['ip_history'])) {
$Distinct = 'DISTINCT ';
$Join['hi']=' JOIN users_history_ips AS hi ON hi.UserID=um1.ID ';
$Where[]= ' hi.IP '.$Match.wrap($_GET['ip'], '', true);
$Join['hi'] = ' JOIN users_history_ips AS hi ON hi.UserID=um1.ID ';
$Where[] = ' hi.IP '.$Match.wrap($_GET['ip'], '', true);
} else {
$Where[]='um1.IP'.$Match.wrap($_GET['ip'], '', true);
$Where[] = 'um1.IP'.$Match.wrap($_GET['ip'], '', true);
}
}
if (!empty($_GET['cc'])) {
if ($_GET['cc_op'] == "equal") {
$Where[]="um1.ipcc = '".db_string($_GET['cc'])."'";
$Where[] = "um1.ipcc = '".db_string($_GET['cc'])."'";
} else {
$Where[]="um1.ipcc != '".db_string($_GET['cc'])."'";
$Where[] = "um1.ipcc != '".db_string($_GET['cc'])."'";
}
}
if (!empty($_GET['tracker_ip'])) {
$Distinct = 'DISTINCT ';
$Join['xfu']=' JOIN xbt_files_users AS xfu ON um1.ID=xfu.uid ';
$Where[]= ' xfu.ip '.$Match.wrap($_GET['tracker_ip'], '', true);
$Join['xfu'] = ' JOIN xbt_files_users AS xfu ON um1.ID=xfu.uid ';
$Where[] = ' xfu.ip '.$Match.wrap($_GET['tracker_ip'], '', true);
}
// if (!empty($_GET['tracker_ip'])) {
// $Distinct = 'DISTINCT ';
// $Join['xs']=' JOIN xbt_snatched AS xs ON um1.ID=xs.uid ';
// $Where[]= ' xs.IP '.$Match.wrap($_GET['ip']);
// $Join['xs'] = ' JOIN xbt_snatched AS xs ON um1.ID=xs.uid ';
// $Where[] = ' xs.IP '.$Match.wrap($_GET['ip']);
// }
if (!empty($_GET['comment'])) {
$Where[]='ui1.AdminComment'.$Match.wrap($_GET['comment']);
$Where[] = 'ui1.AdminComment'.$Match.wrap($_GET['comment']);
}
if (!empty($_GET['lastfm'])) {
@ -300,27 +303,27 @@ function num_compare($Field, $Operand, $Num1, $Num2 = '') {
if (strlen($_GET['invites1'])) {
$Invites1 = round($_GET['invites1']);
$Invites2 = round($_GET['invites2']);
$Where[]=implode(' AND ', num_compare('Invites', $_GET['invites'], $Invites1, $Invites2));
$Where[] = implode(' AND ', num_compare('Invites', $_GET['invites'], $Invites1, $Invites2));
}
if ($_GET['disabled_invites'] == 'yes') {
$Where[]='ui1.DisableInvites=\'1\'';
$Where[] = 'ui1.DisableInvites=\'1\'';
} elseif ($_GET['disabled_invites'] == 'no') {
$Where[]='ui1.DisableInvites=\'0\'';
$Where[] = 'ui1.DisableInvites=\'0\'';
}
if ($_GET['disabled_uploads'] == 'yes') {
$Where[]='ui1.DisableUpload=\'1\'';
$Where[] = 'ui1.DisableUpload=\'1\'';
} elseif ($_GET['disabled_uploads'] == 'no') {
$Where[]='ui1.DisableUpload=\'0\'';
$Where[] = 'ui1.DisableUpload=\'0\'';
}
if ($_GET['join1']) {
$Where[]=implode(' AND ', date_compare('ui1.JoinDate', $_GET['joined'], $_GET['join1'], $_GET['join2']));
$Where[] = implode(' AND ', date_compare('ui1.JoinDate', $_GET['joined'], $_GET['join1'], $_GET['join2']));
}
if ($_GET['lastactive1']) {
$Where[]=implode(' AND ', date_compare('um1.LastAccess', $_GET['lastactive'], $_GET['lastactive1'], $_GET['lastactive2']));
$Where[] = implode(' AND ', date_compare('um1.LastAccess', $_GET['lastactive'], $_GET['lastactive1'], $_GET['lastactive2']));
}
if ($_GET['ratio1']) {
@ -328,16 +331,16 @@ function num_compare($Field, $Operand, $Num1, $Num2 = '') {
if (!$Decimals) {
$Decimals = 0;
}
$Where[]=implode(' AND ', num_compare("ROUND(Uploaded/Downloaded,$Decimals)", $_GET['ratio'], $_GET['ratio1'], $_GET['ratio2']));
$Where[] = implode(' AND ', num_compare("ROUND(Uploaded/Downloaded,$Decimals)", $_GET['ratio'], $_GET['ratio1'], $_GET['ratio2']));
}
if (strlen($_GET['uploaded1'])) {
$Upload1 = round($_GET['uploaded1']);
$Upload2 = round($_GET['uploaded2']);
if ($_GET['uploaded']!='buffer') {
$Where[]=implode(' AND ', num_compare('ROUND(Uploaded/1024/1024/1024)', $_GET['uploaded'], $Upload1, $Upload2));
if ($_GET['uploaded'] != 'buffer') {
$Where[] = implode(' AND ', num_compare('ROUND(Uploaded/1024/1024/1024)', $_GET['uploaded'], $Upload1, $Upload2));
} else {
$Where[]=implode(' AND ', num_compare('ROUND((Uploaded/1024/1024/1024)-(Downloaded/1024/1024/1023))', 'between', $Upload1*0.9, $Upload1*1.1));
$Where[] = implode(' AND ', num_compare('ROUND((Uploaded/1024/1024/1024)-(Downloaded/1024/1024/1023))', 'between', $Upload1 * 0.9, $Upload1 * 1.1));
}
}
@ -361,7 +364,6 @@ function num_compare($Field, $Operand, $Num1, $Num2 = '') {
$Where[]='um1.PermissionID='.wrap($_GET['class'], '=');
}
if ($_GET['secclass'] != '') {
$Join['ul']=' JOIN users_levels AS ul ON um1.ID=ul.UserID ';
$Where[]='ul.PermissionID='.wrap($_GET['secclass'], '=');

View File

@ -2,7 +2,8 @@
// 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)
$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'");
@ -20,16 +21,19 @@
$DB->query("SELECT COUNT(ID) FROM collages WHERE Deleted='0' AND UserID='$UserID'");
list($NumCollages) = $DB->next_record();
$DB->query("SELECT COUNT(DISTINCT CollageID)
$DB->query("
SELECT COUNT(DISTINCT CollageID)
FROM collages_torrents AS ct
JOIN collages ON CollageID = ID
WHERE Deleted='0' AND ct.UserID='$UserID'");
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)
$DB->query("
SELECT COUNT(ID)
FROM torrents
WHERE ((LogScore = 100 AND Format = 'FLAC')
OR (Media = 'Vinyl' AND Format = 'FLAC')
@ -48,33 +52,33 @@
<ul class="stats nobullet">
<li>Forum posts: <?=number_format($ForumPosts)?> <a href="userhistory.php?action=posts&amp;userid=<?=$UserID?>" class="brackets" title="View">View</a></li>
<? if (($Override = check_paranoia_here('torrentcomments+'))) { ?>
<li<?= $Override===2 ? ' class="paranoia_override"' : ''?>>Torrent comments: <?=number_format($NumComments)?>
<li<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Torrent comments: <?=number_format($NumComments)?>
<? if ($Override = check_paranoia_here('torrentcomments')) { ?>
<a href="comments.php?id=<?=$UserID?>" class="brackets<?= $Override===2 ? ' paranoia_override' : '' ?>" title="View">View</a>
<a href="comments.php?id=<?=$UserID?>" class="brackets<?=($Override === 2 ? ' paranoia_override' : '')?>" title="View">View</a>
<? } ?>
</li>
<li<?= $Override===2 ? ' class="paranoia_override"' : ''?>>Artist comments: <?=number_format($NumArtistComments)?>
<li<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Artist comments: <?=number_format($NumArtistComments)?>
<? if ($Override = check_paranoia_here('torrentcomments')) { ?>
<a href="comments.php?id=<?=$UserID?>&amp;action=artists" class="brackets<?= $Override===2 ? ' paranoia_override' : '' ?>" title="View">View</a>
<a href="comments.php?id=<?=$UserID?>&amp;action=artists" class="brackets<?=($Override === 2 ? ' paranoia_override' : '')?>" title="View">View</a>
<? } ?>
</li>
<li<?= $Override===2 ? ' class="paranoia_override"' : ''?>>Request comments: <?=number_format($NumRequestComments)?>
<li<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Request comments: <?=number_format($NumRequestComments)?>
<? if ($Override = check_paranoia_here('torrentcomments')) { ?>
<a href="comments.php?id=<?=$UserID?>&amp;action=requests" class="brackets<?= $Override===2 ? ' paranoia_override' : '' ?>" title="View">View</a>
<a href="comments.php?id=<?=$UserID?>&amp;action=requests" class="brackets<?=($Override === 2 ? ' paranoia_override' : '')?>" title="View">View</a>
<? } ?>
</li>
<? }
if (($Override = check_paranoia_here('collages+'))) { ?>
<li<?= $Override===2 ? ' class="paranoia_override"' : ''?>>Collages started: <?=number_format($NumCollages)?>
<li<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Collages started: <?=number_format($NumCollages)?>
<? if (($Override = check_paranoia_here('collages'))) { ?>
<a href="collages.php?userid=<?=$UserID?>" class="brackets<?= ($Override===2) ? ' paranoia_override' : '' ?>" title="View">View</a>
<a href="collages.php?userid=<?=$UserID?>" class="brackets<?=(($Override === 2) ? ' paranoia_override' : '')?>" title="View">View</a>
<? } ?>
</li>
<? }
if (($Override = check_paranoia_here('collagecontribs+'))) { ?>
<li<?= $Override===2 ? ' class="paranoia_override"' : ''?>>Collages contributed to: <? echo number_format($NumCollageContribs); ?>
<li<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Collages contributed to: <? echo number_format($NumCollageContribs); ?>
<? if (($Override = check_paranoia_here('collagecontribs'))) { ?>
<a href="collages.php?userid=<?=$UserID?>&amp;contrib=1" class="brackets<?= ($Override===2) ? ' paranoia_override' : '' ?>" title="View">View</a>
<a href="collages.php?userid=<?=$UserID?>&amp;contrib=1" class="brackets<?=(($Override === 2) ? ' paranoia_override' : '')?>" title="View">View</a>
<? } ?>
</li>
<? }
@ -92,9 +96,9 @@
<li>Requests filled: <?=number_format($RequestsFilled)?> for <?=Format::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 <?=Format::get_size($TotalBounty) ?></span>
<a href="requests.php?type=filled&amp;userid=<?=$UserID?>" class="brackets<?= ($ViewAll === 2) ? ' paranoia_override' : '' ?>" title="View">View</a>
<span<?=(($ViewCount === 2) ? ' class="paranoia_override"' : '')?>>Requests filled: <?=number_format($RequestsFilled)?></span>
<span<?=(($ViewBounty === 2) ? ' class="paranoia_override"' : '')?>> for <?=Format::get_size($TotalBounty) ?></span>
<a href="requests.php?type=filled&amp;userid=<?=$UserID?>" class="brackets<?=(($ViewAll === 2) ? ' paranoia_override' : '')?>" title="View">View</a>
</li>
<? }
@ -114,57 +118,59 @@
<li>Requests voted: <?=number_format($RequestsVoted)?> for <?=Format::get_size($TotalSpent)?></li>
<? } elseif ($ViewAll) { ?>
<li>
<span<?= ($ViewCount === 2) ? ' class="paranoia_override"' : ''?>>Requests created: <?=number_format($RequestsCreated)?></span>
<span<?= ($ViewBounty === 2) ? ' class="paranoia_override"' : ''?>> for <?=Format::get_size($RequestsCreatedSpent)?></span>
<a href="requests.php?type=created&amp;userid=<?=$UserID?>" class="brackets<?= ($ViewAll === 2) ? ' paranoia_override' : '' ?>" title="View">View</a>
<span<?=(($ViewCount === 2) ? ' class="paranoia_override"' : '')?>>Requests created: <?=number_format($RequestsCreated)?></span>
<span<?=(($ViewBounty === 2) ? ' class="paranoia_override"' : '')?>> for <?=Format::get_size($RequestsCreatedSpent)?></span>
<a href="requests.php?type=created&amp;userid=<?=$UserID?>" class="brackets<?=(($ViewAll === 2) ? ' paranoia_override' : '')?>" title="View">View</a>
</li>
<li>
<span<?= ($ViewCount === 2) ? ' class="paranoia_override"' : ''?>>Requests voted: <?=number_format($RequestsVoted)?></span>
<span<?= ($ViewBounty === 2) ? ' class="paranoia_override"' : ''?>> for <?=Format::get_size($TotalSpent)?></span>
<a href="requests.php?type=voted&amp;userid=<?=$UserID?>" class="brackets<?= ($ViewAll === 2) ? ' paranoia_override' : '' ?>" title="View">View</a>
<span<?=(($ViewCount === 2) ? ' class="paranoia_override"' : '')?>>Requests voted: <?=number_format($RequestsVoted)?></span>
<span<?=(($ViewBounty === 2) ? ' class="paranoia_override"' : '')?>> for <?=Format::get_size($TotalSpent)?></span>
<a href="requests.php?type=voted&amp;userid=<?=$UserID?>" class="brackets<?=(($ViewAll === 2) ? ' paranoia_override' : '')?>" title="View">View</a>
</li>
<? }
if (($Override = check_paranoia_here('uploads+'))) { ?>
<li<?= $Override === 2 ? ' class="paranoia_override"' : ''?>>Uploaded: <?=number_format($Uploads)?>
<li<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Uploaded: <?=number_format($Uploads)?>
<? if (($Override = check_paranoia_here('uploads'))) { ?>
<a href="torrents.php?type=uploaded&amp;userid=<?=$UserID?>" class="brackets<?= $Override === 2 ? ' paranoia_override' : '' ?>" title="View">View</a>
<a href="torrents.php?type=uploaded&amp;userid=<?=$UserID?>" class="brackets<?=($Override === 2 ? ' paranoia_override' : '')?>" 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 torrents before redownloading.');" class="brackets<?= $Override === 2 ? ' paranoia_override' : '' ?>" title="Download">Download</a>
<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 torrents before redownloading.');" class="brackets<?=($Override === 2 ? ' paranoia_override' : '')?>" title="Download">Download</a>
<? }
}
?>
</li>
<? }
if (($Override = check_paranoia_here('uniquegroups+'))) { ?>
<li<?= $Override === 2 ? ' class="paranoia_override"' : ''?>>Unique groups: <? echo number_format($UniqueGroups); ?>
<li<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Unique groups: <? echo number_format($UniqueGroups); ?>
<? if (($Override = check_paranoia_here('uniquegroups'))) { ?>
<a href="torrents.php?type=uploaded&amp;userid=<?=$UserID?>&amp;filter=uniquegroup" class="brackets<?= $Override === 2 ? ' paranoia_override' : '' ?>" title="View">View</a>
<a href="torrents.php?type=uploaded&amp;userid=<?=$UserID?>&amp;filter=uniquegroup" class="brackets<?=($Override === 2 ? ' paranoia_override' : '')?>" title="View">View</a>
<? } ?>
</li>
<? }
if (($Override = check_paranoia_here('perfectflacs+'))) { ?>
<li<?= $Override === 2 ? ' class="paranoia_override"' : ''?>>"Perfect" FLACs: <? echo number_format($PerfectFLACs); ?>
<li<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>"Perfect" FLACs: <? echo number_format($PerfectFLACs); ?>
<? if (($Override = check_paranoia_here('perfectflacs'))) { ?>
<a href="torrents.php?type=uploaded&amp;userid=<?=$UserID?>&amp;filter=perfectflac" class="brackets<?= $Override === 2 ? ' paranoia_override' : '' ?>" title="View">View</a>
<a href="torrents.php?type=uploaded&amp;userid=<?=$UserID?>&amp;filter=perfectflac" class="brackets<?=($Override === 2 ? ' paranoia_override' : '')?>" title="View">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)
$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
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;
$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)?>
<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?>" class="brackets<?= $AOverride === 2 ? ' paranoia_override' :'' ?>" title="View">View</a>
? '<span'.($Override === 2 ? ' class="paranoia_override"' : '').'> (' . 100 * min(1, round($Seeding / $UniqueSnatched, 2)).'%)</span>' : ''); ?>
<a href="torrents.php?type=seeding&amp;userid=<?=$UserID?>" class="brackets<?=($AOverride === 2 ? ' 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 torrents before redownloading.');" class="brackets" title="Download">Download</a>
<? }
@ -173,35 +179,36 @@
</li>
<? }
if (($Override = check_paranoia_here('leeching+'))) { ?>
<li<?= $Override === 2 ? ' class="paranoia_override"' : ''?>>Leeching: <? echo number_format($Leeching); ?>
<li<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Leeching: <? echo number_format($Leeching); ?>
<? if (($Override = check_paranoia_here('leeching'))) { ?>
<a href="torrents.php?type=leeching&amp;userid=<?=$UserID?>" class="brackets<?= $Override === 2 ? ' paranoia_override' : '' ?>" title="View">View</a>
<a href="torrents.php?type=leeching&amp;userid=<?=$UserID?>" class="brackets<?=($Override === 2 ? ' paranoia_override' : '')?>" 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)?>
<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) ?>)
(<?=($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?>" class="brackets<?= $Override === 2 ? ' paranoia_override' : '' ?>" title="View">View</a>
<a href="torrents.php?type=snatched&amp;userid=<?=$UserID?>" class="brackets<?=($Override === 2 ? ' 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 torrents before redownloading.');" class="brackets" title="Download">Download</a>
<? } ?>
</li>
<? }
if (($Override = check_perms('site_view_torrent_snatchlist', $Class))) {
$DB->query("SELECT COUNT(ud.UserID), COUNT(DISTINCT ud.TorrentID)
$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)?>)
<li<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Downloaded: <?=number_format($NumDownloads)?> (<?=number_format($UniqueDownloads)?>)
<a href="torrents.php?type=downloaded&amp;userid=<?=$UserID?>" class="brackets" title="View">View</a>
</li>
<? }

View File

@ -7,7 +7,8 @@
global $Cache;
$DB->query("SELECT
$DB->query("
SELECT
m.Username,
m.Email,
m.IRCKey,
@ -24,7 +25,7 @@
JOIN users_info AS i ON i.UserID = m.ID
LEFT JOIN permissions AS p ON p.ID=m.PermissionID
WHERE m.ID = '".db_string($UserID)."'");
list($Username,$Email,$IRCKey,$Paranoia,$Info,$Avatar,$Country,$StyleID,$StyleURL,$SiteOptions,$UnseededAlerts,$Class)=$DB->next_record(MYSQLI_NUM, array(3,9));
list($Username, $Email, $IRCKey, $Paranoia, $Info, $Avatar, $Country, $StyleID, $StyleURL, $SiteOptions, $UnseededAlerts, $Class) = $DB->next_record(MYSQLI_NUM, array(3, 9));
if ($UserID != $LoggedUser['ID'] && !check_perms('users_edit_profiles', $Class)) {
@ -58,7 +59,7 @@ function checked($Checked) {
$SiteOptions = array();
}
View::show_header($Username.' > Settings','user,jquery,jquery-ui,release_sort,password_validate,validate,push_settings,cssgallery');
View::show_header($Username.' > Settings','user,jquery,jquery-ui,release_sort,password_validate,validate,push_settings,cssgallery,preview_paranoia');
@ -99,7 +100,7 @@ function checked($Checked) {
<? foreach ($Stylesheets as $Style) { ?>
<div class="preview_wrapper">
<div class="preview_image" name="<?=$Style['Name']?>" style="background: url('<?=STATIC_SERVER.'thumb_'.$Style['Name'].'.png'?>') no-repeat scroll center top #CCC"></div>
<p class="preview_name"><input type="radio" name="stylesheet_gallery" value="<?= $Style['ID'] ?>" /> <?= $Style["ProperName"] ?></p>
<p class="preview_name"><input type="radio" name="stylesheet_gallery" value="<?=($Style['ID'])?>" /> <?=($Style['ProperName'])?></p>
</div>
<? } ?>
</div>
@ -267,7 +268,7 @@ function checked($Checked) {
</select>
</td>
</tr>
<!-- -->
<!---->
<tr>
<td class="label"><strong>Auto-save text</strong></td>
<td>
@ -469,6 +470,10 @@ function checked($Checked) {
<br /><label><input type="checkbox" name="p_artistsadded" <?=checked(!in_array('artistsadded', $Paranoia))?>/> Number of artists added</label>
</td>
</tr>
<tr>
<td></td>
<td><a href="#" id="preview_paranoia" class="brackets">Preview paranoia</a><noscript> (Requires Javascript)</noscript></td>
</tr>
<tr class="colhead_dark">
<td colspan="2">
<strong>Reset passkey</strong>

View File

@ -38,9 +38,7 @@
case 'search':// User search
if (check_perms('admin_advanced_user_search') && check_perms('users_view_ips') && check_perms('users_view_email')) {
include('advancedsearch.php');
}
else {
} else {
include('search.php');
}
break;
@ -96,7 +94,7 @@
include(SERVER_ROOT.'/sections/user/user.php');
break;
//Provide public methods for Last.fm data gets.
// Provide public methods for Last.fm data gets.
case 'lastfm_compare':
if (isset($_GET['username'])) {
echo LastFM::compare_user_with($_GET['username']);

View File

@ -10,9 +10,9 @@
<div class="head colhead_dark">Last.fm</div>
<ul class="stats nobullet">
<li>
Username: <a id="lastfm_username" href="<?= $LastFMInfo['user']['url'] ?>" target="_blank" title="<?= $LastFMInfo['user']['name'] ?> on Last.fm: <?= number_format($LastFMInfo['user']['playcount']) ?> plays, <?= number_format($LastFMInfo['user']['playlists']) ?> playlists."><?= $LastFMInfo['user']['name'] ?></a>
Username: <a id="lastfm_username" href="<?=($LastFMInfo['user']['url'])?>" target="_blank" title="<?=($LastFMInfo['user']['name'])?> on Last.fm: <?=(number_format($LastFMInfo['user']['playcount']))?> plays, <?=(number_format($LastFMInfo['user']['playlists']))?> playlists."><?=($LastFMInfo['user']['name'])?></a>
</li>
<div id="lastfm_stats"<? if ($OwnProfile == true): ?> data-uid="<?= $OwnProfile ?>"<? endif; ?>>
<div id="lastfm_stats"<? if ($OwnProfile == true): ?> data-uid="<?=($OwnProfile)?>"<? endif; ?>>
</div>
<li>
<a href="#" id="lastfm_expand" onclick="return false" class="brackets">Show more info</a>

View File

@ -271,7 +271,10 @@
$SQL="UPDATE users_main AS m JOIN users_info AS i ON m.ID=i.UserID SET
$SQL = "
UPDATE users_main AS m
JOIN users_info AS i ON m.ID=i.UserID
SET
i.StyleID='".db_string($_POST['stylesheet'])."',
i.StyleURL='".db_string($_POST['styleurl'])."',
i.Avatar='".db_string($_POST['avatar'])."',
@ -289,24 +292,25 @@
$ChangerIP = db_string($LoggedUser['IP']);
$PassHash=Users::make_crypt_hash($_POST['new_pass_1']);
$SQL.=",m.PassHash='".db_string($PassHash)."'";
$DB->query("INSERT INTO users_history_passwords
(UserID, ChangerIP, ChangeTime) VALUES
$DB->query("
INSERT INTO users_history_passwords
(UserID, ChangerIP, ChangeTime)
VALUES
('$UserID', '$ChangerIP', '".sqltime()."')");
}
if (isset($_POST['resetpasskey'])) {
$UserInfo = Users::user_heavy_info($UserID);
$OldPassKey = db_string($UserInfo['torrent_pass']);
$NewPassKey = db_string(Users::make_secret());
$ChangerIP = db_string($LoggedUser['IP']);
$SQL.=",m.torrent_pass='$NewPassKey'";
$DB->query("INSERT INTO users_history_passkeys
(UserID, OldPassKey, NewPassKey, ChangerIP, ChangeTime) VALUES
$DB->query("
INSERT INTO users_history_passkeys
(UserID, OldPassKey, NewPassKey, ChangerIP, ChangeTime)
VALUES
('$UserID', '$OldPassKey', '$NewPassKey', '$ChangerIP', '".sqltime()."')");
$Cache->begin_transaction('user_info_heavy_'.$UserID);
$Cache->update_row(false, array('torrent_pass'=>$NewPassKey));

View File

@ -718,11 +718,11 @@
$SET = implode(', ', $UpdateSet);
$sql = "UPDATE users_main AS m JOIN users_info AS i ON m.ID=i.UserID SET $SET WHERE m.ID='$UserID'";
$SQL = "UPDATE users_main AS m JOIN users_info AS i ON m.ID=i.UserID SET $SET WHERE m.ID='$UserID'";
// Perform update
//die($sql);
$DB->query($sql);
//die($SQL);
$DB->query($SQL);
if (isset($ClearStaffIDCache)) {
$Cache->delete_value('staff_ids');
@ -731,8 +731,8 @@
// redirect to user page
header("location: user.php?id=$UserID");
function translateUserStatus($status) {
switch ($status) {
function translateUserStatus($Status) {
switch ($Status) {
case 0:
return 'Unconfirmed';
case 1:
@ -740,18 +740,18 @@ function translateUserStatus($status) {
case 2:
return 'Disabled';
default:
return $status;
return $Status;
}
}
function translateLeechStatus($status) {
switch ($status) {
function translateLeechStatus($Status) {
switch ($Status) {
case 0:
return 'Disabled';
case 1:
return 'Enabled';
default:
return $status;
return $Status;
}
}
?>

View File

@ -3,20 +3,31 @@
include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
$Text = new TEXT;
if (empty($_GET['id']) || !is_numeric($_GET['id']))
error(404);
include(SERVER_ROOT.'/sections/requests/functions.php');
if (empty($_GET['id']) || !is_numeric($_GET['id']) || (!empty($_GET['preview']) && !is_numeric($_GET['preview']))) {
error(404);
}
$UserID = $_GET['id'];
$Preview = $_GET['preview'];
if ($UserID == $LoggedUser['ID']) {
$OwnProfile = true;
if ($Preview == 1) {
$OwnProfile = false;
$ParanoiaString = $_GET['paranoia'];
$CustomParanoia = explode(',', $ParanoiaString);
}
} else {
$OwnProfile = false;
//Don't allow any kind of previewing on others' profiles
$Preview = 0;
}
if (check_perms('users_mod')) { // Person viewing is a staff member
$DB->query("SELECT
$DB->query("
SELECT
m.Username,
m.Email,
m.LastAccess,
@ -66,15 +77,17 @@
LEFT JOIN users_main AS inviter ON i.Inviter = inviter.ID
LEFT JOIN permissions AS p ON p.ID=m.PermissionID
LEFT JOIN forums_posts AS posts ON posts.AuthorID = m.ID
WHERE m.ID = '".$UserID."' GROUP BY AuthorID");
WHERE m.ID = '$UserID'
GROUP BY AuthorID");
if ($DB->record_count() == 0) { // If user doesn't exist
header("Location: log.php?search=User+".$UserID);
}
list($Username, $Email, $LastAccess, $IP, $Class, $Uploaded, $Downloaded, $RequiredRatio, $CustomTitle, $torrent_pass, $Enabled, $Paranoia, $Invites, $DisableLeech, $Visible, $JoinDate, $Info, $Avatar, $Country, $AdminComment, $Donor, $Artist, $Warned, $SupportFor, $RestrictedForums, $PermittedForums, $InviterID, $InviterName, $ForumPosts, $RatioWatchEnds, $RatioWatchDownload, $DisableAvatar, $DisableInvites, $DisablePosting, $DisableForums, $DisableTagging, $DisableUpload, $DisableWiki, $DisablePM, $DisableIRC, $DisableRequests, $DisableCountry, $FLTokens, $CommentHash) = $DB->next_record(MYSQLI_NUM, array(8,11));
list($Username, $Email, $LastAccess, $IP, $Class, $Uploaded, $Downloaded, $RequiredRatio, $CustomTitle, $torrent_pass, $Enabled, $Paranoia, $Invites, $DisableLeech, $Visible, $JoinDate, $Info, $Avatar, $Country, $AdminComment, $Donor, $Artist, $Warned, $SupportFor, $RestrictedForums, $PermittedForums, $InviterID, $InviterName, $ForumPosts, $RatioWatchEnds, $RatioWatchDownload, $DisableAvatar, $DisableInvites, $DisablePosting, $DisableForums, $DisableTagging, $DisableUpload, $DisableWiki, $DisablePM, $DisableIRC, $DisableRequests, $DisableCountry, $FLTokens, $CommentHash) = $DB->next_record(MYSQLI_NUM, array(8, 11));
} else { // Person viewing is a normal user
$DB->query("SELECT
$DB->query("
SELECT
m.Username,
m.Email,
m.LastAccess,
@ -105,7 +118,8 @@
LEFT JOIN permissions AS p ON p.ID=m.PermissionID
LEFT JOIN users_main AS inviter ON i.Inviter = inviter.ID
LEFT JOIN forums_posts AS posts ON posts.AuthorID = m.ID
WHERE m.ID = $UserID GROUP BY AuthorID");
WHERE m.ID = $UserID
GROUP BY AuthorID");
if ($DB->record_count() == 0) { // If user doesn't exist
header("Location: log.php?search=User+".$UserID);
@ -117,14 +131,23 @@
// Image proxy CTs
$DisplayCustomTitle = $CustomTitle;
if (check_perms('site_proxy_images') && !empty($CustomTitle)) {
$DisplayCustomTitle = preg_replace_callback('~src=("?)(http.+?)(["\s>])~', function($Matches) {
$DisplayCustomTitle = preg_replace_callback('~src=("?)(http.+?)(["\s>])~',
function($Matches) {
return 'src=' . $Matches[1] . ImageTools::process($Matches[2]) . $Matches[3];
}, $CustomTitle);
}
$Paranoia = unserialize($Paranoia);
if (!is_array($Paranoia)) {
if ($Preview == 1) {
if (strlen($ParanoiaString) == 0) {
$Paranoia = array();
} else {
$Paranoia = $CustomParanoia;
}
} else {
$Paranoia = unserialize($Paranoia);
if (!is_array($Paranoia)) {
$Paranoia = array();
}
}
$ParanoiaLevel = 0;
foreach ($Paranoia as $P) {
@ -138,17 +161,21 @@
$LastAccess = time_diff($LastAccess);
function check_paranoia_here($Setting) {
global $Paranoia, $Class, $UserID;
global $Paranoia, $Class, $UserID, $Preview;
if ($Preview == 1) {
return check_paranoia($Setting, $Paranoia, $Class);
} else {
return check_paranoia($Setting, $Paranoia, $Class, $UserID);
}
}
$Badges=($Donor) ? '<a href="donate.php"><img src="'.STATIC_SERVER.'common/symbols/donor.png" alt="Donor" /></a>' : '';
$Badges = (($Donor) ? '<a href="donate.php"><img src="'.STATIC_SERVER.'common/symbols/donor.png" alt="Donor" /></a>' : '');
$Badges.=($Warned!='0000-00-00 00:00:00') ? '<img src="'.STATIC_SERVER.'common/symbols/warned.png" alt="Warned" />' : '';
$Badges.=($Enabled == '1' || $Enabled == '0' || !$Enabled) ? '': '<img src="'.STATIC_SERVER.'common/symbols/disabled.png" alt="Banned" />';
$Badges.=(($Warned!='0000-00-00 00:00:00') ? '<img src="'.STATIC_SERVER.'common/symbols/warned.png" alt="Warned" />' : '');
$Badges.=(($Enabled == '1' || $Enabled == '0' || !$Enabled) ? '' : '<img src="'.STATIC_SERVER.'common/symbols/disabled.png" alt="Banned" />');
View::show_header($Username,'user,bbcode,requests,jquery,lastfm');
View::show_header($Username, 'user,bbcode,requests,jquery,lastfm');
?>
<div class="thin">
@ -214,7 +241,7 @@ function check_paranoia_here($Setting) {
?>
<div class="box box_image box_image_avatar">
<div class="head colhead_dark">Avatar</div>
<div align="center"><img src="<?=display_str($Avatar)?>" width="150" style="max-height:400px;" alt="<?=$Username?>'s avatar" /></div>
<div align="center"><img src="<?=display_str($Avatar)?>" width="150" style="max-height: 400px;" alt="<?=$Username?>'s avatar" /></div>
</div>
<? } ?>
<div class="box box_info box_userinfo_stats">
@ -222,50 +249,58 @@ function check_paranoia_here($Setting) {
<ul class="stats nobullet">
<li>Joined: <?=$JoinedDate?></li>
<? if (($Override = check_paranoia_here('lastseen'))) { ?>
<li<?= $Override === 2 ? ' class="paranoia_override"' : ''?>>Last seen: <?=$LastAccess?></li>
<li<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Last seen: <?=$LastAccess?></li>
<? }
if (($Override=check_paranoia_here('uploaded'))) { ?>
<li<?= $Override === 2 ? ' class="paranoia_override"' : ''?> title="<?=Format::get_size($Uploaded, 5)?>">Uploaded: <?=Format::get_size($Uploaded)?></li>
<li<?=($Override === 2 ? ' class="paranoia_override"' : '')?> title="<?=Format::get_size($Uploaded, 5)?>">Uploaded: <?=Format::get_size($Uploaded)?></li>
<? }
if (($Override=check_paranoia_here('downloaded'))) { ?>
<li<?= $Override === 2 ? ' class="paranoia_override"' : ''?> title="<?=Format::get_size($Downloaded, 5)?>">Downloaded: <?=Format::get_size($Downloaded)?></li>
<li<?=($Override === 2 ? ' class="paranoia_override"' : '')?> title="<?=Format::get_size($Downloaded, 5)?>">Downloaded: <?=Format::get_size($Downloaded)?></li>
<? }
if (($Override=check_paranoia_here('ratio'))) { ?>
<li<?= $Override === 2 ? ' class="paranoia_override"' : ''?>>Ratio: <?=Format::get_ratio_html($Uploaded, $Downloaded)?></li>
<li<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Ratio: <?=Format::get_ratio_html($Uploaded, $Downloaded)?></li>
<? }
if (($Override=check_paranoia_here('requiredratio')) && isset($RequiredRatio)) { ?>
<li<?= $Override === 2 ? ' class="paranoia_override"' : ''?>>Required ratio: <?=number_format((double)$RequiredRatio, 2)?></li>
<li<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Required ratio: <?=number_format((double)$RequiredRatio, 2)?></li>
<? }
if ($OwnProfile || ($Override=check_paranoia_here(false)) || check_perms('users_mod')) { ?>
<li<?= $Override === 2 ? ' class="paranoia_override"' : ''?>><a href="userhistory.php?action=token_history&amp;userid=<?=$UserID?>">Tokens</a>: <?=number_format($FLTokens)?></li>
<li<?=($Override === 2 ? ' class="paranoia_override"' : '')?>><a href="userhistory.php?action=token_history&amp;userid=<?=$UserID?>">Tokens</a>: <?=number_format($FLTokens)?></li>
<? }
if (($OwnProfile || check_perms('users_mod')) && $Warned!='0000-00-00 00:00:00') { ?>
<li<?= $Override === 2 ? ' class="paranoia_override"' : ''?>>Warning expires: <?= date('Y-m-d H:i', strtotime($Warned)) ?></li>
<li<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Warning expires: <?=(date('Y-m-d H:i', strtotime($Warned)))?></li>
<? } ?>
</ul>
</div>
<?
//Last.fm statistics and comparability
// Last.fm statistics and comparability
include(SERVER_ROOT.'/sections/user/lastfm.php');
if (check_paranoia_here('requestsfilled_count') || check_paranoia_here('requestsfilled_bounty')) {
$DB->query("SELECT
$DB->query("
SELECT
COUNT(DISTINCT r.ID),
SUM(rv.Bounty)
FROM requests AS r
LEFT JOIN requests_votes AS rv ON r.ID=rv.RequestID
WHERE r.FillerID = ".$UserID);
WHERE r.FillerID = $UserID");
list($RequestsFilled, $TotalBounty) = $DB->next_record();
} else {
$RequestsFilled = $TotalBounty = 0;
}
if (check_paranoia_here('requestsvoted_count') || check_paranoia_here('requestsvoted_bounty')) {
$DB->query("SELECT COUNT(rv.RequestID), SUM(rv.Bounty) FROM requests_votes AS rv WHERE rv.UserID = ".$UserID);
$DB->query("
SELECT COUNT(rv.RequestID), SUM(rv.Bounty)
FROM requests_votes AS rv
WHERE rv.UserID = $UserID");
list($RequestsVoted, $TotalSpent) = $DB->next_record();
$DB->query('SELECT COUNT(r.ID), SUM(rv.Bounty) FROM requests AS r LEFT JOIN requests_votes AS rv ON rv.RequestID = r.ID AND rv.UserID = r.UserID WHERE r.UserID = ' . $UserID);
$DB->query("
SELECT COUNT(r.ID), SUM(rv.Bounty)
FROM requests AS r
LEFT JOIN requests_votes AS rv ON rv.RequestID = r.ID AND rv.UserID = r.UserID
WHERE r.UserID = $UserID");
list($RequestsCreated, $RequestsCreatedSpent) = $DB->next_record();
} else {
$RequestsVoted = $TotalSpent = $RequestsCreated = $RequestsCreatedSpent = 0;
@ -301,7 +336,7 @@ function check_paranoia_here($Setting) {
} elseif ($Uploaded == 0) {
$Ratio = 0.5;
} else {
$Ratio = round($Uploaded/$Downloaded, 2);
$Ratio = round($Uploaded / $Downloaded, 2);
}
$OverallRank = $Rank->overall_score($UploadedRank, $DownloadedRank, $UploadsRank, $RequestRank, $PostRank, $BountyRank, $ArtistsRank, $Ratio);
@ -310,23 +345,23 @@ function check_paranoia_here($Setting) {
<div class="head colhead_dark">Percentile rankings (hover for values)</div>
<ul class="stats nobullet">
<? if (($Override=check_paranoia_here('uploaded'))) { ?>
<li<?= $Override===2 ? ' class="paranoia_override"' : ''?> title="<?=Format::get_size($Uploaded)?>">Data uploaded: <?=$UploadedRank === false ? 'Server busy' : number_format($UploadedRank)?></li>
<li<?=($Override === 2 ? ' class="paranoia_override"' : '')?> title="<?=Format::get_size($Uploaded)?>">Data uploaded: <?=$UploadedRank === false ? 'Server busy' : number_format($UploadedRank)?></li>
<? } ?>
<? if (($Override=check_paranoia_here('downloaded'))) { ?>
<li<?= $Override===2 ? ' class="paranoia_override"' : ''?> title="<?=Format::get_size($Downloaded)?>">Data downloaded: <?=$DownloadedRank === false ? 'Server busy' : number_format($DownloadedRank)?></li>
<li<?=($Override === 2 ? ' class="paranoia_override"' : '')?> title="<?=Format::get_size($Downloaded)?>">Data downloaded: <?=$DownloadedRank === false ? 'Server busy' : number_format($DownloadedRank)?></li>
<? } ?>
<? if (($Override=check_paranoia_here('uploads+'))) { ?>
<li<?= $Override===2 ? ' class="paranoia_override"' : ''?> title="<?=number_format($Uploads)?>">Torrents uploaded: <?=$UploadsRank === false ? 'Server busy' : number_format($UploadsRank)?></li>
<li<?=($Override === 2 ? ' class="paranoia_override"' : '')?> title="<?=number_format($Uploads)?>">Torrents uploaded: <?=$UploadsRank === false ? 'Server busy' : number_format($UploadsRank)?></li>
<? } ?>
<? if (($Override=check_paranoia_here('requestsfilled_count'))) { ?>
<li<?= $Override===2 ? ' class="paranoia_override"' : ''?> title="<?=number_format($RequestsFilled)?>">Requests filled: <?=$RequestRank === false ? 'Server busy' : number_format($RequestRank)?></li>
<li<?=($Override === 2 ? ' class="paranoia_override"' : '')?> title="<?=number_format($RequestsFilled)?>">Requests filled: <?=$RequestRank === false ? 'Server busy' : number_format($RequestRank)?></li>
<? } ?>
<? if (($Override=check_paranoia_here('requestsvoted_bounty'))) { ?>
<li<?= $Override===2 ? ' class="paranoia_override"' : ''?> title="<?=Format::get_size($TotalSpent)?>">Bounty spent: <?=$BountyRank === false ? 'Server busy' : number_format($BountyRank)?></li>
<li<?=($Override === 2 ? ' class="paranoia_override"' : '')?> title="<?=Format::get_size($TotalSpent)?>">Bounty spent: <?=$BountyRank === false ? 'Server busy' : number_format($BountyRank)?></li>
<? } ?>
<li title="<?=number_format($ForumPosts)?>">Posts made: <?=$PostRank === false ? 'Server busy' : number_format($PostRank)?></li>
<? if (($Override=check_paranoia_here('artistsadded'))) { ?>
<li<?= $Override===2 ? ' class="paranoia_override"' : ''?> title="<?=number_format($ArtistsAdded)?>">Artists added: <?=$ArtistsRank === false ? 'Server busy' : number_format($ArtistsRank)?></li>
<li<?=($Override === 2 ? ' class="paranoia_override"' : '')?> title="<?=number_format($ArtistsAdded)?>">Artists added: <?=$ArtistsRank === false ? 'Server busy' : number_format($ArtistsRank)?></li>
<? } ?>
<? if (check_paranoia_here(array('uploaded', 'downloaded', 'uploads+', 'requestsfilled_count', 'requestsvoted_bounty', 'artistsadded'))) { ?>
<li><strong>Overall rank: <?=$OverallRank === false ? 'Server busy' : number_format($OverallRank)?></strong></li>
@ -362,12 +397,12 @@ function check_paranoia_here($Setting) {
if (check_perms('users_view_ips',$Class)) {
?>
<li>IPs: <?=number_format($IPChanges)?> <a href="userhistory.php?action=ips&amp;userid=<?=$UserID?>" class="brackets">View</a>&nbsp;<a href="userhistory.php?action=ips&amp;userid=<?=$UserID?>&amp;usersonly=1" class="brackets">View users</a></li>
<? if (check_perms('users_view_ips',$Class) && check_perms('users_mod',$Class)) { ?>
<? if (check_perms('users_view_ips', $Class) && check_perms('users_mod', $Class)) { ?>
<li>Tracker IPs: <?=number_format($TrackerIPs)?> <a href="userhistory.php?action=tracker_ips&amp;userid=<?=$UserID?>" class="brackets">View</a></li>
<? } ?>
<?
}
if (check_perms('users_view_keys',$Class)) {
if (check_perms('users_view_keys', $Class)) {
?>
<li>Passkeys: <?=number_format($PasskeyChanges)?> <a href="userhistory.php?action=passkeys&amp;userid=<?=$UserID?>" class="brackets">View</a></li>
<?
@ -416,7 +451,7 @@ function check_paranoia_here($Setting) {
}
?>
<li>Paranoia level: <span title="<?=$ParanoiaLevel?>"><?=$ParanoiaLevelText?></span></li>
<? if (check_perms('users_view_email',$Class) || $OwnProfile) { ?>
<? if (check_perms('users_view_email', $Class) || $OwnProfile) { ?>
<li>Email: <a href="mailto:<?=display_str($Email)?>"><?=display_str($Email)?></a>
<? if (check_perms('users_view_email',$Class)) { ?>
<a href="user.php?action=search&amp;email_history=on&amp;email=<?=display_str($Email)?>" title="Search" class="brackets">S</a>
@ -452,7 +487,7 @@ function check_paranoia_here($Setting) {
} else {
echo number_format($Invites);
}
echo " (".$Pending.")"
echo " ($Pending)"
?></li>
<?
}
@ -461,12 +496,12 @@ function check_paranoia_here($Setting) {
$DB->query("SELECT SupportFor FROM users_info WHERE UserID = ".$LoggedUser['ID']);
list($SupportFor) = $DB->next_record();
}
if ($Override=check_perms('users_mod') || $OwnProfile || !empty($SupportFor)) {
if ($Override = check_perms('users_mod') || $OwnProfile || !empty($SupportFor)) {
?>
<li <?= $Override===2 || $SupportFor ? 'class="paranoia_override"' : ''?>>Clients: <?
<li <?=($Override === 2 || $SupportFor ? 'class="paranoia_override"' : '')?>>Clients: <?
$DB->query("SELECT DISTINCT useragent FROM xbt_files_users WHERE uid = ".$UserID);
$Clients = $DB->collect(0);
echo implode("; ", $Clients);
echo implode('; ', $Clients);
?></li>
<?
}

View File

@ -117,7 +117,7 @@
<td><?=display_str($IP)?></td>
<? $UserURL = "https://".SSL_SITE_URL."/user.php?id=$UserID2";
$DB->query("SELECT Enabled FROM users_main WHERE ID = ".$UserID2);
list($Enabled)=$DB->next_record();
list($Enabled) = $DB->next_record();
$DB->set_query_id($ueQuery);
?>
<td><a href="<?=display_str($UserURL)?>"><?=Users::format_username($UserID2, false, false, true)?></a></td>

View File

@ -37,7 +37,7 @@
$SearchIPQuery = " AND h1.IP = '$SearchIP' ";
}
View::show_header("IP history for $Username");
View::show_header("IP address history for $Username");
?>
<script type="text/javascript">//<![CDATA[
function ShowIPs(rowname) {
@ -54,7 +54,7 @@ function Ban(ip, id, elemID) {
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById(elemID).innerHTML = "<strong>[Banned]</strong>";
}
}
@ -72,9 +72,9 @@ function UnBan(ip, id, elemID) {
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById(elemID).innerHTML = "Ban";
document.getElementById(elemID).onclick = function() { Ban(ip, id, elemID); return false;};
document.getElementById(elemID).onclick = function() { Ban(ip, id, elemID); return false; };
}
}
xmlhttp.open("GET","tools.php?action=quick_ban&perform=delete&id=" + id + "&ip=" + ip,true);

View File

@ -42,13 +42,13 @@ var autocomp = {
case 38: //up
case 40: //down
this.highlight(key);
if(this.pos !== -1) {
if (this.pos !== -1) {
this.artistid = this.list.children[this.pos].artistid;
this.input.value = this.list.children[this.pos].textContent || this.list.children[this.pos].value;
}
break;
case 13:
if(this.artistid != null) {
if (this.artistid != null) {
window.location = this.id + '.php?id='+this.artistid;
}
return 0;
@ -139,9 +139,9 @@ var autocomp = {
});
listener.set(li,'click',function(e) {
var location = autocomp.id + '.php?id='+this.artistid;
if(e.button == 0) {
if (e.button == 0) {
window.open(location, '_self');
} else if(e.button == 1) {
} else if (e.button == 1) {
var win = window.open(location, '_blank');
win.focus();
}

View File

@ -2,7 +2,7 @@ function Add(input) {
if (input.checked == false) {
Cancel();
} else {
if(document.getElementById("choices").raw().value == "") {
if (document.getElementById("choices").raw().value == "") {
document.getElementById("choices").raw().value += input.name;
} else {
document.getElementById("choices").raw().value += "|" + input.name;

View File

@ -0,0 +1,44 @@
(function($){
// Used to get user ID from URL.
function getURLParameter(name) {
return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search)||[,""])[1].replace(/\+/g, '%20'))||null;
}
// Attach click event on document ready.
$(function(){
$('a#preview_paranoia').click(function(event) {
event.preventDefault();
var paranoia = {};
// Build an object of unchecked (hidden, not allowed for others to see) paranoias.
// We "abuse" object keys to implement sets in JavaScript. This is simpler and
// more memory efficient than building a string and working through that each time.
$('input[name^="p_"]').each(function() {
if (!$(this).prop('checked')) {
var attribute = $(this).attr('name').replace(/^p_/,'');
if (/_c$/.test(attribute)) {
paranoia[attribute.replace(/_.$/,'') + '+'] = 1;
} else if (/_l$/.test(attribute)) {
if (typeof paranoia[attribute.replace(/_.$/,'') + '+'] == "undefined") {
paranoia[attribute.replace(/_.$/,'')] = 1;
}
} else {
paranoia[attribute] = 1;
}
}
});
// Build into a comma-delimited string.
var paranoiaString = "";
for (var key in paranoia) {
if (key === 'length' || !paranoia.hasOwnProperty(key)) {
continue;
}
paranoiaString += key+',';
}
// Get rid of trailing comma.
paranoiaString = paranoiaString.substring(0, paranoiaString.length - 1);
// Get user ID from URL parameter.
var userId = getURLParameter("userid");
// Open a new tab with specified paranoia settings.
window.open('user.php?id=' + encodeURIComponent(userId) + '&preview=1&paranoia=' + encodeURIComponent(paranoiaString), '_blank');
});
});
})(jQuery);

File diff suppressed because it is too large Load Diff