From 9c7079266d7f94c0675d322e99bbf2cd110ebe9f Mon Sep 17 00:00:00 2001 From: Git Date: Mon, 22 Aug 2011 08:00:05 +0000 Subject: [PATCH] 7 changes from Mon Aug 22 02:37:20 2011 +0200 to Mon Aug 22 03:16:48 2011 +0000 empty fix relative date display fixes http://what.cd/forums.php?action=viewthread&threadid=138447 --- classes/class_time.php | 6 +- design/privateheader.php | 3 - gazelle.sql | 12 +++- sections/artist/edit.php | 2 +- sections/bookmarks/artists.php | 1 + sections/bookmarks/index.php | 7 +-- sections/bookmarks/torrents.php | 4 +- sections/collages/browse.php | 9 ++- sections/forums/ajax_get_edit.php | 2 +- sections/forums/thread.php | 2 +- sections/inbox/conversation.php | 4 +- sections/requests/index.php | 2 +- sections/requests/request.php | 2 +- sections/requests/takefill.php | 13 +++-- sections/tools/data/bitcoin_balance.php | 3 +- sections/tools/index.php | 4 ++ sections/tools/tools.php | 4 +- sections/torrents/details.php | 4 +- sections/user/advancedsearch.php | 36 +++++++++--- sections/user/user.php | 75 ++++++++++++++++++++++++- sections/userhistory/post_history.php | 2 +- 21 files changed, 153 insertions(+), 44 deletions(-) diff --git a/classes/class_time.php b/classes/class_time.php index 6f1488ad..f955ef16 100644 --- a/classes/class_time.php +++ b/classes/class_time.php @@ -12,7 +12,7 @@ function time_ago($TimeStamp) { return time()-$TimeStamp; } -function time_diff($TimeStamp,$Levels=2,$Span=true) { +function time_diff($TimeStamp,$Levels=2,$Span=true, $Lowercase=false) { if(!is_number($TimeStamp)) { // Assume that $TimeStamp is SQL timestamp if($TimeStamp == '0000-00-00 00:00:00') { return 'Never'; } $TimeStamp = strtotime($TimeStamp); @@ -122,6 +122,10 @@ function time_diff($TimeStamp,$Levels=2,$Span=true) { } elseif (!isset($HideAgo)) { $Return .= ' ago'; } + + if ($Lowercase) { + $Return = strtolower($Return); + } if ($Span) { return ''.$Return.''; diff --git a/design/privateheader.php b/design/privateheader.php index 1a694340..86f3c3c3 100644 --- a/design/privateheader.php +++ b/design/privateheader.php @@ -86,9 +86,6 @@ ?> > -

diff --git a/gazelle.sql b/gazelle.sql index ba62c385..f9c5614f 100644 --- a/gazelle.sql +++ b/gazelle.sql @@ -388,6 +388,15 @@ CREATE TABLE `news` ( KEY `Time` (`Time`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE `ocelot_query_times` ( + `buffer` enum('users','torrents','snatches','peers') NOT NULL, + `starttime` datetime NOT NULL, + `ocelotinstance` datetime NOT NULL, + `querylength` int(11) NOT NULL, + `timespent` int(11) NOT NULL, + UNIQUE KEY `starttime` (`starttime`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + CREATE TABLE `permissions` ( `ID` int(10) unsigned NOT NULL AUTO_INCREMENT, `Level` int(10) unsigned NOT NULL, @@ -1075,7 +1084,8 @@ CREATE TABLE `users_info` ( KEY `JoinDate` (`JoinDate`), KEY `Inviter` (`Inviter`), KEY `RatioWatchEnds` (`RatioWatchEnds`), - KEY `RatioWatchDownload` (`RatioWatchDownload`) + KEY `RatioWatchDownload` (`RatioWatchDownload`), + KEY `BitcoinAddress` (`BitcoinAddress`(4)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `users_main` ( diff --git a/sections/artist/edit.php b/sections/artist/edit.php index 0749b8f0..260b79a9 100644 --- a/sections/artist/edit.php +++ b/sections/artist/edit.php @@ -44,7 +44,7 @@

Artist info


-

Vanity House " />

+

Vanity House />

Edit summary


diff --git a/sections/bookmarks/artists.php b/sections/bookmarks/artists.php index 7513485b..25a75c11 100644 --- a/sections/bookmarks/artists.php +++ b/sections/bookmarks/artists.php @@ -41,6 +41,7 @@

You have not bookmarked any artists.

+
query("DELETE b FROM bookmarks_torrents AS b WHERE b.UserID='".$LoggedUser['ID']."' AND b.GroupID IN(SELECT DISTINCT t.GroupID FROM torrents AS t INNER JOIN xbt_snatched AS s ON s.fid=t.ID AND s.uid='".$LoggedUser['ID']."')"); - $Cache->delete_value('bookmarks_torrents_'.$UserID); - $Cache->delete_value('bookmarks_torrents_'.$UserID.'_full'); + $Cache->delete_value('bookmarks_torrent_'.$UserID); + $Cache->delete_value('bookmarks_torrent_'.$UserID.'_full'); header('Location: bookmarks.php'); die(); break; diff --git a/sections/bookmarks/torrents.php b/sections/bookmarks/torrents.php index 4098bfb7..0c5e19fd 100644 --- a/sections/bookmarks/torrents.php +++ b/sections/bookmarks/torrents.php @@ -255,14 +255,14 @@ function compare($X, $Y){ [Requests] 0) { ?>

- [Remove Snatched] - [Remove Snatched]?> + [Remove Snatched]

You have not bookmarked any torrents.

+

Browse collages

-
+
@@ -197,8 +197,7 @@ + +
diff --git a/sections/forums/ajax_get_edit.php b/sections/forums/ajax_get_edit.php index cf08a9e7..3b4b24cd 100644 --- a/sections/forums/ajax_get_edit.php +++ b/sections/forums/ajax_get_edit.php @@ -67,7 +67,7 @@ « - + Original Post" onclick="LoadEdit('forums', , 1); return false;">« Last edited by - + diff --git a/sections/inbox/conversation.php b/sections/inbox/conversation.php index 806ddc55..06c116f8 100644 --- a/sections/inbox/conversation.php +++ b/sections/inbox/conversation.php @@ -75,7 +75,9 @@ -
full_format($Body)?>
+
+ full_format($Body)?> +
" onclick="LoadEdit('requests', , 1); return false;">« Last edited by - + diff --git a/sections/requests/takefill.php b/sections/requests/takefill.php index c4e617ae..a1d4ad5f 100644 --- a/sections/requests/takefill.php +++ b/sections/requests/takefill.php @@ -86,10 +86,11 @@ BitrateList, FormatList, MediaList, - LogCue + LogCue, + TimeStampDiff(MINUTE, LastVote, NOW()) FROM requests WHERE ID = ".$RequestID); -list($Title, $RequesterID, $OldTorrentID, $RequestCategoryID, $RequestReleaseType, $RequestCatalogueNumber, $BitrateList, $FormatList, $MediaList, $LogCue) = $DB->next_record(); +list($Title, $RequesterID, $OldTorrentID, $RequestCategoryID, $RequestReleaseType, $RequestCatalogueNumber, $BitrateList, $FormatList, $MediaList, $LogCue, $VoteTime) = $DB->next_record(); if(!empty($OldTorrentID)) { $Err = "This request has already been filled"; @@ -160,8 +161,7 @@ FillerID = ".$FillerID.", TorrentID = ".$TorrentID.", TimeFilled = '".sqltime()."' - WHERE ID = ".$RequestID); - + WHERE ID = ".$RequestID); if($CategoryName == "Music") { $ArtistForm = get_request_artists($RequestID); @@ -174,8 +174,8 @@ $DB->query("SELECT UserID FROM requests_votes WHERE RequestID = ".$RequestID); $UserIDs = $DB->to_array(); foreach ($UserIDs as $User) { - list($UserID) = $User; - send_pm($UserID, 0, db_string("The request '".$FullName."' has been filled"), db_string("One of your requests - [url=http://".NONSSL_SITE_URL."/requests.php?action=view&id=".$RequestID."]".$FullName."[/url] - has been filled. You can view it at [url]http://".NONSSL_SITE_URL."/torrents.php?torrentid=".$TorrentID), ''); + list($VoterID) = $User; + send_pm($VoterID, 0, db_string("The request '".$FullName."' has been filled"), db_string("One of your requests - [url=http://".NONSSL_SITE_URL."/requests.php?action=view&id=".$RequestID."]".$FullName."[/url] - has been filled. You can view it at [url]http://".NONSSL_SITE_URL."/torrents.php?torrentid=".$TorrentID), ''); } $RequestVotes = get_votes_array($RequestID); @@ -192,6 +192,7 @@ $Cache->delete_value('request_'.$RequestID); + $DB->query("SELECT ArtistID FROM requests_artists WHERE RequestID = ".$RequestID); $ArtistIDs = $DB->to_array(); foreach($ArtistIDs as $ArtistID) { diff --git a/sections/tools/data/bitcoin_balance.php b/sections/tools/data/bitcoin_balance.php index 30ab1963..92287e8e 100644 --- a/sections/tools/data/bitcoin_balance.php +++ b/sections/tools/data/bitcoin_balance.php @@ -19,12 +19,13 @@ next_record()) { - $amount = " "; + $amount = false; foreach ($Receiveds as $R) { if ($R->address == $row['BitcoinAddress']) { $amount = $R->amount . ' BTC'; } } + if ($amount === false) { continue; } ?> diff --git a/sections/tools/index.php b/sections/tools/index.php index 3365b7a9..b64e4007 100644 --- a/sections/tools/index.php +++ b/sections/tools/index.php @@ -214,6 +214,10 @@ break; + case 'canariesv2': + include('data/canariesv2.php'); + break; + case 'ip_ban': //TODO: Clean up db table ip_bans. include("managers/bans.php"); diff --git a/sections/tools/tools.php b/sections/tools/tools.php index 0b732cae..b499a3f8 100644 --- a/sections/tools/tools.php +++ b/sections/tools/tools.php @@ -1,5 +1,7 @@
diff --git a/sections/torrents/details.php b/sections/torrents/details.php index 7c862ebf..913a72a5 100644 --- a/sections/torrents/details.php +++ b/sections/torrents/details.php @@ -334,7 +334,7 @@ function filelist($Str) { //There was a type but it wasn't an option! $ReportType = $Types['master']['other']; } - $ReportInfo .= "
"; } $ReportInfo .= "
".(check_perms('admin_reports') ? "$ReporterName reported it " : "Someone reported it ").strtolower(time_diff($ReportedTime))." for the reason '".$ReportType['title']."':"; + $ReportInfo .= "
".(check_perms('admin_reports') ? "$ReporterName reported it " : "Someone reported it ").time_diff($ReportedTime,2,true,true)." for the reason '".$ReportType['title']."':"; $ReportInfo .= "
".$Text->full_format($ReportReason)."
"; @@ -616,7 +616,7 @@ function filelist($Str) { « Last edited by - +
diff --git a/sections/user/advancedsearch.php b/sections/user/advancedsearch.php index 1846757a..d6933bbe 100644 --- a/sections/user/advancedsearch.php +++ b/sections/user/advancedsearch.php @@ -145,7 +145,7 @@ function num_compare($Field, $Operand, $Num1, $Num2 = ''){ $Val->SetFields('ratio', '0', 'inarray', 'Invalid ratio field', $NumberChoices); $Val->SetFields('uploaded', '0', 'inarray', 'Invalid uploaded field', $NumberChoices); $Val->SetFields('downloaded', '0', 'inarray', 'Invalid downloaded field', $NumberChoices); - $Val->SetFields('snatched', '0', 'inarray', 'Invalid snatched field', $NumberChoices); + //$Val->SetFields('snatched', '0', 'inarray', 'Invalid snatched field', $NumberChoices); $Val->SetFields('matchtype', '0', 'inarray', 'Invalid matchtype field', array('inarray'=>array('strict', 'fuzzy', 'regex'))); @@ -194,9 +194,13 @@ function num_compare($Field, $Operand, $Num1, $Num2 = ''){ um1.ID, um1.Username, um1.Uploaded, - um1.Downloaded, - (SELECT COUNT(uid) FROM xbt_snatched AS xs WHERE xs.uid=um1.ID) AS Snatches, - um1.PermissionID, + um1.Downloaded,'; + if ($_GET['snatched'] == "off") { + $SQL .= "'X' AS Snatches,"; + } else { + $SQL .= "(SELECT COUNT(uid) FROM xbt_snatched AS xs WHERE xs.uid=um1.ID) AS Snatches,"; + } + $SQL .= 'um1.PermissionID, um1.Email, um1.Enabled, um1.IP, @@ -254,15 +258,24 @@ function num_compare($Field, $Operand, $Num1, $Num2 = ''){ } if (!empty($_GET['cc'])) { - $Where[]="um1.ipcc = '".$_GET['cc']."'"; + if ($_GET['cc_op'] == "equal") { + $Where[]="um1.ipcc = '".$_GET['cc']."'"; + } else { + $Where[]="um1.ipcc != '".$_GET['cc']."'"; + } } if(!empty($_GET['tracker_ip'])){ $Distinct = 'DISTINCT '; $Join[]=' JOIN xbt_files_users AS xfu ON um1.ID=xfu.uid '; - $Where[]= ' (xfu.ipa '.$Match.wrap((int) ip2long($_GET['tracker_ip'])).' OR xfu.ip '.$Match.wrap($_GET['tracker_ip']).')'; + $Where[]= ' xfu.ip '.$Match.wrap($_GET['tracker_ip']); } - + +// if(!empty($_GET['tracker_ip'])){ +// $Distinct = 'DISTINCT '; +// $Join[]=' JOIN xbt_snatched AS xs ON um1.ID=xs.uid '; +// $Where[]= ' xs.IP '.$Match.wrap($_GET['ip']); +// } if(!empty($_GET['comment'])){ $Where[]='ui1.AdminComment'.$Match.wrap($_GET['comment']); @@ -553,6 +566,7 @@ function num_compare($Field, $Operand, $Num1, $Num2 = ''){ + @@ -603,7 +617,11 @@ function num_compare($Field, $Operand, $Num1, $Num2 = ''){ Country Code: - + + @@ -692,7 +710,7 @@ function num_compare($Field, $Operand, $Num1, $Num2 = ''){ $DB->set_query_id($Results); ?> - + query("SELECT + SQL_CALC_FOUND_ROWS + ID, + Subject, + Status, + Level, + AssignedToUser, + Date, + ResolverID + FROM staff_pm_conversations + WHERE UserID = $UserID AND (Level <= $UserLevel OR AssignedToUser='".$LoggedUser['ID']."') + ORDER BY Date DESC"); + if ($DB->record_count()) { + $StaffPMs = $DB->to_array(); +?> +
+
Staff PMs (View)
+ + + + + + + + + + + + + + + + +
+
- + diff --git a/sections/userhistory/post_history.php b/sections/userhistory/post_history.php index 5242c5ef..5544dc01 100644 --- a/sections/userhistory/post_history.php +++ b/sections/userhistory/post_history.php @@ -309,7 +309,7 @@ « Last edited by - +