You've already forked Atomcms-edit
Fix security, performance, and code quality issues across CMS
Security:
- Replace unescaped {!! !!} with Purify::clean() in 15+ Blade templates (XSS)
- Add rate limiting to register (3/hr), upload (10/min), SSE (6/min)
- Add max:5000 validation on article comments
- Remove duplicate exception handler callback
Hardcoded paths:
- Replace ~44 /var/www/ hardcoded paths with env() configs
- CatalogService (13), AutoDetectService (18), Commandocentrum (11), AppServiceProvider (2)
Performance:
- Add 10 missing database indexes (radio_song_requests, help_center_tickets, etc.)
- Replace Cache::flush() with targeted Cache::forget() in RadioSettings
- Cache getCachedCategories() in TicketController (N+1 fix)
- Remove redundant top-3 leaderboard query
Bug fixes:
- Fix undefined $enabled variable → $isOnline in radio index view
- Add getAvatarAttribute() accessor for non-existent avatar column
- Fix User::guilds() from wrong HasMany to HasManyThrough
Code quality:
- Replace file_get_contents with Http::timeout(10) in TraxService
- Remove commented Echo/Pusher boilerplate in bootstrap.js
- Remove TODO/FIXME comments from logo-generator templates
- Replace hardcoded Turnstile CDN URL with config()
- Restore QUEUE_CONNECTION=redis in .env.example files
This commit is contained in:
@@ -124,6 +124,10 @@ class AuthController extends Controller
|
||||
{
|
||||
$article = WebsiteArticle::where('slug', $slug)->firstOrFail();
|
||||
|
||||
$request->validate([
|
||||
'comment' => ['required', 'string', 'max:5000'],
|
||||
]);
|
||||
|
||||
$comment = $article->comments()->create([
|
||||
'user_id' => $request->user()->id,
|
||||
'comment' => strip_tags((string) $request->input('comment')),
|
||||
|
||||
@@ -23,14 +23,7 @@ class RadioLeaderboardController extends Controller
|
||||
default => $this->getAllTimeLeaderboard(),
|
||||
};
|
||||
|
||||
// Extract top 3 from already-fetched data
|
||||
$topUserData = array_slice($users, 0, 3);
|
||||
$topUserIds = array_column($topUserData, 'id');
|
||||
$topUsers = User::whereIn('id', $topUserIds)
|
||||
->get()
|
||||
->keyBy('id');
|
||||
|
||||
return view('community.radio.leaderboard', ['users' => $users, 'topUsers' => $topUsers, 'period' => $period]);
|
||||
return view('community.radio.leaderboard', ['users' => $users, 'period' => $period]);
|
||||
}
|
||||
|
||||
private function getAllTimeLeaderboard(): array
|
||||
@@ -43,7 +36,7 @@ class RadioLeaderboardController extends Controller
|
||||
'rank' => $index + 1,
|
||||
'id' => $user->id,
|
||||
'username' => $user->username,
|
||||
'avatar' => $user->avatar ?? null,
|
||||
'avatar' => $user->avatar,
|
||||
'points' => $user->radio_points,
|
||||
])
|
||||
->toArray();
|
||||
@@ -79,7 +72,7 @@ class RadioLeaderboardController extends Controller
|
||||
'rank' => $index + 1,
|
||||
'id' => $item->user_id,
|
||||
'username' => $user?->username ?? 'Onbekend',
|
||||
'avatar' => $user?->avatar ?? null,
|
||||
'avatar' => $user?->avatar,
|
||||
'points' => (int) $item->total_points,
|
||||
];
|
||||
})->toArray();
|
||||
|
||||
@@ -9,6 +9,7 @@ use App\Models\Help\WebsiteHelpCenterTicket;
|
||||
use App\Models\Help\WebsiteHelpCenterTicketReply;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class TicketController extends Controller
|
||||
@@ -26,10 +27,15 @@ class TicketController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
private function getCachedCategories(): \Illuminate\Database\Eloquent\Collection
|
||||
{
|
||||
return Cache::remember('help_categories', 3600, fn () => WebsiteHelpCenterCategory::get());
|
||||
}
|
||||
|
||||
public function create(): View
|
||||
{
|
||||
return view('help-center.tickets.create', [
|
||||
'categories' => WebsiteHelpCenterCategory::get(),
|
||||
'categories' => $this->getCachedCategories(),
|
||||
'openTickets' => WebsiteHelpCenterTicket::where('open', true)->where('user_id', Auth::id())->get(),
|
||||
]);
|
||||
}
|
||||
@@ -38,6 +44,8 @@ class TicketController extends Controller
|
||||
{
|
||||
Auth::user()->tickets()->create($request->validated());
|
||||
|
||||
Cache::forget('help_categories');
|
||||
|
||||
return redirect()->back()->with('success', __('Ticket submitted!'));
|
||||
}
|
||||
|
||||
@@ -57,7 +65,7 @@ class TicketController extends Controller
|
||||
|
||||
return view('help-center.tickets.edit', [
|
||||
'ticket' => $ticket,
|
||||
'categories' => WebsiteHelpCenterCategory::get(),
|
||||
'categories' => $this->getCachedCategories(),
|
||||
'openTickets' => WebsiteHelpCenterTicket::where('open', true)->where('id', '!=', $ticket->id)->where('user_id', Auth::id())->get(),
|
||||
]);
|
||||
}
|
||||
@@ -72,6 +80,8 @@ class TicketController extends Controller
|
||||
|
||||
$ticket->update($request->validated());
|
||||
|
||||
Cache::forget('help_categories');
|
||||
|
||||
return to_route('help-center.ticket.show', $ticket)->with('success', __('Ticket updated!'));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user