| Server IP : 173.209.174.21 / Your IP : 216.73.216.89 Web Server : Apache/2.4.58 (Ubuntu) System : Linux wcfs-server 6.8.0-124-generic #124-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 13:00:45 UTC 2026 x86_64 User : nodor ( 1000) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/wcfs/tabs/ |
Upload File : |
<?php
include 'protect.php';
include 'db.php';
include 'store_settings.php';
require_once __DIR__ . '/qbo_name_map_helpers.php';
require_once __DIR__ . '/export_helpers.php';
$month = isset($_REQUEST['month']) ? trim((string) $_REQUEST['month']) : '';
$includeArchived = !empty($_REQUEST['include_archived']);
$mapQboNames = !empty($_REQUEST['map_qbo_names']);
if (!preg_match('/^\d{4}-\d{2}$/', $month)) {
http_response_code(400);
echo 'Please choose a valid export month.';
exit;
}
if ($mapQboNames) {
try {
$mappingFile = isset($_FILES['mapping_file']) ? $_FILES['mapping_file'] : array();
$fileError = isset($mappingFile['error']) ? (int) $mappingFile['error'] : UPLOAD_ERR_NO_FILE;
if ($fileError === UPLOAD_ERR_NO_FILE) {
qboNameMapLoadSaved($conn);
} else {
qboNameMapStoreUploadedFile($conn, $mappingFile);
}
} catch (Exception $e) {
http_response_code(400);
echo htmlspecialchars($e->getMessage(), ENT_QUOTES, 'UTF-8');
exit;
}
}
$storeName = 'HouseTabPro';
if (isset($_SESSION['store_name']) && $_SESSION['store_name'] !== '') {
$storeName = $_SESSION['store_name'];
} elseif (isset($_SESSION['store_db']) && $_SESSION['store_db'] !== '') {
$storeName = $_SESSION['store_db'];
}
$filename = exportFilenameForStore($storeName, $month, $mapQboNames);
$csvContent = exportCsvStringForMonth($conn, $month, $includeArchived, $mapQboNames);
header('Content-Type: text/csv; charset=UTF-8');
header('Content-Disposition: attachment; filename="' . $filename . '"');
echo $csvContent;
exit;