familyHub/export.php
Louis Whittington 6d10cb4726 Implement banking system features and enhancements
- Added banking mode with checking, savings, and charity accounts, including auto-split options for income.
- Introduced banking transaction management, including transfers and charity outflows.
- Updated family settings to allow configuration of banking features and interest rates.
- Enhanced data export functionality to include bank transactions.
- Improved user interface to display banking information and donation goals.
- Updated documentation to reflect new banking features and settings.
2026-03-31 11:03:53 -05:00

32 lines
1.1 KiB
PHP

<?php
require_once __DIR__ . '/includes/db.php';
require_once __DIR__ . '/includes/utils.php';
require_once __DIR__ . '/config/config.php';
function exportData($type) {
ensureExportDirectory();
$data = readJsonFile($type . '.json');
$filename = generateExportFilename($type);
$exportPath = EXPORT_DESTINATION . '/' . $filename;
return file_put_contents($exportPath, json_encode($data, JSON_PRETTY_PRINT));
}
// Handle export request
if (isset($_GET['type'])) {
$type = sanitizeInput($_GET['type']);
if (in_array($type, [
'chores', 'groceries', 'meals', 'meal_plans', 'expenses',
'stores', 'grocery_lists', 'grocery_catalog', 'bank_transactions',
], true)) {
if (exportData($type)) {
echo json_encode(['success' => true, 'message' => 'Export successful']);
} else {
echo json_encode(['success' => false, 'message' => 'Export failed']);
}
} else {
echo json_encode(['success' => false, 'message' => 'Invalid export type']);
}
} else {
echo json_encode(['success' => false, 'message' => 'No export type specified']);
}