Update: 2026-05-15 04:41:45

This commit is contained in:
Hamza-Ayed
2026-05-15 04:41:45 +03:00
parent 2f1ecca593
commit 698d0df01e
3 changed files with 27 additions and 6 deletions

View File

@@ -21,9 +21,15 @@ use PhpOffice\PhpSpreadsheet\Style\Fill;
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
use PhpOffice\PhpSpreadsheet\Style\Color;
// Enable error reporting for debugging
ini_set('display_errors', '1');
error_reporting(E_ALL);
// Autoload PhpSpreadsheet
require_once ROOT_PATH . '/vendor/autoload.php';
try {
// Auth: Support both Bearer header and ?token= query param (for download links)
$token = $_GET['token'] ?? null;
if (!$token) {
@@ -392,3 +398,10 @@ $writer->save('php://output');
$spreadsheet->disconnectWorksheets();
unset($spreadsheet);
exit;
} catch (\Exception $e) {
if (ob_get_length()) ob_end_clean();
header('Content-Type: text/plain; charset=utf-8');
file_put_contents(STORAGE_PATH . '/logs/export_errors.log', "[" . date('Y-m-d H:i:s') . "] " . $e->getMessage() . "\n" . $e->getTraceAsString(), FILE_APPEND);
die("خطأ في التصدير: " . $e->getMessage());
}