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 = "
| ".$lang_getusertorrentlistajax['col_type']." | ".$lang_getusertorrentlistajax['col_name']." | ". + $ret = "
| ".$lang_getusertorrentlistajax['col_type']." | ".$lang_getusertorrentlistajax['col_name']." | ".$lang_getusertorrentlistajax['col_added']." | ". ($showsize ? "![]() | " : "").($showsenum ? "![]() | " : "").($showlenum ? "![]() | " : "").($showuploaded ? "".$lang_getusertorrentlistajax['col_uploaded']." | " : "") . ($showdownloaded ? "".$lang_getusertorrentlistajax['col_downloaded']." | " : "").($showratio ? "".$lang_getusertorrentlistajax['col_ratio']." | " : "").($showsetime ? "".$lang_getusertorrentlistajax['col_se_time']." | " : "").($showletime ? "".$lang_getusertorrentlistajax['col_le_time']." | " : "").($showcotime ? "".$lang_getusertorrentlistajax['col_time_completed']." | " : "").($showanonymous ? "".$lang_getusertorrentlistajax['col_anonymous']." | " : "")."
| ".return_category_image($arr['category'], "torrents.php?allsec=1&")." | \n" . "" . $dispname . "". $banned_torrent . $sp_torrent . $hrImg . $approvalStatusIcon .($dissmall_descr == "" ? "" : " " . $dissmall_descr) . " | ";
+ $ret .= sprintf('%s %s | ', substr($arr['added'], 0, 10), substr($arr['added'], 11));
//size
if ($showsize)
$ret .= "". mksize_compact($arr['size'])." | "; @@ -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 "|||||||||
| " . htmlspecialchars($row['name']) . " | " . $row['seeders'] . " | " . $row['leechers'] . " | ||||||||||
| " . htmlspecialchars($row['name']) . " " . htmlspecialchars($row['small_descr']) ." | " . $row['seeders'] . " | " . $row['leechers'] . " |