-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.php
114 lines (97 loc) · 3.42 KB
/
index.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<?php
$head_time_start = microtime(true);
require_once "lib/lib.php";
require_once "lib/sorts.php";
connect();
vkAuth();
if (array_key_exists("logout", $_GET)) {
if(isset($_SESSION['user']))
unset($_SESSION['user']);
if(isset($_SESSION['showSettings']))
unset($_SESSION['showSettings']);
header("Location: " . \pass\VK::$redirect_uri);
}
Login();
$user = $_SESSION["user"];
$userId = $user['id'];
$login = $user['login'] ? $user['login'] : $user['vkid'];
if (array_key_exists('method', $_POST))
switch ($_POST['method']) {
case "setSettings":
setSettings($user,
array("minRating"=>(float)$_POST['minRating'],
"minVotes"=>(int)$_POST['minVotes'],
"onlyNewTor"=>(int)!empty($_POST['onlyNewTor']),
"quality"=>(int)!empty($_POST['quality']),
"translateQuality"=>(int)$_POST['translateQuality'],
"sortType" => (int)$_POST['sortType'],
"onlyLegal"=>(int)!empty($_POST['onlyLegal']),
"maxCost" => (int)$_POST['maxCost'],
)
);
break;
default:
break;
}
$movies = array();
$q = "SELECT * FROM `movies` WHERE `movies`.id in (SELECT movieId FROM links WHERE seed > 0) AND NOT `movies`.id in (SELECT movieId FROM userignore WHERE userId=$userId)";
$sqlresult = mysqli_query($GLOBALS['mysqli'], $q);
while ($row = mysqli_fetch_assoc($sqlresult))
$movies[(int)$row['id']] = $row;
if ($login == 'wise guest' || $login == 'guest') {
$userId = -1;
$login = false;
}
$keys = sortBySeedLeech($movies, $user);
?>
<!DOCTYPE html>
<html lang="en">
<?php
include "html/head.php";
?>
<body>
<script type="text/javascript">
var userId = <?php echo $userId; ?>;
function ignoreMovie(movieId) {
$.post( "ajax.php", { method: "ignoreMovie", userId: userId, movieId: movieId })
.done(function( data ) {
$('.moviePos'+movieId).remove();
});
}
$(document).ready(function() {
$('#torrentTable').DataTable({
searching: false,
paging: false,
ordering: true,
order: [[ 6, "desc" ]],
info: false,
});
$(".movieDelete").click(function( event ) {
event.preventDefault();
ignoreMovie($(this).attr('movieId'));
});
});
</script>
<?php
// Head tabs
// this requires global $liactive pointing at active tab
$liactive = "home";
include "html/navbar.php";
include "html/userSettings.php";
?>
<div id='main' class="container-fluid">
<?php
// Divs with movies' posters
// this requires global $keys
include "html/movieDivs.php";
?>
<?php
// Fresh torrents table
//include "html/freshTorrents.php";
?>
</div>
<?php
include "html/footer.php";
?>
</body>
</html>