exam support priority + peer suppoert ipv4&ipv6

This commit is contained in:
xiaomlove
2022-04-18 19:07:35 +08:00
parent 107da8e335
commit 55138da862
46 changed files with 302 additions and 115 deletions
+8 -4
View File
@@ -1,6 +1,12 @@
<?php
require_once("../include/bittorrent.php");
dbconn();
function denyDownload()
{
require_once ROOT_PATH . get_langfile_path("functions.php");
require_once(get_langfile_path());
permissiondenied();
}
$torrentRep = new \App\Repositories\TorrentRepository();
if (!empty($_REQUEST['downhash'])) {
$params = explode('|', $_REQUEST['downhash']);
@@ -75,8 +81,7 @@ if (@ini_get('output_handler') == 'ob_gzhandler' AND @ob_get_length() !== false)
*/
if ($CURUSER['downloadpos']=="no") {
require_once(get_langfile_path());
permissiondenied();
denyDownload();
}
$trackerSchemaAndHost = get_tracker_schema_and_host();
@@ -103,8 +108,7 @@ if (filesize($fn) == 0) {
httperr();
}
if (($row['banned'] == 'yes' && get_user_class() < $seebanned_class) || !can_access_torrent($row)) {
require_once(get_langfile_path());
permissiondenied();
denyDownload();
}
sql_query("UPDATE torrents SET hits = hits + 1 WHERE id = ".sqlesc($id)) or sqlerr(__FILE__, __LINE__);
+1 -1
View File
@@ -6,7 +6,7 @@ loggedinorreturn();
$brsectiontype = $browsecatmode;
$spsectiontype = $specialcatmode;
if ($enablespecial == 'yes')
if ($enablespecial == 'yes' && get_user_class() >= get_setting('authority.view_special_torrent'))
$allowspecial = true;
else $allowspecial = false;
$showsubcat = (get_searchbox_value($brsectiontype, 'showsubcat') || ($allowspecial && get_searchbox_value($spsectiontype, 'showsubcat')));
+1 -1
View File
@@ -364,7 +364,7 @@ tr($lang_usercp['row_school'], "<select name=school>$schools</select>", 1);
usercpmenu ("tracker");
$brsectiontype = $browsecatmode;
$spsectiontype = $specialcatmode;
if ($enablespecial == 'yes')
if ($enablespecial == 'yes' && get_user_class() >= get_setting('authority.view_special_torrent'))
$allowspecial = true;
else $allowspecial = false;
$showsubcat = (get_searchbox_value($brsectiontype, 'showsubcat') || ($allowspecial && get_searchbox_value($spsectiontype, 'showsubcat')));
+6 -7
View File
@@ -16,13 +16,14 @@ function dltable($name, $arr, $torrent)
{
global $lang_viewpeerlist,$viewanonymous_class,$userprofile_class,$enablelocation_tweak;
global $CURUSER;
global $lang_functions;
$s = "<b>" . count($arr) . " $name</b>\n";
if (!count($arr))
return $s;
$s .= "\n";
$s .= "<table width=825 class=main border=1 cellspacing=0 cellpadding=3>\n";
$s .= "<table width=100% class=main border=1 cellspacing=0 cellpadding=3>\n";
$s .= "<tr><td class=colhead align=center width=1%>".$lang_viewpeerlist['col_user_ip']."</td>" .
($enablelocation_tweak == 'yes' || get_user_class() >= $userprofile_class ? "<td class=colhead align=center width=1%>".$lang_viewpeerlist['col_location']."</td>" : "").
($enablelocation_tweak == 'yes' || get_user_class() >= $userprofile_class ? "<td class=colhead align=center>".$lang_viewpeerlist['col_location']."</td>" : "").
"<td class=colhead align=center width=1%>".$lang_viewpeerlist['col_connectable']."</td>".
"<td class=colhead align=center width=1%>".$lang_viewpeerlist['col_uploaded']."</td>".
"<td class=colhead align=center width=1%>".$lang_viewpeerlist['col_rate']."</td>" .
@@ -53,15 +54,14 @@ function dltable($name, $arr, $torrent)
$secs = max(1, ($e["la"] - $e["st"]));
if ($enablelocation_tweak == 'yes'){
list($loc_pub, $loc_mod) = get_ip_location($e["ip"]);
list($loc_pub, $loc_mod) = get_ip_location($e["ips"]);
$location = get_user_class() >= $userprofile_class ? "<div title='" . $loc_mod . "'>" . $loc_pub . "</div>" : $loc_pub;
$s .= "<td class=rowfollow align=center width=1%><nobr>" . $location . "</nobr></td>\n";
}
elseif (get_user_class() >= $userprofile_class){
$location = $e["ip"];
$location = $e["ips"];
$s .= "<td class=rowfollow align=center width=1%><nobr>" . $location . "</nobr></td>\n";
}
else $location = "";
$s .= "<td class=rowfollow align=center width=1%><nobr>" . ($e['connectable'] == "yes" ? $lang_viewpeerlist['text_yes'] : "<font color=red>".$lang_viewpeerlist['text_no']."</font>") . "</nobr></td>\n";
$s .= "<td class=rowfollow align=center width=1%><nobr>" . mksize($e["uploaded"]) . "</nobr></td>\n";
@@ -91,10 +91,9 @@ function dltable($name, $arr, $torrent)
$s .= "</table>\n";
return $s;
}
$downloaders = array();
$seeders = array();
$subres = sql_query("SELECT seeder, finishedat, downloadoffset, uploadoffset, ip, port, uploaded, downloaded, to_go, UNIX_TIMESTAMP(started) AS st, connectable, agent, peer_id, UNIX_TIMESTAMP(last_action) AS la, userid FROM peers WHERE torrent = $id") or sqlerr();
$subres = sql_query("SELECT seeder, finishedat, downloadoffset, uploadoffset, group_concat(ip) as ips, port, uploaded, downloaded, to_go, UNIX_TIMESTAMP(started) AS st, connectable, agent, peer_id, UNIX_TIMESTAMP(last_action) AS la, userid FROM peers WHERE torrent = $id group by peer_id ") or sqlerr();
while ($subrow = mysql_fetch_array($subres)) {
if ($subrow["seeder"] == "yes")
$seeders[] = $subrow;