finish author system

This commit is contained in:
isUnknown 2024-10-16 08:53:53 +02:00
parent db8669d30d
commit fe6e01acdf
38 changed files with 614 additions and 73 deletions

View file

@ -6,8 +6,20 @@ return array(
'menu' => require __DIR__ . '/menu.php',
'css' => 'assets/css/panel.css'
),
'email' => [
'transport' => [
'type' => 'smtp',
'host' => 'smtp.outlook.com',
'port' => 587,
'security' => 'tls',
'auth' => true,
'username' => 'adrien.payet@outlook.com',
'password' => 't8nVpxCpEZcqH8y'
]
],
'routes' => array(
require __DIR__ . '/routes/virtual-author.php',
require __DIR__ . '/routes/virtual-category.php',
require __DIR__ . '/routes/send-newsletter.php',
),
);

View file

@ -11,12 +11,21 @@ return [
'texts' => [
'icon' => 'pen',
'label' => 'Textes',
'link' => 'pages/texts',
'link' => 'pages/textes',
'current' => function ($current) {
$path = Kirby::instance()->request()->path()->toString();
return Str::contains($path, 'pages/texts');
return Str::contains($path, 'pages/textes');
}
],
'authors' => [
'icon' => 'users',
'label' => 'Auteurs',
'link' => 'pages/auteurs',
'current' => function ($current) {
$path = Kirby::instance()->request()->path()->toString();
return Str::contains($path, 'pages/auteurs');
}
],
'-',
'-',
'infos' => [
@ -30,11 +39,11 @@ return [
],
'newsletter' => [
'icon' => 'email',
'label' => 'Infolettre',
'link' => 'pages/lettre',
'label' => 'Liste de diffusion',
'link' => 'pages/liste-de-diffusion',
'current' => function ($current) {
$path = Kirby::instance()->request()->path()->toString();
return Str::contains($path, 'pages/lettre');
return Str::contains($path, 'pages/liste-de-diffusion');
}
],
'-',

View file

@ -0,0 +1,24 @@
<?php
return [
'pattern' => '/send-newsletter.json',
'method' => 'POST',
'action' => function () {
$jsonRequest = file_get_contents("php://input");
$request = json_decode($jsonRequest);
$kirby = kirby();
try {
$kirby->email([
'from' => "adrien.payet@outlook.com",
'to' => 'payet.adrien@protonmail.com',
'subject' => 'actualités',
'body' => 'Ceci est un test simple.',
]);
return json_encode(['status' => 'success', 'message' => 'Email envoyé avec succès.']);
} catch (Exception $error) {
return json_encode(['status' => 'error', 'message' => $error->getMessage()]);
}
}
];