finish searchbox build + upload/edit form quality render

This commit is contained in:
xiaomlove
2022-09-14 19:05:29 +08:00
parent a7717b2ce8
commit c9c16bc5bd
22 changed files with 313 additions and 79 deletions
+2 -1
View File
@@ -87,7 +87,8 @@ class Test extends Command
*/ */
public function handle() public function handle()
{ {
$rep = new SearchBoxRepository();
$rep->migrateToModeRelated();
} }
@@ -45,7 +45,6 @@ class SectionResource extends Resource
{ {
return $form return $form
->schema([ ->schema([
Forms\Components\TextInput::make('section_name')->label(__('label.search_box.section_name'))->required(),
Forms\Components\TextInput::make('name')->label(__('label.search_box.name'))->rules('alpha_dash')->required(), Forms\Components\TextInput::make('name')->label(__('label.search_box.name'))->rules('alpha_dash')->required(),
Forms\Components\TextInput::make('catsperrow') Forms\Components\TextInput::make('catsperrow')
->label(__('label.search_box.catsperrow')) ->label(__('label.search_box.catsperrow'))
@@ -61,6 +60,10 @@ class SectionResource extends Resource
->required() ->required()
->default(3) ->default(3)
, ,
Forms\Components\TextInput::make('section_name')
->label(__('label.search_box.section_name'))
->helperText(__('label.search_box.section_name_help'))
,
Forms\Components\CheckboxList::make('custom_fields') Forms\Components\CheckboxList::make('custom_fields')
->options(TorrentCustomField::getCheckboxOptions()) ->options(TorrentCustomField::getCheckboxOptions())
->label(__('label.search_box.custom_fields')) ->label(__('label.search_box.custom_fields'))
@@ -109,8 +112,8 @@ class SectionResource extends Resource
return $table return $table
->columns([ ->columns([
Tables\Columns\TextColumn::make('id'), Tables\Columns\TextColumn::make('id'),
Tables\Columns\TextColumn::make('section_name')->label(__('label.search_box.section_name')),
Tables\Columns\TextColumn::make('name')->label(__('label.search_box.name')), Tables\Columns\TextColumn::make('name')->label(__('label.search_box.name')),
Tables\Columns\TextColumn::make('section_name')->label(__('label.search_box.section_name')),
Tables\Columns\BooleanColumn::make('is_default')->label(__('label.search_box.is_default')), Tables\Columns\BooleanColumn::make('is_default')->label(__('label.search_box.is_default')),
Tables\Columns\BooleanColumn::make('showsubcat')->label(__('label.search_box.showsubcat')), Tables\Columns\BooleanColumn::make('showsubcat')->label(__('label.search_box.showsubcat')),
Tables\Columns\BooleanColumn::make('showsource'), Tables\Columns\BooleanColumn::make('showsource'),
@@ -23,4 +23,9 @@ class EditSection extends EditRecord
return SearchBox::formatTaxonomyExtra($data); return SearchBox::formatTaxonomyExtra($data);
} }
protected function afterSave()
{
clear_search_box_cache($this->record->id);
}
} }
@@ -26,15 +26,16 @@ class CategoriesRelationManager extends RelationManager
{ {
return $form return $form
->schema([ ->schema([
Forms\Components\TextInput::make('name')->required()->label(__('label.search_box.taxonomy.name')), Forms\Components\TextInput::make('name')->required()->label(__('label.search_box.taxonomy.name'))->required(),
Forms\Components\TextInput::make('image') Forms\Components\TextInput::make('image')
->rule('alpha_dash')
->label(__('label.search_box.taxonomy.image')) ->label(__('label.search_box.taxonomy.image'))
->helperText(__('label.search_box.taxonomy.image_help')) ->helperText(__('label.search_box.taxonomy.image_help'))
->required()
, ,
Forms\Components\Select::make('icon_id') Forms\Components\Select::make('icon_id')
->options(Icon::query()->pluck('name', 'id')->toArray()) ->options(Icon::query()->pluck('name', 'id')->toArray())
->label(__('label.search_box.taxonomy.icon_id')) ->label(__('label.search_box.taxonomy.icon_id'))
->required()
, ,
Forms\Components\TextInput::make('class_name') Forms\Components\TextInput::make('class_name')
->label(__('label.search_box.taxonomy.class_name')) ->label(__('label.search_box.taxonomy.class_name'))
@@ -57,19 +58,27 @@ class CategoriesRelationManager extends RelationManager
Tables\Columns\TextColumn::make('icon.name')->label(__('label.search_box.taxonomy.icon_id')), Tables\Columns\TextColumn::make('icon.name')->label(__('label.search_box.taxonomy.icon_id')),
Tables\Columns\TextColumn::make('image')->label(__('label.search_box.taxonomy.image')), Tables\Columns\TextColumn::make('image')->label(__('label.search_box.taxonomy.image')),
Tables\Columns\TextColumn::make('class_name')->label(__('label.search_box.taxonomy.class_name')), Tables\Columns\TextColumn::make('class_name')->label(__('label.search_box.taxonomy.class_name')),
Tables\Columns\TextColumn::make('sort_index')->label(__('label.search_box.taxonomy.sort_index'))->sortable(),
]) ])
->defaultSort('sort_index')
->filters([ ->filters([
// //
]) ])
->headerActions([ ->headerActions([
Tables\Actions\CreateAction::make(), Tables\Actions\CreateAction::make()->after(function ($record) {
clear_search_box_cache($record->mode);
}),
]) ])
->actions([ ->actions([
Tables\Actions\EditAction::make(), Tables\Actions\EditAction::make()->after(function ($record) {
Tables\Actions\DeleteAction::make(), clear_search_box_cache($record->mode);
}),
Tables\Actions\DeleteAction::make()->after(function ($record) {
clear_search_box_cache($record->mode);
}),
]) ])
->bulkActions([ ->bulkActions([
Tables\Actions\DeleteBulkAction::make(),
]); ]);
} }
} }
@@ -13,7 +13,7 @@ use Illuminate\Database\Eloquent\SoftDeletingScope;
class TaxonomyAudioCodecsRelationManager extends TaxonomySourcesRelationManager class TaxonomyAudioCodecsRelationManager extends TaxonomySourcesRelationManager
{ {
protected static string $relationship = 'taxonomy_audio_codecs'; protected static string $relationship = 'taxonomy_audiocodec';
protected static ?string $recordTitleAttribute = 'name'; protected static ?string $recordTitleAttribute = 'name';
@@ -13,7 +13,7 @@ use Illuminate\Database\Eloquent\SoftDeletingScope;
class TaxonomyCodecsRelationManager extends TaxonomySourcesRelationManager class TaxonomyCodecsRelationManager extends TaxonomySourcesRelationManager
{ {
protected static string $relationship = 'taxonomy_codecs'; protected static string $relationship = 'taxonomy_codec';
protected static ?string $recordTitleAttribute = 'name'; protected static ?string $recordTitleAttribute = 'name';
@@ -15,7 +15,7 @@ use Illuminate\Database\Eloquent\SoftDeletingScope;
class TaxonomySourcesRelationManager extends RelationManager class TaxonomySourcesRelationManager extends RelationManager
{ {
protected static string $relationship = 'taxonomy_sources'; protected static string $relationship = 'taxonomy_source';
protected static ?string $recordTitleAttribute = 'name'; protected static ?string $recordTitleAttribute = 'name';
@@ -94,14 +94,20 @@ class TaxonomySourcesRelationManager extends RelationManager
// //
]) ])
->headerActions([ ->headerActions([
Tables\Actions\CreateAction::make(), Tables\Actions\CreateAction::make()->after(function ($record) {
clear_search_box_cache($record->mode);
}),
]) ])
->actions([ ->actions([
Tables\Actions\EditAction::make(), Tables\Actions\EditAction::make()->after(function ($record) {
Tables\Actions\DeleteAction::make(), clear_search_box_cache($record->mode);
}),
Tables\Actions\DeleteAction::make()->after(function ($record) {
clear_search_box_cache($record->mode);
}),
]) ])
->bulkActions([ ->bulkActions([
Tables\Actions\DeleteBulkAction::make(),
]); ]);
} }
@@ -12,7 +12,7 @@ use Illuminate\Database\Eloquent\SoftDeletingScope;
class TaxonomyStandardsRelationManager extends TaxonomySourcesRelationManager class TaxonomyStandardsRelationManager extends TaxonomySourcesRelationManager
{ {
protected static string $relationship = 'taxonomy_standards'; protected static string $relationship = 'taxonomy_standard';
protected static ?string $recordTitleAttribute = 'name'; protected static ?string $recordTitleAttribute = 'name';
@@ -12,7 +12,7 @@ use Illuminate\Database\Eloquent\SoftDeletingScope;
class TaxonomyTeamsRelationManager extends TaxonomySourcesRelationManager class TaxonomyTeamsRelationManager extends TaxonomySourcesRelationManager
{ {
protected static string $relationship = 'taxonomy_teams'; protected static string $relationship = 'taxonomy_team';
protected static ?string $recordTitleAttribute = 'name'; protected static ?string $recordTitleAttribute = 'name';
+20 -12
View File
@@ -3,6 +3,7 @@
namespace App\Models; namespace App\Models;
use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Support\Str;
class SearchBox extends NexusModel class SearchBox extends NexusModel
{ {
@@ -27,8 +28,8 @@ class SearchBox extends NexusModel
const EXTRA_DISPLAY_COVER_ON_TORRENT_LIST = 'display_cover_on_torrent_list'; const EXTRA_DISPLAY_COVER_ON_TORRENT_LIST = 'display_cover_on_torrent_list';
const EXTRA_DISPLAY_SEED_BOX_ICON_ON_TORRENT_LIST = 'display_seed_box_icon_on_torrent_list'; const EXTRA_DISPLAY_SEED_BOX_ICON_ON_TORRENT_LIST = 'display_seed_box_icon_on_torrent_list';
public static array $subCategories = [ public static array $taxonomies = [
'source' => 'surces', 'source' => 'sources',
'medium' => 'media', 'medium' => 'media',
'codec' => 'codecs', 'codec' => 'codecs',
'audiocodec' => 'audiocodecs', 'audiocodec' => 'audiocodecs',
@@ -53,7 +54,7 @@ class SearchBox extends NexusModel
public static function formatTaxonomyExtra(array $data): array public static function formatTaxonomyExtra(array $data): array
{ {
foreach (self::$subCategories as $field => $table) { foreach (self::$taxonomies as $field => $table) {
$data["show{$field}"] = 0; $data["show{$field}"] = 0;
foreach ($data['extra'][self::EXTRA_TAXONOMY_LABELS] ?? [] as $item) { foreach ($data['extra'][self::EXTRA_TAXONOMY_LABELS] ?? [] as $item) {
if ($field == $item['torrent_field']) { if ($field == $item['torrent_field']) {
@@ -65,6 +66,16 @@ class SearchBox extends NexusModel
return $data; return $data;
} }
public function getTaxonomyLabel($torrentField)
{
foreach ($this->extra[self::EXTRA_TAXONOMY_LABELS] ?? [] as $item) {
if ($item['torrent_field'] == $torrentField) {
return $item['display_text'];
}
}
return nexus_trans('label.torrent.' . $torrentField) ?: ucfirst($torrentField);
}
protected function customFields(): Attribute protected function customFields(): Attribute
{ {
return new Attribute( return new Attribute(
@@ -75,7 +86,7 @@ class SearchBox extends NexusModel
public static function getSubCatOptions(): array public static function getSubCatOptions(): array
{ {
return array_combine(array_keys(self::$subCategories), array_keys(self::$subCategories)); return array_combine(array_keys(self::$taxonomies), array_keys(self::$taxonomies));
} }
public function categories(): \Illuminate\Database\Eloquent\Relations\HasMany public function categories(): \Illuminate\Database\Eloquent\Relations\HasMany
@@ -88,7 +99,7 @@ class SearchBox extends NexusModel
return $this->hasMany(SearchBoxField::class, 'searchbox_id'); return $this->hasMany(SearchBoxField::class, 'searchbox_id');
} }
public function taxonomy_sources(): \Illuminate\Database\Eloquent\Relations\HasMany public function taxonomy_source(): \Illuminate\Database\Eloquent\Relations\HasMany
{ {
return $this->hasMany(Source::class, 'mode'); return $this->hasMany(Source::class, 'mode');
} }
@@ -98,22 +109,22 @@ class SearchBox extends NexusModel
return $this->hasMany(Media::class, 'mode'); return $this->hasMany(Media::class, 'mode');
} }
public function taxonomy_standards(): \Illuminate\Database\Eloquent\Relations\HasMany public function taxonomy_standard(): \Illuminate\Database\Eloquent\Relations\HasMany
{ {
return $this->hasMany(Standard::class, 'mode'); return $this->hasMany(Standard::class, 'mode');
} }
public function taxonomy_codecs(): \Illuminate\Database\Eloquent\Relations\HasMany public function taxonomy_codec(): \Illuminate\Database\Eloquent\Relations\HasMany
{ {
return $this->hasMany(Codec::class, 'mode'); return $this->hasMany(Codec::class, 'mode');
} }
public function taxonomy_audio_codecs(): \Illuminate\Database\Eloquent\Relations\HasMany public function taxonomy_audiocodec(): \Illuminate\Database\Eloquent\Relations\HasMany
{ {
return $this->hasMany(AudioCodec::class, 'mode'); return $this->hasMany(AudioCodec::class, 'mode');
} }
public function taxonomy_teams(): \Illuminate\Database\Eloquent\Relations\HasMany public function taxonomy_team(): \Illuminate\Database\Eloquent\Relations\HasMany
{ {
return $this->hasMany(Team::class, 'mode'); return $this->hasMany(Team::class, 'mode');
} }
@@ -129,7 +140,4 @@ class SearchBox extends NexusModel
} }
} }
+52 -11
View File
@@ -7,6 +7,7 @@ use App\Models\NexusModel;
use App\Models\SearchBox; use App\Models\SearchBox;
use App\Models\SearchBoxField; use App\Models\SearchBoxField;
use App\Models\Setting; use App\Models\Setting;
use Elasticsearch\Endpoints\Search;
use Illuminate\Support\Arr; use Illuminate\Support\Arr;
use Nexus\Database\NexusDB; use Nexus\Database\NexusDB;
@@ -102,13 +103,14 @@ class SearchBoxRepository extends BaseRepository
return Icon::query()->find(array_keys($iconIdArr)); return Icon::query()->find(array_keys($iconIdArr));
} }
public static function migrateToModeRelated() public function migrateToModeRelated()
{ {
$secondIconTable = 'secondicons'; $secondIconTable = 'secondicons';
$normalId = Setting::get('main.browsecat'); $normalId = Setting::get('main.browsecat');
$specialId = Setting::get('main.specialcat'); $specialId = Setting::get('main.specialcat');
$searchBoxList = SearchBox::query()->get(); $searchBoxList = SearchBox::query()->get();
$tables = array_values(SearchBox::$subCategories); $tables = array_values(SearchBox::$taxonomies);
foreach ($searchBoxList as $searchBox) { foreach ($searchBoxList as $searchBox) {
if ($searchBox->id == $normalId) { if ($searchBox->id == $normalId) {
//all sub categories add `mode` field //all sub categories add `mode` field
@@ -129,17 +131,56 @@ class SearchBoxRepository extends BaseRepository
NexusDB::statement($sql); NexusDB::statement($sql);
do_log("copy table $table, $sql"); do_log("copy table $table, $sql");
} }
$fields = array_keys(SearchBox::$subCategories); // $fields = array_keys(SearchBox::$taxonomies);
$fields = array_merge($fields, ['name', 'class_name', 'image']); // $fields = array_merge($fields, ['name', 'class_name', 'image']);
$fieldStr = implode(', ', $fields); // $fieldStr = implode(', ', $fields);
$sql = sprintf( // $sql = sprintf(
"insert into `%s` (%s, mode) select %s, '%s' from `%s`", // "insert into `%s` (%s, mode) select %s, '%s' from `%s`",
$secondIconTable, $fieldStr, $fieldStr, $specialId, $secondIconTable // $secondIconTable, $fieldStr, $fieldStr, $specialId, $secondIconTable
); // );
NexusDB::statement($sql); // NexusDB::statement($sql);
do_log("copy table $secondIconTable, $sql"); // do_log("copy table $secondIconTable, $sql");
} }
$taxonomies = [];
foreach (SearchBox::$taxonomies as $field => $taxonomyTable) {
$showField = "show" . $field;
if ($searchBox->{$showField}) {
$taxonomies[] = [
'torrent_field' => $field,
'display_text' => $field,
];
}
}
$searchBox->update(["extra->" . SearchBox::EXTRA_TAXONOMY_LABELS => $taxonomies]);
} }
} }
public function renderQualitySelect($searchBox, array $torrentInfo = []): string
{
if (!$searchBox instanceof SearchBox) {
$searchBox = SearchBox::query()->findOrFail(intval($searchBox));
}
$results = [];
foreach (SearchBox::$taxonomies as $torrentField => $table) {
$searchBoxField = "show" . $torrentField;
if ($searchBox->{$searchBoxField}) {
$select = sprintf("<b>%s:</b>", $searchBox->getTaxonomyLabel($torrentField));
$select .= sprintf('<select name="%s" data-mode="%s">', $torrentField . "_sel", $searchBox->id);
$select .= sprintf('<option value="%s">%s</option>', 0, nexus_trans('nexus.select_one_please'));
$relation = "taxonomy_$torrentField";
$list = $searchBox->{$relation};
foreach ($list as $item) {
$selected = '';
if (isset($torrentInfo[$torrentField]) && $torrentInfo[$torrentField] == $item->id) {
$selected = " selected";
}
$select .= sprintf('<option value="%s"%s>%s</option>', $item->id, $selected, $item->name);
}
$select .= '</select>';
$results[] = $select;
}
}
return implode('&nbsp;&nbsp;', $results);
}
} }
+90 -11
View File
@@ -2181,7 +2181,7 @@ function tr($x,$y,$noesc=0,$relation='', $return = false) {
// $result = ("<tr".( $relation ? " relation = \"$relation\"" : "")."><td class=\"rowhead nowrap\" valign=\"top\" align=\"right\">$x</td><td class=\"rowfollow\" valign=\"top\" align=\"left\">".$a."</td></tr>\n"); // $result = ("<tr".( $relation ? " relation = \"$relation\"" : "")."><td class=\"rowhead nowrap\" valign=\"top\" align=\"right\">$x</td><td class=\"rowfollow\" valign=\"top\" align=\"left\">".$a."</td></tr>\n");
$result = sprintf( $result = sprintf(
'<tr%s><td class="rowhead nowrap" valign="top" align="right">%s</td><td class="rowfollow" valign="top" align="left">%s</td></tr>', '<tr%s><td class="rowhead nowrap" valign="top" align="right">%s</td><td class="rowfollow" valign="top" align="left">%s</td></tr>',
$relation ? sprintf(' relation="%s"', $relation) : '', $relation ? sprintf(' relation="%s" class="%s"', $relation, $relation) : '',
$x, $a $x, $a
); );
if ($return) { if ($return) {
@@ -2291,15 +2291,17 @@ function menu ($selected = "home") {
if ($menu) { if ($menu) {
print $menu; print $menu;
} else { } else {
$normalSectionName = get_searchbox_value(get_setting('main.browsecat'), 'section_name');
$specialSectionName = get_searchbox_value(get_setting('main.specialcat'), 'section_name');
print ("<ul id=\"mainmenu\" class=\"menu\">"); print ("<ul id=\"mainmenu\" class=\"menu\">");
print ("<li" . ($selected == "home" ? " class=\"selected\"" : "") . "><a href=\"index.php\">" . $lang_functions['text_home'] . "</a></li>"); print ("<li" . ($selected == "home" ? " class=\"selected\"" : "") . "><a href=\"index.php\">" . $lang_functions['text_home'] . "</a></li>");
if ($enableextforum != 'yes') if ($enableextforum != 'yes')
print ("<li" . ($selected == "forums" ? " class=\"selected\"" : "") . "><a href=\"forums.php\">".$lang_functions['text_forums']."</a></li>"); print ("<li" . ($selected == "forums" ? " class=\"selected\"" : "") . "><a href=\"forums.php\">".$lang_functions['text_forums']."</a></li>");
else else
print ("<li" . ($selected == "forums" ? " class=\"selected\"" : "") . "><a href=\"" . $extforumurl."\" target=\"_blank\">".$lang_functions['text_forums']."</a></li>"); print ("<li" . ($selected == "forums" ? " class=\"selected\"" : "") . "><a href=\"" . $extforumurl."\" target=\"_blank\">".$lang_functions['text_forums']."</a></li>");
print ("<li" . ($selected == "torrents" ? " class=\"selected\"" : "") . "><a href=\"torrents.php\" rel='sub-menu'>".$lang_functions['text_torrents']."</a></li>"); print ("<li" . ($selected == "torrents" ? " class=\"selected\"" : "") . "><a href=\"torrents.php\" rel='sub-menu'>".($normalSectionName ?: $lang_functions['text_torrents'])."</a></li>");
if ($enablespecial == 'yes' && user_can('view_special_torrent')) if ($enablespecial == 'yes' && user_can('view_special_torrent'))
print ("<li" . ($selected == "special" ? " class=\"selected\"" : "") . "><a href=\"special.php\">".$lang_functions['text_special']."</a></li>"); print ("<li" . ($selected == "special" ? " class=\"selected\"" : "") . "><a href=\"special.php\">".($specialSectionName ?: $lang_functions['text_special'])."</a></li>");
if ($enableoffer == 'yes') if ($enableoffer == 'yes')
print ("<li" . ($selected == "offers" ? " class=\"selected\"" : "") . "><a href=\"offers.php\">".$lang_functions['text_offers']."</a></li>"); print ("<li" . ($selected == "offers" ? " class=\"selected\"" : "") . "><a href=\"offers.php\">".$lang_functions['text_offers']."</a></li>");
if ($enablerequest == 'yes') if ($enablerequest == 'yes')
@@ -3213,14 +3215,15 @@ function genrelist($catmode = 1) {
return $ret; return $ret;
} }
function searchbox_item_list($table = "sources"){ function searchbox_item_list($table, $mode){
global $Cache; global $Cache;
if (!$ret = $Cache->get_value($table.'_list')){ $cacheKey = "{$table}_list_mode_{$mode}";
if (!$ret = $Cache->get_value($cacheKey)){
$ret = array(); $ret = array();
$res = sql_query("SELECT * FROM ".$table." ORDER BY sort_index, id"); $res = sql_query("SELECT * FROM $table where mode = '$mode' ORDER BY sort_index, id");
while ($row = mysql_fetch_array($res)) while ($row = mysql_fetch_array($res))
$ret[] = $row; $ret[] = $row;
$Cache->cache_value($table.'_list', $ret, 152800); $Cache->cache_value($cacheKey, $ret, 152800);
} }
return $ret; return $ret;
} }
@@ -4750,7 +4753,8 @@ function get_plain_username($id){
function get_searchbox_value($mode = 1, $item = 'showsubcat'){ function get_searchbox_value($mode = 1, $item = 'showsubcat'){
global $Cache; global $Cache;
static $rows; static $rows;
if (!$rows && !$rows = $Cache->get_value('searchbox_content')){ $cacheKey = "search_box_content_{$mode}";
if (!$rows && !$rows = $Cache->get_value($cacheKey)){
$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)) {
@@ -4759,7 +4763,7 @@ function get_searchbox_value($mode = 1, $item = 'showsubcat'){
} }
$rows[$row['id']] = $row; $rows[$row['id']] = $row;
} }
$Cache->cache_value('searchbox_content', $rows, 100500); $Cache->cache_value($cacheKey, $rows, 100500);
} }
return $rows[$mode][$item] ?? ''; return $rows[$mode][$item] ?? '';
} }
@@ -4864,11 +4868,11 @@ function user_can_upload($where = "torrents"){
return false; return false;
} }
function torrent_selection($name,$selname,$listname,$selectedid = 0) function torrent_selection($name,$selname,$listname,$selectedid = 0, $mode = 0)
{ {
global $lang_functions; global $lang_functions;
$selection = "<b>".$name."</b>&nbsp;<select name=\"".$selname."\">\n<option value=\"0\">".$lang_functions['select_choose_one']."</option>\n"; $selection = "<b>".$name."</b>&nbsp;<select name=\"".$selname."\">\n<option value=\"0\">".$lang_functions['select_choose_one']."</option>\n";
$listarray = searchbox_item_list($listname); $listarray = searchbox_item_list($listname, $mode);
foreach ($listarray as $row) foreach ($listarray as $row)
$selection .= "<option value=\"" . $row["id"] . "\"". ($row["id"]==$selectedid ? " selected=\"selected\"" : "").">" . htmlspecialchars($row["name"]) . "</option>\n"; $selection .= "<option value=\"" . $row["id"] . "\"". ($row["id"]==$selectedid ? " selected=\"selected\"" : "").">" . htmlspecialchars($row["name"]) . "</option>\n";
$selection .= "</select>&nbsp;&nbsp;&nbsp;\n"; $selection .= "</select>&nbsp;&nbsp;&nbsp;\n";
@@ -5872,4 +5876,79 @@ function calculate_harem_addition($uid)
return $addition; return $addition;
} }
function build_search_box_category_table($mode, $checkboxValue, $categoryHrefPrefix, $taxonomyHrefPrefix, $taxonomyNameLength, $checkedValues = '')
{
$searchBox = \App\Models\SearchBox::query()->with(['categories', 'categories.icon'])->findOrFail($mode);
$withTaxonomies = [];
foreach (\App\Models\SearchBox::$taxonomies as $torrentField => $taxonomyTable) {
$showField = "show" . $torrentField;
if ($searchBox->{$showField}) {
$withTaxonomies[] = "taxonomy_{$torrentField}";
}
}
$searchBox->load($withTaxonomies);
$html = '<table>';
$html .= sprintf('<caption><font class="big">%s</font></caption>', $searchBox->section_name);
//Category
$html .= sprintf('<tr><td class="embedded" align="left">%s</td></tr>', nexus_trans('label.search_box.category'));
$categoryChunks = $searchBox->categories->chunk($searchBox->catsperrow);
$lang = get_langfolder_cookie();
foreach ($categoryChunks as $chunk) {
$html .= '<tr>';
foreach ($chunk as $item) {
$checked = '';
if (str_contains($checkedValues, "[cat{$item->id}]")) {
$checked = " checked";
}
$icon = $item->icon;
$backgroundImagePath = sprintf('pic/category/%s/%s/%s%s', $searchBox->name, trim($icon->folder, '/'), $icon->multilang == 'yes' ? "$lang/" : "", $item->image);
$td = <<<TD
<td align="left" class="bottom" style="padding-bottom: 4px;padding-left: {$searchBox->catpadding}px">
<input type="checkbox" id="cat{$item->id}" name="cat{$item->id}" value="{$checkboxValue}"{$checked} />
<a href="{$categoryHrefPrefix}&cat={$item->id}"><img src="pic/cattrans.gif" class="{$item->class_name}" alt="{$item->name}" title="{$item->name}" style="background-image: url({$backgroundImagePath})" /></a>
</td>
TD;
$html .= $td;
}
$html .= '</tr>';
}
//Taxonomy
foreach ($withTaxonomies as $relation) {
$torrentField = str_replace("taxonomy_", '', $relation);
if ($taxonomyNameLength > 0) {
$namePrefix = substr($torrentField, 0, $taxonomyNameLength);
} else {
$namePrefix = $torrentField;
}
$html .= sprintf('<tr><td class="embedded" align="left">%s</td></tr>', $searchBox->getTaxonomyLabel($torrentField));
$taxonomyChunks = $searchBox->{$relation}->chunk($searchBox->catsperrow);
foreach ($taxonomyChunks as $chunk) {
$html .= '<tr>';
foreach ($chunk as $item) {
if ($taxonomyHrefPrefix) {
$afterInput = sprintf('<a href="%s&%s=%s">%s</a>', $taxonomyHrefPrefix, $namePrefix, $item->id, $item->name);
} else {
$afterInput = $item->name;
}
$checked = '';
if (str_contains($checkedValues, "[{$namePrefix}{$item->id}]")) {
$checked = ' checked';
}
$td = <<<TD
<td align="left" class="bottom" style="padding-bottom: 4px;padding-left: {$item->catpadding}px">
<label><input type="checkbox" id="{$namePrefix}{$item->id}" name="{$namePrefix}{$item->id}" value="{$checkboxValue}"{$checked} />$afterInput</label>
</td>
TD;
$html .= $td;
}
$html .= '</tr>';
}
$html .= '</tr>';
}
$html .= '</table>';
return $html;
}
?> ?>
+6
View File
@@ -983,6 +983,12 @@ function clear_staff_message_cache()
\App\Repositories\MessageRepository::updateStaffMessageCountCache(false); \App\Repositories\MessageRepository::updateStaffMessageCountCache(false);
} }
function clear_search_box_cache($id)
{
do_log("clear_search_box_cache: $id");
\Nexus\Database\NexusDB::cache_del("search_box_content_{$id}");
}
function user_can($permission, $fail = false, $uid = 0): bool function user_can($permission, $fail = false, $uid = 0): bool
{ {
$log = "permission: $permission, fail: $fail, user: $uid"; $log = "permission: $permission, fail: $fail, user: $uid";
+14 -2
View File
@@ -19,7 +19,7 @@ if (!$row) die();
$customField = new \Nexus\Field\Field(); $customField = new \Nexus\Field\Field();
$tagIdArr = \App\Models\TorrentTag::query()->where('torrent_id', $id)->get()->pluck('tag_id')->toArray(); $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')) if ($enablespecial == 'yes' && user_can('movetorrent'))
$allowmove = true; //enable moving torrent to other section $allowmove = true; //enable moving torrent to other section
else $allowmove = false; else $allowmove = false;
@@ -35,7 +35,7 @@ else
$othermode = $browsecatmode; $othermode = $browsecatmode;
$movenote = $lang_edit['text_move_to_browse']; $movenote = $lang_edit['text_move_to_browse'];
} }
/*
$showsource = (get_searchbox_value($sectionmode, 'showsource') || ($allowmove && get_searchbox_value($othermode, 'showsource'))); //whether show sources or not $showsource = (get_searchbox_value($sectionmode, 'showsource') || ($allowmove && get_searchbox_value($othermode, 'showsource'))); //whether show sources or not
$showmedium = (get_searchbox_value($sectionmode, 'showmedium') || ($allowmove && get_searchbox_value($othermode, 'showmedium'))); //whether show media or not $showmedium = (get_searchbox_value($sectionmode, 'showmedium') || ($allowmove && get_searchbox_value($othermode, 'showmedium'))); //whether show media or not
$showcodec = (get_searchbox_value($sectionmode, 'showcodec') || ($allowmove && get_searchbox_value($othermode, 'showcodec'))); //whether show codecs or not $showcodec = (get_searchbox_value($sectionmode, 'showcodec') || ($allowmove && get_searchbox_value($othermode, 'showcodec'))); //whether show codecs or not
@@ -43,6 +43,7 @@ $showstandard = (get_searchbox_value($sectionmode, 'showstandard') || ($allowmov
$showprocessing = (get_searchbox_value($sectionmode, 'showprocessing') || ($allowmove && get_searchbox_value($othermode, 'showprocessing'))); //whether show processings or not $showprocessing = (get_searchbox_value($sectionmode, 'showprocessing') || ($allowmove && get_searchbox_value($othermode, 'showprocessing'))); //whether show processings or not
$showteam = (get_searchbox_value($sectionmode, 'showteam') || ($allowmove && get_searchbox_value($othermode, 'showteam'))); //whether show teams or not $showteam = (get_searchbox_value($sectionmode, 'showteam') || ($allowmove && get_searchbox_value($othermode, 'showteam'))); //whether show teams or not
$showaudiocodec = (get_searchbox_value($sectionmode, 'showaudiocodec') || ($allowmove && get_searchbox_value($othermode, 'showaudiocodec'))); //whether show audio codecs or not $showaudiocodec = (get_searchbox_value($sectionmode, 'showaudiocodec') || ($allowmove && get_searchbox_value($othermode, 'showaudiocodec'))); //whether show audio codecs or not
*/
$settingMain = get_setting('main'); $settingMain = get_setting('main');
stdhead($lang_edit['head_edit_torrent'] . "\"". $row["name"] . "\""); stdhead($lang_edit['head_edit_torrent'] . "\"". $row["name"] . "\"");
@@ -105,6 +106,7 @@ else {
$movecheckbox = "<input type=\"checkbox\" id=movecheck name=\"movecheck\" value=\"1\" onclick=\"disableother2('oricat','newcat')\" />"; $movecheckbox = "<input type=\"checkbox\" id=movecheck name=\"movecheck\" value=\"1\" onclick=\"disableother2('oricat','newcat')\" />";
} }
tr($lang_edit['row_type']."<font color=\"red\">*</font>", $s.($allowmove ? "&nbsp;&nbsp;".$movecheckbox.$movenote.$s2 : ""), 1); tr($lang_edit['row_type']."<font color=\"red\">*</font>", $s.($allowmove ? "&nbsp;&nbsp;".$movecheckbox.$movenote.$s2 : ""), 1);
/*
if ($showsource || $showmedium || $showcodec || $showaudiocodec || $showstandard || $showprocessing){ if ($showsource || $showmedium || $showcodec || $showaudiocodec || $showstandard || $showprocessing){
if ($showsource){ if ($showsource){
$source_select = torrent_selection($lang_edit['text_source'],"source_sel","sources",$row["source"]); $source_select = torrent_selection($lang_edit['text_source'],"source_sel","sources",$row["source"]);
@@ -147,6 +149,16 @@ else {
tr($lang_edit['row_content'],$team_select,1); tr($lang_edit['row_content'],$team_select,1);
} }
*/
$sectionCurrent = $searchBoxRep->renderQualitySelect($sectionmode);
tr($lang_edit['row_quality'], $sectionCurrent, 1, "hide mode mode_$sectionmode");
if ($allowmove && $othermode) {
$selectOther = $searchBoxRep->renderQualitySelect($othermode);
tr($lang_edit['row_quality'], $selectOther, 1, "hide mode mode_$othermode");
}
tr($lang_functions['text_tags'], (new \App\Repositories\TagRepository())->renderCheckbox($tagIdArr), 1); tr($lang_functions['text_tags'], (new \App\Repositories\TagRepository())->renderCheckbox($tagIdArr), 1);
$rowChecks = []; $rowChecks = [];
+16 -8
View File
@@ -6,7 +6,7 @@ loggedinorreturn();
$brsectiontype = $browsecatmode; $brsectiontype = $browsecatmode;
$spsectiontype = $specialcatmode; $spsectiontype = $specialcatmode;
if ($enablespecial == 'yes' && get_user_class() >= get_setting('authority.view_special_torrent')) if ($enablespecial == 'yes' && user_can('view_special_torrent'))
$allowspecial = true; $allowspecial = true;
else $allowspecial = false; else $allowspecial = false;
$showsubcat = (get_searchbox_value($brsectiontype, 'showsubcat') || ($allowspecial && get_searchbox_value($spsectiontype, 'showsubcat'))); $showsubcat = (get_searchbox_value($brsectiontype, 'showsubcat') || ($allowspecial && get_searchbox_value($spsectiontype, 'showsubcat')));
@@ -29,13 +29,13 @@ $brcats = genrelist($brsectiontype);
$spcats = genrelist($spsectiontype); $spcats = genrelist($spsectiontype);
if ($showsubcat){ if ($showsubcat){
if ($showsource) $sources = searchbox_item_list("sources"); if ($showsource) $sources = searchbox_item_list("sources", $brsectiontype);
if ($showmedium) $media = searchbox_item_list("media"); if ($showmedium) $media = searchbox_item_list("media", $brsectiontype);
if ($showcodec) $codecs = searchbox_item_list("codecs"); if ($showcodec) $codecs = searchbox_item_list("codecs", $brsectiontype);
if ($showstandard) $standards = searchbox_item_list("standards"); if ($showstandard) $standards = searchbox_item_list("standards", $brsectiontype);
if ($showprocessing) $processings = searchbox_item_list("processings"); if ($showprocessing) $processings = searchbox_item_list("processings", $brsectiontype);
if ($showteam) $teams = searchbox_item_list("teams"); if ($showteam) $teams = searchbox_item_list("teams", $brsectiontype);
if ($showaudiocodec) $audiocodecs = searchbox_item_list("audiocodecs"); if ($showaudiocodec) $audiocodecs = searchbox_item_list("audiocodecs", $brsectiontype);
} }
stdhead($lang_getrss['head_rss_feeds']); stdhead($lang_getrss['head_rss_feeds']);
$query = []; $query = [];
@@ -177,6 +177,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") {
stdfoot(); stdfoot();
die(); die();
} }
?> ?>
<h1 align="center"><?php echo $lang_getrss['text_rss_feeds']?></h1> <h1 align="center"><?php echo $lang_getrss['text_rss_feeds']?></h1>
<form method="post" action="getrss.php"> <form method="post" action="getrss.php">
@@ -186,6 +187,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") {
</td> </td>
<td class="rowfollow" align="left"> <td class="rowfollow" align="left">
<?php <?php
/*
$categories = "<table><tr><td class=\"embedded\" align=\"left\"><b>".$lang_getrss['text_category']."</b></td></tr><tr>"; $categories = "<table><tr><td class=\"embedded\" align=\"left\"><b>".$lang_getrss['text_category']."</b></td></tr><tr>";
$i = 0; $i = 0;
foreach ($brcats as $cat)//print category list of Torrents section foreach ($brcats as $cat)//print category list of Torrents section
@@ -296,7 +298,13 @@ if ($allowspecial) //print category list of Special section
} }
} }
$categories .= "</table>"; $categories .= "</table>";
*/
$categories = build_search_box_category_table($browsecatmode, 'yes', 'torrents.php?allsec=1', false, 3);
print($categories); print($categories);
print '<div style="height: 1px;background-color: #eee;margin: 10px 0"></div>';
$categoriesSpecial = build_search_box_category_table($specialcatmode, 'yes', 'torrents.php?allsec=1', false, 3);
print($categoriesSpecial);
?> ?>
</td> </td>
</tr> </tr>
+26 -1
View File
@@ -28,7 +28,7 @@ jQuery('.btn-get-pt-gen').on('click', function () {
}, 'json') }, 'json')
}) })
//auto fill quality
function autoSelect(value) { function autoSelect(value) {
// console.log(`autoSelect: ${value}`) // console.log(`autoSelect: ${value}`)
value = value.replace(/[-\/\.]+/ig, '').toUpperCase(); value = value.replace(/[-\/\.]+/ig, '').toUpperCase();
@@ -36,6 +36,10 @@ function autoSelect(value) {
for (let i = 0; i < names.length; i++) { for (let i = 0; i < names.length; i++) {
const name = names[i]; const name = names[i];
const select = jQuery("select[name="+name+"]") const select = jQuery("select[name="+name+"]")
if (select.prop('disabled')) {
console.log("name: " + name + " is disabled, skip")
continue
}
// console.log("check name: " + name) // console.log("check name: " + name)
select.children("option").each(function (index, option) { select.children("option").each(function (index, option) {
let _option = jQuery(option) let _option = jQuery(option)
@@ -71,3 +75,24 @@ jQuery("#compose").on("click", ".nexus-action-btn",function () {
} }
} }
}) })
//change section
function showHideQuality(activeSelect) {
let mode = activeSelect.getAttribute("data-mode")
let value = activeSelect.value
console.log(mode, value)
if (value == 0) {
//enable all section
jQuery("select[name=type]").prop("disabled", false);
//disable all quality tr
jQuery("tr.mode").hide().find("select").prop("disabled", true);
} else {
jQuery("select[name=type]").prop("disabled", true);
activeSelect.disabled = false
//active current section quality tr
jQuery("tr.mode_" + mode).show().find("select").prop("disabled", false);
}
}
jQuery("#compose").on("change", "select[name=type]", function () {
showHideQuality(this)
});
+3
View File
@@ -530,3 +530,6 @@ img.hitandrun {
background-position: 100% 0; background-position: 100% 0;
} }
} }
.hide {
display: none;
}
+8 -8
View File
@@ -23,7 +23,7 @@ switch (nexus()->getScript()) {
if (get_setting('main.spsct') != 'yes') { if (get_setting('main.spsct') != 'yes') {
httperr(); httperr();
} }
if (get_user_class() < get_setting('authority.view_special_torrent')) { if (!user_can('view_special_torrent')) {
stderr($lang_special['std_sorry'],$lang_special['std_permission_denied_only'].get_user_class_name(get_setting('authority.view_special_torrent'),false,true,true).$lang_special['std_or_above_can_view'],false); stderr($lang_special['std_sorry'],$lang_special['std_permission_denied_only'].get_user_class_name(get_setting('authority.view_special_torrent'),false,true,true).$lang_special['std_or_above_can_view'],false);
} }
$sectiontype = $specialcatmode; $sectiontype = $specialcatmode;
@@ -44,13 +44,13 @@ $catpadding = get_searchbox_value($sectiontype, 'catpadding'); //padding space b
$cats = genrelist($sectiontype); $cats = genrelist($sectiontype);
if ($showsubcat){ if ($showsubcat){
if ($showsource) $sources = searchbox_item_list("sources"); if ($showsource) $sources = searchbox_item_list("sources", $sectiontype);
if ($showmedium) $media = searchbox_item_list("media"); if ($showmedium) $media = searchbox_item_list("media", $sectiontype);
if ($showcodec) $codecs = searchbox_item_list("codecs"); if ($showcodec) $codecs = searchbox_item_list("codecs", $sectiontype);
if ($showstandard) $standards = searchbox_item_list("standards"); if ($showstandard) $standards = searchbox_item_list("standards", $sectiontype);
if ($showprocessing) $processings = searchbox_item_list("processings"); if ($showprocessing) $processings = searchbox_item_list("processings", $sectiontype);
if ($showteam) $teams = searchbox_item_list("teams"); if ($showteam) $teams = searchbox_item_list("teams", $sectiontype);
if ($showaudiocodec) $audiocodecs = searchbox_item_list("audiocodecs"); if ($showaudiocodec) $audiocodecs = searchbox_item_list("audiocodecs", $sectiontype);
} }
$searchstr_ori = htmlspecialchars(trim($_GET["search"] ?? '')); $searchstr_ori = htmlspecialchars(trim($_GET["search"] ?? ''));
+15 -4
View File
@@ -23,6 +23,7 @@ $allowtwosec = ($allowtorrents && $allowspecial);
$brsectiontype = $browsecatmode; $brsectiontype = $browsecatmode;
$spsectiontype = $specialcatmode; $spsectiontype = $specialcatmode;
/*
$showsource = (($allowtorrents && get_searchbox_value($brsectiontype, 'showsource')) || ($allowspecial && get_searchbox_value($spsectiontype, 'showsource'))); //whether show sources or not $showsource = (($allowtorrents && get_searchbox_value($brsectiontype, 'showsource')) || ($allowspecial && get_searchbox_value($spsectiontype, 'showsource'))); //whether show sources or not
$showmedium = (($allowtorrents && get_searchbox_value($brsectiontype, 'showmedium')) || ($allowspecial && get_searchbox_value($spsectiontype, 'showmedium'))); //whether show media or not $showmedium = (($allowtorrents && get_searchbox_value($brsectiontype, 'showmedium')) || ($allowspecial && get_searchbox_value($spsectiontype, 'showmedium'))); //whether show media or not
$showcodec = (($allowtorrents && get_searchbox_value($brsectiontype, 'showcodec')) || ($allowspecial && get_searchbox_value($spsectiontype, 'showcodec'))); //whether show codecs or not $showcodec = (($allowtorrents && get_searchbox_value($brsectiontype, 'showcodec')) || ($allowspecial && get_searchbox_value($spsectiontype, 'showcodec'))); //whether show codecs or not
@@ -30,9 +31,10 @@ $showstandard = (($allowtorrents && get_searchbox_value($brsectiontype, 'showsta
$showprocessing = (($allowtorrents && get_searchbox_value($brsectiontype, 'showprocessing')) || ($allowspecial && get_searchbox_value($spsectiontype, 'showprocessing'))); //whether show processings or not $showprocessing = (($allowtorrents && get_searchbox_value($brsectiontype, 'showprocessing')) || ($allowspecial && get_searchbox_value($spsectiontype, 'showprocessing'))); //whether show processings or not
$showteam = (($allowtorrents && get_searchbox_value($brsectiontype, 'showteam')) || ($allowspecial && get_searchbox_value($spsectiontype, 'showteam'))); //whether show teams or not $showteam = (($allowtorrents && get_searchbox_value($brsectiontype, 'showteam')) || ($allowspecial && get_searchbox_value($spsectiontype, 'showteam'))); //whether show teams or not
$showaudiocodec = (($allowtorrents && get_searchbox_value($brsectiontype, 'showaudiocodec')) || ($allowspecial && get_searchbox_value($spsectiontype, 'showaudiocodec'))); //whether show languages or not $showaudiocodec = (($allowtorrents && get_searchbox_value($brsectiontype, 'showaudiocodec')) || ($allowspecial && get_searchbox_value($spsectiontype, 'showaudiocodec'))); //whether show languages or not
*/
$settingMain = get_setting('main'); $settingMain = get_setting('main');
$torrentRep = new \App\Repositories\TorrentRepository(); $torrentRep = new \App\Repositories\TorrentRepository();
$searchBoxRep = new \App\Repositories\SearchBoxRepository();
stdhead($lang_upload['head_upload']); stdhead($lang_upload['head_upload']);
?> ?>
<form id="compose" enctype="multipart/form-data" action="takeupload.php" method="post" name="upload"> <form id="compose" enctype="multipart/form-data" action="takeupload.php" method="post" name="upload">
@@ -84,7 +86,7 @@ stdhead($lang_upload['head_upload']);
if ($allowtorrents){ if ($allowtorrents){
$disablespecial = " onchange=\"disableother('browsecat','specialcat')\""; $disablespecial = " onchange=\"disableother('browsecat','specialcat')\"";
$s = "<select name=\"type\" id=\"browsecat\" ".($allowtwosec ? $disablespecial : "").">\n<option value=\"0\">".$lang_upload['select_choose_one']."</option>\n"; $s = "<select name=\"type\" id=\"browsecat\" data-mode='$browsecatmode'>\n<option value=\"0\">".$lang_upload['select_choose_one']."</option>\n";
$cats = genrelist($browsecatmode); $cats = genrelist($browsecatmode);
foreach ($cats as $row) foreach ($cats as $row)
$s .= "<option value=\"" . $row["id"] . "\">" . htmlspecialchars($row["name"]) . "</option>\n"; $s .= "<option value=\"" . $row["id"] . "\">" . htmlspecialchars($row["name"]) . "</option>\n";
@@ -93,7 +95,7 @@ stdhead($lang_upload['head_upload']);
else $s = ""; else $s = "";
if ($allowspecial){ if ($allowspecial){
$disablebrowse = " onchange=\"disableother('specialcat','browsecat')\""; $disablebrowse = " onchange=\"disableother('specialcat','browsecat')\"";
$s2 = "<select name=\"type\" id=\"specialcat\" ".$disablebrowse.">\n<option value=\"0\">".$lang_upload['select_choose_one']."</option>\n"; $s2 = "<select name=\"type\" id=\"specialcat\" data-mode='$specialcatmode'>\n<option value=\"0\">".$lang_upload['select_choose_one']."</option>\n";
$cats2 = genrelist($specialcatmode); $cats2 = genrelist($specialcatmode);
foreach ($cats2 as $row) foreach ($cats2 as $row)
$s2 .= "<option value=\"" . $row["id"] . "\">" . htmlspecialchars($row["name"]) . "</option>\n"; $s2 .= "<option value=\"" . $row["id"] . "\">" . htmlspecialchars($row["name"]) . "</option>\n";
@@ -101,7 +103,7 @@ stdhead($lang_upload['head_upload']);
} }
else $s2 = ""; else $s2 = "";
tr($lang_upload['row_type']."<font color=\"red\">*</font>", ($allowtwosec ? $lang_upload['text_to_browse_section'] : "").$s.($allowtwosec ? $lang_upload['text_to_special_section'] : "").$s2.($allowtwosec ? $lang_upload['text_type_note'] : ""),1); tr($lang_upload['row_type']."<font color=\"red\">*</font>", ($allowtwosec ? $lang_upload['text_to_browse_section'] : "").$s.($allowtwosec ? $lang_upload['text_to_special_section'] : "").$s2.($allowtwosec ? $lang_upload['text_type_note'] : ""),1);
/*
if ($showsource || $showmedium || $showcodec || $showaudiocodec || $showstandard || $showprocessing){ if ($showsource || $showmedium || $showcodec || $showaudiocodec || $showstandard || $showprocessing){
if ($showsource){ if ($showsource){
$source_select = torrent_selection($lang_upload['text_source'],"source_sel","sources"); $source_select = torrent_selection($lang_upload['text_source'],"source_sel","sources");
@@ -144,6 +146,15 @@ stdhead($lang_upload['head_upload']);
tr($lang_upload['row_content'],$team_select,1); tr($lang_upload['row_content'],$team_select,1);
} }
*/
if ($allowtorrents) {
$selectNormal = $searchBoxRep->renderQualitySelect($browsecatmode);
tr($lang_upload['row_quality'], $selectNormal, 1, "hide mode mode_$browsecatmode");
}
if ($allowspecial) {
$selectNormal = $searchBoxRep->renderQualitySelect($specialcatmode);
tr($lang_upload['row_quality'], $selectNormal, 1, "hide mode mode_$specialcatmode");
}
//==== offer dropdown for offer mod from code by S4NE //==== offer dropdown for offer mod from code by S4NE
$offerres = sql_query("SELECT id, name FROM offers WHERE userid = ".sqlesc($CURUSER['id'])." AND allowed = 'allowed' ORDER BY name ASC") or sqlerr(__FILE__, __LINE__); $offerres = sql_query("SELECT id, name FROM offers WHERE userid = ".sqlesc($CURUSER['id'])." AND allowed = 'allowed' ORDER BY name ASC") or sqlerr(__FILE__, __LINE__);
+9 -1
View File
@@ -367,6 +367,7 @@ $spsectiontype = $specialcatmode;
if ($enablespecial == 'yes' && get_user_class() >= get_setting('authority.view_special_torrent')) if ($enablespecial == 'yes' && get_user_class() >= get_setting('authority.view_special_torrent'))
$allowspecial = true; $allowspecial = true;
else $allowspecial = false; else $allowspecial = false;
/*
$showsubcat = (get_searchbox_value($brsectiontype, 'showsubcat') || ($allowspecial && get_searchbox_value($spsectiontype, 'showsubcat'))); $showsubcat = (get_searchbox_value($brsectiontype, 'showsubcat') || ($allowspecial && get_searchbox_value($spsectiontype, 'showsubcat')));
$showsource = (get_searchbox_value($brsectiontype, 'showsource') || ($allowspecial && get_searchbox_value($spsectiontype, 'showsource'))); //whether show sources or not $showsource = (get_searchbox_value($brsectiontype, 'showsource') || ($allowspecial && get_searchbox_value($spsectiontype, 'showsource'))); //whether show sources or not
$showmedium = (get_searchbox_value($brsectiontype, 'showmedium') || ($allowspecial && get_searchbox_value($spsectiontype, 'showmedium'))); //whether show media or not $showmedium = (get_searchbox_value($brsectiontype, 'showmedium') || ($allowspecial && get_searchbox_value($spsectiontype, 'showmedium'))); //whether show media or not
@@ -395,6 +396,7 @@ if ($showprocessing) $processings = searchbox_item_list("processings");
if ($showteam) $teams = searchbox_item_list("teams"); if ($showteam) $teams = searchbox_item_list("teams");
if ($showaudiocodec) $audiocodecs = searchbox_item_list("audiocodecs"); if ($showaudiocodec) $audiocodecs = searchbox_item_list("audiocodecs");
} }
*/
print ("<table border=0 cellspacing=0 cellpadding=5 width=".CONTENT_WIDTH.">"); print ("<table border=0 cellspacing=0 cellpadding=5 width=".CONTENT_WIDTH.">");
form ("tracker"); form ("tracker");
if ($type == 'saved') if ($type == 'saved')
@@ -403,6 +405,7 @@ if ($showaudiocodec) $audiocodecs = searchbox_item_list("audiocodecs");
tr_small($lang_usercp['row_email_notification'], "<input type=checkbox name=pmnotif" . (strpos($CURUSER['notifs'], "[pm]") !== false ? " checked" : "") . " value=yes> ".$lang_usercp['checkbox_notification_received_pm']."<br />\n<input type=checkbox name=emailnotif" . (strpos($CURUSER['notifs'], "[email]") !== false ? " checked" : "") . " value=\"yes\" /> ".$lang_usercp['checkbox_notification_default_categories'], 1); tr_small($lang_usercp['row_email_notification'], "<input type=checkbox name=pmnotif" . (strpos($CURUSER['notifs'], "[pm]") !== false ? " checked" : "") . " value=yes> ".$lang_usercp['checkbox_notification_received_pm']."<br />\n<input type=checkbox name=emailnotif" . (strpos($CURUSER['notifs'], "[email]") !== false ? " checked" : "") . " value=\"yes\" /> ".$lang_usercp['checkbox_notification_default_categories'], 1);
//no this option //no this option
$brenablecatrow = false; $brenablecatrow = false;
/*
$categories = "<table>".($allowspecial ? "<tr><td class=embedded align=left><font class=big>".$lang_usercp['text_at_browse_page']."</font></td></tr></table><table>" : "")."<tr><td class=embedded align=left><b>".($brenablecatrow == true ? $brcatrow[0] : $lang_usercp['text_category'])."</b></td></tr><tr>"; $categories = "<table>".($allowspecial ? "<tr><td class=embedded align=left><font class=big>".$lang_usercp['text_at_browse_page']."</font></td></tr></table><table>" : "")."<tr><td class=embedded align=left><b>".($brenablecatrow == true ? $brcatrow[0] : $lang_usercp['text_category'])."</b></td></tr><tr>";
$i = 0; $i = 0;
foreach ($brcats as $cat)//print category list of Torrents section foreach ($brcats as $cat)//print category list of Torrents section
@@ -536,7 +539,12 @@ if ($showaudiocodec) $audiocodecs = searchbox_item_list("audiocodecs");
$categories .= "<tr><td class=bottom><b>".$lang_usercp['text_show_dead_active']."</b><br /><select name=\"incldead\"><option value=\"0\" ".(strpos($CURUSER['notifs'], "[incldead=0]") !== false ? " selected" : "").">".$lang_usercp['select_including_dead']."</option><option value=\"1\" ".(strpos($CURUSER['notifs'], "[incldead=1]") !== false || strpos($CURUSER['notifs'], "incldead") == false ? " selected" : "").">".$lang_usercp['select_active']."</option><option value=\"2\" ".(strpos($CURUSER['notifs'], "[incldead=2]") !== false ? " selected" : "").">".$lang_usercp['select_dead']."</option></select></td><td class=bottom align=left><b>".$lang_usercp['text_show_special_torrents']."</b><br /><select name=\"spstate\"><option value=\"0\" ".($special_state == 0 ? " selected" : "").">".$lang_usercp['select_all']."</option>".promotion_selection($special_state)."</select></td><td class=bottom><b>".$lang_usercp['text_show_bookmarked']."</b><br /><select name=\"inclbookmarked\"><option value=\"0\" ".(strpos($CURUSER['notifs'], "[inclbookmarked=0]") !== false ? " selected" : "").">".$lang_usercp['select_all']."</option><option value=\"1\" ".(strpos($CURUSER['notifs'], "[inclbookmarked=1]") !== false ? " selected" : "")." >".$lang_usercp['select_bookmarked']."</option><option value=\"2\" ".(strpos($CURUSER['notifs'], "[inclbookmarked=2]") !== false ? " selected" : "").">".$lang_usercp['select_bookmarked_exclude']."</option></select></td></tr>"; $categories .= "<tr><td class=bottom><b>".$lang_usercp['text_show_dead_active']."</b><br /><select name=\"incldead\"><option value=\"0\" ".(strpos($CURUSER['notifs'], "[incldead=0]") !== false ? " selected" : "").">".$lang_usercp['select_including_dead']."</option><option value=\"1\" ".(strpos($CURUSER['notifs'], "[incldead=1]") !== false || strpos($CURUSER['notifs'], "incldead") == false ? " selected" : "").">".$lang_usercp['select_active']."</option><option value=\"2\" ".(strpos($CURUSER['notifs'], "[incldead=2]") !== false ? " selected" : "").">".$lang_usercp['select_dead']."</option></select></td><td class=bottom align=left><b>".$lang_usercp['text_show_special_torrents']."</b><br /><select name=\"spstate\"><option value=\"0\" ".($special_state == 0 ? " selected" : "").">".$lang_usercp['select_all']."</option>".promotion_selection($special_state)."</select></td><td class=bottom><b>".$lang_usercp['text_show_bookmarked']."</b><br /><select name=\"inclbookmarked\"><option value=\"0\" ".(strpos($CURUSER['notifs'], "[inclbookmarked=0]") !== false ? " selected" : "").">".$lang_usercp['select_all']."</option><option value=\"1\" ".(strpos($CURUSER['notifs'], "[inclbookmarked=1]") !== false ? " selected" : "")." >".$lang_usercp['select_bookmarked']."</option><option value=\"2\" ".(strpos($CURUSER['notifs'], "[inclbookmarked=2]") !== false ? " selected" : "").">".$lang_usercp['select_bookmarked_exclude']."</option></select></td></tr>";
$categories .= "</table>"; $categories .= "</table>";
tr_small($lang_usercp['row_browse_default_categories'],$categories,1); */
$categories = build_search_box_category_table($browsecatmode, 'yes','torrents.php?allsec=1', false, 3, $CURUSER['notifs']);
$delimiter = '<div style="height: 1px;background-color: #eee;margin: 10px 0"></div>';
$categoriesSpecial = build_search_box_category_table($specialcatmode, 'yes','torrents.php?allsec=1', false, 3, $CURUSER['notifs']);
$extra = "<table><caption><font class='big'>{$lang_usercp['text_additional_selection']}</font></caption><tr><td class=bottom><b>".$lang_usercp['text_show_dead_active']."</b><br /><select name=\"incldead\"><option value=\"0\" ".(strpos($CURUSER['notifs'], "[incldead=0]") !== false ? " selected" : "").">".$lang_usercp['select_including_dead']."</option><option value=\"1\" ".(strpos($CURUSER['notifs'], "[incldead=1]") !== false || strpos($CURUSER['notifs'], "incldead") == false ? " selected" : "").">".$lang_usercp['select_active']."</option><option value=\"2\" ".(strpos($CURUSER['notifs'], "[incldead=2]") !== false ? " selected" : "").">".$lang_usercp['select_dead']."</option></select></td><td class=bottom align=left><b>".$lang_usercp['text_show_special_torrents']."</b><br /><select name=\"spstate\"><option value=\"0\" ".($special_state == 0 ? " selected" : "").">".$lang_usercp['select_all']."</option>".promotion_selection($special_state)."</select></td><td class=bottom><b>".$lang_usercp['text_show_bookmarked']."</b><br /><select name=\"inclbookmarked\"><option value=\"0\" ".(strpos($CURUSER['notifs'], "[inclbookmarked=0]") !== false ? " selected" : "").">".$lang_usercp['select_all']."</option><option value=\"1\" ".(strpos($CURUSER['notifs'], "[inclbookmarked=1]") !== false ? " selected" : "")." >".$lang_usercp['select_bookmarked']."</option><option value=\"2\" ".(strpos($CURUSER['notifs'], "[inclbookmarked=2]") !== false ? " selected" : "").">".$lang_usercp['select_bookmarked_exclude']."</option></select></td></tr></table>";
tr_small($lang_usercp['row_browse_default_categories'],$categories . $delimiter . $categoriesSpecial . $delimiter . $extra,1);
$ss_r = sql_query("SELECT * FROM stylesheets") or die; $ss_r = sql_query("SELECT * FROM stylesheets") or die;
$ss_sa = array(); $ss_sa = array();
while ($ss_a = mysql_fetch_array($ss_r)) while ($ss_a = mysql_fetch_array($ss_r))
+11 -3
View File
@@ -147,6 +147,13 @@ return [
'pos_state' => '置顶', 'pos_state' => '置顶',
'sp_state' => '优惠', 'sp_state' => '优惠',
'visible' => '活种', 'visible' => '活种',
'source' => '来源',
'codec' => '编码',
'audiocodec' => '音频编码',
'medium' => '媒介',
'team' => '制作组',
'processing' => '处理',
'standard' => '分辨率',
], ],
'hit_and_run' => [ 'hit_and_run' => [
'label' => '用户 H&R', 'label' => '用户 H&R',
@@ -231,8 +238,9 @@ return [
], ],
'search_box' => [ 'search_box' => [
'label' => '分区', 'label' => '分区',
'name' => '名', 'name' => '名',
'section_name' => '名称', 'section_name' => '分区名称',
'section_name_help' => '若设置,显示在菜单上',
'is_default' => '是否默认', 'is_default' => '是否默认',
'showsubcat' => '次分类', 'showsubcat' => '次分类',
'taxonomies' => '分类法', 'taxonomies' => '分类法',
@@ -246,7 +254,7 @@ return [
'custom_fields_display_name' => '自定义字段展示名称', 'custom_fields_display_name' => '自定义字段展示名称',
'custom_fields_display' => '自定义字段展示', 'custom_fields_display' => '自定义字段展示',
'custom_fields_display_help' => '使用特殊的标签代表字段的名称和值,如某字段其 Name 为 artist,则它的名称为:<%artist.label%>,它的值为:<%artist.value%>', 'custom_fields_display_help' => '使用特殊的标签代表字段的名称和值,如某字段其 Name 为 artist,则它的名称为:<%artist.label%>,它的值为:<%artist.value%>',
'category' => '分类', 'category' => '分类',
'torrent_field_duplicate' => '种子表字段::field 不能重复使用!', 'torrent_field_duplicate' => '种子表字段::field 不能重复使用!',
'taxonomy' => [ 'taxonomy' => [
'name' => '名称', 'name' => '名称',
+1
View File
@@ -2,4 +2,5 @@
return [ return [
'invalid_argument' => '参数错误', 'invalid_argument' => '参数错误',
'select_one_please' => '请选择',
]; ];