aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-10-24 11:37:29 +0200
committerGitHub <noreply@github.com>2020-10-24 11:37:29 +0200
commit820cae27cfcc94af552818f3f1e5342e00478f6c (patch)
tree20eb1cd95987088a7afc3602e8b712448ef05a93 /index.php
parent8f6e3d51ccb2df513aadeabafbc5bfffe38b8608 (diff)
parentb38a1b0209f546d4824a0db81a34c4e30fcdebaf (diff)
downloadShaarli-820cae27cfcc94af552818f3f1e5342e00478f6c.tar.gz
Shaarli-820cae27cfcc94af552818f3f1e5342e00478f6c.tar.zst
Shaarli-820cae27cfcc94af552818f3f1e5342e00478f6c.zip
Merge pull request #1601 from ArthurHoaro/feature/psr3
Diffstat (limited to 'index.php')
-rw-r--r--index.php19
1 files changed, 17 insertions, 2 deletions
diff --git a/index.php b/index.php
index b6ee8ebc..1b10ee41 100644
--- a/index.php
+++ b/index.php
@@ -25,9 +25,12 @@ require_once 'application/Utils.php';
25 25
26require_once __DIR__ . '/init.php'; 26require_once __DIR__ . '/init.php';
27 27
28use Katzgrau\KLogger\Logger;
29use Psr\Log\LogLevel;
28use Shaarli\Config\ConfigManager; 30use Shaarli\Config\ConfigManager;
29use Shaarli\Container\ContainerBuilder; 31use Shaarli\Container\ContainerBuilder;
30use Shaarli\Languages; 32use Shaarli\Languages;
33use Shaarli\Security\BanManager;
31use Shaarli\Security\CookieManager; 34use Shaarli\Security\CookieManager;
32use Shaarli\Security\LoginManager; 35use Shaarli\Security\LoginManager;
33use Shaarli\Security\SessionManager; 36use Shaarli\Security\SessionManager;
@@ -48,10 +51,22 @@ if ($conf->get('dev.debug', false)) {
48 }); 51 });
49} 52}
50 53
54$logger = new Logger(
55 dirname($conf->get('resource.log')),
56 !$conf->get('dev.debug') ? LogLevel::INFO : LogLevel::DEBUG,
57 ['filename' => basename($conf->get('resource.log'))]
58);
51$sessionManager = new SessionManager($_SESSION, $conf, session_save_path()); 59$sessionManager = new SessionManager($_SESSION, $conf, session_save_path());
52$sessionManager->initialize(); 60$sessionManager->initialize();
53$cookieManager = new CookieManager($_COOKIE); 61$cookieManager = new CookieManager($_COOKIE);
54$loginManager = new LoginManager($conf, $sessionManager, $cookieManager); 62$banManager = new BanManager(
63 $conf->get('security.trusted_proxies', []),
64 $conf->get('security.ban_after'),
65 $conf->get('security.ban_duration'),
66 $conf->get('resource.ban_file', 'data/ipbans.php'),
67 $logger
68);
69$loginManager = new LoginManager($conf, $sessionManager, $cookieManager, $banManager, $logger);
55$loginManager->generateStaySignedInToken($_SERVER['REMOTE_ADDR']); 70$loginManager->generateStaySignedInToken($_SERVER['REMOTE_ADDR']);
56 71
57// Sniff browser language and set date format accordingly. 72// Sniff browser language and set date format accordingly.
@@ -71,7 +86,7 @@ date_default_timezone_set($conf->get('general.timezone', 'UTC'));
71 86
72$loginManager->checkLoginState(client_ip_id($_SERVER)); 87$loginManager->checkLoginState(client_ip_id($_SERVER));
73 88
74$containerBuilder = new ContainerBuilder($conf, $sessionManager, $cookieManager, $loginManager); 89$containerBuilder = new ContainerBuilder($conf, $sessionManager, $cookieManager, $loginManager, $logger);
75$container = $containerBuilder->build(); 90$container = $containerBuilder->build();
76$app = new App($container); 91$app = new App($container);
77 92