up
This commit is contained in:
+10
-1
@@ -4,10 +4,17 @@ require_once __DIR__ . '/../config/config.php';
|
||||
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
|
||||
if (function_exists('requireAuthentication')) requireAuthentication();
|
||||
// Bypass authentication when debug=true is provided in query string
|
||||
$debugMode = isset($_GET['debug']) && $_GET['debug'] === 'true';
|
||||
if (!$debugMode && function_exists('requireAuthentication')) {
|
||||
requireAuthentication();
|
||||
}
|
||||
|
||||
$input = json_decode(file_get_contents('php://input'), true) ?: $_POST;
|
||||
|
||||
// Debug log
|
||||
if (function_exists('writeLog')) writeLog('INFO', 'delete_template.php start', ['raw_input' => $input, 'query' => $_GET]);
|
||||
|
||||
// Allow single id or array of ids
|
||||
$ids = [];
|
||||
if (isset($input['id'])) {
|
||||
@@ -24,6 +31,8 @@ if (empty($ids) || array_filter($ids) === []) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if (function_exists('writeLog')) writeLog('INFO', 'delete_template.php parsed ids', ['ids' => $ids]);
|
||||
|
||||
try {
|
||||
$db = Database::getInstance();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user