From d9a653c45dc3ccc07be5760642a27829a4f6309e Mon Sep 17 00:00:00 2001 From: Git Date: Thu, 16 May 2013 16:15:57 +0000 Subject: [PATCH] Empty commit --- classes/class_invite_tree.php | 65 +- classes/class_misc.php | 130 ++- classes/class_text.php | 4 +- classes/class_text2.php | 5 +- classes/class_text3.php | 4 +- classes/class_tools.php | 41 +- classes/class_torrents.php | 4 +- classes/class_user_rank.php | 5 +- classes/class_users.php | 104 +- classes/script_start.php | 87 +- design/privateheader.php | 41 +- sections/ajax/index.php | 4 +- sections/ajax/usersearch.php | 2 +- sections/artist/artist.php | 10 +- sections/blog/index.php | 16 +- sections/bookmarks/torrents.php | 2 +- sections/collages/collage.php | 2 +- sections/collages/edit.php | 2 +- sections/collages/manage.php | 2 +- sections/comments/artistcomments.php | 3 +- sections/comments/torrentcomments.php | 2 +- sections/donate/config.php | 10 +- sections/donate/index.php | 1 - sections/donate/ipn.php | 28 +- sections/forums/forum.php | 6 +- sections/forums/mod_thread.php | 4 +- sections/forums/thread.php | 6 +- sections/image/index.php | 2 +- sections/inbox/inbox.php | 2 +- sections/login/index.php | 62 +- sections/register/index.php | 8 +- sections/reportsv2/ajax_new_report.php | 137 +-- sections/reportsv2/report.php | 4 +- sections/reportsv2/static.php | 205 ++-- sections/requests/takevote.php | 2 +- sections/rules/upload.php | 2 +- sections/schedule/index.php | 10 +- sections/staffpm/assign.php | 2 +- sections/staffpm/takepost.php | 21 +- sections/stats/users.php | 8 +- sections/tools/index.php | 2 +- sections/tools/tools.php | 4 +- sections/torrents/browse2.php | 2 +- sections/torrents/details.php | 24 +- sections/torrents/functions.php | 60 +- sections/torrents/index.php | 29 +- sections/torrents/redownload.php | 32 +- sections/torrents/user.php | 6 +- sections/torrents/vote.php | 4 +- sections/upload/insert_extra_torrents.php | 2 +- sections/user/advancedsearch.php | 96 +- sections/user/community_stats.php | 139 +-- sections/user/edit.php | 47 +- sections/user/index.php | 8 +- sections/user/invite.php | 2 +- sections/user/lastfm.php | 4 +- sections/user/search.php | 4 +- sections/user/takeedit.php | 44 +- sections/user/takeinvite.php | 2 +- sections/user/takemoderate.php | 36 +- sections/user/user.php | 277 +++--- sections/userhistory/email_history.php | 2 +- sections/userhistory/index.php | 2 +- sections/userhistory/ip_history.php | 8 +- static/functions/autocomplete.js | 8 +- static/functions/collage.js | 2 +- static/functions/preview_paranoia.js | 44 + static/styles/proton/style.css | 1055 +++++++++++++-------- 68 files changed, 1727 insertions(+), 1273 deletions(-) create mode 100644 static/functions/preview_paranoia.js diff --git a/classes/class_invite_tree.php b/classes/class_invite_tree.php index eb9671e1..62b9652c 100644 --- a/classes/class_invite_tree.php +++ b/classes/class_invite_tree.php @@ -30,32 +30,37 @@ function make_tree() { if (!$TreeID) { return; } - $DB->query("SELECT - TreePosition FROM invite_tree - WHERE TreeID=$TreeID AND TreeLevel=$TreeLevel AND TreePosition>$TreePosition - ORDER BY TreePosition ASC LIMIT 1"); + $DB->query(" + SELECT TreePosition + FROM invite_tree + WHERE TreeID=$TreeID + AND TreeLevel=$TreeLevel + AND TreePosition>$TreePosition + ORDER BY TreePosition ASC + LIMIT 1"); if ($DB->record_count()) { list($MaxPosition) = $DB->next_record(MYSQLI_NUM, false); } else { $MaxPosition = false; } - $TreeQuery = $DB->query("SELECT - it.UserID, - Enabled, - PermissionID, - Donor, - Uploaded, - Downloaded, - Paranoia, - TreePosition, - TreeLevel + $TreeQuery = $DB->query(" + SELECT + it.UserID, + Enabled, + PermissionID, + Donor, + Uploaded, + Downloaded, + Paranoia, + TreePosition, + TreeLevel FROM invite_tree AS it - JOIN users_main AS um ON um.ID=it.UserID - JOIN users_info AS ui ON ui.UserID=it.UserID + JOIN users_main AS um ON um.ID=it.UserID + JOIN users_info AS ui ON ui.UserID=it.UserID WHERE TreeID=$TreeID - AND TreePosition>$TreePosition". - ($MaxPosition ? " AND TreePosition<$MaxPosition" : '')." - AND TreeLevel>$TreeLevel + AND TreePosition>$TreePosition". + ($MaxPosition ? " AND TreePosition<$MaxPosition" : '')." + AND TreeLevel>$TreeLevel ORDER BY TreePosition"); $PreviousTreeLevel = $TreeLevel; @@ -108,20 +113,18 @@ function make_tree() { // Manage tree depth if ($TreeLevel > $PreviousTreeLevel) { for ($i = 0; $i < $TreeLevel - $PreviousTreeLevel; $i++) { - echo '"; } - echo ''; - echo '
  • '; + echo "\t
  • \n
  • "; } else { - echo '
  • '; - echo '
  • '; + echo "\t
  • \n
  • "; } ?> - + \n"; + $Tree .= "\t
  • \n\n"; } if ($Count) { ?>

    - This tree has entries, branches, and a depth of . + This tree has entries, branches, and a depth of . It has '; - + if ($ParanoidCount) { echo '

    '; echo $ParanoidCount; diff --git a/classes/class_misc.php b/classes/class_misc.php index 12c6d132..478b7b2c 100644 --- a/classes/class_misc.php +++ b/classes/class_misc.php @@ -72,21 +72,30 @@ public static function send_pm($ToID,$FromID,$Subject,$Body,$ConvID='') { WHERE UserID IN (".implode(',', $ToID).") AND ConvID='$ConvID'"); - $DB->query("UPDATE pm_conversations_users SET + $DB->query(" + UPDATE pm_conversations_users + SET InSentbox='1', SentDate='".sqltime()."' - WHERE UserID='$FromID' + WHERE UserID='$FromID' AND ConvID='$ConvID'"); } // Now that we have a $ConvID for sure, send the message. - $DB->query("INSERT INTO pm_messages - (SenderID, ConvID, SentDate, Body) VALUES - ('$FromID', '$ConvID', '".sqltime()."', '".$Body."')"); + $DB->query(" + INSERT INTO pm_messages + (SenderID, ConvID, SentDate, Body) + VALUES + ('$FromID', '$ConvID', '".sqltime()."', '$Body')"); // Update the cached new message count. foreach ($ToID as $ID) { - $DB->query("SELECT COUNT(ConvID) FROM pm_conversations_users WHERE UnRead = '1' and UserID='$ID' AND InInbox = '1'"); + $DB->query(" + SELECT COUNT(ConvID) + FROM pm_conversations_users + WHERE UnRead = '1' + AND UserID='$ID' + AND InInbox = '1'"); list($UnRead) = $DB->next_record(); $Cache->cache_value('inbox_new_'.$ID, $UnRead); } @@ -94,15 +103,20 @@ public static function send_pm($ToID,$FromID,$Subject,$Body,$ConvID='') { $DB->query("SELECT Username FROM users_main WHERE ID = '$FromID'"); list($SenderName) = $DB->next_record(); foreach ($ToID as $ID) { - $DB->query("SELECT COUNT(ConvID) FROM pm_conversations_users WHERE UnRead = '1' and UserID='$ID' AND InInbox = '1'"); + $DB->query(" + SELECT COUNT(ConvID) + FROM pm_conversations_users + WHERE UnRead = '1' + AND UserID='$ID' + AND InInbox = '1'"); list($UnRead) = $DB->next_record(); $Cache->cache_value('inbox_new_'.$ID, $UnRead); - + } return $ConvID; } - + /** * 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['IsSticky'] = 0; - $DB->query("INSERT INTO forums_topics - (Title, AuthorID, ForumID, LastPostTime, LastPostAuthorID) - Values - ('".$Title."', '".$AuthorID."', '$ForumID', '".sqltime()."', '".$AuthorID."')"); + $DB->query(" + INSERT INTO forums_topics + (Title, AuthorID, ForumID, LastPostTime, LastPostAuthorID) + VALUES + ('$Title', '$AuthorID', '$ForumID', '".sqltime()."', '$AuthorID')"); $TopicID = $DB->inserted_id(); $Posts = 1; - $DB->query("INSERT INTO forums_posts + $DB->query(" + INSERT INTO forums_posts (TopicID, AuthorID, AddedTime, Body) - VALUES - ('$TopicID', '".$AuthorID."', '".sqltime()."', '".$PostBody."')"); + VALUES + ('$TopicID', '$AuthorID', '".sqltime()."', '$PostBody')"); $PostID = $DB->inserted_id(); - $DB->query("UPDATE forums SET - NumPosts = NumPosts+1, - NumTopics = NumTopics+1, - LastPostID = '$PostID', - LastPostAuthorID = '".$AuthorID."', - LastPostTopicID = '$TopicID', - LastPostTime = '".sqltime()."' - WHERE ID = '$ForumID'"); + $DB->query(" + UPDATE forums + SET + NumPosts = NumPosts+1, + NumTopics = NumTopics+1, + LastPostID = '$PostID', + LastPostAuthorID = '$AuthorID', + LastPostTopicID = '$TopicID', + LastPostTime = '".sqltime()."' + WHERE ID = '$ForumID'"); - $DB->query("UPDATE forums_topics SET + $DB->query(" + UPDATE forums_topics + SET NumPosts = NumPosts+1, LastPostID = '$PostID', - LastPostAuthorID = '".$AuthorID."', + LastPostAuthorID = '$AuthorID', LastPostTime = '".sqltime()."' - WHERE ID = '$TopicID'"); + WHERE ID = '$TopicID'"); // Bump this topic to head of the cache 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) { array_pop($Forum); } - $DB->query("SELECT f.IsLocked, f.IsSticky, f.NumPosts FROM forums_topics AS f + $DB->query(" + SELECT f.IsLocked, f.IsSticky, f.NumPosts + FROM forums_topics AS f WHERE f.ID ='$TopicID'"); - list($IsLocked,$IsSticky,$NumPosts) = $DB->next_record(); - $Part1 = array_slice($Forum,0,$Stickies,true); //Stickys + list($IsLocked, $IsSticky, $NumPosts) = $DB->next_record(); + $Part1 = array_slice($Forum, 0, $Stickies, true); //Stickys $Part2 = array( - $TopicID=>array( + $TopicID => array( 'ID' => $TopicID, 'Title' => $Title, 'AuthorID' => $AuthorID, @@ -181,10 +203,10 @@ public static function create_thread($ForumID, $AuthorID, $Title, $PostBody) { 'LastPostAuthorID' => $AuthorID, ) ); //Bumped thread - $Part3 = array_slice($Forum,$Stickies,TOPICS_PER_PAGE,true); //Rest of page + $Part3 = array_slice($Forum, $Stickies, TOPICS_PER_PAGE, true); //Rest of page if ($Stickies > 0) { - $Part1 = array_slice($Forum,0,$Stickies,true); //Stickies - $Part3 = array_slice($Forum,$Stickies,TOPICS_PER_PAGE-$Stickies-1,true); //Rest of page + $Part1 = array_slice($Forum, 0, $Stickies, true); //Stickies + $Part3 = array_slice($Forum, $Stickies, TOPICS_PER_PAGE - $Stickies - 1, true); //Rest of page } else { $Part1 = array(); $Part3 = $Forum; @@ -192,7 +214,7 @@ public static function create_thread($ForumID, $AuthorID, $Title, $PostBody) { if (is_null($Part1)) { $Part1 = array(); } if (is_null($Part3)) { $Part3 = array(); } $Forum = $Part1 + $Part2 + $Part3; - $Cache->cache_value('forums_'.$ForumID, array($Forum,'',0,$Stickies), 0); + $Cache->cache_value('forums_'.$ForumID, array($Forum, '', 0, $Stickies), 0); } //Update the forum root @@ -209,12 +231,12 @@ public static function create_thread($ForumID, $AuthorID, $Title, $PostBody) { 'IsSticky'=>$ThreadInfo['IsSticky'] ); - $UpdateArray['NumTopics']='+1'; + $UpdateArray['NumTopics'] = '+1'; $Cache->update_row($ForumID, $UpdateArray); $Cache->commit_transaction(0); - $CatalogueID = floor((POSTS_PER_PAGE*ceil($Posts/POSTS_PER_PAGE)-POSTS_PER_PAGE)/THREAD_CATALOGUE); + $CatalogueID = floor((POSTS_PER_PAGE * ceil($Posts / POSTS_PER_PAGE) - POSTS_PER_PAGE) / THREAD_CATALOGUE); $Cache->begin_transaction('thread_'.$TopicID.'_catalogue_'.$CatalogueID); $Post = array( 'ID'=>$PostID, @@ -271,7 +293,7 @@ public static function in_array_partial($Needle, $Haystack) { } foreach ($Haystack as $String) { if (substr($String, -1) == '*') { - if (!strncmp($Needle, $String, strlen($String)-1)) { + if (!strncmp($Needle, $String, strlen($String) - 1)) { $Searches[$Needle] = true; return true; } @@ -293,7 +315,7 @@ public static function in_array_partial($Needle, $Haystack) { * @param boolean $AllowEmpty If set to true, a key that is in the request but blank will not throw an error. * @param int $Error The error code to throw if one of the keys isn't in the array. */ - public static function assert_isset_request($Request, $Keys=NULL, $AllowEmpty = False, $Error=0) { + public static function assert_isset_request($Request, $Keys = NULL, $AllowEmpty = False, $Error = 0) { if (isset($Keys)) { foreach ($Keys as $K) { if (!isset($Request[$K]) || ($AllowEmpty == False && $Request[$K] == '')) { @@ -329,7 +351,10 @@ public static function get_tags($TagNames) { } } if (count($TagNames) > 0) { - $DB->query("SELECT ID, Name FROM tags WHERE Name IN ('".implode("', '", $TagNames)."')"); + $DB->query(" + SELECT ID, Name + FROM tags + WHERE Name IN ('".implode("', '", $TagNames)."')"); $SQLTagIDs = $DB->to_array(); foreach ($SQLTagIDs as $Tag) { $TagIDs[$Tag['ID']] = $Tag['Name']; @@ -348,13 +373,13 @@ public static function get_tags($TagNames) { * @return string The aliased tag. */ public static function get_alias_tag($BadTag) { - global $DB; - $DB->query("SELECT AliasTag FROM tag_aliases WHERE BadTag = '". $BadTag ."' LIMIT 1"); - if ($DB->record_count() > 0) { - list($AliasTag) = $DB->next_record(); - return $AliasTag; - } - return $BadTag; + global $DB; + $DB->query("SELECT AliasTag FROM tag_aliases WHERE BadTag = '". $BadTag ."' LIMIT 1"); + if ($DB->record_count() > 0) { + list($AliasTag) = $DB->next_record(); + return $AliasTag; + } + return $BadTag; } @@ -365,8 +390,9 @@ public static function get_alias_tag($BadTag) { */ public static function write_log($Message) { global $DB,$Time; - $DB->query('INSERT INTO log (Message, Time) VALUES (\'' - .db_string($Message).'\', \''.sqltime().'\')'); + $DB->query(" + INSERT INTO log (Message, Time) + VALUES ('" . db_string($Message) . "', '" . sqltime() . "')"); } @@ -417,10 +443,10 @@ public static function is_new_torrent(&$Data) { public static function display_recommend($ID, $Type, $Hide = true) { global $DB, $LoggedUser; if ($Hide) { - $Hide = 'style="display: none;"'; + $Hide = ' style="display: none;"'; } ?> -

    class="center"> +
    class="center">
    Recommend to: - + Featured /> diff --git a/sections/collages/manage.php b/sections/collages/manage.php index fd236613..5a6e935a 100644 --- a/sections/collages/manage.php +++ b/sections/collages/manage.php @@ -26,7 +26,7 @@ $GroupIDs = $DB->collect('GroupID'); - $CollageDataList=$DB->to_array('GroupID', MYSQLI_ASSOC); + $CollageDataList = $DB->to_array('GroupID', MYSQLI_ASSOC); if (count($GroupIDs) > 0) { $TorrentList = Torrents::get_groups($GroupIDs); $TorrentList = $TorrentList['matches']; diff --git a/sections/comments/artistcomments.php b/sections/comments/artistcomments.php index 01d8df9a..e6eaf0c9 100644 --- a/sections/comments/artistcomments.php +++ b/sections/comments/artistcomments.php @@ -56,8 +56,7 @@ comment_body($UserID, $PostID, $postheader, $permalink, $Body, $EditorID, $AddedTime, $EditedTime); } /* end while loop*/ ?> - +
    - +
    query("SELECT BitcoinAddress FROM users_info WHERE UserID = '$UserID'"); list($Addr) = $DB->next_record(); - if (!empty($Addr)) { return $Addr; } - elseif ($GenAddress) { - + if (!empty($Addr)) { + return $Addr; + } elseif ($GenAddress) { if (empty($NewAddr)) { error(0); } diff --git a/sections/donate/index.php b/sections/donate/index.php index ecb804bc..a91492f1 100644 --- a/sections/donate/index.php +++ b/sections/donate/index.php @@ -9,7 +9,6 @@ case 'ipn': // PayPal hits this page when a donation is received include(SERVER_ROOT.'/sections/donate/ipn.php'); break; - case 'complete': include(SERVER_ROOT.'/sections/donate/complete.php'); break; diff --git a/sections/donate/ipn.php b/sections/donate/ipn.php index e10cd884..dfb9c121 100644 --- a/sections/donate/ipn.php +++ b/sections/donate/ipn.php @@ -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.'); } - + } } } @@ -66,7 +66,10 @@ } else { //Failed pending donation $Message = "User https://".SSL_SITE_URL."/user.php?id=".$_POST['custom']." had donation of ".$TotalDonated." ".PAYPAL_CURRENCY." at ".$DonationTime." UTC from ".$_POST['payer_email']." returned."; - $DB->query('SELECT SUM(Amount), MIN(Time) FROM donations WHERE UserID=\''.$_POST['custom'].'\';'); + $DB->query(' + SELECT SUM(Amount), MIN(Time) + FROM donations + WHERE UserID=\''.$_POST['custom'].'\';'); list($TotalDonated,$DonationTime) = $DB->next_record(); if ($TotalDonated+$_POST['mc_gross'] == 0) { $DB->query("SELECT Invites FROM users_main WHERE ID='".$_POST['custom']."'"); @@ -92,17 +95,22 @@ } } } - $DB->query("UPDATE users_info + $DB->query(" + UPDATE users_info SET - AdminComment=CONCAT('".sqltime()." - User donated ".db_string($_POST['mc_gross'])." ".db_string(PAYPAL_CURRENCY)." from ".db_string($_POST['payer_email']).".\n',AdminComment) + AdminComment=CONCAT('".sqltime()." - User donated ".db_string($_POST['mc_gross'])." ".db_string(PAYPAL_CURRENCY)." from ".db_string($_POST['payer_email']).".\n',AdminComment) WHERE UserID='".$_POST['custom']."'"); - $DB->query("INSERT INTO donations - (UserID, Amount, Email, Time) VALUES - ('".$_POST['custom']."', '".db_string($_POST['mc_gross'])."', '".db_string($_POST['payer_email'])."', '".sqltime()."')"); + $DB->query(" + INSERT INTO donations + (UserID, Amount, Email, Time) + VALUES + ('".$_POST['custom']."', '".db_string($_POST['mc_gross'])."', '".db_string($_POST['payer_email'])."', '".sqltime()."')"); } else { - $DB->query("INSERT INTO ip_bans - (FromIP, ToIP, Reason) VALUES - ('".Tools::ip_to_unsigned($_SERVER['REMOTE_ADDR'])."','".ip2long($_SERVER['REMOTE_ADDR'])."', 'Attempted to exploit donation system.')"); + $DB->query(" + INSERT INTO ip_bans + (FromIP, ToIP, Reason) + VALUES + ('".Tools::ip_to_unsigned($_SERVER['REMOTE_ADDR'])."','".ip2long($_SERVER['REMOTE_ADDR'])."', 'Attempted to exploit donation system.')"); } fclose ($Socket); if (check_perms('site_debug')) { diff --git a/sections/forums/forum.php b/sections/forums/forum.php index 749a5368..9205746b 100644 --- a/sections/forums/forum.php +++ b/sections/forums/forum.php @@ -48,7 +48,7 @@ ORDER BY t.IsSticky DESC, t.LastPostTime DESC LIMIT $Limit"); // Can be cached until someone makes a new post $Forum = $DB->to_array('ID',MYSQLI_ASSOC, false); - + if ($Page == 1) { $DB->query("SELECT COUNT(ID) FROM forums_topics WHERE ForumID='$ForumID' AND IsSticky='1'"); list($Stickies) = $DB->next_record(); @@ -56,7 +56,6 @@ } } - if (!isset($Forums[$ForumID])) { error(404); } @@ -68,7 +67,6 @@ } - $ForumName = display_str($Forums[$ForumID]['Name']); if ($LoggedUser['CustomForums'][$ForumID] != 1 && $Forums[$ForumID]['MinClassRead'] > $LoggedUser['Class']) { error(403); @@ -247,7 +245,7 @@ unset($PageLinks); $Title = display_str($Title); $DisplayTitle = $Title; - + ?> diff --git a/sections/forums/mod_thread.php b/sections/forums/mod_thread.php index a5748cc7..bf468473 100644 --- a/sections/forums/mod_thread.php +++ b/sections/forums/mod_thread.php @@ -128,7 +128,7 @@ } } else { // If we're just editing it - + $Cache->begin_transaction('thread_'.$TopicID.'_info'); $UpdateArray = array( 'IsSticky' => $Sticky, @@ -287,5 +287,5 @@ $Cache->delete_value('polls_'.$TopicID); } header('Location: forums.php?action=viewthread&threadid='.$TopicID.'&page='.$Page); - + } diff --git a/sections/forums/thread.php b/sections/forums/thread.php index 89dcdcbd..97151174 100644 --- a/sections/forums/thread.php +++ b/sections/forums/thread.php @@ -113,10 +113,10 @@ } //Handle last read - - + + if (!$ThreadInfo['IsLocked'] || $ThreadInfo['IsSticky']) { - + $DB->query(" SELECT PostID FROM forums_last_read_topics diff --git a/sections/image/index.php b/sections/image/index.php index cacdd8ca..371927c2 100644 --- a/sections/image/index.php +++ b/sections/image/index.php @@ -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."); - + } } } diff --git a/sections/inbox/inbox.php b/sections/inbox/inbox.php index 65142e73..952d03fd 100644 --- a/sections/inbox/inbox.php +++ b/sections/inbox/inbox.php @@ -123,7 +123,7 @@ Subject - + Date Forwarded to diff --git a/sections/login/index.php b/sections/login/index.php index cf2ad7f8..a992ec8e 100644 --- a/sections/login/index.php +++ b/sections/login/index.php @@ -66,7 +66,7 @@ AND i.UserID=m.ID"); $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); if ($AttemptID) { // User has attempted to log in recently $Attempts++; - if ($Attempts>5) { // Only 6 allowed login attempts, ban user's IP - $BannedUntil=time_plus(60*60*6); - $DB->query("UPDATE login_attempts SET - LastAttempt='".sqltime()."', - Attempts='".db_string($Attempts)."', - BannedUntil='".db_string($BannedUntil)."', - Bans=Bans+1 + if ($Attempts > 5) { // Only 6 allowed login attempts, ban user's IP + $BannedUntil = time_plus(60 * 60 * 6); + $DB->query(" + UPDATE login_attempts + SET + LastAttempt='".sqltime()."', + Attempts='".db_string($Attempts)."', + BannedUntil='".db_string($BannedUntil)."', + Bans=Bans+1 WHERE ID='".db_string($AttemptID)."'"); - + if ($Bans > 9) { // Automated bruteforce prevention $DB->query("SELECT Reason FROM ip_bans WHERE ".$IP." BETWEEN FromIP AND ToIP"); if ($DB->record_count() > 0) { //Ban exists already, only add new entry if not for same reason list($Reason) = $DB->next_record(MYSQLI_BOTH, false); if ($Reason != 'Automated ban per >60 failed login attempts') { - $DB->query("UPDATE ip_bans + $DB->query(" + UPDATE ip_bans SET Reason = CONCAT('Automated ban per >60 failed login attempts AND ', Reason) - WHERE FromIP = ".$IP." AND ToIP = ".$IP); + WHERE FromIP = $IP AND ToIP = $IP"); } } else { //No ban - $DB->query("INSERT IGNORE INTO ip_bans - (FromIP, ToIP, Reason) VALUES - ('$IP','$IP', 'Automated ban per >60 failed login attempts')"); + $DB->query(" + INSERT IGNORE INTO ip_bans (FromIP, ToIP, Reason) + VALUES ('$IP','$IP', 'Automated ban per >60 failed login attempts')"); $Cache->delete_value('ip_bans_'.$IPA); } } } else { // User has attempted fewer than 6 logins - $DB->query("UPDATE login_attempts SET - LastAttempt='".sqltime()."', - Attempts='".db_string($Attempts)."', - BannedUntil='0000-00-00 00:00:00' + $DB->query(" + UPDATE login_attempts + SET + LastAttempt='".sqltime()."', + Attempts='".db_string($Attempts)."', + BannedUntil='0000-00-00 00:00:00' WHERE ID='".db_string($AttemptID)."'"); } } else { // User has not attempted to log in recently - $Attempts=1; - $DB->query("INSERT INTO login_attempts - (UserID,IP,LastAttempt,Attempts) VALUES - ('".db_string($UserID)."','".db_string($IPStr)."','".sqltime()."',1)"); + $Attempts = 1; + $DB->query(" + INSERT INTO login_attempts (UserID,IP,LastAttempt,Attempts) + VALUES ('".db_string($UserID)."','".db_string($IPStr)."','".sqltime()."',1)"); } } // end log_attempt function @@ -231,7 +236,7 @@ function log_attempt($UserID) { header("Location: login.php"); die(); } - $Err=$Validate->ValidateForm($_POST); + $Err = $Validate->ValidateForm($_POST); if (!$Err) { // Passes preliminary validation (username and password "look right") @@ -274,7 +279,7 @@ function log_attempt($UserID) { isset($CustomPermissions['site_disable_ip_history']) ) { $_SERVER['REMOTE_ADDR'] = '127.0.0.1'; } - + $DB->query("INSERT INTO users_sessions (UserID, SessionID, KeepLogged, Browser, OperatingSystem, IP, LastUpdate, FullUA) @@ -290,11 +295,12 @@ function log_attempt($UserID) { )); $Cache->commit_transaction(0); - $Sql = "UPDATE users_main + $Sql = " + UPDATE users_main SET LastLogin='".sqltime()."', LastAccess='".sqltime()."'"; - + $Sql .= " WHERE ID='".db_string($UserID)."'"; $DB->query($Sql); @@ -311,7 +317,7 @@ function log_attempt($UserID) { } else { log_attempt($UserID); if ($Enabled == 2) { - + header('location:login.php?action=disabled'); } elseif ($Enabled == 0) { $Err = "Your account has not been confirmed.
    Please check your email."; @@ -320,7 +326,7 @@ function log_attempt($UserID) { } } else { log_attempt($UserID); - + $Err = "Your username or password was incorrect."; setcookie('keeplogged','',time() + 60 * 60 * 24 * 365,'/','',false); } diff --git a/sections/register/index.php b/sections/register/index.php index bc156abd..57e62394 100644 --- a/sections/register/index.php +++ b/sections/register/index.php @@ -2,7 +2,7 @@ /* if (isset($LoggedUser)) { - + //Silly user, what are you doing here! header('Location: index.php'); die(); @@ -82,7 +82,7 @@ } $IPcc = Tools::geoip($_SERVER['REMOTE_ADDR']); - + $DB->query("INSERT INTO users_main (Username,Email,PassHash,torrent_pass,IP,PermissionID,Enabled,Invites,Uploaded,ipcc) VALUES @@ -104,7 +104,7 @@ (UserID, IP, StartTime) VALUES ('$UserID', '".db_string($_SERVER['REMOTE_ADDR'])."', '".sqltime()."')"); - + $DB->query("INSERT INTO users_history_emails @@ -197,7 +197,7 @@ Tracker::update_tracker('add_user', array('id' => $UserID, 'passkey' => $torrent_pass)); $Sent = 1; - + } } elseif ($_GET['invite']) { diff --git a/sections/reportsv2/ajax_new_report.php b/sections/reportsv2/ajax_new_report.php index 9d7d054d..6d3b2f77 100644 --- a/sections/reportsv2/ajax_new_report.php +++ b/sections/reportsv2/ajax_new_report.php @@ -14,82 +14,84 @@ -$DB->query("SELECT - r.ID, - r.ReporterID, - reporter.Username, - r.TorrentID, - r.Type, - r.UserComment, - r.ResolverID, - resolver.Username, - r.Status, - r.ReportedTime, - r.LastChangeTime, - r.ModComment, - r.Track, - r.Image, - r.ExtraID, - r.Link, - r.LogMessage, - tg.Name, - tg.ID, - CASE COUNT(ta.GroupID) - WHEN 1 THEN aa.ArtistID - WHEN 0 THEN '0' - ELSE '0' - END AS ArtistID, - CASE COUNT(ta.GroupID) - WHEN 1 THEN aa.Name - WHEN 0 THEN '' - ELSE 'Various Artists' - END AS ArtistName, - tg.Year, - tg.CategoryID, - t.Time, - t.Remastered, - t.RemasterTitle, - t.RemasterYear, - t.Media, - t.Format, - t.Encoding, - t.Size, - t.HasCue, - t.HasLog, - t.LogScore, - t.UserID AS UploaderID, - t.Tasted, - uploader.Username - FROM reportsv2 AS r - LEFT JOIN torrents AS t ON t.ID=r.TorrentID - 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 artists_alias AS aa ON aa.AliasID=ta.AliasID - LEFT JOIN users_main AS resolver ON resolver.ID=r.ResolverID - LEFT JOIN users_main AS reporter ON reporter.ID=r.ReporterID - LEFT JOIN users_main AS uploader ON uploader.ID=t.UserID - WHERE r.Status = 'New' - GROUP BY r.ID - ORDER BY ReportedTime ASC - LIMIT 1"); - +$DB->query(" + SELECT + r.ID, + r.ReporterID, + reporter.Username, + r.TorrentID, + r.Type, + r.UserComment, + r.ResolverID, + resolver.Username, + r.Status, + r.ReportedTime, + r.LastChangeTime, + r.ModComment, + r.Track, + r.Image, + r.ExtraID, + r.Link, + r.LogMessage, + tg.Name, + tg.ID, + CASE COUNT(ta.GroupID) + WHEN 1 THEN aa.ArtistID + WHEN 0 THEN '0' + ELSE '0' + END AS ArtistID, + CASE COUNT(ta.GroupID) + WHEN 1 THEN aa.Name + WHEN 0 THEN '' + ELSE 'Various Artists' + END AS ArtistName, + tg.Year, + tg.CategoryID, + t.Time, + t.Remastered, + t.RemasterTitle, + t.RemasterYear, + t.Media, + t.Format, + t.Encoding, + t.Size, + t.HasCue, + t.HasLog, + t.LogScore, + t.UserID AS UploaderID, + t.Tasted, + uploader.Username + FROM reportsv2 AS r + LEFT JOIN torrents AS t ON t.ID=r.TorrentID + 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 artists_alias AS aa ON aa.AliasID=ta.AliasID + LEFT JOIN users_main AS resolver ON resolver.ID=r.ResolverID + LEFT JOIN users_main AS reporter ON reporter.ID=r.ReporterID + LEFT JOIN users_main AS uploader ON uploader.ID=t.UserID + WHERE r.Status = 'New' + GROUP BY r.ID + ORDER BY ReportedTime ASC + LIMIT 1"); if ($DB->record_count() < 1) { die(); } - - + + 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, $RemasterYear, $Media, $Format, $Encoding, $Size, $HasCue, $HasLog, $LogScore, $UploaderID, $UploaderName) = $DB->next_record(MYSQLI_BOTH, array("ModComment")); - + if (!$GroupID) { //Torrent already deleted - $DB->query("UPDATE reportsv2 - SET Status='Resolved', - LastChangeTime='".sqltime()."', - ModComment='Report already dealt with (torrent deleted)' - WHERE ID=".$ReportID); + $DB->query(" + UPDATE reportsv2 + SET + Status='Resolved', + LastChangeTime='".sqltime()."', + ModComment='Report already dealt with (torrent deleted)' + WHERE ID=".$ReportID); ?>
    @@ -250,7 +252,6 @@ $Extras = explode(' ', $ExtraIDs); foreach ($Extras as $ExtraID) { - $DB->query(" SELECT tg.Name, diff --git a/sections/reportsv2/report.php b/sections/reportsv2/report.php index 1a9520f2..548eac50 100644 --- a/sections/reportsv2/report.php +++ b/sections/reportsv2/report.php @@ -114,7 +114,7 @@ } foreach ($TypeList as $Type => $Data) { ?> - + @@ -126,7 +126,7 @@
    - query("SELECT SQL_CALC_FOUND_ROWS - r.ID, - r.ReporterID, - reporter.Username, - r.TorrentID, - r.Type, - r.UserComment, - r.ResolverID, - resolver.Username, - r.Status, - r.ReportedTime, - r.LastChangeTime, - r.ModComment, - r.Track, - r.Image, - r.ExtraID, - r.Link, - r.LogMessage, - tg.Name, - tg.ID, - CASE COUNT(ta.GroupID) - WHEN 1 THEN aa.ArtistID - WHEN 0 THEN '0' - ELSE '0' - END AS ArtistID, - CASE COUNT(ta.GroupID) - WHEN 1 THEN aa.Name - WHEN 0 THEN '' - ELSE 'Various Artists' - END AS ArtistName, - tg.Year, - tg.CategoryID, - t.Time, - t.Remastered, - t.RemasterTitle, - t.RemasterYear, - t.Media, - t.Format, - t.Encoding, - t.Size, - t.HasCue, - t.HasLog, - t.LogScore, - t.UserID AS UploaderID, - uploader.Username - FROM reportsv2 AS r - LEFT JOIN torrents AS t ON t.ID=r.TorrentID - 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 artists_alias AS aa ON aa.AliasID=ta.AliasID - LEFT JOIN users_main AS resolver ON resolver.ID=r.ResolverID - LEFT JOIN users_main AS reporter ON reporter.ID=r.ReporterID - LEFT JOIN users_main AS uploader ON uploader.ID=t.UserID " - .$Where." - GROUP BY r.ID " - .$Order." - LIMIT ".$Limit); +$DB->query(" + SELECT SQL_CALC_FOUND_ROWS + r.ID, + r.ReporterID, + reporter.Username, + r.TorrentID, + r.Type, + r.UserComment, + r.ResolverID, + resolver.Username, + r.Status, + r.ReportedTime, + r.LastChangeTime, + r.ModComment, + r.Track, + r.Image, + r.ExtraID, + r.Link, + r.LogMessage, + tg.Name, + tg.ID, + CASE COUNT(ta.GroupID) + WHEN 1 THEN aa.ArtistID + WHEN 0 THEN '0' + ELSE '0' + END AS ArtistID, + CASE COUNT(ta.GroupID) + WHEN 1 THEN aa.Name + WHEN 0 THEN '' + ELSE 'Various Artists' + END AS ArtistName, + tg.Year, + tg.CategoryID, + t.Time, + t.Remastered, + t.RemasterTitle, + t.RemasterYear, + t.Media, + t.Format, + t.Encoding, + t.Size, + t.HasCue, + t.HasLog, + t.LogScore, + t.UserID AS UploaderID, + uploader.Username + FROM reportsv2 AS r + LEFT JOIN torrents AS t ON t.ID=r.TorrentID + 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 artists_alias AS aa ON aa.AliasID=ta.AliasID + LEFT JOIN users_main AS resolver ON resolver.ID=r.ResolverID + LEFT JOIN users_main AS reporter ON reporter.ID=r.ReporterID + LEFT JOIN users_main AS uploader ON uploader.ID=t.UserID + $Where + GROUP BY r.ID + $Order + LIMIT $Limit"); $Reports = $DB->to_array(); $DB->query('SELECT FOUND_ROWS()'); list($Results) = $DB->next_record(); -$PageLinks=Format::get_pages($Page,$Results,REPORTS_PER_PAGE,11); +$PageLinks = Format::get_pages($Page, $Results, REPORTS_PER_PAGE, 11); View::show_header('Reports V2!', 'reportsv2,bbcode'); @@ -222,19 +223,21 @@ query("UPDATE reportsv2 SET - Status='Resolved', - LastChangeTime='".sqltime()."', - ModComment='Report already dealt with (torrent deleted)' - WHERE ID=".$ReportID); + $DB->query(" + UPDATE reportsv2 + SET + Status='Resolved', + LastChangeTime='".sqltime()."', + ModComment='Report already dealt with (torrent deleted)' + WHERE ID=".$ReportID); $Cache->decrement('num_torrent_reportsv2'); ?>
    @@ -406,41 +409,41 @@ $Extras = explode(' ', $ExtraIDs); foreach ($Extras as $ExtraID) { - - $DB->query("SELECT - tg.Name, - tg.ID, - CASE COUNT(ta.GroupID) - WHEN 1 THEN aa.ArtistID - WHEN 0 THEN '0' - ELSE '0' - END AS ArtistID, - CASE COUNT(ta.GroupID) - WHEN 1 THEN aa.Name - WHEN 0 THEN '' - ELSE 'Various Artists' - END AS ArtistName, - tg.Year, - t.Time, - t.Remastered, - t.RemasterTitle, - t.RemasterYear, - t.Media, - t.Format, - t.Encoding, - t.Size, - t.HasCue, - t.HasLog, - t.LogScore, - t.UserID AS UploaderID, - uploader.Username - FROM torrents AS t - 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 artists_alias AS aa ON aa.AliasID=ta.AliasID - LEFT JOIN users_main AS uploader ON uploader.ID=t.UserID - WHERE t.ID='$ExtraID' - GROUP BY tg.ID"); + $DB->query(" + SELECT + tg.Name, + tg.ID, + CASE COUNT(ta.GroupID) + WHEN 1 THEN aa.ArtistID + WHEN 0 THEN '0' + ELSE '0' + END AS ArtistID, + CASE COUNT(ta.GroupID) + WHEN 1 THEN aa.Name + WHEN 0 THEN '' + ELSE 'Various Artists' + END AS ArtistName, + tg.Year, + t.Time, + t.Remastered, + t.RemasterTitle, + t.RemasterYear, + t.Media, + t.Format, + t.Encoding, + t.Size, + t.HasCue, + t.HasLog, + t.LogScore, + t.UserID AS UploaderID, + uploader.Username + FROM torrents AS t + 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 artists_alias AS aa ON aa.AliasID=ta.AliasID + LEFT JOIN users_main AS uploader ON uploader.ID=t.UserID + WHERE t.ID='$ExtraID' + GROUP BY tg.ID"); 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()); diff --git a/sections/requests/takevote.php b/sections/requests/takevote.php index 7cfb057a..12eb6878 100644 --- a/sections/requests/takevote.php +++ b/sections/requests/takevote.php @@ -62,7 +62,7 @@ // Subtract amount from user $DB->query("UPDATE users_main SET Uploaded = (Uploaded - $Amount) WHERE ID = ".$LoggedUser['ID']); $Cache->delete_value('user_stats_'.$LoggedUser['ID']); - + Requests::update_sphinx_requests($RequestID); echo 'success'; } elseif ($LoggedUser['BytesUploaded'] < $Amount) { diff --git a/sections/rules/upload.php b/sections/rules/upload.php index e46a9e74..0ac6fd75 100644 --- a/sections/rules/upload.php +++ b/sections/rules/upload.php @@ -361,7 +361,7 @@ - Note: The "Year" tag is optional, but strongly encouraged. However, if missing or incorrect, this is not grounds for trumping a torrent. + Note: The "Year" tag is optional but strongly encouraged. However, if missing or incorrect, this is not grounds for trumping a torrent.
  • ↑_ 2.3.17. The torrent artist for classical works should use the full composer name. Before uploading see this wiki for guidelines on uploading classical music torrents. Also, consult this wiki for a full explanation of the classical music tagging system.
  • ↑_ 2.3.18. Newly re-tagged torrents trumping badly tagged torrents must reflect a substantial improvement over the previous tags. 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 MusicBrainz or Discogs. 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 MusicBrainz and in Discogs. 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 tagging guidelines.
  • diff --git a/sections/schedule/index.php b/sections/schedule/index.php index 4a902229..5b526678 100644 --- a/sections/schedule/index.php +++ b/sections/schedule/index.php @@ -302,7 +302,7 @@ function next_hour() { $AgoMins = time_minus(60 * 30); $AgoDays = time_minus(3600 * 24 * 30); - + $SessionQuery = $DB->query("SELECT UserID, SessionID FROM users_sessions @@ -316,7 +316,7 @@ function next_hour() { $Cache->commit_transaction(0); } - + //------------- Lower Login Attempts ------------------------------------// $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)."'"); @@ -593,7 +593,7 @@ function next_hour() { i.AdminComment=CONCAT('$sqltime - Leeching ability disabled by ratio watch system - required ratio: ', m.RequiredRatio,'', i.AdminComment) WHERE m.ID 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 $InactivityExceptionsMade = array(//UserID => expiry time of exception - + ); foreach ($TorrentIDs as $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)"); } - + // Daily top 10 history. $DB->query("INSERT INTO top10_history (Date, Type) VALUES ('".$sqltime."', 'Daily')"); diff --git a/sections/staffpm/assign.php b/sections/staffpm/assign.php index 0306fcd8..374b9ab6 100644 --- a/sections/staffpm/assign.php +++ b/sections/staffpm/assign.php @@ -70,7 +70,7 @@ AssignedToUser=$NewLevel, Level=$Level WHERE ID=$ConvID"); - + } echo '1'; diff --git a/sections/staffpm/takepost.php b/sections/staffpm/takepost.php index bb6e3867..49d6657d 100644 --- a/sections/staffpm/takepost.php +++ b/sections/staffpm/takepost.php @@ -1,7 +1,7 @@ query(" INSERT INTO staff_pm_conversations @@ -25,8 +25,6 @@ // Check if conversation belongs to user $DB->query("SELECT UserID, AssignedToUser FROM staff_pm_conversations WHERE ID=$ConvID"); list($UserID, $AssignedToUser) = $DB->next_record(); - - if ($UserID == $LoggedUser['ID'] || $IsFLS || $UserID == $AssignedToUser) { // Response to existing conversation @@ -40,11 +38,17 @@ // Update conversation if ($IsFLS) { // FLS/Staff - $DB->query("UPDATE staff_pm_conversations SET Date='".sqltime()."', Unread=true, Status='Open' WHERE ID=$ConvID"); + $DB->query(" + UPDATE staff_pm_conversations + SET Date='".sqltime()."', Unread=true, Status='Open' + WHERE ID=$ConvID"); $Cache->delete_value('num_staff_pms_'.$LoggedUser['ID']); } else { // User - $DB->query("UPDATE staff_pm_conversations SET Date='".sqltime()."', Unread=true, Status='Unanswered' WHERE ID=$ConvID"); + $DB->query(" + UPDATE staff_pm_conversations + SET Date='".sqltime()."', Unread=true, Status='Unanswered' + WHERE ID=$ConvID"); } // Clear cache for user @@ -56,18 +60,17 @@ // User is trying to respond to conversation that does no belong to them error(403); } - } else { - // Message but no subject or conversation id + // Message but no subject or conversation ID header("Location: staffpm.php?action=viewconv&id=$ConvID"); } } elseif ($ConvID = (int)$_POST['convid']) { - // No message, but conversation id + // No message, but conversation ID header("Location: staffpm.php?action=viewconv&id=$ConvID"); } else { - // No message or conversation id + // No message or conversation ID header('Location: staffpm.php'); } diff --git a/sections/stats/users.php b/sections/stats/users.php index d6bbb134..8caf71e2 100644 --- a/sections/stats/users.php +++ b/sections/stats/users.php @@ -59,14 +59,14 @@ } if (!$PlatformDistribution = $Cache->get_value('platform_distribution')) { include_once(SERVER_ROOT.'/classes/class_charts.php'); - - + + $DB->query(" SELECT OperatingSystem, COUNT(UserID) AS Users FROM users_sessions GROUP BY OperatingSystem ORDER BY Users DESC"); - + $Platforms = $DB->to_array(); $Pie = new PIE_CHART(750,400,array('Other'=>1,'Percentage'=>1)); foreach ($Platforms as $Platform) { @@ -82,7 +82,7 @@ if (!$BrowserDistribution = $Cache->get_value('browser_distribution')) { include_once(SERVER_ROOT.'/classes/class_charts.php'); - + $DB->query(" SELECT Browser, COUNT(UserID) AS Users diff --git a/sections/tools/index.php b/sections/tools/index.php index 26768799..860c301c 100644 --- a/sections/tools/index.php +++ b/sections/tools/index.php @@ -163,7 +163,7 @@ $DB->query("INSERT INTO news (UserID, Title, Body, Time) VALUES ('$LoggedUser[ID]', '".db_string($_POST['title'])."', '".db_string($_POST['body'])."', '".sqltime()."')"); - + $Cache->cache_value('news_latest_id', $DB->inserted_id(), 0); $Cache->delete_value('news'); diff --git a/sections/tools/tools.php b/sections/tools/tools.php index ece44b85..8361ebbe 100644 --- a/sections/tools/tools.php +++ b/sections/tools/tools.php @@ -51,7 +51,7 @@
    - + @@ -74,7 +74,7 @@ - diff --git a/sections/torrents/browse2.php b/sections/torrents/browse2.php index f32e0f52..d70c13c3 100644 --- a/sections/torrents/browse2.php +++ b/sections/torrents/browse2.php @@ -1018,7 +1018,7 @@ function header_link($SortKey,$DefaultWay="desc") { - > + > " title="Report">RP | ED - - + | RM - - + | PL ] » @@ -561,18 +560,17 @@ function filelist($Str) {
    Uploaded by - -= 1209600) { ?> += 1209600) { ?>
    Last active: - +
    Last active: -= 345678 && time() - strtotime($LastReseedRequest) >= 864000) { ?> += 345678 && time() - strtotime($LastReseedRequest) >= 864000) { ?>
    Request re-seed - + - +
    @@ -585,7 +583,7 @@ function filelist($Str) { View download listView snatch list - +View file listView report information diff --git a/sections/torrents/functions.php b/sections/torrents/functions.php index 9135c6e5..4ac0747e 100644 --- a/sections/torrents/functions.php +++ b/sections/torrents/functions.php @@ -458,8 +458,8 @@ function filelist($Str) { $EditionID++; ?> - - + + - + - - - - + + + + - + - +
    Registration log
    Invite pool
    Upscale pool
    User flow
    Manipulate tree
    Update GeoIP
    (Max)
    - [ + [ - | FL + | FL - | RP + | RP - | ED + | ED - | RM + | RM - | PL + | PL ] - » + »
    - Uploaded by + Uploaded by = 1209600) { ?> -
    Last active: +
    Last active: -
    Last active: +
    Last active: = 345678 && time() - strtotime($LastReseedRequest) >= 864000) { ?> -
    Request re-seed +
    Request re-seed
    - - - - + + + + - + ' . $Text->full_format($Description) . ''; diff --git a/sections/torrents/index.php b/sections/torrents/index.php index 15d6efa6..7d34cfa3 100644 --- a/sections/torrents/index.php +++ b/sections/torrents/index.php @@ -247,16 +247,21 @@ function js_pages($Action, $TorrentID, $NumResults, $CurrentPage) { } // Mainly - $DB->query("SELECT - tc.Body, - tc.AuthorID, - tc.GroupID, - tc.AddedTime + $DB->query(" + SELECT + tc.Body, + tc.AuthorID, + tc.GroupID, + tc.AddedTime FROM torrents_comments AS tc WHERE tc.ID='".db_string($_POST['post'])."'"); - list($OldBody, $AuthorID,$GroupID,$AddedTime)=$DB->next_record(); + list($OldBody, $AuthorID,$GroupID,$AddedTime) = $DB->next_record(); - $DB->query("SELECT ceil(COUNT(ID) / ".TORRENT_COMMENTS_PER_PAGE.") AS Page FROM torrents_comments WHERE GroupID = $GroupID AND ID <= $_POST[post]"); + $DB->query(" + SELECT ceil(COUNT(ID) / ".TORRENT_COMMENTS_PER_PAGE.") AS Page + FROM torrents_comments + WHERE GroupID = $GroupID + AND ID <= $_POST[post]"); list($Page) = $DB->next_record(); if ($LoggedUser['ID'] != $AuthorID && !check_perms('site_moderate_forums')) { @@ -267,10 +272,12 @@ function js_pages($Action, $TorrentID, $NumResults, $CurrentPage) { } // Perform the update - $DB->query("UPDATE torrents_comments SET - Body = '".db_string($_POST['body'])."', - EditedUserID = '".db_string($LoggedUser['ID'])."', - EditedTime = '".sqltime()."' + $DB->query(" + UPDATE torrents_comments + SET + Body = '".db_string($_POST['body'])."', + EditedUserID = '".db_string($LoggedUser['ID'])."', + EditedTime = '".sqltime()."' WHERE ID='".db_string($_POST['post'])."'"); // Update the cache diff --git a/sections/torrents/redownload.php b/sections/torrents/redownload.php index 590879b9..6fa9bfb0 100644 --- a/sections/torrents/redownload.php +++ b/sections/torrents/redownload.php @@ -17,7 +17,7 @@ if (empty($_GET['type'])) { error(0); } else { - + switch ($_GET['type']) { case 'uploads': if (!check_paranoia('uploads', $User['Paranoia'], $UserClass, $UserID)) { @@ -45,19 +45,20 @@ } } -$DownloadsQ = $DB->query("SELECT - t.ID AS TorrentID, - DATE_FORMAT(".$Month.",'%Y - %m') AS Month, - t.GroupID, - t.Media, - t.Format, - t.Encoding, - IF(t.RemasterYear=0,tg.Year,t.RemasterYear) AS Year, - tg.Name, - t.Size +$DownloadsQ = $DB->query(" + SELECT + t.ID AS TorrentID, + DATE_FORMAT($Month,'%Y - %m') AS Month, + t.GroupID, + t.Media, + t.Format, + t.Encoding, + IF(t.RemasterYear=0,tg.Year,t.RemasterYear) AS Year, + tg.Name, + t.Size FROM torrents as t - JOIN torrents_group AS tg ON t.GroupID=tg.ID - ".$SQL." + JOIN torrents_group AS tg ON t.GroupID=tg.ID + $SQL GROUP BY TorrentID"); $Collector = new TorrentsDL($DownloadsQ, "$Username's ".ucfirst($_GET['type'])); @@ -65,7 +66,10 @@ while (list($Downloads, $GroupIDs) = $Collector->get_downloads('TorrentID')) { $Artists = Artists::get_artists($GroupIDs); $TorrentIDs = array_keys($GroupIDs); - $TorrentFilesQ = $DB->query("SELECT TorrentID, File FROM torrents_files WHERE TorrentID IN (".implode(',', $TorrentIDs).")", false); + $TorrentFilesQ = $DB->query(' + SELECT TorrentID, File + FROM torrents_files + WHERE TorrentID IN ('.implode(',', $TorrentIDs).')', false); if (is_int($TorrentFilesQ)) { // Query failed. Let's not create a broken zip archive foreach ($TorrentIDs as $TorrentID) { diff --git a/sections/torrents/user.php b/sections/torrents/user.php index 3a3756ac..2ec0533b 100644 --- a/sections/torrents/user.php +++ b/sections/torrents/user.php @@ -28,7 +28,7 @@ function header_link($SortKey,$DefaultWay="DESC") { if (!empty($_GET['page']) && is_number($_GET['page']) && $_GET['page'] > 0) { $Page = $_GET['page']; - $Limit = ($Page-1)*TORRENTS_PER_PAGE.', '.TORRENTS_PER_PAGE; + $Limit = ($Page - 1) * TORRENTS_PER_PAGE.', '.TORRENTS_PER_PAGE; } else { $Page = 1; $Limit = TORRENTS_PER_PAGE; @@ -461,7 +461,7 @@ function header_link($SortKey,$DefaultWay="DESC") { extract(Torrents::array_group($Results[$GroupID])); $Torrent = $Torrents[$TorrentID]; - + $TorrentTags = new Tags($TagList); @@ -512,7 +512,7 @@ function header_link($SortKey,$DefaultWay="DESC") { >
    diff --git a/sections/torrents/vote.php b/sections/torrents/vote.php index 065e7c31..d09cda40 100644 --- a/sections/torrents/vote.php +++ b/sections/torrents/vote.php @@ -5,12 +5,12 @@ $TotalVotes = $GroupVotes['Total']; $UpVotes = $GroupVotes['Ups']; - $Voted = isset($UserVotes[$GroupID])?$UserVotes[$GroupID]['Type']:false; + $Voted = isset($UserVotes[$GroupID]) ? $UserVotes[$GroupID]['Type'] : false; ?>
    Album votes
    - This has out of total. + This has out of total.

    @@ -48,33 +52,33 @@
    • Forum posts: View
    • - >Torrent comments: + >Torrent comments: - View + View - >Artist comments: + >Artist comments: - View + View - >Request comments: + >Request comments: - View + View - >Collages started: + >Collages started: - View + View - >Collages contributed to: + >Collages contributed to: - View + View Requests filled: for
    • - >Requests filled: - > for - View + >Requests filled: + > for + View
    • Requests voted: for
    • - >Requests created: - > for - View + >Requests created: + > for + View
    • - >Requests voted: - > for - View + >Requests voted: + > for + View
    • - >Uploaded: + >Uploaded: - View + View - Download + Download - >Unique groups: + >Unique groups: - View + View - >"Perfect" FLACs: + >"Perfect" FLACs: - View + View query("SELECT IF(remaining=0,'Seeding','Leeching') AS Type, COUNT(x.uid) - FROM xbt_files_users AS x - INNER JOIN torrents AS t ON t.ID=x.fid - WHERE x.uid='$UserID' AND x.active=1 - GROUP BY Type"); + $DB->query(" + SELECT IF(remaining=0,'Seeding','Leeching') AS Type, COUNT(x.uid) + FROM xbt_files_users AS x + INNER JOIN torrents AS t ON t.ID=x.fid + WHERE x.uid='$UserID' + AND x.active=1 + GROUP BY Type"); $PeerCount = $DB->to_array(0, MYSQLI_NUM, false); - $Seeding = isset($PeerCount['Seeding'][1]) ? $PeerCount['Seeding'][1] : 0; - $Leeching = isset($PeerCount['Leeching'][1]) ? $PeerCount['Leeching'][1] : 0; + $Seeding = (isset($PeerCount['Seeding'][1]) ? $PeerCount['Seeding'][1] : 0); + $Leeching = (isset($PeerCount['Leeching'][1]) ? $PeerCount['Leeching'][1] : 0); } ?> - >Seeding: + >Seeding: 0 ) - ? ' (' . 100 * min(1,round($Seeding / $UniqueSnatched,2)).'%)' : ''); ?> - View + ? ' (' . 100 * min(1, round($Seeding / $UniqueSnatched, 2)).'%)' : ''); ?> + View Download - >Leeching: + >Leeching: - View + View (Disabled)
      ' : '' ?> - >Snatched: + >Snatched: - ('.number_format($UniqueSnatched).'' : number_format($UniqueSnatched) ?>) + ('.number_format($UniqueSnatched).'' : number_format($UniqueSnatched))?>) - View + View Download query("SELECT COUNT(ud.UserID), COUNT(DISTINCT ud.TorrentID) - FROM users_downloads AS ud - INNER JOIN torrents AS t ON t.ID=ud.TorrentID - WHERE ud.UserID='$UserID'"); + $DB->query(" + SELECT COUNT(ud.UserID), COUNT(DISTINCT ud.TorrentID) + FROM users_downloads AS ud + INNER JOIN torrents AS t ON t.ID=ud.TorrentID + WHERE ud.UserID='$UserID'"); list($NumDownloads, $UniqueDownloads) = $DB->next_record(); ?> - >Downloaded: () + >Downloaded: () View query("SELECT - m.Username, - m.Email, - m.IRCKey, - m.Paranoia, - i.Info, - i.Avatar, - i.Country, - i.StyleID, - i.StyleURL, - i.SiteOptions, - i.UnseededAlerts, - p.Level AS Class - FROM users_main AS m - JOIN users_info AS i ON i.UserID = m.ID - LEFT JOIN permissions AS p ON p.ID=m.PermissionID - WHERE m.ID = '".db_string($UserID)."'"); -list($Username,$Email,$IRCKey,$Paranoia,$Info,$Avatar,$Country,$StyleID,$StyleURL,$SiteOptions,$UnseededAlerts,$Class)=$DB->next_record(MYSQLI_NUM, array(3,9)); +$DB->query(" + SELECT + m.Username, + m.Email, + m.IRCKey, + m.Paranoia, + i.Info, + i.Avatar, + i.Country, + i.StyleID, + i.StyleURL, + i.SiteOptions, + i.UnseededAlerts, + p.Level AS Class + FROM users_main AS m + JOIN users_info AS i ON i.UserID = m.ID + LEFT JOIN permissions AS p ON p.ID=m.PermissionID + WHERE m.ID = '".db_string($UserID)."'"); +list($Username, $Email, $IRCKey, $Paranoia, $Info, $Avatar, $Country, $StyleID, $StyleURL, $SiteOptions, $UnseededAlerts, $Class) = $DB->next_record(MYSQLI_NUM, array(3, 9)); if ($UserID != $LoggedUser['ID'] && !check_perms('users_edit_profiles', $Class)) { @@ -58,7 +59,7 @@ function checked($Checked) { $SiteOptions = array(); } -View::show_header($Username.' > Settings','user,jquery,jquery-ui,release_sort,password_validate,validate,push_settings,cssgallery'); +View::show_header($Username.' > Settings','user,jquery,jquery-ui,release_sort,password_validate,validate,push_settings,cssgallery,preview_paranoia'); @@ -99,7 +100,7 @@ function checked($Checked) {
      -

      +

    @@ -267,7 +268,7 @@ function checked($Checked) { - + Auto-save text @@ -469,6 +470,10 @@ function checked($Checked) {
    + + + Preview paranoia + Reset passkey diff --git a/sections/user/index.php b/sections/user/index.php index c9e9d011..010a40b0 100644 --- a/sections/user/index.php +++ b/sections/user/index.php @@ -38,9 +38,7 @@ case 'search':// User search if (check_perms('admin_advanced_user_search') && check_perms('users_view_ips') && check_perms('users_view_email')) { include('advancedsearch.php'); - } - - else { + } else { include('search.php'); } break; @@ -95,8 +93,8 @@ $Cache->delete_value('collage_subs_user_new_'.$UserID); include(SERVER_ROOT.'/sections/user/user.php'); break; - - //Provide public methods for Last.fm data gets. + + // Provide public methods for Last.fm data gets. case 'lastfm_compare': if (isset($_GET['username'])) { echo LastFM::compare_user_with($_GET['username']); diff --git a/sections/user/invite.php b/sections/user/invite.php index bdd76b64..a99aa13f 100644 --- a/sections/user/invite.php +++ b/sections/user/invite.php @@ -15,7 +15,7 @@ $UserID = $LoggedUser['ID']; $Sneaky = false; - + } list($UserID, $Username, $PermissionID) = array_values(Users::user_info($UserID)); diff --git a/sections/user/lastfm.php b/sections/user/lastfm.php index 7143e41f..38f80802 100644 --- a/sections/user/lastfm.php +++ b/sections/user/lastfm.php @@ -10,9 +10,9 @@
    Last.fm
    • - Username: + Username:
    • -
      data-uid=""> +
      data-uid="">
    • Show more info diff --git a/sections/user/search.php b/sections/user/search.php index d1c2609b..d3b3ea7d 100644 --- a/sections/user/search.php +++ b/sections/user/search.php @@ -4,14 +4,14 @@ **********************************************************************/ if (!empty($_GET['search'])) { - + $_GET['username'] = $_GET['search']; } define('USERS_PER_PAGE', 30); if (isset($_GET['username'])) { - + $_GET['username'] = trim($_GET['username']); // form submitted $Val->SetFields('username','1','username','Please enter a username.'); diff --git a/sections/user/takeedit.php b/sections/user/takeedit.php index 76ec0595..9e03f01b 100644 --- a/sections/user/takeedit.php +++ b/sections/user/takeedit.php @@ -150,7 +150,7 @@ die(); } - + } //End Email change @@ -271,17 +271,20 @@ -$SQL="UPDATE users_main AS m JOIN users_info AS i ON m.ID=i.UserID SET - i.StyleID='".db_string($_POST['stylesheet'])."', - i.StyleURL='".db_string($_POST['styleurl'])."', - i.Avatar='".db_string($_POST['avatar'])."', - i.SiteOptions='".db_string(serialize($Options))."', - i.NotifyOnQuote = '".db_string($Options['NotifyOnQuote'])."', - i.Info='".db_string($_POST['info'])."', - i.DownloadAlt='$DownloadAlt', - i.UnseededAlerts='$UnseededAlerts', - m.Email='".db_string($_POST['email'])."', - m.IRCKey='".db_string($_POST['irckey'])."',"; +$SQL = " + UPDATE users_main AS m + JOIN users_info AS i ON m.ID=i.UserID + SET + i.StyleID='".db_string($_POST['stylesheet'])."', + i.StyleURL='".db_string($_POST['styleurl'])."', + i.Avatar='".db_string($_POST['avatar'])."', + i.SiteOptions='".db_string(serialize($Options))."', + i.NotifyOnQuote = '".db_string($Options['NotifyOnQuote'])."', + i.Info='".db_string($_POST['info'])."', + 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))."'"; @@ -289,24 +292,25 @@ $ChangerIP = db_string($LoggedUser['IP']); $PassHash=Users::make_crypt_hash($_POST['new_pass_1']); $SQL.=",m.PassHash='".db_string($PassHash)."'"; - $DB->query("INSERT INTO users_history_passwords - (UserID, ChangerIP, ChangeTime) VALUES - ('$UserID', '$ChangerIP', '".sqltime()."')"); + $DB->query(" + INSERT INTO users_history_passwords + (UserID, ChangerIP, ChangeTime) + VALUES + ('$UserID', '$ChangerIP', '".sqltime()."')"); - } if (isset($_POST['resetpasskey'])) { - - $UserInfo = Users::user_heavy_info($UserID); $OldPassKey = db_string($UserInfo['torrent_pass']); $NewPassKey = db_string(Users::make_secret()); $ChangerIP = db_string($LoggedUser['IP']); $SQL.=",m.torrent_pass='$NewPassKey'"; - $DB->query("INSERT INTO users_history_passkeys - (UserID, OldPassKey, NewPassKey, ChangerIP, ChangeTime) VALUES + $DB->query(" + INSERT INTO users_history_passkeys + (UserID, OldPassKey, NewPassKey, ChangerIP, ChangeTime) + VALUES ('$UserID', '$OldPassKey', '$NewPassKey', '$ChangerIP', '".sqltime()."')"); $Cache->begin_transaction('user_info_heavy_'.$UserID); $Cache->update_row(false, array('torrent_pass'=>$NewPassKey)); diff --git a/sections/user/takeinvite.php b/sections/user/takeinvite.php index c94c78cd..1d24f386 100644 --- a/sections/user/takeinvite.php +++ b/sections/user/takeinvite.php @@ -81,7 +81,7 @@ Misc::send_email($CurEmail, 'You have been invited to '.SITE_NAME, $Message,'noreply'); - + } header('Location: user.php?action=invite'); diff --git a/sections/user/takemoderate.php b/sections/user/takemoderate.php index ed6dc59f..14ae10e2 100644 --- a/sections/user/takemoderate.php +++ b/sections/user/takemoderate.php @@ -228,10 +228,10 @@ $Cache->delete_value('session_'.$UserID.'_'.$SessionID); } $Cache->delete_value('users_sessions_'.$UserID); - - + + $DB->query("DELETE FROM users_sessions WHERE UserID='$UserID'"); - + } } @@ -340,7 +340,7 @@ $Values = array(); foreach ($AddedClasses as $PermID) { $Values[] = "($UserID, $PermID)"; - + } $DB->query("INSERT INTO users_levels (UserID, PermissionID) VALUES ".implode(', ',$Values)); //$LightUpdates['ExtraClasses'] = array_fill_keys($SecondaryClasses, 1); @@ -653,10 +653,10 @@ $Cache->delete_value('session_'.$UserID.'_'.$SessionID); } $Cache->delete_value('users_sessions_'.$UserID); - - + + $DB->query("DELETE FROM users_sessions WHERE UserID='$UserID'"); - + } if (empty($UpdateSet) && empty($EditSummary)) { @@ -695,13 +695,13 @@ $Summary .= "\nReason: ".$Reason; } - + $Summary .= "\n\n".$AdminComment; } elseif (empty($UpdateSet) && empty($EditSummary) && $Cur['AdminComment'] == $_POST['AdminComment']) { $Summary = sqltime().' - '.'Comment added by '.$LoggedUser['Username'].': '.$Reason."\n\n"; - + } @@ -718,11 +718,11 @@ $SET = implode(', ', $UpdateSet); -$sql = "UPDATE users_main AS m JOIN users_info AS i ON m.ID=i.UserID SET $SET WHERE m.ID='$UserID'"; +$SQL = "UPDATE users_main AS m JOIN users_info AS i ON m.ID=i.UserID SET $SET WHERE m.ID='$UserID'"; // Perform update -//die($sql); -$DB->query($sql); +//die($SQL); +$DB->query($SQL); if (isset($ClearStaffIDCache)) { $Cache->delete_value('staff_ids'); @@ -731,8 +731,8 @@ // redirect to user page header("location: user.php?id=$UserID"); -function translateUserStatus($status) { - switch ($status) { +function translateUserStatus($Status) { + switch ($Status) { case 0: return 'Unconfirmed'; case 1: @@ -740,18 +740,18 @@ function translateUserStatus($status) { case 2: return 'Disabled'; default: - return $status; + return $Status; } } -function translateLeechStatus($status) { - switch ($status) { +function translateLeechStatus($Status) { + switch ($Status) { case 0: return 'Disabled'; case 1: return 'Enabled'; default: - return $status; + return $Status; } } ?> diff --git a/sections/user/user.php b/sections/user/user.php index d77c16b6..be223d33 100644 --- a/sections/user/user.php +++ b/sections/user/user.php @@ -3,109 +3,123 @@ include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class $Text = new TEXT; -if (empty($_GET['id']) || !is_numeric($_GET['id'])) - error(404); +include(SERVER_ROOT.'/sections/requests/functions.php'); +if (empty($_GET['id']) || !is_numeric($_GET['id']) || (!empty($_GET['preview']) && !is_numeric($_GET['preview']))) { + error(404); +} $UserID = $_GET['id']; +$Preview = $_GET['preview']; if ($UserID == $LoggedUser['ID']) { $OwnProfile = true; + if ($Preview == 1) { + $OwnProfile = false; + $ParanoiaString = $_GET['paranoia']; + $CustomParanoia = explode(',', $ParanoiaString); + } } else { $OwnProfile = false; + //Don't allow any kind of previewing on others' profiles + $Preview = 0; } if (check_perms('users_mod')) { // Person viewing is a staff member - $DB->query("SELECT - m.Username, - m.Email, - m.LastAccess, - m.IP, - p.Level AS Class, - m.Uploaded, - m.Downloaded, - m.RequiredRatio, - m.Title, - m.torrent_pass, - m.Enabled, - m.Paranoia, - m.Invites, - m.can_leech, - m.Visible, - i.JoinDate, - i.Info, - i.Avatar, - i.Country, - i.AdminComment, - i.Donor, - i.Artist, - i.Warned, - i.SupportFor, - i.RestrictedForums, - i.PermittedForums, - i.Inviter, - inviter.Username, - COUNT(posts.id) AS ForumPosts, - i.RatioWatchEnds, - i.RatioWatchDownload, - i.DisableAvatar, - i.DisableInvites, - i.DisablePosting, - i.DisableForums, - i.DisableTagging, - i.DisableUpload, - i.DisableWiki, - i.DisablePM, - i.DisableIRC, - i.DisableRequests, - i.HideCountryChanges, - m.FLTokens, - SHA1(i.AdminComment) + $DB->query(" + SELECT + m.Username, + m.Email, + m.LastAccess, + m.IP, + p.Level AS Class, + m.Uploaded, + m.Downloaded, + m.RequiredRatio, + m.Title, + m.torrent_pass, + m.Enabled, + m.Paranoia, + m.Invites, + m.can_leech, + m.Visible, + i.JoinDate, + i.Info, + i.Avatar, + i.Country, + i.AdminComment, + i.Donor, + i.Artist, + i.Warned, + i.SupportFor, + i.RestrictedForums, + i.PermittedForums, + i.Inviter, + inviter.Username, + COUNT(posts.id) AS ForumPosts, + i.RatioWatchEnds, + i.RatioWatchDownload, + i.DisableAvatar, + i.DisableInvites, + i.DisablePosting, + i.DisableForums, + i.DisableTagging, + i.DisableUpload, + i.DisableWiki, + i.DisablePM, + i.DisableIRC, + i.DisableRequests, + i.HideCountryChanges, + m.FLTokens, + SHA1(i.AdminComment) FROM users_main AS m JOIN users_info AS i ON i.UserID = m.ID LEFT JOIN users_main AS inviter ON i.Inviter = inviter.ID LEFT JOIN permissions AS p ON p.ID=m.PermissionID LEFT JOIN forums_posts AS posts ON posts.AuthorID = m.ID - WHERE m.ID = '".$UserID."' GROUP BY AuthorID"); + WHERE m.ID = '$UserID' + GROUP BY AuthorID"); if ($DB->record_count() == 0) { // If user doesn't exist header("Location: log.php?search=User+".$UserID); } - list($Username, $Email, $LastAccess, $IP, $Class, $Uploaded, $Downloaded, $RequiredRatio, $CustomTitle, $torrent_pass, $Enabled, $Paranoia, $Invites, $DisableLeech, $Visible, $JoinDate, $Info, $Avatar, $Country, $AdminComment, $Donor, $Artist, $Warned, $SupportFor, $RestrictedForums, $PermittedForums, $InviterID, $InviterName, $ForumPosts, $RatioWatchEnds, $RatioWatchDownload, $DisableAvatar, $DisableInvites, $DisablePosting, $DisableForums, $DisableTagging, $DisableUpload, $DisableWiki, $DisablePM, $DisableIRC, $DisableRequests, $DisableCountry, $FLTokens, $CommentHash) = $DB->next_record(MYSQLI_NUM, array(8,11)); + list($Username, $Email, $LastAccess, $IP, $Class, $Uploaded, $Downloaded, $RequiredRatio, $CustomTitle, $torrent_pass, $Enabled, $Paranoia, $Invites, $DisableLeech, $Visible, $JoinDate, $Info, $Avatar, $Country, $AdminComment, $Donor, $Artist, $Warned, $SupportFor, $RestrictedForums, $PermittedForums, $InviterID, $InviterName, $ForumPosts, $RatioWatchEnds, $RatioWatchDownload, $DisableAvatar, $DisableInvites, $DisablePosting, $DisableForums, $DisableTagging, $DisableUpload, $DisableWiki, $DisablePM, $DisableIRC, $DisableRequests, $DisableCountry, $FLTokens, $CommentHash) = $DB->next_record(MYSQLI_NUM, array(8, 11)); } else { // Person viewing is a normal user - $DB->query("SELECT - m.Username, - m.Email, - m.LastAccess, - m.IP, - p.Level AS Class, - m.Uploaded, - m.Downloaded, - m.RequiredRatio, - m.Enabled, - m.Paranoia, - m.Invites, - m.Title, - m.torrent_pass, - m.can_leech, - i.JoinDate, - i.Info, - i.Avatar, - m.FLTokens, - i.Country, - i.Donor, - i.Warned, - COUNT(posts.id) AS ForumPosts, - i.Inviter, - i.DisableInvites, - inviter.username + $DB->query(" + SELECT + m.Username, + m.Email, + m.LastAccess, + m.IP, + p.Level AS Class, + m.Uploaded, + m.Downloaded, + m.RequiredRatio, + m.Enabled, + m.Paranoia, + m.Invites, + m.Title, + m.torrent_pass, + m.can_leech, + i.JoinDate, + i.Info, + i.Avatar, + m.FLTokens, + i.Country, + i.Donor, + i.Warned, + COUNT(posts.id) AS ForumPosts, + i.Inviter, + i.DisableInvites, + inviter.username FROM users_main AS m JOIN users_info AS i ON i.UserID = m.ID LEFT JOIN permissions AS p ON p.ID=m.PermissionID LEFT JOIN users_main AS inviter ON i.Inviter = inviter.ID LEFT JOIN forums_posts AS posts ON posts.AuthorID = m.ID - WHERE m.ID = $UserID GROUP BY AuthorID"); + WHERE m.ID = $UserID + GROUP BY AuthorID"); if ($DB->record_count() == 0) { // If user doesn't exist header("Location: log.php?search=User+".$UserID); @@ -117,14 +131,23 @@ // Image proxy CTs $DisplayCustomTitle = $CustomTitle; if (check_perms('site_proxy_images') && !empty($CustomTitle)) { - $DisplayCustomTitle = preg_replace_callback('~src=("?)(http.+?)(["\s>])~', function($Matches) { - return 'src=' . $Matches[1] . ImageTools::process($Matches[2]) . $Matches[3]; - }, $CustomTitle); + $DisplayCustomTitle = preg_replace_callback('~src=("?)(http.+?)(["\s>])~', + function($Matches) { + return 'src=' . $Matches[1] . ImageTools::process($Matches[2]) . $Matches[3]; + }, $CustomTitle); } -$Paranoia = unserialize($Paranoia); -if (!is_array($Paranoia)) { - $Paranoia = array(); +if ($Preview == 1) { + if (strlen($ParanoiaString) == 0) { + $Paranoia = array(); + } else { + $Paranoia = $CustomParanoia; + } +} else { + $Paranoia = unserialize($Paranoia); + if (!is_array($Paranoia)) { + $Paranoia = array(); + } } $ParanoiaLevel = 0; foreach ($Paranoia as $P) { @@ -138,17 +161,21 @@ $LastAccess = time_diff($LastAccess); function check_paranoia_here($Setting) { - global $Paranoia, $Class, $UserID; - return check_paranoia($Setting, $Paranoia, $Class, $UserID); + global $Paranoia, $Class, $UserID, $Preview; + if ($Preview == 1) { + return check_paranoia($Setting, $Paranoia, $Class); + } else { + return check_paranoia($Setting, $Paranoia, $Class, $UserID); + } } -$Badges=($Donor) ? 'Donor' : ''; +$Badges = (($Donor) ? 'Donor' : ''); -$Badges.=($Warned!='0000-00-00 00:00:00') ? 'Warned' : ''; -$Badges.=($Enabled == '1' || $Enabled == '0' || !$Enabled) ? '': 'Banned'; +$Badges.=(($Warned!='0000-00-00 00:00:00') ? 'Warned' : ''); +$Badges.=(($Enabled == '1' || $Enabled == '0' || !$Enabled) ? '' : 'Banned'); -View::show_header($Username,'user,bbcode,requests,jquery,lastfm'); +View::show_header($Username, 'user,bbcode,requests,jquery,lastfm'); ?>
      @@ -214,7 +241,7 @@ function check_paranoia_here($Setting) { ?>
      Avatar
      -
      <?=$Username?>'s avatar
      +
      <?=$Username?>'s avatar
      @@ -222,50 +249,58 @@ function check_paranoia_here($Setting) {
      • Joined:
      • - >Last seen: + >Last seen: - title="">Uploaded: + title="">Uploaded: - title="">Downloaded: + title="">Downloaded: - >Ratio: + >Ratio: - >Required ratio: + >Required ratio: - >Tokens: + >Tokens: - >Warning expires: + >Warning expires:
      query("SELECT - COUNT(DISTINCT r.ID), - SUM(rv.Bounty) - FROM requests AS r - LEFT JOIN requests_votes AS rv ON r.ID=rv.RequestID - WHERE r.FillerID = ".$UserID); + $DB->query(" + SELECT + COUNT(DISTINCT r.ID), + SUM(rv.Bounty) + FROM requests AS r + LEFT JOIN requests_votes AS rv ON r.ID=rv.RequestID + WHERE r.FillerID = $UserID"); list($RequestsFilled, $TotalBounty) = $DB->next_record(); } else { $RequestsFilled = $TotalBounty = 0; } if (check_paranoia_here('requestsvoted_count') || check_paranoia_here('requestsvoted_bounty')) { - $DB->query("SELECT COUNT(rv.RequestID), SUM(rv.Bounty) FROM requests_votes AS rv WHERE rv.UserID = ".$UserID); + $DB->query(" + SELECT COUNT(rv.RequestID), SUM(rv.Bounty) + FROM requests_votes AS rv + WHERE rv.UserID = $UserID"); list($RequestsVoted, $TotalSpent) = $DB->next_record(); - $DB->query('SELECT COUNT(r.ID), SUM(rv.Bounty) FROM requests AS r LEFT JOIN requests_votes AS rv ON rv.RequestID = r.ID AND rv.UserID = r.UserID WHERE r.UserID = ' . $UserID); + $DB->query(" + SELECT COUNT(r.ID), SUM(rv.Bounty) + FROM requests AS r + LEFT JOIN requests_votes AS rv ON rv.RequestID = r.ID AND rv.UserID = r.UserID + WHERE r.UserID = $UserID"); list($RequestsCreated, $RequestsCreatedSpent) = $DB->next_record(); } else { $RequestsVoted = $TotalSpent = $RequestsCreated = $RequestsCreatedSpent = 0; @@ -301,7 +336,7 @@ function check_paranoia_here($Setting) { } elseif ($Uploaded == 0) { $Ratio = 0.5; } else { - $Ratio = round($Uploaded/$Downloaded, 2); + $Ratio = round($Uploaded / $Downloaded, 2); } $OverallRank = $Rank->overall_score($UploadedRank, $DownloadedRank, $UploadsRank, $RequestRank, $PostRank, $BountyRank, $ArtistsRank, $Ratio); @@ -310,23 +345,23 @@ function check_paranoia_here($Setting) {
      Percentile rankings (hover for values)
        - title="">Data uploaded: + title="">Data uploaded: - title="">Data downloaded: + title="">Data downloaded: - title="">Torrents uploaded: + title="">Torrents uploaded: - title="">Requests filled: + title="">Requests filled: - title="">Bounty spent: + title="">Bounty spent:
      • Posts made:
      • - title="">Artists added: + title="">Artists added:
      • Overall rank:
      • @@ -362,12 +397,12 @@ function check_paranoia_here($Setting) { if (check_perms('users_view_ips',$Class)) { ?>
      • IPs: View View users
      • - +
      • Tracker IPs: View
      • Passkeys: View
      • Passwords: View
      • Stats: N/A View
      @@ -416,7 +451,7 @@ function check_paranoia_here($Setting) { } ?>
    • Paranoia level:
    • - +
    • Email: S @@ -441,7 +476,7 @@ function check_paranoia_here($Setting) { } else { $Invited=''.$InviterName.''; } - + ?>
    • Invited by:
    • Invites:
    • query("SELECT SupportFor FROM users_info WHERE UserID = ".$LoggedUser['ID']); list($SupportFor) = $DB->next_record(); } -if ($Override=check_perms('users_mod') || $OwnProfile || !empty($SupportFor)) { +if ($Override = check_perms('users_mod') || $OwnProfile || !empty($SupportFor)) { ?> -
    • >Clients: >Clients: query("SELECT DISTINCT useragent FROM xbt_files_users WHERE uid = ".$UserID); $Clients = $DB->collect(0); - echo implode("; ", $Clients); + echo implode('; ', $Clients); ?>
    • query("SELECT Enabled FROM users_main WHERE ID = ".$UserID2); - list($Enabled)=$DB->next_record(); + list($Enabled) = $DB->next_record(); $DB->set_query_id($ueQuery); ?> diff --git a/sections/userhistory/index.php b/sections/userhistory/index.php index 320948ec..63f6f23f 100644 --- a/sections/userhistory/index.php +++ b/sections/userhistory/index.php @@ -61,7 +61,7 @@ case 'catchup_collages': require('catchup_collages.php'); break; - + case 'token_history': require('token_history.php'); break; diff --git a/sections/userhistory/ip_history.php b/sections/userhistory/ip_history.php index ada36a78..6fbc84be 100644 --- a/sections/userhistory/ip_history.php +++ b/sections/userhistory/ip_history.php @@ -37,7 +37,7 @@ $SearchIPQuery = " AND h1.IP = '$SearchIP' "; } -View::show_header("IP history for $Username"); +View::show_header("IP address history for $Username"); ?>