mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 03:57:22 +08:00
improve announce update torrent visible
This commit is contained in:
+14
-7
@@ -443,6 +443,7 @@ else // continue an existing session
|
||||
|
||||
$dt = sqlesc(date("Y-m-d H:i:s"));
|
||||
$updateset = array();
|
||||
$hasChangeSeederLeecher = false;
|
||||
// set non-type event
|
||||
if (!isset($event))
|
||||
$event = "";
|
||||
@@ -452,6 +453,7 @@ if (isset($self) && $event == "stopped")
|
||||
if (mysql_affected_rows())
|
||||
{
|
||||
// $updateset[] = ($self["seeder"] == "yes" ? "seeders = seeders - 1" : "leechers = leechers - 1");
|
||||
$hasChangeSeederLeecher = true;
|
||||
sql_query("UPDATE snatched SET uploaded = uploaded + $trueupthis, downloaded = downloaded + $truedownthis, to_go = $left, $announcetime, last_action = ".$dt." WHERE torrentid = $torrentid AND userid = $userid") or err("SL Err 1");
|
||||
}
|
||||
}
|
||||
@@ -470,9 +472,10 @@ elseif(isset($self))
|
||||
|
||||
if (mysql_affected_rows())
|
||||
{
|
||||
// if ($seeder <> $self["seeder"])
|
||||
//count directly since 1.7.4
|
||||
// $updateset[] = ($seeder == "yes" ? "seeders = seeders + 1, leechers = leechers - 1" : "seeders = seeders - 1, leechers = leechers + 1");
|
||||
if ($seeder <> $self["seeder"]) {
|
||||
// $updateset[] = ($seeder == "yes" ? "seeders = seeders + 1, leechers = leechers - 1" : "seeders = seeders - 1, leechers = leechers + 1");
|
||||
$hasChangeSeederLeecher = true;
|
||||
}
|
||||
$snatchInfo = \App\Models\Snatch::query()
|
||||
->where('torrentid', $torrentid)
|
||||
->where('userid', $userid)
|
||||
@@ -524,7 +527,7 @@ else
|
||||
if (mysql_affected_rows())
|
||||
{
|
||||
// $updateset[] = ($seeder == "yes" ? "seeders = seeders + 1" : "leechers = leechers + 1");
|
||||
|
||||
$hasChangeSeederLeecher = true;
|
||||
$check = @mysql_fetch_row(@sql_query("SELECT COUNT(*) FROM snatched WHERE torrentid = $torrentid AND userid = $userid"));
|
||||
if (!$check['0'])
|
||||
sql_query("INSERT INTO snatched (torrentid, userid, ip, port, uploaded, downloaded, to_go, startdat, last_action) VALUES ($torrentid, $userid, ".sqlesc($ip).", $port, $uploaded, $downloaded, $left, $dt, $dt)") or err("SL Err 4");
|
||||
@@ -548,11 +551,13 @@ if (isset($event) && !empty($event)) {
|
||||
$updateset[] = 'leechers = ' . get_row_count("peers", "where torrent = $torrentid and to_go > 0");
|
||||
}
|
||||
|
||||
if (count($updateset)) // Update only when there is change in peer counts
|
||||
if (count($updateset) || $hasChangeSeederLeecher) // Update only when there is change in peer counts
|
||||
{
|
||||
$updateset[] = "visible = 'yes'";
|
||||
$updateset[] = "last_action = $dt";
|
||||
sql_query("UPDATE torrents SET " . join(",", $updateset) . " WHERE id = $torrentid");
|
||||
$sql = "UPDATE torrents SET " . join(",", $updateset) . " WHERE id = $torrentid";
|
||||
sql_query($sql);
|
||||
do_log("[ANNOUNCE_UPDATE_TORRENT], $sql");
|
||||
}
|
||||
|
||||
if($client_familyid != 0 && $client_familyid != $az['clientselect']) {
|
||||
@@ -571,7 +576,9 @@ if ($az['class'] == UC_VIP) {
|
||||
}
|
||||
if(count($USERUPDATESET) && $userid)
|
||||
{
|
||||
sql_query("UPDATE users SET " . join(",", $USERUPDATESET) . " WHERE id = ".$userid);
|
||||
$sql = "UPDATE users SET " . join(",", $USERUPDATESET) . " WHERE id = ".$userid;
|
||||
sql_query($sql);
|
||||
do_log("[ANNOUNCE_UPDATE_USER], $sql");
|
||||
}
|
||||
do_action('announced', $torrent, $az, $_REQUEST);
|
||||
benc_resp($rep_dict);
|
||||
|
||||
+1
-1
@@ -156,7 +156,7 @@ if (!$row) {
|
||||
if (get_user_class() >= $askreseed_class && $row['seeders'] == 0) {
|
||||
$actions[] = "<a title=\"".$lang_details['title_ask_for_reseed']."\" href=\"takereseed.php?reseedid=$id\"><img class=\"dt_reseed\" src=\"pic/trans.gif\" alt=\"reseed\"> <b><font class=\"small\">".$lang_details['text_ask_for_reseed'] ."</font></b></a>";
|
||||
}
|
||||
if (get_user_class() >= $torrentmanage_class && get_setting('torrent.approval_status_none_visible') == 'no') {
|
||||
if (get_user_class() >= $torrentmanage_class && (get_setting('torrent.approval_status_icon_enabled') == 'yes' || get_setting('torrent.approval_status_none_visible') == 'no')) {
|
||||
$approvalIcon = '<svg t="1655224943277" class="icon" viewBox="0 0 1397 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="45530" width="16" height="16"><path d="M1396.363636 121.018182c0 0-223.418182 74.472727-484.072727 372.363636-242.036364 269.963636-297.890909 381.672727-390.981818 530.618182C512 1014.690909 372.363636 744.727273 0 549.236364l195.490909-186.181818c0 0 176.872727 121.018182 297.890909 344.436364 0 0 307.2-474.763636 902.981818-707.490909L1396.363636 121.018182 1396.363636 121.018182zM1396.363636 121.018182" p-id="45531" fill="#e78d0f"></path></svg>';
|
||||
$actions[] = sprintf(
|
||||
'<a href="javascript:;"><b><font id="approval" class="small approval" data-torrent_id="%s">%s %s</font></b></a>',
|
||||
|
||||
@@ -36,8 +36,10 @@ function dltable($name, $arr, $torrent)
|
||||
"<td class=colhead align=center width=1%>".$lang_viewpeerlist['col_client']."</td></tr>\n";
|
||||
$now = time();
|
||||
$num = 0;
|
||||
$privacyData = \App\Models\User::query()->whereIn('id', array_column($arr, 'userid'))->get(['id', 'privacy'])->keyBy('id');
|
||||
foreach ($arr as $e) {
|
||||
$privacy = get_single_value("users", "privacy","WHERE id=".sqlesc($e['userid']));
|
||||
// $privacy = get_single_value("users", "privacy","WHERE id=".sqlesc($e['userid']));
|
||||
$privacy = $privacyData->get($e['userid'])->privacy ?? '';
|
||||
++$num;
|
||||
|
||||
$highlight = $CURUSER["id"] == $e['userid'] ? " bgcolor=#BBAF9B" : "";
|
||||
|
||||
Reference in New Issue
Block a user