Skip to content

Commit ab15571

Browse files
committed
Disabling footer pages when inactive in config
Footer pages now return an error 404 when disabled in the config.
1 parent 72387e6 commit ab15571

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

app/Http/Controllers/AdminController.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -315,16 +315,27 @@ public function delFavicon()
315315
}
316316

317317
//View any of the pages: contact, terms, privacy
318-
public function pages(request $request)
318+
public function pages(Request $request)
319319
{
320320
$name = $request->name;
321-
321+
322+
$enabledPages = [
323+
'contact' => env('DISPLAY_FOOTER_CONTACT', false),
324+
'terms' => env('DISPLAY_FOOTER_TERMS', false),
325+
'privacy' => env('DISPLAY_FOOTER_PRIVACY', false),
326+
// Add other pages here as needed
327+
];
328+
329+
if (!array_key_exists($name, $enabledPages) || !$enabledPages[$name]) {
330+
return abort(404);
331+
}
332+
322333
try {
323334
$data['page'] = Page::select($name)->first();
324335
} catch (Exception $e) {
325336
return abort(404);
326337
}
327-
338+
328339
return view('pages', ['data' => $data, 'name' => $name]);
329340
}
330341

0 commit comments

Comments
 (0)