21 lines
491 B
PHP
21 lines
491 B
PHP
|
|
<?php
|
|||
|
|
require_once($_SERVER['DOCUMENT_ROOT'] . "/config.php");
|
|||
|
|
|
|||
|
|
header('Content-Type: application/json');
|
|||
|
|
|
|||
|
|
if (!$_SESSION['superadmin']) {
|
|||
|
|
echo json_encode(['success' => false, 'error' => 'Доступ запрещён']);
|
|||
|
|
exit();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$id = isset($_POST['id']) ? (int)$_POST['id'] : 0;
|
|||
|
|
|
|||
|
|
if (!$id) {
|
|||
|
|
echo json_encode(['success' => false, 'error' => 'Не указан ID']);
|
|||
|
|
exit();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
Article::delete($id);
|
|||
|
|
Article::regenerateSitemap();
|
|||
|
|
echo json_encode(['success' => true]);
|