BioTorrents.de’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 2.0KB

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