Compare commits
No commits in common. "d666593fde99cabaf3421f3610d0ce7c44da1cd7" and "a6ba53764bd5e17a805c2a67165dafc04ad7d412" have entirely different histories.
d666593fde
...
a6ba53764b
@ -10,7 +10,7 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"esoko/soko-web": "0.10",
|
||||
"esoko/soko-web": "0.7",
|
||||
"fzaninotto/faker": "^1.9"
|
||||
},
|
||||
"require-dev": {
|
||||
|
8
composer.lock
generated
8
composer.lock
generated
@ -4,15 +4,15 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "db04b12ad70bbdfe83841fa292277ec6",
|
||||
"content-hash": "cadf44c9030f1d63cb602a2ddb77db7e",
|
||||
"packages": [
|
||||
{
|
||||
"name": "esoko/soko-web",
|
||||
"version": "0.10",
|
||||
"version": "v0.7",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://git.esoko.eu/esoko/soko-web.git",
|
||||
"reference": "fd286c9cffadc4a26609bfa00944f8014a2f3f59"
|
||||
"reference": "88a2a99527b51dfb240ec78ac7070dc36a1022b6"
|
||||
},
|
||||
"require": {
|
||||
"phpmailer/phpmailer": "^6.8",
|
||||
@ -33,7 +33,7 @@
|
||||
"GNU GPL 3.0"
|
||||
],
|
||||
"description": "Lightweight web framework",
|
||||
"time": "2023-05-02T10:55:47+00:00"
|
||||
"time": "2023-04-30T18:20:27+00:00"
|
||||
},
|
||||
{
|
||||
"name": "fzaninotto/faker",
|
||||
|
21
web.php
21
web.php
@ -4,7 +4,6 @@ use SokoWeb\Response\HttpResponse;
|
||||
use SokoWeb\Routing\RouteCollection;
|
||||
use SokoWeb\Session\DatabaseSessionHandler;
|
||||
use SokoWeb\Request\Request;
|
||||
use SokoWeb\Request\Session;
|
||||
use MapGuesser\Controller\MapsController;
|
||||
use MapGuesser\Controller\HomeController;
|
||||
use MapGuesser\Controller\LoginController;
|
||||
@ -91,21 +90,27 @@ Container::$routeCollection->group('admin', function (RouteCollection $routeColl
|
||||
});
|
||||
|
||||
if (isset($_COOKIE['COOKIES_CONSENT'])) {
|
||||
Container::$sessionHandler = new DatabaseSessionHandler(
|
||||
Container::$dbConnection,
|
||||
'sessions',
|
||||
new DateTime('-7 days')
|
||||
);
|
||||
Container::$sessionHandler = new DatabaseSessionHandler(Container::$dbConnection);
|
||||
|
||||
session_set_save_handler(Container::$sessionHandler, true);
|
||||
session_start([
|
||||
'gc_probability' => 0, // old sessions are deleted by MaintainDatabaseCommand
|
||||
'cookie_lifetime' => 0,
|
||||
'cookie_lifetime' => 604800,
|
||||
'cookie_path' => '/',
|
||||
'cookie_httponly' => true,
|
||||
'cookie_samesite' => 'Lax'
|
||||
]);
|
||||
|
||||
if (isset($_COOKIE[session_name()])) {
|
||||
// extend session cookie lifetime is cookie already exists
|
||||
setcookie(session_name(), session_id(), [
|
||||
'expires' => time() + 604800,
|
||||
'path' => '/',
|
||||
'httponly' => true,
|
||||
'samesite' => 'Lax'
|
||||
]);
|
||||
}
|
||||
|
||||
// this is needed to handle old type of session IDs
|
||||
if (!Container::$sessionHandler->validateId(session_id())) {
|
||||
session_regenerate_id(true);
|
||||
@ -119,7 +124,7 @@ Container::$request = new Request(
|
||||
$_GET,
|
||||
$_POST,
|
||||
getallheaders(),
|
||||
new Session($_SESSION),
|
||||
$_SESSION,
|
||||
new UserRepository()
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user