1
|
|
|
<?php
|
2
|
|
|
|
3
|
|
|
require_once __DIR__.'/../vendor/autoload.php';
|
4
|
|
|
|
5
|
|
|
use Alpha\Controller\Front\FrontController; |
6
|
|
|
use Alpha\Util\Config\ConfigProvider; |
7
|
|
|
use Alpha\Util\Http\Filter\ClientBlacklistFilter; |
8
|
|
|
use Alpha\Util\Http\Filter\IPBlacklistFilter; |
9
|
|
|
use Alpha\Util\Http\Filter\ClientTempBlacklistFilter; |
10
|
|
|
use Alpha\Util\Http\Request; |
11
|
|
|
use Alpha\Util\Http\Response; |
12
|
|
|
use Alpha\Exception\ResourceNotFoundException; |
13
|
|
|
use Alpha\Exception\ResourceNotAllowedException; |
14
|
|
|
use Alpha\View\View;
|
15
|
|
|
|
16
|
|
|
try {
|
17
|
|
|
$config = ConfigProvider::getInstance();
|
18
|
|
|
|
19
|
|
|
set_exception_handler('Alpha\Util\ErrorHandlers::catchException');
|
20
|
|
|
set_error_handler('Alpha\Util\ErrorHandlers::catchError', $config->get('php.error.log.level'));
|
21
|
|
|
|
22
|
|
|
$front = new FrontController();
|
23
|
|
|
|
24
|
|
|
if ($config->get('security.client.blacklist.filter.enabled')) {
|
25
|
|
|
$front->registerFilter(new ClientBlacklistFilter());
|
26
|
|
|
}
|
27
|
|
|
|
28
|
|
|
if ($config->get('security.ip.blacklist.filter.enabled')) {
|
29
|
|
|
$front->registerFilter(new IPBlacklistFilter());
|
30
|
|
|
}
|
31
|
|
|
|
32
|
|
|
if ($config->get('security.client.temp.blacklist.filter.enabled')) {
|
33
|
|
|
$front->registerFilter(new ClientTempBlacklistFilter());
|
34
|
|
|
}
|
35
|
|
|
|
36
|
|
|
$request = new Request();
|
37
|
|
|
$response = $front->process($request);
|
38
|
|
|
|
39
|
|
|
} catch (ResourceNotFoundException $rnfe) {
|
40
|
|
|
$response = new Response(404, View::renderErrorPage(404, $rnfe->getMessage(), array('Content-Type' => 'text/html')));
|
|
|
|
|
41
|
|
|
} catch (ResourceNotAllowedException $rnae) {
|
42
|
|
|
$response = new Response(403, View::renderErrorPage(403, $rnae->getMessage(), array('Content-Type' => 'text/html')));
|
|
|
|
|
43
|
|
|
}
|
44
|
|
|
|
45
|
|
|
if ($config->get('security.http.header.x.frame.options') != '' && $response->getHeader('X-Frame-Options') == null) {
|
46
|
|
|
$response->setHeader('X-Frame-Options', $config->get('security.http.header.x.frame.options'));
|
47
|
|
|
}
|
48
|
|
|
|
49
|
|
|
echo $response->send();
|
50
|
|
|
|
51
|
|
|
?> |
|
|
|
|
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.