Handle 404s on feed edit page (#4)
This commit is contained in:
parent
da9a569e4a
commit
480228013c
@ -25,19 +25,24 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
$feedId = $isNew ? $result['ok'] : $_POST['id'];
|
||||
} else {
|
||||
add_error($result['error']);
|
||||
$feedId = 'error';
|
||||
}
|
||||
}
|
||||
|
||||
if ($feedId == 'new') {
|
||||
$feed = [ 'id' => $_GET['id'], 'url' => '' ];
|
||||
$title = 'Add RSS Feed';
|
||||
$feed = [ 'id' => $_GET['id'], 'url' => '' ];
|
||||
} else {
|
||||
$feed = Data::retrieveFeedById((int) $feedId, $db);
|
||||
if (!$feed) {
|
||||
http_response_code(404);
|
||||
die();
|
||||
}
|
||||
$title = 'Edit RSS Feed';
|
||||
if ($feedId == 'error') {
|
||||
$feed = ['id' => $_POST['id'] ?? '', 'url' => $_POST['url'] ?? ''];
|
||||
} else {
|
||||
$feed = Data::retrieveFeedById((int) $feedId, $db);
|
||||
if (!$feed) {
|
||||
http_response_code(404);
|
||||
die();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
page_head($title); ?>
|
||||
|
Loading…
Reference in New Issue
Block a user