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,32 +30,37 @@ function make_tree() {
if (!$TreeID) { if (!$TreeID) {
return; return;
} }
$DB->query("SELECT $DB->query("
TreePosition FROM invite_tree SELECT TreePosition
WHERE TreeID=$TreeID AND TreeLevel=$TreeLevel AND TreePosition>$TreePosition FROM invite_tree
ORDER BY TreePosition ASC LIMIT 1"); WHERE TreeID=$TreeID
AND TreeLevel=$TreeLevel
AND TreePosition>$TreePosition
ORDER BY TreePosition ASC
LIMIT 1");
if ($DB->record_count()) { if ($DB->record_count()) {
list($MaxPosition) = $DB->next_record(MYSQLI_NUM, false); list($MaxPosition) = $DB->next_record(MYSQLI_NUM, false);
} else { } else {
$MaxPosition = false; $MaxPosition = false;
} }
$TreeQuery = $DB->query("SELECT $TreeQuery = $DB->query("
it.UserID, SELECT
Enabled, it.UserID,
PermissionID, Enabled,
Donor, PermissionID,
Uploaded, Donor,
Downloaded, Uploaded,
Paranoia, Downloaded,
TreePosition, Paranoia,
TreeLevel TreePosition,
TreeLevel
FROM invite_tree AS it FROM invite_tree AS it
JOIN users_main AS um ON um.ID=it.UserID JOIN users_main AS um ON um.ID=it.UserID
JOIN users_info AS ui ON ui.UserID=it.UserID JOIN users_info AS ui ON ui.UserID=it.UserID
WHERE TreeID=$TreeID WHERE TreeID=$TreeID
AND TreePosition>$TreePosition". AND TreePosition>$TreePosition".
($MaxPosition ? " AND TreePosition<$MaxPosition" : '')." ($MaxPosition ? " AND TreePosition<$MaxPosition" : '')."
AND TreeLevel>$TreeLevel AND TreeLevel>$TreeLevel
ORDER BY TreePosition"); ORDER BY TreePosition");
$PreviousTreeLevel = $TreeLevel; $PreviousTreeLevel = $TreeLevel;
@ -108,20 +113,18 @@ function make_tree() {
// Manage tree depth // Manage tree depth
if ($TreeLevel > $PreviousTreeLevel) { if ($TreeLevel > $PreviousTreeLevel) {
for ($i = 0; $i < $TreeLevel - $PreviousTreeLevel; $i++) { for ($i = 0; $i < $TreeLevel - $PreviousTreeLevel; $i++) {
echo '<ul class="invitetree"><li>'; echo "<ul class=\"invitetree\">\n\t<li>";
} }
} elseif ($TreeLevel < $PreviousTreeLevel) { } elseif ($TreeLevel < $PreviousTreeLevel) {
for ($i = 0; $i < $PreviousTreeLevel - $TreeLevel; $i++) { for ($i = 0; $i < $PreviousTreeLevel - $TreeLevel; $i++) {
echo '</li></ul>'; echo "\t</li>\n</ul>";
} }
echo '</li>'; echo "\t</li>\n<li>";
echo '<li>';
} else { } else {
echo '</li>'; echo "\t</li>\n<li>";
echo '<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)) { if (check_paranoia(array('uploaded', 'downloaded'), $Paranoia, $UserClass)) {
$TotalUpload += $Uploaded; $TotalUpload += $Uploaded;
@ -145,13 +148,13 @@ function make_tree() {
$Tree = ob_get_clean(); $Tree = ob_get_clean();
for ($i = 0; $i < $PreviousTreeLevel - $OriginalTreeLevel; $i++) { for ($i = 0; $i < $PreviousTreeLevel - $OriginalTreeLevel; $i++) {
$Tree .= "</li></ul>\n"; $Tree .= "\t</li>\n</ul>\n";
} }
if ($Count) { if ($Count) {
?> <p style="font-weight: bold;"> ?> <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 It has
<? <?
$ClassStrings = array(); $ClassStrings = array();
@ -208,10 +211,10 @@ function make_tree() {
echo 'The total amount uploaded by direct invitees (the top level) was '.Format::get_size($TopLevelUpload); echo 'The total amount uploaded by direct invitees (the top level) was '.Format::get_size($TopLevelUpload);
echo '; the total amount downloaded was '.Format::get_size($TopLevelDownload); echo '; the total amount downloaded was '.Format::get_size($TopLevelDownload);
echo '; and the total ratio is '.Format::get_ratio_html($TopLevelUpload, $TopLevelDownload).'. '; echo '; and the total ratio is '.Format::get_ratio_html($TopLevelUpload, $TopLevelDownload).'. ';
echo 'These numbers include the stats of paranoid users and will be factored into the invitation giving script.</p>'; echo 'These numbers include the stats of paranoid users and will be factored into the invitation giving script.</p>';
if ($ParanoidCount) { if ($ParanoidCount) {
echo '<p style="font-weight: bold;">'; echo '<p style="font-weight: bold;">';
echo $ParanoidCount; echo $ParanoidCount;

View File

@ -72,21 +72,30 @@ public static function send_pm($ToID,$FromID,$Subject,$Body,$ConvID='') {
WHERE UserID IN (".implode(',', $ToID).") WHERE UserID IN (".implode(',', $ToID).")
AND ConvID='$ConvID'"); AND ConvID='$ConvID'");
$DB->query("UPDATE pm_conversations_users SET $DB->query("
UPDATE pm_conversations_users
SET
InSentbox='1', InSentbox='1',
SentDate='".sqltime()."' SentDate='".sqltime()."'
WHERE UserID='$FromID' WHERE UserID='$FromID'
AND ConvID='$ConvID'"); AND ConvID='$ConvID'");
} }
// Now that we have a $ConvID for sure, send the message. // Now that we have a $ConvID for sure, send the message.
$DB->query("INSERT INTO pm_messages $DB->query("
(SenderID, ConvID, SentDate, Body) VALUES INSERT INTO pm_messages
('$FromID', '$ConvID', '".sqltime()."', '".$Body."')"); (SenderID, ConvID, SentDate, Body)
VALUES
('$FromID', '$ConvID', '".sqltime()."', '$Body')");
// Update the cached new message count. // Update the cached new message count.
foreach ($ToID as $ID) { 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(); list($UnRead) = $DB->next_record();
$Cache->cache_value('inbox_new_'.$ID, $UnRead); $Cache->cache_value('inbox_new_'.$ID, $UnRead);
} }
@ -94,15 +103,20 @@ public static function send_pm($ToID,$FromID,$Subject,$Body,$ConvID='') {
$DB->query("SELECT Username FROM users_main WHERE ID = '$FromID'"); $DB->query("SELECT Username FROM users_main WHERE ID = '$FromID'");
list($SenderName) = $DB->next_record(); list($SenderName) = $DB->next_record();
foreach ($ToID as $ID) { 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(); list($UnRead) = $DB->next_record();
$Cache->cache_value('inbox_new_'.$ID, $UnRead); $Cache->cache_value('inbox_new_'.$ID, $UnRead);
} }
return $ConvID; return $ConvID;
} }
/** /**
* Create thread function, things should already be escaped when sent here. * Create thread function, things should already be escaped when sent here.
@ -129,34 +143,40 @@ public static function create_thread($ForumID, $AuthorID, $Title, $PostBody) {
$ThreadInfo['IsLocked'] = 0; $ThreadInfo['IsLocked'] = 0;
$ThreadInfo['IsSticky'] = 0; $ThreadInfo['IsSticky'] = 0;
$DB->query("INSERT INTO forums_topics $DB->query("
(Title, AuthorID, ForumID, LastPostTime, LastPostAuthorID) INSERT INTO forums_topics
Values (Title, AuthorID, ForumID, LastPostTime, LastPostAuthorID)
('".$Title."', '".$AuthorID."', '$ForumID', '".sqltime()."', '".$AuthorID."')"); VALUES
('$Title', '$AuthorID', '$ForumID', '".sqltime()."', '$AuthorID')");
$TopicID = $DB->inserted_id(); $TopicID = $DB->inserted_id();
$Posts = 1; $Posts = 1;
$DB->query("INSERT INTO forums_posts $DB->query("
INSERT INTO forums_posts
(TopicID, AuthorID, AddedTime, Body) (TopicID, AuthorID, AddedTime, Body)
VALUES VALUES
('$TopicID', '".$AuthorID."', '".sqltime()."', '".$PostBody."')"); ('$TopicID', '$AuthorID', '".sqltime()."', '$PostBody')");
$PostID = $DB->inserted_id(); $PostID = $DB->inserted_id();
$DB->query("UPDATE forums SET $DB->query("
NumPosts = NumPosts+1, UPDATE forums
NumTopics = NumTopics+1, SET
LastPostID = '$PostID', NumPosts = NumPosts+1,
LastPostAuthorID = '".$AuthorID."', NumTopics = NumTopics+1,
LastPostTopicID = '$TopicID', LastPostID = '$PostID',
LastPostTime = '".sqltime()."' LastPostAuthorID = '$AuthorID',
WHERE ID = '$ForumID'"); LastPostTopicID = '$TopicID',
LastPostTime = '".sqltime()."'
WHERE ID = '$ForumID'");
$DB->query("UPDATE forums_topics SET $DB->query("
UPDATE forums_topics
SET
NumPosts = NumPosts+1, NumPosts = NumPosts+1,
LastPostID = '$PostID', LastPostID = '$PostID',
LastPostAuthorID = '".$AuthorID."', LastPostAuthorID = '$AuthorID',
LastPostTime = '".sqltime()."' LastPostTime = '".sqltime()."'
WHERE ID = '$TopicID'"); WHERE ID = '$TopicID'");
// Bump this topic to head of the cache // Bump this topic to head of the cache
list($Forum,,,$Stickies) = $Cache->get_value('forums_'.$ForumID); list($Forum,,,$Stickies) = $Cache->get_value('forums_'.$ForumID);
@ -164,12 +184,14 @@ public static function create_thread($ForumID, $AuthorID, $Title, $PostBody) {
if (count($Forum) == TOPICS_PER_PAGE && $Stickies < TOPICS_PER_PAGE) { if (count($Forum) == TOPICS_PER_PAGE && $Stickies < TOPICS_PER_PAGE) {
array_pop($Forum); 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'"); WHERE f.ID ='$TopicID'");
list($IsLocked,$IsSticky,$NumPosts) = $DB->next_record(); list($IsLocked, $IsSticky, $NumPosts) = $DB->next_record();
$Part1 = array_slice($Forum,0,$Stickies,true); //Stickys $Part1 = array_slice($Forum, 0, $Stickies, true); //Stickys
$Part2 = array( $Part2 = array(
$TopicID=>array( $TopicID => array(
'ID' => $TopicID, 'ID' => $TopicID,
'Title' => $Title, 'Title' => $Title,
'AuthorID' => $AuthorID, 'AuthorID' => $AuthorID,
@ -181,10 +203,10 @@ public static function create_thread($ForumID, $AuthorID, $Title, $PostBody) {
'LastPostAuthorID' => $AuthorID, 'LastPostAuthorID' => $AuthorID,
) )
); //Bumped thread ); //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) { if ($Stickies > 0) {
$Part1 = array_slice($Forum,0,$Stickies,true); //Stickies $Part1 = array_slice($Forum, 0, $Stickies, true); //Stickies
$Part3 = array_slice($Forum,$Stickies,TOPICS_PER_PAGE-$Stickies-1,true); //Rest of page $Part3 = array_slice($Forum, $Stickies, TOPICS_PER_PAGE - $Stickies - 1, true); //Rest of page
} else { } else {
$Part1 = array(); $Part1 = array();
$Part3 = $Forum; $Part3 = $Forum;
@ -192,7 +214,7 @@ public static function create_thread($ForumID, $AuthorID, $Title, $PostBody) {
if (is_null($Part1)) { $Part1 = array(); } if (is_null($Part1)) { $Part1 = array(); }
if (is_null($Part3)) { $Part3 = array(); } if (is_null($Part3)) { $Part3 = array(); }
$Forum = $Part1 + $Part2 + $Part3; $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 //Update the forum root
@ -209,12 +231,12 @@ public static function create_thread($ForumID, $AuthorID, $Title, $PostBody) {
'IsSticky'=>$ThreadInfo['IsSticky'] 'IsSticky'=>$ThreadInfo['IsSticky']
); );
$UpdateArray['NumTopics']='+1'; $UpdateArray['NumTopics'] = '+1';
$Cache->update_row($ForumID, $UpdateArray); $Cache->update_row($ForumID, $UpdateArray);
$Cache->commit_transaction(0); $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); $Cache->begin_transaction('thread_'.$TopicID.'_catalogue_'.$CatalogueID);
$Post = array( $Post = array(
'ID'=>$PostID, 'ID'=>$PostID,
@ -271,7 +293,7 @@ public static function in_array_partial($Needle, $Haystack) {
} }
foreach ($Haystack as $String) { foreach ($Haystack as $String) {
if (substr($String, -1) == '*') { if (substr($String, -1) == '*') {
if (!strncmp($Needle, $String, strlen($String)-1)) { if (!strncmp($Needle, $String, strlen($String) - 1)) {
$Searches[$Needle] = true; $Searches[$Needle] = true;
return 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 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. * @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)) { if (isset($Keys)) {
foreach ($Keys as $K) { foreach ($Keys as $K) {
if (!isset($Request[$K]) || ($AllowEmpty == False && $Request[$K] == '')) { if (!isset($Request[$K]) || ($AllowEmpty == False && $Request[$K] == '')) {
@ -329,7 +351,10 @@ public static function get_tags($TagNames) {
} }
} }
if (count($TagNames) > 0) { 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(); $SQLTagIDs = $DB->to_array();
foreach ($SQLTagIDs as $Tag) { foreach ($SQLTagIDs as $Tag) {
$TagIDs[$Tag['ID']] = $Tag['Name']; $TagIDs[$Tag['ID']] = $Tag['Name'];
@ -348,13 +373,13 @@ public static function get_tags($TagNames) {
* @return string The aliased tag. * @return string The aliased tag.
*/ */
public static function get_alias_tag($BadTag) { public static function get_alias_tag($BadTag) {
global $DB; global $DB;
$DB->query("SELECT AliasTag FROM tag_aliases WHERE BadTag = '". $BadTag ."' LIMIT 1"); $DB->query("SELECT AliasTag FROM tag_aliases WHERE BadTag = '". $BadTag ."' LIMIT 1");
if ($DB->record_count() > 0) { if ($DB->record_count() > 0) {
list($AliasTag) = $DB->next_record(); list($AliasTag) = $DB->next_record();
return $AliasTag; return $AliasTag;
} }
return $BadTag; return $BadTag;
} }
@ -365,8 +390,9 @@ public static function get_alias_tag($BadTag) {
*/ */
public static function write_log($Message) { public static function write_log($Message) {
global $DB,$Time; global $DB,$Time;
$DB->query('INSERT INTO log (Message, Time) VALUES (\'' $DB->query("
.db_string($Message).'\', \''.sqltime().'\')'); 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) { public static function display_recommend($ID, $Type, $Hide = true) {
global $DB, $LoggedUser; global $DB, $LoggedUser;
if ($Hide) { 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;"> <div style="display: inline-block;">
<strong>Recommend to:</strong> <strong>Recommend to:</strong>
<select id="friend" name="friend"> <select id="friend" name="friend">
@ -431,7 +457,7 @@ public static function display_recommend($ID, $Type, $Hide = true) {
</div> </div>
<div class="new" id="recommendation_status"><br /></div> <div class="new" id="recommendation_status"><br /></div>
</div> </div>
<? <?
} }
} }
?> ?>

View File

@ -831,7 +831,7 @@ private function to_html ($Array) {
} }
break; break;
} }
} }
} }
@ -857,7 +857,7 @@ private function raw_text ($Array) {
case 'size': case 'size':
case 'quote': case 'quote':
case 'align': case 'align':
$Str.=$this->raw_text($Block['Val']); $Str.=$this->raw_text($Block['Val']);
break; break;
case 'tex': //since this will never strip cleanly, just remove it case 'tex': //since this will never strip cleanly, just remove it

View File

@ -600,9 +600,8 @@ function to_html($Array) {
$Str.='<a rel="noreferrer" target="_blank" href="'.$Block['Attr'].'">'.$Block['Attr'].'</a>'; $Str.='<a rel="noreferrer" target="_blank" href="'.$Block['Attr'].'">'.$Block['Attr'].'</a>';
} }
} }
break; break;
} }
} }
$this->Levels--; $this->Levels--;
@ -626,7 +625,7 @@ function raw_text($Array) {
case 'size': case 'size':
case 'quote': case 'quote':
case 'align': case 'align':
$Str.=$this->raw_text($Block['Val']); $Str.=$this->raw_text($Block['Val']);
break; break;
case 'tex': //since this will never strip cleanly, just remove it case 'tex': //since this will never strip cleanly, just remove it

View File

@ -565,7 +565,7 @@ function to_html($Array) {
} }
break; break;
} }
} }
$this->Levels--; $this->Levels--;
@ -589,7 +589,7 @@ function raw_text($Array) {
case 'size': case 'size':
case 'quote': case 'quote':
case 'align': case 'align':
$Str.=$this->raw_text($Block['Val']); $Str.=$this->raw_text($Block['Val']);
break; break;
case 'tex': //since this will never strip cleanly, just remove it case 'tex': //since this will never strip cleanly, just remove it

View File

@ -130,7 +130,7 @@ public static function lookup_ip($IP) {
public static function display_ip($IP) { public static function display_ip($IP) {
$Line = display_str($IP).' ('.Tools::get_country_code_by_ajax($IP).') '; $Line = display_str($IP).' ('.Tools::get_country_code_by_ajax($IP).') ';
$Line .= '<a href="user.php?action=search&amp;ip_history=on&amp;ip='.display_str($IP).'&amp;matchtype=strict" title="Search" class="brackets">S</a>'; $Line .= '<a href="user.php?action=search&amp;ip_history=on&amp;ip='.display_str($IP).'&amp;matchtype=strict" title="Search" class="brackets">S</a>';
return $Line; return $Line;
} }
@ -141,7 +141,7 @@ public static function get_country_code_by_ajax($IP) {
} }
/** /**
* Disable an array of users. * Disable an array of users.
@ -161,7 +161,7 @@ public static function disable_users($UserIDs, $AdminComment, $BanReason = 1) {
m.can_leech='0', m.can_leech='0',
i.AdminComment = CONCAT('".sqltime()." - ".($AdminComment ? $AdminComment : 'Disabled by system')."\n\n', i.AdminComment), i.AdminComment = CONCAT('".sqltime()." - ".($AdminComment ? $AdminComment : 'Disabled by system')."\n\n', i.AdminComment),
i.BanDate='".sqltime()."', i.BanDate='".sqltime()."',
i.BanReason='".$BanReason."', i.BanReason='$BanReason',
i.RatioWatchDownload=".($BanReason == 2 ? 'm.Downloaded' : "'0'")." i.RatioWatchDownload=".($BanReason == 2 ? 'm.Downloaded' : "'0'")."
WHERE m.ID IN(".implode(',',$UserIDs).") "); WHERE m.ID IN(".implode(',',$UserIDs).") ");
$Cache->decrement('stats_user_count',$DB->affected_rows()); $Cache->decrement('stats_user_count',$DB->affected_rows());
@ -176,14 +176,14 @@ public static function disable_users($UserIDs, $AdminComment, $BanReason = 1) {
$Cache->delete_value('session_'.$UserID.'_'.$SessionID); $Cache->delete_value('session_'.$UserID.'_'.$SessionID);
} }
$Cache->delete_value('users_sessions_'.$UserID); $Cache->delete_value('users_sessions_'.$UserID);
$DB->query("DELETE FROM users_sessions WHERE UserID='$UserID'"); $DB->query("DELETE FROM users_sessions WHERE UserID='$UserID'");
} }
// Remove the users from the tracker. // 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'); $PassKeys = $DB->collect('torrent_pass');
$Concat = ''; $Concat = '';
foreach ($PassKeys as $PassKey) { foreach ($PassKeys as $PassKey) {
@ -223,10 +223,12 @@ 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"; $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('
Warned=\''.db_string($NewExpDate).'\', UPDATE users_info
WarnedTimes=WarnedTimes+1, SET
AdminComment=CONCAT(\''.db_string($AdminComment).'\',AdminComment) Warned=\''.db_string($NewExpDate).'\',
WarnedTimes=WarnedTimes+1,
AdminComment=CONCAT(\''.db_string($AdminComment).'\',AdminComment)
WHERE UserID=\''.db_string($UserID).'\''); WHERE UserID=\''.db_string($UserID).'\'');
} else { } else {
//Not changing, user was not already warned //Not changing, user was not already warned
@ -238,10 +240,12 @@ public static function warn_user($UserID, $Duration, $Reason) {
$AdminComment = date('Y-m-d').' - Warned until '.$WarnTime.' by '.$LoggedUser['Username']."\nReason: $Reason\n\n"; $AdminComment = date('Y-m-d').' - Warned until '.$WarnTime.' by '.$LoggedUser['Username']."\nReason: $Reason\n\n";
$DB->query('UPDATE users_info SET $DB->query('
Warned=\''.db_string($WarnTime).'\', UPDATE users_info
WarnedTimes=WarnedTimes+1, SET
AdminComment=CONCAT(\''.db_string($AdminComment).'\',AdminComment) Warned=\''.db_string($WarnTime).'\',
WarnedTimes=WarnedTimes+1,
AdminComment=CONCAT(\''.db_string($AdminComment).'\',AdminComment)
WHERE UserID=\''.db_string($UserID).'\''); WHERE UserID=\''.db_string($UserID).'\'');
} }
} }
@ -253,9 +257,10 @@ public static function warn_user($UserID, $Duration, $Reason) {
*/ */
public static function update_user_notes($UserID, $AdminComment) { public static function update_user_notes($UserID, $AdminComment) {
global $DB; global $DB;
$DB->query('UPDATE users_info SET $DB->query('
AdminComment=CONCAT(\''.db_string($AdminComment).'\',AdminComment) UPDATE users_info
WHERE UserID=\''.db_string($UserID).'\''); SET AdminComment=CONCAT(\''.db_string($AdminComment).'\',AdminComment)
WHERE UserID=\''.db_string($UserID).'\'');
} }
} }
?> ?>

View File

@ -243,7 +243,7 @@ public static function delete_torrent($ID, $GroupID=0, $OcelotReason=-1) {
} }
} }
$DB->query("SELECT info_hash FROM torrents WHERE ID = ".$ID); $DB->query("SELECT info_hash FROM torrents WHERE ID = ".$ID);
list($InfoHash) = $DB->next_record(MYSQLI_BOTH, false); list($InfoHash) = $DB->next_record(MYSQLI_BOTH, false);
$DB->query("DELETE FROM torrents WHERE ID = ".$ID); $DB->query("DELETE FROM torrents WHERE ID = ".$ID);
@ -314,7 +314,7 @@ public static function delete_group($GroupID) {
} }
$Cache->decrement('stats_group_count'); $Cache->decrement('stats_group_count');
// Collages // Collages
$DB->query("SELECT CollageID FROM collages_torrents WHERE GroupID='$GroupID'"); $DB->query("SELECT CollageID FROM collages_torrents WHERE GroupID='$GroupID'");

View File

@ -48,10 +48,9 @@ function table_query($TableName) {
$Query = "SELECT COUNT(p.ID) AS Posts FROM users_main AS um JOIN forums_posts AS p ON p.AuthorID=um.ID WHERE um.Enabled='1' GROUP BY um.ID ORDER BY Posts;"; $Query = "SELECT COUNT(p.ID) AS Posts FROM users_main AS um JOIN forums_posts AS p ON p.AuthorID=um.ID WHERE um.Enabled='1' GROUP BY um.ID ORDER BY Posts;";
break; break;
case 'bounty': 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;"; $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; break;
case 'artists': case 'artists':
$Query = "SELECT COUNT(ta.ArtistID) AS Artists FROM torrents_artists AS ta JOIN torrents_group AS tg ON tg.ID=ta.GroupID JOIN torrents AS t ON t.GroupID = tg.ID WHERE t.UserID != ta.UserID GROUP BY tg.ID ORDER BY Artists ASC"; $Query = "SELECT COUNT(ta.ArtistID) AS Artists FROM torrents_artists AS ta JOIN torrents_group AS tg ON tg.ID=ta.GroupID JOIN torrents AS t ON t.GroupID = tg.ID WHERE t.UserID != ta.UserID GROUP BY tg.ID ORDER BY Artists ASC";

View File

@ -16,7 +16,7 @@ public static function get_classes() {
$Cache->cache_value('classes', array($Classes, $ClassLevels), 0); $Cache->cache_value('classes', array($Classes, $ClassLevels), 0);
} }
$Debug->set_flag('Loaded permissions'); $Debug->set_flag('Loaded permissions');
return array($Classes, $ClassLevels); return array($Classes, $ClassLevels);
} }
@ -47,30 +47,31 @@ public static function user_info($UserID) {
// the !isset($UserInfo['Paranoia']) can be removed after a transition period // the !isset($UserInfo['Paranoia']) can be removed after a transition period
if (empty($UserInfo) || empty($UserInfo['ID']) || !isset($UserInfo['Paranoia']) || empty($UserInfo['Class'])) { if (empty($UserInfo) || empty($UserInfo['ID']) || !isset($UserInfo['Paranoia']) || empty($UserInfo['Class'])) {
$OldQueryID = $DB->get_query_id(); $OldQueryID = $DB->get_query_id();
$DB->query("SELECT $DB->query("
m.ID, SELECT
m.Username, m.ID,
m.PermissionID, m.Username,
m.Paranoia, m.PermissionID,
i.Artist, m.Paranoia,
i.Donor, i.Artist,
i.Warned, i.Donor,
i.Avatar, i.Warned,
m.Enabled, i.Avatar,
m.Title, m.Enabled,
i.CatchupTime, m.Title,
m.Visible, i.CatchupTime,
GROUP_CONCAT(ul.PermissionID SEPARATOR ',') AS Levels m.Visible,
GROUP_CONCAT(ul.PermissionID SEPARATOR ',') AS Levels
FROM users_main AS m FROM users_main AS m
INNER JOIN users_info AS i ON i.UserID=m.ID INNER JOIN users_info AS i ON i.UserID=m.ID
LEFT JOIN users_levels AS ul ON ul.UserID = m.ID LEFT JOIN users_levels AS ul ON ul.UserID = m.ID
WHERE m.ID='$UserID' WHERE m.ID='$UserID'
GROUP BY m.ID"); GROUP BY m.ID");
if ($DB->record_count() == 0) { // Deleted user, maybe? if ($DB->record_count() == 0) { // Deleted user, maybe?
$UserInfo = array('ID'=>'','Username'=>'','PermissionID'=>0,'Artist'=>false,'Donor'=>false,'Warned'=>'0000-00-00 00:00:00','Avatar'=>'','Enabled'=>0,'Title'=>'', 'CatchupTime'=>0, 'Visible'=>'1'); $UserInfo = array('ID'=>'','Username'=>'','PermissionID'=>0,'Artist'=>false,'Donor'=>false,'Warned'=>'0000-00-00 00:00:00','Avatar'=>'','Enabled'=>0,'Title'=>'', 'CatchupTime'=>0, 'Visible'=>'1');
} else { } else {
$UserInfo = $DB->next_record(MYSQLI_ASSOC, array('Paranoia', 'Title')); $UserInfo = $DB->next_record(MYSQLI_ASSOC, array('Paranoia', 'Title'));
$UserInfo['CatchupTime'] = strtotime($UserInfo['CatchupTime']); $UserInfo['CatchupTime'] = strtotime($UserInfo['CatchupTime']);
@ -118,39 +119,40 @@ public static function user_heavy_info($UserID) {
global $DB, $Cache; global $DB, $Cache;
$HeavyInfo = $Cache->get_value('user_info_heavy_'.$UserID); $HeavyInfo = $Cache->get_value('user_info_heavy_'.$UserID);
if (empty($HeavyInfo)) { if (empty($HeavyInfo)) {
$DB->query("SELECT $DB->query("
m.Invites, SELECT
m.torrent_pass, m.Invites,
m.IP, m.torrent_pass,
m.CustomPermissions, m.IP,
m.can_leech AS CanLeech, m.CustomPermissions,
i.AuthKey, m.can_leech AS CanLeech,
i.RatioWatchEnds, i.AuthKey,
i.RatioWatchDownload, i.RatioWatchEnds,
i.StyleID, i.RatioWatchDownload,
i.StyleURL, i.StyleID,
i.DisableInvites, i.StyleURL,
i.DisablePosting, i.DisableInvites,
i.DisableUpload, i.DisablePosting,
i.DisableWiki, i.DisableUpload,
i.DisableAvatar, i.DisableWiki,
i.DisablePM, i.DisableAvatar,
i.DisableRequests, i.DisablePM,
i.DisableForums, i.DisableRequests,
i.DisableTagging, i.DisableForums,
i.SiteOptions, i.DisableTagging,
i.DownloadAlt, i.SiteOptions,
i.LastReadNews, i.DownloadAlt,
i.LastReadBlog, i.LastReadNews,
i.RestrictedForums, i.LastReadBlog,
i.PermittedForums, i.RestrictedForums,
m.FLTokens, i.PermittedForums,
m.PermissionID m.FLTokens,
m.PermissionID
FROM users_main AS m FROM users_main AS m
INNER JOIN users_info AS i ON i.UserID=m.ID INNER JOIN users_info AS i ON i.UserID=m.ID
WHERE m.ID='$UserID'"); WHERE m.ID='$UserID'");
$HeavyInfo = $DB->next_record(MYSQLI_ASSOC, array('CustomPermissions', 'SiteOptions')); $HeavyInfo = $DB->next_record(MYSQLI_ASSOC, array('CustomPermissions', 'SiteOptions'));

View File

@ -11,7 +11,9 @@
/********************************************************/ /********************************************************/
require 'config.php'; //The config contains all site wide configuration information require 'config.php'; //The config contains all site wide configuration information
//Deal with dumbasses //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'); require(SERVER_ROOT.'/classes/class_proxies.php');
@ -221,15 +223,16 @@
$UserSessions = $Cache->get_value('users_sessions_'.$UserID); $UserSessions = $Cache->get_value('users_sessions_'.$UserID);
if (!is_array($UserSessions)) { if (!is_array($UserSessions)) {
$DB->query("SELECT $DB->query("
SessionID, SELECT
Browser, SessionID,
OperatingSystem, Browser,
IP, OperatingSystem,
LastUpdate IP,
LastUpdate
FROM users_sessions FROM users_sessions
WHERE UserID='$UserID' WHERE UserID='$UserID'
AND Active = 1 AND Active = 1
ORDER BY LastUpdate DESC"); ORDER BY LastUpdate DESC");
$UserSessions = $DB->to_array('SessionID',MYSQLI_ASSOC); $UserSessions = $DB->to_array('SessionID',MYSQLI_ASSOC);
$Cache->cache_value('users_sessions_'.$UserID, $UserSessions, 0); $Cache->cache_value('users_sessions_'.$UserID, $UserSessions, 0);
@ -243,20 +246,21 @@
$Enabled = $Cache->get_value('enabled_'.$LoggedUser['ID']); $Enabled = $Cache->get_value('enabled_'.$LoggedUser['ID']);
if ($Enabled === false) { if ($Enabled === false) {
$DB->query("SELECT Enabled FROM users_main WHERE ID='$LoggedUser[ID]'"); $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); $Cache->cache_value('enabled_'.$LoggedUser['ID'], $Enabled, 0);
} }
if ($Enabled==2) { if ($Enabled == 2) {
logout(); logout();
} }
// Up/Down stats // Up/Down stats
$UserStats = $Cache->get_value('user_stats_'.$LoggedUser['ID']); $UserStats = $Cache->get_value('user_stats_'.$LoggedUser['ID']);
if (!is_array($UserStats)) { 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); $UserStats = $DB->next_record(MYSQLI_ASSOC);
$Cache->cache_value('user_stats_'.$LoggedUser['ID'], $UserStats, 3600); $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['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['RatioWatch'] = (
$LoggedUser['RatioWatchEnds'] != '0000-00-00 00:00:00' && $LoggedUser['RatioWatchEnds'] != '0000-00-00 00:00:00' &&
time() < strtotime($LoggedUser['RatioWatchEnds']) && time() < strtotime($LoggedUser['RatioWatchEnds']) &&
($LoggedUser['BytesDownloaded']*$LoggedUser['RequiredRatio'])>$LoggedUser['BytesUploaded'] ($LoggedUser['BytesDownloaded'] * $LoggedUser['RequiredRatio']) > $LoggedUser['BytesUploaded']
); );
if (!isset($LoggedUser['ID'])) { if (!isset($LoggedUser['ID'])) {
$Debug->log_var($LightInfo, 'LightInfo'); $Debug->log_var($LightInfo, 'LightInfo');
@ -286,19 +290,30 @@
$Debug->log_var($UserStats, 'UserStats'); $Debug->log_var($UserStats, 'UserStats');
} }
//Load in the permissions // Load in the permissions
$LoggedUser['Permissions'] = Permissions::get_permissions_for_user($LoggedUser['ID'], $LoggedUser['CustomPermissions']); $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'); $Cache->CanClear = check_perms('admin_clear_cache');
// Because we <3 our staff // Because we <3 our staff
if (check_perms('site_disable_ip_history')) { $_SERVER['REMOTE_ADDR'] = '127.0.0.1'; } if (check_perms('site_disable_ip_history')) { $_SERVER['REMOTE_ADDR'] = '127.0.0.1'; }
// Update LastUpdate every 10 minutes // Update LastUpdate every 10 minutes
if (strtotime($UserSessions[$SessionID]['LastUpdate'])+600<time()) { if (strtotime($UserSessions[$SessionID]['LastUpdate']) + 600 < time()) {
$DB->query("UPDATE users_main SET LastAccess='".sqltime()."' WHERE ID='$LoggedUser[ID]'"); $DB->query("
$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)."'"); 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->begin_transaction('users_sessions_'.$UserID);
$Cache->delete_row($SessionID); $Cache->delete_row($SessionID);
$Cache->insert_front($SessionID,array( $Cache->insert_front($SessionID,array(
@ -327,23 +342,26 @@
} }
// IP changed // IP changed
if ($LoggedUser['IP'] != $_SERVER['REMOTE_ADDR'] && !check_perms('site_disable_ip_history')) { if ($LoggedUser['IP'] != $_SERVER['REMOTE_ADDR'] && !check_perms('site_disable_ip_history')) {
if (Tools::site_ban_ip($_SERVER['REMOTE_ADDR'])) { 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']); $CurIP = db_string($LoggedUser['IP']);
$NewIP = db_string($_SERVER['REMOTE_ADDR']); $NewIP = db_string($_SERVER['REMOTE_ADDR']);
$DB->query("UPDATE users_history_ips SET $DB->query("
EndTime='".sqltime()."' UPDATE users_history_ips
WHERE EndTime IS NULL SET EndTime='".sqltime()."'
WHERE EndTime IS NULL
AND UserID='$LoggedUser[ID]' AND UserID='$LoggedUser[ID]'
AND IP='$CurIP'"); AND IP='$CurIP'");
$DB->query("INSERT IGNORE INTO users_history_ips $DB->query("
(UserID, IP, StartTime) VALUES INSERT IGNORE INTO users_history_ips
(UserID, IP, StartTime)
VALUES
('$LoggedUser[ID]', '$NewIP', '".sqltime()."')"); ('$LoggedUser[ID]', '$NewIP', '".sqltime()."')");
$ipcc = Tools::geoip($NewIP); $ipcc = Tools::geoip($NewIP);
@ -352,10 +370,9 @@
$Cache->update_row(false, array('IP' => $_SERVER['REMOTE_ADDR'])); $Cache->update_row(false, array('IP' => $_SERVER['REMOTE_ADDR']));
$Cache->commit_transaction(0); $Cache->commit_transaction(0);
} }
// Get stylesheets // Get stylesheets
$Stylesheets = $Cache->get_value('stylesheets'); $Stylesheets = $Cache->get_value('stylesheets');
@ -388,10 +405,10 @@ function logout() {
setcookie('keeplogged', '', time() - 60 * 60 * 24 * 365, '/', '', false); setcookie('keeplogged', '', time() - 60 * 60 * 24 * 365, '/', '', false);
setcookie('session', '', time() - 60 * 60 * 24 * 365, '/', '', false); setcookie('session', '', time() - 60 * 60 * 24 * 365, '/', '', false);
if ($SessionID) { if ($SessionID) {
$DB->query("DELETE FROM users_sessions WHERE UserID='$LoggedUser[ID]' AND SessionID='".db_string($SessionID)."'"); $DB->query("DELETE FROM users_sessions WHERE UserID='$LoggedUser[ID]' AND SessionID='".db_string($SessionID)."'");
$Cache->begin_transaction('users_sessions_'.$LoggedUser['ID']); $Cache->begin_transaction('users_sessions_'.$LoggedUser['ID']);
$Cache->delete_row($SessionID); $Cache->delete_row($SessionID);
$Cache->commit_transaction(0); $Cache->commit_transaction(0);

View File

@ -110,7 +110,7 @@
<? <?
if (check_perms('site_send_unlimited_invites')) { if (check_perms('site_send_unlimited_invites')) {
$Invites = ' (∞)'; $Invites = ' (∞)';
} elseif ($LoggedUser['Invites']>0) { } elseif ($LoggedUser['Invites'] > 0) {
$Invites = ' ('.$LoggedUser['Invites'].')'; $Invites = ' ('.$LoggedUser['Invites'].')';
} else { } else {
$Invites = ''; $Invites = '';
@ -118,7 +118,7 @@
?> ?>
<li id="nav_invite" class="brackets<?=Format::add_class($PageID, array('user','invite'), 'active', false)?>"><a href="user.php?action=invite">Invite<?=$Invites?></a></li> <li id="nav_invite" class="brackets<?=Format::add_class($PageID, array('user','invite'), 'active', false)?>"><a href="user.php?action=invite">Invite<?=$Invites?></a></li>
<li id="nav_donate" class="brackets<?=Format::add_class($PageID, array('donate'), 'active', false)?>"><a href="donate.php">Donate</a></li> <li id="nav_donate" class="brackets<?=Format::add_class($PageID, array('donate'), 'active', false)?>"><a href="donate.php">Donate</a></li>
</ul> </ul>
<ul id="userinfo_stats"> <ul id="userinfo_stats">
<li id="stats_seeding"><a href="torrents.php?type=seeding&amp;userid=<?=$LoggedUser['ID']?>">Up</a>: <span class="stat" title="<?=Format::get_size($LoggedUser['BytesUploaded'], 5)?>"><?=Format::get_size($LoggedUser['BytesUploaded'])?></span></li> <li id="stats_seeding"><a href="torrents.php?type=seeding&amp;userid=<?=$LoggedUser['ID']?>">Up</a>: <span class="stat" title="<?=Format::get_size($LoggedUser['BytesUploaded'], 5)?>"><?=Format::get_size($LoggedUser['BytesUploaded'])?></span></li>
@ -139,20 +139,21 @@
$RestrictedForums = implode("','", array_keys($LoggedUser['CustomForums'], 0)); $RestrictedForums = implode("','", array_keys($LoggedUser['CustomForums'], 0));
$PermittedForums = implode("','", array_keys($LoggedUser['CustomForums'], 1)); $PermittedForums = implode("','", array_keys($LoggedUser['CustomForums'], 1));
} }
$DB->query("SELECT COUNT(s.TopicID) $DB->query("
FROM users_subscriptions AS s SELECT COUNT(s.TopicID)
JOIN forums_last_read_topics AS l ON s.UserID = l.UserID AND s.TopicID = l.TopicID FROM users_subscriptions AS s
JOIN forums_topics AS t ON l.TopicID = t.ID JOIN forums_last_read_topics AS l ON s.UserID = l.UserID AND s.TopicID = l.TopicID
JOIN forums AS f ON t.ForumID = f.ID JOIN forums_topics AS t ON l.TopicID = t.ID
WHERE (f.MinClassRead <= ".$LoggedUser['Class']." OR f.ID IN ('$PermittedForums')) JOIN forums AS f ON t.ForumID = f.ID
AND l.PostID < t.LastPostID WHERE (f.MinClassRead <= ".$LoggedUser['Class']." OR f.ID IN ('$PermittedForums'))
AND s.UserID = ".$LoggedUser['ID']. AND l.PostID < t.LastPostID
(!empty($RestrictedForums) ? " AND s.UserID = ".$LoggedUser['ID'].
AND f.ID NOT IN ('".$RestrictedForums."')" : "")); (!empty($RestrictedForums) ? "
AND f.ID NOT IN ('$RestrictedForums')" : ''));
list($NewSubscriptions) = $DB->next_record(); list($NewSubscriptions) = $DB->next_record();
$Cache->cache_value('subscriptions_user_new_'.$LoggedUser['ID'], $NewSubscriptions, 0); $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_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_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> <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)); $RestrictedForums = implode("','", array_keys($LoggedUser['CustomForums'], 0));
$PermittedForums = implode("','", array_keys($LoggedUser['CustomForums'], 1)); $PermittedForums = implode("','", array_keys($LoggedUser['CustomForums'], 1));
} }
$sql = "SELECT COUNT(q.UnRead) $sql = "
FROM users_notify_quoted AS q SELECT COUNT(q.UnRead)
LEFT JOIN forums_topics AS t ON t.ID = q.PageID FROM users_notify_quoted AS q
LEFT JOIN forums AS f ON f.ID = t.ForumID LEFT JOIN forums_topics AS t ON t.ID = q.PageID
WHERE q.UserID=$LoggedUser[ID] AND q.UnRead=1 AND q.Page = 'forums' AND ((f.MinClassRead<='$LoggedUser[Class]'"; 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]'";
if (!empty($RestrictedForums)) { if (!empty($RestrictedForums)) {
$sql .= " AND f.ID NOT IN ('$RestrictedForums')"; $sql .= " AND f.ID NOT IN ('$RestrictedForums')";
} }

View File

@ -30,7 +30,7 @@
'response' => 'Rate limit exceeded.' 'response' => 'Rate limit exceeded.'
) )
); );
json_die("failure", "rate limit exceeded"); json_die("failure", "rate limit exceeded");
} else { } else {
$Cache->increment_value('ajax_requests_'.$UserID); $Cache->increment_value('ajax_requests_'.$UserID);
@ -58,7 +58,7 @@
case 'stats': case 'stats':
require(SERVER_ROOT . '/sections/ajax/stats.php'); require(SERVER_ROOT . '/sections/ajax/stats.php');
break; break;
case 'checkprivate': case 'checkprivate':
include('checkprivate.php'); include('checkprivate.php');
break; break;

View File

@ -13,7 +13,7 @@
if (isset($_GET['username'])) { if (isset($_GET['username'])) {
$_GET['username'] = trim($_GET['username']); $_GET['username'] = trim($_GET['username']);
list($Page,$Limit) = Format::page_limit(USERS_PER_PAGE); list($Page,$Limit) = Format::page_limit(USERS_PER_PAGE);
$DB->query(" $DB->query("
SELECT SQL_CALC_FOUND_ROWS SELECT SQL_CALC_FOUND_ROWS

View File

@ -886,7 +886,7 @@ function require(file, callback) {
</div> </div>
<div id="body" class="body"><?=$Text->full_format($Body)?></div> <div id="body" class="body"><?=$Text->full_format($Body)?></div>
</div> </div>
<!-- --> <!---->
<?php <?php
// --- Comments --- // --- Comments ---
@ -909,9 +909,9 @@ function require(file, callback) {
WHERE ArtistID = $ArtistID WHERE ArtistID = $ArtistID
AND ID <= $_GET[postid]"); AND ID <= $_GET[postid]");
list($PostNum) = $DB->next_record(); 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 { } 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 //Get the cache catalogue
@ -937,12 +937,12 @@ function require(file, callback) {
WHERE c.ArtistID = '$ArtistID' WHERE c.ArtistID = '$ArtistID'
ORDER BY c.ID ORDER BY c.ID
LIMIT $CatalogueLimit"); 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); $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 //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"> <div id="artistcomments" class="linkbox">
<a name="comments"></a> <a name="comments"></a>

View File

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

View File

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

View File

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

View File

@ -66,7 +66,7 @@
<td class="label">Tags</td> <td class="label">Tags</td>
<td><input type="text" name="tags" size="60" value="<?=$TagList?>" /></td> <td><input type="text" name="tags" size="60" value="<?=$TagList?>" /></td>
</tr> </tr>
<? if ($CategoryID == 0) { // CategoryID==0 is for "personal" collages ?> <? if ($CategoryID == 0) { // CategoryID == 0 is for "personal" collages ?>
<tr> <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 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> <td><input type="checkbox" name="featured"<?=($Featured ? ' checked="checked"' : '')?> /></td>

View File

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

View File

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

View File

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

View File

@ -8,11 +8,11 @@
define('PAYPAL_MINIMUM',5); define('PAYPAL_MINIMUM',5);
function btc_received() { function btc_received() {
} }
function btc_balance() { function btc_balance() {
} }
// This will be rarely called, so let's go directly to the database // This will be rarely called, so let's go directly to the database
@ -22,9 +22,9 @@ function btc_address($UserID, $GenAddress = false) {
$DB->query("SELECT BitcoinAddress FROM users_info WHERE UserID = '$UserID'"); $DB->query("SELECT BitcoinAddress FROM users_info WHERE UserID = '$UserID'");
list($Addr) = $DB->next_record(); list($Addr) = $DB->next_record();
if (!empty($Addr)) { return $Addr; } if (!empty($Addr)) {
elseif ($GenAddress) { return $Addr;
} elseif ($GenAddress) {
if (empty($NewAddr)) { if (empty($NewAddr)) {
error(0); error(0);
} }

View File

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

View File

@ -55,7 +55,7 @@
Misc::send_pm($_POST['custom'], 0, 'Thank you for your donation', 'Your donation from '.$_POST['payer_email'].' of '.$_POST['mc_gross'].' '.PAYPAL_CURRENCY.' has been successfully processed. Your continued support is highly appreciated and helps to make this place possible.'); Misc::send_pm($_POST['custom'], 0, 'Thank you for your donation', 'Your donation from '.$_POST['payer_email'].' of '.$_POST['mc_gross'].' '.PAYPAL_CURRENCY.' has been successfully processed. Your continued support is highly appreciated and helps to make this place possible.');
} }
} }
} }
} }
@ -66,7 +66,10 @@
} else { } else {
//Failed pending donation //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."; $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(); list($TotalDonated,$DonationTime) = $DB->next_record();
if ($TotalDonated+$_POST['mc_gross'] == 0) { if ($TotalDonated+$_POST['mc_gross'] == 0) {
$DB->query("SELECT Invites FROM users_main WHERE ID='".$_POST['custom']."'"); $DB->query("SELECT Invites FROM users_main WHERE ID='".$_POST['custom']."'");
@ -92,17 +95,22 @@
} }
} }
} }
$DB->query("UPDATE users_info $DB->query("
UPDATE users_info
SET SET
AdminComment=CONCAT('".sqltime()." - User donated ".db_string($_POST['mc_gross'])." ".db_string(PAYPAL_CURRENCY)." from ".db_string($_POST['payer_email']).".\n',AdminComment) 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']."'"); WHERE UserID='".$_POST['custom']."'");
$DB->query("INSERT INTO donations $DB->query("
(UserID, Amount, Email, Time) VALUES INSERT INTO donations
('".$_POST['custom']."', '".db_string($_POST['mc_gross'])."', '".db_string($_POST['payer_email'])."', '".sqltime()."')"); (UserID, Amount, Email, Time)
VALUES
('".$_POST['custom']."', '".db_string($_POST['mc_gross'])."', '".db_string($_POST['payer_email'])."', '".sqltime()."')");
} else { } else {
$DB->query("INSERT INTO ip_bans $DB->query("
(FromIP, ToIP, Reason) VALUES INSERT INTO ip_bans
('".Tools::ip_to_unsigned($_SERVER['REMOTE_ADDR'])."','".ip2long($_SERVER['REMOTE_ADDR'])."', 'Attempted to exploit donation system.')"); (FromIP, ToIP, Reason)
VALUES
('".Tools::ip_to_unsigned($_SERVER['REMOTE_ADDR'])."','".ip2long($_SERVER['REMOTE_ADDR'])."', 'Attempted to exploit donation system.')");
} }
fclose ($Socket); fclose ($Socket);
if (check_perms('site_debug')) { if (check_perms('site_debug')) {

View File

@ -48,7 +48,7 @@
ORDER BY t.IsSticky DESC, t.LastPostTime DESC ORDER BY t.IsSticky DESC, t.LastPostTime DESC
LIMIT $Limit"); // Can be cached until someone makes a new post LIMIT $Limit"); // Can be cached until someone makes a new post
$Forum = $DB->to_array('ID',MYSQLI_ASSOC, false); $Forum = $DB->to_array('ID',MYSQLI_ASSOC, false);
if ($Page == 1) { if ($Page == 1) {
$DB->query("SELECT COUNT(ID) FROM forums_topics WHERE ForumID='$ForumID' AND IsSticky='1'"); $DB->query("SELECT COUNT(ID) FROM forums_topics WHERE ForumID='$ForumID' AND IsSticky='1'");
list($Stickies) = $DB->next_record(); list($Stickies) = $DB->next_record();
@ -56,7 +56,6 @@
} }
} }
if (!isset($Forums[$ForumID])) { if (!isset($Forums[$ForumID])) {
error(404); error(404);
} }
@ -68,7 +67,6 @@
} }
$ForumName = display_str($Forums[$ForumID]['Name']); $ForumName = display_str($Forums[$ForumID]['Name']);
if ($LoggedUser['CustomForums'][$ForumID] != 1 && $Forums[$ForumID]['MinClassRead'] > $LoggedUser['Class']) { if ($LoggedUser['CustomForums'][$ForumID] != 1 && $Forums[$ForumID]['MinClassRead'] > $LoggedUser['Class']) {
error(403); error(403);
@ -247,7 +245,7 @@
unset($PageLinks); unset($PageLinks);
$Title = display_str($Title); $Title = display_str($Title);
$DisplayTitle = $Title; $DisplayTitle = $Title;
?> ?>
<strong> <strong>
<a href="forums.php?action=viewthread&amp;threadid=<?=$TopicID?>" title="<?=$Title?>"><?=Format::cut_string($DisplayTitle, $TopicLength) ?></a> <a href="forums.php?action=viewthread&amp;threadid=<?=$TopicID?>" title="<?=$Title?>"><?=Format::cut_string($DisplayTitle, $TopicLength) ?></a>

View File

@ -128,7 +128,7 @@
} }
} else { // If we're just editing it } else { // If we're just editing it
$Cache->begin_transaction('thread_'.$TopicID.'_info'); $Cache->begin_transaction('thread_'.$TopicID.'_info');
$UpdateArray = array( $UpdateArray = array(
'IsSticky' => $Sticky, 'IsSticky' => $Sticky,
@ -287,5 +287,5 @@
$Cache->delete_value('polls_'.$TopicID); $Cache->delete_value('polls_'.$TopicID);
} }
header('Location: forums.php?action=viewthread&threadid='.$TopicID.'&page='.$Page); header('Location: forums.php?action=viewthread&threadid='.$TopicID.'&page='.$Page);
} }

View File

@ -113,10 +113,10 @@
} }
//Handle last read //Handle last read
if (!$ThreadInfo['IsLocked'] || $ThreadInfo['IsSticky']) { if (!$ThreadInfo['IsLocked'] || $ThreadInfo['IsSticky']) {
$DB->query(" $DB->query("
SELECT PostID SELECT PostID
FROM forums_last_read_topics FROM forums_last_read_topics

View File

@ -82,7 +82,7 @@
Your avatar at $DBURL has been found to exceed these rules. As such, it has been automatically reset. You are welcome to reinstate your avatar once it has been resized down to an acceptable size."); Your avatar at $DBURL has been found to exceed these rules. As such, it has been automatically reset. You are welcome to reinstate your avatar once it has been resized down to an acceptable size.");
} }
} }
} }

View File

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

View File

@ -66,7 +66,7 @@
AND i.UserID=m.ID"); AND i.UserID=m.ID");
$Reset = true; // Past tense form of "to reset", meaning that password has now been reset $Reset = true; // Past tense form of "to reset", meaning that password has now been reset
} }
} }
@ -182,46 +182,51 @@ function log_attempt($UserID) {
$IP = Tools::ip_to_unsigned($IPStr); $IP = Tools::ip_to_unsigned($IPStr);
if ($AttemptID) { // User has attempted to log in recently if ($AttemptID) { // User has attempted to log in recently
$Attempts++; $Attempts++;
if ($Attempts>5) { // Only 6 allowed login attempts, ban user's IP if ($Attempts > 5) { // Only 6 allowed login attempts, ban user's IP
$BannedUntil=time_plus(60*60*6); $BannedUntil = time_plus(60 * 60 * 6);
$DB->query("UPDATE login_attempts SET $DB->query("
LastAttempt='".sqltime()."', UPDATE login_attempts
Attempts='".db_string($Attempts)."', SET
BannedUntil='".db_string($BannedUntil)."', LastAttempt='".sqltime()."',
Bans=Bans+1 Attempts='".db_string($Attempts)."',
BannedUntil='".db_string($BannedUntil)."',
Bans=Bans+1
WHERE ID='".db_string($AttemptID)."'"); WHERE ID='".db_string($AttemptID)."'");
if ($Bans > 9) { // Automated bruteforce prevention if ($Bans > 9) { // Automated bruteforce prevention
$DB->query("SELECT Reason FROM ip_bans WHERE ".$IP." BETWEEN FromIP AND ToIP"); $DB->query("SELECT Reason FROM ip_bans WHERE ".$IP." BETWEEN FromIP AND ToIP");
if ($DB->record_count() > 0) { if ($DB->record_count() > 0) {
//Ban exists already, only add new entry if not for same reason //Ban exists already, only add new entry if not for same reason
list($Reason) = $DB->next_record(MYSQLI_BOTH, false); list($Reason) = $DB->next_record(MYSQLI_BOTH, false);
if ($Reason != 'Automated ban per >60 failed login attempts') { 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) 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 { } else {
//No ban //No ban
$DB->query("INSERT IGNORE INTO ip_bans $DB->query("
(FromIP, ToIP, Reason) VALUES INSERT IGNORE INTO ip_bans (FromIP, ToIP, Reason)
('$IP','$IP', 'Automated ban per >60 failed login attempts')"); VALUES ('$IP','$IP', 'Automated ban per >60 failed login attempts')");
$Cache->delete_value('ip_bans_'.$IPA); $Cache->delete_value('ip_bans_'.$IPA);
} }
} }
} else { } else {
// User has attempted fewer than 6 logins // User has attempted fewer than 6 logins
$DB->query("UPDATE login_attempts SET $DB->query("
LastAttempt='".sqltime()."', UPDATE login_attempts
Attempts='".db_string($Attempts)."', SET
BannedUntil='0000-00-00 00:00:00' LastAttempt='".sqltime()."',
Attempts='".db_string($Attempts)."',
BannedUntil='0000-00-00 00:00:00'
WHERE ID='".db_string($AttemptID)."'"); WHERE ID='".db_string($AttemptID)."'");
} }
} else { // User has not attempted to log in recently } else { // User has not attempted to log in recently
$Attempts=1; $Attempts = 1;
$DB->query("INSERT INTO login_attempts $DB->query("
(UserID,IP,LastAttempt,Attempts) VALUES INSERT INTO login_attempts (UserID,IP,LastAttempt,Attempts)
('".db_string($UserID)."','".db_string($IPStr)."','".sqltime()."',1)"); VALUES ('".db_string($UserID)."','".db_string($IPStr)."','".sqltime()."',1)");
} }
} // end log_attempt function } // end log_attempt function
@ -231,7 +236,7 @@ function log_attempt($UserID) {
header("Location: login.php"); header("Location: login.php");
die(); die();
} }
$Err=$Validate->ValidateForm($_POST); $Err = $Validate->ValidateForm($_POST);
if (!$Err) { if (!$Err) {
// Passes preliminary validation (username and password "look right") // Passes preliminary validation (username and password "look right")
@ -274,7 +279,7 @@ function log_attempt($UserID) {
isset($CustomPermissions['site_disable_ip_history']) isset($CustomPermissions['site_disable_ip_history'])
) { $_SERVER['REMOTE_ADDR'] = '127.0.0.1'; } ) { $_SERVER['REMOTE_ADDR'] = '127.0.0.1'; }
$DB->query("INSERT INTO users_sessions $DB->query("INSERT INTO users_sessions
(UserID, SessionID, KeepLogged, Browser, OperatingSystem, IP, LastUpdate, FullUA) (UserID, SessionID, KeepLogged, Browser, OperatingSystem, IP, LastUpdate, FullUA)
@ -290,11 +295,12 @@ function log_attempt($UserID) {
)); ));
$Cache->commit_transaction(0); $Cache->commit_transaction(0);
$Sql = "UPDATE users_main $Sql = "
UPDATE users_main
SET SET
LastLogin='".sqltime()."', LastLogin='".sqltime()."',
LastAccess='".sqltime()."'"; LastAccess='".sqltime()."'";
$Sql .= " WHERE ID='".db_string($UserID)."'"; $Sql .= " WHERE ID='".db_string($UserID)."'";
$DB->query($Sql); $DB->query($Sql);
@ -311,7 +317,7 @@ function log_attempt($UserID) {
} else { } else {
log_attempt($UserID); log_attempt($UserID);
if ($Enabled == 2) { if ($Enabled == 2) {
header('location:login.php?action=disabled'); header('location:login.php?action=disabled');
} elseif ($Enabled == 0) { } elseif ($Enabled == 0) {
$Err = "Your account has not been confirmed.<br />Please check your email."; $Err = "Your account has not been confirmed.<br />Please check your email.";
@ -320,7 +326,7 @@ function log_attempt($UserID) {
} }
} else { } else {
log_attempt($UserID); log_attempt($UserID);
$Err = "Your username or password was incorrect."; $Err = "Your username or password was incorrect.";
setcookie('keeplogged','',time() + 60 * 60 * 24 * 365,'/','',false); setcookie('keeplogged','',time() + 60 * 60 * 24 * 365,'/','',false);
} }

View File

@ -2,7 +2,7 @@
/* /*
if (isset($LoggedUser)) { if (isset($LoggedUser)) {
//Silly user, what are you doing here! //Silly user, what are you doing here!
header('Location: index.php'); header('Location: index.php');
die(); die();
@ -82,7 +82,7 @@
} }
$IPcc = Tools::geoip($_SERVER['REMOTE_ADDR']); $IPcc = Tools::geoip($_SERVER['REMOTE_ADDR']);
$DB->query("INSERT INTO users_main $DB->query("INSERT INTO users_main
(Username,Email,PassHash,torrent_pass,IP,PermissionID,Enabled,Invites,Uploaded,ipcc) VALUES (Username,Email,PassHash,torrent_pass,IP,PermissionID,Enabled,Invites,Uploaded,ipcc) VALUES
@ -104,7 +104,7 @@
(UserID, IP, StartTime) VALUES (UserID, IP, StartTime) VALUES
('$UserID', '".db_string($_SERVER['REMOTE_ADDR'])."', '".sqltime()."')"); ('$UserID', '".db_string($_SERVER['REMOTE_ADDR'])."', '".sqltime()."')");
$DB->query("INSERT INTO users_history_emails $DB->query("INSERT INTO users_history_emails
@ -197,7 +197,7 @@
Tracker::update_tracker('add_user', array('id' => $UserID, 'passkey' => $torrent_pass)); Tracker::update_tracker('add_user', array('id' => $UserID, 'passkey' => $torrent_pass));
$Sent = 1; $Sent = 1;
} }
} elseif ($_GET['invite']) { } elseif ($_GET['invite']) {

View File

@ -14,82 +14,84 @@
$DB->query("SELECT $DB->query("
r.ID, SELECT
r.ReporterID, r.ID,
reporter.Username, r.ReporterID,
r.TorrentID, reporter.Username,
r.Type, r.TorrentID,
r.UserComment, r.Type,
r.ResolverID, r.UserComment,
resolver.Username, r.ResolverID,
r.Status, resolver.Username,
r.ReportedTime, r.Status,
r.LastChangeTime, r.ReportedTime,
r.ModComment, r.LastChangeTime,
r.Track, r.ModComment,
r.Image, r.Track,
r.ExtraID, r.Image,
r.Link, r.ExtraID,
r.LogMessage, r.Link,
tg.Name, r.LogMessage,
tg.ID, tg.Name,
CASE COUNT(ta.GroupID) tg.ID,
WHEN 1 THEN aa.ArtistID CASE COUNT(ta.GroupID)
WHEN 0 THEN '0' WHEN 1 THEN aa.ArtistID
ELSE '0' WHEN 0 THEN '0'
END AS ArtistID, ELSE '0'
CASE COUNT(ta.GroupID) END AS ArtistID,
WHEN 1 THEN aa.Name CASE COUNT(ta.GroupID)
WHEN 0 THEN '' WHEN 1 THEN aa.Name
ELSE 'Various Artists' WHEN 0 THEN ''
END AS ArtistName, ELSE 'Various Artists'
tg.Year, END AS ArtistName,
tg.CategoryID, tg.Year,
t.Time, tg.CategoryID,
t.Remastered, t.Time,
t.RemasterTitle, t.Remastered,
t.RemasterYear, t.RemasterTitle,
t.Media, t.RemasterYear,
t.Format, t.Media,
t.Encoding, t.Format,
t.Size, t.Encoding,
t.HasCue, t.Size,
t.HasLog, t.HasCue,
t.LogScore, t.HasLog,
t.UserID AS UploaderID, t.LogScore,
t.Tasted, t.UserID AS UploaderID,
uploader.Username t.Tasted,
FROM reportsv2 AS r uploader.Username
LEFT JOIN torrents AS t ON t.ID=r.TorrentID FROM reportsv2 AS r
LEFT JOIN torrents_group AS tg ON tg.ID=t.GroupID LEFT JOIN torrents AS t ON t.ID=r.TorrentID
LEFT JOIN torrents_artists AS ta ON ta.GroupID=tg.ID AND ta.Importance='1' LEFT JOIN torrents_group AS tg ON tg.ID=t.GroupID
LEFT JOIN artists_alias AS aa ON aa.AliasID=ta.AliasID LEFT JOIN torrents_artists AS ta ON ta.GroupID=tg.ID AND ta.Importance='1'
LEFT JOIN users_main AS resolver ON resolver.ID=r.ResolverID LEFT JOIN artists_alias AS aa ON aa.AliasID=ta.AliasID
LEFT JOIN users_main AS reporter ON reporter.ID=r.ReporterID LEFT JOIN users_main AS resolver ON resolver.ID=r.ResolverID
LEFT JOIN users_main AS uploader ON uploader.ID=t.UserID LEFT JOIN users_main AS reporter ON reporter.ID=r.ReporterID
WHERE r.Status = 'New' LEFT JOIN users_main AS uploader ON uploader.ID=t.UserID
GROUP BY r.ID WHERE r.Status = 'New'
ORDER BY ReportedTime ASC GROUP BY r.ID
LIMIT 1"); ORDER BY ReportedTime ASC
LIMIT 1");
if ($DB->record_count() < 1) { if ($DB->record_count() < 1) {
die(); die();
} }
list($ReportID, $ReporterID, $ReporterName, $TorrentID, $Type, $UserComment, $ResolverID, $ResolverName, $Status, $ReportedTime, $LastChangeTime, list($ReportID, $ReporterID, $ReporterName, $TorrentID, $Type, $UserComment, $ResolverID, $ResolverName, $Status, $ReportedTime, $LastChangeTime,
$ModComment, $Tracks, $Images, $ExtraIDs, $Links, $LogMessage, $GroupName, $GroupID, $ArtistID, $ArtistName, $Year, $CategoryID, $Time, $Remastered, $RemasterTitle, $ModComment, $Tracks, $Images, $ExtraIDs, $Links, $LogMessage, $GroupName, $GroupID, $ArtistID, $ArtistName, $Year, $CategoryID, $Time, $Remastered, $RemasterTitle,
$RemasterYear, $Media, $Format, $Encoding, $Size, $HasCue, $HasLog, $LogScore, $UploaderID, $UploaderName) = $DB->next_record(MYSQLI_BOTH, array("ModComment")); $RemasterYear, $Media, $Format, $Encoding, $Size, $HasCue, $HasLog, $LogScore, $UploaderID, $UploaderName) = $DB->next_record(MYSQLI_BOTH, array("ModComment"));
if (!$GroupID) { if (!$GroupID) {
//Torrent already deleted //Torrent already deleted
$DB->query("UPDATE reportsv2 $DB->query("
SET Status='Resolved', UPDATE reportsv2
LastChangeTime='".sqltime()."', SET
ModComment='Report already dealt with (torrent deleted)' Status='Resolved',
WHERE ID=".$ReportID); LastChangeTime='".sqltime()."',
ModComment='Report already dealt with (torrent deleted)'
WHERE ID=".$ReportID);
?> ?>
<div> <div>
<table class="layout"> <table class="layout">
@ -250,7 +252,6 @@
$Extras = explode(' ', $ExtraIDs); $Extras = explode(' ', $ExtraIDs);
foreach ($Extras as $ExtraID) { foreach ($Extras as $ExtraID) {
$DB->query(" $DB->query("
SELECT SELECT
tg.Name, tg.Name,

View File

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

View File

@ -122,69 +122,70 @@
$DB->query("SELECT SQL_CALC_FOUND_ROWS $DB->query("
r.ID, SELECT SQL_CALC_FOUND_ROWS
r.ReporterID, r.ID,
reporter.Username, r.ReporterID,
r.TorrentID, reporter.Username,
r.Type, r.TorrentID,
r.UserComment, r.Type,
r.ResolverID, r.UserComment,
resolver.Username, r.ResolverID,
r.Status, resolver.Username,
r.ReportedTime, r.Status,
r.LastChangeTime, r.ReportedTime,
r.ModComment, r.LastChangeTime,
r.Track, r.ModComment,
r.Image, r.Track,
r.ExtraID, r.Image,
r.Link, r.ExtraID,
r.LogMessage, r.Link,
tg.Name, r.LogMessage,
tg.ID, tg.Name,
CASE COUNT(ta.GroupID) tg.ID,
WHEN 1 THEN aa.ArtistID CASE COUNT(ta.GroupID)
WHEN 0 THEN '0' WHEN 1 THEN aa.ArtistID
ELSE '0' WHEN 0 THEN '0'
END AS ArtistID, ELSE '0'
CASE COUNT(ta.GroupID) END AS ArtistID,
WHEN 1 THEN aa.Name CASE COUNT(ta.GroupID)
WHEN 0 THEN '' WHEN 1 THEN aa.Name
ELSE 'Various Artists' WHEN 0 THEN ''
END AS ArtistName, ELSE 'Various Artists'
tg.Year, END AS ArtistName,
tg.CategoryID, tg.Year,
t.Time, tg.CategoryID,
t.Remastered, t.Time,
t.RemasterTitle, t.Remastered,
t.RemasterYear, t.RemasterTitle,
t.Media, t.RemasterYear,
t.Format, t.Media,
t.Encoding, t.Format,
t.Size, t.Encoding,
t.HasCue, t.Size,
t.HasLog, t.HasCue,
t.LogScore, t.HasLog,
t.UserID AS UploaderID, t.LogScore,
uploader.Username t.UserID AS UploaderID,
FROM reportsv2 AS r uploader.Username
LEFT JOIN torrents AS t ON t.ID=r.TorrentID FROM reportsv2 AS r
LEFT JOIN torrents_group AS tg ON tg.ID=t.GroupID LEFT JOIN torrents AS t ON t.ID=r.TorrentID
LEFT JOIN torrents_artists AS ta ON ta.GroupID=tg.ID AND ta.Importance='1' LEFT JOIN torrents_group AS tg ON tg.ID=t.GroupID
LEFT JOIN artists_alias AS aa ON aa.AliasID=ta.AliasID LEFT JOIN torrents_artists AS ta ON ta.GroupID=tg.ID AND ta.Importance='1'
LEFT JOIN users_main AS resolver ON resolver.ID=r.ResolverID LEFT JOIN artists_alias AS aa ON aa.AliasID=ta.AliasID
LEFT JOIN users_main AS reporter ON reporter.ID=r.ReporterID LEFT JOIN users_main AS resolver ON resolver.ID=r.ResolverID
LEFT JOIN users_main AS uploader ON uploader.ID=t.UserID " LEFT JOIN users_main AS reporter ON reporter.ID=r.ReporterID
.$Where." LEFT JOIN users_main AS uploader ON uploader.ID=t.UserID
GROUP BY r.ID " $Where
.$Order." GROUP BY r.ID
LIMIT ".$Limit); $Order
LIMIT $Limit");
$Reports = $DB->to_array(); $Reports = $DB->to_array();
$DB->query('SELECT FOUND_ROWS()'); $DB->query('SELECT FOUND_ROWS()');
list($Results) = $DB->next_record(); 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'); View::show_header('Reports V2!', 'reportsv2,bbcode');
@ -222,19 +223,21 @@
<? <?
} else { } else {
foreach ($Reports as $Report) { foreach ($Reports as $Report) {
list($ReportID, $ReporterID, $ReporterName, $TorrentID, $Type, $UserComment, $ResolverID, $ResolverName, $Status, $ReportedTime, $LastChangeTime, list($ReportID, $ReporterID, $ReporterName, $TorrentID, $Type, $UserComment, $ResolverID, $ResolverName, $Status, $ReportedTime, $LastChangeTime,
$ModComment, $Tracks, $Images, $ExtraIDs, $Links, $LogMessage, $GroupName, $GroupID, $ArtistID, $ArtistName, $Year, $CategoryID, $Time, $Remastered, $RemasterTitle, $ModComment, $Tracks, $Images, $ExtraIDs, $Links, $LogMessage, $GroupName, $GroupID, $ArtistID, $ArtistName, $Year, $CategoryID, $Time, $Remastered, $RemasterTitle,
$RemasterYear, $Media, $Format, $Encoding, $Size, $HasCue, $HasLog, $LogScore, $UploaderID, $UploaderName) = Misc::display_array($Report, array("ModComment")); $RemasterYear, $Media, $Format, $Encoding, $Size, $HasCue, $HasLog, $LogScore, $UploaderID, $UploaderName) = Misc::display_array($Report, array("ModComment"));
if (!$GroupID && $Status != 'Resolved') { if (!$GroupID && $Status != 'Resolved') {
//Torrent already deleted //Torrent already deleted
$DB->query("UPDATE reportsv2 SET $DB->query("
Status='Resolved', UPDATE reportsv2
LastChangeTime='".sqltime()."', SET
ModComment='Report already dealt with (torrent deleted)' Status='Resolved',
WHERE ID=".$ReportID); LastChangeTime='".sqltime()."',
ModComment='Report already dealt with (torrent deleted)'
WHERE ID=".$ReportID);
$Cache->decrement('num_torrent_reportsv2'); $Cache->decrement('num_torrent_reportsv2');
?> ?>
<div id="report<?=$ReportID?>"> <div id="report<?=$ReportID?>">
@ -406,41 +409,41 @@
$Extras = explode(' ', $ExtraIDs); $Extras = explode(' ', $ExtraIDs);
foreach ($Extras as $ExtraID) { foreach ($Extras as $ExtraID) {
$DB->query("
$DB->query("SELECT SELECT
tg.Name, tg.Name,
tg.ID, tg.ID,
CASE COUNT(ta.GroupID) CASE COUNT(ta.GroupID)
WHEN 1 THEN aa.ArtistID WHEN 1 THEN aa.ArtistID
WHEN 0 THEN '0' WHEN 0 THEN '0'
ELSE '0' ELSE '0'
END AS ArtistID, END AS ArtistID,
CASE COUNT(ta.GroupID) CASE COUNT(ta.GroupID)
WHEN 1 THEN aa.Name WHEN 1 THEN aa.Name
WHEN 0 THEN '' WHEN 0 THEN ''
ELSE 'Various Artists' ELSE 'Various Artists'
END AS ArtistName, END AS ArtistName,
tg.Year, tg.Year,
t.Time, t.Time,
t.Remastered, t.Remastered,
t.RemasterTitle, t.RemasterTitle,
t.RemasterYear, t.RemasterYear,
t.Media, t.Media,
t.Format, t.Format,
t.Encoding, t.Encoding,
t.Size, t.Size,
t.HasCue, t.HasCue,
t.HasLog, t.HasLog,
t.LogScore, t.LogScore,
t.UserID AS UploaderID, t.UserID AS UploaderID,
uploader.Username uploader.Username
FROM torrents AS t FROM torrents AS t
LEFT JOIN torrents_group AS tg ON tg.ID=t.GroupID LEFT JOIN torrents_group AS tg ON tg.ID=t.GroupID
LEFT JOIN torrents_artists AS ta ON ta.GroupID=tg.ID AND ta.Importance='1' LEFT JOIN torrents_artists AS ta ON ta.GroupID=tg.ID AND ta.Importance='1'
LEFT JOIN artists_alias AS aa ON aa.AliasID=ta.AliasID LEFT JOIN artists_alias AS aa ON aa.AliasID=ta.AliasID
LEFT JOIN users_main AS uploader ON uploader.ID=t.UserID LEFT JOIN users_main AS uploader ON uploader.ID=t.UserID
WHERE t.ID='$ExtraID' WHERE t.ID='$ExtraID'
GROUP BY tg.ID"); GROUP BY tg.ID");
list($ExtraGroupName, $ExtraGroupID, $ExtraArtistID, $ExtraArtistName, $ExtraYear, $ExtraTime, $ExtraRemastered, $ExtraRemasterTitle, list($ExtraGroupName, $ExtraGroupID, $ExtraArtistID, $ExtraArtistName, $ExtraYear, $ExtraTime, $ExtraRemastered, $ExtraRemasterTitle,
$ExtraRemasterYear, $ExtraMedia, $ExtraFormat, $ExtraEncoding, $ExtraSize, $ExtraHasCue, $ExtraHasLog, $ExtraLogScore, $ExtraUploaderID, $ExtraUploaderName) = Misc::display_array($DB->next_record()); $ExtraRemasterYear, $ExtraMedia, $ExtraFormat, $ExtraEncoding, $ExtraSize, $ExtraHasCue, $ExtraHasLog, $ExtraLogScore, $ExtraUploaderID, $ExtraUploaderName) = Misc::display_array($DB->next_record());

View File

@ -62,7 +62,7 @@
// Subtract amount from user // Subtract amount from user
$DB->query("UPDATE users_main SET Uploaded = (Uploaded - $Amount) WHERE ID = ".$LoggedUser['ID']); $DB->query("UPDATE users_main SET Uploaded = (Uploaded - $Amount) WHERE ID = ".$LoggedUser['ID']);
$Cache->delete_value('user_stats_'.$LoggedUser['ID']); $Cache->delete_value('user_stats_'.$LoggedUser['ID']);
Requests::update_sphinx_requests($RequestID); Requests::update_sphinx_requests($RequestID);
echo 'success'; echo 'success';
} elseif ($LoggedUser['BytesUploaded'] < $Amount) { } elseif ($LoggedUser['BytesUploaded'] < $Amount) {

View File

@ -361,7 +361,7 @@
</ul> </ul>
</li> </li>
</ul> </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>
<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.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> <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

@ -302,7 +302,7 @@ function next_hour() {
$AgoMins = time_minus(60 * 30); $AgoMins = time_minus(60 * 30);
$AgoDays = time_minus(3600 * 24 * 30); $AgoDays = time_minus(3600 * 24 * 30);
$SessionQuery = $DB->query("SELECT UserID, SessionID $SessionQuery = $DB->query("SELECT UserID, SessionID
FROM users_sessions FROM users_sessions
@ -316,7 +316,7 @@ function next_hour() {
$Cache->commit_transaction(0); $Cache->commit_transaction(0);
} }
//------------- Lower Login Attempts ------------------------------------// //------------- Lower Login Attempts ------------------------------------//
$DB->query("UPDATE login_attempts SET Attempts=Attempts-1 WHERE Attempts>0"); $DB->query("UPDATE login_attempts SET Attempts=Attempts-1 WHERE Attempts>0");
$DB->query("DELETE FROM login_attempts WHERE LastAttempt<'".time_minus(3600 * 24 * 90)."'"); $DB->query("DELETE FROM login_attempts WHERE LastAttempt<'".time_minus(3600 * 24 * 90)."'");
@ -593,7 +593,7 @@ function next_hour() {
i.AdminComment=CONCAT('$sqltime - Leeching ability disabled by ratio watch system - required ratio: ', m.RequiredRatio,'', i.AdminComment) i.AdminComment=CONCAT('$sqltime - Leeching ability disabled by ratio watch system - required ratio: ', m.RequiredRatio,'', i.AdminComment)
WHERE m.ID IN(".implode(',',$UserIDs).")"); WHERE m.ID IN(".implode(',',$UserIDs).")");
$DB->query("DELETE FROM users_torrent_history WHERE UserID IN (".implode(',',$UserIDs).")"); $DB->query("DELETE FROM users_torrent_history WHERE UserID IN (".implode(',',$UserIDs).")");
} }
@ -770,7 +770,7 @@ function next_hour() {
// Exceptions for inactivity deletion // Exceptions for inactivity deletion
$InactivityExceptionsMade = array(//UserID => expiry time of exception $InactivityExceptionsMade = array(//UserID => expiry time of exception
); );
foreach ($TorrentIDs as $TorrentID) { foreach ($TorrentIDs as $TorrentID) {
list($ID, $GroupID, $Name, $ArtistName, $LastAction, $Format, $Encoding, $UserID, $Media, $InfoHash) = $TorrentID; list($ID, $GroupID, $Name, $ArtistName, $LastAction, $Format, $Encoding, $UserID, $Media, $InfoHash) = $TorrentID;
@ -821,7 +821,7 @@ function next_hour() {
$DB->query("DELETE FROM artists_similar_votes WHERE SimilarID IN($SimilarIDs)"); $DB->query("DELETE FROM artists_similar_votes WHERE SimilarID IN($SimilarIDs)");
} }
// Daily top 10 history. // Daily top 10 history.
$DB->query("INSERT INTO top10_history (Date, Type) VALUES ('".$sqltime."', 'Daily')"); $DB->query("INSERT INTO top10_history (Date, Type) VALUES ('".$sqltime."', 'Daily')");

View File

@ -70,7 +70,7 @@
AssignedToUser=$NewLevel, AssignedToUser=$NewLevel,
Level=$Level Level=$Level
WHERE ID=$ConvID"); WHERE ID=$ConvID");
} }
echo '1'; echo '1';

View File

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

View File

@ -59,14 +59,14 @@
} }
if (!$PlatformDistribution = $Cache->get_value('platform_distribution')) { if (!$PlatformDistribution = $Cache->get_value('platform_distribution')) {
include_once(SERVER_ROOT.'/classes/class_charts.php'); include_once(SERVER_ROOT.'/classes/class_charts.php');
$DB->query(" $DB->query("
SELECT OperatingSystem, COUNT(UserID) AS Users SELECT OperatingSystem, COUNT(UserID) AS Users
FROM users_sessions FROM users_sessions
GROUP BY OperatingSystem GROUP BY OperatingSystem
ORDER BY Users DESC"); ORDER BY Users DESC");
$Platforms = $DB->to_array(); $Platforms = $DB->to_array();
$Pie = new PIE_CHART(750,400,array('Other'=>1,'Percentage'=>1)); $Pie = new PIE_CHART(750,400,array('Other'=>1,'Percentage'=>1));
foreach ($Platforms as $Platform) { foreach ($Platforms as $Platform) {
@ -82,7 +82,7 @@
if (!$BrowserDistribution = $Cache->get_value('browser_distribution')) { if (!$BrowserDistribution = $Cache->get_value('browser_distribution')) {
include_once(SERVER_ROOT.'/classes/class_charts.php'); include_once(SERVER_ROOT.'/classes/class_charts.php');
$DB->query(" $DB->query("
SELECT Browser, COUNT(UserID) AS Users SELECT Browser, COUNT(UserID) AS Users

View File

@ -163,7 +163,7 @@
$DB->query("INSERT INTO news (UserID, Title, Body, Time) $DB->query("INSERT INTO news (UserID, Title, Body, Time)
VALUES ('$LoggedUser[ID]', '".db_string($_POST['title'])."', '".db_string($_POST['body'])."', '".sqltime()."')"); VALUES ('$LoggedUser[ID]', '".db_string($_POST['title'])."', '".db_string($_POST['body'])."', '".sqltime()."')");
$Cache->cache_value('news_latest_id', $DB->inserted_id(), 0); $Cache->cache_value('news_latest_id', $DB->inserted_id(), 0);
$Cache->delete_value('news'); $Cache->delete_value('news');

View File

@ -51,7 +51,7 @@
<tr><td><a href="tools.php?action=registration_log">Registration log</a></td></tr> <tr><td><a href="tools.php?action=registration_log">Registration log</a></td></tr>
<? } if (check_perms('users_view_invites')) { ?> <? } if (check_perms('users_view_invites')) { ?>
<tr><td><a href="tools.php?action=invite_pool">Invite pool</a></td></tr> <tr><td><a href="tools.php?action=invite_pool">Invite pool</a></td></tr>
<? } if (check_perms('site_view_flow')) { ?> <? } if (check_perms('site_view_flow')) { ?>
<tr><td><a href="tools.php?action=upscale_pool">Upscale pool</a></td></tr> <tr><td><a href="tools.php?action=upscale_pool">Upscale pool</a></td></tr>
<tr><td><a href="tools.php?action=user_flow">User flow</a></td></tr> <tr><td><a href="tools.php?action=user_flow">User flow</a></td></tr>
@ -74,7 +74,7 @@
<? } <? }
if (check_perms('users_mod')) { ?> if (check_perms('users_mod')) { ?>
<tr><td><a href="tools.php?action=manipulate_tree">Manipulate tree</a></td></tr> <tr><td><a href="tools.php?action=manipulate_tree">Manipulate tree</a></td></tr>
<? } <? }
if (check_perms('admin_update_geoip')) { ?> if (check_perms('admin_update_geoip')) { ?>
<tr><td><a href="tools.php?action=update_geoip">Update GeoIP </a></td></tr> <tr><td><a href="tools.php?action=update_geoip">Update GeoIP </a></td></tr>
<? } if (check_perms('admin_create_users')) { ?> <? } if (check_perms('admin_create_users')) { ?>

View File

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

View File

@ -542,11 +542,10 @@ function filelist($Str) {
| <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) { ?> <? 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']) { ?> 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> ]</span>
&raquo; <a href="#" onclick="$('#torrent_<?=$TorrentID?>').toggle(); return false;"><?=$ExtraInfo; ?></a> &raquo; <a href="#" onclick="$('#torrent_<?=$TorrentID?>').toggle(); return false;"><?=$ExtraInfo; ?></a>
@ -561,18 +560,17 @@ function filelist($Str) {
<div id="release_<?=$TorrentID?>" class="no_overflow"> <div id="release_<?=$TorrentID?>" class="no_overflow">
<blockquote> <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 ($Seeders == 0) {
<? if ($LastActive != '0000-00-00 00:00:00' && time() - strtotime($LastActive) >= 1209600) { ?>
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 { ?> <? } 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) { ?> 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> </blockquote>
</div> </div>
<? if (check_perms('site_moderate_requests')) { ?> <? if (check_perms('site_moderate_requests')) { ?>
@ -585,7 +583,7 @@ function filelist($Str) {
<? if (check_perms('site_view_torrent_snatchlist')) { ?> <? 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_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_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) { ?> <? 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>

View File

@ -458,8 +458,8 @@ function filelist($Str) {
$EditionID++; $EditionID++;
?> ?>
<tr class="releases_<?= $ReleaseType ?> groupid_<?= $GroupID ?> edition group_torrent"> <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> <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> </tr>
<? <?
} }
@ -469,65 +469,65 @@ function filelist($Str) {
$LastRemasterCatalogueNumber = $RemasterCatalogueNumber; $LastRemasterCatalogueNumber = $RemasterCatalogueNumber;
$LastMedia = $Media; $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> <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)) { ?> <? 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) { ?> <? 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']) { ?> 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> ]</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>
<td class="nobr"><?= Format::get_size($Size) ?></td> <td class="nobr"><?=(Format::get_size($Size))?></td>
<td><?= number_format($Snatched) ?></td> <td><?=(number_format($Snatched))?></td>
<td><?= number_format($Seeders) ?></td> <td><?=(number_format($Seeders))?></td>
<td><?= number_format($Leechers) ?></td> <td><?=(number_format($Leechers))?></td>
</tr> </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"> <td colspan="5">
<blockquote> <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 ($Seeders == 0) {
if ($LastActive != '0000-00-00 00:00:00' && time() - strtotime($LastActive) >= 1209600) { ?> 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 { ?> <? } 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) { ?> 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> </blockquote>
<? if (check_perms('site_moderate_requests')) { ?> <? if (check_perms('site_moderate_requests')) { ?>
<div class="linkbox"> <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>
<? } ?> <? } ?>
<div class="linkbox"> <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')) { ?> <? 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_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_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) { ?> <? 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>
<div id="peers_<?= $TorrentID ?>" class="hidden"></div> <div id="peers_<?=($TorrentID)?>" class="hidden"></div>
<div id="downloads_<?= $TorrentID ?>" class="hidden"></div> <div id="downloads_<?=($TorrentID)?>" class="hidden"></div>
<div id="snatches_<?= $TorrentID ?>" class="hidden"></div> <div id="snatches_<?=($TorrentID)?>" class="hidden"></div>
<div id="files_<?= $TorrentID ?>" class="hidden"><?= $FileTable ?></div> <div id="files_<?=($TorrentID)?>" class="hidden"><?=($FileTable)?></div>
<? if ($Reported) { ?> <? if ($Reported) { ?>
<div id="reported_<?= $TorrentID ?>" class="hidden"><?= $ReportInfo ?></div> <div id="reported_<?=($TorrentID)?>" class="hidden"><?=($ReportInfo)?></div>
<? } <? }
if (!empty($Description)) { if (!empty($Description)) {
echo '<blockquote>' . $Text->full_format($Description) . '</blockquote>'; echo '<blockquote>' . $Text->full_format($Description) . '</blockquote>';

View File

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

View File

@ -17,7 +17,7 @@
if (empty($_GET['type'])) { if (empty($_GET['type'])) {
error(0); error(0);
} else { } else {
switch ($_GET['type']) { switch ($_GET['type']) {
case 'uploads': case 'uploads':
if (!check_paranoia('uploads', $User['Paranoia'], $UserClass, $UserID)) { if (!check_paranoia('uploads', $User['Paranoia'], $UserClass, $UserID)) {
@ -45,19 +45,20 @@
} }
} }
$DownloadsQ = $DB->query("SELECT $DownloadsQ = $DB->query("
t.ID AS TorrentID, SELECT
DATE_FORMAT(".$Month.",'%Y - %m') AS Month, t.ID AS TorrentID,
t.GroupID, DATE_FORMAT($Month,'%Y - %m') AS Month,
t.Media, t.GroupID,
t.Format, t.Media,
t.Encoding, t.Format,
IF(t.RemasterYear=0,tg.Year,t.RemasterYear) AS Year, t.Encoding,
tg.Name, IF(t.RemasterYear=0,tg.Year,t.RemasterYear) AS Year,
t.Size tg.Name,
t.Size
FROM torrents as t FROM torrents as t
JOIN torrents_group AS tg ON t.GroupID=tg.ID JOIN torrents_group AS tg ON t.GroupID=tg.ID
".$SQL." $SQL
GROUP BY TorrentID"); GROUP BY TorrentID");
$Collector = new TorrentsDL($DownloadsQ, "$Username's ".ucfirst($_GET['type'])); $Collector = new TorrentsDL($DownloadsQ, "$Username's ".ucfirst($_GET['type']));
@ -65,7 +66,10 @@
while (list($Downloads, $GroupIDs) = $Collector->get_downloads('TorrentID')) { while (list($Downloads, $GroupIDs) = $Collector->get_downloads('TorrentID')) {
$Artists = Artists::get_artists($GroupIDs); $Artists = Artists::get_artists($GroupIDs);
$TorrentIDs = array_keys($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)) { if (is_int($TorrentFilesQ)) {
// Query failed. Let's not create a broken zip archive // Query failed. Let's not create a broken zip archive
foreach ($TorrentIDs as $TorrentID) { 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) { if (!empty($_GET['page']) && is_number($_GET['page']) && $_GET['page'] > 0) {
$Page = $_GET['page']; $Page = $_GET['page'];
$Limit = ($Page-1)*TORRENTS_PER_PAGE.', '.TORRENTS_PER_PAGE; $Limit = ($Page - 1) * TORRENTS_PER_PAGE.', '.TORRENTS_PER_PAGE;
} else { } else {
$Page = 1; $Page = 1;
$Limit = TORRENTS_PER_PAGE; $Limit = TORRENTS_PER_PAGE;
@ -461,7 +461,7 @@ function header_link($SortKey,$DefaultWay="DESC") {
extract(Torrents::array_group($Results[$GroupID])); extract(Torrents::array_group($Results[$GroupID]));
$Torrent = $Torrents[$TorrentID]; $Torrent = $Torrents[$TorrentID];
$TorrentTags = new Tags($TagList); $TorrentTags = new Tags($TagList);
@ -512,7 +512,7 @@ function header_link($SortKey,$DefaultWay="DESC") {
<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> <td><?=number_format($Torrent['Leechers'])?></td>
</tr> </tr>
<? } ?> <? }?>
</table> </table>
<? } ?> <? } ?>
<div class="linkbox"><?=$Pages?></div> <div class="linkbox"><?=$Pages?></div>

View File

@ -5,12 +5,12 @@
$TotalVotes = $GroupVotes['Total']; $TotalVotes = $GroupVotes['Total'];
$UpVotes = $GroupVotes['Ups']; $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="box" id="votes">
<div class="head"><strong>Album votes</strong></div> <div class="head"><strong>Album votes</strong></div>
<div class="album_votes body"> <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 /> <br /><br />
<? if (check_perms('site_album_votes')) { ?> <? 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> <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

@ -22,7 +22,7 @@
Tracker::update_tracker('add_torrent', array('id' => $ExtraTorrentID, 'info_hash' => rawurlencode($ExtraTorrent['InfoHash']), 'freetorrent' => $T['FreeLeech'])); Tracker::update_tracker('add_torrent', array('id' => $ExtraTorrentID, 'info_hash' => rawurlencode($ExtraTorrent['InfoHash']), 'freetorrent' => $T['FreeLeech']));
//******************************************************************************// //******************************************************************************//
//--------------- Write torrent file -------------------------------------------// //--------------- Write torrent file -------------------------------------------//

View File

@ -195,27 +195,30 @@ function num_compare($Field, $Operand, $Num1, $Num2 = '') {
$Order = ''; $Order = '';
$SQL = 'SQL_CALC_FOUND_ROWS $SQL = '
um1.ID, SQL_CALC_FOUND_ROWS
um1.Username, um1.ID,
um1.Uploaded, um1.Username,
um1.Downloaded,'; um1.Uploaded,
um1.Downloaded,';
if ($_GET['snatched'] == "off") { if ($_GET['snatched'] == "off") {
$SQL .= "'X' AS Snatches,"; $SQL .= "'X' AS Snatches,";
} else { } else {
$SQL .= "(SELECT COUNT(uid) FROM xbt_snatched AS xs WHERE xs.uid=um1.ID) AS Snatches,"; $SQL .= "(SELECT COUNT(uid) FROM xbt_snatched AS xs WHERE xs.uid=um1.ID) AS Snatches,";
} }
$SQL .= 'um1.PermissionID, $SQL .= '
um1.Email, um1.PermissionID,
um1.Enabled, um1.Email,
um1.IP, um1.Enabled,
um1.Invites, um1.IP,
ui1.DisableInvites, um1.Invites,
ui1.Warned, ui1.DisableInvites,
ui1.Donor, ui1.Warned,
ui1.JoinDate, ui1.Donor,
um1.LastAccess ui1.JoinDate,
FROM users_main AS um1 JOIN users_info AS ui1 ON ui1.UserID=um1.ID '; um1.LastAccess
FROM users_main AS um1
JOIN users_info AS ui1 ON ui1.UserID=um1.ID ';
if (!empty($_GET['username'])) { if (!empty($_GET['username'])) {
@ -225,17 +228,19 @@ function num_compare($Field, $Operand, $Num1, $Num2 = '') {
if (!empty($_GET['email'])) { if (!empty($_GET['email'])) {
if (isset($_GET['email_history'])) { if (isset($_GET['email_history'])) {
$Distinct = 'DISTINCT '; $Distinct = 'DISTINCT ';
$Join['he']=' JOIN users_history_emails AS he ON he.UserID=um1.ID '; $Join['he'] = ' JOIN users_history_emails AS he ON he.UserID=um1.ID ';
$Where[]= ' he.Email '.$Match.wrap($_GET['email']); $Where[] = ' he.Email '.$Match.wrap($_GET['email']);
} else { } 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'])) { 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') { if ($_GET['emails_opt'] === 'equal') {
$operator = '='; $operator = '=';
} }
@ -249,7 +254,7 @@ function num_compare($Field, $Operand, $Num1, $Num2 = '') {
$DB->query($Query); $DB->query($Query);
$Users = implode(',', $DB->collect('UserID')); $Users = implode(',', $DB->collect('UserID'));
if (!empty($Users)) { 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 (!empty($_GET['ip'])) {
if (isset($_GET['ip_history'])) { if (isset($_GET['ip_history'])) {
$Distinct = 'DISTINCT '; $Distinct = 'DISTINCT ';
$Join['hi']=' JOIN users_history_ips AS hi ON hi.UserID=um1.ID '; $Join['hi'] = ' JOIN users_history_ips AS hi ON hi.UserID=um1.ID ';
$Where[]= ' hi.IP '.$Match.wrap($_GET['ip'], '', true); $Where[] = ' hi.IP '.$Match.wrap($_GET['ip'], '', true);
} else { } else {
$Where[]='um1.IP'.$Match.wrap($_GET['ip'], '', true); $Where[] = 'um1.IP'.$Match.wrap($_GET['ip'], '', true);
} }
} }
if (!empty($_GET['cc'])) { if (!empty($_GET['cc'])) {
if ($_GET['cc_op'] == "equal") { if ($_GET['cc_op'] == "equal") {
$Where[]="um1.ipcc = '".db_string($_GET['cc'])."'"; $Where[] = "um1.ipcc = '".db_string($_GET['cc'])."'";
} else { } else {
$Where[]="um1.ipcc != '".db_string($_GET['cc'])."'"; $Where[] = "um1.ipcc != '".db_string($_GET['cc'])."'";
} }
} }
if (!empty($_GET['tracker_ip'])) { if (!empty($_GET['tracker_ip'])) {
$Distinct = 'DISTINCT '; $Distinct = 'DISTINCT ';
$Join['xfu']=' JOIN xbt_files_users AS xfu ON um1.ID=xfu.uid '; $Join['xfu'] = ' JOIN xbt_files_users AS xfu ON um1.ID=xfu.uid ';
$Where[]= ' xfu.ip '.$Match.wrap($_GET['tracker_ip'], '', true); $Where[] = ' xfu.ip '.$Match.wrap($_GET['tracker_ip'], '', true);
} }
// if (!empty($_GET['tracker_ip'])) { // if (!empty($_GET['tracker_ip'])) {
// $Distinct = 'DISTINCT '; // $Distinct = 'DISTINCT ';
// $Join['xs']=' JOIN xbt_snatched AS xs ON um1.ID=xs.uid '; // $Join['xs'] = ' JOIN xbt_snatched AS xs ON um1.ID=xs.uid ';
// $Where[]= ' xs.IP '.$Match.wrap($_GET['ip']); // $Where[] = ' xs.IP '.$Match.wrap($_GET['ip']);
// } // }
if (!empty($_GET['comment'])) { if (!empty($_GET['comment'])) {
$Where[]='ui1.AdminComment'.$Match.wrap($_GET['comment']); $Where[] = 'ui1.AdminComment'.$Match.wrap($_GET['comment']);
} }
if (!empty($_GET['lastfm'])) { if (!empty($_GET['lastfm'])) {
@ -300,27 +303,27 @@ function num_compare($Field, $Operand, $Num1, $Num2 = '') {
if (strlen($_GET['invites1'])) { if (strlen($_GET['invites1'])) {
$Invites1 = round($_GET['invites1']); $Invites1 = round($_GET['invites1']);
$Invites2 = round($_GET['invites2']); $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') { if ($_GET['disabled_invites'] == 'yes') {
$Where[]='ui1.DisableInvites=\'1\''; $Where[] = 'ui1.DisableInvites=\'1\'';
} elseif ($_GET['disabled_invites'] == 'no') { } elseif ($_GET['disabled_invites'] == 'no') {
$Where[]='ui1.DisableInvites=\'0\''; $Where[] = 'ui1.DisableInvites=\'0\'';
} }
if ($_GET['disabled_uploads'] == 'yes') { if ($_GET['disabled_uploads'] == 'yes') {
$Where[]='ui1.DisableUpload=\'1\''; $Where[] = 'ui1.DisableUpload=\'1\'';
} elseif ($_GET['disabled_uploads'] == 'no') { } elseif ($_GET['disabled_uploads'] == 'no') {
$Where[]='ui1.DisableUpload=\'0\''; $Where[] = 'ui1.DisableUpload=\'0\'';
} }
if ($_GET['join1']) { 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']) { 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']) { if ($_GET['ratio1']) {
@ -328,16 +331,16 @@ function num_compare($Field, $Operand, $Num1, $Num2 = '') {
if (!$Decimals) { if (!$Decimals) {
$Decimals = 0; $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'])) { if (strlen($_GET['uploaded1'])) {
$Upload1 = round($_GET['uploaded1']); $Upload1 = round($_GET['uploaded1']);
$Upload2 = round($_GET['uploaded2']); $Upload2 = round($_GET['uploaded2']);
if ($_GET['uploaded']!='buffer') { if ($_GET['uploaded'] != 'buffer') {
$Where[]=implode(' AND ', num_compare('ROUND(Uploaded/1024/1024/1024)', $_GET['uploaded'], $Upload1, $Upload2)); $Where[] = implode(' AND ', num_compare('ROUND(Uploaded/1024/1024/1024)', $_GET['uploaded'], $Upload1, $Upload2));
} else { } 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));
} }
} }
@ -360,7 +363,6 @@ function num_compare($Field, $Operand, $Num1, $Num2 = '') {
if ($_GET['class'] != '') { if ($_GET['class'] != '') {
$Where[]='um1.PermissionID='.wrap($_GET['class'], '='); $Where[]='um1.PermissionID='.wrap($_GET['class'], '=');
} }
if ($_GET['secclass'] != '') { if ($_GET['secclass'] != '') {
$Join['ul']=' JOIN users_levels AS ul ON um1.ID=ul.UserID '; $Join['ul']=' JOIN users_levels AS ul ON um1.ID=ul.UserID ';

View File

@ -2,10 +2,11 @@
// These stats used to be all together in one UNION'd query // 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. // But we broke them up because they had a habit of locking each other to death.
// They all run really quickly anyways. // They all run really quickly anyways.
$DB->query("SELECT COUNT(x.uid), COUNT(DISTINCT x.fid) $DB->query("
FROM xbt_snatched AS x SELECT COUNT(x.uid), COUNT(DISTINCT x.fid)
INNER JOIN torrents AS t ON t.ID=x.fid FROM xbt_snatched AS x
WHERE x.uid='$UserID'"); INNER JOIN torrents AS t ON t.ID=x.fid
WHERE x.uid='$UserID'");
list($Snatched, $UniqueSnatched) = $DB->next_record(); list($Snatched, $UniqueSnatched) = $DB->next_record();
$DB->query("SELECT COUNT(ID) FROM torrents_comments WHERE AuthorID='$UserID'"); $DB->query("SELECT COUNT(ID) FROM torrents_comments WHERE AuthorID='$UserID'");
@ -20,27 +21,30 @@
$DB->query("SELECT COUNT(ID) FROM collages WHERE Deleted='0' AND UserID='$UserID'"); $DB->query("SELECT COUNT(ID) FROM collages WHERE Deleted='0' AND UserID='$UserID'");
list($NumCollages) = $DB->next_record(); list($NumCollages) = $DB->next_record();
$DB->query("SELECT COUNT(DISTINCT CollageID) $DB->query("
FROM collages_torrents AS ct SELECT COUNT(DISTINCT CollageID)
JOIN collages ON CollageID = ID FROM collages_torrents AS ct
WHERE Deleted='0' AND ct.UserID='$UserID'"); JOIN collages ON CollageID = ID
WHERE Deleted='0'
AND ct.UserID='$UserID'");
list($NumCollageContribs) = $DB->next_record(); list($NumCollageContribs) = $DB->next_record();
$DB->query("SELECT COUNT(DISTINCT GroupID) FROM torrents WHERE UserID = '$UserID'"); $DB->query("SELECT COUNT(DISTINCT GroupID) FROM torrents WHERE UserID = '$UserID'");
list($UniqueGroups) = $DB->next_record(); list($UniqueGroups) = $DB->next_record();
$DB->query("SELECT COUNT(ID) $DB->query("
FROM torrents SELECT COUNT(ID)
WHERE ((LogScore = 100 AND Format = 'FLAC') FROM torrents
OR (Media = 'Vinyl' AND Format = 'FLAC') WHERE ((LogScore = 100 AND Format = 'FLAC')
OR (Media = 'WEB' AND Format = 'FLAC') OR (Media = 'Vinyl' AND Format = 'FLAC')
OR (Media = 'DVD' AND Format = 'FLAC') OR (Media = 'WEB' AND Format = 'FLAC')
OR (Media = 'Soundboard' AND Format = 'FLAC') OR (Media = 'DVD' AND Format = 'FLAC')
OR (Media = 'Cassette' AND Format = 'FLAC') OR (Media = 'Soundboard' AND Format = 'FLAC')
OR (Media = 'SACD' AND Format = 'FLAC') OR (Media = 'Cassette' AND Format = 'FLAC')
OR (Media = 'Blu-ray' AND Format = 'FLAC') OR (Media = 'SACD' AND Format = 'FLAC')
OR (Media = 'DAT' AND Format = 'FLAC')) OR (Media = 'Blu-ray' AND Format = 'FLAC')
AND UserID = '$UserID'"); OR (Media = 'DAT' AND Format = 'FLAC'))
AND UserID = '$UserID'");
list($PerfectFLACs) = $DB->next_record(); list($PerfectFLACs) = $DB->next_record();
?> ?>
<div class="box box_info box_userinfo_community"> <div class="box box_info box_userinfo_community">
@ -48,33 +52,33 @@
<ul class="stats nobullet"> <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> <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+'))) { ?> <? 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')) { ?> <? 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>
<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')) { ?> <? 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>
<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')) { ?> <? 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> </li>
<? } <? }
if (($Override = check_paranoia_here('collages+'))) { ?> 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'))) { ?> <? 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> </li>
<? } <? }
if (($Override = check_paranoia_here('collagecontribs+'))) { ?> 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'))) { ?> <? 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> </li>
<? } <? }
@ -92,9 +96,9 @@
<li>Requests filled: <?=number_format($RequestsFilled)?> for <?=Format::get_size($TotalBounty)?></li> <li>Requests filled: <?=number_format($RequestsFilled)?> for <?=Format::get_size($TotalBounty)?></li>
<? } elseif ($ViewAll) { ?> <? } elseif ($ViewAll) { ?>
<li> <li>
<span<?= ($ViewCount === 2) ? ' class="paranoia_override"' : ''?>>Requests filled: <?=number_format($RequestsFilled)?></span> <span<?=(($ViewCount === 2) ? ' class="paranoia_override"' : '')?>>Requests filled: <?=number_format($RequestsFilled)?></span>
<span<?= ($ViewBounty === 2) ? ' class="paranoia_override"' : ''?>> for <?=Format::get_size($TotalBounty) ?></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> <a href="requests.php?type=filled&amp;userid=<?=$UserID?>" class="brackets<?=(($ViewAll === 2) ? ' paranoia_override' : '')?>" title="View">View</a>
</li> </li>
<? } <? }
@ -114,57 +118,59 @@
<li>Requests voted: <?=number_format($RequestsVoted)?> for <?=Format::get_size($TotalSpent)?></li> <li>Requests voted: <?=number_format($RequestsVoted)?> for <?=Format::get_size($TotalSpent)?></li>
<? } elseif ($ViewAll) { ?> <? } elseif ($ViewAll) { ?>
<li> <li>
<span<?= ($ViewCount === 2) ? ' class="paranoia_override"' : ''?>>Requests created: <?=number_format($RequestsCreated)?></span> <span<?=(($ViewCount === 2) ? ' class="paranoia_override"' : '')?>>Requests created: <?=number_format($RequestsCreated)?></span>
<span<?= ($ViewBounty === 2) ? ' class="paranoia_override"' : ''?>> for <?=Format::get_size($RequestsCreatedSpent)?></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> <a href="requests.php?type=created&amp;userid=<?=$UserID?>" class="brackets<?=(($ViewAll === 2) ? ' paranoia_override' : '')?>" title="View">View</a>
</li> </li>
<li> <li>
<span<?= ($ViewCount === 2) ? ' class="paranoia_override"' : ''?>>Requests voted: <?=number_format($RequestsVoted)?></span> <span<?=(($ViewCount === 2) ? ' class="paranoia_override"' : '')?>>Requests voted: <?=number_format($RequestsVoted)?></span>
<span<?= ($ViewBounty === 2) ? ' class="paranoia_override"' : ''?>> for <?=Format::get_size($TotalSpent)?></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> <a href="requests.php?type=voted&amp;userid=<?=$UserID?>" class="brackets<?=(($ViewAll === 2) ? ' paranoia_override' : '')?>" title="View">View</a>
</li> </li>
<? } <? }
if (($Override = check_paranoia_here('uploads+'))) { ?> 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'))) { ?> <? 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')) { ?> <? 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> </li>
<? } <? }
if (($Override = check_paranoia_here('uniquegroups+'))) { ?> 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'))) { ?> <? 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> </li>
<? } <? }
if (($Override = check_paranoia_here('perfectflacs+'))) { ?> 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'))) { ?> <? 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> </li>
<? } <? }
if (check_paranoia_here('seeding+') || check_paranoia_here('leeching+')) { if (check_paranoia_here('seeding+') || check_paranoia_here('leeching+')) {
$DB->query("SELECT IF(remaining=0,'Seeding','Leeching') AS Type, COUNT(x.uid) $DB->query("
FROM xbt_files_users AS x SELECT IF(remaining=0,'Seeding','Leeching') AS Type, COUNT(x.uid)
INNER JOIN torrents AS t ON t.ID=x.fid FROM xbt_files_users AS x
WHERE x.uid='$UserID' AND x.active=1 INNER JOIN torrents AS t ON t.ID=x.fid
GROUP BY Type"); WHERE x.uid='$UserID'
AND x.active=1
GROUP BY Type");
$PeerCount = $DB->to_array(0, MYSQLI_NUM, false); $PeerCount = $DB->to_array(0, MYSQLI_NUM, false);
$Seeding = isset($PeerCount['Seeding'][1]) ? $PeerCount['Seeding'][1] : 0; $Seeding = (isset($PeerCount['Seeding'][1]) ? $PeerCount['Seeding'][1] : 0);
$Leeching = isset($PeerCount['Leeching'][1]) ? $PeerCount['Leeching'][1] : 0; $Leeching = (isset($PeerCount['Leeching'][1]) ? $PeerCount['Leeching'][1] : 0);
} ?> } ?>
<? if (($Override = check_paranoia_here('seeding+'))) { ?> <? 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'))) { <? if (($AOverride = check_paranoia_here('seeding'))) {
echo ((($Override = check_paranoia_here('snatched')) && $UniqueSnatched > 0 ) echo ((($Override = check_paranoia_here('snatched')) && $UniqueSnatched > 0 )
? '<span'.($Override === 2 ? ' class="paranoia_override"' : '').'> (' . 100 * min(1,round($Seeding / $UniqueSnatched,2)).'%)</span>' : ''); ?> ? '<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> <a href="torrents.php?type=seeding&amp;userid=<?=$UserID?>" class="brackets<?=($AOverride === 2 ? ' paranoia_override' : '')?>" title="View">View</a>
<? if (check_perms('zip_downloader')) { ?> <? 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> <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> </li>
<? } <? }
if (($Override = check_paranoia_here('leeching+'))) { ?> 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'))) { ?> <? 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>' : '' echo ($DisableLeech == 0 && check_perms('users_view_ips')) ? ' <strong>(Disabled)</strong>' : ''
?> ?>
</li> </li>
<? } <? }
if (($Override = check_paranoia_here('snatched+'))) { ?> 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))) { ?> <? 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'))) { ?> 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')) { ?> <? 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> <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> </li>
<? } <? }
if (($Override = check_perms('site_view_torrent_snatchlist', $Class))) { if (($Override = check_perms('site_view_torrent_snatchlist', $Class))) {
$DB->query("SELECT COUNT(ud.UserID), COUNT(DISTINCT ud.TorrentID) $DB->query("
FROM users_downloads AS ud SELECT COUNT(ud.UserID), COUNT(DISTINCT ud.TorrentID)
INNER JOIN torrents AS t ON t.ID=ud.TorrentID FROM users_downloads AS ud
WHERE ud.UserID='$UserID'"); INNER JOIN torrents AS t ON t.ID=ud.TorrentID
WHERE ud.UserID='$UserID'");
list($NumDownloads, $UniqueDownloads) = $DB->next_record(); 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> <a href="torrents.php?type=downloaded&amp;userid=<?=$UserID?>" class="brackets" title="View">View</a>
</li> </li>
<? } <? }

View File

@ -7,24 +7,25 @@
global $Cache; global $Cache;
$DB->query("SELECT $DB->query("
m.Username, SELECT
m.Email, m.Username,
m.IRCKey, m.Email,
m.Paranoia, m.IRCKey,
i.Info, m.Paranoia,
i.Avatar, i.Info,
i.Country, i.Avatar,
i.StyleID, i.Country,
i.StyleURL, i.StyleID,
i.SiteOptions, i.StyleURL,
i.UnseededAlerts, i.SiteOptions,
p.Level AS Class i.UnseededAlerts,
FROM users_main AS m p.Level AS Class
JOIN users_info AS i ON i.UserID = m.ID FROM users_main AS m
LEFT JOIN permissions AS p ON p.ID=m.PermissionID JOIN users_info AS i ON i.UserID = m.ID
WHERE m.ID = '".db_string($UserID)."'"); LEFT JOIN permissions AS p ON p.ID=m.PermissionID
list($Username,$Email,$IRCKey,$Paranoia,$Info,$Avatar,$Country,$StyleID,$StyleURL,$SiteOptions,$UnseededAlerts,$Class)=$DB->next_record(MYSQLI_NUM, array(3,9)); 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));
if ($UserID != $LoggedUser['ID'] && !check_perms('users_edit_profiles', $Class)) { if ($UserID != $LoggedUser['ID'] && !check_perms('users_edit_profiles', $Class)) {
@ -58,7 +59,7 @@ function checked($Checked) {
$SiteOptions = array(); $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) { ?> <? foreach ($Stylesheets as $Style) { ?>
<div class="preview_wrapper"> <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> <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>
<? } ?> <? } ?>
</div> </div>
@ -267,7 +268,7 @@ function checked($Checked) {
</select> </select>
</td> </td>
</tr> </tr>
<!-- --> <!---->
<tr> <tr>
<td class="label"><strong>Auto-save text</strong></td> <td class="label"><strong>Auto-save text</strong></td>
<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> <br /><label><input type="checkbox" name="p_artistsadded" <?=checked(!in_array('artistsadded', $Paranoia))?>/> Number of artists added</label>
</td> </td>
</tr> </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"> <tr class="colhead_dark">
<td colspan="2"> <td colspan="2">
<strong>Reset passkey</strong> <strong>Reset passkey</strong>

View File

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

View File

@ -15,7 +15,7 @@
$UserID = $LoggedUser['ID']; $UserID = $LoggedUser['ID'];
$Sneaky = false; $Sneaky = false;
} }
list($UserID, $Username, $PermissionID) = array_values(Users::user_info($UserID)); list($UserID, $Username, $PermissionID) = array_values(Users::user_info($UserID));

View File

@ -10,9 +10,9 @@
<div class="head colhead_dark">Last.fm</div> <div class="head colhead_dark">Last.fm</div>
<ul class="stats nobullet"> <ul class="stats nobullet">
<li> <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> </li>
<div id="lastfm_stats"<? if ($OwnProfile == true): ?> data-uid="<?= $OwnProfile ?>"<? endif; ?>> <div id="lastfm_stats"<? if ($OwnProfile == true): ?> data-uid="<?=($OwnProfile)?>"<? endif; ?>>
</div> </div>
<li> <li>
<a href="#" id="lastfm_expand" onclick="return false" class="brackets">Show more info</a> <a href="#" id="lastfm_expand" onclick="return false" class="brackets">Show more info</a>

View File

@ -4,14 +4,14 @@
**********************************************************************/ **********************************************************************/
if (!empty($_GET['search'])) { if (!empty($_GET['search'])) {
$_GET['username'] = $_GET['search']; $_GET['username'] = $_GET['search'];
} }
define('USERS_PER_PAGE', 30); define('USERS_PER_PAGE', 30);
if (isset($_GET['username'])) { if (isset($_GET['username'])) {
$_GET['username'] = trim($_GET['username']); $_GET['username'] = trim($_GET['username']);
// form submitted // form submitted
$Val->SetFields('username','1','username','Please enter a username.'); $Val->SetFields('username','1','username','Please enter a username.');

View File

@ -150,7 +150,7 @@
die(); die();
} }
} }
//End Email change //End Email change
@ -271,17 +271,20 @@
$SQL="UPDATE users_main AS m JOIN users_info AS i ON m.ID=i.UserID SET $SQL = "
i.StyleID='".db_string($_POST['stylesheet'])."', UPDATE users_main AS m
i.StyleURL='".db_string($_POST['styleurl'])."', JOIN users_info AS i ON m.ID=i.UserID
i.Avatar='".db_string($_POST['avatar'])."', SET
i.SiteOptions='".db_string(serialize($Options))."', i.StyleID='".db_string($_POST['stylesheet'])."',
i.NotifyOnQuote = '".db_string($Options['NotifyOnQuote'])."', i.StyleURL='".db_string($_POST['styleurl'])."',
i.Info='".db_string($_POST['info'])."', i.Avatar='".db_string($_POST['avatar'])."',
i.DownloadAlt='$DownloadAlt', i.SiteOptions='".db_string(serialize($Options))."',
i.UnseededAlerts='$UnseededAlerts', i.NotifyOnQuote = '".db_string($Options['NotifyOnQuote'])."',
m.Email='".db_string($_POST['email'])."', i.Info='".db_string($_POST['info'])."',
m.IRCKey='".db_string($_POST['irckey'])."',"; i.DownloadAlt='$DownloadAlt',
i.UnseededAlerts='$UnseededAlerts',
m.Email='".db_string($_POST['email'])."',
m.IRCKey='".db_string($_POST['irckey'])."',";
$SQL .= "m.Paranoia='".db_string(serialize($Paranoia))."'"; $SQL .= "m.Paranoia='".db_string(serialize($Paranoia))."'";
@ -289,24 +292,25 @@
$ChangerIP = db_string($LoggedUser['IP']); $ChangerIP = db_string($LoggedUser['IP']);
$PassHash=Users::make_crypt_hash($_POST['new_pass_1']); $PassHash=Users::make_crypt_hash($_POST['new_pass_1']);
$SQL.=",m.PassHash='".db_string($PassHash)."'"; $SQL.=",m.PassHash='".db_string($PassHash)."'";
$DB->query("INSERT INTO users_history_passwords $DB->query("
(UserID, ChangerIP, ChangeTime) VALUES INSERT INTO users_history_passwords
('$UserID', '$ChangerIP', '".sqltime()."')"); (UserID, ChangerIP, ChangeTime)
VALUES
('$UserID', '$ChangerIP', '".sqltime()."')");
} }
if (isset($_POST['resetpasskey'])) { if (isset($_POST['resetpasskey'])) {
$UserInfo = Users::user_heavy_info($UserID); $UserInfo = Users::user_heavy_info($UserID);
$OldPassKey = db_string($UserInfo['torrent_pass']); $OldPassKey = db_string($UserInfo['torrent_pass']);
$NewPassKey = db_string(Users::make_secret()); $NewPassKey = db_string(Users::make_secret());
$ChangerIP = db_string($LoggedUser['IP']); $ChangerIP = db_string($LoggedUser['IP']);
$SQL.=",m.torrent_pass='$NewPassKey'"; $SQL.=",m.torrent_pass='$NewPassKey'";
$DB->query("INSERT INTO users_history_passkeys $DB->query("
(UserID, OldPassKey, NewPassKey, ChangerIP, ChangeTime) VALUES INSERT INTO users_history_passkeys
(UserID, OldPassKey, NewPassKey, ChangerIP, ChangeTime)
VALUES
('$UserID', '$OldPassKey', '$NewPassKey', '$ChangerIP', '".sqltime()."')"); ('$UserID', '$OldPassKey', '$NewPassKey', '$ChangerIP', '".sqltime()."')");
$Cache->begin_transaction('user_info_heavy_'.$UserID); $Cache->begin_transaction('user_info_heavy_'.$UserID);
$Cache->update_row(false, array('torrent_pass'=>$NewPassKey)); $Cache->update_row(false, array('torrent_pass'=>$NewPassKey));

View File

@ -81,7 +81,7 @@
Misc::send_email($CurEmail, 'You have been invited to '.SITE_NAME, $Message,'noreply'); Misc::send_email($CurEmail, 'You have been invited to '.SITE_NAME, $Message,'noreply');
} }
header('Location: user.php?action=invite'); header('Location: user.php?action=invite');

View File

@ -228,10 +228,10 @@
$Cache->delete_value('session_'.$UserID.'_'.$SessionID); $Cache->delete_value('session_'.$UserID.'_'.$SessionID);
} }
$Cache->delete_value('users_sessions_'.$UserID); $Cache->delete_value('users_sessions_'.$UserID);
$DB->query("DELETE FROM users_sessions WHERE UserID='$UserID'"); $DB->query("DELETE FROM users_sessions WHERE UserID='$UserID'");
} }
} }
@ -340,7 +340,7 @@
$Values = array(); $Values = array();
foreach ($AddedClasses as $PermID) { foreach ($AddedClasses as $PermID) {
$Values[] = "($UserID, $PermID)"; $Values[] = "($UserID, $PermID)";
} }
$DB->query("INSERT INTO users_levels (UserID, PermissionID) VALUES ".implode(', ',$Values)); $DB->query("INSERT INTO users_levels (UserID, PermissionID) VALUES ".implode(', ',$Values));
//$LightUpdates['ExtraClasses'] = array_fill_keys($SecondaryClasses, 1); //$LightUpdates['ExtraClasses'] = array_fill_keys($SecondaryClasses, 1);
@ -653,10 +653,10 @@
$Cache->delete_value('session_'.$UserID.'_'.$SessionID); $Cache->delete_value('session_'.$UserID.'_'.$SessionID);
} }
$Cache->delete_value('users_sessions_'.$UserID); $Cache->delete_value('users_sessions_'.$UserID);
$DB->query("DELETE FROM users_sessions WHERE UserID='$UserID'"); $DB->query("DELETE FROM users_sessions WHERE UserID='$UserID'");
} }
if (empty($UpdateSet) && empty($EditSummary)) { if (empty($UpdateSet) && empty($EditSummary)) {
@ -695,13 +695,13 @@
$Summary .= "\nReason: ".$Reason; $Summary .= "\nReason: ".$Reason;
} }
$Summary .= "\n\n".$AdminComment; $Summary .= "\n\n".$AdminComment;
} elseif (empty($UpdateSet) && empty($EditSummary) && $Cur['AdminComment'] == $_POST['AdminComment']) { } elseif (empty($UpdateSet) && empty($EditSummary) && $Cur['AdminComment'] == $_POST['AdminComment']) {
$Summary = sqltime().' - '.'Comment added by '.$LoggedUser['Username'].': '.$Reason."\n\n"; $Summary = sqltime().' - '.'Comment added by '.$LoggedUser['Username'].': '.$Reason."\n\n";
} }
@ -718,11 +718,11 @@
$SET = implode(', ', $UpdateSet); $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 // Perform update
//die($sql); //die($SQL);
$DB->query($sql); $DB->query($SQL);
if (isset($ClearStaffIDCache)) { if (isset($ClearStaffIDCache)) {
$Cache->delete_value('staff_ids'); $Cache->delete_value('staff_ids');
@ -731,8 +731,8 @@
// redirect to user page // redirect to user page
header("location: user.php?id=$UserID"); header("location: user.php?id=$UserID");
function translateUserStatus($status) { function translateUserStatus($Status) {
switch ($status) { switch ($Status) {
case 0: case 0:
return 'Unconfirmed'; return 'Unconfirmed';
case 1: case 1:
@ -740,18 +740,18 @@ function translateUserStatus($status) {
case 2: case 2:
return 'Disabled'; return 'Disabled';
default: default:
return $status; return $Status;
} }
} }
function translateLeechStatus($status) { function translateLeechStatus($Status) {
switch ($status) { switch ($Status) {
case 0: case 0:
return 'Disabled'; return 'Disabled';
case 1: case 1:
return 'Enabled'; return 'Enabled';
default: default:
return $status; return $Status;
} }
} }
?> ?>

View File

@ -3,109 +3,123 @@
include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
$Text = new TEXT; $Text = new TEXT;
if (empty($_GET['id']) || !is_numeric($_GET['id'])) include(SERVER_ROOT.'/sections/requests/functions.php');
error(404);
if (empty($_GET['id']) || !is_numeric($_GET['id']) || (!empty($_GET['preview']) && !is_numeric($_GET['preview']))) {
error(404);
}
$UserID = $_GET['id']; $UserID = $_GET['id'];
$Preview = $_GET['preview'];
if ($UserID == $LoggedUser['ID']) { if ($UserID == $LoggedUser['ID']) {
$OwnProfile = true; $OwnProfile = true;
if ($Preview == 1) {
$OwnProfile = false;
$ParanoiaString = $_GET['paranoia'];
$CustomParanoia = explode(',', $ParanoiaString);
}
} else { } else {
$OwnProfile = false; $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 if (check_perms('users_mod')) { // Person viewing is a staff member
$DB->query("SELECT $DB->query("
m.Username, SELECT
m.Email, m.Username,
m.LastAccess, m.Email,
m.IP, m.LastAccess,
p.Level AS Class, m.IP,
m.Uploaded, p.Level AS Class,
m.Downloaded, m.Uploaded,
m.RequiredRatio, m.Downloaded,
m.Title, m.RequiredRatio,
m.torrent_pass, m.Title,
m.Enabled, m.torrent_pass,
m.Paranoia, m.Enabled,
m.Invites, m.Paranoia,
m.can_leech, m.Invites,
m.Visible, m.can_leech,
i.JoinDate, m.Visible,
i.Info, i.JoinDate,
i.Avatar, i.Info,
i.Country, i.Avatar,
i.AdminComment, i.Country,
i.Donor, i.AdminComment,
i.Artist, i.Donor,
i.Warned, i.Artist,
i.SupportFor, i.Warned,
i.RestrictedForums, i.SupportFor,
i.PermittedForums, i.RestrictedForums,
i.Inviter, i.PermittedForums,
inviter.Username, i.Inviter,
COUNT(posts.id) AS ForumPosts, inviter.Username,
i.RatioWatchEnds, COUNT(posts.id) AS ForumPosts,
i.RatioWatchDownload, i.RatioWatchEnds,
i.DisableAvatar, i.RatioWatchDownload,
i.DisableInvites, i.DisableAvatar,
i.DisablePosting, i.DisableInvites,
i.DisableForums, i.DisablePosting,
i.DisableTagging, i.DisableForums,
i.DisableUpload, i.DisableTagging,
i.DisableWiki, i.DisableUpload,
i.DisablePM, i.DisableWiki,
i.DisableIRC, i.DisablePM,
i.DisableRequests, i.DisableIRC,
i.HideCountryChanges, i.DisableRequests,
m.FLTokens, i.HideCountryChanges,
SHA1(i.AdminComment) m.FLTokens,
SHA1(i.AdminComment)
FROM users_main AS m FROM users_main AS m
JOIN users_info AS i ON i.UserID = m.ID JOIN users_info AS i ON i.UserID = m.ID
LEFT JOIN users_main AS inviter ON i.Inviter = inviter.ID LEFT JOIN users_main AS inviter ON i.Inviter = inviter.ID
LEFT JOIN permissions AS p ON p.ID=m.PermissionID LEFT JOIN permissions AS p ON p.ID=m.PermissionID
LEFT JOIN forums_posts AS posts ON posts.AuthorID = m.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 if ($DB->record_count() == 0) { // If user doesn't exist
header("Location: log.php?search=User+".$UserID); 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 } else { // Person viewing is a normal user
$DB->query("SELECT $DB->query("
m.Username, SELECT
m.Email, m.Username,
m.LastAccess, m.Email,
m.IP, m.LastAccess,
p.Level AS Class, m.IP,
m.Uploaded, p.Level AS Class,
m.Downloaded, m.Uploaded,
m.RequiredRatio, m.Downloaded,
m.Enabled, m.RequiredRatio,
m.Paranoia, m.Enabled,
m.Invites, m.Paranoia,
m.Title, m.Invites,
m.torrent_pass, m.Title,
m.can_leech, m.torrent_pass,
i.JoinDate, m.can_leech,
i.Info, i.JoinDate,
i.Avatar, i.Info,
m.FLTokens, i.Avatar,
i.Country, m.FLTokens,
i.Donor, i.Country,
i.Warned, i.Donor,
COUNT(posts.id) AS ForumPosts, i.Warned,
i.Inviter, COUNT(posts.id) AS ForumPosts,
i.DisableInvites, i.Inviter,
inviter.username i.DisableInvites,
inviter.username
FROM users_main AS m FROM users_main AS m
JOIN users_info AS i ON i.UserID = m.ID JOIN users_info AS i ON i.UserID = m.ID
LEFT JOIN permissions AS p ON p.ID=m.PermissionID LEFT JOIN permissions AS p ON p.ID=m.PermissionID
LEFT JOIN users_main AS inviter ON i.Inviter = inviter.ID LEFT JOIN users_main AS inviter ON i.Inviter = inviter.ID
LEFT JOIN forums_posts AS posts ON posts.AuthorID = m.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 if ($DB->record_count() == 0) { // If user doesn't exist
header("Location: log.php?search=User+".$UserID); header("Location: log.php?search=User+".$UserID);
@ -117,14 +131,23 @@
// Image proxy CTs // Image proxy CTs
$DisplayCustomTitle = $CustomTitle; $DisplayCustomTitle = $CustomTitle;
if (check_perms('site_proxy_images') && !empty($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>])~',
return 'src=' . $Matches[1] . ImageTools::process($Matches[2]) . $Matches[3]; function($Matches) {
}, $CustomTitle); return 'src=' . $Matches[1] . ImageTools::process($Matches[2]) . $Matches[3];
}, $CustomTitle);
} }
$Paranoia = unserialize($Paranoia); if ($Preview == 1) {
if (!is_array($Paranoia)) { if (strlen($ParanoiaString) == 0) {
$Paranoia = array(); $Paranoia = array();
} else {
$Paranoia = $CustomParanoia;
}
} else {
$Paranoia = unserialize($Paranoia);
if (!is_array($Paranoia)) {
$Paranoia = array();
}
} }
$ParanoiaLevel = 0; $ParanoiaLevel = 0;
foreach ($Paranoia as $P) { foreach ($Paranoia as $P) {
@ -138,17 +161,21 @@
$LastAccess = time_diff($LastAccess); $LastAccess = time_diff($LastAccess);
function check_paranoia_here($Setting) { function check_paranoia_here($Setting) {
global $Paranoia, $Class, $UserID; global $Paranoia, $Class, $UserID, $Preview;
return check_paranoia($Setting, $Paranoia, $Class, $UserID); 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.=(($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.=(($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"> <div class="thin">
@ -214,7 +241,7 @@ function check_paranoia_here($Setting) {
?> ?>
<div class="box box_image box_image_avatar"> <div class="box box_image box_image_avatar">
<div class="head colhead_dark">Avatar</div> <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>
<? } ?> <? } ?>
<div class="box box_info box_userinfo_stats"> <div class="box box_info box_userinfo_stats">
@ -222,50 +249,58 @@ function check_paranoia_here($Setting) {
<ul class="stats nobullet"> <ul class="stats nobullet">
<li>Joined: <?=$JoinedDate?></li> <li>Joined: <?=$JoinedDate?></li>
<? if (($Override = check_paranoia_here('lastseen'))) { ?> <? 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'))) { ?> 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'))) { ?> 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'))) { ?> 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)) { ?> 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')) { ?> 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') { ?> 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> </ul>
</div> </div>
<? <?
//Last.fm statistics and comparability // Last.fm statistics and comparability
include(SERVER_ROOT.'/sections/user/lastfm.php'); include(SERVER_ROOT.'/sections/user/lastfm.php');
if (check_paranoia_here('requestsfilled_count') || check_paranoia_here('requestsfilled_bounty')) { if (check_paranoia_here('requestsfilled_count') || check_paranoia_here('requestsfilled_bounty')) {
$DB->query("SELECT $DB->query("
COUNT(DISTINCT r.ID), SELECT
SUM(rv.Bounty) COUNT(DISTINCT r.ID),
FROM requests AS r SUM(rv.Bounty)
LEFT JOIN requests_votes AS rv ON r.ID=rv.RequestID FROM requests AS r
WHERE r.FillerID = ".$UserID); LEFT JOIN requests_votes AS rv ON r.ID=rv.RequestID
WHERE r.FillerID = $UserID");
list($RequestsFilled, $TotalBounty) = $DB->next_record(); list($RequestsFilled, $TotalBounty) = $DB->next_record();
} else { } else {
$RequestsFilled = $TotalBounty = 0; $RequestsFilled = $TotalBounty = 0;
} }
if (check_paranoia_here('requestsvoted_count') || check_paranoia_here('requestsvoted_bounty')) { 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(); 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(); list($RequestsCreated, $RequestsCreatedSpent) = $DB->next_record();
} else { } else {
$RequestsVoted = $TotalSpent = $RequestsCreated = $RequestsCreatedSpent = 0; $RequestsVoted = $TotalSpent = $RequestsCreated = $RequestsCreatedSpent = 0;
@ -301,7 +336,7 @@ function check_paranoia_here($Setting) {
} elseif ($Uploaded == 0) { } elseif ($Uploaded == 0) {
$Ratio = 0.5; $Ratio = 0.5;
} else { } else {
$Ratio = round($Uploaded/$Downloaded, 2); $Ratio = round($Uploaded / $Downloaded, 2);
} }
$OverallRank = $Rank->overall_score($UploadedRank, $DownloadedRank, $UploadsRank, $RequestRank, $PostRank, $BountyRank, $ArtistsRank, $Ratio); $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> <div class="head colhead_dark">Percentile rankings (hover for values)</div>
<ul class="stats nobullet"> <ul class="stats nobullet">
<? if (($Override=check_paranoia_here('uploaded'))) { ?> <? 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'))) { ?> <? 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+'))) { ?> <? 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'))) { ?> <? 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'))) { ?> <? 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> <li title="<?=number_format($ForumPosts)?>">Posts made: <?=$PostRank === false ? 'Server busy' : number_format($PostRank)?></li>
<? if (($Override=check_paranoia_here('artistsadded'))) { ?> <? 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'))) { ?> <? 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> <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)) { 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> <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> <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> <li>Passkeys: <?=number_format($PasskeyChanges)?> <a href="userhistory.php?action=passkeys&amp;userid=<?=$UserID?>" class="brackets">View</a></li>
<? <?
@ -377,7 +412,7 @@ function check_paranoia_here($Setting) {
<li>Passwords: <?=number_format($PasswordChanges)?> <a href="userhistory.php?action=passwords&amp;userid=<?=$UserID?>" class="brackets">View</a></li> <li>Passwords: <?=number_format($PasswordChanges)?> <a href="userhistory.php?action=passwords&amp;userid=<?=$UserID?>" class="brackets">View</a></li>
<li>Stats: N/A <a href="userhistory.php?action=stats&amp;userid=<?=$UserID?>" class="brackets">View</a></li> <li>Stats: N/A <a href="userhistory.php?action=stats&amp;userid=<?=$UserID?>" class="brackets">View</a></li>
<? <?
} }
?> ?>
</ul> </ul>
@ -416,7 +451,7 @@ function check_paranoia_here($Setting) {
} }
?> ?>
<li>Paranoia level: <span title="<?=$ParanoiaLevel?>"><?=$ParanoiaLevelText?></span></li> <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> <li>Email: <a href="mailto:<?=display_str($Email)?>"><?=display_str($Email)?></a>
<? if (check_perms('users_view_email',$Class)) { ?> <? 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> <a href="user.php?action=search&amp;email_history=on&amp;email=<?=display_str($Email)?>" title="Search" class="brackets">S</a>
@ -441,7 +476,7 @@ function check_paranoia_here($Setting) {
} else { } else {
$Invited='<a href="user.php?id='.$InviterID.'">'.$InviterName.'</a>'; $Invited='<a href="user.php?id='.$InviterID.'">'.$InviterName.'</a>';
} }
?> ?>
<li>Invited by: <?=$Invited?></li> <li>Invited by: <?=$Invited?></li>
<li>Invites: <? <li>Invites: <?
@ -452,7 +487,7 @@ function check_paranoia_here($Setting) {
} else { } else {
echo number_format($Invites); echo number_format($Invites);
} }
echo " (".$Pending.")" echo " ($Pending)"
?></li> ?></li>
<? <?
} }
@ -461,12 +496,12 @@ function check_paranoia_here($Setting) {
$DB->query("SELECT SupportFor FROM users_info WHERE UserID = ".$LoggedUser['ID']); $DB->query("SELECT SupportFor FROM users_info WHERE UserID = ".$LoggedUser['ID']);
list($SupportFor) = $DB->next_record(); 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); $DB->query("SELECT DISTINCT useragent FROM xbt_files_users WHERE uid = ".$UserID);
$Clients = $DB->collect(0); $Clients = $DB->collect(0);
echo implode("; ", $Clients); echo implode('; ', $Clients);
?></li> ?></li>
<? <?
} }

View File

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

View File

@ -61,7 +61,7 @@
case 'catchup_collages': case 'catchup_collages':
require('catchup_collages.php'); require('catchup_collages.php');
break; break;
case 'token_history': case 'token_history':
require('token_history.php'); require('token_history.php');
break; break;

View File

@ -37,7 +37,7 @@
$SearchIPQuery = " AND h1.IP = '$SearchIP' "; $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[ <script type="text/javascript">//<![CDATA[
function ShowIPs(rowname) { function ShowIPs(rowname) {
@ -54,7 +54,7 @@ function Ban(ip, id, elemID) {
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
} }
xmlhttp.onreadystatechange=function() { xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200) { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById(elemID).innerHTML = "<strong>[Banned]</strong>"; document.getElementById(elemID).innerHTML = "<strong>[Banned]</strong>";
} }
} }
@ -72,9 +72,9 @@ function UnBan(ip, id, elemID) {
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
} }
xmlhttp.onreadystatechange=function() { 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).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); 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 38: //up
case 40: //down case 40: //down
this.highlight(key); this.highlight(key);
if(this.pos !== -1) { if (this.pos !== -1) {
this.artistid = this.list.children[this.pos].artistid; this.artistid = this.list.children[this.pos].artistid;
this.input.value = this.list.children[this.pos].textContent || this.list.children[this.pos].value; this.input.value = this.list.children[this.pos].textContent || this.list.children[this.pos].value;
} }
break; break;
case 13: case 13:
if(this.artistid != null) { if (this.artistid != null) {
window.location = this.id + '.php?id='+this.artistid; window.location = this.id + '.php?id='+this.artistid;
} }
return 0; return 0;
@ -139,9 +139,9 @@ var autocomp = {
}); });
listener.set(li,'click',function(e) { listener.set(li,'click',function(e) {
var location = autocomp.id + '.php?id='+this.artistid; var location = autocomp.id + '.php?id='+this.artistid;
if(e.button == 0) { if (e.button == 0) {
window.open(location, '_self'); window.open(location, '_self');
} else if(e.button == 1) { } else if (e.button == 1) {
var win = window.open(location, '_blank'); var win = window.open(location, '_blank');
win.focus(); win.focus();
} }

View File

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