mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-22 05:12:25 +01:00
"only open office archives need to be repaired by \"zip -F\" (because a bug in php<5.3.1),
ms word files brake, when \"zip -F\" is run on them GRRRRRRRRRRRR"
This commit is contained in:
parent
141519d4e6
commit
30a8168747
@ -483,7 +483,7 @@ abstract class bo_merge
|
||||
case 'application/vnd.openxmlformats-officedocument.wordprocessingml.d': // mimetypes in vfs are limited to 64 chars
|
||||
$mimetype = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
|
||||
case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document':
|
||||
$archive = tempnam($GLOBALS['egw_info']['server']['temp_dir'], basename($document,'.dotx').'-').'.dotx';
|
||||
$archive = tempnam($GLOBALS['egw_info']['server']['temp_dir'], basename($document,'.docx').'-').'.docx';
|
||||
copy($content_url,$archive);
|
||||
$content_url = 'zip://'.$archive.'#'.($content_file = 'word/document.xml');
|
||||
$fix = array( // regular expression to fix garbled placeholders
|
||||
@ -519,7 +519,8 @@ abstract class bo_merge
|
||||
if ($zip->close() !== true) throw new Exception("!ZipArchive::close()");
|
||||
unset($zip);
|
||||
unset($merged);
|
||||
if (file_exists('/usr/bin/zip') && version_compare(PHP_VERSION,'5.3.1','<')) // fix broken zip archives generated by current php
|
||||
if (substr($mimetype,0,35) == 'application/vnd.oasis.opendocument.' && // only open office archives need that, ms word files brake
|
||||
file_exists('/usr/bin/zip') && version_compare(PHP_VERSION,'5.3.1','<')) // fix broken zip archives generated by current php
|
||||
{
|
||||
exec('/usr/bin/zip -F '.escapeshellarg($archive));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user