fix bannedemails no effect

This commit is contained in:
xiaomlove
2022-11-24 18:51:03 +08:00
parent 56d4968c09
commit 54d9d5c796
13 changed files with 51 additions and 56 deletions

View File

@@ -72,7 +72,8 @@ class TagResource extends Resource
Tables\Columns\TextColumn::make('border_radius')->label(__('label.tag.border_radius')),
Tables\Columns\TextColumn::make('priority')->label(__('label.priority'))->sortable(),
Tables\Columns\TextColumn::make('torrents_count')->label(__('label.tag.torrents_count')),
Tables\Columns\TextColumn::make('updated_at')->dateTime()->label(__('label.updated_at')),
Tables\Columns\TextColumn::make('torrents_sum_size')->label(__('label.tag.torrents_sum_size'))->formatStateUsing(fn ($state) => mksize($state)),
// Tables\Columns\TextColumn::make('updated_at')->dateTime()->label(__('label.updated_at')),
])
->defaultSort('priority', 'desc')
->filters([

View File

@@ -23,7 +23,7 @@ class ListTags extends PageList
protected function getTableQuery(): Builder
{
return Tag::query()->withCount('torrents');
return Tag::query()->withCount('torrents')->withSum('torrents', 'size');
}
}

View File

@@ -151,6 +151,11 @@ class TorrentResource extends Resource
Tables\Filters\SelectFilter::make('hr')
->options(self::getYesNoOptions())
->label(__('label.torrent.hr')),
Tables\Filters\SelectFilter::make('tags')
->relationship('tags', 'name')
->label(__('label.tag.label'))
,
])
->actions(self::getActions())
->bulkActions(self::getBulkActions());

View File

@@ -75,6 +75,7 @@ class UserResource extends Resource
Tables\Columns\BadgeColumn::make('status')->colors(['success' => 'confirmed', 'warning' => 'pending'])->label(__("label.user.status")),
Tables\Columns\BadgeColumn::make('enabled')->colors(['success' => 'yes', 'danger' => 'no'])->label(__("label.user.enabled")),
Tables\Columns\BadgeColumn::make('downloadpos')->colors(['success' => 'yes', 'danger' => 'no'])->label(__("label.user.downloadpos")),
Tables\Columns\BadgeColumn::make('parked')->colors(['success' => 'yes', 'danger' => 'no'])->label(__("label.user.parked")),
Tables\Columns\TextColumn::make('added')->sortable()->dateTime('Y-m-d H:i')->label(__("label.added")),
Tables\Columns\TextColumn::make('last_access')->dateTime()->label(__("label.last_access")),
])
@@ -93,6 +94,7 @@ class UserResource extends Resource
Tables\Filters\SelectFilter::make('status')->options(['confirmed' => 'confirmed', 'pending' => 'pending'])->label(__('label.user.status')),
Tables\Filters\SelectFilter::make('enabled')->options(self::$yesOrNo)->label(__('label.user.enabled')),
Tables\Filters\SelectFilter::make('downloadpos')->options(self::$yesOrNo)->label(__('label.user.downloadpos')),
Tables\Filters\SelectFilter::make('parked')->options(self::$yesOrNo)->label(__('label.user.parked')),
])
->actions([
Tables\Actions\ViewAction::make(),

View File

@@ -1,11 +0,0 @@
<?php
namespace App\Models;
class Taxonomy extends NexusModel
{
protected $fillable = [
'mode', 'name', 'torrent_field', 'image', 'class_name', 'priority',
];
}

View File

@@ -1,38 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('taxonomies', function (Blueprint $table) {
$table->id();
$table->integer('mode')->default(0);
$table->string('name');
$table->string('torrent_field');
$table->string('image')->nullable(true);
$table->string('class_name')->nullable(true);
$table->integer('priority')->default(0);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('taxonomies');
}
};

View File

@@ -1,6 +1,6 @@
<?php
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.8.0');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2022-11-23');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2022-11-24');
defined('IN_TRACKER') || define('IN_TRACKER', false);
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");

View File

@@ -1481,10 +1481,21 @@ function safe_email($email) {
}
function check_email ($email) {
if(preg_match('/^[A-Za-z0-9][A-Za-z0-9_.+\-]*@[A-Za-z0-9][A-Za-z0-9_+\-]*(\.[A-Za-z0-9][A-Za-z0-9_+\-]*)+$/', $email))
if(!preg_match('/^[A-Za-z0-9][A-Za-z0-9_.+\-]*@[A-Za-z0-9][A-Za-z0-9_+\-]*(\.[A-Za-z0-9][A-Za-z0-9_+\-]*)+$/', $email)) {
return false;
}
$bannedEmails = mysql_fetch_assoc(sql_query('select * from bannedemails'));
$bannedEmailsArr = preg_split('/[\s]+/', $bannedEmails['value'] ?? '');
if (empty($bannedEmailsArr)) {
return true;
}
foreach ($bannedEmailsArr as $ban) {
if (str_ends_with($email, $ban)) {
do_log("[BANNED_EMAIL] email: $email is banned by record: $ban");
return false;
}
}
return true;
else
return false;
}
function sent_mail($to,$fromname,$fromemail,$subject,$body,$type = "confirmation",$showmsg=true,$multiple=false,$multiplemail='',$hdr_encoding = 'UTF-8', $specialcase = '') {
@@ -6011,6 +6022,7 @@ function calculate_harem_addition($uid)
function build_search_box_category_table($mode, $checkboxValue, $categoryHrefPrefix, $taxonomyHrefPrefix, $taxonomyNameLength, $checkedValues = '', array $options = [])
{
// dd($checkedValues, $taxonomyNameLength);
$searchBox = \App\Models\SearchBox::query()->with(['categories', 'categories.icon'])->findOrFail($mode);
$lang = get_langfolder_cookie();
$withTaxonomies = [];
@@ -6115,6 +6127,11 @@ TD;
$checked = '';
if (str_contains($checkedValues, "[{$namePrefix}{$item->id}]") || str_contains($checkedValues, "{$namePrefix}{$item->id}=1")) {
$checked = ' checked';
} elseif (!empty($options['user_notifs'])) {
$userNotifsKey = sprintf('[%s%s]', substr($torrentField, 0, 3), $item->id);
if (str_contains($options['user_notifs'], $userNotifsKey)) {
$checked = ' checked';
}
}
$tdContent = <<<TDCONTENT
<label><input type="checkbox" id="{$namePrefix}{$item->id}" name="{$namePrefix}{$item->id}" value="{$checkboxValue}"{$checked} />$afterInput</label>

View File

@@ -983,7 +983,7 @@ if ($allsec != 1 || $enablespecial != 'yes'){ //do not print searchbox if showin
// }
// ?>
<!-- </table>-->
<?php echo build_search_box_category_table($sectiontype, '1', '?', '?', 0, $_SERVER['QUERY_STRING'], ['select_unselect' => true])?>
<?php echo build_search_box_category_table($sectiontype, '1', '?', '?', 0, $_SERVER['QUERY_STRING'], ['select_unselect' => true, 'user_notifs' => $CURUSER['notifs']])?>
</td>
<td class="rowfollow" valign="middle">

View File

@@ -100,6 +100,8 @@ return [
'two_step_authentication' => 'Two-step authentication',
'seed_points' => 'Seed points',
'downloadpos' => 'Download privileges',
'parked' => 'Parked',
'offer_allowed_count' => 'Offer allowed count',
],
'medal' => [
'label' => 'Medal',
@@ -174,6 +176,7 @@ return [
'padding' => 'Padding',
'border_radius' => 'Border radius',
'torrents_count' => 'Torrents count',
'torrents_sum_size' => 'Torrents size',
],
'agent_allow' => [
'label' => 'Agent allow',

View File

@@ -100,6 +100,8 @@ return [
'two_step_authentication' => '两步验证',
'seed_points' => '做种积分',
'downloadpos' => '下载权限',
'parked' => '挂起',
'offer_allowed_count' => '候选通过数',
],
'medal' => [
'label' => '勋章',
@@ -174,6 +176,7 @@ return [
'padding' => '内边距',
'border_radius' => '边框圆角',
'torrents_count' => '种子数',
'torrents_sum_size' => '种子体积',
],
'agent_allow' => [
'label' => '允许客户端',

View File

@@ -100,6 +100,8 @@ return [
'two_step_authentication' => '兩步驗證',
'seed_points' => '做種積分',
'downloadpos' => '下載權限',
'parked' => '掛起',
'offer_allowed_count' => '候選通過數',
],
'medal' => [
'label' => '勛章',
@@ -174,6 +176,7 @@ return [
'padding' => '內邊距',
'border_radius' => '邊框圓角',
'torrents_count' => '種子數',
'torrents_sum_size' => '種子體積',
],
'agent_allow' => [
'label' => '允許客戶端',

View File

@@ -65,6 +65,16 @@
<td>{{$record->downloadpos}}</td>
<td></td>
</tr>
<tr>
<th>{{__('label.user.parked')}}</th>
<td>{{$record->parked}}</td>
<td></td>
</tr>
<tr>
<th>{{__('label.user.offer_allowed_count')}}</th>
<td>{{$record->offer_allowed_count}}</td>
<td></td>
</tr>
<tr>
<th>{{__('label.user.seed_points')}}</th>
<td>{{$record->seed_points}}</td>