paid torrent

This commit is contained in:
xiaomlove
2023-02-11 16:08:48 +08:00
parent 43b35b4e77
commit 3c64e76011
50 changed files with 556 additions and 87 deletions
+68 -68
View File
@@ -1045,74 +1045,74 @@ function docleanup($forceAll = 0, $printProgress = false) {
}
//1.delete torrents that doesn't exist any more
do {
$res = sql_query("SELECT id FROM torrents") or sqlerr(__FILE__, __LINE__);
$ar = array();
while ($row = mysql_fetch_array($res)) {
$id = $row[0];
$ar[$id] = 1;
}
if (!count($ar))
break;
$dp = @opendir($torrent_dir);
if (!$dp)
break;
$ar2 = array();
while (($file = readdir($dp)) !== false) {
if (!preg_match('/^(\d+)\.torrent$/', $file, $m))
continue;
$id = $m[1];
$ar2[$id] = 1;
if (isset($ar[$id]) && $ar[$id])
continue;
$ff = $torrent_dir . "/$file";
unlink($ff);
}
closedir($dp);
if (!count($ar2))
break;
$delids = array();
foreach (array_keys($ar) as $k) {
if (isset($ar2[$k]) && $ar2[$k])
continue;
$delids[] = $k;
unset($ar[$k]);
}
if (count($delids))
sql_query("DELETE FROM torrents WHERE id IN (" . join(",", $delids) . ")") or sqlerr(__FILE__, __LINE__);
$res = sql_query("SELECT torrent FROM peers GROUP BY torrent") or sqlerr(__FILE__, __LINE__);
$delids = array();
while ($row = mysql_fetch_array($res)) {
$id = $row[0];
if (isset($ar[$id]) && $ar[$id])
continue;
$delids[] = $id;
}
if (count($delids))
sql_query("DELETE FROM peers WHERE torrent IN (" . join(",", $delids) . ")") or sqlerr(__FILE__, __LINE__);
$res = sql_query("SELECT torrent FROM files GROUP BY torrent") or sqlerr(__FILE__, __LINE__);
$delids = array();
while ($row = mysql_fetch_array($res)) {
$id = $row[0];
if ($ar[$id])
continue;
$delids[] = $id;
}
if (count($delids))
sql_query("DELETE FROM files WHERE torrent IN (" . join(",", $delids) . ")") or sqlerr(__FILE__, __LINE__);
} while (0);
$log = "delete torrents that doesn't exist any more";
do_log($log);
if ($printProgress) {
printProgress($log);
}
// do {
// $res = sql_query("SELECT id FROM torrents") or sqlerr(__FILE__, __LINE__);
// $ar = array();
// while ($row = mysql_fetch_array($res)) {
// $id = $row[0];
// $ar[$id] = 1;
// }
//
// if (!count($ar))
// break;
//
// $dp = @opendir($torrent_dir);
// if (!$dp)
// break;
//
// $ar2 = array();
// while (($file = readdir($dp)) !== false) {
// if (!preg_match('/^(\d+)\.torrent$/', $file, $m))
// continue;
// $id = $m[1];
// $ar2[$id] = 1;
// if (isset($ar[$id]) && $ar[$id])
// continue;
// $ff = $torrent_dir . "/$file";
// unlink($ff);
// }
// closedir($dp);
//
// if (!count($ar2))
// break;
//
// $delids = array();
// foreach (array_keys($ar) as $k) {
// if (isset($ar2[$k]) && $ar2[$k])
// continue;
// $delids[] = $k;
// unset($ar[$k]);
// }
// if (count($delids))
// sql_query("DELETE FROM torrents WHERE id IN (" . join(",", $delids) . ")") or sqlerr(__FILE__, __LINE__);
//
// $res = sql_query("SELECT torrent FROM peers GROUP BY torrent") or sqlerr(__FILE__, __LINE__);
// $delids = array();
// while ($row = mysql_fetch_array($res)) {
// $id = $row[0];
// if (isset($ar[$id]) && $ar[$id])
// continue;
// $delids[] = $id;
// }
// if (count($delids))
// sql_query("DELETE FROM peers WHERE torrent IN (" . join(",", $delids) . ")") or sqlerr(__FILE__, __LINE__);
//
// $res = sql_query("SELECT torrent FROM files GROUP BY torrent") or sqlerr(__FILE__, __LINE__);
// $delids = array();
// while ($row = mysql_fetch_array($res)) {
// $id = $row[0];
// if ($ar[$id])
// continue;
// $delids[] = $id;
// }
// if (count($delids))
// sql_query("DELETE FROM files WHERE torrent IN (" . join(",", $delids) . ")") or sqlerr(__FILE__, __LINE__);
// } while (0);
// $log = "delete torrents that doesn't exist any more";
// do_log($log);
// if ($printProgress) {
// printProgress($log);
// }
//8.lock topics where last post was made more than x days ago
$secs = 365*24*60*60;
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.8.0');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2023-02-10');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2023-02-11');
defined('IN_TRACKER') || define('IN_TRACKER', false);
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
+4 -3
View File
@@ -3642,7 +3642,8 @@ foreach ($rows as $row)
} else {
$seedBoxIcon = '';
}
$titleSuffix = $banned_torrent.$picked_torrent.$sp_torrent.$sp_torrent_sub. $hrImg . $seedBoxIcon . $approvalStatusIcon;
$paidIcon = $torrentRep->getPaidIcon($row);
$titleSuffix = $banned_torrent.$paidIcon.$picked_torrent.$sp_torrent.$sp_torrent_sub. $hrImg . $seedBoxIcon . $approvalStatusIcon;
$titleSuffix = apply_filter('torrent_title_suffix', $titleSuffix, $row);
print($titleSuffix);
//$tags = torrentTags($row['tags'], 'span');
@@ -6385,14 +6386,14 @@ function build_search_area($searchArea, array $options = [])
return $result;
}
function torrent_name_for_admin(\App\Models\Torrent|null $torrent, $withTags = false)
function torrent_name_for_admin(\App\Models\Torrent|null $torrent, $withTags = false, $length = 40)
{
if (empty($torrent)) {
return '';
}
$name = sprintf(
'<div class="text-primary-600 transition hover:underline hover:text-primary-500 focus:underline focus:text-primary-500"><a href="/details.php?id=%s" target="_blank" title="%s">%s</a></div>',
$torrent->id, $torrent->name, Str::limit($torrent->name, 40)
$torrent->id, $torrent->name, Str::limit($torrent->name, $length)
);
$tags = '';
if ($withTags) {