Add blog extension
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
phpb_requires_authenticated();
|
||||
if (($_SERVER['REQUEST_METHOD'] ?? '') !== 'POST') {
|
||||
http_response_code(405);
|
||||
exit();
|
||||
}
|
||||
if (!phpb_validate_csrf()) {
|
||||
http_response_code(403);
|
||||
exit();
|
||||
}
|
||||
|
||||
$deleted = false;
|
||||
try {
|
||||
if (isset($_POST['id']) && is_string($_POST['id']) && ctype_digit($_POST['id']) && (int) $_POST['id'] > 0) {
|
||||
$deleted = (new \Plugi\Extensions\Blog\CategoriesRepository())->destroy((int) $_POST['id']);
|
||||
}
|
||||
} catch (\Throwable) {
|
||||
$deleted = false;
|
||||
}
|
||||
phpb_redirect(phpb_url('website_manager', ['tab' => 'ext--blog', 'action' => 'categories']), [
|
||||
'message-type' => $deleted ? 'success' : 'error',
|
||||
'message' => $deleted ? 'Category deleted; associated posts are uncategorized.' : 'The category could not be deleted.',
|
||||
]);
|
||||
Reference in New Issue
Block a user