diff --git a/app/Console/Commands/NexusUpdate.php b/app/Console/Commands/NexusUpdate.php index 391a6b20..1a6b44ac 100644 --- a/app/Console/Commands/NexusUpdate.php +++ b/app/Console/Commands/NexusUpdate.php @@ -12,14 +12,14 @@ class NexusUpdate extends Command * * @var string */ - protected $signature = 'nexus:update {--tag=} {--keep_tmp}'; + protected $signature = 'nexus:update {--tag=} {--keep_tmp} {--include_composer}'; /** * The console command description. * * @var string */ - protected $description = 'Update nexusphp after code updated, remember run `composer update` first. Options: --tag=, --keep_tmp'; + protected $description = 'Update nexusphp after code updated, remember run `composer update` first. Options: --tag=, --keep_tmp, --include_composer'; private $update; @@ -45,14 +45,19 @@ class NexusUpdate extends Command require ROOT_PATH . 'nexus/Database/helpers.php'; $tag = $this->option('tag'); $keepTmp = $this->option('keep_tmp'); + $includeComposer = $this->option('include_composer'); + $includes = []; + if ($includeComposer) { + $includes[] = 'composer'; + } 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); + $this->doLog("Specific tag: '$tag', download from '$url' and extra code, includes: " . implode(', ', $includes)); + $tmpPath = $this->update->downAndExtractCode($url, $includes); } //Step 1 $step = $this->update->currentStep(); diff --git a/app/Console/Commands/Test.php b/app/Console/Commands/Test.php index aae1340b..b608f387 100644 --- a/app/Console/Commands/Test.php +++ b/app/Console/Commands/Test.php @@ -78,8 +78,8 @@ class Test extends Command */ public function handle() { - $r = User::query()->find(10003, ['id', 'added', 'donoruntil']); - dd($r->donoruntil->toDateTimeString() < '1978'); + $r = Carbon::parse('2022-07-03 04:00:00')->diffInSeconds(); + dd($r); } diff --git a/app/Filament/Resources/Torrent/TagResource.php b/app/Filament/Resources/Torrent/TagResource.php index ad372cc9..bb6a8909 100644 --- a/app/Filament/Resources/Torrent/TagResource.php +++ b/app/Filament/Resources/Torrent/TagResource.php @@ -21,7 +21,7 @@ class TagResource extends Resource protected static ?string $navigationGroup = 'Torrent'; - protected static ?int $navigationSort = 1; + protected static ?int $navigationSort = 2; protected static function getNavigationLabel(): string { diff --git a/app/Filament/Resources/Torrent/TorrentResource.php b/app/Filament/Resources/Torrent/TorrentResource.php new file mode 100644 index 00000000..1d2a168f --- /dev/null +++ b/app/Filament/Resources/Torrent/TorrentResource.php @@ -0,0 +1,198 @@ +schema([ + // + ]); + } + + public static function table(Table $table): Table + { + return $table + ->columns([ + Tables\Columns\TextColumn::make('id')->sortable(), + Tables\Columns\BadgeColumn::make('basic_category.name')->label(__('label.torrent.category')), + Tables\Columns\TextColumn::make('name') + ->label(__('label.name')) + ->limit(30) + ->url(fn ($record) => sprintf('/details.php?id=%s', $record->id)) + ->openUrlInNewTab(true) + , + Tables\Columns\BadgeColumn::make('posStateText')->label(__('label.torrent.pos_state')), + Tables\Columns\BadgeColumn::make('spStateText')->label(__('label.torrent.sp_state')), + Tables\Columns\TextColumn::make('tagsFormatted')->label(__('label.tag.label'))->html(), + Tables\Columns\TextColumn::make('size')->label(__('label.torrent.size'))->formatStateUsing(fn ($state) => mksize($state)), + Tables\Columns\TextColumn::make('seeders')->label(__('label.torrent.seeders')), + Tables\Columns\TextColumn::make('leechers')->label(__('label.torrent.leechers')), + Tables\Columns\BadgeColumn::make('approval_status') + ->label(__('label.torrent.approval_status')) + ->colors(array_flip(Torrent::listApprovalStatus(true, 'badge_color'))) + ->formatStateUsing(fn ($record) => $record->approvalStatusText), + Tables\Columns\TextColumn::make('added')->label(__('label.added'))->dateTime(), + Tables\Columns\TextColumn::make('user.username') + ->label(__('label.user.label')) + ->url(fn ($record) => sprintf('/userdetails.php?id=%s', $record->owner)) + ->openUrlInNewTab(true) + , + ]) + ->defaultSort('id', 'desc') + ->filters([ + Tables\Filters\SelectFilter::make('approval_status') + ->options(Torrent::listApprovalStatus(true)) + ->label(__('label.torrent.approval_status')), + + Tables\Filters\SelectFilter::make('pos_state') + ->options(Torrent::listPosStates(true)) + ->label(__('label.torrent.pos_state')), + + Tables\Filters\SelectFilter::make('sp_state') + ->options(Torrent::listPromotionTypes(true)) + ->label(__('label.torrent.sp_state')), + ]) + ->actions([ +// Tables\Actions\EditAction::make(), + Tables\Actions\Action::make('approval') + ->label(__('admin.resources.torrent.action_approval')) + ->form([ + Forms\Components\Radio::make('approval_status') + ->label(__('label.torrent.approval_status')) + ->inline() + ->required() + ->options(Torrent::listApprovalStatus(true)) + , + Forms\Components\Textarea::make('comment')->label(__('label.comment')), + ]) + ->icon('heroicon-o-check') + ->color('success') + ->action(function (Torrent $record, array $data) { + $torrentRep = new TorrentRepository(); + try { + $data['torrent_id'] = $record->id; + $torrentRep->approval(Auth::user(), $data); + } catch (\Exception $exception) { + do_log($exception->getMessage(), 'error'); + } + }) + ]) + ->bulkActions([ +// Tables\Actions\DeleteBulkAction::make(), + Tables\Actions\BulkAction::make('posState') + ->label(__('admin.resources.torrent.bulk_action_pos_state')) + ->form([ + Forms\Components\Select::make('pos_state') + ->label(__('label.torrent.pos_state')) + ->options(Torrent::listPosStates(true)) + ]) + ->icon('heroicon-o-arrow-circle-up') + ->action(function (Collection $records, array $data) { + $idArr = $records->pluck('id')->toArray(); + Torrent::query()->whereIn('id', $idArr)->update(['pos_state' => $data['pos_state']]); + }) + ->deselectRecordsAfterCompletion(), + + Tables\Actions\BulkAction::make('remove_tag') + ->label(__('admin.resources.torrent.bulk_action_remove_tag')) + ->requiresConfirmation() + ->icon('heroicon-o-minus-circle') + ->action(function (Collection $records) { + $idArr = $records->pluck('id')->toArray(); + TorrentTag::query()->whereIn('torrent_id', $idArr)->delete(); + }) + ->deselectRecordsAfterCompletion(), + + Tables\Actions\BulkAction::make('attach_tag') + ->label(__('admin.resources.torrent.bulk_action_attach_tag')) + ->form([ + Forms\Components\CheckboxList::make('tags') + ->label(__('label.tag.label')) + ->columns(4) + ->options(TagRepository::createBasicQuery()->pluck('name', 'id')->toArray()), + ]) + ->icon('heroicon-o-tag') + ->action(function (Collection $records, array $data) { + if (empty($data['tags'])) { + return; + } + $insert = $torrentIdArr = []; + $time = now()->toDateTimeString(); + foreach ($records as $torrent) { + $torrentIdArr[] = $torrent->id; + foreach ($data['tags'] as $tagId) { + $insert[] = [ + 'torrent_id' => $torrent->id, + 'tag_id' => $tagId, + 'created_at' => $time, + 'updated_at' => $time, + ]; + } + } + TorrentTag::query()->whereIn('torrent_id', $torrentIdArr)->delete(); + TorrentTag::query()->insert($insert); + }) + ->deselectRecordsAfterCompletion(), + ]); + } + + public static function getEloquentQuery(): Builder + { + return parent::getEloquentQuery()->with(['user', 'basic_category', 'tags']); + } + + public static function getRelations(): array + { + return [ + // + ]; + } + + public static function getPages(): array + { + return [ + 'index' => Pages\ListTorrents::route('/'), + 'create' => Pages\CreateTorrent::route('/create'), + 'edit' => Pages\EditTorrent::route('/{record}/edit'), + ]; + } +} diff --git a/app/Filament/Resources/Torrent/TorrentResource/Pages/CreateTorrent.php b/app/Filament/Resources/Torrent/TorrentResource/Pages/CreateTorrent.php new file mode 100644 index 00000000..acd6a02a --- /dev/null +++ b/app/Filament/Resources/Torrent/TorrentResource/Pages/CreateTorrent.php @@ -0,0 +1,12 @@ +sortable(), Tables\Columns\TextColumn::make('user.username')->label(__('label.user.label'))->searchable(), Tables\Columns\TextColumn::make('torrent.name')->limit(50)->label(__('label.torrent.label'))->searchable(), - Tables\Columns\TextColumn::make('torrent.size')->label(__('label.torrent.size'))->formatStateUsing(fn ($record) => mksize($record->size)), - Tables\Columns\TextColumn::make('torrent.added')->label(__('label.torrent.ttl'))->formatStateUsing(fn ($record) => mkprettytime($record->added)), + Tables\Columns\TextColumn::make('torrent.size')->label(__('label.torrent.size'))->formatStateUsing(fn (Model $record) => mksize($record->torrent->size)), + Tables\Columns\TextColumn::make('torrent.added')->label(__('label.torrent.ttl'))->formatStateUsing(fn (Model $record) => mkprettytime($record->torrent->added->diffInSeconds())), Tables\Columns\TextColumn::make('created_at')->label(__('label.created_at'))->dateTime(), Tables\Columns\TextColumn::make('last_settle_at')->label(__('label.claim.last_settle_at'))->dateTime(), Tables\Columns\TextColumn::make('seedTimeThisMonth')->label(__('label.claim.seed_time_this_month')), diff --git a/app/Models/Torrent.php b/app/Models/Torrent.php index 711055f2..9e3dadce 100644 --- a/app/Models/Torrent.php +++ b/app/Models/Torrent.php @@ -138,14 +138,17 @@ class Torrent extends NexusModel public static array $approvalStatus = [ self::APPROVAL_STATUS_NONE => [ 'text' => 'None', + 'badge_color' => 'primary', 'icon' => '', ], self::APPROVAL_STATUS_ALLOW => [ 'text' => 'Allow', + 'badge_color' => 'success', 'icon' => '', ], self::APPROVAL_STATUS_DENY => [ 'text' => 'Deny', + 'badge_color' => 'danger', 'icon' => '', ], ]; @@ -190,13 +193,27 @@ class Torrent extends NexusModel return $spState; } - public function posStateText(): Attribute + protected function posStateText(): Attribute { return new Attribute( get: fn($value, $attributes) => nexus_trans('torrent.pos_state_' . $attributes['pos_state']) ); } + protected function approvalStatusText(): Attribute + { + return new Attribute( + get: fn($value, $attributes) => nexus_trans('torrent.approval.status_text.' . $attributes['approval_status']) + ); + } + + protected function spStateText(): Attribute + { + return new Attribute( + get: fn($value, $attributes) => self::$promotionTypes[$this->sp_state]['text'] ?? '' + ); + } + public static function getGlobalPromotionState() { if (is_null(self::$globalPromotionState)) { @@ -221,14 +238,29 @@ class Torrent extends NexusModel return $fields; } - public static function listApprovalStatus($onlyKeyValue = false): array + public static function listApprovalStatus($onlyKeyValue = false, $valueField = 'text'): array { $result = self::$approvalStatus; $keyValue = []; foreach ($result as $status => &$info) { $text = nexus_trans("torrent.approval.status_text.$status"); $info['text'] = $text; - $keyValue[$status] = $text; + $keyValue[$status] = $info[$valueField]; + } + if ($onlyKeyValue) { + return $keyValue; + } + return $result; + } + + public static function listPromotionTypes($onlyKeyValue = false, $valueField = 'text'): array + { + $result = self::$promotionTypes; + $keyValue = []; + foreach ($result as $status => &$info) { + $text = $info['text']; + $info['text'] = $text; + $keyValue[$status] = $info[$valueField]; } if ($onlyKeyValue) { return $keyValue; @@ -253,6 +285,18 @@ class Torrent extends NexusModel return self::$hrStatus[$this->hr] ?? ''; } + public function getTagsFormattedAttribute(): string + { + $html = []; + foreach ($this->tags as $tag) { + $html[] = sprintf( + '%s', + $tag->font_color, $tag->color, $tag->border_radius, $tag->font_size, $tag->padding, $tag->margin, $tag->name + ); + } + return implode('', $html); + } + public static function getBasicInfo(): array { $result = []; @@ -262,11 +306,16 @@ class Torrent extends NexusModel return $result; } - public static function listPosStates(): array + public static function listPosStates($onlyKeyValue = false, $valueField = 'text'): array { $result = self::$posStates; + $keyValues = []; foreach ($result as $key => &$value) { $value['text'] = nexus_trans('torrent.pos_state_' . $key); + $keyValues[$key] = $value[$valueField]; + } + if ($onlyKeyValue) { + return $keyValues; } return $result; } diff --git a/app/Models/TorrentOperationLog.php b/app/Models/TorrentOperationLog.php index 2fecbbbb..7c06c06c 100644 --- a/app/Models/TorrentOperationLog.php +++ b/app/Models/TorrentOperationLog.php @@ -64,5 +64,6 @@ class TorrentOperationLog extends NexusModel Message::query()->insert($message); NexusDB::cache_del("user_{$receiver->id}_unread_message_count"); NexusDB::cache_del("user_{$receiver->id}_inbox_count"); + do_log("notify user: {$receiver->id}, $subject"); } } diff --git a/app/Repositories/DashboardRepository.php b/app/Repositories/DashboardRepository.php index 00761d37..b1dd69ec 100644 --- a/app/Repositories/DashboardRepository.php +++ b/app/Repositories/DashboardRepository.php @@ -12,6 +12,8 @@ use Illuminate\Support\Facades\DB; class DashboardRepository extends BaseRepository { + const FILAMENT_VERSION = '2.13.15'; + public function getSystemInfo(): array { $result = []; @@ -37,7 +39,7 @@ class DashboardRepository extends BaseRepository $result[$name] = [ 'name' => $name, 'text' => nexus_trans("dashboard.system_info.$name"), - 'value' => "2.13.14", + 'value' => self::FILAMENT_VERSION, ]; $name = 'php_version'; $result[$name] = [ diff --git a/app/Repositories/TorrentRepository.php b/app/Repositories/TorrentRepository.php index 58b5a453..fc146a99 100644 --- a/app/Repositories/TorrentRepository.php +++ b/app/Repositories/TorrentRepository.php @@ -521,11 +521,11 @@ class TorrentRepository extends BaseRepository NexusDB::transaction(function () use ($torrent, $torrentOperationLog, $torrentUpdate, $notifyUser) { $log = "torrent: " . $torrent->id; if (!empty($torrentUpdate)) { - $log .= "[UPDATE_TORRENT]: " . nexus_json_encode($torrentUpdate); + $log .= ", [UPDATE_TORRENT]: " . nexus_json_encode($torrentUpdate); $torrent->update($torrentUpdate); } if (!empty($torrentOperationLog)) { - $log .= "[ADD_TORRENT_OPERATION_LOG]: " . nexus_json_encode($torrentOperationLog); + $log .= ", [ADD_TORRENT_OPERATION_LOG]: " . nexus_json_encode($torrentOperationLog); TorrentOperationLog::add($torrentOperationLog, $notifyUser); } do_log($log); diff --git a/include/constants.php b/include/constants.php index 2d2a4cd1..158d5b2a 100644 --- a/include/constants.php +++ b/include/constants.php @@ -1,6 +1,6 @@ " 条记录", 'text_no_record' => "没有记录", 'text_total_size' => " | 总大小:", + 'col_added' => "发布时间", ); ?> diff --git a/lang/cht/lang_getusertorrentlistajax.php b/lang/cht/lang_getusertorrentlistajax.php index e8e4f88d..3f8f1835 100644 --- a/lang/cht/lang_getusertorrentlistajax.php +++ b/lang/cht/lang_getusertorrentlistajax.php @@ -16,5 +16,7 @@ $lang_getusertorrentlistajax = array 'col_le_time' => "下載時間", 'text_record' => "條記錄", 'text_no_record' => "沒有記錄", + 'text_total_size' => " | 總大小:", + 'col_added' => "發布時間", ); ?> diff --git a/lang/en/lang_getusertorrentlistajax.php b/lang/en/lang_getusertorrentlistajax.php index c0eb3f44..a86a31bd 100644 --- a/lang/en/lang_getusertorrentlistajax.php +++ b/lang/en/lang_getusertorrentlistajax.php @@ -16,5 +16,7 @@ $lang_getusertorrentlistajax = array 'col_le_time' => "Le. Time", 'text_record' => " record", 'text_no_record' => "No record.", + 'text_total_size' => " | Total size: ", + 'col_added' => "Added", ); ?> diff --git a/nexus/Install/Update.php b/nexus/Install/Update.php index 5660d111..d882e001 100644 --- a/nexus/Install/Update.php +++ b/nexus/Install/Update.php @@ -312,7 +312,7 @@ class Update extends Install return $results; } - public function downAndExtractCode($url): string + public function downAndExtractCode($url, array $includes = []): string { $arr = explode('/', $url); $basename = last($arr); @@ -354,7 +354,11 @@ class Update extends Install foreach (glob("$extractDir/*") as $path) { if (is_dir($path)) { - $excludes = ['.git', 'composer.lock', 'composer.json', 'public/favicon.ico', '.env']; + $excludes = ['.git', 'public/favicon.ico', '.env']; + if (!in_array('composer', $includes)) { + $excludes[] = 'composer.lock'; + $excludes[] = 'composer.json'; + } // $command = sprintf('cp -raf %s/. %s', $path, ROOT_PATH); $command = "rsync -rvq $path/ " . ROOT_PATH; foreach ($excludes as $exclude) { diff --git a/public/getusertorrentlistajax.php b/public/getusertorrentlistajax.php index 36d2d580..60eb1e2b 100644 --- a/public/getusertorrentlistajax.php +++ b/public/getusertorrentlistajax.php @@ -116,7 +116,7 @@ function maketable($res, $mode = 'seeding') ->keyBy('torrentid'); } - $ret = "". + $ret = "
".$lang_getusertorrentlistajax['col_type']."".$lang_getusertorrentlistajax['col_name']."
". ($showsize ? "" : "").($showsenum ? "" : "").($showlenum ? "" : "").($showuploaded ? "" : "") . ($showdownloaded ? "" : "").($showratio ? "" : "").($showsetime ? "" : "").($showletime ? "" : "").($showcotime ? "" : "").($showanonymous ? "" : "")."\n"; $total_size = 0; foreach ($results as $arr) @@ -158,6 +158,7 @@ function maketable($res, $mode = 'seeding') else $dissmall_descr == ""; $ret .= "\n" . ""; + $ret .= sprintf('', substr($arr['added'], 0, 10), substr($arr['added'], 11)); //size if ($showsize) $ret .= ""; @@ -210,7 +211,7 @@ switch ($type) case 'uploaded': { // $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__); - $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 FROM torrents LEFT JOIN categories ON torrents.category = categories.id WHERE torrents.owner=$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, torrents.added FROM torrents LEFT JOIN categories ON torrents.category = categories.id WHERE torrents.owner=$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) { @@ -233,7 +234,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, 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(); + $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, torrents.added 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' ); @@ -244,7 +245,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, 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(); + $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, torrents.added,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) { @@ -256,7 +257,7 @@ switch ($type) // Incomplete torrents case 'incomplete': { - $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(); + $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, torrents.added,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) { @@ -273,7 +274,7 @@ switch ($type) } if (isset($total_size) && $total_size){ - echo "
" . $count . "" . $lang_getusertorrentlistajax ['text_record'] . add_s ( $count ) . $lang_getusertorrentlistajax['text_total_size'] . mksize($total_size) . "

" . $torrentlist; + echo "
" . $count . "" . $lang_getusertorrentlistajax['text_record'] . add_s ( $count ) . $lang_getusertorrentlistajax['text_total_size'] . mksize($total_size) . "

" . $torrentlist; } elseif ($count){ echo "
".$count."".$lang_getusertorrentlistajax['text_record'].add_s($count)."

".$torrentlist; } else { diff --git a/public/index.php b/public/index.php index 174f8a1a..0156c1a2 100644 --- a/public/index.php +++ b/public/index.php @@ -174,7 +174,7 @@ if ($showlastxforumposts_main == "yes" && $CURUSER) // ------------- start: latest torrents ------------------// if ($showlastxtorrents_main == "yes") { - $result = sql_query("SELECT id,name,leechers,seeders FROM torrents where visible='yes' ORDER BY id DESC LIMIT 5") or sqlerr(__FILE__, __LINE__); + $result = sql_query("SELECT id,name,small_descr,leechers,seeders FROM torrents where visible='yes' ORDER BY id DESC LIMIT 5") or sqlerr(__FILE__, __LINE__); if(mysql_num_rows($result) != 0 ) { print ("

".$lang_index['text_last_five_torrent']."

"); @@ -182,7 +182,7 @@ if ($showlastxtorrents_main == "yes") { while( $row = mysql_fetch_assoc($result) ) { - print (""); + print (""); } print ("
".$lang_getusertorrentlistajax['col_type']."".$lang_getusertorrentlistajax['col_name']."  ".$lang_getusertorrentlistajax['col_added']."  \"size\"\"seeders\"\"leechers\"".$lang_getusertorrentlistajax['col_uploaded']."".$lang_getusertorrentlistajax['col_downloaded']."".$lang_getusertorrentlistajax['col_ratio']."".$lang_getusertorrentlistajax['col_se_time']."".$lang_getusertorrentlistajax['col_le_time']."".$lang_getusertorrentlistajax['col_time_completed']."".$lang_getusertorrentlistajax['col_anonymous']."
".return_category_image($arr['category'], "torrents.php?allsec=1&")."" . $dispname . "". $banned_torrent . $sp_torrent . $hrImg . $approvalStatusIcon .($dissmall_descr == "" ? "" : "
" . $dissmall_descr) . "
%s
%s
". mksize_compact($arr['size'])."
" . htmlspecialchars($row['name']) . "" . $row['seeders'] . "" . $row['leechers'] . "
" . htmlspecialchars($row['name']) . "
" . htmlspecialchars($row['small_descr']) ."
" . $row['seeders'] . "" . $row['leechers'] . "
"); } diff --git a/resources/lang/en/admin.php b/resources/lang/en/admin.php index 87cd0915..2350deee 100644 --- a/resources/lang/en/admin.php +++ b/resources/lang/en/admin.php @@ -13,6 +13,7 @@ return [ 'settings' => 'Settings', 'users_medals' => 'User medals', 'claims' => 'User claims', + 'torrent_list' => 'Torrents', ], 'resources' => [ 'agent_allow' => [ @@ -64,5 +65,11 @@ return [ 'bulk_action_pardon' => 'Bulk pardon', 'action_pardon' => 'Pardon', ], + 'torrent' => [ + 'bulk_action_pos_state' => 'Sticky', + 'bulk_action_remove_tag' => 'Remove tag', + 'bulk_action_attach_tag' => 'Attach tag', + 'action_approval' => 'Approval', + ], ] ]; diff --git a/resources/lang/en/label.php b/resources/lang/en/label.php index 2d90a988..b079b7c5 100644 --- a/resources/lang/en/label.php +++ b/resources/lang/en/label.php @@ -111,11 +111,19 @@ return [ 'label' => 'Torrent', 'size' => 'Size', 'ttl' => 'TTL', + 'seeders' => 'Seeders', + 'leechers' => 'Leechers', + 'times_completed' => 'Complete', + 'category' => 'Category', + 'approval_status' => 'Approval status', + 'pos_state' => 'Pos state', + 'sp_state' => 'Promotion', ], 'hit_and_run' => [ ], 'tag' => [ + 'label' => 'Tag', 'color' => 'Background color', 'font_color' => 'Font color', 'font_size' => 'Font size', diff --git a/resources/lang/en/torrent.php b/resources/lang/en/torrent.php index 86359f17..05af92b8 100644 --- a/resources/lang/en/torrent.php +++ b/resources/lang/en/torrent.php @@ -69,8 +69,8 @@ return [ 'comment_label' => 'Comment(optional)', 'status_text' => [ \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', + \App\Models\Torrent::APPROVAL_STATUS_ALLOW => 'Approved', + \App\Models\Torrent::APPROVAL_STATUS_DENY => 'Not approved', ], 'deny_comment_show' => 'Denied, reason: :reason', ], diff --git a/resources/lang/zh_CN/admin.php b/resources/lang/zh_CN/admin.php index bb71a1ae..c238d925 100644 --- a/resources/lang/zh_CN/admin.php +++ b/resources/lang/zh_CN/admin.php @@ -13,6 +13,7 @@ return [ 'settings' => '设置', 'users_medals' => '用户勋章', 'claims' => '用户认领', + 'torrent_list' => '种子', ], 'resources' => [ 'agent_allow' => [ @@ -64,5 +65,11 @@ return [ 'bulk_action_pardon' => '批量免罪', 'action_pardon' => '免罪', ], + 'torrent' => [ + 'bulk_action_pos_state' => '置顶', + 'bulk_action_remove_tag' => '清除标签', + 'bulk_action_attach_tag' => '设置标签', + 'action_approval' => '审核', + ], ] ]; diff --git a/resources/lang/zh_CN/label.php b/resources/lang/zh_CN/label.php index dff65135..d30b2feb 100644 --- a/resources/lang/zh_CN/label.php +++ b/resources/lang/zh_CN/label.php @@ -108,13 +108,21 @@ return [ ], 'torrent' => [ 'label' => '种子', - 'size' => '体积', + 'size' => '大小', 'ttl' => '存活时间', + 'seeders' => '做种', + 'leechers' => '下载', + 'times_completed' => '完成次数', + 'category' => '类型', + 'approval_status' => '审核状态', + 'pos_state' => '置顶', + 'sp_state' => '优惠', ], 'hit_and_run' => [ ], 'tag' => [ + 'label' => '标签', 'color' => '背景颜色', 'font_color' => '字体颜色', 'font_size' => '字体大小', diff --git a/resources/lang/zh_TW/admin.php b/resources/lang/zh_TW/admin.php index 7b6b2032..09512e19 100644 --- a/resources/lang/zh_TW/admin.php +++ b/resources/lang/zh_TW/admin.php @@ -13,6 +13,7 @@ return [ 'settings' => '設置', 'users_medals' => '用戶勛章', 'claims' => '用戶認領', + 'torrent_list' => '種子', ], 'resources' => [ 'agent_allow' => [ @@ -64,5 +65,11 @@ return [ 'bulk_action_pardon' => '批量免罪', 'action_pardon' => '免罪', ], + 'torrent' => [ + 'bulk_action_pos_state' => '置頂', + 'bulk_action_remove_tag' => '清除標簽', + 'bulk_action_attach_tag' => '設置標簽', + 'action_approval' => '審核', + ], ] ]; diff --git a/resources/lang/zh_TW/label.php b/resources/lang/zh_TW/label.php index 785ce460..b4dbb30d 100644 --- a/resources/lang/zh_TW/label.php +++ b/resources/lang/zh_TW/label.php @@ -109,13 +109,21 @@ return [ ], 'torrent' => [ 'label' => '種子', - 'size' => '體積', + 'size' => '大小', 'ttl' => '存活時間', + 'seeders' => '做种', + 'leechers' => '下载', + 'times_completed' => '完成次數', + 'category' => '類型', + 'approval_status' => '審核狀態', + 'pos_state' => '置頂', + 'sp_state' => '優惠', ], 'hit_and_run' => [ ], 'tag' => [ + 'label' => '標簽', 'color' => '背景顏色', 'font_color' => '字體顏色', 'font_size' => '字體大小',