1 | <?php |
||
2 | |||
3 | namespace App\Http\Controllers; |
||
4 | |||
5 | use Blacklight\Contents; |
||
0 ignored issues
–
show
|
|||
6 | use Illuminate\Http\Request; |
||
7 | |||
8 | class ContentController extends BasePageController |
||
9 | { |
||
10 | /** |
||
11 | * @return \Illuminate\Http\JsonResponse|\Illuminate\View\View |
||
12 | * |
||
13 | * @throws \Exception |
||
14 | */ |
||
15 | public function show(Request $request) |
||
16 | { |
||
17 | $contents = new Contents; |
||
18 | |||
19 | $role = $this->userdata->role ?? 0; |
||
20 | |||
21 | /* The role column in the content table values are : |
||
22 | * 1 = logged in users |
||
23 | * 2 = admins |
||
24 | * |
||
25 | * The user role values are: |
||
26 | * 1 = user |
||
27 | * 2 = admin |
||
28 | * 3 = disabled |
||
29 | * 4 = moderator |
||
30 | * |
||
31 | * Admins and mods should be the only ones to see admin content. |
||
32 | */ |
||
33 | $isAdmin = ($role === 2 || $role === 4); |
||
34 | |||
35 | $contentId = 0; |
||
36 | if ($request->has('id')) { |
||
37 | $contentId = $request->input('id'); |
||
38 | } |
||
39 | |||
40 | $contentPage = false; |
||
41 | if ($request->has('page')) { |
||
42 | $contentPage = $request->input('page'); |
||
43 | } |
||
44 | |||
45 | if ($contentId === 0 && $contentPage === 'content') { |
||
46 | $content = $contents->getAllButFront(); |
||
47 | $isFront = false; |
||
48 | $meta_title = 'Contents page'; |
||
49 | $meta_keywords = 'contents'; |
||
50 | $meta_description = 'This is the contents page.'; |
||
51 | } elseif ($contentId !== 0 && $contentPage !== false) { |
||
52 | $content = [$contents->getByID($contentId, $role)]; |
||
53 | $isFront = false; |
||
54 | $meta_title = 'Contents page'; |
||
55 | $meta_keywords = 'contents'; |
||
56 | $meta_description = 'This is the contents page.'; |
||
57 | } else { |
||
58 | $content = $contents->getFrontPage(); |
||
59 | $index = $contents->getIndex(); |
||
60 | $isFront = true; |
||
61 | $meta_title = $index->title ?? 'Contents page'; |
||
62 | $meta_keywords = $index->metakeyword ?? 'contents'; |
||
63 | $meta_description = $index->metadescription ?? 'This is the contents page.'; |
||
64 | } |
||
65 | |||
66 | if (empty($content)) { |
||
67 | return response()->json(['message' => 'There is nothing to see here, no content provided.'], 404); |
||
68 | } |
||
69 | |||
70 | $this->viewData = array_merge($this->viewData, [ |
||
71 | 'content' => $content, |
||
72 | 'admin' => $isAdmin, |
||
73 | 'front' => $isFront, |
||
74 | 'meta_title' => $meta_title, |
||
75 | 'meta_keywords' => $meta_keywords, |
||
76 | 'meta_description' => $meta_description, |
||
77 | ]); |
||
78 | |||
79 | return view('content.index', $this->viewData); |
||
80 | } |
||
81 | } |
||
82 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths