Update: 2026-05-15 04:41:45
This commit is contained in:
@@ -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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user