Update directory structure

This commit is contained in:
Florine W. Dekker 2022-08-14 16:49:52 +02:00
parent 7dd14b0416
commit c5531d21cf
Signed by: FWDekker
GPG Key ID: D3DCFAA8A4560BE0
9 changed files with 18 additions and 16 deletions

View File

@ -17,7 +17,7 @@ module.exports = grunt => {
files: [{expand: true, cwd: "src/main/", src: "**/*.html", dest: "dist/", flatten: true}]
},
php: {
files: [{expand: true, cwd: "src/main/", src: "**/*.php", dest: "dist/", flatten: true}]
files: [{expand: true, cwd: "src/main/", src: "**/*.php", dest: "dist/", flatten: false}]
},
},
focus: {

View File

@ -1,7 +1,7 @@
{
"name": "fwdekker/death-notifier",
"description": "Get notified when a famous person dies.",
"version": "0.0.3",
"version": "0.0.4",
"type": "project",
"license": "MIT",
"homepage": "https://git.fwdekker.com/tools/death-notifier",
@ -23,7 +23,7 @@
},
"autoload": {
"psr-4": {
"main\\": "./"
"php\\": "php/"
}
},
"minimum-stability": "stable"

View File

@ -1,6 +1,6 @@
{
"name": "death-notifier",
"version": "0.0.3",
"version": "0.0.4",
"description": "Get notified when a famous person dies.",
"author": "Florine W. Dekker",
"browser": "dist/bundle.js",

View File

@ -1,13 +1,13 @@
<?php
namespace main;
use Exception;
use Monolog\ErrorHandler;
use Monolog\Handler\BrowserConsoleHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Logger;
use SQLite3;
use php\Mailer;
use php\Mediawiki;
use php\Response;
use php\TrackingManager;
use php\UserManager;
/** @noinspection PhpIncludeInspection Exists after `npm run deploy` */
require_once __DIR__ . "/vendor/autoload.php";
@ -62,7 +62,8 @@ function generate_csrf_token(): string
}
session_start();
$_SESSION["token"] = generate_csrf_token();
if (!isset($_SESSION["token"]))
$_SESSION["token"] = generate_csrf_token();
// Read JSON from POST
$_POST = json_decode(file_get_contents("php://input"), associative: true);
@ -200,7 +201,7 @@ if (isset($_POST["action"])) {
$response = match ($_GET["action"]) {
"get-user-data" => validate_logged_in() ?? $user_manager->get_user_data($_SESSION["uuid"]),
"list-trackings" => validate_logged_in() ?? $tracking_manager->list_trackings($_SESSION["uuid"]),
"is-alive" => $mediawiki->people_are_alive(array("Janelle Monáe", "John Malkovich", "Adolf Hitler")),
"is-alive" => $mediawiki->people_are_alive(array("John Cusack", "Cameron Diaz", "John Malkovich")),
default => new Response("Unknown GET action '" . $_GET["action"] . "'.", false),
};
} else {

View File

@ -1,6 +1,6 @@
<?php
namespace main;
namespace php;
use Monolog\Logger;
use PHPMailer\PHPMailer\Exception;

View File

@ -1,6 +1,6 @@
<?php
namespace main;
namespace php;
use Exception;
use Monolog\Logger;
@ -87,6 +87,7 @@ class Mediawiki
$pages = array_values($response["query"]["pages"]);
$page_names = array_column($pages, "title");
$page_categories = array_column($pages, "categories");
// TODO: Differentiate between living, dead, missing, presumed dead, etc.
$is_alive = fn($it): bool => in_array("Category:Living people", array_column($it, "title"));
$alive_results = array_combine($page_names, array_map($is_alive, $page_categories));

View File

@ -1,6 +1,6 @@
<?php
namespace main;
namespace php;
/**

View File

@ -1,6 +1,6 @@
<?php
namespace main;
namespace php;
use Monolog\Logger;
use SQLite3;

View File

@ -1,6 +1,6 @@
<?php
namespace main;
namespace php;
use Exception;
use Monolog\Logger;