2019-09-13 10:45:07 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
$slug = $_POST['slug'];
|
2019-09-19 17:17:57 +02:00
|
|
|
$topic = $_POST['topic'];
|
|
|
|
$emails_json = json_decode(file_get_contents(__DIR__.'/emails.json'), true)[0];
|
|
|
|
if (!array_key_exists($topic, $emails_json)) {
|
|
|
|
header('HTTP/1.0 404 Not Found');
|
|
|
|
}
|
|
|
|
$emails_json = $emails_json[$topic];
|
2019-09-13 10:45:07 +02:00
|
|
|
$emails = [];
|
|
|
|
foreach ($emails_json as $email) {
|
|
|
|
$emails[$email['slug']] = $email;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!array_key_exists($slug, $emails)) {
|
|
|
|
header('HTTP/1.0 404 Not Found');
|
|
|
|
}
|
|
|
|
|
|
|
|
$email = $emails[$slug];
|
|
|
|
|
|
|
|
header('Content-Type: application/json');
|
|
|
|
die(json_encode($email));
|