1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
|
3
|
|
|
use html_go\model\Config; |
4
|
|
|
use html_go\Utils; |
|
|
|
|
5
|
|
|
|
6
|
|
|
return [ |
7
|
|
|
HTTP_GET => [ |
8
|
|
|
ADMIN_DASHBOARD_KEY => (object) [ |
9
|
|
|
'cb' => 'get_dashboard_view_content_object' |
10
|
|
|
], |
11
|
|
|
CAT_INDEX_KEY => (object) [ |
12
|
|
|
'cb' => 'get_category_listview_content_object' |
13
|
|
|
], |
14
|
|
|
CAT_INDEX_KEY.FWD_SLASH.ADMIN_ACTION_EDIT => (object) [ |
15
|
|
|
'cb' => 'get_category_edit_object' |
16
|
|
|
], |
17
|
|
|
CAT_INDEX_KEY.FWD_SLASH.ADMIN_ACTION_ADD => (object) [ |
18
|
|
|
'cb' => 'get_category_add_content_object' |
19
|
|
|
], |
20
|
|
|
CAT_INDEX_KEY.FWD_SLASH.ADMIN_ACTION_DELETE => (object) [ |
21
|
|
|
'cb' => 'get_category_delete_object' |
22
|
|
|
] |
23
|
|
|
], |
24
|
|
|
HTTP_POST => [ |
25
|
|
|
CAT_INDEX_KEY => (object) [ |
26
|
|
|
'cb' => function (array $data): \stdClass { |
27
|
|
|
if (empty($data[ADMIN_ACTION_CANCEL]) === false) { |
28
|
|
|
header('Location: '.get_config()->getString(Config::KEY_SITE_URL).FWD_SLASH.$data[ADMIN_CONTEXT_STR].FWD_SLASH.'category'); |
29
|
|
|
return new \stdClass(); |
30
|
|
|
} |
31
|
|
|
if (empty($data[ADMIN_ACTION_STR])) { |
32
|
|
|
return new \stdClass(); // Force not-found 404 |
33
|
|
|
} |
34
|
|
|
$content = new \stdClass(); |
35
|
|
|
$action = $data[ADMIN_ACTION_STR]; |
36
|
|
|
switch ($action) { |
37
|
|
|
case ADMIN_ACTION_ADD: |
38
|
|
|
if (save_category($data)) { |
39
|
|
|
header('Location: '.get_config()->getString(Config::KEY_SITE_URL).FWD_SLASH.$data[ADMIN_CONTEXT_STR].FWD_SLASH.'category'); |
40
|
|
|
} else { |
41
|
|
|
$content = get_category_add_content_object(); |
42
|
|
|
$content->list[0] = (object)$data; |
43
|
|
|
print_r($data); |
44
|
|
|
} |
45
|
|
|
break; |
46
|
|
|
case ADMIN_ACTION_EDIT: |
47
|
|
|
if (update_category($data)) { |
48
|
|
|
header('Location: '.get_config()->getString(Config::KEY_SITE_URL).FWD_SLASH.$data[ADMIN_CONTEXT_STR].FWD_SLASH.'category'); |
49
|
|
|
} else { |
50
|
|
|
exit('Update: validation failed'); |
|
|
|
|
51
|
|
|
} |
52
|
|
|
break; |
53
|
|
|
case ADMIN_ACTION_DELETE: |
54
|
|
|
break; |
55
|
|
|
default: |
56
|
|
|
break; |
57
|
|
|
} |
58
|
|
|
return $content; |
59
|
|
|
} |
60
|
|
|
] |
61
|
|
|
] |
62
|
|
|
]; |
63
|
|
|
|
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