-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathmytorrents.php
80 lines (78 loc) · 2.72 KB
/
mytorrents.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
/**
* https://github.com/Bigjoos/
* Licence Info: GPL
* Copyright (C) 2010 U-232 v.3
* A bittorrent tracker source based on TBDev.net/tbsource/bytemonsoon.
* Project Leaders: Mindless, putyn.
*
*/
require_once (dirname(__FILE__).DIRECTORY_SEPARATOR.'include'.DIRECTORY_SEPARATOR.'bittorrent.php');
require_once (INCL_DIR.'user_functions.php');
require_once INCL_DIR.'pager_functions.php';
require_once INCL_DIR.'torrenttable_functions.php';
require_once INCL_DIR.'html_functions.php';
dbconn(false);
loggedinorreturn();
$lang = array_merge(load_language('global') , load_language('mytorrents') , load_language('torrenttable_functions'));
$stdfoot = array(
/** include js **/
'js' => array(
'java_klappe',
'wz_tooltip'
)
);
$HTMLOUT = '';
if (isset($_GET['sort']) && isset($_GET['type'])) {
$column = '';
$ascdesc = '';
$_valid_sort = array(
'id',
'name',
'numfiles',
'comments',
'added',
'size',
'times_completed',
'seeders',
'leechers',
'owner'
);
$column = isset($_GET['sort']) && isset($_valid_sort[(int)$_GET['sort']]) ? $_valid_sort[(int)$_GET['sort']] : $_valid_sort[0];
switch (htmlsafechars($_GET['type'])) {
case 'asc':
$ascdesc = "ASC";
$linkascdesc = "asc";
break;
case 'desc':
$ascdesc = "DESC";
$linkascdesc = "desc";
break;
default:
$ascdesc = "DESC";
$linkascdesc = "desc";
break;
}
$orderby = "ORDER BY torrents.".$column." ".$ascdesc;
$pagerlink = "sort=".intval($_GET['sort'])."&type=".$linkascdesc."&";
} else {
$orderby = "ORDER BY torrents.sticky ASC, torrents.id DESC";
$pagerlink = "";
}
$where = "WHERE owner = {$CURUSER["id"]} AND banned != 'yes'";
$res = sql_query("SELECT COUNT(id) FROM torrents $where");
$row = mysqli_fetch_array($res, MYSQLI_NUM);
$count = $row[0];
if (!$count) {
$HTMLOUT.= "{$lang['mytorrents_no_torrents']}";
$HTMLOUT.= "{$lang['mytorrents_no_uploads']}";
} else {
$pager = pager(20, $count, "mytorrents.php?{$pagerlink}");
$res = sql_query("SELECT type, sticky, vip, descr, nuked, bump, nukereason, release_group, free, silver, comments, leechers, seeders, IF(num_ratings < {$INSTALLER09['minvotes']}, NULL, ROUND(rating_sum / num_ratings, 1)) AS rating, id, name, save_as, numfiles, added, size, views, visible, hits, times_completed, category, description, username FROM torrents $where $orderby ".$pager['limit']);
$HTMLOUT.= $pager['pagertop'];
$HTMLOUT.= "<br />";
$HTMLOUT.= torrenttable($res, "mytorrents");
$HTMLOUT.= $pager['pagerbottom'];
}
echo stdhead($CURUSER["username"]."'s torrents").$HTMLOUT.stdfoot($stdfoot);
?>