first commit

This commit is contained in:
2025-03-07 10:04:42 +00:00
commit f3a71e8d12
23 changed files with 732 additions and 0 deletions

47
public/css/blog.css Normal file
View File

@ -0,0 +1,47 @@
body {
background-color: #121212;
color: #e0e0e0;
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
}
.container {
width: 90%;
max-width: 800px;
padding: 20px;
}
.post {
padding: 15px;
border-bottom: 1px solid #333;
}
.post a {
color: #bb86fc;
text-decoration: none;
}
.post a:hover {
text-decoration: underline;
}
.back {
display: block;
margin: 20px 0;
color: #bb86fc;
text-decoration: none;
}
.back:hover {
text-decoration: underline;
}
@media (max-width: 600px) {
.container {
width: 100%;
padding: 10px;
}
}

34
public/index.php Normal file
View File

@ -0,0 +1,34 @@
<?php
error_reporting(E_ALL);
ini_set("display_errors", 1);
session_start([
'cookie_lifetime' => 86400,
'cookie_secure' => true,
'cookie_httponly' => true,
'cookie_samesite' => 'Strict'
]);
if(empty($_SESSION['token']))
$_SESSION['token'] = bin2hex(random_bytes(32));
require_once __DIR__ . "/../vendor/autoload.php";
use Blog\Core\router;
use Blog\Core\container;
use Blog\Template\twig;
use Blog\Utils\authHelper;
AuthHelper::initialize(new Blog\Model\userModel());
$router = new Router();
$container = new Container();
$container->set('twig', fn() => new Twig(__DIR__ . "/../views"));
$container->set('postModel', fn() => new Blog\Model\postModel());
require_once __DIR__ . "/../routes/web.php";
$router->dispatch(
new Blog\Http\request($_SERVER['REQUEST_METHOD'], $_SERVER['REQUEST_URI']),
new Blog\Http\response
);