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 | * Configuration file for DI container. |
||
4 | */ |
||
5 | return [ |
||
6 | |||
7 | // Services to add to the container. |
||
8 | "services" => [ |
||
9 | "request" => [ |
||
10 | "shared" => true, |
||
11 | "callback" => function () { |
||
12 | $obj = new \Anax\Request\Request(); |
||
13 | $obj->init(); |
||
14 | return $obj; |
||
15 | } |
||
16 | ], |
||
17 | "response" => [ |
||
18 | "shared" => true, |
||
19 | //"callback" => "\Anax\Response\Response", |
||
20 | "callback" => function () { |
||
21 | $obj = new \Anax\Response\ResponseUtility(); |
||
22 | $obj->setDI($this); |
||
0 ignored issues
–
show
|
|||
23 | return $obj; |
||
24 | } |
||
25 | ], |
||
26 | "url" => [ |
||
27 | "shared" => true, |
||
28 | "callback" => function () { |
||
29 | $obj = new \Anax\Url\Url(); |
||
30 | $request = $this->get("request"); |
||
0 ignored issues
–
show
|
|||
31 | $obj->setSiteUrl($request->getSiteUrl()); |
||
32 | $obj->setBaseUrl($request->getBaseUrl()); |
||
33 | $obj->setStaticSiteUrl($request->getSiteUrl()); |
||
34 | $obj->setStaticBaseUrl($request->getBaseUrl()); |
||
35 | $obj->setScriptName($request->getScriptName()); |
||
36 | $obj->configure("url.php"); |
||
37 | $obj->setDefaultsFromConfiguration(); |
||
38 | return $obj; |
||
39 | } |
||
40 | ], |
||
41 | "router" => [ |
||
42 | "shared" => true, |
||
43 | "callback" => function () { |
||
44 | $obj = new \Anax\Route\Router(); |
||
45 | $obj->setDI($this); |
||
0 ignored issues
–
show
|
|||
46 | $obj->configure("route.php"); |
||
47 | return $obj; |
||
48 | } |
||
49 | ], |
||
50 | "view" => [ |
||
51 | "shared" => true, |
||
52 | "callback" => function () { |
||
53 | $obj = new \Anax\View\ViewCollection(); |
||
54 | $obj->setDI($this); |
||
0 ignored issues
–
show
|
|||
55 | $obj->configure("view.php"); |
||
56 | return $obj; |
||
57 | } |
||
58 | ], |
||
59 | "viewRenderFile" => [ |
||
60 | "shared" => true, |
||
61 | "callback" => function () { |
||
62 | $obj = new \Anax\View\ViewRenderFile2(); |
||
63 | $obj->setDI($this); |
||
0 ignored issues
–
show
|
|||
64 | return $obj; |
||
65 | } |
||
66 | ], |
||
67 | "session" => [ |
||
68 | "shared" => true, |
||
69 | "callback" => function () { |
||
70 | $obj = new \Anax\Session\SessionConfigurable(); |
||
71 | $obj->configure("session.php"); |
||
72 | $obj->start(); |
||
73 | return $obj; |
||
74 | } |
||
75 | ], |
||
76 | "textfilter" => [ |
||
77 | "shared" => true, |
||
78 | "callback" => "\Anax\TextFilter\TextFilter", |
||
79 | ], |
||
80 | "pageRender" => [ |
||
81 | "shared" => true, |
||
82 | "callback" => function () { |
||
83 | $obj = new \Anax\Page\PageRender(); |
||
84 | $obj->setDI($this); |
||
0 ignored issues
–
show
|
|||
85 | return $obj; |
||
86 | } |
||
87 | ], |
||
88 | "errorController" => [ |
||
89 | "shared" => true, |
||
90 | "callback" => function () { |
||
91 | $obj = new \Anax\Page\ErrorController(); |
||
92 | $obj->setDI($this); |
||
0 ignored issues
–
show
|
|||
93 | return $obj; |
||
94 | } |
||
95 | ], |
||
96 | "debugController" => [ |
||
97 | "shared" => true, |
||
98 | "callback" => function () { |
||
99 | $obj = new \Anax\Page\DebugController(); |
||
100 | $obj->setDI($this); |
||
0 ignored issues
–
show
|
|||
101 | return $obj; |
||
102 | } |
||
103 | ], |
||
104 | "flatFileContentController" => [ |
||
105 | "shared" => true, |
||
106 | "callback" => function () { |
||
107 | $obj = new \Anax\Page\FlatFileContentController(); |
||
108 | $obj->setDI($this); |
||
0 ignored issues
–
show
|
|||
109 | return $obj; |
||
110 | } |
||
111 | ], |
||
112 | "commentFrontController" => [ |
||
113 | "shared" => true, |
||
114 | "callback" => function () { |
||
115 | $obj = new \Nicklas\Comment\FrontController(); |
||
116 | $obj->setDI($this); |
||
0 ignored issues
–
show
|
|||
117 | return $obj; |
||
118 | } |
||
119 | ], |
||
120 | "pageRenderComment" => [ |
||
121 | "shared" => true, |
||
122 | "callback" => function () { |
||
123 | $obj = new \Nicklas\Page\PageRenderMock(); |
||
124 | $obj->setDI($this); |
||
0 ignored issues
–
show
|
|||
125 | return $obj; |
||
126 | } |
||
127 | ], |
||
128 | "pageRenderComment2" => [ |
||
129 | "shared" => true, |
||
130 | "callback" => function () { |
||
131 | $obj = new \Nicklas\Page\PageRender(); |
||
132 | $obj->setDI($this); |
||
0 ignored issues
–
show
|
|||
133 | return $obj; |
||
134 | } |
||
135 | ], |
||
136 | "db" => [ |
||
137 | "shared" => false, |
||
138 | "callback" => function () { |
||
139 | $obj = new \Anax\Database\DatabaseQueryBuilder(); |
||
140 | $obj->configure("sqlitedatabase.php"); |
||
141 | $obj->connect(); |
||
142 | |||
143 | |||
144 | |||
145 | // SETUP ALL TABLES |
||
146 | // USER |
||
147 | $sql = 'CREATE TABLE `coffee_users` |
||
148 | ( |
||
149 | `id` INTEGER PRIMARY KEY NOT NULL, |
||
150 | `name` VARCHAR(100) NOT NULL UNIQUE, |
||
151 | `email` VARCHAR(100), |
||
152 | `pass` VARCHAR(255) NOT NULL, |
||
153 | `authority` VARCHAR(255) NOT NULL, |
||
154 | `created` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, |
||
155 | `question` text |
||
156 | )'; |
||
157 | $obj->execute($sql); |
||
158 | |||
159 | // QUESTIONs TABLE |
||
160 | $sql = 'CREATE TABLE `coffee_questions` |
||
161 | ( |
||
162 | `id` INTEGER PRIMARY KEY NOT NULL, |
||
163 | `user` VARCHAR(100) NOT NULL, |
||
164 | `acceptedId` int, |
||
165 | `title` text, |
||
166 | `tags` text, |
||
167 | `created` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, |
||
168 | `status` VARCHAR(20) DEFAULT active, |
||
169 | |||
170 | FOREIGN KEY (`user`) REFERENCES `coffee_users` (`name`) |
||
171 | )'; |
||
172 | $obj->execute($sql); |
||
173 | |||
174 | // POSTS TABLE |
||
175 | $sql = 'CREATE TABLE `coffee_posts` |
||
176 | ( |
||
177 | `id` INTEGER PRIMARY KEY NOT NULL, |
||
178 | `questionId` int, |
||
179 | `accepted` VARCHAR(100) DEFAULT "no", |
||
180 | `user` VARCHAR(100) NOT NULL, |
||
181 | `type` text, -- question or answer |
||
182 | `text` text, |
||
183 | `created` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, |
||
184 | |||
185 | FOREIGN KEY (`user`) REFERENCES `coffee_users` (`name`), |
||
186 | FOREIGN KEY (`questionId`) REFERENCES `coffee_questions` (`id`) |
||
187 | )'; |
||
188 | $obj->execute($sql); |
||
189 | |||
190 | |||
191 | // POSTS TABLE |
||
192 | $sql = 'CREATE TABLE `coffee_comments` |
||
193 | ( |
||
194 | `id` INTEGER PRIMARY KEY NOT NULL, |
||
195 | `user` VARCHAR(100) NOT NULL, |
||
196 | `parentId` INT, |
||
197 | `text` text, |
||
198 | `created` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, |
||
199 | |||
200 | FOREIGN KEY (`user`) REFERENCES `coffee_users` (`name`), |
||
201 | FOREIGN KEY (`parentId`) REFERENCES `coffee_posts` (`id`) |
||
202 | )'; |
||
203 | $obj->execute($sql); |
||
204 | |||
205 | |||
206 | // POSTS TABLE |
||
207 | $sql = 'CREATE TABLE `coffee_votes` |
||
208 | ( |
||
209 | `id` INTEGER PRIMARY KEY NOT NULL, |
||
210 | `user` VARCHAR(100) NOT NULL, |
||
211 | `parentId` int, |
||
212 | `parentType` text, -- comment/question/answer |
||
213 | `upVote` INT, |
||
214 | `downVote` INT, |
||
215 | |||
216 | FOREIGN KEY (`user`) REFERENCES `coffee_users` (`name`) |
||
217 | )'; |
||
218 | $obj->execute($sql); |
||
219 | |||
220 | |||
221 | |||
222 | |||
223 | $sql = 'INSERT INTO `coffee_users` (`name`, `email`, `pass`, `authority`, `question`) VALUES |
||
224 | ("admin", "[email protected]", "$2y$10$Oo8aC.3U9NlfrSBO3W5bG.jByboAvCRA/UuTwAx9uJOb5BlOVh0xC", "admin", "lasagne"), |
||
225 | ("nicklas766", "[email protected]", "$2y$10$Oo8aC.3U9NlfrSBO3W5bG.jByboAvCRA/UuTwAx9uJOb5BlOVh0xC", "user", "lasagne"), |
||
226 | ("anders", "[email protected]", "$2y$10$Oo8aC.3U9NlfrSBO3W5bG.jByboAvCRA/UuTwAx9uJOb5BlOVh0xC", "user", "lasagne"), |
||
227 | ("kalle", "[email protected]", "$2y$10$Oo8aC.3U9NlfrSBO3W5bG.jByboAvCRA/UuTwAx9uJOb5BlOVh0xC", "user", "lasagne"), |
||
228 | ("sven", "[email protected]", "$2y$10$Oo8aC.3U9NlfrSBO3W5bG.jByboAvCRA/UuTwAx9uJOb5BlOVh0xC", "user", "lasagne"), |
||
229 | ("jessica", "[email protected]", "$2y$10$Oo8aC.3U9NlfrSBO3W5bG.jByboAvCRA/UuTwAx9uJOb5BlOVh0xC", "user", "lasagne"), |
||
230 | ("user", "[email protected]", "$2y$10$Oo8aC.3U9NlfrSBO3W5bG.jByboAvCRA/UuTwAx9uJOb5BlOVh0xC", "user", "lasagne")'; |
||
231 | $obj->execute($sql); |
||
232 | |||
233 | // --------------------------------------------- QUESTIONs 1 |
||
234 | $sql = 'INSERT INTO `coffee_questions` (`user`, `title`, `tags`) VALUES |
||
235 | ("kalle", "Fråga om kaffe koppar", "mugg,kaffe")'; |
||
236 | $obj->execute($sql); |
||
237 | |||
238 | $sql = 'INSERT INTO `coffee_posts` (`questionId`, `user`, `type`, `text`) VALUES |
||
239 | (1, "kalle", "question", "Hej bör kaffe drickas ur tjocka koppar eller smala? Vad gillar ni mest? Personligen så föredrar jag smala."), |
||
240 | (1, "sven", "answer", "Bra fråga, troligtvis något många glömmer att tänka på. Jag har bara tjocka kaffekoppar hemma."), |
||
241 | (1, "jessica", "answer", "Personligen så föredrar jag att variera, varför använda endast en?")'; |
||
242 | $obj->execute($sql); |
||
243 | |||
244 | $sql = 'INSERT INTO `coffee_comments` (`parentId`, `user`, `text`) VALUES |
||
245 | (2, "kalle", "Ok tack för ditt svar Sven!"), |
||
246 | (3, "sven", "Hmm, du har en poäng jag ska köpa några smala koppar idag.")'; |
||
247 | $obj->execute($sql); |
||
248 | |||
249 | // --------------------------------------------- QUESTIONs 2 |
||
250 | $sql = 'INSERT INTO `coffee_questions` (`user`, `title`, `tags`) VALUES |
||
251 | ("nicklas766", "Vilken tésort bör jag köpa?", "té,tésort,kaffe")'; |
||
252 | $obj->execute($sql); |
||
253 | |||
254 | $sql = 'INSERT INTO `coffee_posts` (`questionId`, `user`, `type`, `text`) VALUES |
||
255 | (2, "nicklas766", "question", "Hej alla! Vilken tésort bör jag köpa? Gärna att den är rik med antioxidanter."), |
||
256 | (2, "sven", "answer", "Jag gillar roobius, köp den!")'; |
||
257 | $obj->execute($sql); |
||
258 | |||
259 | $sql = 'INSERT INTO `coffee_comments` (`parentId`, `user`, `text`) VALUES |
||
260 | (4, "kalle", "Jag älskar té, men detta är fel hemsida.."), |
||
261 | (5, "kalle", "uppmuntra honom inte..")'; |
||
262 | $obj->execute($sql); |
||
263 | |||
264 | |||
265 | // --------------------------------------------- LIKES |
||
266 | $sql = 'INSERT INTO `coffee_votes` (`user`, `parentId`, `parentType`, `upVote`, `downVote`) VALUES |
||
267 | ("kalle", 1, "post", 1, null), |
||
268 | ("sven", 1, "post", null, 1), |
||
269 | ("anders", 1, "post", null, 1), |
||
270 | ("jessica", 1, "post", null, 1), |
||
271 | ("kalle", 1, "comment", null, 1), |
||
272 | ("sven", 1, "comment", 1, null), |
||
273 | ("anders", 1, "comment", 1, null), |
||
274 | ("jessica", 1, "comment", 1, null)'; |
||
275 | $obj->execute($sql); |
||
276 | |||
277 | |||
278 | return $obj; |
||
279 | } |
||
280 | ], |
||
281 | ], |
||
282 | ]; |
||
283 |
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.