|
@@ -0,0 +1,96 @@
|
|
1
|
+<?
|
|
2
|
+ function bytesToGiB($bytes) {
|
|
3
|
+ if ($bytes > 1048576) {
|
|
4
|
+ $GiB = $bytes / 1073741824;
|
|
5
|
+ } else {
|
|
6
|
+ $GiB = 0;
|
|
7
|
+ }
|
|
8
|
+ return $GiB;
|
|
9
|
+ }
|
|
10
|
+
|
|
11
|
+ $Username = $LoggedUser['Username'];
|
|
12
|
+ View::show_header($Username." > Bonus Rates");
|
|
13
|
+
|
|
14
|
+ $activeTorrents = array();
|
|
15
|
+ $DB->query("
|
|
16
|
+ SELECT x.timespent,
|
|
17
|
+ t.GroupID,
|
|
18
|
+ t.Media,
|
|
19
|
+ t.Container,
|
|
20
|
+ t.Codec,
|
|
21
|
+ t.Resolution,
|
|
22
|
+ t.AudioFormat,
|
|
23
|
+ t.Size,
|
|
24
|
+ t.Seeders,
|
|
25
|
+ t.Recorded,
|
|
26
|
+ us.SeedTime,
|
|
27
|
+ (us.SeedTime/60/60) AS hours,
|
|
28
|
+ (us.SeedTime/60/60/24) AS days,
|
|
29
|
+ tg.Name AS Album,
|
|
30
|
+ ag.Name AS Artist
|
|
31
|
+ FROM xbt_files_users AS x
|
|
32
|
+ LEFT JOIN torrents AS t ON t.ID=x.fid
|
|
33
|
+ LEFT JOIN users_seedtime AS us ON x.fid=us.TorrentID AND x.uid=us.UserID
|
|
34
|
+ LEFT JOIN torrents_group AS tg ON t.GroupID=tg.ID
|
|
35
|
+ LEFT JOIN torrents_artists AS ta ON t.GroupID=ta.GroupID
|
|
36
|
+ LEFT JOIN artists_group AS ag ON ta.ArtistID=ag.ArtistID
|
|
37
|
+ WHERE x.uid = $UserID AND x.active=1");
|
|
38
|
+ while ($result = $DB->next_record()) {
|
|
39
|
+ $activeTorrents[] = $result;
|
|
40
|
+ }
|
|
41
|
+ $totals = [
|
|
42
|
+ 'torrents' => 0,
|
|
43
|
+ 'size' => 0,
|
|
44
|
+ 'points' => 0,
|
|
45
|
+ ];
|
|
46
|
+ //print_r($activeTorrents); die();
|
|
47
|
+?>
|
|
48
|
+<div class="thin">
|
|
49
|
+ <div class="header">
|
|
50
|
+ <h2><?=Users::format_username($UserID, false, false, false)?> > Bonus Rates</h2>
|
|
51
|
+ </div>
|
|
52
|
+ <div class="main_column" style="width: 100%; margin-top: 18px">
|
|
53
|
+ <table class="box torrent_table cats no_grouping" id="torrent_table">
|
|
54
|
+ <tr class="colhead">
|
|
55
|
+ <td>Torrent</td>
|
|
56
|
+ <td>Size</td>
|
|
57
|
+ <td><svg width="11" height="15" fill="white" class="tooltip" alt="Seeders" title="Seeders"><polygon points="0,7 5.5,0 11,7 8,7 8,15 3,15 3,7"></polygon></svg>
|
|
58
|
+ </td>
|
|
59
|
+ <td>Seed Time</td>
|
|
60
|
+ <td>BP/hour</td>
|
|
61
|
+ </tr>
|
|
62
|
+<?php foreach ($activeTorrents as $torrent) {
|
|
63
|
+ $points = bytesToGiB($torrent['Size']) * ( 0.25 + ( 0.6 * log(1+$torrent['days']) / pow($torrent['Seeders'],0.6) ) );
|
|
64
|
+ $totals['torrents']++;
|
|
65
|
+ $totals['size'] = $totals['size'] + $torrent['Size'];
|
|
66
|
+ $totals['points'] = $totals['points'] + $points;
|
|
67
|
+?>
|
|
68
|
+ <tr id="site_style_tr">
|
|
69
|
+ <td><?=$torrent['Artist'].' - '.$torrent['Album'].' - '.$torrent['Recorded'].' | '.$torrent['Codec'].' / '.$torrent['Media'].' / '.$torrent['Container'].' / '.$torrent['Resolution'].' / '.$torrent['AudioFormat']; ?></td>
|
|
70
|
+ <td><?=Format::get_size($torrent['Size'])?></td>
|
|
71
|
+ <td><?php echo $torrent['Seeders']; ?></td>
|
|
72
|
+ <td><?php echo round($torrent['days'], 2); ?> days (<?=$torrent['hours']?>)</td>
|
|
73
|
+ <td><?=round($points, 4)?></td>
|
|
74
|
+ </tr>
|
|
75
|
+<?php } ?>
|
|
76
|
+ </table>
|
|
77
|
+ <br />
|
|
78
|
+ <table class="box torrent_table cats no_grouping" id="torrent_table">
|
|
79
|
+ <tr class="colhead">
|
|
80
|
+ <td>Total Torrents</td>
|
|
81
|
+ <td>Seeding Size</td>
|
|
82
|
+ <td>BP/hour</td>
|
|
83
|
+ <td>BP/day</td>
|
|
84
|
+ <td>BP/month</td>
|
|
85
|
+ </tr>
|
|
86
|
+ <tr>
|
|
87
|
+ <td><?=$totals['torrents']?></td>
|
|
88
|
+ <td><?=Format::get_size($totals['size'])?></td>
|
|
89
|
+ <td><?=round($totals['points'], 4)?></td>
|
|
90
|
+ <td><?=round($totals['points']*24, 4)?></td>
|
|
91
|
+ <td><?=round($totals['points']*24*30, 4)?></td>
|
|
92
|
+ </tr>
|
|
93
|
+ </table>
|
|
94
|
+ </div>
|
|
95
|
+</div>
|
|
96
|
+<? View::show_footer(); ?>
|