} if (ctype_digit($folderId)) { header('Location: templates.php?focus=' . $folderId); exit; } if (ctype_digit($_POST['folder_id'])) { header('Location: templates.php?focus=' . $_POST['folder_id']); exit; } header('Location: templates.php'); exit; } elseif ($_GET['page'] === 'delete-folder') { //Only folders that have no content in them can be deleted $folder_content_count = $template->getCountTemplatesInFolder($_GET['folder_id']); if ($folder_content_count < 1) { $template->markFolderAsDeleted($_GET['folder_id']); $loggers['audit']->info("Folder {$_GET['folder_id']} deleted"); } else { $loggers['audit']->warning("Attempted to delete non-empty folder {$_GET['folder_id']}"); } header('Location: templates.php'); exit; } elseif ($_GET['page'] === 'fetch-files-in-folder') { $items = $template->getTemplatesInFolder($_POST['folder_id']); if (!empty($items)) { foreach ($items as &$i) { $i['inserted_on'] = $l10nDate->format($i['inserted_on'], 'day_date_time'); } unset($i); } header('Content-Type: application/json; charset=utf-8');