diff --git a/app/Filament/Resources/Section/SectionResource.php b/app/Filament/Resources/Section/SectionResource.php index c61d5251..232cc93f 100644 --- a/app/Filament/Resources/Section/SectionResource.php +++ b/app/Filament/Resources/Section/SectionResource.php @@ -2,8 +2,8 @@ namespace App\Filament\Resources\Section; -use App\Filament\Resources\System\SectionResource\Pages; -use App\Filament\Resources\System\SectionResource\RelationManagers; +use App\Filament\Resources\Section\SectionResource\Pages; +use App\Filament\Resources\Section\SectionResource\RelationManagers; use App\Http\Middleware\Locale; use App\Models\Forum; use App\Models\SearchBox; diff --git a/app/Filament/Resources/Section/SectionResource/Pages/CreateSection.php b/app/Filament/Resources/Section/SectionResource/Pages/CreateSection.php index 73067690..0b726904 100644 --- a/app/Filament/Resources/Section/SectionResource/Pages/CreateSection.php +++ b/app/Filament/Resources/Section/SectionResource/Pages/CreateSection.php @@ -1,6 +1,6 @@ record = $examRep->store($data); - $this->notify('success', $this->getCreatedNotificationMessage()); + $this->notify('success', $this->getCreatedNotificationTitle()); if ($another) { // Ensure that the form record is anonymized so that relationships aren't loaded. $this->form->model($this->record::class); diff --git a/app/Filament/Resources/System/SeedBoxRecordResource/Pages/CreateSeedBoxRecord.php b/app/Filament/Resources/System/SeedBoxRecordResource/Pages/CreateSeedBoxRecord.php index 6356e6b0..f3fcf7e1 100644 --- a/app/Filament/Resources/System/SeedBoxRecordResource/Pages/CreateSeedBoxRecord.php +++ b/app/Filament/Resources/System/SeedBoxRecordResource/Pages/CreateSeedBoxRecord.php @@ -22,7 +22,7 @@ class CreateSeedBoxRecord extends CreateRecord $rep = new SeedBoxRepository(); try { $this->record = $rep->store($data); - $this->notify('success', $this->getCreatedNotificationMessage()); + $this->notify('success', $this->getCreatedNotificationTitle()); if ($another) { // Ensure that the form record is anonymized so that relationships aren't loaded. $this->form->model($this->record::class); diff --git a/app/Filament/Resources/Torrent/TagResource.php b/app/Filament/Resources/Torrent/TagResource.php index c1403150..cdd9728e 100644 --- a/app/Filament/Resources/Torrent/TagResource.php +++ b/app/Filament/Resources/Torrent/TagResource.php @@ -4,6 +4,7 @@ namespace App\Filament\Resources\Torrent; use App\Filament\Resources\Torrent\TagResource\Pages; use App\Filament\Resources\Torrent\TagResource\RelationManagers; +use App\Models\SearchBox; use App\Models\Tag; use Filament\Forms; use Filament\Resources\Form; @@ -45,6 +46,11 @@ class TagResource extends Resource 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('priority')->integer()->required()->label(__('label.priority'))->default(0), + Forms\Components\Select::make('mode') + ->options(SearchBox::query()->pluck('name', 'id')->toArray()) + ->label(__('label.search_box.taxonomy.mode')) + ->helperText(__('label.search_box.taxonomy.mode_help')) + , ]); } @@ -53,6 +59,10 @@ class TagResource extends Resource return $table ->columns([ Tables\Columns\TextColumn::make('id'), + Tables\Columns\TextColumn::make('search_box.name') + ->label(__('label.search_box.label')) + ->formatStateUsing(fn ($record) => $record->search_box->name ?? 'All') + , Tables\Columns\TextColumn::make('name')->label(__('label.name'))->searchable(), Tables\Columns\TextColumn::make('color')->label(__('label.tag.color')), Tables\Columns\TextColumn::make('font_color')->label(__('label.tag.font_color')), @@ -66,7 +76,17 @@ class TagResource extends Resource ]) ->defaultSort('priority', 'desc') ->filters([ - // + Tables\Filters\SelectFilter::make('mode') + ->options(SearchBox::query()->pluck('name', 'id')->toArray()) + ->label(__('label.search_box.taxonomy.mode')) + ->query(function (Builder $query, array $data) { + return $query->when($data['value'], function (Builder $query, $value) { + return $query->where(function (Builder $query) use ($value) { + return $query->where('mode', $value)->orWhere('mode', 0); + }); + }); + }) + , ]) ->actions(self::getActions()) ->bulkActions([ diff --git a/app/Filament/Resources/User/UserResource/Pages/CreateUser.php b/app/Filament/Resources/User/UserResource/Pages/CreateUser.php index 6b0e193a..aa5a42da 100644 --- a/app/Filament/Resources/User/UserResource/Pages/CreateUser.php +++ b/app/Filament/Resources/User/UserResource/Pages/CreateUser.php @@ -20,7 +20,7 @@ class CreateUser extends CreateRecord $this->record = $userRep->store($data); $this->notify( 'success ', - $this->getCreatedNotificationMessage(), + $this->getCreatedNotificationTitle(), ); $this->redirect($this->getRedirectUrl()); } catch (\Exception $exception) { diff --git a/app/Http/Controllers/AuthenticateController.php b/app/Http/Controllers/AuthenticateController.php index 2b924fb1..5e8e4400 100644 --- a/app/Http/Controllers/AuthenticateController.php +++ b/app/Http/Controllers/AuthenticateController.php @@ -51,7 +51,12 @@ class AuthenticateController extends Controller $user = User::query()->where('passkey', $passkey)->first(['id', 'passhash']); if ($user) { $ip = getip(); - $passhash = md5($user->passhash . $ip); + /** + * Not IP related + * @since 1.8.0 + */ +// $passhash = md5($user->passhash . $ip); + $passhash = md5($user->passhash); do_log(sprintf('passhash: %s, ip: %s, md5: %s', $user->passhash, $ip, $passhash)); logincookie($user->id, $passhash,false, 0x7fffffff, true, true, true); $user->last_login = now(); diff --git a/app/Models/AudioCodec.php b/app/Models/AudioCodec.php index ebc42420..7f883c18 100644 --- a/app/Models/AudioCodec.php +++ b/app/Models/AudioCodec.php @@ -7,7 +7,7 @@ class AudioCodec extends NexusModel { protected $table = 'audiocodecs'; - protected $fillable = ['name', 'sort_index']; + protected $fillable = ['name', 'sort_index', 'mode',]; public static function getLabelName() { diff --git a/app/Models/Codec.php b/app/Models/Codec.php index b0e04f2b..39246da1 100644 --- a/app/Models/Codec.php +++ b/app/Models/Codec.php @@ -7,7 +7,7 @@ class Codec extends NexusModel { protected $table = 'codecs'; - protected $fillable = ['name', 'sort_index']; + protected $fillable = ['name', 'sort_index', 'mode',]; public static function getLabelName() { diff --git a/app/Models/Media.php b/app/Models/Media.php index f20f74c9..a85f63fd 100644 --- a/app/Models/Media.php +++ b/app/Models/Media.php @@ -7,7 +7,7 @@ class Media extends NexusModel { protected $table = 'media'; - protected $fillable = ['name', 'sort_index']; + protected $fillable = ['name', 'sort_index', 'mode',]; public static function getLabelName() { diff --git a/app/Models/Processing.php b/app/Models/Processing.php index 578d7983..e02c1579 100644 --- a/app/Models/Processing.php +++ b/app/Models/Processing.php @@ -7,7 +7,7 @@ class Processing extends NexusModel { protected $table = 'processings'; - protected $fillable = ['name', 'sort_index']; + protected $fillable = ['name', 'sort_index', 'mode',]; public static function getLabelName() { diff --git a/app/Models/Source.php b/app/Models/Source.php index edbbe661..52ffb8c1 100644 --- a/app/Models/Source.php +++ b/app/Models/Source.php @@ -5,7 +5,7 @@ namespace App\Models; class Source extends NexusModel { - protected $fillable = ['name', 'sort_index']; + protected $fillable = ['name', 'sort_index', 'mode',]; public static function getLabelName() { diff --git a/app/Models/Standard.php b/app/Models/Standard.php index 6c7b12b3..45ec25fc 100644 --- a/app/Models/Standard.php +++ b/app/Models/Standard.php @@ -5,7 +5,7 @@ namespace App\Models; class Standard extends NexusModel { - protected $fillable = ['name', 'sort_index']; + protected $fillable = ['name', 'sort_index', 'mode',]; public static function getLabelName() { diff --git a/app/Models/Tag.php b/app/Models/Tag.php index 03858aec..b8acbabf 100644 --- a/app/Models/Tag.php +++ b/app/Models/Tag.php @@ -7,7 +7,9 @@ class Tag extends NexusModel public $timestamps = true; protected $fillable = [ - 'id', 'name', 'color', 'priority', 'created_at', 'updated_at', 'font_size', 'font_color', 'padding', 'margin', 'border_radius' + 'id', 'name', 'color', 'priority', 'created_at', 'updated_at', + 'font_size', 'font_color', 'padding', 'margin', 'border_radius', + 'mode', ]; const DEFAULTS = [ @@ -66,6 +68,11 @@ class Tag extends NexusModel return $this->hasMany(TorrentTag::class, 'tag_id'); } + public function search_box(): \Illuminate\Database\Eloquent\Relations\BelongsTo + { + return $this->belongsTo(SearchBox::class, 'mode', 'id'); + } + } diff --git a/app/Models/Team.php b/app/Models/Team.php index 3f1235fb..a2fd9d0e 100644 --- a/app/Models/Team.php +++ b/app/Models/Team.php @@ -5,7 +5,7 @@ namespace App\Models; class Team extends NexusModel { - protected $fillable = ['name', 'sort_index']; + protected $fillable = ['name', 'sort_index', 'mode',]; public static function getLabelName() { diff --git a/app/Repositories/TagRepository.php b/app/Repositories/TagRepository.php index ab107dd0..4af421ee 100644 --- a/app/Repositories/TagRepository.php +++ b/app/Repositories/TagRepository.php @@ -50,27 +50,27 @@ class TagRepository extends BaseRepository return Tag::query()->orderBy('priority', 'desc')->orderBy('id', 'desc'); } - public function renderCheckbox(array $checked = [], $ignorePermission = false): string + public function renderCheckbox(int $searchBoxId, array $checked = [], $ignorePermission = false): string { $html = ''; - $results = $this->listAll(); + $results = $this->listAll($searchBoxId); if (!$ignorePermission && !user_can('torrent-set-special-tag')) { $specialTags = Tag::listSpecial(); $results = $results->filter(fn ($item) => !in_array($item->id, $specialTags)); } foreach ($results as $value) { $html .= sprintf( - '%s', - $value->id, in_array($value->id, $checked) ? ' checked' : '', $value->name + '%s', + $searchBoxId, $value->id, in_array($value->id, $checked) ? ' checked' : '', $value->name ); } return $html; } - public function renderSpan(array $renderIdArr = [], $withFilterLink = false): string + public function renderSpan(int $searchBoxId, array $renderIdArr = [], $withFilterLink = false): string { $html = ''; - foreach ($this->listAll() as $value) { + foreach ($this->listAll($searchBoxId) as $value) { if (in_array($value->id, $renderIdArr) || (isset($renderIdArr[0]) && $renderIdArr[0] == '*')) { $tagId = $value->id; if ($value) { @@ -149,17 +149,20 @@ class TagRepository extends BaseRepository return self::$orderByFieldIdString; } - public function listAll() + public function listAll(int $searchBoxId = 0): \Illuminate\Database\Eloquent\Collection|array { if (empty(self::$allTags)) { self::$allTags = self::createBasicQuery()->get(); } + if ($searchBoxId > 0) { + return self::$allTags->filter(fn ($d) => in_array($d->mode, [0, $searchBoxId])); + } return self::$allTags; } - public function buildSelect($name, $value): string + public function buildSelect(int $searchBoxId, $name, $value): string { - $list = $this->listAll(); + $list = $this->listAll($searchBoxId); $select = sprintf('%s', $name, nexus_trans('nexus.select_one_please')); foreach ($list as $item) { $selected = ''; diff --git a/database/migrations/2022_10_30_024325_add_mode_to_tags_table.php b/database/migrations/2022_10_30_024325_add_mode_to_tags_table.php new file mode 100644 index 00000000..8d8afcb2 --- /dev/null +++ b/database/migrations/2022_10_30_024325_add_mode_to_tags_table.php @@ -0,0 +1,35 @@ +integer('mode')->default(0); + }); + } + + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('tags', function (Blueprint $table) { + $table->dropColumn(['mode']); + }); + } +}; diff --git a/include/functions.php b/include/functions.php index 7ebf799e..8141b0c0 100644 --- a/include/functions.php +++ b/include/functions.php @@ -1985,7 +1985,12 @@ function userlogin() { if ($_COOKIE["c_secure_login"] == base64("yeah")) { - $md5 = md5($row["passhash"].$ip); + /** + * Not IP related + * @since 1.8.0 + */ +// $md5 = md5($row["passhash"].$ip); + $md5 = md5($row["passhash"]); $log .= ", secure login == yeah, passhash: {$row['passhash']}, ip: $ip, md5: $md5"; if ($_COOKIE["c_secure_pass"] != $md5) { do_log("$log, c_secure_pass != md5"); @@ -3619,7 +3624,7 @@ foreach ($rows as $row) */ $tagOwns = $torrentTagResult->get($id); if ($tagOwns) { - $tags = $tagRep->renderSpan($tagOwns->pluck('tag_id')->toArray()); + $tags = $tagRep->renderSpan($row['search_box_id'], $tagOwns->pluck('tag_id')->toArray()); } else { $tags = ''; } @@ -6025,7 +6030,6 @@ function build_search_box_category_table($mode, $checkboxValue, $categoryHrefPre //Category $html .= sprintf('%s', nexus_trans('label.search_box.category')); $categoryChunks = $searchBox->categories->chunk($searchBox->catsperrow); - $lang = get_langfolder_cookie(); foreach ($categoryChunks as $chunk) { $html .= ''; foreach ($chunk as $item) { diff --git a/lang/chs/lang_userdetails.php b/lang/chs/lang_userdetails.php index 4546c3a2..a8578a4d 100644 --- a/lang/chs/lang_userdetails.php +++ b/lang/chs/lang_userdetails.php @@ -150,7 +150,7 @@ $lang_userdetails = array 'row_medal' => '勋章', 'row_donoruntil' => '捐赠状态截止时间', 'text_donoruntil_note' => "时间格式为'年年年年-月月-日日 时时:分分:秒秒'。留空永久有效。", - 'change_field_value_migrated' => '修改请到管理后台操作', + 'change_field_value_migrated' => '修改请到%s操作', 'sure_to_remove_leech_warn' => '确定要清除此吸血警告吗?', 'row_user_props' => '道具', 'meta_key_change_username_username' => '新用户名', diff --git a/lang/cht/lang_userdetails.php b/lang/cht/lang_userdetails.php index 4a3c0a98..6551ab5a 100644 --- a/lang/cht/lang_userdetails.php +++ b/lang/cht/lang_userdetails.php @@ -150,7 +150,7 @@ $lang_userdetails = array 'row_medal' => '勛章', 'row_donoruntil' => '捐贈狀態截止時間', 'text_donoruntil_note' => "時間格式為'年年年年-月月-日日 時時:分分:秒秒'。留空永久有效。", - 'change_field_value_migrated' => '修改請到管理後臺操作', + 'change_field_value_migrated' => '修改請到%s操作', 'sure_to_remove_leech_warn' => '確定要清除此吸血警告嗎?', 'row_user_props' => '道具', 'meta_key_change_username_username' => '新用戶名', diff --git a/lang/en/lang_userdetails.php b/lang/en/lang_userdetails.php index 6be9dc95..f6d02109 100644 --- a/lang/en/lang_userdetails.php +++ b/lang/en/lang_userdetails.php @@ -150,7 +150,7 @@ $lang_userdetails = array 'row_medal' => 'Medal', 'row_donoruntil' => 'Donated until', 'text_donoruntil_note' => "Time format is YYYY-MM-DD hh:mm:ss. Leave blank permanently.", - 'change_field_value_migrated' => 'Modification please go to the background management system.', + 'change_field_value_migrated' => 'Modification please go to the %s.', 'sure_to_remove_leech_warn' => 'Are you sure to remove this leech warn ?', 'row_user_props' => 'Props', 'meta_key_change_username_username' => 'New username', diff --git a/nexus/Install/Install.php b/nexus/Install/Install.php index 4f9f0bbc..1f09ae5d 100644 --- a/nexus/Install/Install.php +++ b/nexus/Install/Install.php @@ -132,7 +132,10 @@ class Install $filename = basename($path); $count = preg_match('/create_(.*)_table.php/', $filename, $matches); if ($count) { - $tables[$matches[1]] = "database/migrations/$filename"; + $tableName = $matches[1]; + //Special treatment + $tableName = str_replace("seedbox_records", "seed_box_records", $tableName); + $tables[$tableName] = "database/migrations/$filename"; } } return $tables; @@ -535,7 +538,6 @@ class Install public function listShouldCreateTable() { $existsTable = $this->listExistsTable(); -// $tableCreate = $this->listAllTableCreate(); $tableCreate = $this->listAllTableCreateFromMigrations(); $shouldCreateTable = []; foreach ($tableCreate as $table => $sql) { diff --git a/public/details.php b/public/details.php index 0a187868..5a0d4fbd 100644 --- a/public/details.php +++ b/public/details.php @@ -132,7 +132,7 @@ if (!$row) { $torrentTags = \App\Models\TorrentTag::query()->where('torrent_id', $row['id'])->get(); if ($torrentTags->isNotEmpty()) { $tagRep = new \App\Repositories\TagRepository(); - tr($lang_details['row_tags'], $tagRep->renderSpan($torrentTags->pluck('tag_id')->toArray()),true); + tr($lang_details['row_tags'], $tagRep->renderSpan($row['search_box_id'], $torrentTags->pluck('tag_id')->toArray()),true); } $size_info = "".$lang_details['text_size']."" . mksize($row["size"]); diff --git a/public/download.php b/public/download.php index 56b793f2..79c68699 100644 --- a/public/download.php +++ b/public/download.php @@ -123,7 +123,7 @@ if (strlen($CURUSER['passkey']) != 32) { $trackerReportAuthKey = $torrentRep->getTrackerReportAuthKey($id, $CURUSER['id'], true); $dict = \Rhilip\Bencode\Bencode::load($fn); $dict['announce'] = $ssl_torrent . $base_announce_url . "?authkey=$trackerReportAuthKey"; - +do_log(sprintf("[ANNOUNCE_URL], user: %s, torrent: %s, url: %s", $CURUSER['id'] ?? '', $id, $dict['announce'])); /** * does not support multi-tracker * diff --git a/public/edit.php b/public/edit.php index 0dc1c1f0..732ed8c9 100644 --- a/public/edit.php +++ b/public/edit.php @@ -18,7 +18,7 @@ if (!$row) die(); */ $customField = new \Nexus\Field\Field(); $hitAndRunRep = new \App\Repositories\HitAndRunRepository(); - +$tagRep = new \App\Repositories\TagRepository(); $tagIdArr = \App\Models\TorrentTag::query()->where('torrent_id', $id)->get()->pluck('tag_id')->toArray(); $searchBoxRep = new \App\Repositories\SearchBoxRepository(); if ($enablespecial == 'yes' && user_can('movetorrent')) @@ -154,16 +154,16 @@ else { tr($lang_edit['row_quality'], $sectionCurrent, 1, "mode_$sectionmode"); echo $customField->renderOnUploadPage($id, $sectionmode); echo $hitAndRunRep->renderOnUploadPage($row['hr'], $sectionmode); + tr($lang_functions['text_tags'], $tagRep->renderCheckbox($sectionmode, $tagIdArr), 1, "mode_$sectionmode"); if ($allowmove && $othermode) { $selectOther = $searchBoxRep->renderTaxonomySelect($othermode, $row); tr($lang_edit['row_quality'], $selectOther, 1, "mode_$othermode"); echo $customField->renderOnUploadPage($id, $othermode); echo $hitAndRunRep->renderOnUploadPage($row['hr'], $othermode); + tr($lang_functions['text_tags'], $tagRep->renderCheckbox($othermode, $tagIdArr), 1, "mode_$othermode"); } - tr($lang_functions['text_tags'], (new \App\Repositories\TagRepository())->renderCheckbox($tagIdArr), 1); - $rowChecks = []; if (user_can('beanonymous') || user_can('torrentmanage')) { $rowChecks[] = "".$lang_edit['checkbox_anonymous_note'].""; diff --git a/public/getrss.php b/public/getrss.php index 5a2cb87a..8c0c4889 100644 --- a/public/getrss.php +++ b/public/getrss.php @@ -302,9 +302,11 @@ $categories .= ""; $categories = build_search_box_category_table($browsecatmode, 'yes', 'torrents.php?allsec=1&', false, 3, '', ['section_name' => true]); print($categories); -print ''; -$categoriesSpecial = build_search_box_category_table($specialcatmode, 'yes', 'torrents.php?allsec=1&', false, 3, '', ['section_name' => true]); -print($categoriesSpecial); +if (get_setting('main.spsct') == 'yes') { + print ''; + $categoriesSpecial = build_search_box_category_table($specialcatmode, 'yes', 'torrents.php?allsec=1&', false, 3, '', ['section_name' => true]); + print($categoriesSpecial); +} ?> diff --git a/public/settings.php b/public/settings.php index 7cfdfaed..2ebb11b6 100644 --- a/public/settings.php +++ b/public/settings.php @@ -599,8 +599,8 @@ elseif ($action == 'bonussettings'){ tr($lang_settings['row_official_addition'],$lang_settings['text_user_would_get_by_official']."".$lang_settings['text_addition_addition_note'], 1); $tagRep = new \App\Repositories\TagRepository(); - tr($lang_settings['row_official_tag'], $tagRep->buildSelect('official_tag', $BONUS["official_tag"] ?? '') . $lang_settings['text_official_tag_note'], 1); - tr($lang_settings['row_zero_bonus_tag'], $tagRep->buildSelect('zero_bonus_tag', $BONUS["zero_bonus_tag"] ?? '') . $lang_settings['text_zero_bonus_tag_note'], 1); + tr($lang_settings['row_official_tag'], $tagRep->buildSelect(0,'official_tag', $BONUS["official_tag"] ?? '') . $lang_settings['text_official_tag_note'], 1); + tr($lang_settings['row_zero_bonus_tag'], $tagRep->buildSelect(0,'zero_bonus_tag', $BONUS["zero_bonus_tag"] ?? '') . $lang_settings['text_zero_bonus_tag_note'], 1); print("".$lang_settings['text_things_cost_bonus'].""); tr($lang_settings['row_one_gb_credit'],$lang_settings['text_it_costs_user']."".$lang_settings['text_one_gb_credit_note'], 1); diff --git a/public/takeedit.php b/public/takeedit.php index 51d59fde..b7d9aa63 100644 --- a/public/takeedit.php +++ b/public/takeedit.php @@ -236,7 +236,7 @@ if (!empty($_POST['custom_fields'][$newcatmode])) { * * @since v1.6 */ -$tagIdArr = array_filter($_POST['tags'] ?? []); +$tagIdArr = array_filter($_POST['tags'][$newcatmode] ?? []); insert_torrent_tags($id, $tagIdArr, true); if($CURUSER["id"] == $row["owner"]) diff --git a/public/takelogin.php b/public/takelogin.php index a416d7a4..711352b0 100644 --- a/public/takelogin.php +++ b/public/takelogin.php @@ -43,7 +43,12 @@ if ($row["enabled"] == "no") if (isset($_POST["securelogin"]) && $_POST["securelogin"] == "yes") { $securelogin_indentity_cookie = true; - $passh = md5($row["passhash"].$ip); + /** + * Not IP related + * @since 1.8.0 + */ +// $passh = md5($row["passhash"].$ip); + $passh = md5($row["passhash"]); $log .= ", secure login == yeah, passhash: {$row['passhash']}, ip: $ip, md5: $passh"; } else diff --git a/public/takeupload.php b/public/takeupload.php index 31587e37..ed6750ff 100644 --- a/public/takeupload.php +++ b/public/takeupload.php @@ -407,7 +407,7 @@ if (!empty($_POST['custom_fields'][$catmod])) { * * @since v1.6 */ -$tagIdArr = array_filter($_POST['tags'] ?? []); +$tagIdArr = array_filter($_POST['tags'][$catmod] ?? []); if (!empty($tagIdArr)) { insert_torrent_tags($id, $tagIdArr); } diff --git a/public/torrents.php b/public/torrents.php index 7d40f73c..0f9f2f71 100644 --- a/public/torrents.php +++ b/public/torrents.php @@ -5,14 +5,6 @@ require_once(get_langfile_path('torrents.php')); require_once(get_langfile_path('speical.php')); loggedinorreturn(); parked(); - -/** - * tags - */ -$tagRep = new \App\Repositories\TagRepository(); -$allTags = $tagRep->listAll(); -$elasticsearchEnabled = nexus_env('ELASTICSEARCH_ENABLED'); - //check searchbox switch (nexus()->getScript()) { case 'torrents': @@ -30,6 +22,13 @@ switch (nexus()->getScript()) { default: $sectiontype = 0; } +/** + * tags + */ +$tagRep = new \App\Repositories\TagRepository(); +$allTags = $tagRep->listAll($sectiontype); +$elasticsearchEnabled = nexus_env('ELASTICSEARCH_ENABLED'); + $showsubcat = get_searchbox_value($sectiontype, 'showsubcat');//whether show subcategory (i.e. sources, codecs) or not $showsource = get_searchbox_value($sectiontype, 'showsource'); //whether show sources or not $showmedium = get_searchbox_value($sectiontype, 'showmedium'); //whether show media or not @@ -1143,7 +1142,7 @@ if (!$Cache->get_page()){ echo $Cache->next_row(); if ($allTags->isNotEmpty()) { - echo '' . $tagRep->renderSpan(['*'], true) . ''; + echo '' . $tagRep->renderSpan($sectiontype, ['*'], true) . ''; } ?> diff --git a/public/upload.php b/public/upload.php index b3e1d6b1..52efb6a9 100644 --- a/public/upload.php +++ b/public/upload.php @@ -41,6 +41,7 @@ $showaudiocodec = (($allowtorrents && get_searchbox_value($brsectiontype, 'showa $settingMain = get_setting('main'); $torrentRep = new \App\Repositories\TorrentRepository(); $searchBoxRep = new \App\Repositories\SearchBoxRepository(); +$tagRep = new \App\Repositories\TagRepository(); stdhead($lang_upload['head_upload']); ?> @@ -158,12 +159,14 @@ stdhead($lang_upload['head_upload']); tr($lang_upload['row_quality'], $selectNormal, 1, "mode_$browsecatmode"); echo $customField->renderOnUploadPage(0, $browsecatmode); echo $hitAndRunRep->renderOnUploadPage('', $browsecatmode); + tr($lang_functions['text_tags'], $tagRep->renderCheckbox($browsecatmode), 1, "mode_$browsecatmode"); } if ($allowspecial) { $selectNormal = $searchBoxRep->renderTaxonomySelect($specialcatmode); tr($lang_upload['row_quality'], $selectNormal, 1, "mode_$specialcatmode"); echo $customField->renderOnUploadPage(0, $specialcatmode); echo $hitAndRunRep->renderOnUploadPage('', $specialcatmode); + tr($lang_functions['text_tags'], $tagRep->renderCheckbox($specialcatmode), 1, "mode_$specialcatmode"); } //==== offer dropdown for offer mod from code by S4NE @@ -229,7 +232,6 @@ JS; { tr($lang_upload['row_show_uploader'], "".$lang_upload['checkbox_hide_uploader_note'], 1); } - tr($lang_functions['text_tags'], (new \App\Repositories\TagRepository())->renderCheckbox(), 1); ?> diff --git a/public/usercp.php b/public/usercp.php index 20108771..cb6278f3 100644 --- a/public/usercp.php +++ b/public/usercp.php @@ -542,9 +542,11 @@ if ($showaudiocodec) $audiocodecs = searchbox_item_list("audiocodecs"); */ $categories = build_search_box_category_table($browsecatmode, 'yes','torrents.php?allsec=1', false, 3, $CURUSER['notifs'], ['section_name' => true]); $delimiter = ''; - $categoriesSpecial = build_search_box_category_table($specialcatmode, 'yes','torrents.php?allsec=1', false, 3, $CURUSER['notifs'], ['section_name' => true]); - $extra = "{$lang_usercp['text_additional_selection']}".$lang_usercp['text_show_dead_active']."".$lang_usercp['select_including_dead']."".$lang_usercp['select_active']."".$lang_usercp['select_dead']."".$lang_usercp['text_show_special_torrents']."".$lang_usercp['select_all']."".promotion_selection($special_state)."".$lang_usercp['text_show_bookmarked']."".$lang_usercp['select_all']."".$lang_usercp['select_bookmarked']."".$lang_usercp['select_bookmarked_exclude'].""; - tr_small($lang_usercp['row_browse_default_categories'],$categories . $delimiter . $categoriesSpecial . $delimiter . $extra,1); + if (get_setting('main.spsct') == 'yes') { + $categories .= $delimiter . build_search_box_category_table($specialcatmode, 'yes','torrents.php?allsec=1', false, 3, $CURUSER['notifs'], ['section_name' => true]); + } + $categories .= $delimiter . "{$lang_usercp['text_additional_selection']}".$lang_usercp['text_show_dead_active']."".$lang_usercp['select_including_dead']."".$lang_usercp['select_active']."".$lang_usercp['select_dead']."".$lang_usercp['text_show_special_torrents']."".$lang_usercp['select_all']."".promotion_selection($special_state)."".$lang_usercp['text_show_bookmarked']."".$lang_usercp['select_all']."".$lang_usercp['select_bookmarked']."".$lang_usercp['select_bookmarked_exclude'].""; + tr_small($lang_usercp['row_browse_default_categories'], $categories,1); $ss_r = sql_query("SELECT * FROM stylesheets") or die; $ss_sa = array(); while ($ss_a = mysql_fetch_array($ss_r)) diff --git a/public/userdetails.php b/public/userdetails.php index f5900081..31f94663 100644 --- a/public/userdetails.php +++ b/public/userdetails.php @@ -120,6 +120,12 @@ if ($CURUSER['id'] == $user['id'] || user_can('cruprfmanage')) ?> %s', $userManageSystemUrl, $lang_functions['text_management_system']); +if (user_can('prfmanage') && $user["class"] < get_user_class()) { + $userIdDisplay .= " [$userManageSystemText]"; +} if (($user["privacy"] != "strong") OR (user_can('prfmanage')) || $CURUSER['id'] == $user['id']){ //Xia Zuojie: Taste compatibility is extremely slow. It can takes thounsands of datebase queries. It is disabled until someone makes it fast. /* @@ -188,7 +194,7 @@ if (($user["privacy"] != "strong") OR (user_can('prfmanage')) || $CURUSER['id'] print("".$lang_userdetails['row_compatibility']."". $compatibility_info ."\n"); } */ - tr_small($lang_userdetails['text_user_id'], $user['id'], 1); + tr_small($lang_userdetails['text_user_id'], $userIdDisplay, 1); if ($CURUSER['id'] == $user['id'] || user_can('viewinvite')){ if ($user["invites"] <= 0) tr_small($lang_userdetails['row_invitation'], $lang_userdetails['text_no_invitation'], 1); @@ -600,15 +606,11 @@ JS; if (user_can('cruprfmanage')) { -// tr($lang_userdetails['row_amount_uploaded'], "".$lang_userdetails['change_field_value_migrated'], 1); -// tr($lang_userdetails['row_amount_downloaded'], "".$lang_userdetails['change_field_value_migrated'], 1); -// tr($lang_userdetails['row_seeding_karma'], "".$lang_userdetails['change_field_value_migrated'], 1); -// tr($lang_userdetails['row_invites'], "".$lang_userdetails['change_field_value_migrated'], 1); - - tr($lang_userdetails['row_amount_uploaded'], "", 1); - tr($lang_userdetails['row_amount_downloaded'], "", 1); - tr($lang_userdetails['row_seeding_karma'], "", 1); - tr($lang_userdetails['row_invites'], "", 1); + $migratedHelp = sprintf($lang_userdetails['change_field_value_migrated'], $userManageSystemText); + tr($lang_userdetails['row_amount_uploaded'], "".$migratedHelp, 1); + tr($lang_userdetails['row_amount_downloaded'], "".$migratedHelp, 1); + tr($lang_userdetails['row_seeding_karma'], "".$migratedHelp, 1); + tr($lang_userdetails['row_invites'], "".$migratedHelp, 1); } tr($lang_userdetails['row_passkey'], "".$lang_userdetails['checkbox_reset_passkey'], 1); diff --git a/resources/lang/en/label.php b/resources/lang/en/label.php index 53b4ae32..e192bfd4 100644 --- a/resources/lang/en/label.php +++ b/resources/lang/en/label.php @@ -264,7 +264,7 @@ then it's label:<%artist.label%>,it's value:<%artist.value%>", 'image_help' => 'The name of image file. Allowed Characters: [a-z] (in lower case), [0-9], [_./].', 'icon_id' => 'Category icon pack', 'mode' => 'SearchBox', - 'mode_help' => 'Leave blank to indicate that it applies to all sections', + 'mode_help' => 'Leave blank to indicate that it applies to all SearchBox', ], ], 'icon' => [ diff --git a/resources/lang/zh_CN/label.php b/resources/lang/zh_CN/label.php index ddf4d0e8..5df353ff 100644 --- a/resources/lang/zh_CN/label.php +++ b/resources/lang/zh_CN/label.php @@ -271,8 +271,8 @@ return [ 'image' => '图片文件名', 'image_help' => '图片文件的名字。允许的字符:[a-z](小写),[0-9],[_./]。', 'icon_id' => '分类图标', - 'mode' => '分区', - 'mode_help' => '留空表示适用于全部分区', + 'mode' => '分类模式', + 'mode_help' => '留空表示适用于全部分类模式', ], ], 'icon' => [ diff --git a/resources/lang/zh_TW/label.php b/resources/lang/zh_TW/label.php index 3e7b97d9..6371cc60 100644 --- a/resources/lang/zh_TW/label.php +++ b/resources/lang/zh_TW/label.php @@ -261,8 +261,8 @@ return [ 'image' => '圖片文件名', 'image_help' => '圖片文件的名字。允許的字符:[a-z](小寫),[0-9],[_./]。', 'icon_id' => '分類圖標', - 'mode' => '分區', - 'mode_help' => '留空表示適用於全部分區', + 'mode' => '分類模式', + 'mode_help' => '留空表示適用於全部分類模式', ], ], 'icon' => [