Oppaitime's version of Gazelle
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

top10_daily.php 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?
  2. //------------- Daily Top 10 History -------------//
  3. $DB->query("
  4. INSERT INTO top10_history (Date, Type)
  5. VALUES ('$sqltime', 'Daily')");
  6. $HistoryID = $DB->inserted_id();
  7. $Top10 = $Cache->get_value('top10tor_day_10');
  8. if ($Top10 === false) {
  9. $DB->query("
  10. SELECT
  11. t.ID,
  12. g.ID,
  13. g.Name,
  14. g.CategoryID,
  15. g.WikiImage,
  16. g.TagList,
  17. t.Media,
  18. g.Year,
  19. t.Snatched,
  20. t.Seeders,
  21. t.Leechers,
  22. ((t.Size * t.Snatched) + (t.Size * 0.5 * t.Leechers)) AS Data
  23. FROM torrents AS t
  24. LEFT JOIN torrents_group AS g ON g.ID = t.GroupID
  25. WHERE t.Seeders > 0
  26. AND t.Time > ('$sqltime' - INTERVAL 1 DAY)
  27. ORDER BY (t.Seeders + t.Leechers) DESC
  28. LIMIT 10;");
  29. $Top10 = $DB->to_array();
  30. }
  31. $i = 1;
  32. foreach ($Top10 as $Torrent) {
  33. list($TorrentID, $GroupID, $GroupName, $GroupCategoryID,
  34. $WikiImage, $TorrentTags, $Media, $Year,
  35. $Snatched, $Seeders, $Leechers, $Data) = $Torrent;
  36. $DisplayName = '';
  37. $Artists = Artists::get_artist($GroupID);
  38. if (!empty($Artists)) {
  39. $DisplayName = Artists::display_artists($Artists, false, true);
  40. }
  41. $DisplayName .= $GroupName;
  42. if ($GroupCategoryID == 1 && $GroupYear > 0) {
  43. $DisplayName .= " [$GroupYear]";
  44. }
  45. // append extra info to torrent title
  46. $ExtraInfo = '';
  47. $AddExtra = '';
  48. if ($Media) {
  49. $ExtraInfo .= $AddExtra.$Media;
  50. $AddExtra = ' / ';
  51. }
  52. if ($Year > 0) {
  53. $ExtraInfo .= $AddExtra.$Year;
  54. $AddExtra = ' ';
  55. }
  56. if ($ExtraInfo != '') {
  57. $ExtraInfo = "- [$ExtraInfo]";
  58. }
  59. $TitleString = "$DisplayName $ExtraInfo";
  60. $TagString = str_replace('|', ' ', $TorrentTags);
  61. $DB->query("
  62. INSERT INTO top10_history_torrents
  63. (HistoryID, Rank, TorrentID, TitleString, TagString)
  64. VALUES
  65. ($HistoryID, $i, $TorrentID, '".db_string($TitleString)."', '".db_string($TagString)."')");
  66. $i++;
  67. }
  68. ?>