1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Http\Controllers; |
4
|
|
|
|
5
|
|
|
use Blacklight\Contents; |
|
|
|
|
6
|
|
|
use Illuminate\Http\Request; |
7
|
|
|
|
8
|
|
|
class ContentController extends BasePageController |
9
|
|
|
{ |
10
|
|
|
/** |
11
|
|
|
* @return \Illuminate\Http\JsonResponse|void |
12
|
|
|
* |
13
|
|
|
* @throws \Exception |
14
|
|
|
*/ |
15
|
|
|
public function show(Request $request) |
16
|
|
|
{ |
17
|
|
|
$this->setPreferences(); |
18
|
|
|
$contents = new Contents; |
19
|
|
|
|
20
|
|
|
$role = $this->userdata->role ?? 0; |
21
|
|
|
|
22
|
|
|
/* The role column in the content table values are : |
23
|
|
|
* 1 = logged in users |
24
|
|
|
* 2 = admins |
25
|
|
|
* |
26
|
|
|
* The user role values are: |
27
|
|
|
* 1 = user |
28
|
|
|
* 2 = admin |
29
|
|
|
* 3 = disabled |
30
|
|
|
* 4 = moderator |
31
|
|
|
* |
32
|
|
|
* Admins and mods should be the only ones to see admin content. |
33
|
|
|
*/ |
34
|
|
|
$this->smarty->assign('admin', (($role === 2 || $role === 4) ? 'true' : 'false')); |
35
|
|
|
|
36
|
|
|
$contentId = 0; |
37
|
|
|
if ($request->has('id')) { |
38
|
|
|
$contentId = $request->input('id'); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
$contentPage = false; |
42
|
|
|
if ($request->has('page')) { |
43
|
|
|
$contentPage = $request->input('page'); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
if ($contentId === 0 && $contentPage === 'content') { |
47
|
|
|
$content = $contents->getAllButFront(); |
48
|
|
|
$this->smarty->assign('front', false); |
49
|
|
|
$meta_title = 'Contents page'; |
50
|
|
|
$meta_keywords = 'contents'; |
51
|
|
|
$meta_description = 'This is the contents page.'; |
52
|
|
|
} elseif ($contentId !== 0 && $contentPage !== false) { |
53
|
|
|
$content = [$contents->getByID($contentId, $role)]; |
54
|
|
|
$this->smarty->assign('front', false); |
55
|
|
|
$meta_title = 'Contents page'; |
56
|
|
|
$meta_keywords = 'contents'; |
57
|
|
|
$meta_description = 'This is the contents page.'; |
58
|
|
|
} else { |
59
|
|
|
$content = $contents->getFrontPage(); |
60
|
|
|
$index = $contents->getIndex(); |
61
|
|
|
$this->smarty->assign('front', true); |
62
|
|
|
$meta_title = $index->title ?? 'Contents page'; |
63
|
|
|
$meta_keywords = $index->metakeyword ?? 'contents'; |
64
|
|
|
$meta_description = $index->metadescription ?? 'This is the contents page.'; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
if (empty($content)) { |
68
|
|
|
return response()->json(['message' => 'There is nothing to see here, no content provided.'], 404); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
$this->smarty->assign('content', $content); |
72
|
|
|
|
73
|
|
|
$content = $this->smarty->fetch('content.tpl'); |
74
|
|
|
$this->smarty->assign(compact('content', 'meta_title', 'meta_keywords', 'meta_description')); |
75
|
|
|
$this->pagerender(); |
76
|
|
|
} |
77
|
|
|
} |
78
|
|
|
|
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