From: Alan Knowles Date: Fri, 5 Jun 2020 04:31:01 +0000 (+0800) Subject: GnumericToExcel.php X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=commitdiff_plain;h=ab97b92de6a60c2512ff77c0d7ed82fb891c9a68 GnumericToExcel.php --- diff --git a/GnumericToExcel.php b/GnumericToExcel.php index 824db5be..d4188412 100644 --- a/GnumericToExcel.php +++ b/GnumericToExcel.php @@ -71,14 +71,14 @@ class Pman_Core_GnumericToExcel extends Pman $mime = 'application/vnd.ms-excel'; if (!empty($_POST['format']) && $_POST['format']=='xlsx') { $outfmt = 'Gnumeric_Excel:xlsx'; - $ext = '.xlsx'; + $ext = 'xlsx'; $mime = 'aapplication/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; } $srcTmp = ini_get('session.save_path') . '/' .uniqid('gnumeric_').'.gnumeric'; - $targetTmp = ini_get('session.save_path') . '/' .uniqid('gnumeric_') . $ext; + $targetTmp = ini_get('session.save_path') . '/' .uniqid('gnumeric_') . '.' . $ext; // write the gnumeric file... $fh = fopen($srcTmp,'w'); fwrite($fh, $xml); @@ -107,7 +107,7 @@ class Pman_Core_GnumericToExcel extends Pman if (empty($fname)) { $fname = basename($targetTmp); } - $fname .= preg_match('/\.xls/i', $fname) ? '' : '.xls'; // make sure it ends in xls.. + $fname .= preg_match('/\.' . $ext . '/i', $fname) ? '' : ('.' . $ext); // make sure it ends in xls.. header('Content-type: ' . $mime); header('Content-Disposition: attachment; filename="' .addslashes($fname). '"');