This commit is contained in:
Lizandro Guarnizo
2026-01-21 22:51:57 -05:00
parent 32f5f580f7
commit a70b8f36b5
3 changed files with 49 additions and 1 deletions
+10 -1
View File
@@ -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();