torrents list show seedbox icon

This commit is contained in:
xiaomlove
2022-09-02 19:49:41 +08:00
parent 17b225424e
commit 875e8ea797
19 changed files with 180 additions and 39 deletions
+1 -3
View File
@@ -86,9 +86,7 @@ class Test extends Command
*/ */
public function handle() public function handle()
{ {
$role = Role::query()->first();
$r = $role->permissions()->createMany([['permission' => 'sss']]);
dd($r);
} }
@@ -44,7 +44,7 @@ class TagResource extends Resource
Forms\Components\TextInput::make('margin')->required()->label(__('label.tag.margin')), Forms\Components\TextInput::make('margin')->required()->label(__('label.tag.margin')),
Forms\Components\TextInput::make('padding')->required()->label(__('label.tag.padding')), Forms\Components\TextInput::make('padding')->required()->label(__('label.tag.padding')),
Forms\Components\TextInput::make('border_radius')->required()->label(__('label.tag.border_radius')), Forms\Components\TextInput::make('border_radius')->required()->label(__('label.tag.border_radius')),
Forms\Components\TextInput::make('priority')->integer()->label(__('label.priority')), Forms\Components\TextInput::make('priority')->integer()->required()->label(__('label.priority'))->default(0),
]); ]);
} }
@@ -10,4 +10,8 @@ class CreateTag extends CreateRecord
{ {
protected static string $resource = TagResource::class; protected static string $resource = TagResource::class;
protected function getRedirectUrl(): string
{
return $this->getResource()::getUrl('index');
}
} }
+20 -1
View File
@@ -9,9 +9,28 @@ class SearchBox extends NexusModel
protected $fillable = [ protected $fillable = [
'name', 'catsperrow', 'catpadding', 'showsubcat', 'name', 'catsperrow', 'catpadding', 'showsubcat',
'showsource', 'showmedium', 'showcodec', 'showstandard', 'showprocessing', 'showteam', 'showaudiocodec', 'showsource', 'showmedium', 'showcodec', 'showstandard', 'showprocessing', 'showteam', 'showaudiocodec',
'custom_fields', 'custom_fields_display_name', 'custom_fields_display' 'custom_fields', 'custom_fields_display_name', 'custom_fields_display', 'extra'
]; ];
protected $casts = [
'extra' => 'object'
];
const EXTRA_DISPLAY_COVER_ON_TORRENT_LIST = 'display_cover_on_torrent_list';
public static array $extras = [
self::EXTRA_DISPLAY_COVER_ON_TORRENT_LIST => ['text' => 'Display cover on torrent list'],
];
public static function listExtraText(): array
{
$result = [];
foreach (self::$extras as $extra => $info) {
$result[$extra] = nexus_trans("searchbox.extras.$extra");
}
return $result;
}
public function categories(): \Illuminate\Database\Eloquent\Relations\HasMany public function categories(): \Illuminate\Database\Eloquent\Relations\HasMany
{ {
return $this->hasMany(Category::class, 'mode'); return $this->hasMany(Category::class, 'mode');
+10 -5
View File
@@ -130,13 +130,18 @@ class SeedBoxRepository extends BaseRepository
}); });
} }
public function renderIcon($ip, $uid): string public function renderIcon($ipArr, $uid): string
{ {
$result = ''; static $enableSeedBox;
if ((isIPV4($ip) || isIPV6($ip)) && get_setting('seed_box.enabled') == 'yes' && isIPSeedBox($ip, $uid)) { if ($enableSeedBox === null) {
$result = '<img src="pic/misc/seed-box.png" style="vertical-align: bottom; height: 16px; margin-left: 4px" title="SeedBox" />'; $enableSeedBox = get_setting('seed_box.enabled') == 'yes';
} }
return $result; foreach (Arr::wrap($ipArr) as $ip) {
if ((isIPV4($ip) || isIPV6($ip)) && $enableSeedBox && isIPSeedBox($ip, $uid)) {
return '<img src="pic/misc/seed-box.png" style="vertical-align: bottom; height: 16px; margin-left: 4px" title="SeedBox" />';
}
}
return '';
} }
private function clearCache() private function clearCache()
@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('searchbox', function (Blueprint $table) {
$table->text('extra')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('searchbox', function (Blueprint $table) {
$table->dropColumn('extra');
});
}
};
+10 -6
View File
@@ -2,6 +2,7 @@
namespace Database\Seeders; namespace Database\Seeders;
use App\Models\SearchBox;
use Illuminate\Database\Seeder; use Illuminate\Database\Seeder;
class SearchboxTableSeeder extends Seeder class SearchboxTableSeeder extends Seeder
@@ -14,12 +15,12 @@ class SearchboxTableSeeder extends Seeder
*/ */
public function run() public function run()
{ {
\DB::table('searchbox')->delete(); \DB::table('searchbox')->delete();
\DB::table('searchbox')->insert(array ( \DB::table('searchbox')->insert(array (
0 => 0 =>
array ( array (
'id' => 4, 'id' => 4,
'name' => 'chd', 'name' => 'chd',
@@ -36,9 +37,12 @@ class SearchboxTableSeeder extends Seeder
'custom_fields' => '', 'custom_fields' => '',
'custom_fields_display_name' => '', 'custom_fields_display_name' => '',
'custom_fields_display' => '', 'custom_fields_display' => '',
'extra' => json_encode([
SearchBox::EXTRA_DISPLAY_COVER_ON_TORRENT_LIST => 1,
])
), ),
)); ));
} }
} }
+51 -14
View File
@@ -3291,7 +3291,7 @@ function get_torrent_bookmark_state($userid, $torrentid, $text = false)
return $act; return $act;
} }
function torrenttable($rows, $variant = "torrent") { function torrenttable($rows, $variant = "torrent", $searchBoxId = 0) {
global $Cache; global $Cache;
global $lang_functions; global $lang_functions;
global $CURUSER, $waitsystem; global $CURUSER, $waitsystem;
@@ -3302,7 +3302,13 @@ function torrenttable($rows, $variant = "torrent") {
$torrent = new Nexus\Torrent\Torrent(); $torrent = new Nexus\Torrent\Torrent();
$torrentRep = new \App\Repositories\TorrentRepository(); $torrentRep = new \App\Repositories\TorrentRepository();
$imdb = new \Nexus\Imdb\Imdb(); $imdb = new \Nexus\Imdb\Imdb();
$torrentIdArr = array_column($rows, 'id'); $torrentIdArr = $ownerIdArr = [];
foreach($rows as $row) {
$torrentIdArr[] = $row['id'];
$ownerIdArr[] = $row['owner'];
}
unset($row);
$torrentSeedingLeechingStatus = $torrent->listLeechingSeedingStatus($CURUSER['id'], $torrentIdArr); $torrentSeedingLeechingStatus = $torrent->listLeechingSeedingStatus($CURUSER['id'], $torrentIdArr);
$tagRep = new \App\Repositories\TagRepository(); $tagRep = new \App\Repositories\TagRepository();
$tagCollection = $tagRep->createBasicQuery()->get(); $tagCollection = $tagRep->createBasicQuery()->get();
@@ -3310,6 +3316,25 @@ function torrenttable($rows, $variant = "torrent") {
$torrentTagCollection = \App\Models\TorrentTag::query()->whereIn('torrent_id', $torrentIdArr)->orderByRaw("field(tag_id,$tagIdStr)")->get(); $torrentTagCollection = \App\Models\TorrentTag::query()->whereIn('torrent_id', $torrentIdArr)->orderByRaw("field(tag_id,$tagIdStr)")->get();
$tagKeyById = $tagCollection->keyBy('id'); $tagKeyById = $tagCollection->keyBy('id');
$torrentTagResult = $torrentTagCollection->groupBy('torrent_id'); $torrentTagResult = $torrentTagCollection->groupBy('torrent_id');
$showCover = false;
if ($searchBoxId) {
$searchBoxExtra = get_searchbox_value($searchBoxId, "extra");
if (!empty($searchBoxExtra[\App\Models\SearchBox::EXTRA_DISPLAY_COVER_ON_TORRENT_LIST])) {
$showCover = true;
}
}
//seedBoxIcon
$showSeedBoxIcon = get_setting('seed_box.enabled') == 'yes';
if ($showSeedBoxIcon) {
$seedBoxRep = new \App\Repositories\SeedBoxRepository();
$ownerPeerInfo = \App\Models\Peer::query()
->whereIn('torrent', $torrentIdArr)
->whereIn('userid', array_unique($ownerIdArr))
->where('seeder', 'yes')
->get(['torrent', 'ipv4', 'ipv6'])
->keyBy('torrent');
}
$last_browse = $CURUSER['last_browse']; $last_browse = $CURUSER['last_browse'];
// if ($variant == "torrent"){ // if ($variant == "torrent"){
@@ -3489,20 +3514,23 @@ foreach ($rows as $row)
$hrImg = get_hr_img($row); $hrImg = get_hr_img($row);
//cover //cover
$coverSrc = ''; $coverSrc = $tdCover = '';
if ($imdb_id = parse_imdb_id($row["url"])) { if ($showCover) {
try { if ($imdb_id = parse_imdb_id($row["url"])) {
if ($imdb->getCacheStatus($imdb_id) == 1) { try {
$coverSrc = $imdb->getMovie($imdb_id)->photo(false); if ($imdb->getCacheStatus($imdb_id) == 1) {
$coverSrc = $imdb->getMovie($imdb_id)->photo(false);
}
} catch (\Exception $exception) {
do_log("torrent: {$row['id']} get cover from imdb error: ".$exception->getMessage() . "\n[stacktrace]\n" . $exception->getTraceAsString(), 'error');
} }
} catch (\Exception $exception) {
do_log("torrent: {$row['id']} get cover from imdb error: ".$exception->getMessage() . "\n[stacktrace]\n" . $exception->getTraceAsString(), 'error');
} }
if (empty($coverSrc) && !empty($row['cover'])) {
$coverSrc = $row['cover'];
}
$tdCover = sprintf('<td class="embedded" style="text-align: center;width: 46px;height: 46px"><img src="pic/misc/spinner.svg" data-src="%s" class="nexus-lazy-load" style="max-height: 46px;max-width: 46px" /></td>', $coverSrc);
} }
if (empty($coverSrc) && !empty($row['cover'])) {
$coverSrc = $row['cover'];
}
$tdCover = sprintf('<td class="embedded" style="text-align: center;width: 46px;height: 46px"><img src="pic/misc/spinner.svg" data-src="%s" class="nexus-lazy-load" style="max-height: 46px;max-width: 46px" /></td>', $coverSrc);
print("<td class=\"rowfollow\" width=\"100%\" align=\"left\" style='padding: 0px'><table class=\"torrentname\" width=\"100%\"><tr" . $sphighlight . ">$tdCover<td class=\"embedded\" style='padding-left: 5px'>".$stickyicon."<a $short_torrent_name_alt $mouseovertorrent href=\"details.php?id=".$id."&amp;hit=1\"><b>".htmlspecialchars($dispname)."</b></a>"); print("<td class=\"rowfollow\" width=\"100%\" align=\"left\" style='padding: 0px'><table class=\"torrentname\" width=\"100%\"><tr" . $sphighlight . ">$tdCover<td class=\"embedded\" style='padding-left: 5px'>".$stickyicon."<a $short_torrent_name_alt $mouseovertorrent href=\"details.php?id=".$id."&amp;hit=1\"><b>".htmlspecialchars($dispname)."</b></a>");
$picked_torrent = ""; $picked_torrent = "";
if ($CURUSER['appendpicked'] != 'no'){ if ($CURUSER['appendpicked'] != 'no'){
@@ -3519,7 +3547,13 @@ foreach ($rows as $row)
$banned_torrent = ($row["banned"] == 'yes' ? " <b>(<font class=\"striking\">".$lang_functions['text_banned']."</font>)</b>" : ""); $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); $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 = $torrentRep->renderApprovalStatus($row['approval_status']); $approvalStatusIcon = $torrentRep->renderApprovalStatus($row['approval_status']);
$titleSuffix = $banned_torrent.$picked_torrent.$sp_torrent.$sp_torrent_sub. $hrImg . $approvalStatusIcon; if ($showSeedBoxIcon && $ownerPeerInfo->has($row['id'])) {
$ownerPeer = $ownerPeerInfo->get($row['id']);
$seedBoxIcon = $seedBoxRep->renderIcon([$ownerPeer->ipv4, $ownerPeer->ipv6], $row['owner']);
} else {
$seedBoxIcon = '';
}
$titleSuffix = $banned_torrent.$picked_torrent.$sp_torrent.$sp_torrent_sub. $hrImg . $seedBoxIcon . $approvalStatusIcon;
$titleSuffix = apply_filter('torrent_title_suffix', $titleSuffix, $row); $titleSuffix = apply_filter('torrent_title_suffix', $titleSuffix, $row);
print($titleSuffix); print($titleSuffix);
//$tags = torrentTags($row['tags'], 'span'); //$tags = torrentTags($row['tags'], 'span');
@@ -4707,6 +4741,9 @@ function get_searchbox_value($mode = 1, $item = 'showsubcat'){
$rows = array(); $rows = array();
$res = sql_query("SELECT * FROM searchbox ORDER BY id ASC"); $res = sql_query("SELECT * FROM searchbox ORDER BY id ASC");
while ($row = mysql_fetch_array($res)) { while ($row = mysql_fetch_array($res)) {
if (isset($row['extra'])) {
$row['extra'] = json_decode($row['extra'], true);
}
$rows[$row['id']] = $row; $rows[$row['id']] = $row;
} }
$Cache->cache_value('searchbox_content', $rows, 100500); $Cache->cache_value('searchbox_content', $rows, 100500);
+1
View File
@@ -80,6 +80,7 @@ $lang_catmanage = array
'row_custom_field_display_name' => '自定义字段展示名称', 'row_custom_field_display_name' => '自定义字段展示名称',
'row_custom_field_display' => '自定义字段展示', 'row_custom_field_display' => '自定义字段展示',
'row_custom_field_display_help' => '使用特殊的标签代表字段的名称和值,如某字段其 Name 为 artist,则它的名称为:<%artist.label%>,它的值为:<%artist.value%>', 'row_custom_field_display_help' => '使用特殊的标签代表字段的名称和值,如某字段其 Name 为 artist,则它的名称为:<%artist.label%>,它的值为:<%artist.value%>',
'row_searchbox_extras' => '其他',
); );
?> ?>
+1
View File
@@ -80,6 +80,7 @@ $lang_catmanage = array
'row_custom_field_display_name' => '自定義字段展示名稱', 'row_custom_field_display_name' => '自定義字段展示名稱',
'row_custom_field_display' => '自定義字段展示', 'row_custom_field_display' => '自定義字段展示',
'row_custom_field_display_help' => '使用特殊的標簽代表字段的名稱和值,如某字段其 Name 為 artist,則它的名稱為:<%artist.label%>,它的值為:<%artist.value%>', 'row_custom_field_display_help' => '使用特殊的標簽代表字段的名稱和值,如某字段其 Name 為 artist,則它的名稱為:<%artist.label%>,它的值為:<%artist.value%>',
'row_searchbox_extras' => '其他',
); );
?> ?>
+1
View File
@@ -80,6 +80,7 @@ $lang_catmanage = array
'row_custom_field_display_name' => 'Custom field display name', 'row_custom_field_display_name' => 'Custom field display name',
'row_custom_field_display' => 'Custom field display', 'row_custom_field_display' => 'Custom field display',
'row_custom_field_display_help' => "Use 'specific label' to represent custom field's label and valuesuch as one custom field's name is 'artist'<br/>then it's label<%artist.label%>it's value<%artist.value%>", 'row_custom_field_display_help' => "Use 'specific label' to represent custom field's label and valuesuch as one custom field's name is 'artist'<br/>then it's label<%artist.label%>it's value<%artist.value%>",
'row_searchbox_extras' => 'Extras',
); );
?> ?>
+8 -1
View File
@@ -9,6 +9,7 @@ use App\Models\Exam;
use App\Models\ExamUser; use App\Models\ExamUser;
use App\Models\HitAndRun; use App\Models\HitAndRun;
use App\Models\Icon; use App\Models\Icon;
use App\Models\SearchBox;
use App\Models\Setting; use App\Models\Setting;
use App\Models\Tag; use App\Models\Tag;
use App\Models\Torrent; use App\Models\Torrent;
@@ -243,8 +244,14 @@ class Update extends Install
NexusDB::cache_del('nexus_is_ip_seed_box'); NexusDB::cache_del('nexus_is_ip_seed_box');
/** /**
* @since 1.7.23 * @since 1.7.24
*/ */
if (!NexusDB::hasColumn('searchbox', 'extra')) {
$this->runMigrate('database/migrations/2022_09_02_031539_add_extra_to_searchbox_table.php');
SearchBox::query()->update(['extra' => [
SearchBox::EXTRA_DISPLAY_COVER_ON_TORRENT_LIST => 1,
]]);
}
} }
+16
View File
@@ -217,6 +217,9 @@ function print_category_editor($type, $row='')
$showaudiocodec = $row['showaudiocodec']; $showaudiocodec = $row['showaudiocodec'];
$catsperrow = $row['catsperrow']; $catsperrow = $row['catsperrow'];
$catpadding = $row['catpadding']; $catpadding = $row['catpadding'];
if (!empty($row['extra'])) {
$row['extra'] = json_decode($row['extra'], true);
}
} }
else else
{ {
@@ -233,6 +236,17 @@ function print_category_editor($type, $row='')
} }
tr($lang_catmanage['row_searchbox_name']."<font color=\"red\">*</font>", "<input type=\"text\" name=\"name\" value=\"".htmlspecialchars($name)."\" style=\"width: 300px\" /> " . $lang_catmanage['text_searchbox_name_note'], 1); tr($lang_catmanage['row_searchbox_name']."<font color=\"red\">*</font>", "<input type=\"text\" name=\"name\" value=\"".htmlspecialchars($name)."\" style=\"width: 300px\" /> " . $lang_catmanage['text_searchbox_name_note'], 1);
tr($lang_catmanage['row_show_sub_category'], "<input type=\"checkbox\" name=\"showsource\" value=\"1\"".($showsource ? " checked=\"checked\"" : "")." /> " . $lang_catmanage['text_sources'] . "<input type=\"checkbox\" name=\"showmedium\" value=\"1\"".($showmedium ? " checked=\"checked\"" : "")." /> " . $lang_catmanage['text_media'] . "<input type=\"checkbox\" name=\"showcodec\" value=\"1\"".($showcodec ? " checked=\"checked\"" : "")." /> " . $lang_catmanage['text_codecs'] . "<input type=\"checkbox\" name=\"showstandard\" value=\"1\"".($showstandard ? " checked=\"checked\"" : "")." /> " . $lang_catmanage['text_standards'] . "<input type=\"checkbox\" name=\"showprocessing\" value=\"1\"".($showprocessing ? " checked=\"checked\"" : "")." /> " . $lang_catmanage['text_processings'] . "<input type=\"checkbox\" name=\"showteam\" value=\"1\"".($showteam ? " checked=\"checked\"" : "")." /> " . $lang_catmanage['text_teams'] . "<input type=\"checkbox\" name=\"showaudiocodec\" value=\"1\"".($showaudiocodec ? " checked=\"checked\"" : "")." /> " . $lang_catmanage['text_audio_codecs']."<br />".$lang_catmanage['text_show_sub_category_note'], 1); tr($lang_catmanage['row_show_sub_category'], "<input type=\"checkbox\" name=\"showsource\" value=\"1\"".($showsource ? " checked=\"checked\"" : "")." /> " . $lang_catmanage['text_sources'] . "<input type=\"checkbox\" name=\"showmedium\" value=\"1\"".($showmedium ? " checked=\"checked\"" : "")." /> " . $lang_catmanage['text_media'] . "<input type=\"checkbox\" name=\"showcodec\" value=\"1\"".($showcodec ? " checked=\"checked\"" : "")." /> " . $lang_catmanage['text_codecs'] . "<input type=\"checkbox\" name=\"showstandard\" value=\"1\"".($showstandard ? " checked=\"checked\"" : "")." /> " . $lang_catmanage['text_standards'] . "<input type=\"checkbox\" name=\"showprocessing\" value=\"1\"".($showprocessing ? " checked=\"checked\"" : "")." /> " . $lang_catmanage['text_processings'] . "<input type=\"checkbox\" name=\"showteam\" value=\"1\"".($showteam ? " checked=\"checked\"" : "")." /> " . $lang_catmanage['text_teams'] . "<input type=\"checkbox\" name=\"showaudiocodec\" value=\"1\"".($showaudiocodec ? " checked=\"checked\"" : "")." /> " . $lang_catmanage['text_audio_codecs']."<br />".$lang_catmanage['text_show_sub_category_note'], 1);
//extra
$extraCheckbox = "";
foreach (\App\Models\SearchBox::listExtraText() as $name => $text) {
$extraCheckbox .= sprintf(
'<label><input type="checkbox" name="extra[%s]" value="1"%s />%s</label>',
$name, !empty($row['extra'][$name]) ? ' checked' : '', $text
);
}
tr($lang_catmanage['row_searchbox_extras'], $extraCheckbox, 1);
tr($lang_catmanage['row_items_per_row']."<font color=\"red\">*</font>", "<input type=\"text\" name=\"catsperrow\" value=\"".$catsperrow."\" style=\"width: 100px\" /> " . $lang_catmanage['text_items_per_row_note'], 1); tr($lang_catmanage['row_items_per_row']."<font color=\"red\">*</font>", "<input type=\"text\" name=\"catsperrow\" value=\"".$catsperrow."\" style=\"width: 100px\" /> " . $lang_catmanage['text_items_per_row_note'], 1);
tr($lang_catmanage['row_padding_between_items']."<font color=\"red\">*</font>", "<input type=\"text\" name=\"catpadding\" value=\"".$catpadding."\" style=\"width: 100px\" /> " . $lang_catmanage['text_padding_between_items_note'], 1); tr($lang_catmanage['row_padding_between_items']."<font color=\"red\">*</font>", "<input type=\"text\" name=\"catpadding\" value=\"".$catpadding."\" style=\"width: 100px\" /> " . $lang_catmanage['text_padding_between_items_note'], 1);
$field = new \Nexus\Field\Field(); $field = new \Nexus\Field\Field();
@@ -715,6 +729,8 @@ elseif($action == 'submit')
$updateset[] = "custom_fields=" . sqlesc(implode(',', $_POST['custom_fields'] ?? [])); $updateset[] = "custom_fields=" . sqlesc(implode(',', $_POST['custom_fields'] ?? []));
$updateset[] = "custom_fields_display_name=" . sqlesc($_POST['custom_fields_display_name'] ?? ''); $updateset[] = "custom_fields_display_name=" . sqlesc($_POST['custom_fields_display_name'] ?? '');
$updateset[] = "custom_fields_display=" . sqlesc($_POST['custom_fields_display'] ?? ''); $updateset[] = "custom_fields_display=" . sqlesc($_POST['custom_fields_display'] ?? '');
$updateset[] = "extra=" . sqlesc(json_encode($_POST['extra'] ?? []));
if ($showsource || $showmedium || $showcodec || $showstandard || $showprocessing || $showteam || $showaudiocodec) if ($showsource || $showmedium || $showcodec || $showstandard || $showprocessing || $showteam || $showaudiocodec)
$updateset[] = "showsubcat=1"; $updateset[] = "showsubcat=1";
else else
+10 -3
View File
@@ -221,7 +221,13 @@ JS;
tr($lang_details['torrent_dl_url'],sprintf('<a title="%s" href="%s/download.php?downhash=%s|%s">%s</a>',$lang_details['torrent_dl_url_notice'], getSchemeAndHttpHost(), $CURUSER['id'], $torrentRep->encryptDownHash($row['id'], $CURUSER), $lang_details['torrent_dl_url_text']),1); tr($lang_details['torrent_dl_url'],sprintf('<a title="%s" href="%s/download.php?downhash=%s|%s">%s</a>',$lang_details['torrent_dl_url_notice'], getSchemeAndHttpHost(), $CURUSER['id'], $torrentRep->encryptDownHash($row['id'], $CURUSER), $lang_details['torrent_dl_url_text']),1);
// ---------------- start subtitle block -------------------// // ---------------- start subtitle block -------------------//
$r = sql_query("SELECT subs.*, language.flagpic, language.lang_name FROM subs LEFT JOIN language ON subs.lang_id=language.id WHERE torrent_id = " . sqlesc($row["id"]). " ORDER BY subs.lang_id ASC") or sqlerr(__FILE__, __LINE__); $subTorrentIdArr = [$row['id']];
$otherCopiesIdArr = [];
if ($imdb_id) {
$otherCopiesIdArr = \App\Models\Torrent::query()->where('url', $imdb_id)->where('id', '!=', $row['id'])->pluck('id')->toArray();
$subTorrentIdArr = array_merge($subTorrentIdArr, $otherCopiesIdArr);
}
$r = sql_query("SELECT subs.*, language.flagpic, language.lang_name FROM subs LEFT JOIN language ON subs.lang_id=language.id WHERE torrent_id in(" . implode(',', $subTorrentIdArr). ") ORDER BY subs.lang_id ASC") or sqlerr(__FILE__, __LINE__);
print("<tr><td class=\"rowhead\" valign=\"top\">".$lang_details['row_subtitles']."</td>"); print("<tr><td class=\"rowhead\" valign=\"top\">".$lang_details['row_subtitles']."</td>");
print("<td class=\"rowfollow\" align=\"left\" valign=\"top\">"); print("<td class=\"rowfollow\" align=\"left\" valign=\"top\">");
print("<table border=\"0\" cellspacing=\"0\">"); print("<table border=\"0\" cellspacing=\"0\">");
@@ -366,9 +372,10 @@ JS;
$ptGen = new \Nexus\PTGen\PTGen(); $ptGen = new \Nexus\PTGen\PTGen();
$ptGen->updateTorrentPtGen($row); $ptGen->updateTorrentPtGen($row);
} }
if ($imdb_id) if (!empty($otherCopiesIdArr))
{ {
$where_area = " url = " . sqlesc((int)$imdb_id) ." AND torrents.id != ".sqlesc($id); // $where_area = " url = " . sqlesc((int)$imdb_id) ." AND torrents.id != ".sqlesc($id);
$where_area = sprintf('torrents.id in (%s)', implode(',', $otherCopiesIdArr));
$copies_res = sql_query("SELECT torrents.id, torrents.name, torrents.sp_state, torrents.size, torrents.added, torrents.seeders, torrents.leechers, torrents.hr,categories.id AS catid, categories.name AS catname, categories.image AS catimage, sources.name AS source_name, media.name AS medium_name, codecs.name AS codec_name, standards.name AS standard_name, processings.name AS processing_name FROM torrents LEFT JOIN categories ON torrents.category=categories.id LEFT JOIN sources ON torrents.source = sources.id LEFT JOIN media ON torrents.medium = media.id LEFT JOIN codecs ON torrents.codec = codecs.id LEFT JOIN standards ON torrents.standard = standards.id LEFT JOIN processings ON torrents.processing = processings.id WHERE " . $where_area . " ORDER BY torrents.id DESC") or sqlerr(__FILE__, __LINE__); $copies_res = sql_query("SELECT torrents.id, torrents.name, torrents.sp_state, torrents.size, torrents.added, torrents.seeders, torrents.leechers, torrents.hr,categories.id AS catid, categories.name AS catname, categories.image AS catimage, sources.name AS source_name, media.name AS medium_name, codecs.name AS codec_name, standards.name AS standard_name, processings.name AS processing_name FROM torrents LEFT JOIN categories ON torrents.category=categories.id LEFT JOIN sources ON torrents.source = sources.id LEFT JOIN media ON torrents.medium = media.id LEFT JOIN codecs ON torrents.codec = codecs.id LEFT JOIN standards ON torrents.standard = standards.id LEFT JOIN processings ON torrents.processing = processings.id WHERE " . $where_area . " ORDER BY torrents.id DESC") or sqlerr(__FILE__, __LINE__);
$copies_count = mysql_num_rows($copies_res); $copies_count = mysql_num_rows($copies_res);
+1 -1
View File
@@ -46,7 +46,7 @@ function maketable($res, $mode = 'seeding')
$showuploaded = true; $showuploaded = true;
$showdownloaded = true; $showdownloaded = true;
$showratio = true; $showratio = true;
$showsetime = false; $showsetime = true;
$showletime = false; $showletime = false;
$showcotime = false; $showcotime = false;
$showanonymous = false; $showanonymous = false;
+3 -3
View File
@@ -1187,10 +1187,10 @@ if ($count) {
$rows = apply_filter('torrent_list', $rows, $page, $sectiontype); $rows = apply_filter('torrent_list', $rows, $page, $sectiontype);
print($pagertop); print($pagertop);
if ($sectiontype == $browsecatmode) if ($sectiontype == $browsecatmode)
torrenttable($rows, "torrents"); torrenttable($rows, "torrents", $sectiontype);
elseif ($sectiontype == $specialcatmode) elseif ($sectiontype == $specialcatmode)
torrenttable($rows, "music"); torrenttable($rows, "music", $sectiontype);
else torrenttable($rows, "bookmarks"); else torrenttable($rows, "bookmarks", $sectiontype);
print($pagerbottom); print($pagerbottom);
} }
else { else {
+3
View File
@@ -9,4 +9,7 @@ return [
'sub_category_processing_label' => 'Processing', 'sub_category_processing_label' => 'Processing',
'sub_category_codec_label' => 'Codec', 'sub_category_codec_label' => 'Codec',
'sub_category_audio_codec_label' => 'AudioCodec', 'sub_category_audio_codec_label' => 'AudioCodec',
'extras' => [
\App\Models\SearchBox::EXTRA_DISPLAY_COVER_ON_TORRENT_LIST => 'Display cover on torrent list',
],
]; ];
+4 -1
View File
@@ -8,5 +8,8 @@ return [
'sub_category_team_label' => '制作组', 'sub_category_team_label' => '制作组',
'sub_category_processing_label' => '处理', 'sub_category_processing_label' => '处理',
'sub_category_codec_label' => '编码', 'sub_category_codec_label' => '编码',
'sub_category_audio_codec_label' => '音频编码', 'sub_category_audio_codec_label' => '音频编码',
'extras' => [
\App\Models\SearchBox::EXTRA_DISPLAY_COVER_ON_TORRENT_LIST => '种子列表页展示封面',
],
]; ];
+3
View File
@@ -9,4 +9,7 @@ return [
'sub_category_processing_label' => '處理', 'sub_category_processing_label' => '處理',
'sub_category_codec_label' => '編碼', 'sub_category_codec_label' => '編碼',
'sub_category_audio_codec_label' => '音頻編碼', 'sub_category_audio_codec_label' => '音頻編碼',
'extras' => [
\App\Models\SearchBox::EXTRA_DISPLAY_COVER_ON_TORRENT_LIST => '種子列表頁展示封面',
],
]; ];