add configuration: torrent.approval_status_none_visible

This commit is contained in:
xiaomlove
2022-06-24 14:55:10 +08:00
parent e786b8b461
commit aae45835ee
21 changed files with 145 additions and 56 deletions

View File

@@ -33,7 +33,7 @@
安装 docker。
其中 DOMAIN 是你要使用的域名,先做好解析。 没有域名使用 IP 亦可。
端口按需要指定,如果本地 80 端口已经使用,请更换,保证端口对外开放。
2步创建 .env 选择正确的时区 TIMEZONE其他默认即可。
2 步创建 .env 选择正确的时区 TIMEZONE其他默认即可。
```
docker pull xiaomlove/nexusphp:latest
docker run --name my-nexusphp -e DOMAIN=xxx.com -p 80:80 xiaomlove/nexusphp:latest
@@ -46,8 +46,6 @@ docker run --name my-nexusphp -e DOMAIN=xxx.com -p 80:80 xiaomlove/nexusphp:late
QQ群: [764452568](https://jq.qq.com/?_wv=1027&k=IbltZcIx)
Telegram: [https://t.me/nexusphp](https://t.me/nexusphp)
B站: [xiaomlove](https://space.bilibili.com/1319303059)
微信公众号:
![扫码关注](https://nexusphp.org/wp-content/uploads/2022/03/wechat_official_account.png)
## Project supported by JetBrains
Many thanks to Jetbrains for kindly providing a license for me to work on this and other open-source projects.

View File

@@ -12,14 +12,14 @@ class NexusUpdate extends Command
*
* @var string
*/
protected $signature = 'nexus:update';
protected $signature = 'nexus:update {--tag=} {--keep_tmp}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Update nexusphp after code updated, remember run `composer update` first.';
protected $description = 'Update nexusphp after code updated, remember run `composer update` first. Options: --tag=, --keep_tmp';
private $update;
@@ -43,6 +43,17 @@ class NexusUpdate extends Command
{
define('WITH_LARAVEL', true);
require ROOT_PATH . 'nexus/Database/helpers.php';
$tag = $this->option('tag');
$keepTmp = $this->option('keep_tmp');
if ($tag !== null) {
if ($tag === 'dev') {
$url = "https://github.com/xiaomlove/nexusphp/archive/refs/heads/php8.zip";
} else {
$url = "https://api.github.com/repos/xiaomlove/nexusphp/tarball/v$tag";
}
$this->doLog("Specific tag: '$tag', download from '$url' and extra code...");
$tmpPath = $this->update->downAndExtractCode($url);
}
//Step 1
$step = $this->update->currentStep();
$log = sprintf('Step %s, %s...', $step, $this->update->getStepName($step));
@@ -108,6 +119,15 @@ class NexusUpdate extends Command
$this->doLog("All done!");
if (isset($tmpPath)) {
if (!$keepTmp) {
$this->doLog("Delete tmp files in: $tmpPath");
$this->update->executeCommand("rm -rf " . rtrim($tmpPath, '/'));
} else {
$this->doLog("Keep tmp files in: $tmpPath");
}
}
return 0;
}

View File

@@ -78,8 +78,13 @@ class Test extends Command
*/
public function handle()
{
$r = Carbon::parse(null);
dd($r);
$a = 2;
$b = 2;
if ($a != 1 && $b == 2) {
echo "OK";
} else {
echo 'Bad';
}
}

View File

@@ -533,5 +533,36 @@ class TorrentRepository extends BaseRepository
}
public function renderApprovalStatus($approvalStatus, $show = null): string
{
if ($show === null) {
$show = $this->shouldShowApprovalStatusIcon($approvalStatus);
}
if ($show) {
return sprintf(
'<span style="margin-left: 6px" title="%s">%s</span>',
nexus_trans("torrent.approval.status_text.$approvalStatus"),
\App\Models\Torrent::$approvalStatus[$approvalStatus]['icon']
);
}
return '';
}
public function shouldShowApprovalStatusIcon($approvalStatus): bool
{
if (get_setting('torrent.approval_status_icon_enabled') == 'yes') {
//启用审核状态图标,肯定显示
return true;
}
if (
$approvalStatus != \App\Models\Torrent::APPROVAL_STATUS_ALLOW
&& get_setting('torrent.approval_status_none_visible') == 'no'
) {
//不启用审核状态图标,尽量不显示。在种子不是审核通过状态,而审核不通过又不能被用户看到时,显示
return true;
}
return false;
}
}

View File

@@ -382,8 +382,13 @@ class TrackerRepository extends BaseRepository
throw new TrackerException('Torrent not registered with this tracker.');
}
if ($torrent->banned == 'yes' && $user->class < Setting::get('authority.seebanned')) {
throw new TrackerException("torrent banned");
if ($user->class < Setting::get('authority.seebanned')) {
if ($torrent->banned == 'yes') {
throw new TrackerException("torrent banned");
}
if ($torrent->approval_status != Torrent::APPROVAL_STATUS_ALLOW && Setting::get('torrent.approval_status_none_visible') == 'no') {
throw new TrackerException("torrent review not approved");
}
}
return $torrent;
}
@@ -1066,7 +1071,7 @@ class TrackerRepository extends BaseRepository
{
$cacheKey = __METHOD__ . bin2hex($infoHash);
return Cache::remember($cacheKey, 60, function () use ($infoHash, $cacheKey) {
$fieldRaw = 'id, owner, sp_state, seeders, leechers, added, banned, hr, visible, last_action, times_completed';
$fieldRaw = 'id, owner, sp_state, seeders, leechers, added, banned, hr, visible, last_action, times_completed, approval_status';
$torrent = Torrent::query()->where('info_hash', $infoHash)->selectRaw($fieldRaw)->first();
do_log("[getTorrentByInfoHash] cache miss [$cacheKey], from database, and get: " . ($torrent->id ?? ''));
return $torrent;

View File

@@ -1,6 +1,6 @@
<?php
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.7.17');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2022-06-23');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2022-06-24');
defined('IN_TRACKER') || define('IN_TRACKER', true);
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");

View File

@@ -3247,10 +3247,11 @@ function torrenttable($rows, $variant = "torrent") {
global $lang_functions;
global $CURUSER, $waitsystem;
global $showextinfo;
global $torrentmanage_class, $smalldescription_main, $enabletooltip_tweak;
global $torrentmanage_class, $smalldescription_main, $enabletooltip_tweak, $staffmem_class;
global $CURLANGDIR;
$torrent = new Nexus\Torrent\Torrent();
$torrentRep = new \App\Repositories\TorrentRepository();
$torrentIdArr = array_column($rows, 'id');
$torrentSeedingLeechingStatus = $torrent->listLeechingSeedingStatus($CURUSER['id'], $torrentIdArr);
$tagRep = new \App\Repositories\TagRepository();
@@ -3259,7 +3260,6 @@ function torrenttable($rows, $variant = "torrent") {
$torrentTagCollection = \App\Models\TorrentTag::query()->whereIn('torrent_id', $torrentIdArr)->orderByRaw("field(tag_id,$tagIdStr)")->get();
$tagKeyById = $tagCollection->keyBy('id');
$torrentTagResult = $torrentTagCollection->groupBy('torrent_id');
$approvalStatusIconEnabled = \App\Models\Setting::get('torrent.approval_status_icon_enabled') == 'yes';
$last_browse = $CURUSER['last_browse'];
// if ($variant == "torrent"){
@@ -3453,10 +3453,7 @@ foreach ($rows as $row)
$banned_torrent = ($row["banned"] == 'yes' ? " <b>(<font class=\"striking\">".$lang_functions['text_banned']."</font>)</b>" : "");
$sp_torrent_sub = get_torrent_promotion_append_sub($row['sp_state'],"",true,$row['added'], $row['promotion_time_type'], $row['promotion_until'], $row['__ignore_global_sp_state'] ?? false);
$approvalStatusIcon = '';
if ($approvalStatusIconEnabled) {
$approvalStatusIcon = $torrent->renderApprovalStatus($row['approval_status']);
}
$approvalStatusIcon = $torrentRep->renderApprovalStatus($row['approval_status']);
$titleSuffix = $banned_torrent.$picked_torrent.$sp_torrent.$sp_torrent_sub. $hrImg . $approvalStatusIcon;
$titleSuffix = apply_filter('torrent_title_suffix', $titleSuffix, $row);
print($titleSuffix);

View File

@@ -758,8 +758,10 @@ $lang_settings = array
'text_misc_settings_note' => '配置其他杂项。',
'row_misc_donation_custom' => '捐赠自定义内容',
'text_donation_custom_note' => '捐赠页自定义的内容展示于支付宝、PayPal上面。支持&nbsp;<b><a href="tags.php" target="_blank">bbcode 标签</a></b>',
'row_approval_status_icon_enabled' => '审核状态图标',
'text_approval_status_icon_enabled_note' => "是否在种子列表展示审核状态图标,默认: '否'。"
'row_approval_status_icon_enabled' => '显示审核状态图标',
'text_approval_status_icon_enabled_note' => "是否在种子列表展示审核状态图标,默认: '否'。",
'row_approval_status_none_visible' => '未审核种子是否可见',
'text_approval_status_none_visible_note' => "默认:'是'。若改为'否',审核不为[通过]状态时强制显示审核状态图标。",
);
?>

View File

@@ -758,8 +758,10 @@ $lang_settings = array
'text_misc_settings_note' => '配置其他雜項。',
'row_misc_donation_custom' => '捐贈自定義內容',
'text_donation_custom_note' => '捐贈頁自定義的內容展示於支付寶、PayPal上面。支持&nbsp;<b><a href="tags.php" target="_blank">bbcode 標簽</a></b>',
'row_approval_status_icon_enabled' => '審核狀態圖標',
'text_approval_status_icon_enabled_note' => "是否在種子列表展示審核狀態圖標,默認: '否'。"
'row_approval_status_icon_enabled' => '顯示審核狀態圖標',
'text_approval_status_icon_enabled_note' => "是否在種子列表展示審核狀態圖標,默認: '否'。",
'row_approval_status_none_visible' => '未審核種子是否可見',
'text_approval_status_none_visible_note' => "默認:'是'。若改為'否',審核不為[通過]狀態時強製顯示審核狀態圖標。",
);
?>

View File

@@ -758,8 +758,10 @@ $lang_settings = array
'text_misc_settings_note' => 'Misc settings',
'row_misc_donation_custom' => 'Donation custom',
'text_donation_custom_note' => 'Donation page custom content, displayed above Alipay, PayPal. Support&nbsp;<b><a href="tags.php" target="_blank">bbcode tag</a></b>',
'row_approval_status_icon_enabled' => 'Approval status icon',
'text_approval_status_icon_enabled_note' => "Whether to show the approval status icon in the torrent list, default: 'No'."
'row_approval_status_icon_enabled' => 'Show approval status icon',
'text_approval_status_icon_enabled_note' => "Whether to show the approval status icon in the torrent list, default: 'No'.",
'row_approval_status_none_visible' => 'Visibility of not reviewed torrents',
'text_approval_status_none_visible_note' => "Default: 'Yes'. If change to 'No', force to show approval status icon when audit is not [allow] status.",
);
?>

View File

@@ -295,24 +295,24 @@ class Update extends Install
public function requestGithub($url)
{
$client = new Client();
$logPrefix = "请求 github: $url";
$logPrefix = "Request github: $url";
$response = $client->get($url, ['timeout' => 10,]);
if (($statusCode = $response->getStatusCode()) != 200) {
throw new \RuntimeException("$logPrefix 失败,状态码$statusCode");
throw new \RuntimeException("$logPrefix fail, status code$statusCode");
}
if ($response->getBody()->getSize() <= 0) {
throw new \RuntimeException("$logPrefix 失败,结果为空");
throw new \RuntimeException("$logPrefix fail, response empty");
}
$bodyString = $response->getBody()->getContents();
$this->doLog("[REQUEST_GITHUB_RESPONSE]: $bodyString");
$results = json_decode($bodyString, true);
if (empty($results) || !is_array($results)) {
throw new \RuntimeException("$logPrefix 结果异常");
throw new \RuntimeException("$logPrefix response invalid");
}
return $results;
}
public function downAndExtractCode($url): bool
public function downAndExtractCode($url): string
{
$arr = explode('/', $url);
$basename = last($arr);
@@ -329,16 +329,16 @@ class Update extends Install
$client = new Client();
$response = $client->request('GET', $url, ['sink' => $filename]);
if (($statusCode = $response->getStatusCode()) != 200) {
throw new \RuntimeException("下载错误,状态码$statusCode");
throw new \RuntimeException("Download fail, status code$statusCode");
}
if (($bodySize = $response->getBody()->getSize()) <= 0) {
throw new \RuntimeException("下载错误,文件体积$bodySize");
throw new \RuntimeException("Download fail, file size$bodySize");
}
if (!file_exists($filename)) {
throw new \RuntimeException("下载错误,文件不存在$filename");
throw new \RuntimeException("Download fail, file not exists$filename");
}
if (filesize($filename) <= 0) {
throw new \RuntimeException("下载错误,文件大小为0");
throw new \RuntimeException("Download fail, file: $filename size = 0");
}
$this->doLog('SUCCESS_DOWNLOAD');
$extractDir = str_replace($suffix, "", $filename);
@@ -346,7 +346,7 @@ class Update extends Install
$this->executeCommand($command);
if ($isZip) {
$command = "unzip $filename -d $extractDir";
$command = "unzip -q $filename -d $extractDir";
} else {
$command = "tar -xf $filename -C $extractDir";
}
@@ -354,13 +354,18 @@ class Update extends Install
foreach (glob("$extractDir/*") as $path) {
if (is_dir($path)) {
$command = sprintf('cp -Rf %s/* %s', $path, ROOT_PATH);
$excludes = ['.git', 'composer.lock', 'composer.json', 'public/favicon.ico', '.env'];
// $command = sprintf('cp -raf %s/. %s', $path, ROOT_PATH);
$command = "rsync -rvq $path/ " . ROOT_PATH;
foreach ($excludes as $exclude) {
$command .= " --exclude=$exclude";
}
$this->executeCommand($command);
break;
}
}
$this->doLog('SUCCESS_EXTRACT');
return true;
return $extractDir;
}
public function initSeedPoints(): int

View File

@@ -333,6 +333,7 @@ return array (
'claim_reach_standard_seed_time' => \App\Models\Claim::STANDARD_SEED_TIME_HOURS,
'claim_reach_standard_uploaded' => \App\Models\Claim::STANDARD_UPLOADED_TIMES,
'approval_status_icon_enabled' => 'no',
'approval_status_none_visible' => 'yes',
),
'attachment' =>
array (

View File

@@ -86,9 +86,4 @@ class Torrent
return $ptGen->buildRatingSpan($siteIdAndRating);
}
public function renderApprovalStatus($status): string
{
return sprintf('<span style="margin-left: 6px">%s</span>', \App\Models\Torrent::$approvalStatus[$status]['icon']);
}
}

View File

@@ -152,7 +152,7 @@ elseif ($az['showclienterror'] == 'yes'){
}
// check torrent based on info_hash
$checkTorrentSql = "SELECT id, owner, sp_state, seeders, leechers, UNIX_TIMESTAMP(added) AS ts, banned, hr FROM torrents WHERE " . hash_where("info_hash", $info_hash);
$checkTorrentSql = "SELECT id, owner, sp_state, seeders, leechers, UNIX_TIMESTAMP(added) AS ts, banned, hr, approval_status FROM torrents WHERE " . hash_where("info_hash", $info_hash);
if (!$torrent = $Cache->get_value('torrent_hash_'.$info_hash.'_content')){
$res = sql_query($checkTorrentSql);
$torrent = mysql_fetch_array($res);
@@ -168,8 +168,13 @@ if (!$torrent) {
do_log("[TORRENT NOT EXISTS] infoHashUrlEncode: $infoHashUrlEncode", 'error');
err("torrent not registered with this tracker");
} elseif ($az['class'] < $seebanned_class) {
if ($torrent['banned'] == 'yes') {
err("torrent banned");
} elseif ($torrent['approval_status'] != \App\Models\Torrent::APPROVAL_STATUS_ALLOW && get_setting('torrent.approval_status_none_visible') == 'no') {
err("torrent review not approved");
}
}
elseif ($torrent['banned'] == 'yes' && $az['class'] < $seebanned_class) err("torrent banned");
// select peers info from peers table for this torrent
$torrentid = $torrent["id"];
$numpeers = $torrent["seeders"]+$torrent["leechers"];

View File

@@ -71,7 +71,8 @@ if (!$row) {
$sp_torrent = get_torrent_promotion_append($row['sp_state'],'word', false, '', 0, '', $row['__ignore_global_sp_state'] ?? false);
$sp_torrent_sub = get_torrent_promotion_append_sub($row['sp_state'],"",true,$row['added'], $row['promotion_time_type'], $row['promotion_until'], $row['__ignore_global_sp_state'] ?? false);
$hrImg = get_hr_img($row);
$s=htmlspecialchars($row["name"]).$banned_torrent.($sp_torrent ? "&nbsp;&nbsp;&nbsp;".$sp_torrent : "").($sp_torrent_sub) . $hrImg;
$approvalStatusIcon = $torrentRep->renderApprovalStatus($row["approval_status"]);
$s=htmlspecialchars($row["name"]).$banned_torrent.($sp_torrent ? "&nbsp;&nbsp;&nbsp;".$sp_torrent : "").($sp_torrent_sub) . $hrImg . $approvalStatusIcon;
print("<h1 align=\"center\" id=\"top\">".$s."</h1>\n");
//Banned reason

View File

@@ -88,7 +88,7 @@ $trackerSchemaAndHost = get_tracker_schema_and_host();
$ssl_torrent = $trackerSchemaAndHost['ssl_torrent'];
$base_announce_url = $trackerSchemaAndHost['base_announce_url'];
$res = sql_query("SELECT torrents.name, torrents.filename, torrents.save_as, torrents.size, torrents.owner, torrents.banned, categories.mode as search_box_id FROM torrents left join categories on torrents.category = categories.id WHERE torrents.id = ".sqlesc($id)) or sqlerr(__FILE__, __LINE__);
$res = sql_query("SELECT torrents.name, torrents.filename, torrents.save_as, torrents.size, torrents.owner, torrents.banned, torrents.approval_status, categories.mode as search_box_id FROM torrents left join categories on torrents.category = categories.id WHERE torrents.id = ".sqlesc($id)) or sqlerr(__FILE__, __LINE__);
$row = mysql_fetch_assoc($res);
if (!$row) {
do_log("[TORRENT_NOT_EXISTS_IN_DATABASE] $id", 'error');
@@ -107,7 +107,8 @@ if (filesize($fn) == 0) {
do_log("[TORRENT_NOT_VALID_SIZE_ZERO] $fn",'error');
httperr();
}
if (($row['banned'] == 'yes' && get_user_class() < $seebanned_class) || !can_access_torrent($row)) {
$approvalNotAllowed = $row['approval_status'] != \App\Models\Torrent::APPROVAL_STATUS_ALLOW && get_setting('torrent.approval_status_none_visible') == 'no';
if ((($row['banned'] == 'yes' || $approvalNotAllowed) && get_user_class() < $seebanned_class) || !can_access_torrent($row)) {
denyDownload();
}

View File

@@ -8,9 +8,13 @@ header("Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . "GMT" );
header("Cache-Control: no-cache, must-revalidate" );
header("Pragma: no-cache" );
//header("Content-Type: text/xml; charset=utf-8");
$torrentRep = new \App\Repositories\TorrentRepository();
function maketable($res, $mode = 'seeding')
{
global $lang_getusertorrentlistajax,$CURUSER,$smalldescription_main, $lang_functions;
global $torrentRep;
switch ($mode)
{
case 'uploaded': {
@@ -107,6 +111,7 @@ function maketable($res, $mode = 'seeding')
}
$hrImg = get_hr_img($arr);
$approvalStatusIcon = $torrentRep->renderApprovalStatus($arr["approval_status"]);
//torrent name
$dispname = $nametitle = htmlspecialchars($arr["torrentname"]);
$count_dispname=mb_strlen($dispname,"UTF-8");
@@ -125,7 +130,7 @@ function maketable($res, $mode = 'seeding')
}
else $dissmall_descr == "";
$ret .= "<tr" . $sphighlight . "><td class=\"rowfollow nowrap\" valign=\"middle\" style='padding: 0px'>".return_category_image($arr['category'], "torrents.php?allsec=1&amp;")."</td>\n" .
"<td class=\"rowfollow\" width=\"100%\" align=\"left\"><a href=\"".htmlspecialchars("details.php?id=".$arr['torrent']."&hit=1")."\" title=\"".$nametitle."\"><b>" . $dispname . "</b></a>". $banned_torrent . $sp_torrent . $hrImg .($dissmall_descr == "" ? "" : "<br />" . $dissmall_descr) . "</td>";
"<td class=\"rowfollow\" width=\"100%\" align=\"left\"><a href=\"".htmlspecialchars("details.php?id=".$arr['torrent']."&hit=1")."\" title=\"".$nametitle."\"><b>" . $dispname . "</b></a>". $banned_torrent . $sp_torrent . $hrImg . $approvalStatusIcon .($dissmall_descr == "" ? "" : "<br />" . $dissmall_descr) . "</td>";
//size
if ($showsize)
$ret .= "<td class=\"rowfollow\" align=\"center\">". mksize_compact($arr['size'])."</td>";
@@ -184,7 +189,7 @@ switch ($type)
{
case 'uploaded':
{
$res = sql_query("SELECT torrents.id AS torrent, torrents.name as torrentname, small_descr, seeders, leechers, anonymous, torrents.banned, categories.name AS catname, categories.image, category, sp_state, size, torrents.hr, snatched.seedtime, snatched.uploaded FROM torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories ON torrents.category = categories.id WHERE torrents.owner=$id AND snatched.userid=$id " . (($CURUSER["id"] != $id)?((get_user_class() < $viewanonymous_class) ? " AND anonymous = 'no'":""):"") ." ORDER BY torrents.added DESC") or sqlerr(__FILE__, __LINE__);
$res = sql_query("SELECT torrents.id AS torrent, torrents.name as torrentname, small_descr, seeders, leechers, anonymous, torrents.banned, torrents.approval_status, categories.name AS catname, categories.image, category, sp_state, size, torrents.hr, snatched.seedtime, snatched.uploaded FROM torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories ON torrents.category = categories.id WHERE torrents.owner=$id AND snatched.userid=$id " . (($CURUSER["id"] != $id)?((get_user_class() < $viewanonymous_class) ? " AND anonymous = 'no'":""):"") ." ORDER BY torrents.added DESC") or sqlerr(__FILE__, __LINE__);
$count = mysql_num_rows($res);
if ($count > 0)
{
@@ -196,7 +201,7 @@ switch ($type)
// Current Seeding
case 'seeding':
{
$res = sql_query("SELECT torrent,added,snatched.uploaded,snatched.downloaded,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, torrents.banned, categories.name as catname,size,torrents.hr,image,category,seeders,leechers FROM peers LEFT JOIN torrents ON peers.torrent = torrents.id LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN snatched ON torrents.id = snatched.torrentid WHERE peers.userid=$id AND snatched.userid = $id AND peers.seeder='yes' ORDER BY torrents.added DESC") or sqlerr();
$res = sql_query("SELECT torrent,added,snatched.uploaded,snatched.downloaded,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, torrents.banned, torrents.approval_status, categories.name as catname,size,torrents.hr,image,category,seeders,leechers FROM peers LEFT JOIN torrents ON peers.torrent = torrents.id LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN snatched ON torrents.id = snatched.torrentid WHERE peers.userid=$id AND snatched.userid = $id AND peers.seeder='yes' ORDER BY torrents.added DESC") or sqlerr();
$count = mysql_num_rows($res);
if ($count > 0){
list($torrentlist, $total_size) = maketable ( $res, 'seeding' );
@@ -207,7 +212,7 @@ switch ($type)
// Current Leeching
case 'leeching':
{
$res = sql_query("SELECT torrent,snatched.uploaded,snatched.downloaded,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, torrents.banned, categories.name as catname,size,torrents.hr,image,category,seeders,leechers FROM peers LEFT JOIN torrents ON peers.torrent = torrents.id LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN snatched ON torrents.id = snatched.torrentid WHERE peers.userid=$id AND snatched.userid = $id AND peers.seeder='no' ORDER BY torrents.added DESC") or sqlerr();
$res = sql_query("SELECT torrent,snatched.uploaded,snatched.downloaded,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, torrents.banned, torrents.approval_status, categories.name as catname,size,torrents.hr,image,category,seeders,leechers FROM peers LEFT JOIN torrents ON peers.torrent = torrents.id LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN snatched ON torrents.id = snatched.torrentid WHERE peers.userid=$id AND snatched.userid = $id AND peers.seeder='no' ORDER BY torrents.added DESC") or sqlerr();
$count = mysql_num_rows($res);
if ($count > 0){
list($torrentlist, $total_size) = maketable ( $res, 'leeching' );
@@ -218,7 +223,7 @@ switch ($type)
// Completed torrents
case 'completed':
{
$res = sql_query("SELECT torrents.id AS torrent, torrents.name AS torrentname, small_descr, categories.name AS catname, torrents.banned, categories.image, category, sp_state, size, torrents.hr,snatched.uploaded, snatched.seedtime, snatched.leechtime, snatched.completedat FROM torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories on torrents.category = categories.id WHERE snatched.finished='yes' AND torrents.owner != $id AND userid=$id ORDER BY snatched.completedat DESC") or sqlerr();
$res = sql_query("SELECT torrents.id AS torrent, torrents.name AS torrentname, small_descr, categories.name AS catname, torrents.banned, torrents.approval_status, categories.image, category, sp_state, size, torrents.hr,snatched.uploaded, snatched.seedtime, snatched.leechtime, snatched.completedat FROM torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories on torrents.category = categories.id WHERE snatched.finished='yes' AND torrents.owner != $id AND userid=$id ORDER BY snatched.completedat DESC") or sqlerr();
$count = mysql_num_rows($res);
if ($count > 0)
{
@@ -230,7 +235,7 @@ switch ($type)
// Incomplete torrents
case 'incomplete':
{
$res = sql_query("SELECT torrents.id AS torrent, torrents.name AS torrentname, small_descr, torrents.banned, categories.name AS catname, categories.image, category, sp_state, size, torrents.hr,snatched.uploaded, snatched.downloaded, snatched.leechtime FROM torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories on torrents.category = categories.id WHERE snatched.finished='no' AND userid=$id AND torrents.owner != $id ORDER BY snatched.startdat DESC") or sqlerr();
$res = sql_query("SELECT torrents.id AS torrent, torrents.name AS torrentname, small_descr, torrents.banned, torrents.approval_status, categories.name AS catname, categories.image, category, sp_state, size, torrents.hr,snatched.uploaded, snatched.downloaded, snatched.leechtime FROM torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories on torrents.category = categories.id WHERE snatched.finished='no' AND userid=$id AND torrents.owner != $id ORDER BY snatched.startdat DESC") or sqlerr();
$count = mysql_num_rows($res);
if ($count > 0)
{

View File

@@ -151,7 +151,7 @@ elseif($action == 'savesettings_torrent') // save account
'twoupbecome','twoupfreebecome', 'twouphalfleechbecome','normalbecome','uploaderdouble','deldeadtorrent', 'randomthirtypercentdown',
'thirtypercentleechbecome', 'expirethirtypercentleech', 'sticky_first_level_background_color', 'sticky_second_level_background_color',
'download_support_passkey', 'claim_enabled', 'claim_torrent_ttl', 'claim_torrent_user_counts_up_limit', 'claim_user_torrent_counts_up_limit', 'claim_remove_deduct_user_bonus',
'claim_give_up_deduct_user_bonus', 'claim_bonus_multiplier', 'claim_reach_standard_seed_time', 'claim_reach_standard_uploaded', 'approval_status_icon_enabled'
'claim_give_up_deduct_user_bonus', 'claim_bonus_multiplier', 'claim_reach_standard_seed_time', 'claim_reach_standard_uploaded', 'approval_status_icon_enabled', 'approval_status_none_visible'
);
$validConfig = apply_filter('setting_valid_config', $validConfig);
GetVar($validConfig);
@@ -661,6 +661,7 @@ elseif ($action == 'torrentsettings')
tr($lang_settings['row_sticky_second_level_background_color'],"<input type='text' name=sticky_second_level_background_color style=\"width: 100px\" value={$TORRENT['sticky_second_level_background_color']}> ".$lang_settings['text_sticky_second_level_background_color_note'], 1);
yesorno($lang_settings['row_download_support_passkey'], 'download_support_passkey', $TORRENT["download_support_passkey"], $lang_settings['text_download_support_passkey_note']);
yesorno($lang_settings['row_approval_status_icon_enabled'], 'approval_status_icon_enabled', $TORRENT["approval_status_icon_enabled"], $lang_settings['text_approval_status_icon_enabled_note']);
yesorno($lang_settings['row_approval_status_none_visible'], 'approval_status_none_visible', $TORRENT["approval_status_none_visible"], $lang_settings['text_approval_status_none_visible_note']);
yesorno($lang_settings['row_promotion_rules'], 'prorules', $TORRENT["prorules"], $lang_settings['text_promotion_rules_note']);
tr($lang_settings['row_random_promotion'], $lang_settings['text_random_promotion_note_one']."<ul><li><input type='text' style=\"width: 50px\" name=randomhalfleech value='".(isset($TORRENT["randomhalfleech"]) ? $TORRENT["randomhalfleech"] : 5 )."'>".$lang_settings['text_halfleech_chance_becoming']."</li><li><input type='text' style=\"width: 50px\" name=randomfree value='".(isset($TORRENT["randomfree"]) ? $TORRENT["randomfree"] : 2 )."'>".$lang_settings['text_free_chance_becoming']."</li><li><input type='text' style=\"width: 50px\" name=randomtwoup value='".(isset($TORRENT["randomtwoup"]) ? $TORRENT["randomtwoup"] : 2 )."'>".$lang_settings['text_twoup_chance_becoming']."</li><li><input type='text' style=\"width: 50px\" name=randomtwoupfree value='".(isset($TORRENT["randomtwoupfree"]) ? $TORRENT["randomtwoupfree"] : 1 )."'>".$lang_settings['text_freetwoup_chance_becoming']."</li><li><input type='text' style=\"width: 50px\" name=randomtwouphalfdown value='".(isset($TORRENT["randomtwouphalfdown"]) ? $TORRENT["randomtwouphalfdown"] : 0 )."'>".$lang_settings['text_twouphalfleech_chance_becoming']."</li><li><input type='text' style=\"width: 50px\" name=randomthirtypercentdown value='".(isset($TORRENT["randomthirtypercentdown"]) ? $TORRENT["randomthirtypercentdown"] : 0 )."'>".$lang_settings['text_thirtypercentleech_chance_becoming']."</li></ul>".$lang_settings['text_random_promotion_note_two'], 1);
tr($lang_settings['row_large_torrent_promotion'], $lang_settings['text_torrent_larger_than']."<input type='text' style=\"width: 50px\" name=largesize value='".(isset($TORRENT["largesize"]) ? $TORRENT["largesize"] : 20 )."'>".$lang_settings['text_gb_promoted_to']."<select name=largepro>".promotion_selection((isset($TORRENT['largepro']) ? $TORRENT['largepro'] : 2), 1)."</select>".$lang_settings['text_by_system_upon_uploading']."<br />".$lang_settings['text_large_torrent_promotion_note'], 1);

View File

@@ -77,6 +77,13 @@ if($showrows < 1 || $showrows > 50)
$showrows = 10;
$limit .= $showrows;
$where = '';
//approval status
$approvalStatusNoneVisible = get_setting('torrent.approval_status_none_visible');
if ($approvalStatusNoneVisible == 'no' && get_user_class() < $staffmem_class) {
$where = "torrents.approval_status = " . \App\Models\Torrent::APPROVAL_STATUS_ALLOW;
}
function get_where($tablename = "sources", $itemname = "source", $getname = "sou")
{
global $where;

View File

@@ -806,6 +806,12 @@ if (isset($searchstr))
$addparam .= "search_mode=".$search_mode."&";
}
//approval status
$approvalStatusNoneVisible = get_setting('torrent.approval_status_none_visible');
if ($approvalStatusNoneVisible == 'no' && get_user_class() < $staffmem_class) {
$wherea[] = "torrents.approval_status = " . \App\Models\Torrent::APPROVAL_STATUS_ALLOW;
}
$where = implode(" AND ", $wherea);
if ($wherecatin)

View File

@@ -68,10 +68,10 @@ return [
'status_label' => 'Approval status',
'comment_label' => 'Comment(optional)',
'status_text' => [
\App\Models\Torrent::APPROVAL_STATUS_NONE => 'None',
\App\Models\Torrent::APPROVAL_STATUS_ALLOW => 'Allow',
\App\Models\Torrent::APPROVAL_STATUS_DENY => 'Deny',
\App\Models\Torrent::APPROVAL_STATUS_NONE => 'Not reviewed',
\App\Models\Torrent::APPROVAL_STATUS_ALLOW => 'Review approved',
\App\Models\Torrent::APPROVAL_STATUS_DENY => 'Review not approved',
],
'deny_comment_show' => 'Denied, reason: reason',
'deny_comment_show' => 'Denied, reason: :reason',
],
];