This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Kifekenny\Comment; |
||
4 | |||
5 | use \Anax\Configure\ConfigureInterface; |
||
6 | use \Anax\Configure\ConfigureTrait; |
||
7 | use \Anax\DI\InjectionAwareInterface; |
||
8 | use \Anax\DI\InjectionAwareTrait; |
||
9 | use \Kifekenny\Comment\Comment; |
||
10 | use \Kifekenny\Comment\HTMLForm\Com2Create; |
||
11 | use \Kifekenny\Comment\HTMLForm\Com2Update; |
||
12 | use \Kifekenny\Comment\HTMLForm\Com2Delete; |
||
13 | use \Kifekenny\Comment\HTMLForm\Com2Session; |
||
14 | |||
15 | /** |
||
16 | * A controller class. |
||
17 | */ |
||
18 | class Comment2Controller implements |
||
19 | ConfigureInterface, |
||
20 | InjectionAwareInterface |
||
21 | { |
||
22 | use ConfigureTrait, |
||
23 | InjectionAwareTrait; |
||
24 | |||
25 | |||
26 | |||
27 | /** |
||
28 | * @var $data description |
||
29 | */ |
||
30 | //private $data; |
||
31 | |||
32 | |||
33 | |||
34 | /** |
||
35 | * Show all items. |
||
36 | * |
||
37 | * @return void |
||
38 | */ |
||
39 | 1 | public function getIndex() |
|
40 | { |
||
41 | 1 | $title = "View | Comments"; |
|
42 | 1 | $view = $this->di->get("view"); |
|
43 | 1 | $pageRender = $this->di->get("pageRender"); |
|
44 | 1 | $comment2 = new Comment(); |
|
45 | 1 | $comment2->setDb($this->di->get("db")); |
|
46 | |||
47 | $data = [ |
||
48 | 1 | "items" => $comment2->findAll(), |
|
49 | 1 | ]; |
|
50 | |||
51 | 1 | $view->add("incl/header", ["title" => ["Book", "css/style.css"]]); |
|
52 | 1 | $view->add("incl/side-bar1"); |
|
53 | 1 | $view->add("comment/viewAll", $data); |
|
54 | 1 | $view->add("incl/side-bar2"); |
|
55 | 1 | $view->add("incl/footer"); |
|
56 | |||
57 | 1 | $pageRender->renderPage(["title" => $title]); |
|
58 | 1 | } |
|
59 | |||
60 | 1 | View Code Duplication | public function comment2Create() |
0 ignored issues
–
show
|
|||
61 | { |
||
62 | 1 | $session = $this->di->get("session"); |
|
63 | 1 | $userId = $session->get("user_id"); |
|
64 | |||
65 | 1 | if (!$userId) { |
|
66 | 1 | $this->di->get("response")->redirect(""); |
|
67 | 1 | } |
|
68 | |||
69 | 1 | $title = "Create | Comment"; |
|
70 | 1 | $view = $this->di->get("view"); |
|
71 | 1 | $pageRender = $this->di->get("pageRender"); |
|
72 | 1 | $comment2 = new Com2Create($this->di); |
|
73 | |||
74 | 1 | $comment2->check(); |
|
75 | |||
76 | $data = [ |
||
77 | 1 | "form" => $comment2->getHTML(), |
|
78 | 1 | ]; |
|
79 | |||
80 | |||
81 | 1 | $view->add("incl/header", ["title" => ["Book", "../css/style.css"]]); |
|
82 | 1 | $view->add("incl/side-bar1"); |
|
83 | 1 | $view->add("comment/create", $data); |
|
84 | 1 | $view->add("incl/side-bar2"); |
|
85 | 1 | $view->add("incl/footer"); |
|
86 | |||
87 | 1 | $pageRender->renderPage(["title" => $title]); |
|
88 | 1 | } |
|
89 | |||
90 | 1 | View Code Duplication | public function comment2Update($id) |
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
91 | { |
||
92 | 1 | $session = $this->di->get("session"); |
|
93 | 1 | $userId = $session->get("user_id"); |
|
94 | |||
95 | 1 | if (!$userId) { |
|
96 | 1 | $this->di->get("response")->redirect(""); |
|
97 | 1 | } |
|
98 | |||
99 | 1 | $title = "Create | Comment"; |
|
100 | 1 | $view = $this->di->get("view"); |
|
101 | 1 | $pageRender = $this->di->get("pageRender"); |
|
102 | 1 | $comment2 = new Com2Update($this->di, $id); |
|
103 | |||
104 | 1 | $comment2->check(); |
|
105 | |||
106 | 1 | $data = [ |
|
107 | 1 | "form" => $comment2->getHTML(), |
|
108 | 1 | ]; |
|
109 | |||
110 | |||
111 | 1 | $view->add("incl/header", ["title" => ["Book", "../../css/style.css"]]); |
|
112 | 1 | $view->add("incl/side-bar1"); |
|
113 | 1 | $view->add("comment/create", $data); |
|
114 | 1 | $view->add("incl/side-bar2"); |
|
115 | 1 | $view->add("incl/footer"); |
|
116 | |||
117 | 1 | $pageRender->renderPage(["title" => $title]); |
|
118 | 1 | } |
|
119 | |||
120 | 1 | View Code Duplication | public function comment2Delete($id) |
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
121 | { |
||
122 | 1 | $session = $this->di->get("session"); |
|
123 | 1 | $userId = $session->get("user_id"); |
|
124 | |||
125 | 1 | if (!$userId) { |
|
126 | 1 | $this->di->get("response")->redirect(""); |
|
127 | 1 | } |
|
128 | |||
129 | 1 | $title = "Delete | Comment"; |
|
130 | 1 | $view = $this->di->get("view"); |
|
131 | 1 | $pageRender = $this->di->get("pageRender"); |
|
132 | 1 | $comment2 = new Com2Delete($this->di, $id); |
|
133 | |||
134 | 1 | $comment2->check(); |
|
135 | |||
136 | $data = [ |
||
137 | 1 | "form" => $comment2->getHTML(), |
|
138 | 1 | ]; |
|
139 | |||
140 | |||
141 | 1 | $view->add("incl/header", ["title" => ["Book", "../../css/style.css"]]); |
|
142 | 1 | $view->add("incl/side-bar1"); |
|
143 | 1 | $view->add("comment/create", $data); |
|
144 | 1 | $view->add("incl/side-bar2"); |
|
145 | 1 | $view->add("incl/footer"); |
|
146 | |||
147 | 1 | $pageRender->renderPage(["title" => $title]); |
|
148 | 1 | } |
|
149 | |||
150 | 1 | public function setUser() |
|
151 | { |
||
152 | 1 | $title = "Set | Session"; |
|
153 | 1 | $view = $this->di->get("view"); |
|
154 | 1 | $pageRender = $this->di->get("pageRender"); |
|
155 | 1 | $comment2 = new Com2Session($this->di); |
|
156 | |||
157 | 1 | $comment2->check(); |
|
158 | |||
159 | $data = [ |
||
160 | 1 | "form" => $comment2->getHTML(), |
|
161 | 1 | ]; |
|
162 | |||
163 | 1 | $view->add("incl/header", ["title" => ["Book", "../../css/style.css"]]); |
|
164 | 1 | $view->add("incl/side-bar1"); |
|
165 | 1 | $view->add("comment/default", $data); |
|
166 | 1 | $view->add("incl/side-bar2"); |
|
167 | 1 | $view->add("incl/footer"); |
|
168 | |||
169 | 1 | $pageRender->renderPage(["title" => $title]); |
|
170 | 1 | } |
|
171 | } |
||
172 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.