Skip to content

Commit

Permalink
Merge pull request #968 from HDInnovations/2.x.x
Browse files Browse the repository at this point in the history
v2.2.3 Release
  • Loading branch information
HDVinnie authored Nov 17, 2019
2 parents cbc1cb9 + 0feb0bb commit d69b5c5
Show file tree
Hide file tree
Showing 29 changed files with 258 additions and 225 deletions.
4 changes: 2 additions & 2 deletions app/Http/Controllers/FollowController.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public function store(Request $request, $username)
$follow->user_id = $request->user()->id;
$follow->target_id = $user->id;
$follow->save();
if ($user->acceptsNotification($request->user(), $user->id, 'account', 'show_account_follow')) {
$user->notify(new NewFollow('user', $request->user(), $user->id, $follow));
if ($user->acceptsNotification($request->user(), $user, 'account', 'show_account_follow')) {
$user->notify(new NewFollow('user', $request->user(), $user, $follow));
}

return redirect()->route('users.show', ['username' => $user->username])
Expand Down
97 changes: 55 additions & 42 deletions app/Traits/Auditable.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ protected static function generate($action, $old = [], $new = [])
break;
}

return json_encode($data);
$clean = array_filter($data);

return json_encode($clean);
}

/**
Expand All @@ -135,7 +137,7 @@ public static function getUserId()
return;
}

return auth()->user()->getAuthIdentifier();
return auth()->user()->id;
}

/**
Expand All @@ -145,21 +147,25 @@ public static function getUserId()
*/
protected static function registerCreate($model)
{
// Generate the JSON to store
$data = self::generate('create', [], self::strip($model, $model->getAttributes()));
// Get auth (if any)
$userId = self::getUserId();
// Store record
$now = Carbon::now()->format('Y-m-d H:i:s');
DB::table('audits')->insert([
'user_id' => $userId,
'model_name' => class_basename($model),
'model_entry_id' => $model->{$model->getKeyName()},
'action' => 'create',
'record' => $data,
'created_at' => $now,
'updated_at' => $now,
]);

// Generate the JSON to store
$data = self::generate('create', [], self::strip($model, $model->getAttributes()));

if (! is_null($userId) && ! empty($data)) {
// Store record
$now = Carbon::now()->format('Y-m-d H:i:s');
DB::table('audits')->insert([
'user_id' => $userId,
'model_name' => class_basename($model),
'model_entry_id' => $model->{$model->getKeyName()},
'action' => 'create',
'record' => $data,
'created_at' => $now,
'updated_at' => $now,
]);
}
}

/**
Expand All @@ -169,22 +175,25 @@ protected static function registerCreate($model)
*/
protected static function registerUpdate($model)
{
// Strip data
// Generate the JSON to store
$data = self::generate('update', self::strip($model, $model->getOriginal()), self::strip($model, $model->getChanges()));
// Get auth (if any)
$userId = self::getUserId();
// Store record
$now = Carbon::now()->format('Y-m-d H:i:s');
DB::table('audits')->insert([
'user_id' => $userId,
'model_name' => class_basename($model),
'model_entry_id' => $model->{$model->getKeyName()},
'action' => 'update',
'record' => $data,
'created_at' => $now,
'updated_at' => $now,
]);

// Generate the JSON to store
$data = self::generate('update', self::strip($model, $model->getOriginal()), self::strip($model, $model->getChanges()));

if (! is_null($userId) && ! empty(json_decode($data, true))) {
// Store record
$now = Carbon::now()->format('Y-m-d H:i:s');
DB::table('audits')->insert([
'user_id' => $userId,
'model_name' => class_basename($model),
'model_entry_id' => $model->{$model->getKeyName()},
'action' => 'update',
'record' => $data,
'created_at' => $now,
'updated_at' => $now,
]);
}
}

/**
Expand All @@ -194,20 +203,24 @@ protected static function registerUpdate($model)
*/
protected static function registerDelete($model)
{
// Generate the JSON to store
$data = self::generate('delete', self::strip($model, $model->getAttributes()));
// Get auth (if any)
$userId = self::getUserId();
// Store record
$now = Carbon::now()->format('Y-m-d H:i:s');
DB::table('audits')->insert([
'user_id' => $userId,
'model_name' => class_basename($model),
'model_entry_id' => $model->{$model->getKeyName()},
'action' => 'delete',
'record' => $data,
'created_at' => $now,
'updated_at' => $now,
]);

// Generate the JSON to store
$data = self::generate('delete', self::strip($model, $model->getAttributes()));

if (! is_null($userId) && ! empty($data)) {
// Store record
$now = Carbon::now()->format('Y-m-d H:i:s');
DB::table('audits')->insert([
'user_id' => $userId,
'model_name' => class_basename($model),
'model_entry_id' => $model->{$model->getKeyName()},
'action' => 'delete',
'record' => $data,
'created_at' => $now,
'updated_at' => $now,
]);
}
}
}
2 changes: 1 addition & 1 deletion config/other.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
|
*/

'codebase' => 'UNIT3D Community Edition (Nex-Gen Torrent Tracker) v2.2.2',
'codebase' => 'UNIT3D Community Edition (Nex-Gen Torrent Tracker) v2.2.3',

/*
|--------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions config/unit3d.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
|
*/

'powered-by' => 'Powered By UNIT3D Community Edition v2.2.2',
'powered-by' => 'Powered By UNIT3D Community Edition v2.2.3',

/*
|--------------------------------------------------------------------------
Expand All @@ -44,6 +44,6 @@
|
*/

'version' => 'v2.2.2',
'version' => 'v2.2.3',

];
2 changes: 1 addition & 1 deletion resources/lang/en/articles.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

return [
'articles' => 'Articles',
'meta-articles' => 'Articles and news on the tracker and the community',
'meta-articles' => 'Articles and News on the tracker and the community',
'published-at' => 'Published On ',
'read-more' => 'Read More',
];
8 changes: 4 additions & 4 deletions resources/lang/en/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
'lost-username' => 'Forgot Your Username?',
'need-invite' => 'Open Registration Is Disabled and You Will Need A Invite To Gain Access!',
'newbie' => 'New To The Game',
'not-a-member' => 'Not yet member ? Signup in less than 30s.',
'not-a-member' => 'Not yet a member ? Signup in less than 30s.',
'not-activated' => 'This account has not been activated and is still in validating group. Please check your email for activation link. If you did not receive the activation code, please click "forgot password" and complete the steps.',
'password' => 'Password',
'proof-image' => 'Proof Image URL',
Expand All @@ -44,7 +44,7 @@
'signup' => 'Signup',
'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
'unlock' => 'Unlock',
'user-icon' => 'User icon',
'user-icon' => 'User Icon',
'username' => 'Username',
'veteran' => 'Experianced With Private Trackers',
'welcome' => 'Welcome Back!',
Expand All @@ -58,15 +58,15 @@
'subtitle' => 'Verification Required',
'title' => '2-Step Verification',
'titleFailed' => 'Verification Failed',
'titlePassed' => 'Good news everyone!',
'titlePassed' => 'Good News Everyone!',

'inputAlt1' => 'Code Input 1',
'inputAlt2' => 'Code Input 2',
'inputAlt3' => 'Code Input 3',
'inputAlt4' => 'Code Input 4',

'attemptsRemaining' => 'Attempt Remaining|Attempts Remaining',
'missingCode' => 'Didnt receive verification code?',
'missingCode' => 'Didn\'t receive verification code?',
'verifyButton' => 'Verify',

'exceededTitle' => 'Verification Attempts Exceeded',
Expand Down
4 changes: 4 additions & 0 deletions resources/lang/en/torrent.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
'dying-torrent' => 'Dying Torrent',
'dying-torrents' => 'Dying Torrents',
'encode-settings' => 'Encode Settings',
'end-year' => 'Year End',
'estimated-ratio' => 'Estimated Ratio after Download',
'failed' => 'Failed',
'feature' => 'Feature',
Expand Down Expand Up @@ -162,6 +163,7 @@
'special' => 'Special',
'special-freeleech' => 'Special Freeleech',
'staff-tools' => 'Staff Tools',
'start-year' => 'Start Year',
'started' => 'Started',
'status' => 'Status',
'statistics' => 'Statistics',
Expand Down Expand Up @@ -204,4 +206,6 @@
'view-more' => 'View more',
'view-trailer' => 'View trailer',
'votes' => 'Votes',
'year-range' => 'Year Range',

];
14 changes: 7 additions & 7 deletions resources/views/emails/activate.blade.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
@component('mail::message')
# @lang('email.register-header') {{ config('other.title') }} !
**@lang('email.register-code')**
@component('mail::button', ['url' => route('activate', $code), 'color' => 'blue'])
@lang('email.activate-account')
@endcomponent
<p>@lang('email.register-footer')</p>
<p style="word-wrap: break-word; overflow-wrap: break-word; word-break: break-word;">{{ route('activate', $code) }}</p>
# @lang('email.register-header') {{ config('other.title') }} !
**@lang('email.register-code')**
@component('mail::button', ['url' => route('activate', $code), 'color' => 'blue'])
@lang('email.activate-account')
@endcomponent
<p>@lang('email.register-footer')</p>
<p style="word-wrap: break-word; overflow-wrap: break-word; word-break: break-word;">{{ route('activate', $code) }}</p>
@endcomponent
8 changes: 3 additions & 5 deletions resources/views/emails/ban.blade.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
@component('mail::message')
# @lang('email.banned-header')!

**Reason:** {{ $ban->ban_reason }}

*@lang('email.banned-footer')*
# @lang('email.banned-header')!
**Reason:** {{ $ban->ban_reason }}
*@lang('email.banned-footer')*
@endcomponent
8 changes: 3 additions & 5 deletions resources/views/emails/contact.blade.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
@component('mail::message')
# @lang('email.contact-header') {{ $input['email'] }}

**@lang('email.contact-name'):** {{ $input['contact-name'] }}

**@lang('email.contact-message'):** {{ $input['message'] }}
# @lang('email.contact-header') {{ $input['email'] }}
**@lang('email.contact-name'):** {{ $input['contact-name'] }}
**@lang('email.contact-message'):** {{ $input['message'] }}
@endcomponent
13 changes: 5 additions & 8 deletions resources/views/emails/deny_application.blade.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
@component('mail::message')
# Your {{ config('other.title') }} Application

Your application has been denied for the following reason:

{{ $denied_message }}

Thanks,
{{ config('other.title') }}
# Your {{ config('other.title') }} Application
Your application has been denied for the following reason:
{{ $denied_message }}
Thanks,
{{ config('other.title') }}
@endcomponent
14 changes: 5 additions & 9 deletions resources/views/emails/disabled.blade.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
@component('mail::message')
# @lang('email.disabled-header')!

Your account has been flagged as inactive and placed within the disabled group. In order to keep your account you MUST
login within {{ config('other.soft_delete') }} days of receiving this email. Failure to do so will result in your
account
being permanently pruned from use on {{ config('other.title') }}! To avoid this in the future please login at least one
time
every {{ config('other.last_login') }} days.

# @lang('email.disabled-header')!
Your account has been flagged as inactive and placed within the disabled group. In order to keep your account you MUST
login within {{ config('other.soft_delete') }} days of receiving this email. Failure to do so will result in your account
being permanently pruned from use on {{ config('other.title') }}! To avoid this in the future please login at least one time
every {{ config('other.last_login') }} days.
@endcomponent
15 changes: 7 additions & 8 deletions resources/views/emails/invite.blade.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
@component('mail::message')
# @lang('email.invite-header') {{ config('other.title') }} !
**@lang('email.invite-message'):** @lang('email.invite-invited') {{ config('other.title') }}. {{ $invite->custom }}
@component('mail::button', ['url' => route('register', $invite->code), 'color' => 'blue'])
@lang('email.invite-signup')
@endcomponent
<p>@lang('email.register-footer')</p>
<p style="word-wrap: break-word; overflow-wrap: break-word; word-break: break-word;">
{{ route('register', $invite->code) }}</p>
# @lang('email.invite-header') {{ config('other.title') }} !
**@lang('email.invite-message'):** @lang('email.invite-invited') {{ config('other.title') }}. {{ $invite->custom }}
@component('mail::button', ['url' => route('register', $invite->code), 'color' => 'blue'])
@lang('email.invite-signup')
@endcomponent
<p>@lang('email.register-footer')</p>
<p style="word-wrap: break-word; overflow-wrap: break-word; word-break: break-word;">{{ route('register', $invite->code) }}</p>
@endcomponent
16 changes: 8 additions & 8 deletions resources/views/emails/new_reply.blade.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
@component('mail::message')
# @lang('email.newreply-header'): {{ $topic->name }}
**@lang('email.newreply-message'):**
<a href="{{ route('users.show', ['username' => $user->username]) }}">{{ $user->username }}</a>
{{ strtolower(trans('email.newreply-replied')) }}
<a href="{{ route('forum_topic', ['id' => $topic->id]) }}">{{ $topic->name }}</a>
@component('mail::button', ['url' => route('forum_topic', ['id' => $topic->id]), 'color' => 'blue'])
@lang('email.newreply-view')
@endcomponent
# @lang('email.newreply-header'): {{ $topic->name }}
**@lang('email.newreply-message'):**
<a href="{{ route('users.show', ['username' => $user->username]) }}">{{ $user->username }}</a>
{{ strtolower(trans('email.newreply-replied')) }}
<a href="{{ route('forum_topic', ['id' => $topic->id]) }}">{{ $topic->name }}</a>
@component('mail::button', ['url' => route('forum_topic', ['id' => $topic->id]), 'color' => 'blue'])
@lang('email.newreply-view')
@endcomponent
@endcomponent
6 changes: 2 additions & 4 deletions resources/views/emails/pruned.blade.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
@component('mail::message')
# @lang('email.pruned-header')!

Your account has been permanently pruned from use on {{ config('other.title') }} due to prolonged inactivity!

# @lang('email.pruned-header')!
Your account has been permanently pruned from use on {{ config('other.title') }} due to prolonged inactivity!
@endcomponent
13 changes: 5 additions & 8 deletions resources/views/emails/report.blade.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
@component('mail::message')
# @lang('email.report-header') {{ config('other.title') }} !
**@lang('email.report-email'):** {{ $report->email }}

**@lang('email.report-link'):** {{ $report->url }}

**@lang('email.report-link-hash'):** {{ $report->link->hash }}

**@lang('email.report-comment'):** {{ $report->comment }}
# @lang('email.report-header') {{ config('other.title') }} !
**@lang('email.report-email'):** {{ $report->email }}
**@lang('email.report-link'):** {{ $report->url }}
**@lang('email.report-link-hash'):** {{ $report->link->hash }}
**@lang('email.report-comment'):** {{ $report->comment }}
@endcomponent
10 changes: 4 additions & 6 deletions resources/views/emails/test_email.blade.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
@component('mail::message')
# Test Email

Your test email has been successfully delivered! Looks like your mail configs are on point!

Thanks,
{{ config('other.title') }}
# Test Email
Your test email has been successfully delivered! Looks like your mail configs are on point!
Thanks,
{{ config('other.title') }}
@endcomponent
8 changes: 3 additions & 5 deletions resources/views/emails/unban.blade.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
@component('mail::message')
# @lang('email.unban-header')!

**Reason:** {{ $ban->unban_reason }}

*@lang('email.unban-footer')*
# @lang('email.unban-header')!
**Reason:** {{ $ban->unban_reason }}
*@lang('email.unban-footer')*
@endcomponent
Loading

0 comments on commit d69b5c5

Please sign in to comment.